3 git_author
="Release System"
4 git_email
="lede-dev@lists.infradead.org"
6 base_url
="http://downloads.lede-project.org/releases"
8 [ -f "./feeds.conf.default" ] ||
{
9 echo "Please execute as ./${0##*/}" >&2
16 echo "Usage: $0 [-i] [-a <Git author>] [-e <Git email>] \\"
17 echo " [-k <GPG key id>] [-p <GPG passphrase file>] \\"
18 echo " [-u <Download base url>] -v <version>"
21 echo "Exit successfully if tag already exists"
23 echo "-a Git author [$git_author]"
24 echo "Override the author name used for automated Git commits"
26 echo "-e Git email [$git_email]"
27 echo "Override the email used for automated Git commits"
29 echo "-k GPG key id [none]"
30 echo "Enable GPG signing of tags with given GPG key id"
32 echo "-p GPG passphrase file [none]"
33 echo "Use the passphrase stored in the given file for signing"
35 echo "-u Download base url [$base_url]"
36 echo "Use the given URL as base for download repositories"
42 while getopts "a:e:ik:p:u:v:" opt
; do
44 a
) git_author
="$OPTARG" ;;
45 e
) git_email
="$OPTARG" ;;
46 i
) ignore_existing
=1 ;;
47 k
) gpg_keyid
="${OPTARG#0x}" ;;
48 p
) gpg_passfile
="${OPTARG}" ;;
49 u
) base_url
="${OPTARG%/}" ;;
54 basever
="$(echo "$version" | cut -d. -f1-2)"
57 echo "Unexpected version format: $OPTARG" >&2
63 echo "Unexpected option: -$OPTARG" >&2
67 echo "Missing argument for option: -$OPTARG" >&2
73 [ -n "$version" ] || usage
75 if git rev-parse
"v${version}^{tag}" >/dev
/null
2>/dev
/null
; then
76 if [ -z "$ignore_existing" ]; then
77 echo "Tag v${version} already exists!" >&2
84 revnum
="$(./scripts/getver.sh)"
85 githash
="$(git log --format=%h -1)"
87 prev_branch
="$(git symbolic-ref -q HEAD)"
89 case "$prev_branch" in
92 echo "Expecting current branch name to end in \"-$basever\"," \
93 "but it is \"${prev_branch#refs/heads/}\" - aborting."
99 export GIT_AUTHOR_NAME
="$git_author"
100 export GIT_AUTHOR_EMAIL
="$git_email"
101 export GIT_COMMITTER_NAME
="$git_author"
102 export GIT_COMMITTER_EMAIL
="$git_email"
104 git checkout
-b "release-$version"
106 while read type name url
; do
110 *^
*) sha1
="${url##*^}" ;;
111 *\
;*) sha1
="$(git ls-remote "${url%;*}" "${url##*;}")" ;;
112 *) sha1
="$(git ls-remote "$url" "master
")" ;;
114 echo "$type $name ${url%[;^]*}${sha1:+^${sha1:0:40}}"
118 *\
;*) rev="${url##*;}" ;;
119 *) rev="$(svn log -l 1 "$url" | sed -ne '2s/ .*$//p')" ;;
121 echo "$type $name ${url%;*}${rev:+;$rev}"
124 echo "$type $name $url"
127 done < feeds.conf.default
> feeds.conf.tagged
&& \
128 mv feeds.conf.tagged feeds.conf.default
130 sed -e 's!\(VERSION_NUMBER:=\$(if .*\),[^,]*)!\1,'"$version"')!g' \
131 -e 's!\(VERSION_CODE:=\$(if .*\),[^,]*)!\1,'"$revnum-$githash"')!g' \
132 -e 's!\(VERSION_REPO:=\$(if .*\),[^,]*)!\1,'"$base_url/$version"')!g' \
133 include
/version.mk
> include
/version.tagged
&& \
134 mv include
/version.tagged include
/version.mk
136 sed -e 's!http://downloads.lede-project.org/[^"]*!'"$base_url/$version"'!g' \
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 git commit
-sm "LEDE v$version: adjust config defaults" \
143 package
/base-files
/image-config.
in
146 if [ -n "$gpg_keyid" -a -n "$gpg_passfile" ]; then
147 gpg_script
="$(tempfile)"
149 cat <<-EOT > "$gpg_script"
151 exec $(which gpg) --batch --passphrase-file $gpg_passfile "\$@"
154 chmod 0700 "$gpg_script"
157 git
${gpg_script:+-c "gpg.program=$gpg_script"} tag \
159 -m "LEDE v$version Release" \
160 ${gpg_keyid:+-s -u "$gpg_keyid"}
162 [ -n "$gpg_script" ] && rm -f "$gpg_script"
164 git checkout
"${prev_branch#refs/heads/}"
165 git branch
-D "release-$version"
167 git
--no-pager show
"v$version"
168 git push
--follow-tags origin
"refs/tags/v$version:refs/tags/v$version"