Bug#128818: apt-get update using rsync protocol
Hi,
here is my code for doing that:
#! /usr/bin/python
# GPL v2 code. Radim Kolar
import string
import os
SOURCES='/etc/apt/sources.list'
LISTS='/var/lib/apt/lists/'
ARCH='i386'
RSYNCOPT='-t -b'
#read sources.list
f=open(SOURCES)
lines=f.readlines()
f.close()
for line in lines:
data=line.split()
if len(data)==0:
continue # skip empty lines
if data[0][0:0]=='#':
continue # and comments
if data[0]!='deb':
continue # we are not interrested in them also
if data[1][0:5]=='cdrom':
continue # no CD
i=string.find(data[1],"://")
if i==-1: continue
basefn=data[1][i+3:]
#data[2]==distribution
#data[3]..parts
basefn=basefn+'/dists/'+data[2]+'/'
for part in data[3:]:
fn=basefn+part
fn=fn+"/binary-"+ARCH+"/Packages"
COMMAND='rsync '+RSYNCOPT+' rsync://'+fn+' '+LISTS+string.replace(fn,'/','_')
print COMMAND
os.system(COMMAND)
os.system('apt-cache gencaches')
Reply to: