| from launchpadlib.launchpad import Launchpad | |
| from launchpadlib.uris import lookup_service_root | |
| instance = lookup_service_root('production') | |
| launchpad = Launchpad.login_with('lp-shell', instance, version='devel') | |
| loaded = launchpad.load('/~snappy-dev/+snap/core') | |
| for build in loaded.builds: | |
| if build.store_upload_revision == 1689: | |
| break | |
| for manifest in build.getFileUrls(): | |
| if manifest.endswith('.manifest'): | |
| break | |
| import httplib2 | |
| h = httplib2.Http(".cache") | |
| (resp_headers, content) = h.request(manifest, "GET") | |
| import subprocess | |
| import apt | |
| cache = apt.Cache() | |
| packages = [] | |
| for line in content.split('\n'): | |
| if line: | |
| line = line.replace('\t', ' ') | |
| package, version = line.split() | |
| _p = package.split(':') | |
| if len(_p) > 1: | |
| package, arch = _p | |
| pn1 = "%s-dbgsym:%s" % (package, arch) | |
| pn2 = "%s-dbg:%s" % (package, arch) | |
| else: | |
| pn1 = "%s-dbgsym" % package | |
| pn2 = "%s-dbg" % package | |
| did_one = False | |
| if pn1 in cache: | |
| if version in cache[pn1].versions: | |
| packages.append("%s=%s" % (pn1, version)) | |
| did_one = True | |
| if pn2 in cache: | |
| if version in cache[pn2].versions: | |
| packages.append("%s=%s" % (pn2, version)) | |
| did_one = True | |
| if not did_one: | |
| print "Could not find deubg package for ", line | |
| subprocess.check_call("apt-get -qq download " + ' '.join(packages), shell=True) | |
| import glob | |
| for deb_file in glob.glob("*.deb") + glob.glob("*.ddeb"): | |
| _ = subprocess.check_call("dpkg -x %s root/" % deb_file, shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment