[zypp-devel] [OT] multiple source file renames
Hi, i'm wondering what is your opinion on this. Before starting with coding for 11.1 i intend to reorganize zypper's sources a bit to avoid too much typing (each file has 'zypper-' prefix), to reduce compilation time, and to split zypper-misc.* and zypper-utils.* which currently mix too much stuff together. All to make the code easier and more pleasant to work with. Some of this is obvious, but the rename part first. I intend to do the following: #!/bin/bash mv zypper.h Zypper.h mv zypper.cc Zypper.cc mv zypper-command.h Command.h mv zypper-command.cc Command.cc # remove 'zypper-' prefix from the sources for file in $(ls zypper-*); do mv $file ${file:7}; done # move callback headers to separate folder and remove the -callbacks prefix mkdir callbacks for file in $(ls *-callbacks.h); do mv $file callbacks/${file%-callbacks\.h}.h; done # adapt include paths sed -i -e 's/zypper\.h/Zypper.h/g' $(grep -Rl 'zypper\.h' *) sed -i -e 's/zypper\.cc/Zypper.cc/g' $(grep -Rl 'zypper\.cc' *) sed -i -e 's/zypper-command\.\(h\|cc\)/Command.\1/g' $(grep -Rl 'zypper-command\.\(h\|cc\)' *) sed -i -e 's/zypper-\(.*\.\(h\|cc\)\)/\1/g' $(grep -Rl 'zypper-.*\.\(h\|cc\)' *) sed -i -e 's/\(\w*\)-callbacks\.h/callbacks\/\1.h/g' $(grep -Rl '\w*-callbacks\.h' *) for file in $(find -name '*.h'); do file1=${file:2} regex=${file1/\.h/\\\.h} regex=${regex/\//\\\/}; sed -i -e "s/\"$regex\"/\"..\\/$regex\"/g" callbacks/* done An obvious disadvantage is that it will be more difficult to apply patches from the modified source tree into the old one. But i still think it's worth it(?). Or is there an easy way how to do this with subversion? Otherwise a script for adapting patch files would be needed. Or a script reverting what the above script does. Or one would need to apply patches file by file. cheers, jano -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Sat, Jun 21, 2008 at 07:52:41PM +0200, Jano Kupec wrote:
An obvious disadvantage is that it will be more difficult to apply patches from the modified source tree into the old one. But i still think it's worth it(?).
Or is there an easy way how to do this with subversion? Otherwise a script for adapting patch files would be needed. Or a script reverting what the above script does. Or one would need to apply patches file by file.
I haven't checked Subversion. I suggest creating a simple script that transforms patches from one name set to another: sed ' s@/Zypper.h@/zypper.h@ s@/Command.h@/zypper-command.h@ ... ' -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
Hi, On Sat, 21 Jun 2008, Jano Kupec wrote:
i'm wondering what is your opinion on this. Before starting with coding for 11.1 i intend to reorganize zypper's sources a bit to avoid too much typing (each file has 'zypper-' prefix), to reduce compilation time, and to split zypper-misc.* and zypper-utils.* which currently mix too much stuff together. All to make the code easier and more pleasant to work with.
Some of this is obvious, but the rename part first. I intend to do the following:
Bah! 1) Never rename source files: breaks patches without good reason. 2) Don't use capitals in file names: useless use of keypresses. 3) Use "svn mv" 4) Goto 1 If anything, merge the split step with the rename, i.e. move functions from the old big files into new small files named to your liking. The hoops you are trying to jump through to make patches work should make it pretty obvious that this renaming is not a clever idea. Just IMO :) zypper is mostly your child, so in the end what really matters is your preference, in that case please at least do (3) ;-) Ciao, Michael. -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
Michael Matz wrote:
Hi,
On Sat, 21 Jun 2008, Jano Kupec wrote:
i'm wondering what is your opinion on this. Before starting with coding for 11.1 i intend to reorganize zypper's sources a bit to avoid too much typing (each file has 'zypper-' prefix), to reduce compilation time, and to split zypper-misc.* and zypper-utils.* which currently mix too much stuff together. All to make the code easier and more pleasant to work with.
Some of this is obvious, but the rename part first. I intend to do the following:
Bah! 1) Never rename source files: breaks patches without good reason. 2) Don't use capitals in file names: useless use of keypresses. 3) Use "svn mv" 4) Goto 1
If anything, merge the split step with the rename, i.e. move functions from the old big files into new small files named to your liking.
The hoops you are trying to jump through to make patches work should make it pretty obvious that this renaming is not a clever idea.
Thanx! I thought it might turn out good after all, if the hoops will take less energy than the energy saved by working with the renamed sources. :O) Considering also there will not be many patches from SLE11 to SLE10 (probably none), just a few from 11.1 to 11.0.
Just IMO :) zypper is mostly your child, so in the end what really matters is your preference, in that case please at least do (3) ;-)
Of course, i intended to, what i wrote in my initial mail was just to show how will the source tree look. j. -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
participants (4)
-
Jan Kupec
-
Jano Kupec
-
Martin Vidner
-
Michael Matz