From 8ce6a8a0d41af3f4b0f28a196d70426e787d4cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Andriot?= Date: Wed, 18 May 2022 21:29:06 +0200 Subject: [PATCH] RPM: update build scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: François Andriot --- redhat/build/gather_rpm_sources.sh | 12 ++++++++---- redhat/build/get_source_files.sh | 18 ++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/redhat/build/gather_rpm_sources.sh b/redhat/build/gather_rpm_sources.sh index cba05b1f8..fd8b21a2b 100755 --- a/redhat/build/gather_rpm_sources.sh +++ b/redhat/build/gather_rpm_sources.sh @@ -32,10 +32,14 @@ cp -f ${SPECFILE} ${SOURCES} ${TARBALL} "${TARGETDIR}" PATCHDIR="${HOME}/tde/patches/${TDE_VERSION}/$1" if [ -d "${PATCHDIR}" ]; then - cat "${PATCHDIR}/"*".patch" "${PATCHDIR}/"*".patch${DIST}" >>"${TARGETDIR}/one.patch" - sed -i "${TARGETDIR}/"*".spec" \ - -e "/^Source0:/ s/$/\nPatch389: one.patch/" \ - -e "/%setup/ s/$/\n%patch389 -p1/" + cat "${PATCHDIR}/"*".patch" "${PATCHDIR}/"*".patch${DIST}" >>"${TARGETDIR}/one.patch" 2>/dev/null + if [ "$(cat "${TARGETDIR}/one.patch" | wc -c)" = 0 ]; then + rm -f "${TARGETDIR}/one.patch" + else + sed -i "${TARGETDIR}/"*".spec" \ + -e "/^Source0:/ s/$/\nPatch389: one.patch/" \ + -e "/%setup/ s/$/\n%patch389 -p1/" + fi fi exit $RET diff --git a/redhat/build/get_source_files.sh b/redhat/build/get_source_files.sh index d262fccf3..5a7a49ac0 100755 --- a/redhat/build/get_source_files.sh +++ b/redhat/build/get_source_files.sh @@ -8,13 +8,12 @@ DIST="$3" SPECFILE=$(get_specfile.sh ${PKGNAME} ${TDE_VERSION}) SPECDIR="${SPECFILE%/*}" RPMPKGNAME="$(get_rpm_package_name.sh ${PKGNAME})" - [ ! -r "${SPECFILE}" ] && exit 2 while read var val; do case "${var}" in Version:*) VERSION="${val}";; - Source[0-9]*:|Source:|Patch[0-9]*:) + Source*:|Source:|Patch[0-9]*:) FILE="${SPECDIR}/${val##*/}" if [ "${DIST}" = "any" ] && [ "${var//%\{?dist\}/}" = "${var}" ]; then FILES="${FILE//%\{?dist\}/.}"* @@ -23,12 +22,15 @@ while read var val; do fi for FILE in $FILES; do - file=$(rpm --define "tde_pkg ${PKGNAME}" \ - --define "tde_version ${TDE_VERSION}" \ - --define "name ${RPMPKGNAME}" \ - --define "version ${VERSION}" \ - --define "dist ${DIST:-$(rpm -E %dist)}" \ - -E "${FILE}") + for name in ${RPMPKGNAME} ${PKGNAME} trinity-${PKGNAME}; do + file=$(rpm --define "tde_pkg ${PKGNAME}" \ + --define "tde_version ${TDE_VERSION}" \ + --define "name ${name}" \ + --define "version ${VERSION}" \ + --define "dist ${DIST:-$(rpm -E %dist)}" \ + -E "${FILE}") + [ -r "${file}" ] && break + done [ -r "${file}" ] && echo "${file}" done ;;