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" ...@@ -23,9 +23,9 @@ PACKAGE_NAME="libfprint"
PACKAGE_DIR="${SCRIPT_DIR}/tmp" PACKAGE_DIR="${SCRIPT_DIR}/tmp"
PACKAGE_ARCH="all" PACKAGE_ARCH="all"
BUILD_ARCH="$(dpkg --print-architecture)" BUILD_ARCH="$(dpkg --print-architecture)"
PACKAGE_VER="$(git describe $(git rev-list --tags --max-count=1))" LATEST_TAG="$(git describe $(git rev-list --tags --max-count=1))"
DEBIAN_VER="$(grep -P -m 1 -o '\d*\.\d*\.\d*-\d*' debian/changelog)"
UPSTREAM_VER="$(grep -P -m 1 -o '\d*\.\d*\.\d*' debian/changelog)" 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 # Save the final build status messages to functions
good_news() { good_news() {
...@@ -63,19 +63,19 @@ else ...@@ -63,19 +63,19 @@ else
exit 1 exit 1
fi 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? # 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 case $TRANSFER_AGENT in
curl) 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" \ 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}_${UPSTREAM_VER}.orig.tar.gz") -o "${PACKAGE_DIR}/${PACKAGE_NAME}-${LATEST_TAG}.tar.gz")
;; ;;
wget) wget)
HTTP_CODE=$(wget -qc -t 3 --show-progress -O "${PACKAGE_DIR}/${PACKAGE_NAME}_${UPSTREAM_VER}.orig.tar.gz" \ 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/${PACKAGE_VER}/${PACKAGE_NAME}-${PACKAGE_VER}.tar.gz" 2>&1 | --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) awk '/^ HTTP/{print $2}' | tail -1)
;; ;;
*) *)
...@@ -89,12 +89,15 @@ if [ "${HTTP_CODE}" != 200 ]; then ...@@ -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}." echo -e "\\t\\e[37;41mERROR:\\e[0m Request to GitLab for latest release file failed with code ${HTTP_CODE}."
exit 1 exit 1
else 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 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..." 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 # Copy the Debian packaging files into the same directory as the source code and
# make that source+packaging folder the new working directory # make that source+packaging folder the new working directory
...@@ -102,11 +105,10 @@ cp -R "${SCRIPT_DIR}"/debian "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER} ...@@ -102,11 +105,10 @@ cp -R "${SCRIPT_DIR}"/debian "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER}
cd "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER}" || exit 1 cd "${PACKAGE_DIR}"/"${PACKAGE_NAME}"-"${UPSTREAM_VER}" || exit 1
# Create and install a dummy package to satisfy the build dependencies, then delete it # 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 # 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 # 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..." 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