Skip to content

Commit bc3f1fd

Browse files
committed
nix-prefetch-pijul: show date
1 parent 66a5440 commit bc3f1fd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkgs/build-support/fetchpijul/nix-prefetch-pijul

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ remote=
66
channel="main"
77
change=
88
state=
9+
date=
910
exp_hash=
1011

1112
usage() {
@@ -100,11 +101,15 @@ if [ -z "$final_path" ]; then
100101

101102
cd "$tmp_clone"
102103
pijul clone $clone_args "$remote" "$name"
104+
latest_log="$(pijul log --repository "$tmp_clone/$name" --limit 1)"
103105
# State is a stable reference is a stable reference for the patchset that
104106
# doesn't depend on patch order. As a result, it will always be included.
105107
if [ -z "$state" ]; then
106-
state="$(pijul log --repository "$tmp_clone/$name" --state --limit 1 | awk '/^State:/ {printf $2}')"
108+
state="$(printf "%s" "$latest_log" | awk '/^State:/ {printf $2}')"
107109
fi
110+
date="$(printf "%s" "$latest_log" | awk '/^Date:/ { sub(/^Date:[[:space:]]*/, "", $0); printf $0 }')"
111+
date="$(date -u -d "$date" "+%Y-%m-%dT%H:%M:%SZ")"
112+
108113
rm -rf "$tmp_clone/$name/.pijul"
109114

110115
hash="$(nix-hash --type "$hash_algo" "$hash_format" "$tmp_clone/$name")"
@@ -132,6 +137,7 @@ if [ -n "$change" ]; then cat <<EOF
132137
EOF
133138
fi; cat <<EOF
134139
"state": $(json_escape "$state"),
140+
"date": $(json_escape "$date"),
135141
"path": "$final_path",
136142
$(json_escape "$hash_algo"): $(json_escape "$hash"),
137143
"hash": "$(nix-hash --to-sri --type "$hash_algo" "$hash")"

0 commit comments

Comments
 (0)