Skip to content
Snippets Groups Projects
Commit cde43d61 authored by Simon McVittie's avatar Simon McVittie
Browse files

build-relocatable-install: Further fixes

parent 92bffa62
No related branches found
No related tags found
No related merge requests found
...@@ -156,6 +156,9 @@ def main(): ...@@ -156,6 +156,9 @@ def main():
args.prefix = args.destdir + args.prefix args.prefix = args.destdir + args.prefix
args.srcdir = args.destdir + args.srcdir args.srcdir = args.destdir + args.srcdir
if args.archive is None and args.output is None:
parser.error('Either --archive or --output is required')
if args.version is None: if args.version is None:
with open(os.path.join(args.srcdir, '.tarball-version')) as reader: with open(os.path.join(args.srcdir, '.tarball-version')) as reader:
args.version = reader.read().strip() args.version = reader.read().strip()
...@@ -207,16 +210,17 @@ def main(): ...@@ -207,16 +210,17 @@ def main():
v_check_call([ v_check_call([
'apt-get', 'apt-get',
'download', 'download',
package, package + ':' + arch.name,
], cwd=tmpdir) ], cwd=tmpdir)
v_check_call( v_check_call(
'dpkg-deb -x {}_*.deb build-relocatable'.format( 'dpkg-deb -X {}_*_{}.deb build-relocatable'.format(
quote(package), quote(package),
quote(arch.name),
), ),
cwd=tmpdir, cwd=tmpdir,
shell=True, shell=True,
) )
path = '{}/build-relocatable/usr/bin/TOOL'.format(tmpdir) path = '{}/build-relocatable/{}'.format(tmpdir, path)
for tool in LIBCAPSULE_TOOLS: for tool in LIBCAPSULE_TOOLS:
install_exe( install_exe(
...@@ -463,39 +467,40 @@ def main(): ...@@ -463,39 +467,40 @@ def main():
) as writer: ) as writer:
writer.write('{}\n'.format(args.version)) writer.write('{}\n'.format(args.version))
bin_tar = os.path.join( if args.archive:
args.archive, bin_tar = os.path.join(
'pressure-vessel-{}-bin.tar.gz'.format(args.version), args.archive,
) 'pressure-vessel-{}-bin.tar.gz'.format(args.version),
src_tar = os.path.join( )
args.archive, src_tar = os.path.join(
'pressure-vessel-{}-bin+src.tar.gz'.format(args.version), args.archive,
) 'pressure-vessel-{}-bin+src.tar.gz'.format(args.version),
)
subprocess.check_call([ subprocess.check_call([
'tar', 'tar',
r'--transform=s,^\(\.\(/\|$\)\)\?,pressure-vessel-{}/,'.format( r'--transform=s,^\(\.\(/\|$\)\)\?,pressure-vessel-{}/,'.format(
args.version, args.version,
), ),
'--exclude=metadata', # this is all duplicated in sources/ '--exclude=metadata', # this is all duplicated in sources/
'-zcvf', src_tar + '.tmp', '-zcvf', src_tar + '.tmp',
'-C', installation, '-C', installation,
'.', '.',
]) ])
subprocess.check_call([ subprocess.check_call([
'tar', 'tar',
r'--transform=s,^\(\.\(/\|$\)\)\?,pressure-vessel-{}/,'.format( r'--transform=s,^\(\.\(/\|$\)\)\?,pressure-vessel-{}/,'.format(
args.version, args.version,
), ),
'--exclude=sources', '--exclude=sources',
'-zcvf', bin_tar + '.tmp', '-zcvf', bin_tar + '.tmp',
'-C', installation, '-C', installation,
'.', '.',
]) ])
os.rename(bin_tar + '.tmp', bin_tar) os.rename(bin_tar + '.tmp', bin_tar)
os.rename(src_tar + '.tmp', src_tar) os.rename(src_tar + '.tmp', src_tar)
print('Generated {}'.format(os.path.abspath(bin_tar))) print('Generated {}'.format(os.path.abspath(bin_tar)))
print('Generated {}'.format(os.path.abspath(src_tar))) print('Generated {}'.format(os.path.abspath(src_tar)))
if __name__ == '__main__': if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment