Repository: fujiapple852/trippy (language: rust)

Issue:
Ubuntu 24.04 (noble) creates an error 404
**Describe the bug**
Ign:5 https://ppa.launchpadcontent.net/fujiapple/trippy/ubuntu noble InRelease
Err:6 https://ppa.launchpadcontent.net/fujiapple/trippy/ubuntu noble Release
  404  Not Found [IP: 2620:2d:4000:1::81 443]
E: The repository 'https://ppa.launchpadcontent.net/fujiapple/trippy/ubuntu noble Release' does not have a Release file.



**To Reproduce**
Install trippy on a fresh Ubuntu 24.04 system

**Expected behavior**
Successfull installation (just as with Ubuntu 22.04 LTS

**Environment Info**
Ubuntu 24.04.01 LTS



Discussion / hints:
Thank you for flagging this @Imperial929.  

At the time of release of Trippy 0.11.0 (11th Aug 2024), the latest Ubuntu LTS was `jammy`.  It seems that since then a newer Ubuntu LTS (`noble`) has been [released](https://wiki.ubuntu.com/Releases) so it makes sense to release for that as well.
I'm having [trouble](https://trippy.zulipchat.com/#narrow/stream/436136-general/topic/Issue.3A.20.20Ubuntu.2024.2E04.20.28noble.29.20creates.20an.20error.20404.20.231308/near/468924376) uploading the same version for `noble`.

TL;DR; when I try to upload Trippy 0.11.0 for `noble` I get an error that `trippy_0.11.0.orig.tar.gz` already exists, which is true as the filename does not contain the suffix `-ppa1~ubuntu24.04` and so clashes with the prior upload for `jammy`.  I don't know how to convince `debuild` to use a different name.

Build script is here: https://github.com/fujiapple852/trippy/blob/master/debian/release.sh
I found this: https://help.launchpad.net/Packaging/UploadErrors

> If you did change the version number, this usually happens for re-packaged orig.tar.gz. The [Gzip](http://en.wikipedia.org/wiki/Gzip) header includes a timestamp, resulting in files with different checksums for each individual compression step.
The solution for this problem consists of:
downloading the pristine original tarball from the location pointed in the rejection message;
regenerate the source upload using it, debuild -S will do it, note that there is no need to include the original tarball in the upload, a reference to the right file will suffice;
reupload the just created source package as usual, dput <TARGET> <CHANGES>.
@Imperial929 this is now resolved, Trippy 0.11.0 has been released for Ubuntu 24.04 (noble).  This is [trippy - 0.11.0-ppa2~ubuntu24.04](https://launchpad.net/~fujiapple/+archive/ubuntu/trippy/+sourcepub/16487661/+listing-archive-extra).

For my own reference, there were two issues:

- The original tarball (`trippy_0.11.0.orig.tar.gz`) is not versioned with the Ubuntu version and so to use it for `noble` I had to download the exact tarball that was previously uploaded for `jammy` and use that (see the helpful comment from the launchpad docs immediately above).
- The (freshly rebuilt) `vendor.tar.zx` was no longer compatible with the (old) `orig` tarball, specifically as the locked version of `arrayvec` (and likely other) crates was different between the src tarball and the vendored crates and so the build [failed](https://launchpadlibrarian.net/748838081/buildlog_ubuntu-noble-amd64.trippy_0.11.0-ppa1~ubuntu24.04_BUILDING.txt.gz).  The solution was the similar to the above, download the existing `trippy_0.11.0-ppa1~ubuntu24.04.debian.tar.xz` file and extract the `vendor.tar.zx` file and use that to build the package.  Note that this required bumping the `REVISION` to 2 such that we upload `trippy_0.11.0-ppa2~ubuntu24.04.debian.tar.xz`.

For the `0.12.0` release I will upload for both `jammy` and `noble` at the same time and so the issues above should not arise.

Aside: there is an in-flight [ITP](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1081023) to package Trippy for upstream Debian, so hopefully PPAs will not be required in the future.

Fix patch:
diff --git a/debian/release.sh b/debian/release.sh
index 8047b5679..66c2cc2d1 100755
--- a/debian/release.sh
+++ b/debian/release.sh
@@ -2,43 +2,67 @@
 
 set -o errexit -o pipefail -o nounset
 
+# The Trippy version to release
 VERSION="0.11.0"
+
+# The revision number for the PPA
+REVISION=1
+
+# The Ubuntu series to build for
+SERIES=("noble" "jammy" "focal" "bionic")
+
 TARBALL="trippy_${VERSION}.orig.tar.gz"
+PACKAGE="trippy"
+CHANGES="New upstream release"
 export DEBEMAIL="fujiapple852@gmail.com"
 export DEBFULLNAME="Fuji Apple"
-SERIES="noble"
 
-wget "https://github.com/fujiapple852/trippy/archive/refs/tags/${VERSION}.tar.gz"
-mv ${VERSION}.tar.gz $TARBALL
+# Download TARBALL
+wget -O "${TARBALL}" "https://github.com/fujiapple852/trippy/archive/refs/tags/${VERSION}.tar.gz"
+if [[ ! -f "${TARBALL}" ]]; then
+    echo "Error: Failed to download TARBALL." >&2
+    exit 1
+fi
 
-GPG_PRIVATE_KEY=$(cat launchpad_secret_key.pgp)
-GPG_KEY_ID=$(echo "$GPG_PRIVATE_KEY" | gpg --import-options show-only --import | sed -n '2s/^\s*//p')
-echo $GPG_KEY_ID
-echo "$GPG_PRIVATE_KEY" | gpg --batch --import
+# Import GPG key securely
+if [[ ! -f launchpad_secret_key.pgp ]]; then
+    echo "Error: GPG key file 'launchpad_secret_key.pgp' not found." >&2
+    exit 1
+fi
+gpg --batch --import launchpad_secret_key.pgp
+
+# Extract GPG key ID
+GPG_KEY_ID=$(gpg --with-colons --import-options show-only --import launchpad_secret_key.pgp | awk -F: '/^sec/ {print $5}')
 
-echo "Checking GPG expirations..."
-if [[ $(gpg --list-keys | grep expired) ]]; then
+# Check GPG key expiration
+if gpg --list-keys --with-colons "${GPG_KEY_ID}" | grep '^pub' | grep '[e]'; then
     echo "GPG key has expired. Please update your GPG key." >&2
     exit 1
 fi
 
-mkdir -p build
-cp -r debian build/debian
-
-ubuntu_version=$(distro-info --series ${SERIES} -r | cut -d' ' -f1)
-package=$(dpkg-parsechangelog --show-field Source)
-pkg_version=$(dpkg-parsechangelog --show-field Version | cut -d- -f1)
-changes="New upstream release"
-REVISION=1
+# Vendor the cargo dependencies
+cargo vendor
+tar cJf debian/vendor.tar.xz vendor
 
-cd build
+for series in "${SERIES[@]}"; do
+    UBUNTU_VERSION=$(distro-info --series "${series}" -r | cut -d' ' -f1)
+    BUILD_DIR="build-${series}"
+    mkdir -p "${BUILD_DIR}"
+    cp -r debian "${BUILD_DIR}/debian"
+    cd "${BUILD_DIR}"
 
-rm -rf debian/changelog
-dch --create --distribution ${SERIES} --package $package --newversion $pkg_version-ppa$REVISION~ubuntu$ubuntu_version "$changes"
+    # Update changelog for the specific series
+    rm -f debian/changelog
+    dch --create --distribution "${series}" --PACKAGE "${PACKAGE}" \
+        --newversion "${VERSION}-ppa${REVISION}~ubuntu${UBUNTU_VERSION}" "$CHANGES"
 
-./debian/rules vendor
+    # Build the source PACKAGE
+    debuild --prepend-path ~/.cargo/bin -S -sa
 
-debuild --prepend-path ~/.cargo/bin -S -sa
+    cd ..
+done
 
 # The -ss flag is used to simulate the upload, remove to actually upload
-dput -ss ppa:fujiapple/trippy ../*.changes
\ No newline at end of file
+for changes_file in ./*.changes; do
+    dput -ss ppa:fujiapple/trippy "${changes_file}"
+done
diff --git a/debian/rules b/debian/rules
index 41866c87c..74afaaab7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,15 +1,10 @@
 #!/usr/bin/make -f
 
-.PHONY: override_dh_strip vendor
+.PHONY: override_dh_strip
 
 %:
 	dh $@
 
-vendor:
-	-[ -d vendor ] && rm -rf vendor
-	cargo vendor
-	tar cJf debian/vendor.tar.xz vendor
-
 override_dh_auto_build:
 	mkdir .cargo
 	cp debian/cargo.config .cargo/config


Test patch: