Revert "Add support CentOS-8/dnf/mock-2.6 based builds"
This reverts commit c34d5f4b2e
.
Change-Id: I70735e6571d5699fcfff34afef3aa0a31c089c56
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
parent
1bc9f49b7e
commit
09c66cd0d7
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2018-2020 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -18,10 +18,6 @@ BUILD_ISO_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
|
||||
source "${BUILD_ISO_DIR}/image-utils.sh"
|
||||
source "${BUILD_ISO_DIR}/git-utils.sh"
|
||||
|
||||
# Set REPOQUERY, REPOQUERY_SUB_COMMAND, REPOQUERY_RESOLVE and
|
||||
# REPOQUERY_WHATPROVIDES_DELIM for our build environment.
|
||||
source "${BUILD_ISO_DIR}/pkg-manager-utils.sh"
|
||||
|
||||
usage () {
|
||||
echo ""
|
||||
echo "Usage: "
|
||||
@ -44,8 +40,8 @@ usage () {
|
||||
MY_YUM_CONF=""
|
||||
STD_REPO_ID="local-std"
|
||||
RT_REPO_ID="local-rt"
|
||||
LOWER_LAYER_STD_REPO_ID=""
|
||||
LOWER_LAYER_RT_REPO_ID=""
|
||||
LOWER_LAYER_STD_REPO_ID="StxCentos7Distro"
|
||||
LOWER_LAYER_RT_REPO_ID="StxCentos7Distro-rt"
|
||||
|
||||
NPROCS=$(nproc)
|
||||
|
||||
@ -162,10 +158,6 @@ function init_vars {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# LOWER_LAYER_STD_REPO_ID should be something like StxCentos7Distro or StxCentos8Distro
|
||||
LOWER_LAYER_STD_REPO_ID=$(grep '\[StxCentos.*Distro\]' ${MY_YUM_CONF} | sed -e 's/^\[//' -e 's/\].*//')
|
||||
LOWER_LAYER_RT_REPO_ID=$(grep '\[StxCentos.*Distro-rt\]' ${MY_YUM_CONF} | sed -e 's/^\[//' -e 's/\].*//')
|
||||
|
||||
DISTRO_REPO_DIR=$(for d in $(grep baseurl $MY_YUM_CONF | grep file: | awk -F : '{print $2}' | sed 's:///:/:g'); do if [ -d $d/images ]; then echo $d ;fi; done)
|
||||
|
||||
#####################################
|
||||
@ -503,7 +495,7 @@ function final_touches {
|
||||
|
||||
function extract_pkg_from_local_repo {
|
||||
local pkgname=$1
|
||||
local pkg_mgr_conf=$2
|
||||
local yum_conf=$2
|
||||
shift 2
|
||||
|
||||
local repoid=""
|
||||
@ -513,14 +505,7 @@ function extract_pkg_from_local_repo {
|
||||
repoid_arg+=" --repoid=${repoid}"
|
||||
done
|
||||
|
||||
echo "TMPDIR=$TMP_DIR"\
|
||||
"${REPOQUERY} --config=${pkg_mgr_conf} ${repoid_arg}"\
|
||||
"${REPOQUERY_SUB_COMMAND} --location"\
|
||||
"--arch=noarch,x86_64 -q ${pkgname}"
|
||||
local pkgfile=$(TMPDIR=$TMP_DIR \
|
||||
${REPOQUERY} --config=${pkg_mgr_conf} ${repoid_arg} \
|
||||
${REPOQUERY_SUB_COMMAND} --location \
|
||||
--arch=noarch,x86_64 -q ${pkgname})
|
||||
local pkgfile=$(TMPDIR=$TMP_DIR repoquery --config=${yum_conf} ${repoid_arg} --location -q ${pkgname})
|
||||
if [ -z "${pkgfile}" ]; then
|
||||
echo "Could not find package $pkgname in $@"
|
||||
exit 1
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2018-2020 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -15,10 +15,6 @@
|
||||
|
||||
BUILD_PKGS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
|
||||
|
||||
# Set REPOQUERY and REPOQUERY_SUB_COMMAND for our build environment.
|
||||
source "${BUILD_PKGS_DIR}/pkg-manager-utils.sh"
|
||||
|
||||
|
||||
usage () {
|
||||
echo ""
|
||||
echo "Usage: "
|
||||
@ -79,15 +75,11 @@ make_cache_current_rpms () {
|
||||
if [ -d $MY_WORKSPACE/$build_type/rpmbuild/$rpm_type/repodata ]; then
|
||||
current=$MY_WORKSPACE/$build_type/rpmbuild/$rpm_type/
|
||||
|
||||
${REPOQUERY} \
|
||||
repoquery \
|
||||
--repofrompath=$build_type-$rpm_type,$current \
|
||||
--repoid=$build_type-$rpm_type --arch=noarch,src,x86_64 \
|
||||
${REPOQUERY_SUB_COMMAND} \
|
||||
--all \
|
||||
--repoid=$build_type-$rpm_type --arch=noarch,src,x86_64 -a \
|
||||
--qf "%-10{repoid} %-40{name} %-10{version} %-10{release}" \
|
||||
>> ${FILE}
|
||||
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
fi
|
||||
done;
|
||||
done;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2018-2020 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -15,7 +15,7 @@
|
||||
# The location of packages to be built is
|
||||
# $MY_WORKSPACE/<build-type>/rpmbuild/SRPMS.
|
||||
#
|
||||
# The build order is a derived from the BuildRequires in the
|
||||
# The build order is a derived from the BuildRequires in the
|
||||
# spec files in the src.rpms. Note that the BuildRequires sometimes
|
||||
# create dependency loops, so no correct order can be computed. In these
|
||||
# cases we add a retry loop. As long as one new package builds, we
|
||||
@ -24,12 +24,9 @@
|
||||
# messages go by!
|
||||
#
|
||||
|
||||
|
||||
export ME=$(basename "$0")
|
||||
CMDLINE="$ME $@"
|
||||
BUILD_RPMS_PARALLEL_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
|
||||
|
||||
# Set PKG_MANAGER for our build environment.
|
||||
source "${BUILD_RPMS_PARALLEL_DIR}/pkg-manager-utils.sh"
|
||||
|
||||
|
||||
# Build for distribution. Currently 'centos' is only supported value.
|
||||
@ -46,22 +43,22 @@ MAX_MEM_PER_WORKER=11
|
||||
# Note: tmpfs is typically 2.5 gb when compiling many small jobs
|
||||
MIN_MEM_PER_WORKER=3
|
||||
|
||||
# Maximum number of disk based parallel build environments
|
||||
# Maximum number of disk based parallel build environments
|
||||
MAX_DISK_BASED_WORKERS=2
|
||||
|
||||
# Minimum space in gb for each disk based parallel build environment
|
||||
MIN_DISK_PER_WORKER=20
|
||||
|
||||
# How many srpms to build before we add another parallel build environment
|
||||
# How many srpms to build before we add another parallel build environment
|
||||
MIN_TASKS_PER_CORE=3
|
||||
|
||||
# Max number of new concurrent builds to allow for
|
||||
MAX_SHARE_FACTOR=4
|
||||
|
||||
# Always leave at least MEMORY_RESERVE gb of available mem for the system
|
||||
# Always leave at least MEMORY_RESERVE gb of available mem for the system
|
||||
MEMORY_RESERVE=1
|
||||
|
||||
# These two values will be reassigned in the 'compute_resources' subroutine
|
||||
# These two values will be reassigned in the 'compute_resources' subroutine
|
||||
MOCKCHAIN_RESOURCE_ALLOCATION=""
|
||||
MAX_WORKERS=$ABSOLUTE_MAX_WORKERS
|
||||
|
||||
@ -71,19 +68,6 @@ if [ $? -ne 0 ]; then
|
||||
CREATEREPO="createrepo"
|
||||
fi
|
||||
|
||||
# Yum vs DNF compatibility
|
||||
YUM=$(which yum)
|
||||
DNF=$(which dnf)
|
||||
PKG_MANAGER=""
|
||||
if [ ! -z ${DNF} ]; then
|
||||
PKG_MANAGER="dnf"
|
||||
elif [ ! -z ${YUM} ]; then
|
||||
PKG_MANAGER="yum"
|
||||
else
|
||||
echo "ERROR: Couldn't find a supported package manager"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Old repo path or new?
|
||||
LOCAL_REPO=${MY_REPO}/local-repo
|
||||
if [ ! -d ${LOCAL_REPO} ]; then
|
||||
@ -180,7 +164,7 @@ create-no-clean-list () {
|
||||
local install_groups=""
|
||||
local install_packages=""
|
||||
local p
|
||||
|
||||
|
||||
for p in $(grep "config_opts\['chroot_setup_cmd'\]" $MY_BUILD_CFG | tail -n1 | cut -d '=' -f 2 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e "s/^'//" -e "s/'$//" -e 's/^install //'); do
|
||||
if [[ $p == @* ]] ; then
|
||||
install_groups=$(join_by ' ' $install_groups $(echo $p | cut -c 2-))
|
||||
@ -188,44 +172,37 @@ create-no-clean-list () {
|
||||
install_packages=$(join_by ' ' $install_packages $p)
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
local noclean_last_list_len=0
|
||||
local noclean_list=""
|
||||
local tmp_list=""
|
||||
local g
|
||||
|
||||
|
||||
for g in $install_groups; do
|
||||
# Find manditory packages in the group.
|
||||
# Discard anything before (and including) 'Mandatory Packages:'
|
||||
# and anything after (and including) 'Optional Packages:'.
|
||||
# Also discard leading spaces or '+' characters.
|
||||
tmp_list=$(${PKG_MANAGER} -c $MY_YUM_CONF groupinfo $g 2>> /dev/null \
|
||||
| awk 'f;/Mandatory Packages:/{f=1}' \
|
||||
| sed -n '/Optional Packages:/q;p' \
|
||||
| sed 's#[ +]*##')
|
||||
tmp_list=$(yum -c $MY_YUM_CONF groupinfo $g 2>> /dev/null | awk 'f;/Mandatory Packages:/{f=1}' | cut -c 5-)
|
||||
noclean_list=$(join_by ' ' $noclean_list $tmp_list)
|
||||
done
|
||||
|
||||
|
||||
noclean_list=$(join_by ' ' $noclean_list $install_packages)
|
||||
noclean_list=$(echo $noclean_list | tr ' ' '\n' | sort --uniq)
|
||||
noclean_list_len=$(echo $noclean_list | wc -w)
|
||||
|
||||
|
||||
while [ $noclean_list_len -gt $noclean_last_list_len ]; do
|
||||
noclean_last_list_len=$noclean_list_len
|
||||
noclean_list=$( (${PKG_MANAGER} -c $MY_YUM_CONF deplist $noclean_list 2>> /dev/null | grep provider: | awk '{ print $2 }' | awk -F . '{ print $1 }'; for p in $noclean_list; do echo $p; done) | sort --uniq)
|
||||
noclean_list=$( (yum -c $MY_YUM_CONF deplist $noclean_list 2>> /dev/null | grep provider: | awk '{ print $2 }' | awk -F . '{ print $1 }'; for p in $noclean_list; do echo $p; done) | sort --uniq)
|
||||
noclean_list_len=$(echo $noclean_list | wc -w)
|
||||
done
|
||||
|
||||
|
||||
echo $noclean_list > $NO_CLEAN_LIST_FILE
|
||||
fi
|
||||
|
||||
cat $NO_CLEAN_LIST_FILE
|
||||
}
|
||||
|
||||
str_lst_contains() {
|
||||
str_lst_contains() {
|
||||
TARGET="$1"
|
||||
LST="$2"
|
||||
if [[ $LST =~ (^|[[:space:]])$TARGET($|[[:space:]]) ]] ; then
|
||||
if [[ $LST =~ (^|[[:space:]])$TARGET($|[[:space:]]) ]] ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@ -237,7 +214,7 @@ compute_resources () {
|
||||
local b
|
||||
|
||||
echo ""
|
||||
for f in $@; do
|
||||
for f in $@; do
|
||||
b=$(basename $f)
|
||||
if [ -f $SOURCES_DIR/$b/BIG ] || [ ]; then
|
||||
weight=$((weight+MIN_TASKS_PER_CORE))
|
||||
@ -255,7 +232,7 @@ compute_resources () {
|
||||
local cpus=$(number_of_cpus)
|
||||
local num_users=$(sqrt $users)
|
||||
local num_build=$(number_of_builds_in_progress)
|
||||
num_build=$((num_build+1))
|
||||
num_build=$((num_build+1))
|
||||
echo "compute_resources: total: cpus=$cpus, mem=$mem, disk=$disk, weight=$weight, num_build=$num_build"
|
||||
|
||||
# What fraction of the machine will we use
|
||||
@ -334,9 +311,7 @@ create_lst () {
|
||||
recreate_repodata () {
|
||||
local DIR=${1}
|
||||
|
||||
(
|
||||
mkdir -p $DIR
|
||||
cd $DIR
|
||||
(cd $DIR
|
||||
if [ -f repodata/*comps*xml ]; then
|
||||
\mv repodata/*comps*xml comps.xml
|
||||
fi
|
||||
@ -427,11 +402,11 @@ union () {
|
||||
echo $b
|
||||
fi
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# returns 0 if element is in the array
|
||||
#
|
||||
#
|
||||
# e.g. contains ARRAY $SEEKING && echo "$SEEKING is in 'ARRAY'"
|
||||
#
|
||||
contains () {
|
||||
@ -478,7 +453,7 @@ build_order_recursive () {
|
||||
needs=( $(grep "^$target;" "$SRPM_DIRECT_REQUIRES_FILE" | sed "s/$target;//" | sed 's/,/ /g') )
|
||||
needs_list=( $(intersection needs remainder_list) )
|
||||
for((idx=0;idx<${#needs_list[@]};idx++)); do
|
||||
build_order_recursive ${needs_list[idx]}
|
||||
build_order_recursive ${needs_list[idx]}
|
||||
done
|
||||
echo $target
|
||||
break
|
||||
@ -528,7 +503,7 @@ build_order () {
|
||||
UNORDERED_LIST=( ${original_list[@]} )
|
||||
while [ ${#UNORDERED_LIST[@]} -gt 0 ]; do
|
||||
element=${UNORDERED_LIST[0]}
|
||||
build_order_recursive $element
|
||||
build_order_recursive $element
|
||||
done
|
||||
fi
|
||||
}
|
||||
@ -646,7 +621,7 @@ umount_mock_root_as_tmpfs () {
|
||||
return 0
|
||||
fi
|
||||
mock_tmpfs_umount $mount_dir &> /dev/null
|
||||
|
||||
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "FAILED: mock_tmpfs_umount $mount_dir"
|
||||
@ -677,7 +652,7 @@ kill_descendents ()
|
||||
recursive_promote_children=""
|
||||
recursive_children=$(pgrep -P $kill_pid)
|
||||
fi
|
||||
|
||||
|
||||
if [ $iteration -eq 0 ]; then
|
||||
other_children=$(for relevant_child in $relevant_other_children; do pgrep -P $kill_pid $relevant_child; done)
|
||||
if [ "$other_children" != "" ]; then
|
||||
@ -692,7 +667,7 @@ kill_descendents ()
|
||||
fi
|
||||
|
||||
for pid in $recursive_children; do
|
||||
kill_descendents "$pid" $kill_all $need_stop $((iteration + 1))
|
||||
kill_descendents "$pid" $kill_all $need_stop $((iteration + 1))
|
||||
done
|
||||
for pid in $recursive_promote_children; do
|
||||
kill_descendents "$pid" 1 1 $((iteration + 1))
|
||||
@ -971,11 +946,11 @@ mock_clean_cfg () {
|
||||
echo "=================================="
|
||||
mock_clean_cache_cfg $CFG
|
||||
echo "=================================="
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --scrub=all"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --scrub=all
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --scrub=all"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --scrub=all
|
||||
echo "=================================="
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --clean"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --clean
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --clean"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --clean
|
||||
### Note: this sometimes leaves behind a $MY_WORKSPACE/cache/mock/yum_cache/yumcache.lock
|
||||
echo "=================================="
|
||||
mock_clean_cache_all_cfg $CFG
|
||||
@ -1059,10 +1034,10 @@ mock_partial_clean_cfg () {
|
||||
local RPMS_CLEAN_LIST=""
|
||||
local NEED_FULL_MOCK_CLEAN=0
|
||||
for r in $RPMS_LIST; do
|
||||
if ! str_lst_contains $r "$NO_CLEAN_LIST" ; then
|
||||
if ! str_lst_contains $r "$NO_CLEAN_LIST" ; then
|
||||
RPMS_CLEAN_LIST=$(join_by ' ' $RPMS_CLEAN_LIST $r)
|
||||
else
|
||||
echo "Can't remove '$r' from mock environment without a wipe";
|
||||
else
|
||||
echo "Can't remove '$r' from mock environment without a wipe";
|
||||
NEED_FULL_MOCK_CLEAN=1
|
||||
fi
|
||||
done
|
||||
@ -1075,19 +1050,19 @@ mock_partial_clean_cfg () {
|
||||
# Intent of following is for $RPMS_LIST to be expand now while the remaining $ varaibles are for bash inside mock to expand
|
||||
echo "Try to uninstall from the mock environment these packages: $RPMS_CLEAN_LIST"
|
||||
CMD='LST="'$RPMS_CLEAN_LIST'";
|
||||
DELETE_LIST="";
|
||||
for r in $LST; do
|
||||
FOUND=$(rpm -q $r) ;
|
||||
if [ $? -eq 0 ]; then
|
||||
DELETE_LIST="$DELETE_LIST $FOUND";
|
||||
fi;
|
||||
done;
|
||||
echo "uninstalling these packages: $DELETE_LIST";
|
||||
DELETE_LIST="";
|
||||
for r in $LST; do
|
||||
FOUND=$(rpm -q $r) ;
|
||||
if [ $? -eq 0 ]; then
|
||||
DELETE_LIST="$DELETE_LIST $FOUND";
|
||||
fi;
|
||||
done;
|
||||
echo "uninstalling these packages: $DELETE_LIST";
|
||||
if [ "$DELETE_LIST" != "" ]; then
|
||||
rpm -e --nodeps $DELETE_LIST;
|
||||
fi'
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --chroot bash -c $CMD" &> $TMP
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --chroot "bash -c '$CMD'" &>> $TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --chroot bash -c $CMD" &> $TMP
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --chroot "bash -c '$CMD'" &>> $TMP
|
||||
RC=$?
|
||||
if [ $RC -ne 0 ]; then
|
||||
cat $TMP
|
||||
@ -1137,8 +1112,8 @@ mock_clean_cache_cfg () {
|
||||
|
||||
clean_yum_cache_cfg $CFG
|
||||
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --scrub=root-cache --scrub=yum-cache --scrub=cache" &> $TMP
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --scrub=root-cache --scrub=yum-cache --scrub=cache &>> $TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --scrub=root-cache --scrub=yum-cache --scrub=cache" &> $TMP
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --scrub=root-cache --scrub=yum-cache --scrub=cache &>> $TMP
|
||||
RC=$?
|
||||
if [ $RC -ne 0 ]; then
|
||||
cat $TMP
|
||||
@ -1166,8 +1141,8 @@ mock_clean_cache_all_cfg () {
|
||||
echo "=================================="
|
||||
clean_yum_cache_cfg $CFG
|
||||
echo "=================================="
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --scrub=all"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --scrub=all
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --scrub=all"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --scrub=all
|
||||
echo "=================================="
|
||||
}
|
||||
|
||||
@ -1194,16 +1169,9 @@ mock_clean_metadata_cfg () {
|
||||
return 1
|
||||
fi
|
||||
|
||||
CMD=$((cat $CFG; \
|
||||
grep config_opts\\[\'yum.conf\'\\\] $CFG | \
|
||||
sed 's#\\n#\n#g') | \
|
||||
grep '^[[]' | \
|
||||
grep -v main | \
|
||||
sed -e 's/[][]//g' -e "s#^#${PKG_MANAGER} --enablerepo=#" -e 's#$# clean metadata#' | \
|
||||
sort -u | \
|
||||
tr '\n' ';')
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --chroot bash -c $CMD" &> $TMP
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --chroot "bash -c '($CMD)'" &>>$TMP
|
||||
CMD=$((cat $CFG; grep config_opts\\[\'yum.conf\'\\\] $CFG | sed 's#\\n#\n#g') | grep '^[[]' | grep -v main | sed 's/[][]//g' | sed 's#^#yum --enablerepo=#' | sed 's#$# clean metadata#' | sort -u | tr '\n' ';')
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --chroot bash -c $CMD" &> $TMP
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --chroot "bash -c '($CMD)'" &>>$TMP
|
||||
RC=$?
|
||||
if [ $RC -ne 0 ]; then
|
||||
cat $TMP
|
||||
@ -1260,7 +1228,7 @@ update_cgcs_repo () {
|
||||
if [ "x$NEW_UNTRACKED" != "x" ]; then
|
||||
NEED_REBUILD=1
|
||||
fi
|
||||
|
||||
|
||||
if [ $NEED_REBUILD -eq 1 ]; then
|
||||
NEED_MOCK_CLEAN=1
|
||||
echo ""
|
||||
@ -1306,7 +1274,7 @@ mock_clean_mounts_dir () {
|
||||
fi
|
||||
fi
|
||||
if [ $RC -eq 1 ]; then
|
||||
echo "ERROR: Directory '$MOUNT' is already mounted and will cause a build failure within mock."
|
||||
echo "ERROR: Directory '$MOUNT' is already mounted and will cause a build failure within mock."
|
||||
echo "Ask your system administrator to umount '$MOUNT'."
|
||||
exit 1
|
||||
fi
|
||||
@ -1351,7 +1319,7 @@ clean_yum_cache_cfg () {
|
||||
local YUM_CACHE_MOUNT=$(readlink -f "$ROOT_DIR/root/var/cache/yum")
|
||||
local YUM_CACHE_LOCK="$CACHE_DIR/mock/yum_cache/yumcache.lock"
|
||||
# echo "clean_yum_cache YUM_CACHE_MOUNT='$YUM_CACHE_MOUNT' YUM_CACHE_LOCK='$YUM_CACHE_LOCK'"
|
||||
|
||||
|
||||
if [ "$YUM_CACHE_MOUNT" != "" ]; then
|
||||
mock_clean_mounts_dir "$YUM_CACHE_MOUNT"
|
||||
fi
|
||||
@ -1390,8 +1358,8 @@ mock_update_cfg () {
|
||||
echo "${FUNCNAME[0]}: $CFG"
|
||||
echo "=================================="
|
||||
set_mock_symlinks $CFG
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --update"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --update
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --update"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --update
|
||||
echo "=================================="
|
||||
}
|
||||
|
||||
@ -1400,8 +1368,8 @@ mock_init_cfg () {
|
||||
echo "${FUNCNAME[0]}: $CFG"
|
||||
echo "=================================="
|
||||
set_mock_symlinks $CFG
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --init"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --init
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --init"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --init
|
||||
echo "=================================="
|
||||
}
|
||||
|
||||
@ -1420,14 +1388,14 @@ mock_update_or_init_cfg () {
|
||||
if [ -d $ROOT_DIR/root ]; then
|
||||
echo "Updating the mock environment"
|
||||
set_mock_symlinks $CFG
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --update"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --update &> $TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --update"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --update &> $TMP
|
||||
RC=$?
|
||||
else
|
||||
echo "Init the mock environment"
|
||||
set_mock_symlinks $CFG
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --init"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --init &> $TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --init"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --init &> $TMP
|
||||
RC=$?
|
||||
fi
|
||||
if [ $RC -ne 0 ]; then
|
||||
@ -1443,7 +1411,7 @@ mock_update_or_init () {
|
||||
local PREFIX=$(echo $SUB_CFG | rev | cut -d . -f 2 | rev)
|
||||
( mock_update_or_init_cfg $SUB_CFG 2>&1 | sed "s#^#${PREFIX}: #" ; exit ${PIPESTATUS[0]} ) &
|
||||
done
|
||||
wait
|
||||
wait
|
||||
echo "${FUNCNAME[0]}: out"
|
||||
}
|
||||
|
||||
@ -1461,12 +1429,12 @@ NO_DESCENDANTS=0
|
||||
NO_REQUIRED=0
|
||||
NO_AUTOCLEAN=0
|
||||
NO_BUILD_INFO=0
|
||||
HELP=0
|
||||
HELP=0
|
||||
CLEAN_FLAG=0
|
||||
FORMAL_FLAG=0
|
||||
CAREFUL=0
|
||||
DEP_TEST_FLAG=0
|
||||
|
||||
|
||||
# read the options
|
||||
TEMP=$(getopt -o h --long parallel,std,rt,installer,containers,no-required,no-descendants,no-autoclean,no-build-info,dep-test,clean,tmpfs-clean,formal,careful,help,layer: -n "$ME" -- "$@")
|
||||
|
||||
@ -1502,7 +1470,7 @@ while true ; do
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
|
||||
# Reset variables
|
||||
if [ -n "$MY_WORKSPACE" ]; then
|
||||
@ -1761,7 +1729,7 @@ clean_list () {
|
||||
echo "rm -rf $d"
|
||||
\rm -rf "$d" 2>> /dev/null
|
||||
done
|
||||
|
||||
|
||||
else
|
||||
rs=$(rpm_get_srpm $r)
|
||||
if [[ "$rs" != "$sn"-[0-9]* ]]; then
|
||||
@ -1774,7 +1742,7 @@ clean_list () {
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
TARGET=$(rpm -qp --qf '%{NAME}-%{VERSION}\n' "$s")
|
||||
|
||||
if [ $CLEAN_FLAG -eq 1 ]; then
|
||||
@ -1814,7 +1782,7 @@ clean_list () {
|
||||
|
||||
\rm -f -v $RESULT_DIR/mockchain.log 2>> /dev/null
|
||||
mock_clean
|
||||
else
|
||||
else
|
||||
# If dependency test
|
||||
if [ $DEP_TEST_FLAG -eq 1 ]; then
|
||||
mock_clean
|
||||
@ -2077,7 +2045,7 @@ if [ $CLEAN_FLAG -eq 0 ] && [ $NO_DESCENDANTS -eq 0 ] && [ -f $SRPM_DIRECT_DESCE
|
||||
done
|
||||
|
||||
# For non-std build, and if non specific build targets are named, then search all
|
||||
# packages that we might build and check if they require a package that DID build
|
||||
# packages that we might build and check if they require a package that DID build
|
||||
# in the std build. If so build the package as a secondary target, even though the
|
||||
# primary target was from a different build_type.
|
||||
if [ "$BUILD_TYPE" != "std" ] && [ $ALL -eq 1 ] && [ -f $SRPM_TO_RPM_MAP_FILE ] && [ -f $SRPM_RPM_DIRECT_REQUIRES_FILE ]; then
|
||||
@ -2137,7 +2105,7 @@ if [ $CLEAN_FLAG -eq 0 ] && [ $NO_DESCENDANTS -eq 0 ] && [ -f $SRPM_DIRECT_DESCE
|
||||
done
|
||||
fi
|
||||
|
||||
# If the kernel or kernel-rt packages where absent from the primary build targets, but
|
||||
# If the kernel or kernel-rt packages where absent from the primary build targets, but
|
||||
# added as a secondary target, then make sure all out-of-tree kernel modules are also
|
||||
# added.
|
||||
for n in kernel kernel-rt; do
|
||||
@ -2266,9 +2234,9 @@ echo "SRPMS_LIST = $SRPMS_LIST"
|
||||
echo "RPMS_LIST = $RPMS_LIST"
|
||||
|
||||
|
||||
echo
|
||||
echo
|
||||
if [ $CLEAN_FLAG -eq 0 ]; then
|
||||
# pre-create these directories as $USER,
|
||||
# pre-create these directories as $USER,
|
||||
# else mock will create them as root and fails to clean them.
|
||||
# Note: keep these in sync with mockchain-parallel!
|
||||
for i in $(seq 0 $((MAX_WORKERS-1))); do
|
||||
@ -2331,28 +2299,15 @@ mock_clean_metadata
|
||||
echo
|
||||
echo "Building"
|
||||
|
||||
recreate_repodata $BUILD_BASE/results/$BUILD_ENVIRONMENT_DIR
|
||||
|
||||
CMD_PREFIX=""
|
||||
if [ -x /bin/ionice ]; then
|
||||
CMD_PREFIX="nice -n 20 ionice -c Idle /bin/ionice "
|
||||
fi
|
||||
|
||||
REAL_MOCKCHAIN=0
|
||||
MOCK_PASSTHROUGH="-m"
|
||||
MOCKCHAIN="mockchain-parallel"
|
||||
CHAIN_OPTION=""
|
||||
if file $(which mockchain) | grep -q 'Python script'; then
|
||||
REAL_MOCKCHAIN=1
|
||||
fi
|
||||
|
||||
CMD_OPTIONS="$MOCK_PASSTHROUGH --no-clean $MOCK_PASSTHROUGH --no-cleanup-after"
|
||||
CMD_OPTIONS="-m --no-clean -m --no-cleanup-after"
|
||||
if [ $CAREFUL -eq 1 ]; then
|
||||
CMD_OPTIONS="$MOCK_PASSTHROUGH --no-cleanup-after"
|
||||
CMD_OPTIONS="-m --no-cleanup-after"
|
||||
fi
|
||||
|
||||
CMD_OPTIONS+=" --log=$MOCKCHAIN_LOG"
|
||||
|
||||
echo "CAREFUL=$CAREFUL"
|
||||
|
||||
# Sets WORKERS and MOCKCHAIN_RESOURCE_ALLOCATION
|
||||
@ -2360,13 +2315,13 @@ compute_resources $SRPMS_LIST
|
||||
|
||||
|
||||
if [ -f $SRPM_RPM_DIRECT_REQUIRES_FILE ]; then
|
||||
CMD_OPTIONS+=" --srpm-dependency-file $SRPM_RPM_DIRECT_REQUIRES_FILE"
|
||||
CMD_OPTIONS="$CMD_OPTIONS --srpm-dependency-file $SRPM_RPM_DIRECT_REQUIRES_FILE"
|
||||
fi
|
||||
if [ -f "$RPM_DIRECT_REQUIRES_FILE" ]; then
|
||||
CMD_OPTIONS+=" --rpm-dependency-file $RPM_DIRECT_REQUIRES_FILE"
|
||||
CMD_OPTIONS="$CMD_OPTIONS --rpm-dependency-file $RPM_DIRECT_REQUIRES_FILE"
|
||||
fi
|
||||
if [ -f "$RPM_TO_SRPM_MAP_FILE" ]; then
|
||||
CMD_OPTIONS+=" --rpm-to-srpm-map-file $RPM_TO_SRPM_MAP_FILE"
|
||||
CMD_OPTIONS="$CMD_OPTIONS --rpm-to-srpm-map-file $RPM_TO_SRPM_MAP_FILE"
|
||||
fi
|
||||
|
||||
|
||||
@ -2387,12 +2342,12 @@ echo "MAX_WORKERS=$MAX_WORKERS"
|
||||
echo "MOCKCHAIN_RESOURCE_ALLOCATION=$MOCKCHAIN_RESOURCE_ALLOCATION"
|
||||
|
||||
|
||||
CMD="$CMD_PREFIX $MOCKCHAIN --root $BUILD_CFG --localrepo $BUILD_BASE --recurse --workers=$MAX_WORKERS --worker-resources=$MOCKCHAIN_RESOURCE_ALLOCATION --basedir=$MY_WORKSPACE --tmp_prefix=$USER --addrepo=$LOCAL_URL --addrepo=$LOCAL_SRC_URL $CMD_OPTIONS $MOCK_PASSTHROUGH --rebuild"
|
||||
CMD_BUILD_LIST="$CHAIN_OPTION $SRPMS_LIST"
|
||||
CMD="$CMD_PREFIX mockchain-parallel -r $BUILD_CFG -l $BUILD_BASE --recurse --workers=$MAX_WORKERS --worker-resources=$MOCKCHAIN_RESOURCE_ALLOCATION --basedir=$MY_WORKSPACE --log=$MOCKCHAIN_LOG --tmp_prefix=$USER --addrepo=$LOCAL_URL --addrepo=$LOCAL_SRC_URL $CMD_OPTIONS -m --rebuild $SRPMS_LIST"
|
||||
echo ""
|
||||
echo "$CMD $MOCK_PASSTHROUGH --define='_tis_dist .tis' $MOCK_PASSTHROUGH --define='platform_release $PLATFORM_RELEASE' $CMD_BUILD_LIST"
|
||||
echo "$CMD -m --define='_tis_dist .tis' -m --define='platform_release $PLATFORM_RELEASE'"
|
||||
echo ""
|
||||
trapwrap stdbuf -o0 $CMD $MOCK_PASSTHROUGH --define="_tis_dist .tis" $MOCK_PASSTHROUGH --define="platform_release $PLATFORM_RELEASE" $CMD_BUILD_LIST
|
||||
|
||||
trapwrap stdbuf -o0 $CMD -m --define="_tis_dist .tis" -m --define="platform_release $PLATFORM_RELEASE"
|
||||
MOCKCHAIN_RC=$?
|
||||
|
||||
echo $PLATFORM_RELEASE > $LAST_PLATFORM_RELEASE_FILE
|
||||
@ -2402,7 +2357,7 @@ if [ $CLEAN_FLAG -eq 0 ]; then
|
||||
fi
|
||||
|
||||
for d in $(find $RESULT_DIR -name '*.rpm' | grep -v '[.]src[.]rpm' | xargs --max-args=1 dirname | sort -u); do
|
||||
rsync -u $d/*.rpm $RPM_DIR
|
||||
rsync -u $d/*.rpm $RPM_DIR
|
||||
done
|
||||
|
||||
if [ $ALL -eq 1 ]; then
|
||||
@ -2486,5 +2441,5 @@ if [ 0$FORMAL_BUILD -eq 1 ] && [ "$USER" == "jenkins" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
) 2>&1 | stdbuf -o0 awk '{ print strftime("%H:%M:%S"), $0; fflush(); }' | tee $(date "+$MY_WORKSPACE/build-rpms-parallel_%Y-%m-%d_%H-%M-%S.log") ; exit ${PIPESTATUS[0]}
|
||||
|
@ -1,20 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2018-2020 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
#
|
||||
#
|
||||
# Builds rpm files from src.rpm files.
|
||||
#
|
||||
# This version compiles one package at a time.
|
||||
#
|
||||
# The location of packages to be built is
|
||||
#
|
||||
# The location of packages to be built is
|
||||
# $MY_WORKSPACE/<build-type>/rpmbuild/SRPMS.
|
||||
#
|
||||
# The build order is a derived from the BuildRequires in the
|
||||
# The build order is a derived from the BuildRequires in the
|
||||
# spec files in the src.rpms. Note that the BuildRequires sometimes
|
||||
# create dependency loops, so no correct order can be computed. In these
|
||||
# cases we add a retry loop. As long as one new package builds, we
|
||||
@ -103,7 +103,7 @@ create-no-clean-list () {
|
||||
local install_groups=""
|
||||
local install_packages=""
|
||||
local p
|
||||
|
||||
|
||||
for p in $(grep "config_opts\['chroot_setup_cmd'\]" $MY_BUILD_CFG | tail -n1 | cut -d '=' -f 2 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e "s/^'//" -e "s/'$//" -e 's/^install //'); do
|
||||
if [[ $p == @* ]] ; then
|
||||
install_groups=$(join_by ' ' $install_groups $(echo $p | cut -c 2-))
|
||||
@ -111,44 +111,37 @@ create-no-clean-list () {
|
||||
install_packages=$(join_by ' ' $install_packages $p)
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
local noclean_last_list_len=0
|
||||
local noclean_list=""
|
||||
local tmp_list=""
|
||||
local g
|
||||
|
||||
|
||||
for g in $install_groups; do
|
||||
# Find manditory packages in the group.
|
||||
# Discard anything before (and including) 'Mandatory Packages:'
|
||||
# and anything after (and including) 'Optional Packages:'.
|
||||
# Also discard leading spaces or '+' characters.
|
||||
tmp_list=$(${PKG_MANAGER} -c $MY_YUM_CONF groupinfo $g 2>> /dev/null \
|
||||
| awk 'f;/Mandatory Packages:/{f=1}' \
|
||||
| sed -n '/Optional Packages:/q;p' \
|
||||
| sed 's#[ +]*##')
|
||||
tmp_list=$(yum -c $MY_YUM_CONF groupinfo $g 2>> /dev/null | awk 'f;/Mandatory Packages:/{f=1}' | cut -c 5-)
|
||||
noclean_list=$(join_by ' ' $noclean_list $tmp_list)
|
||||
done
|
||||
|
||||
|
||||
noclean_list=$(join_by ' ' $noclean_list $install_packages)
|
||||
noclean_list=$(echo $noclean_list | tr ' ' '\n' | sort --uniq)
|
||||
noclean_list_len=$(echo $noclean_list | wc -w)
|
||||
|
||||
|
||||
while [ $noclean_list_len -gt $noclean_last_list_len ]; do
|
||||
noclean_last_list_len=$noclean_list_len
|
||||
noclean_list=$( (yum -c $MY_YUM_CONF deplist $noclean_list 2>> /dev/null | grep provider: | awk '{ print $2 }' | awk -F . '{ print $1 }'; for p in $noclean_list; do echo $p; done) | sort --uniq)
|
||||
noclean_list_len=$(echo $noclean_list | wc -w)
|
||||
done
|
||||
|
||||
|
||||
echo $noclean_list > $NO_CLEAN_LIST_FILE
|
||||
fi
|
||||
|
||||
cat $NO_CLEAN_LIST_FILE
|
||||
}
|
||||
|
||||
str_lst_contains() {
|
||||
str_lst_contains() {
|
||||
TARGET="$1"
|
||||
LST="$2"
|
||||
if [[ $LST =~ (^|[[:space:]])$TARGET($|[[:space:]]) ]] ; then
|
||||
if [[ $LST =~ (^|[[:space:]])$TARGET($|[[:space:]]) ]] ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@ -176,9 +169,7 @@ create_lst () {
|
||||
recreate_repodata () {
|
||||
local DIR=${1}
|
||||
|
||||
(
|
||||
mkdir -p $DIR
|
||||
cd $DIR
|
||||
(cd $DIR
|
||||
if [ -f repodata/*comps*xml ]; then
|
||||
\mv repodata/*comps*xml comps.xml
|
||||
fi
|
||||
@ -269,11 +260,11 @@ union () {
|
||||
echo $b
|
||||
fi
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# returns 0 if element is in the array
|
||||
#
|
||||
#
|
||||
# e.g. contains ARRAY $SEEKING && echo "$SEEKING is in 'ARRAY'"
|
||||
#
|
||||
contains () {
|
||||
@ -320,7 +311,7 @@ build_order_recursive () {
|
||||
needs=( $(grep "^$target;" "$SRPM_DIRECT_REQUIRES_FILE" | sed "s/$target;//" | sed 's/,/ /g') )
|
||||
needs_list=( $(intersection needs remainder_list) )
|
||||
for((idx=0;idx<${#needs_list[@]};idx++)); do
|
||||
build_order_recursive ${needs_list[idx]}
|
||||
build_order_recursive ${needs_list[idx]}
|
||||
done
|
||||
echo $target
|
||||
break
|
||||
@ -370,7 +361,7 @@ build_order () {
|
||||
UNORDERED_LIST=( ${original_list[@]} )
|
||||
while [ ${#UNORDERED_LIST[@]} -gt 0 ]; do
|
||||
element=${UNORDERED_LIST[0]}
|
||||
build_order_recursive $element
|
||||
build_order_recursive $element
|
||||
done
|
||||
fi
|
||||
}
|
||||
@ -485,7 +476,7 @@ kill_descendents ()
|
||||
recursive_promote_children=""
|
||||
recursive_children=$(pgrep -P $kill_pid)
|
||||
fi
|
||||
|
||||
|
||||
if [ $iteration -eq 0 ]; then
|
||||
other_children=$(for relevant_child in $relevant_other_children; do pgrep -P $kill_pid $relevant_child; done)
|
||||
if [ "$other_children" != "" ]; then
|
||||
@ -500,7 +491,7 @@ kill_descendents ()
|
||||
fi
|
||||
|
||||
for pid in $recursive_children; do
|
||||
kill_descendents "$pid" $kill_all $need_stop $((iteration + 1))
|
||||
kill_descendents "$pid" $kill_all $need_stop $((iteration + 1))
|
||||
done
|
||||
for pid in $recursive_promote_children; do
|
||||
kill_descendents "$pid" 1 1 $((iteration + 1))
|
||||
@ -763,11 +754,11 @@ mock_clean_cfg () {
|
||||
echo "=================================="
|
||||
mock_clean_cache_cfg $CFG
|
||||
echo "=================================="
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --scrub=all"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --scrub=all
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --scrub=all"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --scrub=all
|
||||
echo "=================================="
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --clean"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --clean
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --clean"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --clean
|
||||
### Note: this sometimes leaves behind a $MY_WORKSPACE/cache/mock/yum_cache/yumcache.lock
|
||||
echo "=================================="
|
||||
mock_clean_cache_all_cfg $CFG
|
||||
@ -842,10 +833,10 @@ mock_partial_clean_cfg () {
|
||||
local RPMS_CLEAN_LIST=""
|
||||
local NEED_FULL_MOCK_CLEAN=0
|
||||
for r in $RPMS_LIST; do
|
||||
if ! str_lst_contains $r "$NO_CLEAN_LIST" ; then
|
||||
if ! str_lst_contains $r "$NO_CLEAN_LIST" ; then
|
||||
RPMS_CLEAN_LIST=$(join_by ' ' $RPMS_CLEAN_LIST $r)
|
||||
else
|
||||
echo "Can't remove '$r' from mock environment without a wipe";
|
||||
else
|
||||
echo "Can't remove '$r' from mock environment without a wipe";
|
||||
NEED_FULL_MOCK_CLEAN=1
|
||||
fi
|
||||
done
|
||||
@ -858,19 +849,19 @@ mock_partial_clean_cfg () {
|
||||
# Intent of following is for $RPMS_LIST to be expand now while the remaining $ varaibles are for bash inside mock to expand
|
||||
echo "Try to uninstall from the mock environment these packages: $RPMS_CLEAN_LIST"
|
||||
CMD='LST="'$RPMS_CLEAN_LIST'";
|
||||
DELETE_LIST="";
|
||||
for r in $LST; do
|
||||
FOUND=$(rpm -q $r) ;
|
||||
if [ $? -eq 0 ]; then
|
||||
DELETE_LIST="$DELETE_LIST $FOUND";
|
||||
fi;
|
||||
done;
|
||||
echo "uninstalling these packages: $DELETE_LIST";
|
||||
DELETE_LIST="";
|
||||
for r in $LST; do
|
||||
FOUND=$(rpm -q $r) ;
|
||||
if [ $? -eq 0 ]; then
|
||||
DELETE_LIST="$DELETE_LIST $FOUND";
|
||||
fi;
|
||||
done;
|
||||
echo "uninstalling these packages: $DELETE_LIST";
|
||||
if [ "$DELETE_LIST" != "" ]; then
|
||||
rpm -e --nodeps $DELETE_LIST;
|
||||
fi'
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --chroot bash -c $CMD" &> $TMP
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --chroot "bash -c '$CMD'" &>> $TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --chroot bash -c $CMD" &> $TMP
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --chroot "bash -c '$CMD'" &>> $TMP
|
||||
RC=$?
|
||||
if [ $RC -ne 0 ]; then
|
||||
cat $TMP
|
||||
@ -916,8 +907,8 @@ mock_clean_cache_cfg () {
|
||||
|
||||
clean_yum_cache_cfg $CFG
|
||||
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --scrub=root-cache --scrub=yum-cache --scrub=cache" &> $TMP
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --scrub=root-cache --scrub=yum-cache --scrub=cache &>> $TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --scrub=root-cache --scrub=yum-cache --scrub=cache" &> $TMP
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --scrub=root-cache --scrub=yum-cache --scrub=cache &>> $TMP
|
||||
RC=$?
|
||||
if [ $RC -ne 0 ]; then
|
||||
cat $TMP
|
||||
@ -940,8 +931,8 @@ mock_clean_cache_all_cfg () {
|
||||
echo "=================================="
|
||||
clean_yum_cache_cfg $CFG
|
||||
echo "=================================="
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --scrub=all"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --scrub=all
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --scrub=all"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --scrub=all
|
||||
echo "=================================="
|
||||
}
|
||||
|
||||
@ -965,8 +956,8 @@ mock_clean_metadata_cfg () {
|
||||
fi
|
||||
|
||||
CMD=$((cat $CFG; grep config_opts\\[\'yum.conf\'\\\] $CFG | sed 's#\\n#\n#g') | grep '^[[]' | grep -v main | sed 's/[][]//g' | sed 's#^#yum --enablerepo=#' | sed 's#$# clean metadata#' | sort -u | tr '\n' ';')
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --chroot bash -c $CMD" &> $TMP
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --chroot "bash -c '($CMD)'" &>>$TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --chroot bash -c $CMD" &> $TMP
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --chroot "bash -c '($CMD)'" &>>$TMP
|
||||
RC=$?
|
||||
if [ $RC -ne 0 ]; then
|
||||
cat $TMP
|
||||
@ -1019,7 +1010,7 @@ update_cgcs_repo () {
|
||||
if [ "x$NEW_UNTRACKED" != "x" ]; then
|
||||
NEED_REBUILD=1
|
||||
fi
|
||||
|
||||
|
||||
if [ $NEED_REBUILD -eq 1 ]; then
|
||||
NEED_MOCK_CLEAN=1
|
||||
echo ""
|
||||
@ -1065,7 +1056,7 @@ mock_clean_mounts_dir () {
|
||||
fi
|
||||
fi
|
||||
if [ $RC -eq 1 ]; then
|
||||
echo "ERROR: Directory '$MOUNT' is already mounted and will cause a build failure within mock."
|
||||
echo "ERROR: Directory '$MOUNT' is already mounted and will cause a build failure within mock."
|
||||
echo "Ask your system administrator to umount '$MOUNT'."
|
||||
exit 1
|
||||
fi
|
||||
@ -1106,7 +1097,7 @@ clean_yum_cache_cfg () {
|
||||
local YUM_CACHE_MOUNT=$(readlink -f "$ROOT_DIR/root/var/cache/yum")
|
||||
local YUM_CACHE_LOCK="$CACHE_DIR/mock/yum_cache/yumcache.lock"
|
||||
# echo "clean_yum_cache YUM_CACHE_MOUNT='$YUM_CACHE_MOUNT' YUM_CACHE_LOCK='$YUM_CACHE_LOCK'"
|
||||
|
||||
|
||||
if [ "$YUM_CACHE_MOUNT" != "" ]; then
|
||||
mock_clean_mounts_dir "$YUM_CACHE_MOUNT"
|
||||
fi
|
||||
@ -1140,8 +1131,8 @@ mock_update_cfg () {
|
||||
echo "${FUNCNAME[0]}: $CFG"
|
||||
echo "=================================="
|
||||
set_mock_symlinks $CFG
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --update"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --update
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --update"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --update
|
||||
echo "=================================="
|
||||
}
|
||||
|
||||
@ -1150,8 +1141,8 @@ mock_init_cfg () {
|
||||
echo "${FUNCNAME[0]}: $CFG"
|
||||
echo "=================================="
|
||||
set_mock_symlinks $CFG
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --init"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --init
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --init"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --init
|
||||
echo "=================================="
|
||||
}
|
||||
|
||||
@ -1170,14 +1161,14 @@ mock_update_or_init_cfg () {
|
||||
if [ -d $ROOT_DIR/root ]; then
|
||||
echo "Updating the mock environment"
|
||||
set_mock_symlinks $CFG
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --update"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --update &> $TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --update"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --update &> $TMP
|
||||
RC=$?
|
||||
else
|
||||
echo "Init the mock environment"
|
||||
set_mock_symlinks $CFG
|
||||
echo "$MOCK --root $CFG --configdir $(dirname $CFG) --init"
|
||||
trapwrap_n $CFG $MOCK --root $CFG --configdir $(dirname $CFG) --init &> $TMP
|
||||
echo "$MOCK -r $CFG --configdir $(dirname $CFG) --init"
|
||||
trapwrap_n $CFG $MOCK -r $CFG --configdir $(dirname $CFG) --init &> $TMP
|
||||
RC=$?
|
||||
fi
|
||||
if [ $RC -ne 0 ]; then
|
||||
@ -1207,12 +1198,12 @@ NO_DESCENDANTS=0
|
||||
NO_REQUIRED=0
|
||||
NO_AUTOCLEAN=0
|
||||
NO_BUILD_INFO=0
|
||||
HELP=0
|
||||
HELP=0
|
||||
CLEAN_FLAG=0
|
||||
FORMAL_FLAG=0
|
||||
CAREFUL=0
|
||||
DEP_TEST_FLAG=0
|
||||
|
||||
|
||||
# read the options
|
||||
TEMP=$(getopt -o h --long serial,std,rt,installer,containers,no-required,no-descendants,no-autoclean,no-build-info,dep-test,clean,formal,careful,help,layer: -n "$ME" -- "$@")
|
||||
|
||||
@ -1247,7 +1238,7 @@ while true ; do
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
# Reset variables
|
||||
@ -1502,7 +1493,7 @@ clean_list () {
|
||||
echo "rm -rf $d"
|
||||
\rm -rf "$d" 2>> /dev/null
|
||||
done
|
||||
|
||||
|
||||
else
|
||||
rs=$(rpm_get_srpm $r)
|
||||
if [[ "$rs" != "$sn"-[0-9]* ]]; then
|
||||
@ -1515,7 +1506,7 @@ clean_list () {
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
TARGET=$(rpm -qp --qf '%{NAME}-%{VERSION}\n' "$s")
|
||||
|
||||
if [ $CLEAN_FLAG -eq 1 ]; then
|
||||
@ -1551,7 +1542,7 @@ clean_list () {
|
||||
|
||||
\rm -f -v $RESULT_DIR/mockchain.log 2>> /dev/null
|
||||
mock_clean
|
||||
else
|
||||
else
|
||||
# If dependency test
|
||||
if [ $DEP_TEST_FLAG -eq 1 ]; then
|
||||
mock_clean
|
||||
@ -1810,7 +1801,7 @@ if [ $CLEAN_FLAG -eq 0 ] && [ $NO_DESCENDANTS -eq 0 ] && [ -f $SRPM_DIRECT_DESCE
|
||||
done
|
||||
|
||||
# For non-std build, and if non specific build targets are named, then search all
|
||||
# packages that we might build and check if they require a package that DID build
|
||||
# packages that we might build and check if they require a package that DID build
|
||||
# in the std build. If so build the package as a secondary target, even though the
|
||||
# primary target was from a different build_type.
|
||||
if [ "$BUILD_TYPE" != "std" ] && [ $ALL -eq 1 ] && [ -f $SRPM_TO_RPM_MAP_FILE ] && [ -f $SRPM_RPM_DIRECT_REQUIRES_FILE ]; then
|
||||
@ -1870,7 +1861,7 @@ if [ $CLEAN_FLAG -eq 0 ] && [ $NO_DESCENDANTS -eq 0 ] && [ -f $SRPM_DIRECT_DESCE
|
||||
done
|
||||
fi
|
||||
|
||||
# If the kernel or kernel-rt packages where absent from the primary build targets, but
|
||||
# If the kernel or kernel-rt packages where absent from the primary build targets, but
|
||||
# added as a secondary target, then make sure all out-of-tree kernel modules are also
|
||||
# added.
|
||||
for n in kernel kernel-rt; do
|
||||
@ -2005,9 +1996,9 @@ echo "SRPMS_LIST = $SRPMS_LIST"
|
||||
echo "RPMS_LIST = $RPMS_LIST"
|
||||
|
||||
|
||||
echo
|
||||
echo
|
||||
if [ $CLEAN_FLAG -eq 0 ]; then
|
||||
# pre-create these directories as $USER,
|
||||
# pre-create these directories as $USER,
|
||||
# else mock will create them as root and fails to clean them.
|
||||
# Note: keep these in sync with mockchain-parallel!
|
||||
mkdir -p $MY_WORKSPACE/mock
|
||||
@ -2068,46 +2059,27 @@ mock_clean_metadata
|
||||
echo
|
||||
echo "Building"
|
||||
|
||||
recreate_repodata $BUILD_BASE/results/$BUILD_ENVIRONMENT_DIR
|
||||
|
||||
CMD_PREFIX=""
|
||||
if [ -x /bin/ionice ]; then
|
||||
CMD_PREFIX="nice -n 20 ionice -c Idle /bin/ionice "
|
||||
fi
|
||||
|
||||
REAL_MOCKCHAIN=0
|
||||
MOCK_PASSTHROUGH=""
|
||||
MOCKCHAIN="mock"
|
||||
CHAIN_OPTION="--chain"
|
||||
if file $(which mockchain) | grep -q 'Python script'; then
|
||||
REAL_MOCKCHAIN=1
|
||||
MOCK_PASSTHROUGH="-m"
|
||||
MOCKCHAIN="mockchain"
|
||||
CHAIN_OPTION=""
|
||||
fi
|
||||
|
||||
CMD_OPTIONS="$MOCK_PASSTHROUGH --no-clean $MOCK_PASSTHROUGH --no-cleanup-after"
|
||||
CMD_OPTIONS="-m --no-clean -m --no-cleanup-after"
|
||||
if [ $CAREFUL -eq 1 ]; then
|
||||
CMD_OPTIONS="$MOCK_PASSTHROUGH --no-cleanup-after"
|
||||
fi
|
||||
if [ $REAL_MOCKCHAIN -eq 1 ]; then
|
||||
CMD_OPTIONS+=" --log=$MOCKCHAIN_LOG"
|
||||
CMD_OPTIONS="-m --no-cleanup-after"
|
||||
fi
|
||||
echo "CAREFUL=$CAREFUL"
|
||||
echo "CMD_OPTIONS=$CMD_OPTIONS"
|
||||
|
||||
CMD="$CMD_PREFIX $MOCKCHAIN --root $BUILD_CFG --localrepo $BUILD_BASE --recurse --tmp_prefix=$USER --addrepo=$LOCAL_URL --addrepo=$LOCAL_SRC_URL $MOCK_PASSTHROUGH --rootdir=$BUILD_BASE/mock/root $CMD_OPTIONS $MOCK_PASSTHROUGH --rebuild"
|
||||
CMD_BUILD_LIST="$CHAIN_OPTION $SRPMS_LIST"
|
||||
echo ""
|
||||
echo "$CMD $MOCK_PASSTHROUGH --define='_tis_dist .tis' $MOCK_PASSTHROUGH --define='platform_release $PLATFORM_RELEASE' $CMD_BUILD_LIST"
|
||||
echo ""
|
||||
trapwrap stdbuf -o0 $CMD $MOCK_PASSTHROUGH --define="_tis_dist .tis" $MOCK_PASSTHROUGH --define="platform_release $PLATFORM_RELEASE" $CMD_BUILD_LIST
|
||||
CMD="$CMD_PREFIX mockchain -r $BUILD_CFG -l $BUILD_BASE --recurse --log=$MOCKCHAIN_LOG --tmp_prefix=$USER --addrepo=$LOCAL_URL --addrepo=$LOCAL_SRC_URL -m --rootdir=$BUILD_BASE/mock/root $CMD_OPTIONS -m --rebuild $SRPMS_LIST"
|
||||
echo "$CMD -m --define='_tis_dist .tis' -m --define='platform_release $PLATFORM_RELEASE'"
|
||||
trapwrap stdbuf -o0 $CMD -m --define='_tis_dist .tis' -m --define="platform_release $PLATFORM_RELEASE"
|
||||
MOCKCHAIN_RC=$?
|
||||
|
||||
echo $PLATFORM_RELEASE > $LAST_PLATFORM_RELEASE_FILE
|
||||
|
||||
for d in $(find $RESULT_DIR -name '*.rpm' | grep -v '[.]src[.]rpm' | xargs --max-args=1 dirname | sort -u); do
|
||||
rsync -u $d/*.rpm $RPM_DIR
|
||||
rsync -u $d/*.rpm $RPM_DIR
|
||||
done
|
||||
|
||||
if [ $ALL -eq 1 ]; then
|
||||
@ -2191,5 +2163,5 @@ if [ 0$FORMAL_BUILD -eq 1 ] && [ "$USER" == "jenkins" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
) 2>&1 | stdbuf -o0 awk '{ print strftime("%H:%M:%S"), $0; fflush(); }' | tee $(date "+$MY_WORKSPACE/build-rpms-serial_%Y-%m-%d_%H-%M-%S.log") ; exit ${PIPESTATUS[0]}
|
||||
|
@ -1,11 +1,5 @@
|
||||
#!/bin/env bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2018-2020 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# Here's the score, kids. There are a few different places from which we can
|
||||
# get packages. In priority order, they are:
|
||||
#
|
||||
@ -32,24 +26,18 @@
|
||||
# export/dist/report_deps.txt
|
||||
#
|
||||
|
||||
CGTS_DEPS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
|
||||
|
||||
# Set REPOQUERY, REPOQUERY_SUB_COMMAND, REPOQUERY_RESOLVE and
|
||||
# REPOQUERY_WHATPROVIDES_DELIM for our build environment.
|
||||
source ${CGTS_DEPS_DIR}/../pkg-manager-utils.sh
|
||||
|
||||
# This function generates a simple file of dependencies we're trying to resolve
|
||||
function generate_dep_list {
|
||||
TMP_RPM_DB=$(mktemp -d $(pwd)/tmp_rpm_db_XXXXXX)
|
||||
mkdir -p $TMP_RPM_DB
|
||||
rpm --initdb --dbpath $TMP_RPM_DB
|
||||
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' > $DEPLISTFILE_NEW 2>&1
|
||||
cat $DEPLISTFILE_NEW >> $DEPDETAILLISTFILE
|
||||
cat $DEPLISTFILE_NEW \
|
||||
| grep -v -e "error:" -e "warning:" -e "Preparing..." \
|
||||
-e "Verifying..." -e "installing package" \
|
||||
| sed -e "s/ is needed by.*$//" -e "s/ >=.*$//" \
|
||||
| sort -u > $DEPLISTFILE
|
||||
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' >> $DEPDETAILLISTFILE 2>&1
|
||||
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' 2>&1 \
|
||||
| grep -v "error:" \
|
||||
| grep -v "warning:" \
|
||||
| grep -v "Preparing..." \
|
||||
| grep -v "installing package" \
|
||||
| sed "s/ is needed by.*$//" | sed "s/ >=.*$//" | sort -u > $DEPLISTFILE
|
||||
\rm -rf $TMP_RPM_DB
|
||||
}
|
||||
|
||||
@ -91,17 +79,8 @@ function install_deps {
|
||||
|
||||
# go through each repo and convert deps to packages based on package name
|
||||
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
|
||||
echo "TMPDIR=${TMP_DIR}"\
|
||||
"${REPOQUERY} --config=${YUM} --repoid=$REPOID"\
|
||||
"${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch"\
|
||||
"${DEP_LIST} --qf='%{name}'"
|
||||
|
||||
TMPDIR=${TMP_DIR} \
|
||||
${REPOQUERY} --config=${YUM} --repoid=$REPOID \
|
||||
${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch \
|
||||
--qf='%{name}' ${DEP_LIST} \
|
||||
| sed "s/kernel-debug/kernel/g" >> $UNSORTED_PACKAGES
|
||||
|
||||
echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch ${DEP_LIST} --qf='%{name}'"
|
||||
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $UNSORTED_PACKAGES
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
done
|
||||
sort $UNSORTED_PACKAGES -u > $SORTED_PACKAGES
|
||||
@ -121,24 +100,15 @@ function install_deps {
|
||||
\cp $SORTED_PACKAGES $UNSORTED_PACKAGES
|
||||
while read DEP
|
||||
do
|
||||
DEP_LIST="${DEP_LIST}${REPOQUERY_WHATPROVIDES_DELIM}${DEP}"
|
||||
DEP_LIST="${DEP_LIST} ${DEP}"
|
||||
done < $UNRESOLVED_PACKAGES
|
||||
|
||||
DEP_LIST=$(echo "$DEP_LIST" | sed "s/^${REPOQUERY_WHATPROVIDES_DELIM}//g")
|
||||
DEP_LIST=$(echo "$DEP_LIST" | sed 's/^ //g')
|
||||
if [ "$DEP_LIST" != "" ]; then
|
||||
|
||||
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
|
||||
echo "TMPDIR=${TMP_DIR}"\
|
||||
"${REPOQUERY} --config=${YUM} --repoid=${REPOID}"\
|
||||
"${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch"\
|
||||
"--qf='%{name}' --whatprovides ${DEP_LIST}"
|
||||
|
||||
TMPDIR=${TMP_DIR} \
|
||||
${REPOQUERY} --config=${YUM} --repoid=${REPOID} \
|
||||
${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch \
|
||||
--qf='%{name}' --whatprovides "${DEP_LIST}" \
|
||||
| sed "s/kernel-debug/kernel/g" >> $UNSORTED_PACKAGES
|
||||
|
||||
echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --whatprovides ${DEP_LIST} --qf='%{name}'"
|
||||
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' --whatprovides ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $UNSORTED_PACKAGES
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
done
|
||||
fi
|
||||
@ -167,20 +137,8 @@ function install_deps {
|
||||
|
||||
if [[ ! -z "${TARGETS// }" ]]; then
|
||||
REPO_PATH=$(cat $YUM | sed -n "/^\[$REPOID\]\$/,\$p" | grep '^baseurl=' | head -n 1 | awk -F 'file://' '{print $2}' | sed 's:/$::')
|
||||
|
||||
>&2 echo "TMPDIR=${TMP_DIR}"\
|
||||
"${REPOQUERY} --config=${YUM} --repoid=${REPOID}"\
|
||||
"${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch"\
|
||||
"--qf='%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}'"\
|
||||
"${REPOQUERY_RESOLVE} ${TARGETS}"
|
||||
|
||||
TMPDIR=${TMP_DIR} \
|
||||
${REPOQUERY} --config=${YUM} --repoid=${REPOID} \
|
||||
${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch \
|
||||
--qf="%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}" \
|
||||
${REPOQUERY_RESOLVE} ${TARGETS} \
|
||||
| sort -r -V > $TMPFILE
|
||||
|
||||
>&2 echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf='%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}'"
|
||||
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf="%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}" | sort -r -V > $TMPFILE
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
|
||||
while read STR
|
||||
@ -199,11 +157,7 @@ function install_deps {
|
||||
cp $PKG_PATH .
|
||||
if [ $? -ne 0 ]; then
|
||||
>&2 echo " Here's what I have to work with..."
|
||||
>&2 echo " TMPDIR=${TMP_DIR}"\
|
||||
"${REPOQUERY} --config=${YUM} --repoid=${REPOID}"\
|
||||
"${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch"\
|
||||
"--qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\""\
|
||||
"${REPOQUERY_RESOLVE} ${PKG}"
|
||||
>&2 echo " TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $PKG --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\""
|
||||
>&2 echo " PKG=$PKG PKG_FILE=$PKG_FILE REPO_PATH=$REPO_PATH PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH"
|
||||
fi
|
||||
|
||||
@ -218,8 +172,8 @@ function install_deps {
|
||||
echo " path $PKG_PATH" >> $BUILT_REPORT
|
||||
FOUND_UNKNOWN=1
|
||||
fi
|
||||
done < $TMPFILE
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
done < $TMPFILE #<<< "$(TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\" | sort -r -V)"
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
TARGETS="$UNRESOLVED"
|
||||
fi
|
||||
done
|
||||
@ -266,7 +220,6 @@ OUTPUT_DIR=$MY_WORKSPACE/export
|
||||
TMP_DIR=$MY_WORKSPACE/tmp
|
||||
YUM=$OUTPUT_DIR/yum.conf
|
||||
DEPLISTFILE=$OUTPUT_DIR/deps.txt
|
||||
DEPLISTFILE_NEW=$OUTPUT_DIR/deps_new.txt
|
||||
DEPDETAILLISTFILE=$OUTPUT_DIR/deps_detail.txt
|
||||
|
||||
BUILT_REPORT=$OUTPUT_DIR/local.txt
|
||||
|
@ -1,29 +1,15 @@
|
||||
#!/bin/env bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2018-2020 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
CGTS_DEPS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
|
||||
|
||||
# Set REPOQUERY, REPOQUERY_SUB_COMMAND, REPOQUERY_RESOLVE and
|
||||
# REPOQUERY_WHATPROVIDES_DELIM for our build environment.
|
||||
source ${CGTS_DEPS_DIR}/../pkg-manager-utils.sh
|
||||
|
||||
function generate_dep_list {
|
||||
TMP_RPM_DB=$(mktemp -d $(pwd)/tmp_rpm_db_XXXXXX)
|
||||
mkdir -p $TMP_RPM_DB
|
||||
rpm --initdb --dbpath $TMP_RPM_DB
|
||||
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' > $DEPLISTFILE_NEW 2>&1
|
||||
cat $DEPLISTFILE_NEW >> $DEPDETAILLISTFILE
|
||||
cat $DEPLISTFILE_NEW \
|
||||
| grep -v -e "error:" -e "warning:" -e "Preparing..." \
|
||||
-e "Verifying..." -e "installing package" \
|
||||
| sed -e "s/ is needed by.*$//" -e "s/ >=.*$//" \
|
||||
| sort -u > $DEPLISTFILE
|
||||
\rm -rf $TMP_RPM_DB
|
||||
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' >> $DEPDETAILLISTFILE 2>&1
|
||||
rpm --dbpath $TMP_RPM_DB --test -Uvh --replacefiles '*.rpm' 2>&1 \
|
||||
| grep -v "error:" \
|
||||
| grep -v "warning:" \
|
||||
| grep -v "Preparing..." \
|
||||
| sed "s/ is needed by.*$//" | sed "s/ >=.*$//" | sort -u > $DEPLISTFILE
|
||||
rm -rf $TMP_RPM_DB
|
||||
}
|
||||
|
||||
function install_deps {
|
||||
@ -34,11 +20,9 @@ function install_deps {
|
||||
|
||||
while read DEP
|
||||
do
|
||||
DEP_LIST="${DEP_LIST}${REPOQUERY_WHATPROVIDES_DELIM}${DEP}"
|
||||
DEP_LIST="${DEP_LIST} ${DEP}"
|
||||
done < $DEP_LIST_FILE
|
||||
|
||||
DEP_LIST=$(echo "$DEP_LIST" | sed "s/^${REPOQUERY_WHATPROVIDES_DELIM}//g")
|
||||
|
||||
echo "Debug: List of deps to resolve: ${DEP_LIST}"
|
||||
|
||||
if [ -z "${DEP_LIST}" ]; then
|
||||
@ -46,17 +30,11 @@ function install_deps {
|
||||
fi
|
||||
|
||||
# go through each repo and convert deps to packages
|
||||
|
||||
for REPOID in `grep '^[[].*[]]$' $YUM | grep -v '[[]main[]]' | awk -F '[][]' '{print $2 }'`; do
|
||||
echo "TMPDIR=${TMP_DIR}"\
|
||||
"${REPOQUERY} --config=${YUM} --repoid=${REPOID}"\
|
||||
"${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch"\
|
||||
"--qf='%{name}' --whatprovides ${DEP_LIST}"
|
||||
TMPDIR=${TMP_DIR} \
|
||||
${REPOQUERY} --config=${YUM} --repoid=${REPOID} \
|
||||
${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch \
|
||||
--qf='%{name}' --whatprovides ${DEP_LIST} \
|
||||
| sed "s/kernel-debug/kernel/g" >> $TMPFILE
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --whatprovides ${DEP_LIST} --qf='%{name}'"
|
||||
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --qf='%{name}' --whatprovides ${DEP_LIST} | sed "s/kernel-debug/kernel/g" >> $TMPFILE
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
done
|
||||
sort $TMPFILE -u > $TMPFILE1
|
||||
rm $TMPFILE
|
||||
@ -77,19 +55,9 @@ function install_deps {
|
||||
|
||||
if [[ ! -z "${TARGETS// }" ]]; then
|
||||
REPO_PATH=$(cat $YUM | sed -n "/^\[$REPOID\]\$/,\$p" | grep '^baseurl=' | head -n 1 | awk -F 'file://' '{print $2}' | sed 's:/$::')
|
||||
>&2 echo "TMPDIR=${TMP_DIR}"\
|
||||
"${REPOQUERY} --config=${YUM} --repoid=${REPOID}"\
|
||||
"${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch"\
|
||||
"--qf='%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}'"\
|
||||
"${REPOQUERY_RESOLVE} ${TARGETS}"
|
||||
TMPDIR=${TMP_DIR} \
|
||||
${REPOQUERY} --config=${YUM} --repoid=${REPOID} \
|
||||
${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch \
|
||||
--qf="%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}" \
|
||||
${REPOQUERY_RESOLVE} ${TARGETS} \
|
||||
| sort -r -V >> $TMPFILE
|
||||
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
>&2 echo "TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf='%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}'"
|
||||
TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf="%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}" | sort -r -V >> $TMPFILE
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
|
||||
while read STR
|
||||
do
|
||||
@ -107,11 +75,7 @@ function install_deps {
|
||||
cp $PKG_PATH .
|
||||
if [ $? -ne 0 ]; then
|
||||
>&2 echo " Here's what I have to work with..."
|
||||
>&2 echo " TMPDIR=${TMP_DIR}"\
|
||||
"${REPOQUERY} -c ${YUM} --repoid=${REPOID}"\
|
||||
"${REPOQUERY_SUB_COMMAND} --arch=x86_64,noarch"\
|
||||
"--qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\""\
|
||||
"${REPOQUERY_RESOLVE} ${PKG}"
|
||||
>&2 echo " TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $PKG --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\""
|
||||
>&2 echo " PKG=$PKG PKG_FILE=$PKG_FILE REPO_PATH=$REPO_PATH PKG_REL_PATH=$PKG_REL_PATH PKG_PATH=$PKG_PATH"
|
||||
fi
|
||||
|
||||
@ -127,9 +91,8 @@ function install_deps {
|
||||
echo " path $PKG_PATH" >> $BUILT_REPORT
|
||||
FOUND_UNKNOWN=1
|
||||
fi
|
||||
done < $TMPFILE
|
||||
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
done < $TMPFILE #<<< "$(TMPDIR=$TMP_DIR repoquery -c $YUM --repoid=$REPOID --arch=x86_64,noarch --resolve $TARGETS --qf=\"%{name} %{name}-%{version}-%{release}.%{arch}.rpm %{relativepath}\" | sort -r -V)"
|
||||
\rm -rf $TMP_DIR/yum-$USER-*
|
||||
TARGETS="$UNRESOLVED"
|
||||
fi
|
||||
done
|
||||
@ -180,7 +143,6 @@ OUTPUT_DIR=${ROOT}/newDisk
|
||||
YUM=${ROOT}/yum.conf
|
||||
TMP_DIR=${ROOT}/tmp
|
||||
DEPLISTFILE=${ROOT}/deps.txt
|
||||
DEPLISTFILE_NEW=${ROOT}/deps_new.txt
|
||||
DEPDETAILLISTFILE=${ROOT}/deps_detail.txt
|
||||
INSTALLDIR=${ROOT}/newDisk/isolinux/Packages
|
||||
|
||||
|
@ -1,12 +1,6 @@
|
||||
#!/bin/bash
|
||||
# set -x
|
||||
|
||||
#
|
||||
# Copyright (c) 2018-2020 Wind River Systems, Inc.
|
||||
#
|
||||