Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
[ Patch #3180 ] Single quote, double quote and curly brace completion patch
dpurgin:
Hi oBFusCATed,
1. Yep, sure. The whitespace patch is:
--- Code: ---diff -uNrp codeblocks-10.05-release/src/sdk/cbeditor.cpp codeblocks-10.05-release.new/src/sdk/cbeditor.cpp
--- codeblocks-10.05-release/src/sdk/cbeditor.cpp 2010-05-22 16:10:05.000000000 +0600
+++ codeblocks-10.05-release.new/src/sdk/cbeditor.cpp 2011-06-30 15:48:42.496262953 +0600
@@ -1678,7 +1678,8 @@ bool cbEditor::Save()
{
if(m_pData->m_strip_trailing_spaces)
{
- m_pData->StripTrailingSpaces();
+ // very annoying call
+ //m_pData->StripTrailingSpaces();
}
if(m_pData->m_ensure_consistent_line_ends)
{
--- End code ---
2. I've learned these steps from Fedora's custom kernel tutorial.
At first, you should have some rpm and yum utils:
--- Code: ---$ su -c 'yum install rpmdevtools yum-utils'
--- End code ---
Then you set up rpm development tree. After that you'll see ~/rpmbuild/SPECS, ~/rpmbuild/RPMS, ~/rpmbuild/BUILD and so on. I have done this in my home directory:
--- Code: ---$ cd ~
$ rpmdev-setuptree
--- End code ---
Then you have to download the source package (say, for codeblocks the source RPM would be codeblocks-10.05-4.fc14.src.rpm), install its dependencies and the package itself:
--- Code: ---$ yumdownloader --source codeblocks
$ su -c 'yum-builddep codeblocks-10.05-4.fc14.src.rpm'
$ rpm -ihv codeblocks-10.05-4.fc14.src.rpm
--- End code ---
Note, that the last rpm command should be executed under regular user (non-root). The original source archive and all the patches of your distribution will be installed to ~/rpmbuild/SOURCES without any hierarchy (which is not really convenient, when developing several rpms).
Next step is to prepare the source tree, using the .spec file for your package:
--- Code: ---$ cd ~/rpmbuild/SPECS
$ rpmbuild -bb --target=$(uname -m) codeblocks.spec
--- End code ---
After that you will have the sources deployed to ~/rpmbuild/BUILD/codeblocks-10.05-release
Then you should copy the original source tree:
--- Code: ---$ cd ~/rpmbuild/BUILD
$ cp -r codeblocks-10.05-release codeblocks-10.05-release.new
--- End code ---
Then you modify the sources in codeblocks-10.05-release.new as you wish.
After you're done with editing, you make a patch using diff and put it to the ~/rpmbuild/SOURCES directory:
--- Code: ---$ cd ~/rpmbuild/BUILD
$ diff -uNrp codeblocks-10.05-release codeblocks-10.05-release.new > ../SOURCES/codeblocks-my.patch
--- End code ---
Then you should edit .spec-file in order to include your patch to RPM build. Spec-files have similar structure, but its content differs, so you should check your package's spec. What you have to do is: find list of patches, add your own patch to the list, find the patch commands and add your patching command there. You should also change release number, so that your newly build packages are not messed with the original. For ~/rpmbuild/SPECS/codeblocks.spec:
--- Code: ---Name: codeblocks
Version: 10.05
Release: 4%{?dist} # here you put your release. For example, 4a%{?dist}, then packages will have version 10.05-4a.fc14
Summary: An open source, cross platform, free C++ IDE
Group: Development/Tools
--- End code ---
here go distribution patches:
--- Code: ---Patch2: %{name}-dso.patch
# update for tinyxml 2.6
Patch3: %{name}-tinyxml-26.patch
# D support - svn revisions 6553-6556
Patch4: %{name}-10.05-D.patch
# we add our own patch to the list:
Patch5: %{name}-my.patch # %{name} will be substituted with "codeblocks"
--- End code ---
here goes patch application:
--- Code: ---%prep
%setup -q -n %{name}-%{version}-release
%patch1 -p1 -b .tinyxml
%patch2 -p1 -b .dso
%patch3 -p1 -b .tinyxml-26
%patch4 -p1 -b .D
# we add our own patch
%patch5 -p1 -b .my
--- End code ---
After these steps all you have to do is to build the rpms using the modified .spec:
--- Code: ---$ rpmbuild -bb --target=$(uname -m) codeblocks.spec
--- End code ---
You will have your RPMs under ~/rpmbuild/RPMS/<architecture>/
I also add these packages to exclude statement in /etc/yum.conf, so that they are not crashed by update.
Hope this helps.
Cheers!
oBFusCATed:
Hm,
Does stripping of the trailing spaces work with your patch?
This is a feature of C::B and I like it a lot, when dealing with my source.
If you've disabled it completely, this is not the correct way to do it - there is an option which does the same.
dpurgin:
Yep, just the call is commented out, so no line is stripped. I've understood your concern - a bit later I'll modify this so that only the current line won't be stripped, that is what I actually needed, not every line :)
MortenMacFly:
--- Quote from: dpurgin on June 30, 2011, 11:54:27 am ---1. Yep, sure. The whitespace patch is:
--- End quote ---
Are you kidding? Why don't you simple disable this options in the editor settings: Settings -> Editor, section "End-of-line options" -> "Strip trailing blanks"??? :shock:
dpurgin:
MortenMacFly, thanks for reply - I haven't noticed that option! :D
My code is a dirty hack, I know, but with respect of proposal of oBFusCATed, the aim now is NOT to strip the current line when saving, while leave the others to be stripped. I've tried the trunk code - when "Strip trailing blanks" is on, then the current line is still stripped.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version