---
Ok! Round two.
Here's a summary of the changes from v1. For git-debpush:
- The pristine-tar checking code is now only run if this is a non-native
package (i.e., "if $upstream").
- The upstream version is used instead of the Debian-revised one.
- Differently from the old pristine-tar check, the code is not run just
for the first (i.e., -1 or -0.1) revision, but for any upload. This
way, the t2u service can potentially handle the case where
a pristine-tar upload was intended, but no orig is available in the
archive yet. Please let me know if this makes sense or not!
For tag2upload-obtain-origs:
- Code is a bit more carefully written (using nul terminated command
output when possible). This also applies to the git-debpush script.
- The pristinetar option has been renamed to pristine_tar, and the
option keys glob has been changed to accept underscores instead of
dashes.
- The process will fail if there is more than one pristine-tar orig.
- It is now checked that pristine-tar metadata is a regular file
(according to git ls-tree)
- git update-ref is not used to rewind the pristine-tar branch, instead
of git reset --hard.
I did not add the "critical extension" stuff yet. Also, what should we
do about the signature files which pristine-tar can optionally store and
retrieve?
git-debpush | 41 ++++++++++++++++++++++++++---------------
infra/dgit-repos-server | 7 ++++++-
tag2upload-obtain-origs | 38 ++++++++++++++++++++++++++++++++++++--
3 files changed, 68 insertions(+), 18 deletions(-)
diff --git a/git-debpush b/git-debpush
index e3a4ba39..78e42fb9 100755
--- a/git-debpush
+++ b/git-debpush
@@ -457,6 +457,30 @@ if $upstream; then
to_push+=("$upstream_tag")
fi
+# I obtain the commit ID at the time of the upload, so that I can be sure that
+# the tag2upload service generates the tarball with the expected pristine-tar
+# branch state
+pristine_tar_info=''
+if $upstream; then
+ uversion="${version%-*}"
+
+ if pristine_tar_commit=$(git rev-parse --verify --quiet
'refs/heads/pristine-tar'); then
+ pristine_tar_tarballs=$(git ls-tree -z --name-only --
'refs/heads/pristine-tar' \
+ | grep -zF -- "${source}_${uversion}.orig.tar." \
+ | grep -zc -- "\.id$")
+
+ if [ "$pristine_tar_tarballs" -gt 1 ]; then
+ fail 'more then one pristine-tar orig'
+ fi
+
+ # If there's no tarball, the user probably stopped using pristine-tar a
+ # while ago, but didn't delete the branch. Just ignore it.
+ if [ "$pristine_tar_tarballs" -eq 1 ]; then
+ pristine_tar_info=" pristine-tar=$pristine_tar_commit"
+ fi
+ fi
+fi
+
#**** Useful sanity checks ****
#---- UNRELEASED suite
@@ -522,20 +546,6 @@ case "$branch" in
fi
esac
-#---- Intent to use pristine-tar for this upload
-
-case "$version" in
- *"-1"|*"-0.1")
- uversion="${version%-*}"
- if $upstream && type pristine-tar >/dev/null 2>/dev/null \
- && pristine-tar list \
- | grep -q "^${source}_${uversion}"'\.orig\.tar\.'
- then
- fail_check pristine-tar \
- "pristine-tar data present for $uversion, but this will be ignored (#1106071)"
- fi
-esac
-
#---- Submodules
# Per gitmodules(7) "FORMS", .gitmodules is always present at the
@@ -837,7 +847,8 @@ fi
tagmessage="$source release $version for $target
[dgit distro=$distro split$quilt_mode_text]
-[dgit please-upload source=$source version=$version$upstream_info]
+[dgit please-upload source=$source version=$version]
+${upstream_info:+[dgit $upstream_info$pristine_tar_info]}
"
git_tag_main_opts_args=(-m "$tagmessage" "$debian_tag" "$branch_commit")
diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server
index f6a3716c..96058d56 100755
--- a/infra/dgit-repos-server
+++ b/infra/dgit-repos-server
@@ -1304,7 +1304,7 @@ our ($t2u_email_noreply, $t2u_email_noreply_addr,
$t2u_email_reply_to,
@t2u_email_copies, $t2u_jid, $t2u_url, $t2u_putative_package);
our ($t2u_tagger, $t2u_tagger_addr, $t2u_timeout);
our ($t2u_signing_keyid);
-our ($t2u_upstreamc, $t2u_upstreamt, $t2u_quilt);
+our ($t2u_upstreamc, $t2u_upstreamt, $t2u_quilt, $t2u_pristine_tar);
sub t2u_dgit_cmd () {
(
@@ -1840,6 +1840,8 @@ sub tag2upload_parsetag ($) {
$package = $1;
} elsif (s/^version=(\S+) //) {
$tagversion = $1;
+ } elsif (s/^pristine-tar=(\w+) //) {
+ $t2u_pristine_tar = $1;
} else {
return 0;
}
@@ -2031,6 +2033,9 @@ END
"s=$suite",
"u=$t2u_upstreamc",
);
+ if (length $t2u_pristine_tar) {
+ push(@obtain_origs, "pristine_tar=$t2u_pristine_tar")
+ }
flush EMAIL_REPORT or confess $!;
open STDOUT, ">& EMAIL_REPORT" or confess $!;
t2u_b_run_fetch_cmd_errok 'work', @obtain_origs;
diff --git a/tag2upload-obtain-origs b/tag2upload-obtain-origs
index 016fa655..73a23bea 100755
--- a/tag2upload-obtain-origs
+++ b/tag2upload-obtain-origs
@@ -16,6 +16,7 @@
# optional settings:
#
# bpd defaults to ../bpd
+# pristine_tar=PRISTINE-TAR-COMMITID
set -eu -o pipefail
shopt -s inherit_errexit # #514862, wtf
@@ -32,7 +33,7 @@ while [ $# != 0 ]; do
k="${1%%=*}"
v="${1#*=}"
case "$k" in
- *[^0-9a-z-]*) fail "bad syntax for setting" ;;
+ *[^0-9a-z_]*) fail "bad syntax for setting" ;;
*)
eval "s_$k=\$v"
;;
@@ -96,7 +97,40 @@ case "$rc" in
;;
esac
-x git deborig "$s_u"
+# TODO: what about signature files?
+if [ -n "$s_pristine_tar" ]; then
+ git update-ref --no-deref -- 'refs/heads/pristine-tar' "$s_pristine_tar"
+
+ i=0
+ tarball=$(git ls-tree -z --name-only -- 'refs/heads/pristine-tar' \
+ | while IFS= read -r -d '' file; do
+ case "$file" in
+ "${s_p}_${fversion}.orig.tar."*.id)
+ if [ "$i" -ge 1 ]; then
+ fail 'more then one pristine-tar orig'
+ fi
+ printf '%s' "${file%.id}"
+ i=$(( i + 1 ))
+ ;;
+ esac
+ done)
+ unset i
+
+ if [ -z "$tarball" ]; then
+ fail 'no tarball found in the pristine-tar branch'
+ fi
+
+ if git ls-tree --format '%(objectmode)' -- 'refs/heads/pristine-tar'
"${tarball}.delta" "${tarball}.id" \
+ | grep -Eqv '^(100644|100755)$'; then
+ fail 'pristine-tar metadata is not a regular file'
+ fi
+
+ x pristine-tar checkout -- "$tarball"
+ mv -- "$tarball" ..
+else
+ x git deborig "$s_u"
+fi
+
report 'created orig'
--
2.47.2