about summary refs log tree commit diff
path: root/nixpkgs/pkgs/common-updater/scripts
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-04-27 21:04:56 +0000
committerAlyssa Ross <hi@alyssa.is>2020-04-27 21:04:56 +0000
commita4e6c7d26af697f4346cacb7ab18dcd7fcfc056e (patch)
tree47950e79183035018882419c4eff5047d1537b99 /nixpkgs/pkgs/common-updater/scripts
parent5b00523fb58512232b819a301c4309f579c7f09c (diff)
parent22a3bf9fb9edad917fb6cd1066d58b5e426ee975 (diff)
downloadnixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.gz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.bz2
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.lz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.xz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.zst
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.zip
Merge commit '22a3bf9fb9edad917fb6cd1066d58b5e426ee975'
Diffstat (limited to 'nixpkgs/pkgs/common-updater/scripts')
-rwxr-xr-xnixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions35
-rwxr-xr-xnixpkgs/pkgs/common-updater/scripts/list-git-tags32
2 files changed, 67 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions b/nixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions
new file mode 100755
index 000000000000..e46652820ad2
--- /dev/null
+++ b/nixpkgs/pkgs/common-updater/scripts/list-archive-two-level-versions
@@ -0,0 +1,35 @@
+#! /bin/sh
+
+# lists all available versions listed for a package in a site (http)
+
+scriptName=list-archive-two-level-versions # do not use the .wrapped name
+
+usage() {
+    echo "Usage: $scriptName <archive url> [<package name> [<debug file path>]]"
+}
+
+archive="$1"  # archive url
+pname="$2"  # package name
+file="$3"  # file for writing debugging information
+
+if [ -z "$archive" ]; then
+    echo "$scriptName: Missing archive url"
+    usage
+    exit 1
+fi
+
+# print a debugging message
+if [ -n "$file" ]; then
+    echo "# Listing versions for $pname at $archive" >> $file
+fi
+
+# list all major-minor versions from archive
+tags1=$(curl -sS "$archive/")
+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=$(echo "$tags2" | sed -rne "s,^<a href=\"$pname-([0-9.]+)\\.[^0-9].*\">.*,\\1,p")
+    echo "$tags2"
+done
diff --git a/nixpkgs/pkgs/common-updater/scripts/list-git-tags b/nixpkgs/pkgs/common-updater/scripts/list-git-tags
new file mode 100755
index 000000000000..ff09671c7cb0
--- /dev/null
+++ b/nixpkgs/pkgs/common-updater/scripts/list-git-tags
@@ -0,0 +1,32 @@
+#! /bin/sh -x
+
+# lists all available tags from a git repository
+
+scriptName=list-git-tags # do not use the .wrapped name
+
+usage() {
+    echo "Usage: $scriptName <repository url> [<package name> [<debug file path>]]"
+}
+
+repo="$1" # git repository url
+pname="$2" # package name
+file="$3" # file for writing debugging information
+
+if [ -z "$repo" ]; then
+    echo "$scriptName: Missing git repository url"
+    usage
+    exit 1
+fi
+
+# print a debugging message
+if [ -n "$file" ]; then
+    echo "# Listing tags for $pname at $repo" >> $file
+fi
+
+# list all tags from the remote repository
+tags=$(git ls-remote --tags --refs "$repo")
+
+# keep only the version part of the tag
+tags=$(echo "$tags" | cut --delimiter=/ --field=3)
+
+echo "$tags"