#!/usr/bin/python2 -O # vim:sw=4 et # Script for bumping www-client/google-chrome # Run this from the google-chrome pacakge directory. # Depends on dev-python/python-debian. from glob import glob import os import shutil import subprocess from debian import deb822 from urllib2 import urlopen category = 'www-client' pn = 'google-chrome' #pkgdir = portdir + os.sep + category + os.sep + pn #distdir = portage.settings['DISTDIR'] #manifest = portage.Manifest(pkgdir, distdir) chanmap = { 'beta': '_beta', 'stable': '_p', 'unstable': '_alpha' } oldebuilds = dict() for channel in chanmap: oldebuilds[channel] = sorted(glob("*" + chanmap[channel] + "*.ebuild"), reverse=True) urlfile = urlopen('http://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages') #urlfile = urlopen('http://dl.google.com/linux/chrome/deb/dists/stable/main/binary-i386/Packages') packages = urlfile.readlines() urlfile.close() newebuilds = dict() for pkg in deb822.Packages.iter_paragraphs(packages): channel = pkg['Package'].split('-')[2] version, revision = pkg['Version'].split('-r') #filename = pkg['Filename'].split('/')[-1] ebuild = pn + "-" + version + chanmap[channel] + revision + ".ebuild" if channel not in newebuilds: newebuilds[channel] = list() newebuilds[channel].append(ebuild) for channel in chanmap: for ebuild in newebuilds[channel]: if ebuild not in oldebuilds[channel]: source = oldebuilds[channel][0] print "copy " + source + " " + ebuild shutil.copyfile(source, ebuild) print "cvs add " + ebuild subprocess.call(['cvs', 'add', ebuild]) for ebuild in oldebuilds[channel]: if ebuild not in newebuilds[channel]: print "cvs rm -f " + ebuild subprocess.call(['cvs', 'rm', '-f', ebuild]) subprocess.call(['repoman', 'manifest'])