Tuesday, May 05, 2009

moving debian repository from one machine (running etch) to another (running lenny) is not as trivial as i thought it would be.well, it not hard ether, is just that you should do few things before the new machine is happy, up and running. the problem lies in the fact that you're moving from reprepro version 1.3.1+1-1 to version 3.5.2-6:. now that's a proper jump, ain't it ;)

once i moved all them pretty repo files, users, keys used for signing and so on, to a new server i tried adding new deb package to the repostiry:
~#reprepro --ask-passphrase -A all -Vb . includedeb unstable filename-v1.deb
didn't go. it said that something is wrong with this line in the conf/distributions:
SignWith="Key UID"
but when i change it to
SignWith=yes
the error message was gone.
then i run two more commands:
reprepro translatefilelists
this command translate the file list cache within db/contents.cache.db into the new format used since reprepro 3.0.0.
reprepro collectnewchecksums
this command, according to the man page, calculate all supported checksums for all files in the pool. (Versions prior to 3.3 did only store md5sums, 3.3 added sha1).
after this i was able to add/remove packages to the repository :))

little addition to repo story:
i had a request where i was asked to get all the files from stable (deb and rpm), tar and send them to x.
it was easy for rpm's:
find . -name *.rpm -exec cp -p {} /wherever-rpm-stable-is/ \;
tar zvpfc packages_from_rpm_stables_release.tar.gz

for deb is bit (just a bit) harder ;) to make easy here's the simple script:

#!/bin/sh
BASE_DIR=/something/something/deb
STABLE_PACKAGE_NAME=(`exec sudo reprepro -b $BASE_DIR listfilter stable Package | awk '{print $2"_"$3}' | sort -u`)
cnt_number_of_packages=${#STABLE_PACKAGE_NAME[@]}
rm -rf /tmp/totar #just in case
current=`exec pwd`
mkdir /tmp/totar
for (( i = 0 ; i < cnt_number_of_packages ; i++ ))
do
find $BASE_DIR -name ${STABLE_PACKAGE_NAME[$i]}_*.deb -exec cp -p {} /tmp/totar/ \;
done
cd /tmp/totar
tar zvpfc packages_from_deb_stable_release.tar.gz *
cp *.gz $current
cd $current
rm -rf /tmp/totar
echo file: `exec ls -lh packages_from_deb_stable_release.tar.gz | awk '{print $8,$5}'` is ready