sh: add script to build the gitTable
This commit is contained in:
parent
600e1b9987
commit
2aa099f0e2
@ -34,5 +34,6 @@ in
|
|||||||
chmod +x $out/bin/garlic
|
chmod +x $out/bin/garlic
|
||||||
mkdir -p $out/share/man/man1
|
mkdir -p $out/share/man/man1
|
||||||
cp garlic.1 $out/share/man/man1
|
cp garlic.1 $out/share/man/man1
|
||||||
|
cp garlic-git-table $out/bin
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
25
garlic/sh/garlic-git-table
Executable file
25
garlic/sh/garlic-git-table
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
progname="$(basename $0)"
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
cat >&2 <<EOF
|
||||||
|
Usage: $progname <git repo URL>
|
||||||
|
|
||||||
|
Finds all garlic/* branches and their current commit of the given
|
||||||
|
repository and builds the gitTable to be used in nix derivations.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
garlic-git-table ssh://git@bscpm03.bsc.es/garlic/apps/heat.git
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 'gitTable = {'
|
||||||
|
echo " # Auto-generated with $progname on $(date --rfc-3339=date)"
|
||||||
|
git ls-remote $1 'garlic/*' |\
|
||||||
|
sed 's@refs/heads/@@' |\
|
||||||
|
awk '{printf "\"%s\" = \"%s\";\n", $2, $1}' |\
|
||||||
|
column -t -o ' ' |\
|
||||||
|
sed 's/^/ /'
|
||||||
|
echo '};'
|
Loading…
Reference in New Issue
Block a user