3 git_author
="Release System"
4 git_email
="lede-dev@lists.infradead.org"
6 base_url
="https://downloads.openwrt.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 " [-u <Download base url>] [-n <codename>] -v <version>"
20 echo "Exit successfully if branch already exists"
22 echo "-a Git author [$git_author]"
23 echo "Override the author name used for automated Git commits"
25 echo "-e Git email [$git_email]"
26 echo "Override the email used for automated Git commits"
28 echo "-u Download base url [$base_url]"
29 echo "Use the given URL as base for download repositories"
35 while getopts "a:e:iu:n:v:" opt
; do
37 a
) git_author
="$OPTARG" ;;
38 e
) git_email
="$OPTARG" ;;
39 i
) ignore_existing
=1 ;;
40 u
) base_url
="${OPTARG%/}" ;;
41 n
) codename
="$OPTARG" ;;
45 version
="$(echo "$OPTARG" | cut -d. -f1-2)"
48 echo "Unexpected version format: $OPTARG" >&2
54 echo "Unexpected option: -$OPTARG" >&2
58 echo "Missing argument for option: -$OPTARG" >&2
64 [ -n "$version" ] || usage
66 revnum
="$(./scripts/getver.sh)"
67 githash
="$(git log --format=%h -1)"
69 prev_branch
="$(git symbolic-ref -q HEAD)"
71 if [ "$prev_branch" != "refs/heads/master" ]; then
72 echo "Expecting current branch name to be \"master\"," \
73 "but it is \"${prev_branch#refs/heads/}\" - aborting."
78 distname
="$(sed -ne '/config VERSION_DIST/ { :next; n; s/^[[:space:]]*default "\
(.
*\
)"/\1/p; T next }' \
79 package/base-files/image-config.in)"
81 distname
="${distname:-OpenWrt}"
82 distname_lc
="$(echo "$distname" | tr 'A-Z' 'a-z')"
84 if git rev-parse
"${distname_lc}-${version}^{tree}" >/dev
/null
2>/dev
/null
; then
85 if [ -z "$ignore_existing" ]; then
86 echo "Branch ${distname_lc}-${version} already exists!" >&2
93 if grep -sq 'RELEASE:=' include
/version.mk
&& [ -z "$codename" ]; then
94 echo "A codename is required for this ${distname} version!" >&2
98 export GIT_AUTHOR_NAME
="$git_author"
99 export GIT_AUTHOR_EMAIL
="$git_email"
100 export GIT_COMMITTER_NAME
="$git_author"
101 export GIT_COMMITTER_EMAIL
="$git_email"
103 git checkout
-b "${distname_lc}-$version"
105 while read type name url
; do
112 ref
="$(git ls-remote "$url" "${distname_lc}-$version")"
114 if [ -z "$ref" ]; then
115 echo "WARNING: Feed \"$name\" provides no" \
116 "\"${distname_lc}-$version\" branch - using master!" >&2
118 url
="$url;${distname_lc}-$version"
122 echo "$type $name $url"
125 echo "$type $name $url"
128 done < feeds.conf.default
> feeds.conf.branch
&& \
129 mv feeds.conf.branch feeds.conf.default
131 sed -e 's!^RELEASE:=.*!RELEASE:='"$codename"'!g' \
132 -e 's!\(VERSION_NUMBER:=\$(if .*\),[^,]*)!\1,'"$version-SNAPSHOT"')!g' \
133 -e 's!\(VERSION_REPO:=\$(if .*\),[^,]*)!\1,'"$base_url/$version-SNAPSHOT"')!g' \
134 include
/version.mk
> include
/version.branch
&& \
135 mv include
/version.branch include
/version.mk
137 sed -e 's!\(http\|https\)://downloads.\(openwrt\|lede-project\).org/[^"]*!'"$base_url/$version-SNAPSHOT"'!g' \
138 package
/base-files
/image-config.
in > package
/base-files
/image-config.branch
&& \
139 mv package
/base-files
/image-config.branch package
/base-files
/image-config.
in
141 git commit
-sm "${distname:-OpenWrt} v$version: set branch defaults" \
144 package
/base-files
/image-config.
in
146 git
--no-pager log
-p -1
147 git checkout
"${prev_branch#refs/heads/}"
150 # Push the branch with:
151 git push origin "refs/heads/${distname_lc}-$version:refs/heads/${distname_lc}-$version"