summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosé Romildo <malaquias@gmail.com>2022-02-21 12:10:33 -0300
committerJosé Romildo <malaquias@gmail.com>2022-02-21 13:01:49 -0300
commit005ac63a1910945086e40d197164a5aae4c38090 (patch)
tree78e00cb9bb05fcb853b300cb7e8e0604f3de87fd
parentba59355e8105035382b2f4056a97b1ffcd1bb70a (diff)
downloadnixpkgs-005ac63a1910945086e40d197164a5aae4c38090.tar
nixpkgs-005ac63a1910945086e40d197164a5aae4c38090.tar.gz
nixpkgs-005ac63a1910945086e40d197164a5aae4c38090.tar.bz2
nixpkgs-005ac63a1910945086e40d197164a5aae4c38090.tar.lz
nixpkgs-005ac63a1910945086e40d197164a5aae4c38090.tar.xz
nixpkgs-005ac63a1910945086e40d197164a5aae4c38090.tar.zst
nixpkgs-005ac63a1910945086e40d197164a5aae4c38090.zip
httpTwoLevelsUpdater: init
-rw-r--r--pkgs/common-updater/http-two-levels-updater.nix19
-rwxr-xr-xpkgs/common-updater/scripts/list-archive-two-levels-versions (renamed from pkgs/common-updater/scripts/list-archive-two-level-versions)22
-rw-r--r--pkgs/desktops/mate/default.nix5
-rw-r--r--pkgs/desktops/xfce/applications/orage/default.nix5
-rw-r--r--pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix6
-rw-r--r--pkgs/desktops/xfce/art/xfwm4-themes/default.nix6
-rw-r--r--pkgs/desktops/xfce/default.nix8
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-cpugraph-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-embed-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-eyes-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-fsguard-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-genmon-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-mailwatch-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-mpc-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-notes-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-systemload-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-timer-plugin/default.nix6
-rw-r--r--pkgs/desktops/xfce/panel-plugins/xfce4-weather-plugin/default.nix6
-rw-r--r--pkgs/top-level/all-packages.nix2
20 files changed, 59 insertions, 86 deletions
diff --git a/pkgs/common-updater/http-two-levels-updater.nix b/pkgs/common-updater/http-two-levels-updater.nix
new file mode 100644
index 00000000000..f9e1e1b7204
--- /dev/null
+++ b/pkgs/common-updater/http-two-levels-updater.nix
@@ -0,0 +1,19 @@
+{ lib
+, genericUpdater
+, common-updater-scripts
+}:
+
+{ pname
+, version
+, attrPath ? pname
+, ignoredVersions ? ""
+, rev-prefix ? ""
+, odd-unstable ? false
+, patchlevel-unstable ? false
+, url ? null
+}:
+
+genericUpdater {
+  inherit pname version attrPath ignoredVersions rev-prefix odd-unstable patchlevel-unstable;
+  versionLister = "${common-updater-scripts}/bin/list-archive-two-levels-versions ${lib.optionalString (url != null) "--url=${url}"}";
+}
diff --git a/pkgs/common-updater/scripts/list-archive-two-level-versions b/pkgs/common-updater/scripts/list-archive-two-levels-versions
index ae29d533fc3..4263a9de3ca 100755
--- a/pkgs/common-updater/scripts/list-archive-two-level-versions
+++ b/pkgs/common-updater/scripts/list-archive-two-levels-versions
@@ -2,9 +2,9 @@
 
 # lists all available versions listed for a package in a site (http)
 
