Unverified Commit 3725c504 authored by Maxim Cournoyer's avatar Maxim Cournoyer
Browse files

build-package-rpm: Cache Qt tarball.

Also make the script more readable by factoring out variables to avoid
repeating ourselves.

Change-Id: I30e85fb7b0a1207a8eff3a89d8c7ab4f455e0c4a
parent f236d5f6
...@@ -45,12 +45,22 @@ QT_MAJOR=5 ...@@ -45,12 +45,22 @@ QT_MAJOR=5
QT_MINOR=15 QT_MINOR=15
QT_PATCH=2 QT_PATCH=2
QT_MAJOR_MINOR=${QT_MAJOR}.${QT_MINOR}
QT_MAJOR_MINOR_PATCH=${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}
QT_TARBALL_URL=https://download.qt.io/archive/qt/$QT_MAJOR_MINOR/\
$QT_MAJOR_MINOR_PATCH/single/qt-everywhere-src-$QT_MAJOR_MINOR_PATCH.tar.xz
QT_TARBALL_SHA256="3a530d1b243b5dec00bc54937455471aaa3e56849d2593edb8ded07228202240"
QT_TARBALL_FILE_NAME=$(basename "$QT_TARBALL_URL")
CACHED_QT_TARBALL=/opt/ring-contrib/$QT_TARBALL_FILE_NAME
if [[ "${DISTRIBUTION:0:4}" == "rhel" \ if [[ "${DISTRIBUTION:0:4}" == "rhel" \
|| "${DISTRIBUTION:0:13}" == "opensuse-leap" ]]; then || "${DISTRIBUTION:0:13}" == "opensuse-leap" ]]; then
RPM_PATH=/opt/cache-packaging/${DISTRIBUTION}/jami-libqt-${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}-1.x86_64.rpm RPM_PATH=/opt/cache-packaging/${DISTRIBUTION}/jami-libqt-$QT_MAJOR_MINOR_PATCH-1.x86_64.rpm
if [[ "${DISTRIBUTION:0:4}" == "rhel" ]]; then if [[ "${DISTRIBUTION:0:4}" == "rhel" ]]; then
RPM_PATH=/opt/cache-packaging/${DISTRIBUTION}/jami-libqt-${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}-1.el8.x86_64.rpm RPM_PATH=/opt/cache-packaging/${DISTRIBUTION}/jami-libqt-$QT_MAJOR_MINOR_PATCH-1.el8.x86_64.rpm
fi fi
if [ ! -f "${RPM_PATH}" ]; then if [ ! -f "${RPM_PATH}" ]; then
...@@ -58,17 +68,19 @@ if [[ "${DISTRIBUTION:0:4}" == "rhel" \ ...@@ -58,17 +68,19 @@ if [[ "${DISTRIBUTION:0:4}" == "rhel" \
cd /opt/qt-jami-build cd /opt/qt-jami-build
cp /opt/ring-project-ro/packaging/rules/rpm/jami-libqt.spec . cp /opt/ring-project-ro/packaging/rules/rpm/jami-libqt.spec .
QT_TARBALL_CHECKSUM="3a530d1b243b5dec00bc54937455471aaa3e56849d2593edb8ded07228202240" # Fetch and cache the tarball, if not already available.
wget https://download.qt.io/archive/qt/${QT_MAJOR}.${QT_MINOR}/${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}/single/qt-everywhere-src-${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}.tar.xz if [ ! -f "$CACHED_QT_TARBALL" ]; then
wget "$QT_TARBALL_URL"
if ! echo -n ${QT_TARBALL_CHECKSUM} qt-everywhere-src-*.tar.xz | sha256sum -c - if ! echo -n ${QT_TARBALL_SHA256} "$QT_TARBALL_FILE_NAME" | sha256sum -c -
then then
echo "qt tarball checksum mismatch; quitting" echo "qt tarball checksum mismatch; quitting"
exit 1 exit 1
fi
flock "$CACHED_QT_TARBALL" mv "$QT_TARBALL_FILE_NAME" "$CACHED_QT_TARBALL"
fi fi
mv qt-everywhere-src-${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}.tar.xz /root/rpmbuild/SOURCES/jami-qtlib_${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}.tar.xz cp "$CACHED_QT_TARBALL" "/root/rpmbuild/SOURCES/jami-qtlib_$QT_MAJOR_MINOR_PATCH.tar.xz"
sed -i "s/RELEASE_VERSION/${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}/g" jami-libqt.spec sed -i "s/RELEASE_VERSION/$QT_MAJOR_MINOR_PATCH/g" jami-libqt.spec
rpmdev-bumpspec --comment="Automatic nightly release" \ rpmdev-bumpspec --comment="Automatic nightly release" \
--userstring="Jenkins <jami@lists.savoirfairelinux.net>" jami-libqt.spec --userstring="Jenkins <jami@lists.savoirfairelinux.net>" jami-libqt.spec
...@@ -76,13 +88,13 @@ if [[ "${DISTRIBUTION:0:4}" == "rhel" \ ...@@ -76,13 +88,13 @@ if [[ "${DISTRIBUTION:0:4}" == "rhel" \
mkdir -p /opt/cache-packaging/${DISTRIBUTION}/ mkdir -p /opt/cache-packaging/${DISTRIBUTION}/
if [[ "${DISTRIBUTION:0:4}" == "rhel" ]]; then if [[ "${DISTRIBUTION:0:4}" == "rhel" ]]; then
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}-1.el8.x86_64.rpm ${RPM_PATH} cp "/root/rpmbuild/RPMS/x86_64/jami-libqt-$QT_MAJOR_MINOR_PATCH-1.el8.x86_64.rpm" "${RPM_PATH}"
else else
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-*.rpm ${RPM_PATH} cp /root/rpmbuild/RPMS/x86_64/jami-libqt-*.rpm "${RPM_PATH}"
fi fi
fi fi
rpm --install ${RPM_PATH} rpm --install "${RPM_PATH}"
cp ${RPM_PATH} /opt/output cp "${RPM_PATH}" /opt/output
cd /opt/ring-project cd /opt/ring-project
fi fi
......
...@@ -60,6 +60,7 @@ PACKAGE_%(distribution)s_DOCKER_RUN_COMMAND = docker run \\ ...@@ -60,6 +60,7 @@ PACKAGE_%(distribution)s_DOCKER_RUN_COMMAND = docker run \\
-v $(CURDIR)/packages/%(distribution)s:/opt/output \\ -v $(CURDIR)/packages/%(distribution)s:/opt/output \\
-v /opt/cache-packaging:/opt/cache-packaging \\ -v /opt/cache-packaging:/opt/cache-packaging \\
-t $(DOCKER_EXTRA_ARGS) %(options)s \\ -t $(DOCKER_EXTRA_ARGS) %(options)s \\
-v /opt/ring-contrib:/opt/ring-contrib \\
$(PACKAGE_%(distribution)s_DOCKER_IMAGE_NAME) $(PACKAGE_%(distribution)s_DOCKER_IMAGE_NAME)
$(PACKAGE_%(distribution)s_DOCKER_IMAGE_FILE): docker/Dockerfile_%(docker_image)s $(PACKAGE_%(distribution)s_DOCKER_IMAGE_FILE): docker/Dockerfile_%(docker_image)s
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment