mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Invoke getUbuntuSrcPkg to get current Ubuntu version
This commit is contained in:
parent
440ead9328
commit
764290cb9a
15
syncpackage
15
syncpackage
@ -19,6 +19,7 @@
|
|||||||
# ##################################################################
|
# ##################################################################
|
||||||
|
|
||||||
import os, os.path, sys, urllib, subprocess, shutil
|
import os, os.path, sys, urllib, subprocess, shutil
|
||||||
|
from ubuntutools.requestsync.lp import getUbuntuSrcPkg
|
||||||
|
|
||||||
def retrieve_file(url):
|
def retrieve_file(url):
|
||||||
'''Download file (by URL) to the current directory.
|
'''Download file (by URL) to the current directory.
|
||||||
@ -30,18 +31,6 @@ def retrieve_file(url):
|
|||||||
print 'downloading', url
|
print 'downloading', url
|
||||||
urllib.urlretrieve(url, fname)
|
urllib.urlretrieve(url, fname)
|
||||||
|
|
||||||
def cur_version(sourcepkg, release):
|
|
||||||
madison = subprocess.Popen(['apt-cache', 'madison', sourcepkg], stdout=subprocess.PIPE)
|
|
||||||
out = madison.communicate()[0]
|
|
||||||
assert (madison.returncode == 0)
|
|
||||||
|
|
||||||
for l in out.splitlines():
|
|
||||||
(pkg, version, aptsrc) = l.split('|')
|
|
||||||
if aptsrc.endswith('Sources') and aptsrc.find(release) > 0:
|
|
||||||
return version.strip()
|
|
||||||
|
|
||||||
raise Exception('apt-cache madison does not contain %s/%s' % (sourcepkg, release))
|
|
||||||
|
|
||||||
def dsc_getfiles(dsc):
|
def dsc_getfiles(dsc):
|
||||||
'''Return list of files in a .dsc file (excluding the .dsc file itself).'''
|
'''Return list of files in a .dsc file (excluding the .dsc file itself).'''
|
||||||
|
|
||||||
@ -77,7 +66,7 @@ basepath = os.path.dirname(dscurl)
|
|||||||
(srcpkg, new_ver) = dscname.split('_')
|
(srcpkg, new_ver) = dscname.split('_')
|
||||||
new_ver = new_ver[:-4] # strip off '.dsc'
|
new_ver = new_ver[:-4] # strip off '.dsc'
|
||||||
|
|
||||||
cur_ver = cur_version(srcpkg, release)
|
cur_ver = getUbuntuSrcPkg(srcpkg, release).getVersion()
|
||||||
|
|
||||||
retrieve_file(dscurl)
|
retrieve_file(dscurl)
|
||||||
files = dsc_getfiles(dscname)
|
files = dsc_getfiles(dscname)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user