Commit 5dfbbbdd authored by Peter J. Mello's avatar Peter J. Mello
Browse files

Adjust for GitLab tagged release archive naming conventions

parent 55f93944
Pipeline #45938 failed with stages
in 2 minutes and 49 seconds
......@@ -23,9 +23,9 @@ PACKAGE_NAME="libfprint"
PACKAGE_DIR="${SCRIPT_DIR}/tmp"
PACKAGE_ARCH="all"
BUILD_ARCH="$(dpkg --print-architecture)"
PACKAGE_VER="$(git describe $(git rev-list --tags --max-count=1))"
DEBIAN_VER="$(grep -P -m 1 -o '\d*\.\d*\.\d*-\d*' debian/changelog)"
LATEST_TAG="$(git describe $(git rev-list --tags --max-count=1))"
UPSTREAM_VER="$(grep -P -m 1 -o '\d*\.\d*\.\d*' debian/changelog)"
DEBIAN_VER="$(grep -P -m 1 -o '\d*\.\d*\.\d*-\d*' debian/changelog)"
# Save the final build status messages to functions
good_news() {
......@@ -63,19 +63,19 @@ else
exit 1
fi
echo -e "\\t\\e[37;42mOK:\\e[0m Latest Release Tag = ${PACKAGE_VER}"
echo -e "\\t\\e[37;42mOK:\\e[0m Latest Release Tag = ${LATEST_TAG}"
# Just hand over the tarball and nobody gets hurt, ya see?
echo "Downloading https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/${PACKAGE_VER}/${PACKAGE_NAME}-${PACKAGE_VER}.tar.gz..."
echo "Downloading https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/${LATEST_TAG}/${PACKAGE_NAME}-${LATEST_TAG}.tar.gz..."
case $TRANSFER_AGENT in
curl)
HTTP_CODE=$(curl -# --retry 3 -w '%{http_code}' -L "https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/${PACKAGE_VER}/${PACKAGE_NAME}-${PACKAGE_VER}.tar.gz" \
-o "${PACKAGE_DIR}/${PACKAGE_NAME}_${UPSTREAM_VER}.orig.tar.gz")
HTTP_CODE=$(curl -# --retry 3 -w '%{http_code}' -L "https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/${LATEST_TAG}/${PACKAGE_NAME}-${LATEST_TAG}.tar.gz" \
-o "${PACKAGE_DIR}/${PACKAGE_NAME}-${LATEST_TAG}.tar.gz")
;;
wget)
HTTP_CODE=$(wget -qc -t 3 --show-progress -O "${PACKAGE_DIR}/${PACKAGE_NAME}_${UPSTREAM_VER}.orig.tar.gz" \
--server-response "https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/${PACKAGE_VER}/${PACKAGE_NAME}-${PACKAGE_VER}.tar.gz" 2>&1 |
HTTP_CODE=$(wget -qc -t 3 --show-progress -O "${PACKAGE_DIR}/${PACKAGE_NAME}-${LATEST_TAG}.tar.gz" \
--server-response "https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/${LATEST_TAG}/${PACKAGE_NAME}-${LATEST_TAG}.tar.gz" 2>&1 |
awk '/^ HTTP/{print $2}' | tail -1)
;;
*)
......@@ -89,12 +89,15 @@ if [ "${HTTP_CODE}" != 200 ]; then
echo -e "\\t\\e[37;41mERROR:\\e[0m Request to GitLab for latest release file failed with code ${HTTP_CODE}."
exit 1
else
echo -e '\t\e[37;42mOK:\e[0m Successfully downloaded the latest libfprint package from GitLab.'
echo -e '\t\e[37;42mOK:\e[0m Successfully downloaded the latest tagged libfprint source code archive from GitLab.'
fi
# Unpack the tarball in the build directory
# Unpack the tarball in the build directory and change the naming conventions to Debian standard then repack
echo "Unpacking the release archive..."
tar -xzf "${PACKAGE_DIR}"/"${PACKAGE_NAME}"_"${UPSTREAM_VER}".orig.tar.gz -C "${PACKAGE_DIR}"
tar xzf "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${LATEST_TAG}".tar.gz -C "${PACKAGE_DIR}"
mv "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${LATEST_TAG}" "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER}"
tar cJf "${PACKAGE_NAME}"_"${UPSTREAM_VER}".orig.tar.xz -I xz -z -T 0 -- "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER}"
rm -f "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${LATEST_TAG}".tar.gz
# Copy the Debian packaging files into the same directory as the source code and
# make that source+packaging folder the new working directory
......@@ -102,11 +105,10 @@ cp -R "${SCRIPT_DIR}"/debian "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER}
cd "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER}" || exit 1
# Create and install a dummy package to satisfy the build dependencies, then delete it
mk-build-deps -ir debian/control
mk-build-deps -ir "${SCRIPT_DIR}"/debian/control
# Replace the generic distribution string "unstable" with the distribution codename of the build system
sed -i "1s/unstable/$(lsb_release -cs)/" debian/changelog
sed -i "1s/unstable/$(lsb_release -cs)/" "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER}"/debian/changelog
# Call debuild to oversee the build process and produce an output string for the user based on its exit code
echo -e "\\tBuilding package ${PACKAGE_NAME}_${DEBIAN_VER}_${PACKAGE_ARCH}.deb, please be patient..."
......
Markdown is supported
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