-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathayer-release
executable file
·42 lines (30 loc) · 1.14 KB
/
ayer-release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# arguments: version_name
source /usr/lib/ayer/functions.sh || exit 1
ayer_init
function create_and_publish_tag() {
local project_name="$1"
cd "${git_dir}/${project_name}.git"
git tag --force "$version_name" "origin/$trunk_name"
git push origin "+$version_name"
}
version_name="${1%_trunk}"
[ -n "$version_name" ] || die "usage: $(basename $0) version_name"
trunk_name="${version_name}_trunk"
# TODO: check trunk_name for validity
# TODO: manipulate version tree data
build_commit="origin/$trunk_name"
target_path="$version_name"
previous_ref=""
build_release="$trunk_name"
repodata_dir=$YUM_REPO_DIR/$target_path/$build_os/repodata
[ ! -d "$repodata_dir" ] || die "error: looks like $version_name is released: directory \`$repodata_dir' already exists"
ayer-build-function "$build_commit" "$previous_ref" "$target_path" "$build_release"
create_and_publish_tag ${BASE_PROJECT}
cd "$git_dir/${BASE_PROJECT}.git"
git ls-tree -r "origin/$trunk_name" | while read mode type hash path; do
if [ "$mode" == 160000 ]; then
create_and_publish_tag "$(basename "$path")"
fi
done
replace_repos "$YUM_REPO_DIR/$target_path"