script de build rpm - moins de hardcoding
This commit is contained in:
parent
40be77d9db
commit
69ec605d5a
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
FROMFEDORA='36'
|
FROMFEDORA='36'
|
||||||
PACKAGE='msmtp'
|
PACKAGE='msmtp'
|
||||||
GETTEXT_FC='36'
|
|
||||||
GETTEXT_VERSION='0.21-9'
|
|
||||||
|
|
||||||
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
||||||
cd ${ABSDIR}
|
cd ${ABSDIR}
|
||||||
|
@ -11,13 +9,27 @@ cd ${ABSDIR}
|
||||||
type -P docker >/dev/null && DOCKER=$(which docker)
|
type -P docker >/dev/null && DOCKER=$(which docker)
|
||||||
type -P podman >/dev/null && DOCKER=$(which podman)
|
type -P podman >/dev/null && DOCKER=$(which podman)
|
||||||
|
|
||||||
if ! JSONLINE=$(curl -s https://src.fedoraproject.org/_dg/bodhi_updates/rpms/${PACKAGE} | grep -e "fc${FROMFEDORA}\","); then
|
get_src_rpm_url() {
|
||||||
echo "ERROR : No ${PACKAGE} release available for Fedora ${FROMFEDORA}"
|
local __package=${1}
|
||||||
echo "Please check https://src.fedoraproject.org/rpms/${PACKAGE} to choose the right release."
|
local __resultvar=${2}
|
||||||
|
if ! local __jsonline=$(curl -s https://src.fedoraproject.org/_dg/bodhi_updates/rpms/${1} | grep -e "fc${FROMFEDORA}\","); then
|
||||||
|
echo "ERROR : No ${1} release available for Fedora ${FROMFEDORA}"
|
||||||
|
echo "Please check https://src.fedoraproject.org/rpms/${PACKAGE} to choose the right release."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
local __version=$(echo "${__jsonline}" | sed -e "s/^\s*\"stable\": \"${1}-\(.*\)\.fc${FROMFEDORA}\",\s*$/\1/")
|
||||||
|
for repo in releases updates; do
|
||||||
|
local __url=https://dl.fedoraproject.org/pub/fedora/linux/${repo}/${FROMFEDORA}/Everything/source/tree/Packages/${__package::1}/${__package}-${__version}.fc${FROMFEDORA}.src.rpm
|
||||||
|
if curl -sSLfI ${__url} 1>/dev/null 2>/dev/null; then
|
||||||
|
eval $__resultvar="'${__url}'"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
VERSION=$(echo "${JSONLINE}" | sed -e "s/^\s*\"stable\": \"${PACKAGE}-\(.*\)\.fc${FROMFEDORA}\",\s*$/\1/")
|
get_src_rpm_url ${PACKAGE} PACKAGE_SRC_RPM_URL
|
||||||
|
get_src_rpm_url gettext GETTEXT_SRC_RPM_URL
|
||||||
|
|
||||||
ARCH=$(${DOCKER} run --rm docker.io/library/rockylinux:8 uname -i)
|
ARCH=$(${DOCKER} run --rm docker.io/library/rockylinux:8 uname -i)
|
||||||
|
|
||||||
|
@ -28,12 +40,9 @@ dnf install -qy epel-release
|
||||||
dnf install -qy mock
|
dnf install -qy mock
|
||||||
useradd mockbuilder
|
useradd mockbuilder
|
||||||
usermod -a -G mock mockbuilder
|
usermod -a -G mock mockbuilder
|
||||||
runuser -l mockbuilder -c 'mock --localrepo=/tmp/ --chain -r rocky+epel-8-x86_64 https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/${GETTEXT_FC}/Everything/source/tree/Packages/g/gettext-${GETTEXT_VERSION}.fc${GETTEXT_FC}.src.rpm https://download-ib01.fedoraproject.org/pub/fedora/linux/updates/${FROMFEDORA}/Everything/source/tree/Packages/m/${PACKAGE}-${VERSION}.fc${FROMFEDORA}.src.rpm'
|
runuser -l mockbuilder -c 'mock --localrepo=/tmp/ --chain -r rocky+epel-8-${ARCH} ${GETTEXT_SRC_RPM_URL} ${PACKAGE_SRC_RPM_URL}'
|
||||||
mv -f /tmp/results/*/${PACKAGE}-*/*.rpm /out/
|
mv -f /tmp/results/*/${PACKAGE}-*/*.rpm /out/
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
[[ $? == 0 ]] && mv -i /tmp/dockerrpmbuild-$$/*.rpm ${ABSDIR}/files/ &&
|
[[ $? == 0 ]] && mv -i /tmp/dockerrpmbuild-$$/*.rpm ${ABSDIR}/files/ &&
|
||||||
rm -rf /tmp/dockerrpmbuild-$$ &&
|
rm -rf /tmp/dockerrpmbuild-$$ &&
|
||||||
|
|
||||||
${DOCKER} rmi -f docker-${PACKAGE}-build &&
|
|
||||||
${DOCKER} rmi -f docker-${PACKAGE}-xfer
|
|
||||||
|
|
Loading…
Reference in a new issue