2 # Generate debian/changelog.upstream from debian/changelog and
3 # the git revision log. Inspired by Gerrit Pape’s
4 # debian/changelog.upstream.sh, from the git-core Debian package.
8 # If argument matches /^Version: /, output remaining text.
9 # Result is true if and only if argument matches.
13 result
=${line#Version: }
15 if test "$result" = "$line"
19 printf "%s\n" "$result"
24 # If argument matches /^\* New.*snapshot.*commit /,
25 # output remaining text.
26 # Result is true if and only if argument matches.
30 result
=${line#\* New*snapshot*commit }
32 if test "$result" = "$line"
36 printf "%s\n" "$result"
41 # Read standard input, scanning for a changelog entry of the
42 # form “New snapshot, taken from upstream commit <blah>.”
44 # Fails and writes a message to standard error if no such entry is
45 # found before the next Version: line with a different upstream
47 # $1 is the upstream version sought.
49 local upstream_version line version cid
55 version
=$
(version_line
"$line") &&
56 test "${version%-*}" != "$upstream_version"
61 if cid
=$
(commit_id_line
"$line")
63 printf "%s\n" "${cid%.}"
68 echo >&2 "No commit id for $upstream_version"
74 # Add a list of all revisions up to $last to debian/changelog.upstream
76 # $1 is a user-readable name for the commit $2
78 local new new_cid limiter
82 if test "$last" = none
84 : > debian
/changelog.upstream
90 exec >> debian
/changelog.upstream
94 echo "Version $last:" |
tr "[:print:]" -
97 echo "Version $last; changes since $new:"
98 echo "Version $last; changes since $new:" |
tr "[:print:]" -
102 git log
--date=iso
--stat --no-merges --format=medium
"$limiter$last_cid"
103 test "$new" = none ||
echo
109 dpkg-parsechangelog
--format rfc822
--all |
{
112 if version
=$
(version_line
"$line")
114 # strip Debian revision
115 upstream_version
=${version%-*}
117 if git rev-parse
--verify -q "v$upstream_version" > /dev
/null
120 add_version
"$upstream_version" "v$upstream_version"
123 cid
=$
(read_commit_id
"$upstream_version") ||
exit 1
124 add_version
"$upstream_version" "$cid"
128 add_version none none