mirror of
https://github.com/clearlinux/autospec.git
synced 2026-08-20 05:55:52 +00:00
Add "whatrequires" files for package
The file contains packages that require capabilities of the specified package using the repoquery --whatrequires command. This includes the recursive option to query for all packages, and the archlist=src to specify only SRPMS. To use the repoquery command a yum.conf file is required; the location of this is specified in the autospec.conf file. If a path is not provided, the path is set to the common location of the yum.conf file in clear. This file is informational and can be used by other tooling and package maintainers to identify which packages need to be rebuilt when this package is updated. It can also be used to track dependent packages and versions over time by inspecting git history. Signed-off-by: Gabi Beyer <gabrielle.n.beyer@intel.com>
This commit is contained in:
@@ -42,6 +42,9 @@ Example ``autospec.conf`` file::
|
||||
**packages_file**
|
||||
Optional path to add autodetected runtime requirement checking against
|
||||
|
||||
**yum_conf**
|
||||
Optional path to yum configuration
|
||||
|
||||
**upstream**
|
||||
Base URL for stored upstream tarballs
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import test
|
||||
import commitmessage
|
||||
import pkg_integrity
|
||||
import specfiles
|
||||
import pkg_scan
|
||||
|
||||
from util import print_fatal, binary_in_path, write_out
|
||||
from abireport import examine_abi
|
||||
@@ -219,6 +220,7 @@ def main():
|
||||
pass
|
||||
|
||||
examine_abi(build.download_path)
|
||||
pkg_scan.get_whatrequires(tarball.name)
|
||||
|
||||
write_out(build.download_path + "/release", tarball.release + "\n")
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ old_patches = list()
|
||||
old_keyid = None
|
||||
profile_payload = None
|
||||
signature = None
|
||||
yum_conf = None
|
||||
|
||||
failed_commands = {}
|
||||
maven_jars = {}
|
||||
@@ -452,6 +453,7 @@ def parse_config_files(path, bump, filemanager):
|
||||
global make_install_append
|
||||
global patches
|
||||
global autoreconf
|
||||
global yum_conf
|
||||
|
||||
packages_file = None
|
||||
|
||||
@@ -470,6 +472,7 @@ def parse_config_files(path, bump, filemanager):
|
||||
license_fetch = config['autospec'].get('license_fetch', None)
|
||||
license_show = config['autospec'].get('license_show', None)
|
||||
packages_file = config['autospec'].get('packages_file', None)
|
||||
yum_conf = config['autospec'].get('yum_conf', None)
|
||||
if not packages_file:
|
||||
print("Warning: Set [autospec][packages_file] path to package list file for "
|
||||
"requires validation")
|
||||
@@ -483,6 +486,9 @@ def parse_config_files(path, bump, filemanager):
|
||||
print("Warning: Set [autospec][license_fetch] uri for license fetch support")
|
||||
if not license_show:
|
||||
print("Warning: Set [autospec][license_show] uri for license link check support")
|
||||
if not yum_conf:
|
||||
print("Warning: Set [autospec][yum_conf] path to yum.conf file for whatrequires validation")
|
||||
yum_conf = os.path.join(os.path.dirname(config_file), "image-creator/yum.conf")
|
||||
|
||||
if packages_file:
|
||||
os_packages = set(read_conf_file(packages_file))
|
||||
|
||||
@@ -75,6 +75,7 @@ def commit_to_git(path):
|
||||
call("git add profile_payload", check=False, stderr=subprocess.DEVNULL, cwd=path)
|
||||
call("git add options.conf", check=False, stderr=subprocess.DEVNULL, cwd=path)
|
||||
call("git add configure_misses", check=False, stderr=subprocess.DEVNULL, cwd=path)
|
||||
call("git add whatrequires", check=False, stderr=subprocess.DEVNULL, cwd=path)
|
||||
|
||||
# remove deprecated config files
|
||||
call("git rm use_clang", check=False, stderr=subprocess.DEVNULL, cwd=path)
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# pkg_scan.py - part of autospec
|
||||
# Copyright (C) 2017 Intel Corporation
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
import subprocess
|
||||
import util
|
||||
import config
|
||||
|
||||
|
||||
def get_whatrequires(pkg):
|
||||
"""
|
||||
Write list of packages that require current package to file
|
||||
using repoquery what-requires and --recursive commands
|
||||
"""
|
||||
|
||||
# clean up yum cache to avoid 'no more mirrors repo' error
|
||||
subprocess.check_output(['yum', '--config', config.yum_conf,
|
||||
'clean', 'all'])
|
||||
|
||||
try:
|
||||
out = subprocess.check_output(['repoquery', '--config', config.yum_conf,
|
||||
'--archlist=src', '--recursive',
|
||||
'--whatrequires', pkg]).decode('utf-8')
|
||||
|
||||
except subprocess.CalledProcessError as err:
|
||||
util.print_warning("repoquery whatrequires for {} failed with: {}".format(pkg, err))
|
||||
return
|
||||
|
||||
if 'filesystem' in out:
|
||||
util.print_warning("Package contains filesystem as a whatrequires.\n" +
|
||||
"BE CAREFUL building {}; may require full OS rebuild.\n".format(pkg))
|
||||
|
||||
util.write_out('whatrequires',
|
||||
"# This file contains recursive sources that require this package\n" + \
|
||||
out)
|
||||
Reference in New Issue
Block a user