On Mon Jul 21, 2025 at 7:32 PM CEST, Andrea Pappacoda wrote:
diff --git a/tag2upload-obtain-origs b/tag2upload-obtain-origs
index 016fa655..0453c2de 100755
--- a/tag2upload-obtain-origs
+++ b/tag2upload-obtain-origs
@@ -16,6 +16,7 @@
 # optional settings:
 #
 #     bpd                          defaults to ../bpd
+#     pristinetar=PRISTINE-TAR-COMMITID
set -eu -o pipefail
 shopt -s inherit_errexit # #514862, wtf
@@ -96,7 +97,27 @@ case "$rc" in
        ;;
 esac
-x git deborig "$s_u"
+if [ -n "$s_pristinetar" ]; then
+    old_head=$(git rev-parse --verify HEAD)
+    git reset --hard -- "$s_pristinetar"
+
+    # Only get the first tarball file matching the current package version.
+    # pristine-tar does not disallow having two tarballs for the same package
+    # version using different compression algorithms, so this will just pick a
+    # random one. It might make sense to error out instead in such cases.
+    tarball=$(git ls-tree --name-only | while IFS= read -r file; do
+        case "$file" in
+            "${s_p}_${fversion}.orig.*.id") printf '%s\n' "${file%.id}"
+            break ;;
+        esac
+    done)
+
+    x pristine-tar checkout "$tarball"

Here there should probably also be a `mv "$tarball" ..`, as pristine-tar checkout generates the tarball in the current working directory.

+    git reset --hard -- "$old_head"
+else
+    x git deborig "$s_u"
+fi
+
report 'created orig'

Reply via email to