root/build-tools/build_minimal_iso/build.sh
Scott Little 01c5009d7d Build script readiness for renaming cgcs-centos-repo to centos-repo
I want the build to work with either centos-repo or cgcs-centos-repo.
In many places we will be testing for the existance centos-repo as
the prefered path, then fall back to cgcs-centos-repo as an alternative.
If neither are present, either exit or continue but assuming the new
path is intended.

NOTE: The patch_rebase_1/2/3/4 scripts remain broken, but I hope
to salvage them one day.  The current coding assumes content under
centos-repo/cgcs-centos-repo is managed by a git, which is not
currently true.

Story: 2006387
Task: 36912
Change-Id: I8f694814c41957c5b37eb2e64b653b7d42f2e2c9
Signed-off-by: Scott Little <scott.little@windriver.com>
2020-09-24 11:59:55 -04:00

56 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
CREATEREPO=$(which createrepo_c)
if [ $? -ne 0 ]; then
CREATEREPO="createrepo"
fi
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
# If a file listed in list.txt is missing, this function attempts to find the
# RPM and copy it to the local directory. This should not be required normally
# and is only used when collecting the source RPMs initially.
function findSrc {
local lookingFor=$1
find ${CENTOS_REPO}/Source -name $lookingFor | xargs -I '{}' cp '{}' .
find $MY_REPO/cgcs-tis-repo/Source -name $lookingFor | xargs -I '{}' cp '{}' .
find $MY_WORKSPACE/std/rpmbuild/SRPMS -name $lookingFor | xargs -I '{}' cp '{}' .
}
rm -f success.txt
rm -f fail.txt
rm -f missing.txt
mkdir -p results
infile=list.txt
while read p; do
if [ ! -f "$p" ]; then
findSrc $p
if [ ! -f "$p" ]; then
echo "couldn't find" >> missing.txt
echo "couldn't find $p" >> missing.txt
continue
fi
echo "found $p"
fi
mock -r build.cfg $p --resultdir=results --no-clean
if [ $? -eq 0 ]; then
echo "$p" >> success.txt
cd results
$CREATEREPO .
cd ..
else
echo "$p" >> fail.txt
fi
done < $infile