Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #
- # Insert into /etc/apt/apt.conf.d/50apt-gentoo:
- #
- # DPkg {
- # Pre-Install-Pkgs { "/path/to/apt-gentoo || true"; };
- # };
- import time
- import random
- import urllib2
- import fileinput
- from debian import debfile
- import sys, StringIO, gzip
- from launchpadlib.launchpad import Launchpad
- launchpad = Launchpad.login_anonymously("apt-gentoo", "production")
- ubuntu = launchpad.distributions["ubuntu"]
- archive = ubuntu.main_archive
- def get_build_log_url(sources):
- for source in sources:
- for build in source.getBuilds():
- if (build.arch_tag == pkg_data['Architecture']) and build.build_log_url:
- return build.build_log_url
- for filename in fileinput.input():
- pkg_data = debfile.DebFile(filename.strip()).debcontrol()
- if 'Source' in pkg_data:
- source_pkg = pkg_data['Source']
- else:
- source_pkg = pkg_data['Package']
- sources = archive.getPublishedSources(source_name=source_pkg, version=pkg_data['Version'])
- url = get_build_log_url(sources)
- if not url:
- continue
- f = urllib2.urlopen(url)
- compresseddata = f.read()
- compressedstream = StringIO.StringIO(compresseddata)
- gzipper = gzip.GzipFile(fileobj=compressedstream)
- log = gzipper.read()
- for line in log.splitlines():
- print line
- time.sleep(random.random() * 0.09)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement