mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 16:11:15 +00:00
Replace spaces by tabs.
This commit is contained in:
parent
51dc6ffb7e
commit
5964d3d6cb
72
syncpackage
72
syncpackage
@ -23,45 +23,45 @@ import os, os.path, sys, urllib, subprocess, shutil
|
|||||||
from ubuntutools.requestsync.lp import getUbuntuSrcPkg
|
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.
|
||||||
|
|
||||||
If the file is already present, this function does nothing.'''
|
If the file is already present, this function does nothing.'''
|
||||||
|
|
||||||
fname = os.path.basename(url)
|
fname = os.path.basename(url)
|
||||||
if not os.path.exists(fname):
|
if not os.path.exists(fname):
|
||||||
print 'downloading', url
|
print 'downloading', url
|
||||||
urllib.urlretrieve(url, fname)
|
urllib.urlretrieve(url, fname)
|
||||||
|
|
||||||
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).'''
|
||||||
|
|
||||||
f = open(dsc)
|
f = open(dsc)
|
||||||
files = []
|
files = []
|
||||||
|
|
||||||
# skip until 'Files:'
|
# skip until 'Files:'
|
||||||
for l in f:
|
for l in f:
|
||||||
if l.strip() == 'Files:':
|
if l.strip() == 'Files:':
|
||||||
break
|
break
|
||||||
|
|
||||||
for l in f:
|
for l in f:
|
||||||
if not l.startswith(' '):
|
if not l.startswith(' '):
|
||||||
continue
|
continue
|
||||||
if l.strip() == '':
|
if l.strip() == '':
|
||||||
break
|
break
|
||||||
fname = l.split()[2]
|
fname = l.split()[2]
|
||||||
if not fname.endswith('.dsc'):
|
if not fname.endswith('.dsc'):
|
||||||
files.append(fname)
|
files.append(fname)
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
return files
|
return files
|
||||||
|
|
||||||
#
|
#
|
||||||
# entry point
|
# entry point
|
||||||
#
|
#
|
||||||
|
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 3:
|
||||||
print 'Usage: syncpackage <.dsc URL or path> <target release>'
|
print 'Usage: syncpackage <.dsc URL or path> <target release>'
|
||||||
sys.exit (1)
|
sys.exit (1)
|
||||||
|
|
||||||
(dscurl, release) = sys.argv[1:]
|
(dscurl, release) = sys.argv[1:]
|
||||||
dscname = os.path.basename(dscurl)
|
dscname = os.path.basename(dscurl)
|
||||||
@ -74,7 +74,7 @@ cur_ver = getUbuntuSrcPkg(srcpkg, release).getVersion()
|
|||||||
# No need to continue if version is not greater than current one
|
# No need to continue if version is not greater than current one
|
||||||
apt_pkg.init()
|
apt_pkg.init()
|
||||||
if not apt_pkg.check_dep(new_ver, '>', cur_ver):
|
if not apt_pkg.check_dep(new_ver, '>', cur_ver):
|
||||||
raise Exception('%s version %s is not greater than already available %s' % (srcpkg, new_ver, cur_ver))
|
raise Exception('%s version %s is not greater than already available %s' % (srcpkg, new_ver, cur_ver))
|
||||||
|
|
||||||
retrieve_file(dscurl)
|
retrieve_file(dscurl)
|
||||||
files = dsc_getfiles(dscname)
|
files = dsc_getfiles(dscname)
|
||||||
@ -82,35 +82,35 @@ files = dsc_getfiles(dscname)
|
|||||||
# do we need the orig.tar.gz?
|
# do we need the orig.tar.gz?
|
||||||
need_orig = True
|
need_orig = True
|
||||||
if cur_ver.find('-') > 0 and new_ver.find('-') > 0 and \
|
if cur_ver.find('-') > 0 and new_ver.find('-') > 0 and \
|
||||||
cur_ver.split('-')[0] == new_ver.split('-')[0]:
|
cur_ver.split('-')[0] == new_ver.split('-')[0]:
|
||||||
need_orig = False
|
need_orig = False
|
||||||
#files = [f for f in files if not f.endswith('orig.tar.gz')]
|
#files = [f for f in files if not f.endswith('orig.tar.gz')]
|
||||||
|
|
||||||
print 'Source %s: current version %s, new version %s' % (srcpkg, cur_ver, new_ver)
|
print 'Source %s: current version %s, new version %s' % (srcpkg, cur_ver, new_ver)
|
||||||
print 'needs orig.tar.gz', need_orig
|
print 'needs orig.tar.gz', need_orig
|
||||||
print 'Files:', files
|
print 'Files:', files
|
||||||
for f in files:
|
for f in files:
|
||||||
retrieve_file(os.path.join(basepath, f))
|
retrieve_file(os.path.join(basepath, f))
|
||||||
|
|
||||||
uidx = cur_ver.find('ubuntu')
|
uidx = cur_ver.find('ubuntu')
|
||||||
if uidx > 0:
|
if uidx > 0:
|
||||||
cur_ver = cur_ver[:uidx]
|
cur_ver = cur_ver[:uidx]
|
||||||
print 'WARNING! Overwriting modified Ubuntu version, setting current version to', cur_ver
|
print 'WARNING! Overwriting modified Ubuntu version, setting current version to', cur_ver
|
||||||
|
|
||||||
uidx = cur_ver.find('build')
|
uidx = cur_ver.find('build')
|
||||||
if uidx > 0:
|
if uidx > 0:
|
||||||
cur_ver = cur_ver[:uidx]
|
cur_ver = cur_ver[:uidx]
|
||||||
|
|
||||||
orig_arg = ''
|
orig_arg = ''
|
||||||
if need_orig:
|
if need_orig:
|
||||||
orig_arg = '-sa'
|
orig_arg = '-sa'
|
||||||
|
|
||||||
# extract package, build Source
|
# extract package, build Source
|
||||||
assert subprocess.call(['dpkg-source', '-x', dscname]) == 0
|
assert subprocess.call(['dpkg-source', '-x', dscname]) == 0
|
||||||
os.chdir(srcpkg + '-' + new_ver.split('-')[0])
|
os.chdir(srcpkg + '-' + new_ver.split('-')[0])
|
||||||
assert subprocess.call("dpkg-genchanges -q -S %s -v%s -e\"$(getent passwd $(id -u)|cut -f5 -d:|cut -f1 -d,) <$DEBEMAIL>\" | \
|
assert subprocess.call("dpkg-genchanges -q -S %s -v%s -e\"$(getent passwd $(id -u)|cut -f5 -d:|cut -f1 -d,) <$DEBEMAIL>\" | \
|
||||||
sed 's/^Distribution:.*$/Distribution: %s/; 1 i\Origin: debian/unstable' > ../%s_%s_source.changes" %
|
sed 's/^Distribution:.*$/Distribution: %s/; 1 i\Origin: debian/unstable' > ../%s_%s_source.changes" %
|
||||||
(orig_arg, cur_ver, release, srcpkg, new_ver), shell=True) == 0
|
(orig_arg, cur_ver, release, srcpkg, new_ver), shell=True) == 0
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
shutil.rmtree(srcpkg + '-' + new_ver.split('-')[0], True)
|
shutil.rmtree(srcpkg + '-' + new_ver.split('-')[0], True)
|
||||||
assert subprocess.call("debsign %s_%s_source.changes" % (srcpkg, new_ver), shell=True) == 0
|
assert subprocess.call("debsign %s_%s_source.changes" % (srcpkg, new_ver), shell=True) == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user