2022-12-01 16:37:19 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2024-01-02 15:21:23 -05:00
|
|
|
# Copyright (C) 2016-2024 Savoir-faire Linux Inc.
|
2022-12-01 16:37:19 -05:00
|
|
|
#
|
|
|
|
# Author: Alexandre Viau <alexandre.viau@savoirfairelinux.com>
|
|
|
|
# Author: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
# This script is used in the packaging containers to build packages on
|
|
|
|
# rpm-based distros.
|
|
|
|
#
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Import the spec file.
|
|
|
|
mkdir -p /opt/client-qt
|
|
|
|
cd /opt/client-qt
|
packaging: Update release tarball name and version scheme.
* extras/packaging/gnu-linux/scripts/release-version.sh: Add script
for deriving (reproducibly) a release version. The format will follow
a 'YYYYMMDD.X' scheme, where 'YYYYMMDD' is the date of the last commit
on the current branch, and 'X' the number of releases tagged that day,
starting from zero. Example: the first stable release with a newest
commit date of 2023-01-02 would have a version of '20230102.0', the
subsequent one '20230102.1', and so on. This is derived by counting
the number of git tags with the prefix 'TYPE/YYYYMMDD', where 'TYPE'
is the release type: either 'stable', 'beta', or 'nightly'.
* extras/packaging/gnu-linux/Jenkinsfile: Call the above new script to
derive the release version to use for tagging.
* extras/packaging/gnu-linux/Makefile: Switch from the previous
'jami_YYYYMMDD.hhmm.COMMIT.tar.gz' tarball filename format to
'jami-YYYYMMDD.X.tar.gz'. The new format is shorter, omits the
unnecessary and confusing commit id, and uses dash instead of
underscore. Also, it contains everything in a top-level directory
with the same name as the tarball (without the .tar.gz extensions),
so that 'jami-YYYYMMDD.X.tar.gz' nicely extracts to 'jami-YYYYMMDD.X'.
With these changes, our release tarballs will follow more closely the
related instructions from the GNU maintainers manual:
https://www.gnu.org/prep/maintain/html_node/Distribution-tar-Files.html
Lastly, this change inadvertently 'fixes' a recent issue where the
'extras/ci/client-qt-gnulinux' subdirectory and its contents would be
moved to top-level in the tarball due to one of the tarball transforms
matching the 'client-qt' in the directory's name, replacing the
'extras/ci/client-qt' prefix with 'client-qt', thereby resulting in
'client-qt-gnulinux' being moved to the tarball's top-level.
* .gitignore: Ignore several packaging-related directories and files.
* extras/packaging/gnu-linux/rules/rpm/jami-daemon.spec:
* extras/packaging/gnu-linux/rules/rpm/jami-libclient.spec:
* extras/packaging/gnu-linux/rules/rpm/jami-qt.spec:
* extras/packaging/gnu-linux/rules/rpm/jami.spec: Update the expected
release tarball filename pattern in the 'Source' field. Also replace
references to previous top-level directory name 'client-qt' with the
new one 'jami-%{version}' where needed.
* extras/packaging/gnu-linux/rules/rpm/jami-libqt.spec: Update the
'Source' field to follow new tarball name consistent with the main
Jami release tarball.
* extras/packaging/gnu-linux/scripts/build-package-rpm.sh: Update the
tarball top-level directory pattern for the new format, now passing
the --wildcards option to GNU Tar. Also use a name for the jami-libqt
source tarball that is more consistent with the main Jami release
tarball.
* extras/packaging/gnu-linux/scripts/build-package-snap.sh: Update the
top-level directory pattern for the new format.
* extras/packaging/gnu-linux/tarballs.manifest: Drop file accidentally
checked into git.
Change-Id: I2695f560c0bc5e61fb99dc0244f8fbb8e7026a62
2023-01-25 21:27:01 -05:00
|
|
|
tar xf "/src/$RELEASE_TARBALL_FILENAME" --wildcards 'jami-*/extras/packaging/gnu-linux/rules/rpm' \
|
2022-12-01 16:37:19 -05:00
|
|
|
--strip-components=5 && mv rpm/* . && rmdir rpm
|
|
|
|
rm jami-libqt.spec
|
|
|
|
|
|
|
|
# Prepare the build tree.
|
|
|
|
rpmdev-setuptree
|
|
|
|
|
|
|
|
# Copy the source tarball.
|
|
|
|
cp --reflink=auto "/src/$RELEASE_TARBALL_FILENAME" /root/rpmbuild/SOURCES
|
|
|
|
|
2023-04-19 11:15:41 -04:00
|
|
|
cp patches/*.patch /root/rpmbuild/SOURCES/
|
2022-12-01 16:37:19 -05:00
|
|
|
|
|
|
|
QT_JAMI_PREFIX="/usr/lib64/qt-jami"
|
|
|
|
PATH="${QT_JAMI_PREFIX}/bin:${PATH}"
|
|
|
|
LD_LIBRARY_PATH="${QT_JAMI_PREFIX}/lib:${LD_LIBRARY_PATH}"
|
|
|
|
PKG_CONFIG_PATH="${QT_JAMI_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"
|
|
|
|
CMAKE_PREFIX_PATH="${QT_JAMI_PREFIX}/lib/cmake:${CMAKE_PREFIX_PATH}"
|
|
|
|
QT_MAJOR=6
|
2023-11-27 11:07:12 -05:00
|
|
|
QT_MINOR=5
|
2022-12-01 16:37:19 -05:00
|
|
|
QT_PATCH=3
|
2023-11-27 11:07:12 -05:00
|
|
|
QT_RELEASE_PATCH=0
|
2022-12-01 16:37:19 -05:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-11-27 11:07:12 -05:00
|
|
|
QT_TARBALL_SHA256="7cda4d119aad27a3887329cfc285f2aba5da85601212bcb0aea27bd6b7b544cb"
|
2022-12-01 16:37:19 -05:00
|
|
|
QT_TARBALL_FILE_NAME=$(basename "$QT_TARBALL_URL")
|
|
|
|
CACHED_QT_TARBALL=$TARBALLS/$QT_TARBALL_FILE_NAME
|
|
|
|
|
|
|
|
mkdir -p "$TARBALLS/$DISTRIBUTION"
|
|
|
|
RPM_PATH=$TARBALLS/$DISTRIBUTION/jami-libqt-$QT_MAJOR_MINOR_PATCH-${QT_RELEASE_PATCH}.x86_64.rpm
|
|
|
|
if [[ "${DISTRIBUTION:0:4}" == "rhel" ]]; then
|
|
|
|
RPM_PATH=$TARBALLS/${DISTRIBUTION}/jami-libqt-$QT_MAJOR_MINOR_PATCH-${QT_RELEASE_PATCH}.el8.x86_64.rpm
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "${RPM_PATH}" ]; then
|
|
|
|
# The following block will only run on one build machine at a
|
|
|
|
# time, thanks to flock.
|
|
|
|
(
|
|
|
|
flock 9 # block until the lock is available
|
|
|
|
test -f "$RPM_PATH" && exit 0 # check again
|
|
|
|
|
|
|
|
mkdir /opt/qt-jami-build
|
|
|
|
cd /opt/qt-jami-build
|
|
|
|
tar xf "/src/$RELEASE_TARBALL_FILENAME" \
|
packaging: Update release tarball name and version scheme.
* extras/packaging/gnu-linux/scripts/release-version.sh: Add script
for deriving (reproducibly) a release version. The format will follow
a 'YYYYMMDD.X' scheme, where 'YYYYMMDD' is the date of the last commit
on the current branch, and 'X' the number of releases tagged that day,
starting from zero. Example: the first stable release with a newest
commit date of 2023-01-02 would have a version of '20230102.0', the
subsequent one '20230102.1', and so on. This is derived by counting
the number of git tags with the prefix 'TYPE/YYYYMMDD', where 'TYPE'
is the release type: either 'stable', 'beta', or 'nightly'.
* extras/packaging/gnu-linux/Jenkinsfile: Call the above new script to
derive the release version to use for tagging.
* extras/packaging/gnu-linux/Makefile: Switch from the previous
'jami_YYYYMMDD.hhmm.COMMIT.tar.gz' tarball filename format to
'jami-YYYYMMDD.X.tar.gz'. The new format is shorter, omits the
unnecessary and confusing commit id, and uses dash instead of
underscore. Also, it contains everything in a top-level directory
with the same name as the tarball (without the .tar.gz extensions),
so that 'jami-YYYYMMDD.X.tar.gz' nicely extracts to 'jami-YYYYMMDD.X'.
With these changes, our release tarballs will follow more closely the
related instructions from the GNU maintainers manual:
https://www.gnu.org/prep/maintain/html_node/Distribution-tar-Files.html
Lastly, this change inadvertently 'fixes' a recent issue where the
'extras/ci/client-qt-gnulinux' subdirectory and its contents would be
moved to top-level in the tarball due to one of the tarball transforms
matching the 'client-qt' in the directory's name, replacing the
'extras/ci/client-qt' prefix with 'client-qt', thereby resulting in
'client-qt-gnulinux' being moved to the tarball's top-level.
* .gitignore: Ignore several packaging-related directories and files.
* extras/packaging/gnu-linux/rules/rpm/jami-daemon.spec:
* extras/packaging/gnu-linux/rules/rpm/jami-libclient.spec:
* extras/packaging/gnu-linux/rules/rpm/jami-qt.spec:
* extras/packaging/gnu-linux/rules/rpm/jami.spec: Update the expected
release tarball filename pattern in the 'Source' field. Also replace
references to previous top-level directory name 'client-qt' with the
new one 'jami-%{version}' where needed.
* extras/packaging/gnu-linux/rules/rpm/jami-libqt.spec: Update the
'Source' field to follow new tarball name consistent with the main
Jami release tarball.
* extras/packaging/gnu-linux/scripts/build-package-rpm.sh: Update the
tarball top-level directory pattern for the new format, now passing
the --wildcards option to GNU Tar. Also use a name for the jami-libqt
source tarball that is more consistent with the main Jami release
tarball.
* extras/packaging/gnu-linux/scripts/build-package-snap.sh: Update the
top-level directory pattern for the new format.
* extras/packaging/gnu-linux/tarballs.manifest: Drop file accidentally
checked into git.
Change-Id: I2695f560c0bc5e61fb99dc0244f8fbb8e7026a62
2023-01-25 21:27:01 -05:00
|
|
|
--wildcards 'jami-*/extras/packaging/gnu-linux/rules/rpm/jami-libqt.spec' \
|
2022-12-01 16:37:19 -05:00
|
|
|
--strip-components=6
|
|
|
|
|
|
|
|
# Fetch and cache the tarball, if not already available.
|
|
|
|
if [ ! -f "$CACHED_QT_TARBALL" ]; then
|
|
|
|
(
|
|
|
|
flock 8 # block until the lock file is gone
|
|
|
|
test -f "$CACHED_QT_TARBALL" && exit 0 # check again
|
|
|
|
|
|
|
|
wget "$QT_TARBALL_URL"
|
|
|
|
if ! echo -n ${QT_TARBALL_SHA256} "$QT_TARBALL_FILE_NAME" | sha256sum -c -
|
|
|
|
then
|
|
|
|
echo "qt tarball checksum mismatch; quitting"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
mv "$QT_TARBALL_FILE_NAME" "$CACHED_QT_TARBALL"
|
|
|
|
) 8>"${CACHED_QT_TARBALL}.lock"
|
|
|
|
fi
|
|
|
|
|
packaging: Update release tarball name and version scheme.
* extras/packaging/gnu-linux/scripts/release-version.sh: Add script
for deriving (reproducibly) a release version. The format will follow
a 'YYYYMMDD.X' scheme, where 'YYYYMMDD' is the date of the last commit
on the current branch, and 'X' the number of releases tagged that day,
starting from zero. Example: the first stable release with a newest
commit date of 2023-01-02 would have a version of '20230102.0', the
subsequent one '20230102.1', and so on. This is derived by counting
the number of git tags with the prefix 'TYPE/YYYYMMDD', where 'TYPE'
is the release type: either 'stable', 'beta', or 'nightly'.
* extras/packaging/gnu-linux/Jenkinsfile: Call the above new script to
derive the release version to use for tagging.
* extras/packaging/gnu-linux/Makefile: Switch from the previous
'jami_YYYYMMDD.hhmm.COMMIT.tar.gz' tarball filename format to
'jami-YYYYMMDD.X.tar.gz'. The new format is shorter, omits the
unnecessary and confusing commit id, and uses dash instead of
underscore. Also, it contains everything in a top-level directory
with the same name as the tarball (without the .tar.gz extensions),
so that 'jami-YYYYMMDD.X.tar.gz' nicely extracts to 'jami-YYYYMMDD.X'.
With these changes, our release tarballs will follow more closely the
related instructions from the GNU maintainers manual:
https://www.gnu.org/prep/maintain/html_node/Distribution-tar-Files.html
Lastly, this change inadvertently 'fixes' a recent issue where the
'extras/ci/client-qt-gnulinux' subdirectory and its contents would be
moved to top-level in the tarball due to one of the tarball transforms
matching the 'client-qt' in the directory's name, replacing the
'extras/ci/client-qt' prefix with 'client-qt', thereby resulting in
'client-qt-gnulinux' being moved to the tarball's top-level.
* .gitignore: Ignore several packaging-related directories and files.
* extras/packaging/gnu-linux/rules/rpm/jami-daemon.spec:
* extras/packaging/gnu-linux/rules/rpm/jami-libclient.spec:
* extras/packaging/gnu-linux/rules/rpm/jami-qt.spec:
* extras/packaging/gnu-linux/rules/rpm/jami.spec: Update the expected
release tarball filename pattern in the 'Source' field. Also replace
references to previous top-level directory name 'client-qt' with the
new one 'jami-%{version}' where needed.
* extras/packaging/gnu-linux/rules/rpm/jami-libqt.spec: Update the
'Source' field to follow new tarball name consistent with the main
Jami release tarball.
* extras/packaging/gnu-linux/scripts/build-package-rpm.sh: Update the
tarball top-level directory pattern for the new format, now passing
the --wildcards option to GNU Tar. Also use a name for the jami-libqt
source tarball that is more consistent with the main Jami release
tarball.
* extras/packaging/gnu-linux/scripts/build-package-snap.sh: Update the
top-level directory pattern for the new format.
* extras/packaging/gnu-linux/tarballs.manifest: Drop file accidentally
checked into git.
Change-Id: I2695f560c0bc5e61fb99dc0244f8fbb8e7026a62
2023-01-25 21:27:01 -05:00
|
|
|
cp "$CACHED_QT_TARBALL" "/root/rpmbuild/SOURCES/jami-libqt-$QT_MAJOR_MINOR_PATCH.tar.xz"
|
2022-12-01 16:37:19 -05:00
|
|
|
sed -i "s/RELEASE_VERSION/$QT_MAJOR_MINOR_PATCH/g" jami-libqt.spec
|
|
|
|
rpmdev-bumpspec --comment="Automatic nightly release" \
|
|
|
|
--userstring="Jenkins <jami@lists.savoirfairelinux.net>" jami-libqt.spec
|
|
|
|
|
|
|
|
rpmbuild --define "debug_package %{nil}" -ba jami-libqt.spec
|
|
|
|
# Note: try to remove with Qt > 6. Else we have a problem with $ORIGIN
|
|
|
|
mkdir -p "$TARBALLS/${DISTRIBUTION}"
|
|
|
|
|
|
|
|
# Cache the built Qt RPM package.
|
|
|
|
if [[ "${DISTRIBUTION:0:4}" == "rhel" ]]; then
|
|
|
|
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-$QT_MAJOR_MINOR_PATCH-*.el8.x86_64.rpm "${RPM_PATH}"
|
|
|
|
elif [[ "${DISTRIBUTION}" == "fedora_36" ]]; then
|
|
|
|
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-$QT_MAJOR_MINOR_PATCH-*.fc36.x86_64.rpm "${RPM_PATH}"
|
|
|
|
elif [[ "${DISTRIBUTION}" == "fedora_37" ]]; then
|
|
|
|
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-$QT_MAJOR_MINOR_PATCH-*.fc37.x86_64.rpm "${RPM_PATH}"
|
2023-04-19 11:15:41 -04:00
|
|
|
elif [[ "${DISTRIBUTION}" == "fedora_38" ]]; then
|
|
|
|
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-$QT_MAJOR_MINOR_PATCH-*.fc38.x86_64.rpm "${RPM_PATH}"
|
2023-10-18 07:42:40 -04:00
|
|
|
elif [[ "${DISTRIBUTION}" == "fedora_39" ]]; then
|
|
|
|
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-$QT_MAJOR_MINOR_PATCH-*.fc39.x86_64.rpm "${RPM_PATH}"
|
2023-09-28 09:51:41 -04:00
|
|
|
elif [[ "${DISTRIBUTION}" == "alma_9" ]]; then
|
|
|
|
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-$QT_MAJOR_MINOR_PATCH-*.el9.x86_64.rpm "${RPM_PATH}"
|
2022-12-01 16:37:19 -05:00
|
|
|
else
|
|
|
|
cp /root/rpmbuild/RPMS/x86_64/jami-libqt-*.rpm "${RPM_PATH}"
|
|
|
|
fi
|
|
|
|
) 9>"${RPM_PATH}.lock"
|
|
|
|
fi
|
|
|
|
rpm --install "${RPM_PATH}"
|
|
|
|
cp "${RPM_PATH}" /opt/output
|
|
|
|
cd /opt/client-qt
|
|
|
|
|
|
|
|
# Set the version and associated comment.
|
|
|
|
sed -i "s/RELEASE_VERSION/${RELEASE_VERSION}/g" ./*.spec
|
|
|
|
rpmdev-bumpspec --comment="Automatic nightly release" \
|
|
|
|
--userstring="Jenkins <jami@lists.savoirfairelinux.net>" ./*.spec
|
|
|
|
|
|
|
|
# Build the daemon and install it.
|
|
|
|
rpmbuild --define "debug_package %{nil}" -ba jami-daemon.spec
|
|
|
|
rpm --install /root/rpmbuild/RPMS/x86_64/jami-daemon-*
|
|
|
|
|
|
|
|
# Build the temporary transitional packages.
|
|
|
|
rpmbuild --define "debug_package %{nil}" -ba jami-libclient.spec
|
|
|
|
rpmbuild --define "debug_package %{nil}" -ba jami-qt.spec
|
|
|
|
|
|
|
|
# Build the Qt client.
|
|
|
|
rpmbuild --define "debug_package %{nil}" -ba jami.spec
|
|
|
|
|
|
|
|
# Move the built packages to the output directory.
|
|
|
|
mv /root/rpmbuild/RPMS/*/* /opt/output
|
|
|
|
touch /opt/output/.packages-built
|
|
|
|
chown -R "$CURRENT_UID:$CURRENT_UID" /opt/output
|
2022-12-29 09:40:06 -05:00
|
|
|
chown -R "${CURRENT_UID}:${CURRENT_UID}" .
|
2022-12-01 16:37:19 -05:00
|
|
|
|
|
|
|
# TODO: One click install: create a package that combines the already
|
|
|
|
# built package into one.
|