blob: 703e71438a71e9de0ff305059a9241060546673f (
plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/usr/bin/env bash
# lists all available tags from a git repository
pname="" # package name
attr_path="" # package attribute path
url="" # git repository url
file="" # file for writing debugging information
while (( $# > 0 )); do
flag="$1"
shift 1
case "$flag" in
--pname=*)
pname="${flag#*=}"
;;
--attr-path=*)
attr_path="${flag#*=}"
;;
--url=*)
url="${flag#*=}"
;;
--file=*)
file="${flag#*=}"
;;
*)
echo "$0: unknown option ‘${flag}’"
exit 1
;;
esac
done
if [[ -z "$pname" ]]; then
pname="$UPDATE_NIX_PNAME"
fi
if [[ -z "$attr_path" ]]; then
attr_path="$UPDATE_NIX_ATTR_PATH"
fi
# By default we set url to src.url or src.meta.homepage
if [[ -z "$url" ]]; then
url="$(nix-instantiate $systemArg --eval -E \
"with import ./. {}; $attr_path.src.meta.homepage or $attr_path.src.url" \
| tr -d '"')"
fi
# print a debugging message
if [[ -n "$file" ]]; then
echo "# Listing tags for '$pname' at $url" >> $file
fi
# list all tags from the remote repository
tags=$(git ls-remote --tags --refs "$url")
# keep only the version part of the tag
tags=$(echo "$tags" | cut --delimiter=/ --field=3)
echo "$tags"
|