Mailinglist Archive: zypp-devel (83 mails)

< Previous Next >
[zypp-devel] [OT] multiple source file renames
  • From: Jano Kupec <jkupec@xxxxxxx>
  • Date: Sat, 21 Jun 2008 19:52:41 +0200
  • Message-id: <485D3FE9.8000305@xxxxxxx>
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@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >