summaryrefslogtreecommitdiffstats
path: root/pkgs/common-updater/scripts
diff options
context:
space:
mode:
authorJosé Romildo Malaquias <malaquias@gmail.com>2022-09-30 09:19:21 -0300
committerGitHub <noreply@github.com>2022-09-30 09:19:21 -0300
commite78c23cf5b4e3b5534b480ff1d6a534620d6e395 (patch)
tree1172549cbf3dc68c419f2d8dedad6ce078094f14 /pkgs/common-updater/scripts
parentfee5e0d5ef59e801f2441374ab5ea4d1cfc0c005 (diff)
parent3a36ccc07549f55bec1f679a4e3b98235005e456 (diff)
Merge pull request #193248 from romildo/upd.generic-updater
generic-updater: more flexible with name, pname, version and attr path, and cleanups
Diffstat (limited to 'pkgs/common-updater/scripts')
-rwxr-xr-xpkgs/common-updater/scripts/list-archive-two-levels-versions38
-rwxr-xr-xpkgs/common-updater/scripts/list-git-tags28
2 files changed, 40 insertions, 26 deletions
diff --git a/pkgs/common-updater/scripts/list-archive-two-levels-versions b/pkgs/common-updater/scripts/list-archive-two-levels-versions
index 4263a9de3ca3..11db08ad07b8 100755
--- a/pkgs/common-updater/scripts/list-archive-two-levels-versions
+++ b/pkgs/common-updater/scripts/list-archive-two-levels-versions
@@ -2,20 +2,24 @@
# lists all available versions listed for a package in a site (http)
-archive="" # archive url
pname="" # package name
+attr_path="" # package attribute path
+url="" # directory list url
file="" # file for writing debugging information
while (( $# > 0 )); do
flag="$1"
shift 1
case "$flag" in
- --url=*)
- archive="${flag#*=}"
- ;;
--pname=*)
pname="${flag#*=}"
;;
+ --attr-path=*)
+ attr_path="${flag#*=}"
+ ;;
+ --url=*)
+ url="${flag#*=}"
+ ;;
--file=*)
file="${flag#*=}"
;;
@@ -26,29 +30,33 @@ while (( $# > 0 )); do
esac
done
-# by default set url to the base dir of the first url in src.urls
-if [[ -z "$archive" ]]; then
- archive="$(nix-instantiate $systemArg --eval -E \
- "with import ./. {}; dirOf (dirOf (lib.head $UPDATE_NIX_ATTR_PATH.src.urls))" \
- | tr -d '"')"
+if [[ -z "$pname" ]]; then
+ pname="$UPDATE_NIX_NAME"
fi
-if [[ -z "$pname" ]]; then
- pname="$UPDATE_NIX_ATTR_PATH"
+if [[ -z "$attr_path" ]]; then
+ attr_path="$UPDATE_NIX_ATTR_PATH"
+fi
+
+# by default set url to the base dir of the first url in src.urls
+if [[ -z "$url" ]]; then
+ url="$(nix-instantiate $systemArg --eval -E \
+ "with import ./. {}; dirOf (dirOf (lib.head $attr_path.src.urls))" \
+ | tr -d '"')"
fi
# print a debugging message
if [[ -n "$file" ]]; then
- echo "# Listing versions for '$pname' at $archive" >> $file
+ echo "# Listing versions for '$pname' at $url" >> $file
fi
-# list all major-minor versions from archive
-tags1=$(curl -sS "$archive/")
+# list all major-minor versions from url
+tags1=$(curl -sS "$url/")
tags1=$(echo "$tags1" | sed -rne 's,^<a href="([0-9]+\.[0-9]+)/">.*,\1,p')
# print available versions
for tag in $tags1; do
- tags2=$(curl -sS "$archive/$tag/")
+ tags2=$(curl -sS "$url/$tag/")
tags2=$(echo "$tags2" | sed -rne "s,^<a href=\"$pname-([0-9.]+)\\.[^0-9].*\">.*,\\1,p")
echo "$tags2"
done
diff --git a/pkgs/common-updater/scripts/list-git-tags b/pkgs/common-updater/scripts/list-git-tags
index 86b4949f055d..186dfd5ea6d4 100755
--- a/pkgs/common-updater/scripts/list-git-tags
+++ b/pkgs/common-updater/scripts/list-git-tags
@@ -2,22 +2,24 @@
# lists all available tags from a git repository
-echo "# pname=$UPDATE_NIX_ATTR_PATH" > /tmp/test.txt
-
+pname="" # package name
+attr_path="" # package attribute path
url="" # git repository url
-pname="" # package name
file="" # file for writing debugging information
while (( $# > 0 )); do
flag="$1"
shift 1
case "$flag" in
- --url=*)
- url="${flag#*=}"
- ;;
--pname=*)
pname="${flag#*=}"
;;
+ --attr-path=*)
+ attr_path="${flag#*=}"
+ ;;
+ --url=*)
+ url="${flag#*=}"
+ ;;
--file=*)
file="${flag#*=}"
;;
@@ -28,17 +30,21 @@ while (( $# > 0 )); do
esac
done
+if [[ -z "$pname" ]]; then
+ pname="$UPDATE_NIX_NAME"
+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 ./. {}; $UPDATE_NIX_ATTR_PATH.src.meta.homepage or $UPDATE_NIX_ATTR_PATH.src.url" \
+ "with import ./. {}; $attr_path.src.meta.homepage or $attr_path.src.url" \
| tr -d '"')"
fi
-if [[ -z "$pname" ]]; then
- pname="$UPDATE_NIX_ATTR_PATH"
-fi
-
# print a debugging message
if [[ -n "$file" ]]; then
echo "# Listing tags for '$pname' at $url" >> $file