From 6a0cb3cb1cb3a6b0e80b0b44b7c0300c4a860865 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 8 Oct 2019 15:03:05 +0100 Subject: [PATCH] collect-source-code: Generate Sources.gz Signed-off-by: Simon McVittie --- flatdeb/collect-source-code | 22 ++++++++++++++++++++++ flatdeb/debos-runtimes.yaml | 12 ++++++------ run.py | 5 +++++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/flatdeb/collect-source-code b/flatdeb/collect-source-code index c462e1c..e847230 100755 --- a/flatdeb/collect-source-code +++ b/flatdeb/collect-source-code @@ -310,6 +310,28 @@ def main(): parent = args.output or os.path.join(args.sysroot, 'src', 'files') + with open( + os.path.join(parent, 'Sources'), 'w' + ) as writer: + subprocess.check_call(in_chroot + [ + 'sh', '-euc', + 'dir="$1"; shift; mkdir -p "$dir"; cd "$dir"; "$@"', + 'sh', # argv[0] + '/src/files', # working directory + 'dpkg-scansources', + '.', + ], stdout=writer) + + with open( + os.path.join(parent, 'Sources.gz'), 'wb' + ) as binary_writer: + subprocess.check_call([ + 'pigz', '-c', '-n', '--rsyncable', + os.path.join(parent, 'Sources'), + ], stdout=binary_writer) + + os.remove(os.path.join(parent, 'Sources')) + try: with open( os.path.join(parent, 'sources.txt'), 'r' diff --git a/flatdeb/debos-runtimes.yaml b/flatdeb/debos-runtimes.yaml index eed8ef5..17e6e3b 100644 --- a/flatdeb/debos-runtimes.yaml +++ b/flatdeb/debos-runtimes.yaml @@ -344,12 +344,12 @@ actions: - action: run label: list of included source code chroot: false - command: > - set -e; - cd "$ARTIFACTDIR"; - dir="{{ or $sources_directory "$ROOTDIR/src/files" }}"; - cp -v "$dir/sources.txt" - "{{ $sources_prefix }}.sources.txt" + command: | + set -e + cd "$ARTIFACTDIR" + dir="{{ or $sources_directory "$ROOTDIR/src/files" }}" + cp -v "$dir/Sources.gz" "{{ $sources_prefix }}.deb822.gz" + cp -v "$dir/sources.txt" "{{ $sources_prefix }}.sources.txt" - action: run label: list of missing source code diff --git a/run.py b/run.py index 8fc4ccb..fa34b61 100755 --- a/run.py +++ b/run.py @@ -1131,6 +1131,11 @@ class Builder: multiarch=True, )) + # We probably have this anyway, but we need it for + # dpkg-scansources + if 'dpkg-dev' not in sdk_packages: + sdk_packages.append('dpkg-dev') + if sdk_packages: logger.info('Installing extra packages for SDK:') sdk_packages.sort() -- GitLab