RPM: update build scripts

pull/14/head
François Andriot 6 years ago
parent 82dac1415f
commit 2fbb1e0e39

@ -1,12 +1,12 @@
SHELL := /bin/bash SHELL := /bin/bash
PACKAGING_DIR := $(shell cd ..; pwd)
PATH := $(PATH):$(shell pwd)/build PATH := $(PATH):$(shell pwd)/build
TDE_VERSION := 14.0.5 TDE_VERSION := $(shell echo $${TDE_VERSION:-14.0.5})
TDE_PACKAGING_DIR := $(shell [ -n "$${TDE_PACKAGING_DIR}" ] && cd "$${TDE_PACKAGING_DIR}" || cd ..; pwd)
DIST := $(shell rpm -E %dist) DIST := $(shell rpm -E %dist)
buildpkg = \ buildpkg = \
@echo "Now processing '$(1)' [from $(PACKAGING_DIR)]."; \ @echo "Now processing '$(1)' [from $(TDE_PACKAGING_DIR)]."; \
export PACKAGING_DIR=$(PACKAGING_DIR); \ export TDE_PACKAGING_DIR=$(TDE_PACKAGING_DIR); \
if [ "${REBUILD}" = "$(1)" ] || ! is_latest_package_installed.sh "$(1)" ${TDE_VERSION}; then \ if [ "${REBUILD}" = "$(1)" ] || ! is_latest_package_installed.sh "$(1)" ${TDE_VERSION}; then \
echo " Package '${1}' is not yet installed."; \ echo " Package '${1}' is not yet installed."; \
if [ "${REBUILD}" = "$(1)" ] || ! is_latest_package_built.sh "$(1)" ${TDE_VERSION}; then \ if [ "${REBUILD}" = "$(1)" ] || ! is_latest_package_built.sh "$(1)" ${TDE_VERSION}; then \

