cleaning after apt-mirror
Hi, I created a local mirror for testing distro using apt-mirror. the /var/clean.sh The problem is when I ran it again, the old packages are still there, the /var/clean.sh didn't clean the old version !!!??? so I wrote a script to clean it, I attach my script. I am not satisfied by my script. I sorted the package in descending order and kept the first and deleted others. this seemed correct, unfortunately some packages are not in the good order when the word beta is used, so it dropped the good and kept the bad. especially when there is something like +b1_i386.deb in audacious-plugins_3.4.3-2+b1_i386.deb. When there is no special character like + and extra b1, no problem, just with that name, which is I think , a temporary name. please if anyone has a better script or idea, here are my script, I sort with python3, cause shell didn't do the task well ?? the second with awk/ ## sort.py sort file in decrease order ### filename is read from the keyboard aa=input(Give the filename to sort : ) ff=aa.split() for j in ff: print (j) for j in ff: o=open(j, r); a=o.readlines() b=sorted(a, reverse=True) out=j+T f=open(out, w); for i in b: f.write(i) f.close() o.close() #!/usr/bin/gawk -f ### this script keps just the first ###and deletes the others # when the first field is the same ###the name ends by the _ BEGIN { FS=_ t1=z ### we initialise the t1 to arbitary word not in the packages ### the file is suposed sorted in decreasing order # see the script sort.py } { if ( $1 == t1) { print I delete the file $0 system(rm $0) } t1=$1 } any idea is welcome, thank a lot best regards
Re: cleaning after apt-mirror
On Tue, 07 Oct 2014, Abdelkader Belahcene wrote: I am not satisfied by my script. I sorted the package in descending order and kept the first and deleted others. this seemed correct, It's not correct. You must sort on the basis of version number, which does not necessarily increase lexically. When there is no special character like + and extra b1, no problem, just with that name, which is I think , a temporary name. +b1 usually indicates a binary rebuild of a source package, and when we have them in the archive, you want them. please if anyone has a better script or idea, here are my script, I sort with python3, cause shell didn't do the task well ?? the second with awk/ The proper way to clean an archive is to remove package versions which are both: 1) Not present in the Packages file referenced by the Release file that you're using 2) Have a version number less than the version in the Packages file. #2 is optional, but will keep you from churning if your Packages file is slightly outdated. apt-mirror should really have a function to do this sort of cleaning for you; if it doesn't, please consider extending it to have one in collaboration with apt-mirror upstream. -- Don Armstrong http://www.donarmstrong.com It's brief and bright, dear children; bright and brief. Delight's the lightning; the long thunder's grief. -- John Frederick Nims Poetry in Motion p31 -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20141007162719.gf6...@teltox.donarmstrong.com
Re: Re: cleaning after apt-mirror
thanks for reply, but the problem is 2) Have a version number less than the version in the Packages file. look at these packages: main/m/mutter/gir1.2-mutter-3.0_3.12.2-2_i386.deb main/m/mutter/gir1.2-mutter-3.0_3.12.2-2+b1_i386.deb the sort gives gir1.2-mutter-3.0_3.12.2-2_i386.deb more recent, but in fact gir1.2-mutter-3.0_3.12.2-2+b1_i386.deb is more recent regards
Re: cleaning after apt-mirror
On Tue, 07 Oct 2014, Abdelkader Belahcene wrote: but the problem is 2) Have a version number less than the version in the Packages file. look at these packages: main/m/mutter/gir1.2-mutter-3.0_3.12.2-2_i386.deb main/m/mutter/gir1.2-mutter-3.0_3.12.2-2+b1_i386.deb the sort gives gir1.2-mutter-3.0_3.12.2-2_i386.deb more recent, but in fact gir1.2-mutter-3.0_3.12.2-2+b1_i386.deb is more recent That's because sort sorts lexically, not by version numbers. See dpkg --compare-versions '3.12.2-2' '' '3.12.2-2+b1' \ echo Yes, -2+b1 is greater than -2. for example. -- Don Armstrong http://www.donarmstrong.com A people living under the perpetual menace of war and invasion is very easy to govern. It demands no social reforms. It does not haggle over expenditures on armaments and military equipment. It pays without discussion, it ruins itself, and that is an excellent thing for the syndicates of financiers and manufacturers for whom patriotic terrors are an abundant source of gain. -- Anatole France -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20141007190327.gh23...@rzlab.ucr.edu