3 git_author
="$(git config user.name)"
4 git_email
="$(git config user.email)"
7 base_url
="http://downloads.openwrt.org/releases"
9 [ -f "./feeds.conf.default" ] ||
{
10 echo "Please execute as ./${0##*/}" >&2
17 echo "Usage: $0 [-i] [-a <Git author>] [-e <Git email>] \\"
18 echo " [-k <GPG key id>] [-p <GPG passphrase file>] \\"
19 echo " [-u <Download base url>] -v <version>"
22 echo "Exit successfully if tag already exists"
24 echo "-a Git author [$git_author]"
25 echo "Override the author name used for automated Git commits"
27 echo "-e Git email [$git_email]"
28 echo "Override the email used for automated Git commits"
30 echo "-k GPG key id [${gpg_keyid:-none}]"
31 echo "Enable GPG signing of tags with given GPG key id"
33 echo "-p GPG passphrase file [none]"
34 echo "Use the passphrase stored in the given file for signing"
36 echo "-u Download base url [$base_url]"
37 echo "Use the given URL as base for download repositories"
43 while getopts "a:e:ik:p:u:v:" opt
; do
45 a
) git_author
="$OPTARG" ;;
46 e
) git_email
="$OPTARG" ;;
47 i
) ignore_existing
=1 ;;
48 k
) gpg_keyid
="${OPTARG#0x}" ;;
49 p
) gpg_passfile
="${OPTARG}" ;;
50 u
) base_url
="${OPTARG%/}" ;;
55 basever
="$(echo "$version" | cut -d. -f1-2)"
58 echo "Unexpected version format: $OPTARG" >&2
64 echo "Unexpected option: -$OPTARG" >&2
68 echo "Missing argument for option: -$OPTARG" >&2
74 [ -n "$version" ] || usage
76 if git rev-parse
"v${version}^{tag}" >/dev
/null
2>/dev
/null
; then
77 if [ -z "$ignore_existing" ]; then
78 echo "Tag v${version} already exists!" >&2
85 revnum
="$(./scripts/getver.sh)"
86 epoch
="$(./scripts/get_source_date_epoch.sh)"
88 branch
="$(git symbolic-ref -q HEAD)"
93 echo "Expecting current branch name to end in \"-$basever\"," \
94 "but it is \"${branch#refs/heads/}\" - aborting."
100 export GIT_AUTHOR_NAME
="$git_author"
101 export GIT_AUTHOR_EMAIL
="$git_email"
102 export GIT_COMMITTER_NAME
="$git_author"
103 export GIT_COMMITTER_EMAIL
="$git_email"
105 while read type name url
; do
109 *^
*) sha1
="${url##*^}" ;;
110 *\
;*) sha1
="$(git ls-remote "${url%;*}" "${url##*;}")" ;;
111 *) sha1
="$(git ls-remote "$url" "master
")" ;;
113 echo "$type $name ${url%[;^]*}${sha1:+^${sha1:0:40}}"
117 *\
;*) rev="${url##*;}" ;;
118 *) rev="$(svn log -l 1 "$url" | sed -ne '2s/ .*$//p')" ;;
120 echo "$type $name ${url%;*}${rev:+;$rev}"
123 echo "$type $name $url"
126 done < feeds.conf.default
> feeds.conf.tagged
&& \
127 mv feeds.conf.tagged feeds.conf.default
129 sed -e 's!\(VERSION_NUMBER:=\$(if .*\),[^,]*)!\1,'"$version"')!g' \
130 -e 's!\(VERSION_CODE:=\$(if .*\),[^,]*)!\1,'"$revnum"')!g' \
131 -e 's!\(VERSION_REPO:=\$(if .*\),[^,]*)!\1,'"$base_url/$version"')!g' \
132 include
/version.mk
> include
/version.tagged
&& \
133 mv include
/version.tagged include
/version.mk
135 sed -e 's!http://downloads.openwrt.org/[^"]*!'"$base_url/$version"'!g' \
136 -e '/config VERSION_CODE_FILENAMES/ { :next; n; s!default y!default n!; t end; b next }; :end' \
137 package
/base-files
/image-config.
in > package
/base-files
/image-config.tagged
&& \
138 mv package
/base-files
/image-config.tagged package
/base-files
/image-config.
in
140 echo "$revnum" > version
&& git add version
141 echo "$epoch" > version.
date && git add version.
date
143 git commit
-sm "OpenWrt v$version: adjust config defaults" \
146 package
/base-files
/image-config.
in \
150 if [ -n "$gpg_keyid" -a -n "$gpg_passfile" ]; then
151 gpg_script
="$(tempfile)"
153 cat <<-EOT > "$gpg_script"
155 exec $(which gpg) --batch --passphrase-file $gpg_passfile "\$@"
158 chmod 0700 "$gpg_script"
161 git
${gpg_script:+-c "gpg.program=$gpg_script"} tag \
163 -m "OpenWrt v$version Release" \
164 ${gpg_keyid:+-s -u "$gpg_keyid"}
166 [ -n "$gpg_script" ] && rm -f "$gpg_script"
168 git revert
--no-edit HEAD
169 git commit
--amend -sm "OpenWrt v$version: revert to branch defaults"
171 git
--no-pager show
"v$version"
174 # Push the branch and tag with:
175 git push origin "${branch#refs/heads/}"
176 git push --follow-tags origin "refs/tags/v$version:refs/tags/v$version"