-archive="$1"  # archive url
-pname="$2"  # package name
-file="$3"  # file for writing debugging information
+archive=""  # archive url
+pname=""  # package name
+file=""  # file for writing debugging information
 
 while (( $# > 0 )); do
     flag="$1"
@@ -17,7 +17,7 @@ while (( $# > 0 )); do
             pname="${flag#*=}"
             ;;
         --file=*)
-            version="${flag#*=}"
+            file="${flag#*=}"
             ;;
         *)
             echo "$0: unknown option ‘${flag}’"
@@ -26,13 +26,19 @@ while (( $# > 0 )); do
     esac
 done
 
-if [ -z "$archive" ]; then
-    echo "$scriptName: Missing archive url"
-    exit 1
+# 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 '"')"
+fi
+
+if [[ -z "$pname" ]]; then
+    pname="$UPDATE_NIX_ATTR_PATH"
 fi
 
 # print a debugging message
-if [ -n "$file" ]; then
+if [[ -n "$file" ]]; then
     echo "# Listing versions for '$pname' at $archive" >> $file
 fi
 
diff --git a/pkgs/desktops/mate/default.nix b/pkgs/desktops/mate/default.nix
index 17107ea8947..2c5b45a653e 100644
--- a/pkgs/desktops/mate/default.nix
+++ b/pkgs/desktops/mate/default.nix
@@ -7,10 +7,9 @@ let
 
     # Update script tailored to mate packages from git repository
     mateUpdateScript = { pname, version, odd-unstable ? true, url ? "https://pub.mate-desktop.org/releases" }:
-      pkgs.genericUpdater {
-        inherit pname version odd-unstable;
+      pkgs.httpTwoLevelsUpdater {
+        inherit pname version odd-unstable url;
         attrPath = "mate.${pname}";
-        versionLister = "${pkgs.common-updater-scripts}/bin/list-archive-two-level-versions --url=${url}";
       };
 
     atril = callPackage ./atril { };
diff --git a/pkgs/desktops/xfce/applications/orage/default.nix b/pkgs/desktops/xfce/applications/orage/default.nix
index 7def10fb597..4e5028a6a59 100644
--- a/pkgs/desktops/xfce/applications/orage/default.nix
+++ b/pkgs/desktops/xfce/applications/orage/default.nix
@@ -38,10 +38,9 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
+  passthru.updateScript = xfce.archiveUpdater {
+    category = "apps";
     inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister "apps" pname;
   };
 
   meta = with lib; {
diff --git a/pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix b/pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix
index 209547ea67c..8c37dde65cc 100644
--- a/pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix
+++ b/pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix
@@ -28,11 +28,7 @@ stdenv.mkDerivation rec {
 
   dontDropIconThemeCache = true;
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://www.xfce.org/";
diff --git a/pkgs/desktops/xfce/art/xfwm4-themes/default.nix b/pkgs/desktops/xfce/art/xfwm4-themes/default.nix
index 10270c7fde9..3665263ede0 100644
--- a/pkgs/desktops/xfce/art/xfwm4-themes/default.nix
+++ b/pkgs/desktops/xfce/art/xfwm4-themes/default.nix
@@ -13,11 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-MhTV8A6XA7XoyefDKH1gbe3scoXOtNXbMy6TraZv1XU=";
   };
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://www.xfce.org/";
diff --git a/pkgs/desktops/xfce/default.nix b/pkgs/desktops/xfce/default.nix
index de418dd432c..1ec4cec5b31 100644
--- a/pkgs/desktops/xfce/default.nix
+++ b/pkgs/desktops/xfce/default.nix
@@ -5,8 +5,12 @@ lib.makeScope pkgs.newScope (self: with self; {
 
   genericUpdater = pkgs.genericUpdater;
 
-  archiveLister = category: name:
-    "${pkgs.common-updater-scripts}/bin/list-archive-two-level-versions --url=https://archive.xfce.org/src/${category}/${name}";
+  archiveUpdater = { category, pname, version }:
+    pkgs.httpTwoLevelsUpdater {
+      inherit pname version;
+      attrPath = "xfce.${pname}";
+      url = "https://archive.xfce.org/src/${category}/${pname}";
+    };
 
   mkXfceDerivation = callPackage ./mkXfceDerivation.nix { };
 
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-cpugraph-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-cpugraph-plugin/default.nix
index 68e44437629..33bdb052b6a 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-cpugraph-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-cpugraph-plugin/default.nix
@@ -45,11 +45,7 @@ in stdenv.mkDerivation rec {
     hicolor-icon-theme
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-cpugraph-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-embed-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-embed-plugin/default.nix
index c79e30a6580..cc4ce861e72 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-embed-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-embed-plugin/default.nix
@@ -33,11 +33,7 @@ in stdenv.mkDerivation rec {
     gtk2
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib;{
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-embed-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-eyes-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-eyes-plugin/default.nix
index 17fa349a1d9..08434ad2522 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-eyes-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-eyes-plugin/default.nix
@@ -35,11 +35,7 @@ in stdenv.mkDerivation rec {
     gtk3
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-eyes-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-fsguard-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-fsguard-plugin/default.nix
index 1ba214611a6..81498aea96f 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-fsguard-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-fsguard-plugin/default.nix
@@ -35,11 +35,7 @@ in stdenv.mkDerivation rec {
     gtk3
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-fsguard-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-genmon-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-genmon-plugin/default.nix
index 1f7225fe958..1b794ff2b83 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-genmon-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-genmon-plugin/default.nix
@@ -33,11 +33,7 @@ in stdenv.mkDerivation rec {
     gtk3
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-genmon-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-mailwatch-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-mailwatch-plugin/default.nix
index 2e6d0e297bb..fdd3af5fe40 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-mailwatch-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-mailwatch-plugin/default.nix
@@ -27,11 +27,7 @@ stdenv.mkDerivation rec {
     libgcrypt
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-mailwatch-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-mpc-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-mpc-plugin/default.nix
index da2c4298ec4..56647586934 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-mpc-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-mpc-plugin/default.nix
@@ -27,11 +27,7 @@ stdenv.mkDerivation rec {
     exo
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-mpc-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-notes-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-notes-plugin/default.nix
index 124bbfe8a63..6cb2fcc66c0 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-notes-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-notes-plugin/default.nix
@@ -31,11 +31,7 @@ in stdenv.mkDerivation rec {
     xfconf
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-notes-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin/default.nix
index 8edface25a8..22b4d8c4f40 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin/default.nix
@@ -38,11 +38,7 @@ stdenv.mkDerivation rec {
     "--with-pathnetcat=${netcat-gnu}/bin/netcat"
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-sensors-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-systemload-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-systemload-plugin/default.nix
index ccdc051982f..d264181bd48 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-systemload-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-systemload-plugin/default.nix
@@ -31,11 +31,7 @@ in stdenv.mkDerivation rec {
     xfconf
   ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-systemload-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-timer-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-timer-plugin/default.nix
index ad4add40c5b..c3cb16dfa83 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-timer-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-timer-plugin/default.nix
@@ -28,11 +28,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-timer-plugin";
diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-weather-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-weather-plugin/default.nix
index f6a9bef823f..5ceda9cb8bd 100644
--- a/pkgs/desktops/xfce/panel-plugins/xfce4-weather-plugin/default.nix
+++ b/pkgs/desktops/xfce/panel-plugins/xfce4-weather-plugin/default.nix
@@ -31,11 +31,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  passthru.updateScript = xfce.genericUpdater {
-    inherit pname version;
-    attrPath = "xfce.${pname}";
-    versionLister = xfce.archiveLister category pname;
-  };
+  passthru.updateScript = xfce.archiveUpdater { inherit category pname version; };
 
   meta = with lib; {
     homepage = "https://docs.xfce.org/panel-plugins/xfce4-weather-plugin";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index cf0796ffe21..6726ff8e004 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -109,6 +109,8 @@ with pkgs;
 
   gitUpdater = callPackage ../common-updater/git-updater.nix { };
 
+  httpTwoLevelsUpdater = callPackage ../common-updater/http-two-levels-updater.nix { };
+
   unstableGitUpdater = callPackage ../common-updater/unstable-updater.nix { };
 
   nix-update-script = callPackage ../common-updater/nix-update.nix { };