Hi everybody I 've written a bash script and 2 small python files, to fix a problem I found in apt-mirror. I don't know if I don't use correctly apt-mirror. I give my problem and the script which solve the problem.
before that I don't understand this error ???:
Use of uninitialized value $config{"options"} in pattern match (m//) at
/usr/bin/apt-mirror line 300, <CONFIG> line 17.
The problem: When I run the apt-mirror it gives the size to download to
update my local repos
if I run it again it gives the same (or approxiamativl) size to download,
so noting is added to my repos, when I check I found many packages not
updated. Here is the example ( just a part of the output)
:
5.4 GiB will be downloaded into archive.
Downloading 231 archive files using 20 threads...
Begin time: Thu Jul 6 09:17:29 2017
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]...
[11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]...
[1]... [0]...
End time: Thu Jul 6 09:20:34 2017
4.5 MiB in 22 files and 0 directories can be freed.
--------------------------------------------
just after that if run a get the same size to download
5.4 GiB will be downloaded into archive.
Downloading 207 archive files using 20 threads...
Begin time: Thu Jul 6 09:36:56 2017
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]...
[11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]...
[1]... [0]...
End time: Thu Jul 6 09:37:26 2017
4.5 MiB in 22 files and 0 directories can be freed
MYSOLUTION: maybe somebody wants to use or improves them
I send in attached file 3 scripts : aptMirrorMod.sh ,
OfficialPackages.py and differences.py
The goal of them scripts is to determine the packages which are different
in the local and remote mirror ( the size is different or not installed at
all).
It is not necessary to check the checksum since the remote site (official)
is supposed correct.
I hope these programs will serve some people
best regrads
### OfficialPackages.py
## Construct the legal name for Package
## from nam, version, ...
s=open('Size.txt', 'r')
p=open('Paq.txt', 'r')
v=open('Vers.txt', 'r')
a=open('Arch.txt', 'r')
fd=open('remotePackages.sort', 'w')
while 1:
ss=s.readline()
if ss=='': break
pp = p.readline()
vv = v.readline()
aa = a.readline()
ls=len(ss)
sss=ss[0:ls-1]
ls=len(pp)
ppp=pp[0:ls-1]
ls=len(vv)
vvv=vv[0:ls-1]
ls=len(aa)
aaa=aa[0:ls-1]
res= sss+'\t'+ppp+'_'+vvv+'_'+aaa+'.deb\n'
fd.write(res)
s.close()
p.close()
v.close()
a.close()
fd.close()
### differences.py program
## gives the list of the missed Packages
## or the wrong size Package
## comparing to the official site
r=open('remotePackages.sort', 'r') ### The oficial Packages
p=open('localPackages.sort', 'r') ### local Files
fd=open('Result.sort', 'w')
while 1:
pp=p.readline()
if pp=='': break
ppp=pp.split()
rr = r.readline()
rrr=rr.split()
while rrr[1] < ppp[1]:
res=rrr[0]+" "+ rrr[1]+ "\t\t\t 000000 \t\t missing\n"
print (res)
fd.write(res)
rr = r.readline()
rrr=rr.split()
aaa=rrr[0]+" "+ rrr[1]+ " \t\t"+ rrr[0]+" "+ rrr[1]+'\n'
print(aaa)
fd.write(aaa)
p.close()
r.close()
aptMirrorMod.sh
Description: Bourne shell script

