Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 99a7985

Browse files
William Douglasbryteise
authored andcommitted
Add has_license config
In cases where a package's license subpackage disappears, prefer failing the build as it should have some manual investigation. Signed-off-by: William Douglas <william.douglas@intel.com>
1 parent 9594167 commit 99a7985

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

autospec/autospec.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ def package(args, url, name, archives, workingdir):
277277
# specfile template is assumed "correct" and any failures need to be manually addressed
278278
break
279279
filemanager.load_specfile(specfile)
280+
if 'license' in specfile.packages and not conf.config_opts['has_license']:
281+
conf.config_opts['has_license'] = True
282+
conf.rewrite_config_opts()
280283
specfile.write_spec()
281284
filemanager.newfiles_printed = 0
282285
mock_chroot = "/var/lib/mock/clear-{}/root/builddir/build/BUILDROOT/" \
@@ -297,6 +300,10 @@ def package(args, url, name, archives, workingdir):
297300
conf.create_buildreq_cache(content.version, requirements.buildreqs_cache)
298301
print_build_failed()
299302
sys.exit(1)
303+
elif 'license' not in specfile.packages and conf.config_opts['has_license']:
304+
print_fatal("package -license subpackage deleted")
305+
conf.create_buildreq_cache(content.version, requirements.buildreqs_cache)
306+
sys.exit(1)
300307
elif os.path.isfile("README.clear"):
301308
try:
302309
print("\nREADME.clear CONTENTS")

autospec/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ def __init__(self, download_path):
193193
"no_glob": "Do not use the replacement pattern for file matching",
194194
"allow_exe": "Allow Windows executables (*.exe, *.dll) to be packaged",
195195
"use_ninja": "Use ninja build files",
196+
"has_license": "Require license subpackage for successful build",
196197
}
197198
# simple_pattern_pkgconfig patterns
198199
# contains patterns for parsing build.log for missing dependencies

0 commit comments

Comments
 (0)