script de build rpm - passage de rpmbuild à mock
This commit is contained in:
parent
356ccc9847
commit
40be77d9db
39
docker_rebuild_msmtp_rpm.sh
Executable file
39
docker_rebuild_msmtp_rpm.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
FROMFEDORA='36'
|
||||
PACKAGE='msmtp'
|
||||
GETTEXT_FC='36'
|
||||
GETTEXT_VERSION='0.21-9'
|
||||
|
||||
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
||||
cd ${ABSDIR}
|
||||
|
||||
type -P docker >/dev/null && DOCKER=$(which docker)
|
||||
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
|
||||
echo "ERROR : No ${PACKAGE} release available for Fedora ${FROMFEDORA}"
|
||||
echo "Please check https://src.fedoraproject.org/rpms/${PACKAGE} to choose the right release."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(echo "${JSONLINE}" | sed -e "s/^\s*\"stable\": \"${PACKAGE}-\(.*\)\.fc${FROMFEDORA}\",\s*$/\1/")
|
||||
|
||||
ARCH=$(${DOCKER} run --rm docker.io/library/rockylinux:8 uname -i)
|
||||
|
||||
mkdir /tmp/dockerrpmbuild-$$
|
||||
|
||||
${DOCKER} run -i --rm -v /tmp/dockerrpmbuild-$$:/out:Z --privileged docker.io/library/rockylinux:8 <<EOF
|
||||
dnf install -qy epel-release
|
||||
dnf install -qy mock
|
||||
useradd 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'
|
||||
mv -f /tmp/results/*/${PACKAGE}-*/*.rpm /out/
|
||||
EOF
|
||||
|
||||
[[ $? == 0 ]] && mv -i /tmp/dockerrpmbuild-$$/*.rpm ${ABSDIR}/files/ &&
|
||||
rm -rf /tmp/dockerrpmbuild-$$ &&
|
||||
|
||||
${DOCKER} rmi -f docker-${PACKAGE}-build &&
|
||||
${DOCKER} rmi -f docker-${PACKAGE}-xfer
|
|
@ -1,54 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
FROMFEDORA='36'
|
||||
PACKAGE='msmtp'
|
||||
GETTEXT_FC='34'
|
||||
GETTEXT_VERSION='0.21-4'
|
||||
|
||||
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
||||
cd ${ABSDIR}
|
||||
|
||||
type -P docker >/dev/null && DOCKER=$(which docker)
|
||||
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
|
||||
echo "ERROR : No ${PACKAGE} release available for Fedora ${FROMFEDORA}"
|
||||
echo "Please check https://src.fedoraproject.org/rpms/${PACKAGE} to choose the right release."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(echo "${JSONLINE}" | sed -e "s/^\s*\"stable\": \"${PACKAGE}-\(.*\)\.fc${FROMFEDORA}\",\s*$/\1/")
|
||||
|
||||
ARCH=$(${DOCKER} run --rm docker.io/library/rockylinux:8 uname -i)
|
||||
|
||||
${DOCKER} build -t localhost/docker-${PACKAGE}-build -f- . <<EOF
|
||||
FROM docker.io/library/rockylinux:8
|
||||
RUN dnf install -y epel-release dnf-plugins-core && \
|
||||
dnf config-manager --set-enabled powertools && \
|
||||
dnf install -y rpm-build gcc make gettext gnutls-devel libgsasl-devel libidn-devel libsecret-devel autoconf automake emacs gcc-c++ glibc-langpack-de glibc-langpack-fa glibc-langpack-fr glibc-langpack-ja glibc-langpack-tr glibc-langpack-zh libacl-devel libunistring-devel libxml2-devel ncurses-devel teckit texinfo-tex texlive-dvipdfmx texlive-dvips texlive-xetex git && \
|
||||
useradd -m dontbuildasroot -s /bin/bash
|
||||
USER dontbuildasroot
|
||||
RUN rpmbuild --rebuild https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/${GETTEXT_FC}/Everything/source/tree/Packages/g/gettext-${GETTEXT_VERSION}.fc${GETTEXT_FC}.src.rpm
|
||||
USER root
|
||||
RUN rpm -Uvh /home/dontbuildasroot/rpmbuild/RPMS/x86_64/gettext-devel-${GETTEXT_VERSION}.el8.x86_64.rpm \
|
||||
/home/dontbuildasroot/rpmbuild/RPMS/x86_64/gettext-libs-${GETTEXT_VERSION}.el8.x86_64.rpm \
|
||||
/home/dontbuildasroot/rpmbuild/RPMS/x86_64/gettext-${GETTEXT_VERSION}.el8.x86_64.rpm \
|
||||
/home/dontbuildasroot/rpmbuild/RPMS/noarch/gettext-common-devel-${GETTEXT_VERSION}.el8.noarch.rpm \
|
||||
/home/dontbuildasroot/rpmbuild/RPMS/x86_64/libtextstyle-${GETTEXT_VERSION}.el8.x86_64.rpm
|
||||
USER dontbuildasroot
|
||||
RUN rpmbuild --rebuild https://download-ib01.fedoraproject.org/pub/fedora/linux/updates/${FROMFEDORA}/Everything/source/tree/Packages/m/${PACKAGE}-${VERSION}.fc${FROMFEDORA}.src.rpm
|
||||
EOF
|
||||
|
||||
[[ $? = 0 ]] && mkdir /tmp/dockerrpmbuild-$$
|
||||
|
||||
${DOCKER} build --no-cache -v /tmp/dockerrpmbuild-$$:/out:Z -t docker-${PACKAGE}-xfer -f- . <<EOF
|
||||
FROM localhost/docker-${PACKAGE}-build
|
||||
USER root
|
||||
RUN mv -f /home/dontbuildasroot/rpmbuild/RPMS/*/*.rpm /out/
|
||||
EOF
|
||||
|
||||
[[ $? == 0 ]] && mv -i /tmp/dockerrpmbuild-$$/*.rpm ${ABSDIR}/files/ &&
|
||||
rm -rf /tmp/dockerrpmbuild-$$ &&
|
||||
|
||||
${DOCKER} rmi -f docker-${PACKAGE}-build &&
|
||||
${DOCKER} rmi -f docker-${PACKAGE}-xfer
|
Loading…
Reference in a new issue