Commit 7482785d authored by Simon McVittie's avatar Simon McVittie

Allow collection of source code to be disabled

Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent 288343ed
......@@ -21,6 +21,7 @@
{{- $ostree_prefix := or .ostree_prefix (printf "%s-runtime" $artifact_prefix) -}}
{{- $ostree_tarball := or .ostree_tarball (printf "%s.tar.gz" $ostree_prefix) -}}
{{- $sources_directory := or .sources_directory "" -}}
{{- $collect_source_code := or .collect_source_code false -}}
{{- $sources_prefix := or .sources_prefix (printf "%s-sources" $artifact_prefix) -}}
{{- $sources_tarball := or .sources_tarball "" -}}
{{- $debug_symbols := or .debug_symbols false -}}
......@@ -160,7 +161,7 @@ actions:
cp "$ROOTDIR/usr/lib/os-release" "$ARTIFACTDIR/{{ $artifact_prefix }}.os-release.txt"
fi
{{ if $sdk }}
{{ if and $sdk $collect_source_code }}
- action: run
label: collect-source-code
chroot: false
......@@ -171,7 +172,9 @@ actions:
{{ if $sources_directory }}--output="$ARTIFACTDIR/{{ $sources_directory }}"{{ end }} \
--strip-source-version-suffix="{{ $strip_source_version_suffix }}" \
"$ROOTDIR"
{{ else }}
{{ end }}
{{ if not $sdk }}
- action: run
label: copy manifest for SDK
chroot: false
......@@ -308,7 +311,7 @@ actions:
files metadata
{{ if $sdk }}
{{ if $sources_tarball }}
{{ if and $collect_source_code $sources_tarball }}
- action: run
label: pack source code
chroot: false
......@@ -341,6 +344,7 @@ actions:
.
{{ end }}
{{ if $collect_source_code }}
- action: run
label: list of included source code
chroot: false
......@@ -350,6 +354,7 @@ actions:
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"
{{ end }}
- action: run
label: list of missing source code
......
......@@ -241,6 +241,7 @@ class Builder:
self.sdk_variant_id = None
self.debug_symbols = True
self.automatic_dbgsym = True
self.collect_source_code = True
self.strict = False
self.logger = logger.getChild('Builder')
......@@ -492,6 +493,15 @@ class Builder:
help='Do not include corresponding automatic -dbgsym packages '
'for each package in the Platform',
)
parser.add_argument(
'--collect-source-code', action='store_true', default=True,
help='Include source code for each package (default)',
)
parser.add_argument(
'--no-collect-source-code', dest='collect_source_code',
action='store_false', default=True,
help='Do not include source code',
)
parser.add_argument(
'--strict', action='store_true', default=False,
help='Make various warnings into fatal errors',
......@@ -603,6 +613,8 @@ class Builder:
else:
self.automatic_dbgsym = args.automatic_dbgsym
self.collect_source_code = args.collect_source_code
self.build_apt_sources = self.generate_apt_sources(
add=args.add_apt_source + args.add_build_apt_source,
replace=args.replace_apt_source + args.replace_build_apt_source,
......@@ -1095,7 +1107,7 @@ class Builder:
if generate_source_tarball is None:
generate_source_tarball = not generate_source_directory
if generate_source_tarball:
if self.collect_source_code and generate_source_tarball:
sources_tarball = sources_prefix + '.tar.gz'
argv.append('-t')
argv.append(
......@@ -1114,6 +1126,13 @@ class Builder:
argv.append('-t')
if self.collect_source_code:
argv.append('collect_source_code:yes')
else:
argv.append('collect_source_code:')
argv.append('-t')
if self.automatic_dbgsym:
argv.append('automatic_dbgsym:yes')
else:
......@@ -1205,10 +1224,14 @@ class Builder:
sources_prefix + '.MISSING.txt',
)
if os.path.exists(output) and self.strict:
raise SystemExit(
'Some source code was missing: aborting'
)
if self.collect_source_code:
if os.path.exists(output) and self.strict:
raise SystemExit(
'Some source code was missing: aborting'
)
else:
with open(output, 'w') as writer:
writer.write('EVERYTHING\n')
if sysroot_prefix is not None:
assert sysroot_tarball is not None
......@@ -1259,7 +1282,7 @@ class Builder:
'--tar-autocreate-parents',
])
if generate_source_tarball:
if self.collect_source_code and generate_source_tarball:
output = os.path.join(self.build_area, sources_tarball)
os.rename(output + '.new', output)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment