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

build-relocatable-install: Optionally fetch pressure-vessel source package

parent e5600863
No related branches found
No related tags found
No related merge requests found
...@@ -139,6 +139,7 @@ def main(): ...@@ -139,6 +139,7 @@ def main():
parser.add_argument('--srcdir', default=None) parser.add_argument('--srcdir', default=None)
parser.add_argument('--output', '-o', default=None) parser.add_argument('--output', '-o', default=None)
parser.add_argument('--archive', default=None) parser.add_argument('--archive', default=None)
parser.add_argument('--apt-get-source', action='store_true')
parser.add_argument('--set-version', dest='version', default=None) parser.add_argument('--set-version', dest='version', default=None)
args = parser.parse_args() args = parser.parse_args()
...@@ -335,10 +336,17 @@ def main(): ...@@ -335,10 +336,17 @@ def main():
source_to_download = set() # type: typing.Set[str] source_to_download = set() # type: typing.Set[str]
installed_binaries = set() # type: typing.Set[str] installed_binaries = set() # type: typing.Set[str]
for package, source in ( get_source = (
list(DEPENDENCIES.items()) list(DEPENDENCIES.items())
+ list(PRIMARY_ARCH_DEPENDENCIES.items()) + list(PRIMARY_ARCH_DEPENDENCIES.items())
): )
if args.apt_get_source:
get_source.append(
('pressure-vessel-relocatable', 'pressure-vessel'),
)
for package, source in get_source:
if os.path.exists('/usr/share/doc/{}/copyright'.format(package)): if os.path.exists('/usr/share/doc/{}/copyright'.format(package)):
installed_binaries.add(package) installed_binaries.add(package)
...@@ -410,49 +418,50 @@ def main(): ...@@ -410,49 +418,50 @@ def main():
cwd=os.path.join(installation, 'sources'), cwd=os.path.join(installation, 'sources'),
) )
os.makedirs( if not args.apt_get_source:
os.path.join(installation, 'sources', 'pressure-vessel'), os.makedirs(
exist_ok=True, os.path.join(installation, 'sources', 'pressure-vessel'),
) exist_ok=True,
)
tar = subprocess.Popen([ tar = subprocess.Popen([
'tar', 'tar',
'-C', args.srcdir, '-C', args.srcdir,
'--exclude=.*.sw?', '--exclude=.*.sw?',
'--exclude=./.git', '--exclude=./.git',
'--exclude=./.mypy_cache', '--exclude=./.mypy_cache',
'--exclude=./_build', '--exclude=./_build',
'--exclude=./debian', '--exclude=./debian',
'--exclude=./relocatable-install', '--exclude=./relocatable-install',
'-cf-', '-cf-',
'.', '.',
], stdout=subprocess.PIPE) ], stdout=subprocess.PIPE)
subprocess.check_call([ subprocess.check_call([
'tar', 'tar',
'-C', os.path.join( '-C', os.path.join(
installation, installation,
'sources', 'sources',
'pressure-vessel', 'pressure-vessel',
), ),
'-xvf-', '-xvf-',
], stdin=tar.stdout) ], stdin=tar.stdout)
if tar.wait() != 0: if tar.wait() != 0:
raise subprocess.CalledProcessError( raise subprocess.CalledProcessError(
returncode=tar.returncode, returncode=tar.returncode,
cmd=tar.args, cmd=tar.args,
) )
with open( with open(
os.path.join( os.path.join(
installation, installation,
'sources', 'sources',
'pressure-vessel', 'pressure-vessel',
'.tarball-version', '.tarball-version',
), ),
'w', 'w',
) as writer: ) as writer:
writer.write('{}\n'.format(args.version)) writer.write('{}\n'.format(args.version))
bin_tar = os.path.join( bin_tar = os.path.join(
args.archive, args.archive,
......
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