Build hangs on macro resolution in spec file
Problem: Hung on a spec file that contains a seemingly self referential macro ... Version: %{_version} Normally 'Version: x.y.z' has the effect of setting macro %{_version}. In effect we have 'x=x'. Not sure how rpm handles this, but we need to prevent a recursion in our evaluation scripts. Solution: 1) Test for recursion in spec_evaluate() and fail rather than entering into a recursion. 2) Record the version from the srpm file name into an environment variable. If we fail to read the version from the spec file directly, substitute the one from the environment variable, if defined. Note: Tripped up on mismatched '`' during testing, so substituted all occurances with $(). Now a good browser should be able to highlight an future mismatches. Story: 2002839 Task: 22778 Change-Id: Ib69f879e531d842ff007d473bd3ad34db46cabf1 Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
parent
f31c793761
commit
8744c5f598
@ -490,6 +490,9 @@ build_dir_srpm () {
|
||||
local TARGET_FOUND=""
|
||||
local RC=0
|
||||
|
||||
export SRPM_EXPORT_NAME=$NAME
|
||||
export SRPM_EXPORT_VER=$VER
|
||||
|
||||
local NEED_BUILD=0
|
||||
|
||||
if [ "x$TARGETS" == "x" ]; then
|
||||
@ -1140,20 +1143,24 @@ reaper () {
|
||||
reaped=$((reaped+1))
|
||||
release_build_env $i
|
||||
if [ $ret -ne 0 ]; then
|
||||
# if [ $ret -eq 1 ]; then
|
||||
VERB="build"
|
||||
if [ $EDIT_FLAG ]; then
|
||||
VERB="edit"
|
||||
VERB="build"
|
||||
|
||||
if [ $EDIT_FLAG -eq 1 ]; then
|
||||
VERB="edit"
|
||||
if [ $CLEAN_FLAG -eq 1 ]; then
|
||||
VERB="edit clean"
|
||||
fi
|
||||
if [ $CLEAN_FLAG ]; then
|
||||
VERB="clean"
|
||||
fi
|
||||
sleep 1
|
||||
echo "ERROR: Failed to $VERB src.rpm from source at 'b$i'"
|
||||
cat "$LOG_DIR/$i" >> $LOG_DIR/errors
|
||||
echo "ERROR: Failed to $VERB src.rpm from source at 'b$i'" >> $LOG_DIR/errors
|
||||
echo "" >> $LOG_DIR/errors
|
||||
# fi
|
||||
fi
|
||||
|
||||
if [ $CLEAN_FLAG -eq 1 ]; then
|
||||
VERB="clean"
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
echo "ERROR: Failed to $VERB src.rpm from source at 'b$i'"
|
||||
cat "$LOG_DIR/$i" >> $LOG_DIR/errors
|
||||
echo "ERROR: Failed to $VERB src.rpm from source at 'b$i'" >> $LOG_DIR/errors
|
||||
echo "" >> $LOG_DIR/errors
|
||||
STOP_SCHEDULING=1
|
||||
fi
|
||||
fi
|
||||
|
@ -452,11 +452,15 @@ build_dir_srpm () {
|
||||
|
||||
local ORIG_SRPM=$(basename $ORIG_SRPM_PATH)
|
||||
local NAME=`rpm -q --queryformat '%{NAME}\n' --nosignature -p $ORIG_SRPM_PATH`
|
||||
local VER=`rpm -q --queryformat '%{VERSION}\n' --nosignature -p $ORIG_SRPM_PATH`
|
||||
local PKG_NAME_VER=`rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}\n' --nosignature -p $ORIG_SRPM_PATH`
|
||||
local PKG_DIR="$NAME"
|
||||
local TARGET_FOUND=""
|
||||
local RC=0
|
||||
|
||||
export SRPM_EXPORT_NAME=$NAME
|
||||
export SRPM_EXPORT_VER=$VER
|
||||
|
||||
local NEED_BUILD=0
|
||||
|
||||
if [ "x$TARGETS" == "x" ]; then
|
||||
@ -1011,10 +1015,15 @@ for g in `find "$SRC_BASE" -type d -name .git | sort -V`; do
|
||||
if [ $RC -ne 0 ]; then
|
||||
if [ $RC -eq 1 ]; then
|
||||
VERB="build"
|
||||
if [ $EDIT_FLAG ]; then
|
||||
|
||||
if [ $EDIT_FLAG -eq 1 ]; then
|
||||
VERB="edit"
|
||||
if [ $CLEAN_FLAG -eq 1 ]; then
|
||||
VERB="edit clean"
|
||||
fi
|
||||
fi
|
||||
if [ $CLEAN_FLAG ]; then
|
||||
|
||||
if [ $CLEAN_FLAG -eq 1 ]; then
|
||||
VERB="clean"
|
||||
fi
|
||||
echo "ERROR: Failed to $VERB src.rpm from source at '$p'"
|
||||
@ -1113,7 +1122,6 @@ if [ $ALL -eq 1 ]; then
|
||||
fi
|
||||
fi
|
||||
done
|
||||
set +x
|
||||
fi
|
||||
|
||||
if [ $CLEAN_FLAG -eq 1 ]; then
|
||||
|
@ -28,35 +28,50 @@ spec_evaluate () {
|
||||
local SPEC_FILE=$2
|
||||
local RPMBUILD_DIR=$3
|
||||
|
||||
local LAST_SPEC_EVALUATING="$SPEC_EVALUATING"
|
||||
local MACRO=""
|
||||
local MACRO_VALUE=""
|
||||
local RC=0
|
||||
|
||||
if [ "x$RPMBUILD_DIR" == "x" ];then
|
||||
RPMBUILD_DIR=$(dirname $(dirname $SPEC_FILE))
|
||||
fi
|
||||
|
||||
MACRO=`expr match "$RAW_VALUE" '.*\(%{[^}]*}\)'`
|
||||
MACRO=$(expr match "$RAW_VALUE" '.*\(%{[^}]*}\)')
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$RAW_VALUE"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "x$SPEC_EVALUATING" == "x" ]; then
|
||||
SPEC_EVALUATING=":$MACRO:"
|
||||
else
|
||||
echo "$SPEC_EVALUATING" | grep -q ":$MACRO:"
|
||||
if [ $? -eq 0 ]; then
|
||||
# Break a recursion
|
||||
>&2 echo "ERROR: evaluation of macro '$MACRO' failed due to recursion"
|
||||
return 1
|
||||
fi
|
||||
SPEC_EVALUATING="$LAST_SPEC_EVALUATING$MACRO:"
|
||||
fi
|
||||
|
||||
# >&2 echo "spec_evaluate: MACRO=$MACRO"
|
||||
local MACRO_NAME2=${MACRO#%{}
|
||||
local MACRO_NAME3=${MACRO_NAME2%\}}
|
||||
local PREFIX=`expr match "$MACRO_NAME3" '\([!?]*\)'`
|
||||
local PREFIX=$(expr match "$MACRO_NAME3" '\([!?]*\)')
|
||||
local MACRO_NAME=${MACRO_NAME3#${PREFIX}}
|
||||
|
||||
# >&2 echo "spec_evaluate: MACRO_NAME=$MACRO_NAME"
|
||||
MACRO_VALUE=`spec_find_macro $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR`
|
||||
MACRO_VALUE=$(spec_find_macro $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR)
|
||||
if [ $? -ne 0 ]; then
|
||||
MACRO_VALUE=`spec_find_global $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR`
|
||||
# >&2 echo "CALL: spec_find_global $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR"
|
||||
MACRO_VALUE=$(spec_find_global $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR)
|
||||
if [ $? -ne 0 ]; then
|
||||
MACRO_VALUE=`spec_find_tag ${MACRO_NAME^} $SPEC_FILE $RPMBUILD_DIR`
|
||||
MACRO_VALUE=$(spec_find_tag ${MACRO_NAME^} $SPEC_FILE $RPMBUILD_DIR)
|
||||
if [ $? -ne 0 ]; then
|
||||
MACRO_VALUE=`macro_find_macro $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR`
|
||||
MACRO_VALUE=$(macro_find_macro $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR)
|
||||
if [ $? -ne 0 ]; then
|
||||
MACRO_VALUE=`spec_find_macro_via_rpm $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR`
|
||||
MACRO_VALUE=$(spec_find_macro_via_rpm $MACRO_NAME $SPEC_FILE $RPMBUILD_DIR)
|
||||
if [ $? -ne 0 ]; then
|
||||
case "$MACRO_NAME" in
|
||||
|
||||
@ -73,6 +88,7 @@ spec_evaluate () {
|
||||
>&2 echo "NOTE: optional macro '$MACRO' not defined"
|
||||
else
|
||||
>&2 echo "ERROR: evaluation of macro '$MACRO' failed"
|
||||
SPEC_EVALUATING="$LAST_SPEC_EVALUATING"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
@ -86,6 +102,9 @@ spec_evaluate () {
|
||||
local NEW_VALUE=${RAW_VALUE/"${MACRO}"/${MACRO_VALUE}}
|
||||
# >&2 echo "spec_evaluate: NEW_VALUE=$NEW_VALUE"
|
||||
spec_evaluate "$NEW_VALUE" "$SPEC_FILE" "$RPMBUILD_DIR"
|
||||
RC=$?
|
||||
SPEC_EVALUATING="$LAST_SPEC_EVALUATING"
|
||||
return $RC
|
||||
}
|
||||
|
||||
macro_find_macro () {
|
||||
@ -99,7 +118,7 @@ macro_find_macro () {
|
||||
fi
|
||||
|
||||
# >&2 echo "grep ^%$TARGET $RPM_MACRO_FILE"
|
||||
LINE=`grep "^%$TARGET[[:space:]]" $RPM_MACRO_FILE`
|
||||
LINE=$(grep "^%$TARGET[[:space:]]" $RPM_MACRO_FILE)
|
||||
if [ $? -eq 1 ]; then
|
||||
>&2 echo "macro_find_macro: '%$TARGET' not found in file '$RPM_MACRO_FILE'"
|
||||
echo ""
|
||||
@ -153,11 +172,11 @@ spec_find_macro () {
|
||||
fi
|
||||
|
||||
# >&2 echo "grep ^%define $TARGET $SPEC_FILE"
|
||||
LINE=`grep "^%define $TARGET[[:space:]]" $SPEC_FILE`
|
||||
LINE=$(grep "^%define $TARGET[[:space:]]" $SPEC_FILE)
|
||||
if [ $? -eq 1 ]; then
|
||||
LINE=`grep "^%$TARGET[[:space:]]" $SPEC_FILE`
|
||||
LINE=$(grep "^%$TARGET[[:space:]]" $SPEC_FILE)
|
||||
if [ $? -eq 1 ]; then
|
||||
>&2 echo "spec_find_macro: Neither '%define $TARGET' nor '%$TARGET' not found in file '$SPEC_FILE'"
|
||||
>&2 echo "spec_find_macro: Neither '%define $TARGET' nor '%$TARGET' found in file '$SPEC_FILE'"
|
||||
echo ""
|
||||
return 1
|
||||
else
|
||||
@ -252,7 +271,7 @@ spec_find_global () {
|
||||
RPMBUILD_DIR=$(dirname $(dirname $SPEC_FILE))
|
||||
fi
|
||||
|
||||
LINE=`grep "^%global $TARGET" $SPEC_FILE`
|
||||
LINE=$(grep "^%global $TARGET" $SPEC_FILE)
|
||||
if [ $? -eq 1 ]; then
|
||||
>&2 echo "spec_find_global: '%global $TARGET' not found in file '$SPEC_FILE'"
|
||||
echo ""
|
||||
@ -282,7 +301,7 @@ spec_find_patch_args () {
|
||||
fi
|
||||
|
||||
PATCH_LOWER_NO=$(echo $PATCH_NO | tr '[:upper:]' '[:lower:]')
|
||||
LINE=`grep "^%$PATCH_LOWER_NO " $SPEC_FILE`
|
||||
LINE=$(grep "^%$PATCH_LOWER_NO " $SPEC_FILE)
|
||||
if [ $? -eq 1 ]; then
|
||||
>&2 echo "pec_find_patch_args: $PATCH_LOWER_NO' not found in file '$SPEC_FILE'"
|
||||
echo "-p1"
|
||||
@ -505,7 +524,7 @@ spec_match_package_list () {
|
||||
RPMBUILD_DIR=$(dirname $(dirname $SPEC_FILE))
|
||||
fi
|
||||
|
||||
for PKG_NAME in `spec_list_packages "$SPEC_FILE" "$RPMBUILD_DIR"`; do
|
||||
for PKG_NAME in $(spec_list_packages "$SPEC_FILE" "$RPMBUILD_DIR"); do
|
||||
for TARGET in "${TARGET_LIST[@]}"; do
|
||||
if [ "$PKG_NAME" == "$TARGET" ]; then
|
||||
echo $TARGET
|
||||
@ -532,7 +551,7 @@ spec_match_package () {
|
||||
RPMBUILD_DIR=$(dirname $(dirname $SPEC_FILE))
|
||||
fi
|
||||
|
||||
for PKG_NAME in `spec_list_packages "$SPEC_FILE" "$RPMBUILD_DIR"`; do
|
||||
for PKG_NAME in $(spec_list_packages "$SPEC_FILE" "$RPMBUILD_DIR"); do
|
||||
if [ "$PKG_NAME" == "$TARGET" ]; then
|
||||
echo "found target '$TARGET' in file '$SPEC_FILE' as a package name"
|
||||
return 0
|
||||
@ -556,7 +575,7 @@ spec_match_target_list () {
|
||||
RPMBUILD_DIR=$(dirname $(dirname $SPEC_FILE))
|
||||
fi
|
||||
|
||||
NAME=`spec_find_tag Name "$SPEC_FILE" "$RPMBUILD_DIR"`
|
||||
NAME=$(spec_find_tag Name "$SPEC_FILE" "$RPMBUILD_DIR")
|
||||
if [ $? -eq 0 ]; then
|
||||
for TARGET in "${TARGET_LIST[@]}"; do
|
||||
if [ "$NAME" == "$TARGET" ]; then
|
||||
@ -570,7 +589,7 @@ spec_match_target_list () {
|
||||
done
|
||||
fi
|
||||
|
||||
SERVICE=`spec_find_global service "$SPEC_FILE" "$RPMBUILD_DIR"`
|
||||
SERVICE=$(spec_find_global service "$SPEC_FILE" "$RPMBUILD_DIR")
|
||||
if [ $? -eq 0 ]; then
|
||||
for TARGET in "${TARGET_LIST[@]}"; do
|
||||
if [ "$SERVICE" == "$TARGET" ]; then
|
||||
@ -605,7 +624,7 @@ spec_match_target () {
|
||||
RPMBUILD_DIR=$(dirname $(dirname $SPEC_FILE))
|
||||
fi
|
||||
|
||||
NAME=`spec_find_tag Name "$SPEC_FILE" "$RPMBUILD_DIR"`
|
||||
NAME=$(spec_find_tag Name "$SPEC_FILE" "$RPMBUILD_DIR")
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ "$NAME" == "$TARGET" ]; then
|
||||
echo "found target '$TARGET' in file '$SPEC_FILE' as a name"
|
||||
@ -613,7 +632,7 @@ spec_match_target () {
|
||||
fi
|
||||
fi
|
||||
|
||||
SERVICE=`spec_find_global service "$SPEC_FILE" "$RPMBUILD_DIR"`
|
||||
SERVICE=$(spec_find_global service "$SPEC_FILE" "$RPMBUILD_DIR")
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ "$SERVICE" == "$TARGET" ]; then
|
||||
echo "found target '$TARGET' in file '$SPEC_FILE' as a service"
|
||||
|
@ -13,6 +13,36 @@ METHOD_NO_RPMBUILD=0
|
||||
METHOD_RPMBUILD_UNPATCH=1
|
||||
METHOD_RPMBUILD_SCRIPT=2
|
||||
|
||||
|
||||
|
||||
srpm_spec_find_version () {
|
||||
local SPEC_PATH="$1"
|
||||
local PKG_VER=$(spec_find_tag Version $SPEC_PATH 2>> /dev/null)
|
||||
|
||||
if [ "x$PKG_VER" == "x" ]; then
|
||||
if [ "x$SRPM_EXPORT_VER" != "x" ]; then
|
||||
PKG_VER="$SRPM_EXPORT_VER"
|
||||
else
|
||||
PKG_VER="0"
|
||||
fi
|
||||
fi
|
||||
echo "$PKG_VER"
|
||||
}
|
||||
|
||||
srpm_spec_find_name () {
|
||||
local SPEC_PATH="$1"
|
||||
local PKG_VER=$(spec_find_tag Name $SPEC_PATH 2>> /dev/null)
|
||||
|
||||
if [ "x$PKG_VER" == "x" ]; then
|
||||
if [ "x$SRPM_EXPORT_NAME" != "x" ]; then
|
||||
PKG_VER="$SRPM_EXPORT_NAME"
|
||||
else
|
||||
PKG_VER="0"
|
||||
fi
|
||||
fi
|
||||
echo "$PKG_VER"
|
||||
}
|
||||
|
||||
# Find the common root directory of a tar file.
|
||||
# This form take as input command syntax to list the tar file contents.
|
||||
# Prefered from is to use tar -tvf ... plus any additional args.
|
||||
@ -1160,8 +1190,8 @@ srpm_build_dictionary () {
|
||||
local srpm_path
|
||||
local name
|
||||
|
||||
for srpm_path in `find $srpm_dir -name '*.src.rpm' | sort -V`; do
|
||||
name=`rpm_get_name $srpm_path`
|
||||
for srpm_path in $(find $srpm_dir -name '*.src.rpm' | sort -V); do
|
||||
name=$(rpm_get_name $srpm_path)
|
||||
SRPM_PKG_NAME_TO_PATH[$name]="$srpm_path"
|
||||
SRPM_PKG_NAMES+=("$name")
|
||||
done
|
||||
@ -1172,8 +1202,8 @@ srpm_build_std_dictionary () {
|
||||
local srpm_path
|
||||
local name
|
||||
|
||||
for srpm_path in `find $srpm_dir -name '*.src.rpm' | sort -V`; do
|
||||
name=`rpm_get_name $srpm_path`
|
||||
for srpm_path in $(find $srpm_dir -name '*.src.rpm' | sort -V); do
|
||||
name=$(rpm_get_name $srpm_path)
|
||||
STD_SRPM_PKG_NAME_TO_PATH[$name]="$srpm_path"
|
||||
STD_SRPM_PKG_NAMES+=("$name")
|
||||
done
|
||||
@ -1194,20 +1224,27 @@ srpm_assemble () {
|
||||
|
||||
for SPEC in $(cd $FULL_BUILD_DIR/SPECS/; ls -1 *.spec); do
|
||||
SPEC_PATH="$FULL_BUILD_DIR/SPECS/$SPEC"
|
||||
NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null`
|
||||
NAME=$(srpm_spec_find_name "$SPEC_PATH" 2>> /dev/null)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: $FUNCNAME (${LINENO}): 'Name' not found in '$SPEC_PATH'"
|
||||
fi
|
||||
VERSION=`spec_find_tag Version "$SPEC_PATH" 2>> /dev/null`
|
||||
|
||||
VERSION=$(srpm_spec_find_version "$SPEC_PATH" 2>> /dev/null)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: $FUNCNAME (${LINENO}): 'Version' not found in '$SPEC_PATH'"
|
||||
VERSION="0"
|
||||
if [ "x$SRPM_EXPORT_NAME" != "x" ]; then
|
||||
VERSION="$SRPM_EXPORT_NAME"
|
||||
else
|
||||
VERSION="0"
|
||||
fi
|
||||
fi
|
||||
RELEASE=`spec_find_tag Release "$SPEC_PATH" "$(dirname $(dirname $SPEC_PATH))" "$TIS_PATCH_VER" 2>> /dev/null`
|
||||
|
||||
RELEASE=$(spec_find_tag Release "$SPEC_PATH" "$(dirname $(dirname $SPEC_PATH))" "$TIS_PATCH_VER" 2>> /dev/null)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: $FUNCNAME (${LINENO}): 'Release' not found in '$SPEC_PATH'"
|
||||
RELEASE="0"
|
||||
fi
|
||||
|
||||
SRPM="$NAME-$VERSION-$RELEASE.src.rpm"
|
||||
SRPM_PATH="$FULL_BUILD_DIR/SRPMS/$SRPM"
|
||||
|
||||
@ -1219,7 +1256,7 @@ srpm_assemble () {
|
||||
|
||||
BUILD_NEEDED=0
|
||||
if [ -f $SRPM_PATH ]; then
|
||||
n=`find $FULL_BUILD_DIR -cnewer $SRPM_PATH | wc -l`
|
||||
n=$(find $FULL_BUILD_DIR -cnewer $SRPM_PATH | wc -l)
|
||||
if [ $n -gt 0 ]; then
|
||||
BUILD_NEEDED=1
|
||||
fi
|
||||
@ -1270,8 +1307,8 @@ srpm_extract () {
|
||||
local BRANCH=$5
|
||||
|
||||
local USE_GIT=0
|
||||
local ORIG_DIR=`pwd`
|
||||
local PKG_DIR=`rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}\n' --nosignature -p $ORIG_SRPM_PATH`
|
||||
local ORIG_DIR=$(pwd)
|
||||
local PKG_DIR=$(rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}\n' --nosignature -p $ORIG_SRPM_PATH)
|
||||
|
||||
if [ "x$ROOT_DIR" == "x" ]; then
|
||||
ROOT_DIR="$MY_WORKSPACE/srpm_assemble"
|
||||
@ -1302,8 +1339,8 @@ srpm_extract () {
|
||||
for SPEC in $(cd $SPEC_DIR; ls -1 *.spec); do
|
||||
echo $SPEC;
|
||||
SPEC_GIT="$GIT_DIR/$SPEC"
|
||||
PKG_NAME=$(spec_find_tag Name $SPEC_DIR/$SPEC 2>> /dev/null)
|
||||
PKG_VER=$(spec_find_tag Version $SPEC_DIR/$SPEC 2>> /dev/null)
|
||||
PKG_NAME=$(srpm_spec_find_name $SPEC_DIR/$SPEC 2>> /dev/null)
|
||||
PKG_VER=$(srpm_spec_find_version $SPEC_DIR/$SPEC 2>> /dev/null)
|
||||
TAR_DIR="$PKG_NAME-$PKG_VER"
|
||||
PATCH_TARGET_DIR="$SPEC_GIT/$TAR_DIR"
|
||||
echo " $TAR_DIR"
|
||||
@ -1330,7 +1367,7 @@ srpm_apply_meta_patches () {
|
||||
local ARCH=$4
|
||||
local BRANCH=$5
|
||||
|
||||
local ORIG_DIR=`pwd`
|
||||
local ORIG_DIR=$(pwd)
|
||||
local META_PATCH_DIR
|
||||
local PATCH_DIR
|
||||
local PATCH
|
||||
@ -1362,7 +1399,7 @@ srpm_apply_meta_patches () {
|
||||
return 1
|
||||
fi
|
||||
|
||||
for PATCH in `cat $PO_PATH`; do
|
||||
for PATCH in $(cat $PO_PATH); do
|
||||
PATCH_PATH="$META_PATCH_DIR/$PATCH"
|
||||
if [ ! -f "$PATCH_PATH" ]; then
|
||||
echo "ERROR: $FUNCNAME (${LINENO}): patch '$PATCH_PATH' not found."
|
||||
@ -1395,7 +1432,7 @@ srpm_apply_meta_patches () {
|
||||
return 1
|
||||
fi
|
||||
|
||||
for dd in `find . -type d | sort -V`; do
|
||||
for dd in $(find . -type d | sort -V); do
|
||||
d=${dd:2}
|
||||
mkdir -p "$META_PATCH_TARGET_DIR/SOURCES/$d"
|
||||
if [ $? -ne 0 ]; then
|
||||
@ -1405,7 +1442,7 @@ srpm_apply_meta_patches () {
|
||||
fi
|
||||
done
|
||||
|
||||
for ff in `find . -type f | sort -V`; do
|
||||
for ff in $(find . -type f | sort -V); do
|
||||
f=${ff:2}
|
||||
d=$(dirname $f)
|
||||
\cp -L -f -v "$PATCH_DIR/$f" "$META_PATCH_TARGET_DIR/SOURCES/$d"
|
||||
@ -2003,7 +2040,7 @@ tarball_extract () {
|
||||
if [ $NEED_PATCH_ROLLBACK -eq 1 ]; then
|
||||
# But we don't want patches yet, so roll them back.
|
||||
# Use the log from rpmbuild to learn what patches to roll back, in what order, and with what arguements
|
||||
for n in `grep '^[Pp]atch #' $RPMBUILD_BP_LOG | tac | awk '{ print $2 }' | sed 's/#//'`; do
|
||||
for n in $(grep '^[Pp]atch #' $RPMBUILD_BP_LOG | tac | awk '{ print $2 }' | sed 's/#//'); do
|
||||
cmd1=$(cat $RPMBUILD_BP_LOG | sed -n "/^[Pp]atch #$n /,/^patching/p" | grep '^+' | sed 's/^+ //' | grep '[/]cat')
|
||||
cmd2=$(cat $RPMBUILD_BP_LOG | sed -n "/^[Pp]atch #$n /,/^patching/p" | grep '^+' | sed 's/^+ //' | grep '[/]patch')
|
||||
cmd="$cmd1 | $cmd2 -R"
|
||||
@ -2142,7 +2179,7 @@ tar_and_spec_extract_to_git () {
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ORIG_DIR=`pwd`
|
||||
local ORIG_DIR=$(pwd)
|
||||
|
||||
if [ "x$ROOT_DIR" == "x" ]; then
|
||||
ROOT_DIR="$MY_WORKSPACE/srpm_work"
|
||||
@ -2324,8 +2361,8 @@ srpm_extract_to_git () {
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ORIG_DIR=`pwd`
|
||||
local PKG_DIR=`rpm -q --queryformat '%{NAME}\n' --nosignature -p $ORIG_SRPM_PATH`
|
||||
local ORIG_DIR=$(pwd)
|
||||
local PKG_DIR=$(rpm -q --queryformat '%{NAME}\n' --nosignature -p $ORIG_SRPM_PATH)
|
||||
|
||||
if [ "x$ROOT_DIR" == "x" ]; then
|
||||
ROOT_DIR="$MY_WORKSPACE/srpm_work"
|
||||
@ -2415,8 +2452,8 @@ srpm_extract_to_git () {
|
||||
for SPEC in $(cd $SPEC_DIR; ls -1 *.spec); do
|
||||
echo $SPEC;
|
||||
SPEC_GIT="$GIT_DIR/$SPEC"
|
||||
PKG_NAME=$(spec_find_tag Name $SPEC_DIR/$SPEC 2>> /dev/null)
|
||||
PKG_VER=$(spec_find_tag Version $SPEC_DIR/$SPEC 2>> /dev/null)
|
||||
PKG_NAME=$(srpm_spec_find_name $SPEC_DIR/$SPEC 2>> /dev/null)
|
||||
PKG_VER=$(srpm_spec_find_version $SPEC_DIR/$SPEC 2>> /dev/null)
|
||||
TAR_DIR="$PKG_NAME-$PKG_VER"
|
||||
echo " $TAR_DIR"
|
||||
|
||||
@ -2456,7 +2493,7 @@ srpm_extract_to_git () {
|
||||
cd $PATCH_TARGET_DIR
|
||||
|
||||
# Verify we are on the correct branch
|
||||
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [ "$CURRENT_BRANCH" != "$BRANCH" ]; then
|
||||
echo "git checkout -b $BRANCH"
|
||||
git checkout -b $BRANCH
|
||||
@ -2596,7 +2633,7 @@ srpm_apply_spec_patches () {
|
||||
local PATCH
|
||||
local PATCH_ARGS
|
||||
|
||||
local ORIG_DIR=`pwd`
|
||||
local ORIG_DIR=$(pwd)
|
||||
echo "Applying patches"
|
||||
|
||||
if [ ! -f "$SPEC_PATH" ]; then
|
||||
@ -2722,7 +2759,7 @@ srpm_apply_patch() {
|
||||
|
||||
# echo "srpm_apply_patch: PATCH=$PATCH PATCH_ARGS=$PATCH_ARGS TARGET_DIR=$TARGET_DIR USE_GIT=$USE_GIT COMMENT_PREFIX=$COMMENT_PREFIX METHOD=$METHOD RAW_SCRIPT=$RAW_SCRIPT ROOT_DIR=$ROOT_DIR RPMBUILD_BUILD_DIR=$RPMBUILD_BUILD_DIR SPEC_GIT=$SPEC_GIT PATCH_NO=$PATCH_NO"
|
||||
local ORIG_DIR
|
||||
ORIG_DIR=`pwd`
|
||||
ORIG_DIR=$(pwd)
|
||||
|
||||
if [ ! -f $PATCH ]; then
|
||||
echo "ERROR: $FUNCNAME (${LINENO}): Patch '$PATCH' not found"
|
||||
@ -2752,7 +2789,7 @@ srpm_apply_patch() {
|
||||
fi
|
||||
|
||||
local TAG="v$BRANCH"
|
||||
local PFN=`basename $PATCH`
|
||||
local PFN=$(basename $PATCH)
|
||||
|
||||
local MSG="$PFN"
|
||||
local HASH=""
|
||||
@ -2760,7 +2797,7 @@ srpm_apply_patch() {
|
||||
local ADD_WC
|
||||
|
||||
if [ $USE_GIT -gt 0 ]; then
|
||||
HASH=`git log --pretty=format:'%H' --grep="$MSG\$"`
|
||||
HASH=$(git log --pretty=format:'%H' --grep="$MSG\$")
|
||||
fi
|
||||
|
||||
if [ "x$HASH" == "x" ]; then
|
||||
@ -2810,7 +2847,7 @@ srpm_apply_patch() {
|
||||
fi
|
||||
else
|
||||
echo "patch $PATCH_ARGS < $PATCH"
|
||||
patch $PATCH_ARGS --no-backup-if-mismatch < $PATCH
|
||||
patch -f $PATCH_ARGS --no-backup-if-mismatch < $PATCH
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed to apply patch '$PATCH'"
|
||||
return 1
|
||||
@ -2819,7 +2856,7 @@ srpm_apply_patch() {
|
||||
|
||||
if [ $PWD = $HOME ]; then
|
||||
echo "DPENNEY: in the home dir somehow"
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
@ -2865,7 +2902,7 @@ srpm_find_tag () {
|
||||
local TAG=$1
|
||||
local SRPM_FILE=$2
|
||||
|
||||
local VALUE=`rpm -q --queryformat "%{$TAG}\n" --nosignature -p $SRPM_FILE`
|
||||
local VALUE=$(rpm -q --queryformat "%{$TAG}\n" --nosignature -p $SRPM_FILE)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ""
|
||||
return 1
|
||||
@ -2879,7 +2916,7 @@ srpm_find_tag () {
|
||||
srpm_list_packages () {
|
||||
local SRPM_FILE=$1
|
||||
|
||||
local TMPDIR=`mktemp -d /tmp/srpm_list_packages_XXXXXX`
|
||||
local TMPDIR=$(mktemp -d /tmp/srpm_list_packages_XXXXXX)
|
||||
|
||||
(
|
||||
cd $TMPDIR &>> /dev/null
|
||||
@ -2887,7 +2924,7 @@ srpm_list_packages () {
|
||||
rpm -i --root=$TMPDIR --nosignature $SRPM_FILE
|
||||
)
|
||||
|
||||
for SPEC in `find $TMPDIR -name '*.spec' | sort -V`; do
|
||||
for SPEC in $(find $TMPDIR -name '*.spec' | sort -V); do
|
||||
spec_list_packages $SPEC
|
||||
done
|
||||
|
||||
@ -2898,7 +2935,7 @@ srpm_list_packages () {
|
||||
srpm_list_versioned_packages () {
|
||||
local SRPM_FILE=$1
|
||||
|
||||
local TMPDIR=`mktemp -d /tmp/srpm_list_packages_XXXXXX`
|
||||
local TMPDIR=$(mktemp -d /tmp/srpm_list_packages_XXXXXX)
|
||||
|
||||
(
|
||||
cd $TMPDIR &>> /dev/null
|
||||
@ -2906,7 +2943,7 @@ srpm_list_versioned_packages () {
|
||||
rpm -i --root=$TMPDIR --nosignature $SRPM_FILE
|
||||
)
|
||||
|
||||
for SPEC in `find $TMPDIR -name '*.spec' | sort -V`; do
|
||||
for SPEC in $(find $TMPDIR -name '*.spec' | sort -V); do
|
||||
spec_list_versioned_packages $SPEC
|
||||
done
|
||||
|
||||
@ -2917,7 +2954,7 @@ srpm_list_versioned_packages () {
|
||||
srpm_list_ver_rel_packages () {
|
||||
local SRPM_FILE=$1
|
||||
|
||||
local TMPDIR=`mktemp -d /tmp/srpm_list_packages_XXXXXX`
|
||||
local TMPDIR=$(mktemp -d /tmp/srpm_list_packages_XXXXXX)
|
||||
|
||||
(
|
||||
cd $TMPDIR &>> /dev/null
|
||||
@ -2925,7 +2962,7 @@ srpm_list_ver_rel_packages () {
|
||||
rpm -i --root=$TMPDIR --nosignature $SRPM_FILE
|
||||
)
|
||||
|
||||
for SPEC in `find $TMPDIR -name '*.spec' | sort -V`; do
|
||||
for SPEC in $(find $TMPDIR -name '*.spec' | sort -V); do
|
||||
spec_list_ver_rel_packages $SPEC
|
||||
done
|
||||
|
||||
@ -2936,7 +2973,7 @@ srpm_list_ver_rel_packages () {
|
||||
srpm_list_ver_rel_arch_packages () {
|
||||
local SRPM_FILE=$1
|
||||
|
||||
local TMPDIR=`mktemp -d /tmp/srpm_list_packages_XXXXXX`
|
||||
local TMPDIR=$(mktemp -d /tmp/srpm_list_packages_XXXXXX)
|
||||
|
||||
(
|
||||
cd $TMPDIR &>> /dev/null
|
||||
@ -2944,7 +2981,7 @@ srpm_list_ver_rel_arch_packages () {
|
||||
rpm -i --root=$TMPDIR --nosignature $SRPM_FILE
|
||||
)
|
||||
|
||||
for SPEC in `find $TMPDIR -name '*.spec' | sort -V`; do
|
||||
for SPEC in $(find $TMPDIR -name '*.spec' | sort -V); do
|
||||
spec_list_ver_rel_arch_packages $SPEC
|
||||
done
|
||||
|
||||
@ -2955,7 +2992,7 @@ srpm_list_ver_rel_arch_packages () {
|
||||
srpm_build_requires () {
|
||||
local SRPM_FILE=$1
|
||||
|
||||
local TMPDIR=`mktemp -d /tmp/srpm_list_packages_XXXXXX`
|
||||
local TMPDIR=$(mktemp -d /tmp/srpm_list_packages_XXXXXX)
|
||||
|
||||
(
|
||||
cd $TMPDIR &>> /dev/null
|
||||
@ -2963,7 +3000,7 @@ srpm_build_requires () {
|
||||
rpm -i --root=$TMPDIR $SRPM_FILE
|
||||
)
|
||||
|
||||
for SPEC in `find $TMPDIR -name '*.spec' | sort -V`; do
|
||||
for SPEC in $(find $TMPDIR -name '*.spec' | sort -V); do
|
||||
spec_build_requires $SPEC
|
||||
done
|
||||
|
||||
@ -2978,7 +3015,7 @@ srpm_match_package_list () {
|
||||
local TARGET
|
||||
local PKG_NAME
|
||||
|
||||
for PKG_NAME in `srpm_list_packages "$SRPM_FILE"`; do
|
||||
for PKG_NAME in $(srpm_list_packages "$SRPM_FILE"); do
|
||||
for TARGET in "${TARGET_LIST[@]}"; do
|
||||
if [ "$PKG_NAME" == "$TARGET" ]; then
|
||||
>&2 echo "found target '$TARGET' in file '$SRPM_FILE' as a package name"
|
||||
@ -2996,7 +3033,7 @@ srpm_match_package () {
|
||||
local SRPM_FILE=$2
|
||||
local PKG_NAME
|
||||
|
||||
for PKG_NAME in `srpm_list_packages "$SRPM_FILE"`; do
|
||||
for PKG_NAME in $(srpm_list_packages "$SRPM_FILE"); do
|
||||
if [ "$PKG_NAME" == "$TARGET" ]; then
|
||||
echo "found target '$TARGET' in file '$SRPM_FILE' as a package name"
|
||||
return 0
|
||||
@ -3016,7 +3053,7 @@ srpm_match_target_list () {
|
||||
local SERVICE
|
||||
local PKG_NAME
|
||||
|
||||
NAME=`srpm_find_tag Name "$SRPM_FILE"`
|
||||
NAME=$(srpm_find_tag Name "$SRPM_FILE")
|
||||
if [ $? -eq 0 ]; then
|
||||
for TARGET in "${TARGET_LIST[@]}"; do
|
||||
if [ "$NAME" == "$TARGET" ]; then
|
||||
@ -3032,7 +3069,7 @@ srpm_match_target_list () {
|
||||
done
|
||||
fi
|
||||
|
||||
SERVICE=`srpm_find_tag Service "$SRPM_FILE"`
|
||||
SERVICE=$(srpm_find_tag Service "$SRPM_FILE")
|
||||
if [ $? -eq 0 ]; then
|
||||
for TARGET in "${TARGET_LIST[@]}"; do
|
||||
if [ "$SERVICE" == "$TARGET" ]; then
|
||||
@ -3057,7 +3094,7 @@ srpm_match_target () {
|
||||
local SERVICE
|
||||
local PKG_NAME
|
||||
|
||||
NAME=`srpm_find_tag Name "$SRPM_FILE"`
|
||||
NAME=$(srpm_find_tag Name "$SRPM_FILE")
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ "$NAME" == "$TARGET" ]; then
|
||||
echo "found target '$TARGET' in file '$SRPM_FILE' as a name"
|
||||
@ -3065,7 +3102,7 @@ srpm_match_target () {
|
||||
fi
|
||||
fi
|
||||
|
||||
SERVICE=`srpm_find_tag Service "$SRPM_FILE"`
|
||||
SERVICE=$(srpm_find_tag Service "$SRPM_FILE")
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ "$SERVICE" == "$TARGET" ]; then
|
||||
echo "found target '$TARGET' in file '$SRPM_FILE' as a service"
|
||||
|
Loading…
Reference in New Issue
Block a user