@ -4,8 +4,8 @@ PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.0}" TDE_VERSION="${2:-14.0.0}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1 [ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
[ -d "${TARBALLS_DIR}" ] || TARBALLS_DIR=~/tde/tde-tarballs/${TDE_VERSION}/ [ -d "${TARBALLS_DIR}" ] || TARBALLS_DIR=~/tde/tarballs/${TDE_VERSION}/
[ -d "${TDE_PACKAGING_DIR}" ] || TDE_PACKAGING_DIR=~/tde/tde-packaging [ -d "${TDE_PACKAGING_DIR}" ] || TDE_PACKAGING_DIR=~/tde/master/tde-packaging
[ -d "${DIST_PACKAGING_DIR}" ] || DIST_PACKAGING_DIR=${TDE_PACKAGING_DIR}/redhat/ [ -d "${DIST_PACKAGING_DIR}" ] || DIST_PACKAGING_DIR=${TDE_PACKAGING_DIR}/redhat/
EXTRA_DIR="$(cd ${TARBALLS_DIR}/../extras/; pwd)" EXTRA_DIR="$(cd ${TARBALLS_DIR}/../extras/; pwd)"

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
PKGNAME="${1##*/}" PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.0}" TDE_VERSION="${2:-14.0.5}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1 [ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
[ -d "${TDE_PACKAGING_DIR}" ] || TDE_PACKAGING_DIR=~/tde/tde-packaging [ -d "${TDE_PACKAGING_DIR}" ] || TDE_PACKAGING_DIR=~/tde/master/tde-packaging
[ -d "${DIST_PACKAGING_DIR}" ] || DIST_PACKAGING_DIR=${TDE_PACKAGING_DIR}/redhat [ -d "${DIST_PACKAGING_DIR}" ] || DIST_PACKAGING_DIR=${TDE_PACKAGING_DIR}/redhat
# Special case for QT3 # Special case for QT3

@ -18,7 +18,7 @@ RPMDIR=$(rpm -E %{_rpmdir}.tde-${TDE_VERSION})
if [ -x /usr/sbin/urpmi ]; then if [ -x /usr/sbin/urpmi ]; then
REPOUPDATE='(cd ${RPMDIR}; genhdlist2 --clean --allow-empty noarch & genhdlist2 --clean --allow-empty ${ARCH} & wait; sudo urpmi.update rpmbuild.${ARCH} rpmbuild.noarch)' REPOUPDATE='(cd ${RPMDIR}; genhdlist2 --clean --allow-empty noarch & genhdlist2 --clean --allow-empty ${ARCH} & wait; sudo urpmi.update rpmbuild.${ARCH} rpmbuild.noarch)'
elif [ -x /usr/bin/dnf ]; then elif [ -x /usr/bin/dnf ]; then
REPOUPDATE='(cd ${RPMDIR}; createrepo --workers=${WORKERS} ${ARCH} & createrepo --workers=${WORKERS} noarch & wait; sudo dnf clean expire-cache --disablerepo="*" --enablerepo="rpmbuild*")' REPOUPDATE='(cd ${RPMDIR}; createrepo --workers=${WORKERS} ${ARCH} & createrepo --workers=${WORKERS} noarch & wait; sudo dnf --repo="rpmbuild*" clean expire-cache)'
elif [ -x /usr/bin/zypper ]; then elif [ -x /usr/bin/zypper ]; then
REPOUPDATE='(cd ${RPMDIR}; createrepo --workers=${WORKERS} ${ARCH} & createrepo --workers=${WORKERS} noarch & wait; sudo zypper refresh rpmbuild.${ARCH} rpmbuild.noarch)' REPOUPDATE='(cd ${RPMDIR}; createrepo --workers=${WORKERS} ${ARCH} & createrepo --workers=${WORKERS} noarch & wait; sudo zypper refresh rpmbuild.${ARCH} rpmbuild.noarch)'
elif [ -x /usr/bin/yum ]; then elif [ -x /usr/bin/yum ]; then

@ -8,6 +8,18 @@ ARCH="$3"
[ -z "${ARCH}" ] && ARCH="x86_64" [ -z "${ARCH}" ] && ARCH="x86_64"
IMAGE="trinity.${DISTRIB}.${ARCH}:${TDE_VERSION}" IMAGE="trinity.${DISTRIB}.${ARCH}:${TDE_VERSION}"
FILE="${HOME}/tde/docker/${IMAGE}.tar.gz"
#docker rmi -f "${IMAGE}" #docker rmi -f "${IMAGE}"
if [ $(docker images -q "${IMAGE}") ]; then
echo "Docker image '${IMAGE}' already exists."
elif [ -r "${FILE}" ]; then
echo "Importing existing docker image '${FILE}'."
zcat "${FILE}" | docker import - "${IMAGE}"
else
echo "Building new Docker image '${IMAGE}'."
docker build -t "${IMAGE}" -f "${DISTRIB}/Dockerfile.${ARCH}" --build-arg TDE_VERSION="${TDE_VERSION}" --build-arg ARCH="${ARCH}" "${DISTRIB}" docker build -t "${IMAGE}" -f "${DISTRIB}/Dockerfile.${ARCH}" --build-arg TDE_VERSION="${TDE_VERSION}" --build-arg ARCH="${ARCH}" "${DISTRIB}"
echo "Saving image to '${FILE}'"
docker save "${IMAGE}" | pigz >"${FILE}"
fi

@ -14,19 +14,26 @@ mkdir -p "${HOME}/rpmbuild/RPMS/RPMS${DIST}.tde-${TDE_VERSION}"
mkdir -p "${HOME}/rpmbuild/SRPMS/SRPMS${DIST}.tde-${TDE_VERSION}" mkdir -p "${HOME}/rpmbuild/SRPMS/SRPMS${DIST}.tde-${TDE_VERSION}"
mkdir -p "/dev/shm/docker" mkdir -p "/dev/shm/docker"
docker run -t -i --rm --privileged \ case "${VERSION}" in
"14.0."*) TDE_BRANCH="r14.0.x";;
*) TDE_BRANCH="master";;
esac
mkdir -p "${HOME}/rpmbuild/RPMS/RPMS${DIST}.tde-${TDE_VERSION}" "${HOME}/rpmbuild/SRPMS/SRPMS${DIST}.tde-${TDE_VERSION}"
docker run -ti --rm --privileged \
-h "${IMAGE}" \ -h "${IMAGE}" \
--name "${IMAGE//:/-}" \ --name "${IMAGE//:/-}" \
-v /dev/shm/docker:/tmp:z \ -v /dev/shm/docker:/tmp:z \
-u trinity \ -u trinity \
-e TMPPATH=/tmp \ -e TMPPATH=/tmp \
-e TDE_VERSION=${TDE_VERSION} \ -e TDE_VERSION=${TDE_VERSION} \
-w /home/trinity/tde/tde-packaging.r14.0.x/redhat \ -e TDE_BRANCH=${TDE_BRANCH} \
-w /home/trinity/tde/${TDE_BRANCH}/tde-packaging/redhat \
-v ${HOME}/.gnupg:/home/trinity/.gnupg \ -v ${HOME}/.gnupg:/home/trinity/.gnupg \
-v ${HOME}/tde/tde-packaging.r14.0.x:/home/trinity/tde/tde-packaging.r14.0.x \ -v ${HOME}/tde/${TDE_BRANCH}/tde-packaging:/home/trinity/tde/${TDE_BRANCH}/tde-packaging \
-v ${HOME}/tde/tde-packaging.master:/home/trinity/tde/tde-packaging.master \ -v ${HOME}/tde/patches:/home/trinity/tde/patches \
-v ${HOME}/tde/tde-patches:/home/trinity/tde/tde-patches \ -v ${HOME}/tde/tarballs:/home/trinity/tde/tarballs \
-v ${HOME}/tde/tde-tarballs:/home/trinity/tde/tde-tarballs \
-v ${HOME}/rpmbuild/RPMS/RPMS${DIST}.tde-${TDE_VERSION}:/home/trinity/rpmbuild/RPMS.tde-${TDE_VERSION} \ -v ${HOME}/rpmbuild/RPMS/RPMS${DIST}.tde-${TDE_VERSION}:/home/trinity/rpmbuild/RPMS.tde-${TDE_VERSION} \
-v ${HOME}/rpmbuild/SRPMS/SRPMS${DIST}.tde-${TDE_VERSION}:/home/trinity/rpmbuild/SRPMS.tde-${TDE_VERSION} \ -v ${HOME}/rpmbuild/SRPMS/SRPMS${DIST}.tde-${TDE_VERSION}:/home/trinity/rpmbuild/SRPMS.tde-${TDE_VERSION} \
"${IMAGE}" setarch ${ARCH} bash "${IMAGE}" setarch ${ARCH} bash

Loading…
Cancel
Save