root/build-tools/pkg-manager-utils.sh
Scott Little 77576b7207 Add support CentOS-8/dnf/mock-2.6 based builds
This update will retain support for CentOS-7/yum/mock-1.4 based builds.
The build environment will be queried to discover which environment
it is building in, and modify the commands we issue accordingly.

In CentOS 8, DNF replaces both YUM and REPOQUERY.
While DNF tries to be a transparent replacement of the old tools,
there are also subtle changes to the supported arguments.

I will provide independent mock.cfg.prototypes for centos7 vs centos8.
Changes in generate-centos-repo.sh under stx-tools will be required to
select the correct prototype.

Add support for mock 2.6. Mock 2.6 is python 3, and it processes the
'root' and 'rootdir' arguments slightly differently.

Also change the order of arguments to tar within default_build_srpm.
The latest tar only honors '--exclude' if it precedes other arguments.

Story: 2006729
Depends-On: https://review.opendev.org/762700
Signed-off-by: Scott Little <scott.little@windriver.com>
Change-Id: I826be2051e535e6a4c08ad17124f453b04210668
2020-12-08 14:13:28 -05:00

34 lines
754 B
Bash
Executable File

#
# Copyright (c) 2020 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# BASH utilities to select package manager
#
# Currently just sets some environment variables
#
# Yum vs DNF compatibility
YUM=$(which yum 2>> /dev/null)
DNF=$(which dnf 2>> /dev/null)
PKG_MANAGER=""
REPOQUERY=$(which repoquery 2>> /dev/null)
REPOQUERY_SUB_COMMAND=""
REPOQUERY_RESOLVE="--resolve"
REPOQUERY_WHATPROVIDES_DELIM=" "
if [ ! -z ${DNF} ]; then
PKG_MANAGER="dnf"
REPOQUERY=${DNF}
REPOQUERY_SUB_COMMAND="repoquery --disable-modular-filtering"
REPOQUERY_RESOLVE=""
REPOQUERY_WHATPROVIDES_DELIM=","
elif [ ! -z ${YUM} ]; then
PKG_MANAGER="yum"
else
>&2 echo "ERROR: Couldn't find a supported package manager"
exit 1
fi