From ba59355e8105035382b2f4056a97b1ffcd1bb70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Romildo?= Date: Sun, 20 Feb 2022 22:11:49 -0300 Subject: [PATCH 1/2] gitUpdater: init - Add the 'gitUpdater' helper function to update git based packages, using the 'genericUpdater' function. - Rework argument passing to the `list-git-tags' and 'list-archive-two-level-versions' scripts. - Replace 'genericUpdater' plus 'list-git-tags' by 'gitUpdater' --- pkgs/applications/audio/r128gain/default.nix | 10 +--- .../nbxplorer/util/update-common.sh | 2 +- .../networking/shellhub-agent/default.nix | 6 +-- .../version-management/git-review/default.nix | 8 +-- pkgs/applications/video/epgstation/update.nix | 2 +- pkgs/applications/video/mirakurun/update.nix | 2 +- pkgs/applications/video/shotcut/default.nix | 6 +-- pkgs/common-updater/generic-updater.nix | 2 +- pkgs/common-updater/git-updater.nix | 17 +++++++ .../scripts/list-archive-two-level-versions | 29 ++++++++--- pkgs/common-updater/scripts/list-git-tags | 49 +++++++++++++------ pkgs/data/fonts/iosevka/update-default.sh | 2 +- pkgs/data/themes/marwaita/default.nix | 3 ++ pkgs/desktops/lxqt/default.nix | 3 +- pkgs/desktops/mate/default.nix | 2 +- pkgs/desktops/mate/mate-tweak/default.nix | 6 +-- .../xfce/applications/orage/default.nix | 2 +- .../xfce/art/xfce4-icon-theme/default.nix | 2 +- .../xfce/art/xfwm4-themes/default.nix | 2 +- pkgs/desktops/xfce/default.nix | 7 +-- pkgs/desktops/xfce/mkXfceDerivation.nix | 5 +- .../xfce4-cpugraph-plugin/default.nix | 2 +- .../xfce4-embed-plugin/default.nix | 2 +- .../xfce4-eyes-plugin/default.nix | 2 +- .../xfce4-fsguard-plugin/default.nix | 2 +- .../xfce4-genmon-plugin/default.nix | 2 +- .../xfce4-mailwatch-plugin/default.nix | 2 +- .../xfce4-mpc-plugin/default.nix | 2 +- .../xfce4-namebar-plugin/default.nix | 7 +-- .../xfce4-notes-plugin/default.nix | 2 +- .../xfce4-sensors-plugin/default.nix | 2 +- .../xfce4-systemload-plugin/default.nix | 2 +- .../xfce4-timer-plugin/default.nix | 2 +- .../xfce4-weather-plugin/default.nix | 2 +- .../xfce4-windowck-plugin/default.nix | 5 +- .../xfce/thunar-plugins/dropbox/default.nix | 4 +- .../beam-modules/elvis-erlang/default.nix | 2 +- .../beam-modules/erlang-ls/default.nix | 2 +- .../interpreters/erlang/generic-builder.nix | 2 +- .../libraries/gsettings-qt/default.nix | 5 +- .../development/libraries/libyang/default.nix | 6 +-- pkgs/development/libraries/mlt/default.nix | 5 +- pkgs/development/libraries/mlt/qt-5.nix | 6 +-- .../tools/build-managers/rebar3/default.nix | 2 +- pkgs/tools/backup/stenc/default.nix | 8 +-- pkgs/top-level/all-packages.nix | 2 + 46 files changed, 136 insertions(+), 111 deletions(-) create mode 100644 pkgs/common-updater/git-updater.nix diff --git a/pkgs/applications/audio/r128gain/default.nix b/pkgs/applications/audio/r128gain/default.nix index 96053d08d00f..af22a9dce67c 100644 --- a/pkgs/applications/audio/r128gain/default.nix +++ b/pkgs/applications/audio/r128gain/default.nix @@ -1,8 +1,7 @@ { lib , fetchFromGitHub -, genericUpdater +, gitUpdater , substituteAll -, common-updater-scripts , ffmpeg , python3Packages , sox @@ -33,12 +32,7 @@ python3Packages.buildPythonApplication rec { # sandbox to be disabled. doCheck = false; - passthru = { - updateScript = genericUpdater { - inherit pname version; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; - }; - }; + passthru.updateScript = gitUpdater { inherit pname version; }; meta = with lib; { description = "Fast audio loudness scanner & tagger (ReplayGain v2 / R128)"; diff --git a/pkgs/applications/blockchains/nbxplorer/util/update-common.sh b/pkgs/applications/blockchains/nbxplorer/util/update-common.sh index 8899bdd181de..1ca9ef3444b5 100755 --- a/pkgs/applications/blockchains/nbxplorer/util/update-common.sh +++ b/pkgs/applications/blockchains/nbxplorer/util/update-common.sh @@ -26,7 +26,7 @@ getRepo() { } getLatestVersionTag() { - "$nixpkgs"/pkgs/common-updater/scripts/list-git-tags https://github.com/$(getRepo) 2>/dev/null \ + "$nixpkgs"/pkgs/common-updater/scripts/list-git-tags --url=https://github.com/$(getRepo) 2>/dev/null \ | sort -V | tail -1 | sed 's|^v||' } diff --git a/pkgs/applications/networking/shellhub-agent/default.nix b/pkgs/applications/networking/shellhub-agent/default.nix index 0b95023ad59d..d698601cb190 100644 --- a/pkgs/applications/networking/shellhub-agent/default.nix +++ b/pkgs/applications/networking/shellhub-agent/default.nix @@ -1,8 +1,7 @@ { lib , buildGoModule , fetchFromGitHub -, genericUpdater -, common-updater-scripts +, gitUpdater , makeWrapper , openssh }: @@ -25,9 +24,8 @@ buildGoModule rec { ldflags = [ "-s" "-w" "-X main.AgentVersion=v${version}" ]; passthru = { - updateScript = genericUpdater { + updateScript = gitUpdater { inherit pname version; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; rev-prefix = "v"; ignoredVersions = ".(rc|beta).*"; }; diff --git a/pkgs/applications/version-management/git-review/default.nix b/pkgs/applications/version-management/git-review/default.nix index 40061baca53e..98c9c5312e61 100644 --- a/pkgs/applications/version-management/git-review/default.nix +++ b/pkgs/applications/version-management/git-review/default.nix @@ -4,8 +4,7 @@ , pbr , requests , setuptools -, genericUpdater -, common-updater-scripts +, gitUpdater }: buildPythonApplication rec { @@ -42,10 +41,7 @@ buildPythonApplication rec { pythonImportsCheck = [ "git_review" ]; - passthru.updateScript = genericUpdater { - inherit pname version; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; - }; + passthru.updateScript = gitUpdater { inherit pname version; }; meta = with lib; { description = "Tool to submit code to Gerrit"; diff --git a/pkgs/applications/video/epgstation/update.nix b/pkgs/applications/video/epgstation/update.nix index 9faa83c64f9e..5c2fbe66f04e 100644 --- a/pkgs/applications/video/epgstation/update.nix +++ b/pkgs/applications/video/epgstation/update.nix @@ -13,7 +13,7 @@ let inherit pname version; attrPath = lib.toLower pname; rev-prefix = "v"; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${homepage}"; + versionLister = "${common-updater-scripts}/bin/list-git-tags --url=${homepage}"; }; updateScript = builtins.elemAt updater 0; updateArgs = map (lib.escapeShellArg) (builtins.tail updater); diff --git a/pkgs/applications/video/mirakurun/update.nix b/pkgs/applications/video/mirakurun/update.nix index ccea2279783b..18a4d0ab2562 100644 --- a/pkgs/applications/video/mirakurun/update.nix +++ b/pkgs/applications/video/mirakurun/update.nix @@ -17,7 +17,7 @@ let # exclude prerelease versions versionLister = writers.writeBash "list-mirakurun-versions" '' - ${common-updater-scripts}/bin/list-git-tags ${homepage} \ + ${common-updater-scripts}/bin/list-git-tags --url=${homepage} \ | grep '^[0-9]\+\.[0-9]\+\.[0-9]\+$' ''; }; diff --git a/pkgs/applications/video/shotcut/default.nix b/pkgs/applications/video/shotcut/default.nix index 3b6116d5a068..e996ae92d216 100644 --- a/pkgs/applications/video/shotcut/default.nix +++ b/pkgs/applications/video/shotcut/default.nix @@ -17,8 +17,7 @@ , qtgraphicaleffects , qmake , qttools -, genericUpdater -, common-updater-scripts +, gitUpdater }: assert lib.versionAtLeast mlt.version "6.24.0"; @@ -76,9 +75,8 @@ mkDerivation rec { cp -r src/qml $out/share/shotcut/ ''; - passthru.updateScript = genericUpdater { + passthru.updateScript = gitUpdater { inherit pname version; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; rev-prefix = "v"; }; diff --git a/pkgs/common-updater/generic-updater.nix b/pkgs/common-updater/generic-updater.nix index 8483f9bbd1de..df47df14b85b 100644 --- a/pkgs/common-updater/generic-updater.nix +++ b/pkgs/common-updater/generic-updater.nix @@ -55,7 +55,7 @@ let return 1 } - tags=$($version_lister $pname ${fileForGitCommands}) || exit 1 + tags=$($version_lister --pname=${pname} --file="${fileForGitCommands}") || exit 1 # print available tags for tag in $tags; do diff --git a/pkgs/common-updater/git-updater.nix b/pkgs/common-updater/git-updater.nix new file mode 100644 index 000000000000..304bad9af60c --- /dev/null +++ b/pkgs/common-updater/git-updater.nix @@ -0,0 +1,17 @@ +{ genericUpdater +, common-updater-scripts +}: + +{ pname +, version +, attrPath ? pname +, ignoredVersions ? "" +, rev-prefix ? "" +, odd-unstable ? false +, patchlevel-unstable ? false +}: + +genericUpdater { + inherit pname version attrPath ignoredVersions rev-prefix odd-unstable patchlevel-unstable; + versionLister = "${common-updater-scripts}/bin/list-git-tags"; +} diff --git a/pkgs/common-updater/scripts/list-archive-two-level-versions b/pkgs/common-updater/scripts/list-archive-two-level-versions index 36a051e97c91..ae29d533fc3b 100755 --- a/pkgs/common-updater/scripts/list-archive-two-level-versions +++ b/pkgs/common-updater/scripts/list-archive-two-level-versions @@ -2,25 +2,38 @@ # 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="$1" # archive url pname="$2" # package name file="$3" # file for writing debugging information +while (( $# > 0 )); do + flag="$1" + shift 1 + case "$flag" in + --url=*) + archive="${flag#*=}" + ;; + --pname=*) + pname="${flag#*=}" + ;; + --file=*) + version="${flag#*=}" + ;; + *) + echo "$0: unknown option ‘${flag}’" + exit 1 + ;; + esac +done + 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 + echo "# Listing versions for '$pname' at $archive" >> $file fi # list all major-minor versions from archive diff --git a/pkgs/common-updater/scripts/list-git-tags b/pkgs/common-updater/scripts/list-git-tags index d137552cdd66..176e647eb2ea 100755 --- a/pkgs/common-updater/scripts/list-git-tags +++ b/pkgs/common-updater/scripts/list-git-tags @@ -2,29 +2,50 @@ # lists all available tags from a git repository -scriptName=list-git-tags # do not use the .wrapped name +echo "# pname=$UPDATE_NIX_ATTR_PATH" > /tmp/test.txt -usage() { - echo "Usage: $scriptName [ []]" -} +url="" # git repository url +pname="" # package name +file="" # file for writing debugging information -repo="$1" # git repository url -pname="$2" # package name -file="$3" # file for writing debugging information +while (( $# > 0 )); do + flag="$1" + shift 1 + case "$flag" in + --url=*) + url="${flag#*=}" + ;; + --pname=*) + pname="${flag#*=}" + ;; + --file=*) + file="${flag#*=}" + ;; + *) + echo "$0: unknown option ‘${flag}’" + exit 1 + ;; + esac +done -if [ -z "$repo" ]; then - echo "$scriptName: Missing git repository url" - usage - exit 1 +# 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.url or $UPDATE_NIX_ATTR_PATH.src.meta.homepage" \ + | 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 $repo" >> $file +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 "$repo") +tags=$(git ls-remote --tags --refs "$url") # keep only the version part of the tag tags=$(echo "$tags" | cut --delimiter=/ --field=3) diff --git a/pkgs/data/fonts/iosevka/update-default.sh b/pkgs/data/fonts/iosevka/update-default.sh index 208ea6101ac2..8d918058988a 100755 --- a/pkgs/data/fonts/iosevka/update-default.sh +++ b/pkgs/data/fonts/iosevka/update-default.sh @@ -8,7 +8,7 @@ repo=https://github.com/be5invis/Iosevka # Discover the latest version. current_version=$(nix-instantiate "$nixpkgs" --eval --strict -A iosevka.version | tr -d '"') -new_version=$(list-git-tags "$repo" | sort --reverse --version-sort | awk 'match($0, /^v([0-9.]+)$/, m) { print m[1]; exit; }') +new_version=$(list-git-tags --url="$repo" | sort --reverse --version-sort | awk 'match($0, /^v([0-9.]+)$/, m) { print m[1]; exit; }') if [[ "$new_version" == "$current_version" ]]; then echo "iosevka: no update found" exit diff --git a/pkgs/data/themes/marwaita/default.nix b/pkgs/data/themes/marwaita/default.nix index 966cb1c4f6f8..1e1fa617e028 100644 --- a/pkgs/data/themes/marwaita/default.nix +++ b/pkgs/data/themes/marwaita/default.nix @@ -5,6 +5,7 @@ , gtk-engine-murrine , gtk_engines , librsvg +, gitUpdater }: stdenv.mkDerivation rec { @@ -37,6 +38,8 @@ stdenv.mkDerivation rec { runHook postInstall ''; + passthru.updateScript = gitUpdater {inherit pname version; }; + meta = with lib; { description = "GTK theme supporting Budgie, Pantheon, Mate, Xfce4 and GNOME desktops"; homepage = "https://www.pling.com/p/1239855/"; diff --git a/pkgs/desktops/lxqt/default.nix b/pkgs/desktops/lxqt/default.nix index 062ca4abfe86..5404c0c7753a 100644 --- a/pkgs/desktops/lxqt/default.nix +++ b/pkgs/desktops/lxqt/default.nix @@ -4,10 +4,9 @@ let # Update script tailored to LXQt packages from git repository lxqtUpdateScript = { pname, version, src }: - pkgs.genericUpdater { + pkgs.gitUpdater { inherit pname version; attrPath = "lxqt.${pname}"; - versionLister = "${pkgs.common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; }; # For compiling information, see: diff --git a/pkgs/desktops/mate/default.nix b/pkgs/desktops/mate/default.nix index e9822f0242d6..17107ea8947f 100644 --- a/pkgs/desktops/mate/default.nix +++ b/pkgs/desktops/mate/default.nix @@ -10,7 +10,7 @@ let pkgs.genericUpdater { inherit pname version odd-unstable; attrPath = "mate.${pname}"; - versionLister = "${pkgs.common-updater-scripts}/bin/list-archive-two-level-versions ${url}"; + versionLister = "${pkgs.common-updater-scripts}/bin/list-archive-two-level-versions --url=${url}"; }; atril = callPackage ./atril { }; diff --git a/pkgs/desktops/mate/mate-tweak/default.nix b/pkgs/desktops/mate/mate-tweak/default.nix index ebac46692c01..e0fc06135e19 100644 --- a/pkgs/desktops/mate/mate-tweak/default.nix +++ b/pkgs/desktops/mate/mate-tweak/default.nix @@ -9,8 +9,7 @@ , gobject-introspection , wrapGAppsHook , glib -, genericUpdater -, common-updater-scripts +, gitUpdater }: python3Packages.buildPythonApplication rec { @@ -74,10 +73,9 @@ python3Packages.buildPythonApplication rec { done ''; - passthru.updateScript = genericUpdater { + passthru.updateScript = gitUpdater { inherit pname version; attrPath = "mate.${pname}"; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; }; meta = with lib; { diff --git a/pkgs/desktops/xfce/applications/orage/default.nix b/pkgs/desktops/xfce/applications/orage/default.nix index f38dacf0dbbc..7def10fb5973 100644 --- a/pkgs/desktops/xfce/applications/orage/default.nix +++ b/pkgs/desktops/xfce/applications/orage/default.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { }) ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister "apps" pname; diff --git a/pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix b/pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix index 8c4dff80747d..209547ea67c4 100644 --- a/pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix +++ b/pkgs/desktops/xfce/art/xfce4-icon-theme/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { dontDropIconThemeCache = true; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; diff --git a/pkgs/desktops/xfce/art/xfwm4-themes/default.nix b/pkgs/desktops/xfce/art/xfwm4-themes/default.nix index 2c84c619c64f..10270c7fde99 100644 --- a/pkgs/desktops/xfce/art/xfwm4-themes/default.nix +++ b/pkgs/desktops/xfce/art/xfwm4-themes/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { sha256 = "sha256-MhTV8A6XA7XoyefDKH1gbe3scoXOtNXbMy6TraZv1XU="; }; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; diff --git a/pkgs/desktops/xfce/default.nix b/pkgs/desktops/xfce/default.nix index 2340a57c22d8..de418dd432cd 100644 --- a/pkgs/desktops/xfce/default.nix +++ b/pkgs/desktops/xfce/default.nix @@ -3,13 +3,10 @@ lib.makeScope pkgs.newScope (self: with self; { #### NixOS support - updateScript = pkgs.genericUpdater; - - gitLister = url: - "${pkgs.common-updater-scripts}/bin/list-git-tags ${url}"; + genericUpdater = pkgs.genericUpdater; archiveLister = category: name: - "${pkgs.common-updater-scripts}/bin/list-archive-two-level-versions https://archive.xfce.org/src/${category}/${name}"; + "${pkgs.common-updater-scripts}/bin/list-archive-two-level-versions --url=https://archive.xfce.org/src/${category}/${name}"; mkXfceDerivation = callPackage ./mkXfceDerivation.nix { }; diff --git a/pkgs/desktops/xfce/mkXfceDerivation.nix b/pkgs/desktops/xfce/mkXfceDerivation.nix index 8ff0d83cae38..261178381e4e 100644 --- a/pkgs/desktops/xfce/mkXfceDerivation.nix +++ b/pkgs/desktops/xfce/mkXfceDerivation.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitLab, pkg-config, xfce4-dev-tools, hicolor-icon-theme, xfce, wrapGAppsHook }: +{ lib, stdenv, fetchFromGitLab, pkg-config, xfce4-dev-tools, hicolor-icon-theme, xfce, wrapGAppsHook, gitUpdater }: { category , pname @@ -41,9 +41,8 @@ let pos = builtins.unsafeGetAttrPos "pname" args; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = gitUpdater { inherit pname version attrPath rev-prefix odd-unstable patchlevel-unstable; - versionLister = xfce.gitLister src.meta.homepage; }; meta = with lib; { 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 dd74a0653b8d..68e44437629c 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-cpugraph-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-cpugraph-plugin/default.nix @@ -45,7 +45,7 @@ in stdenv.mkDerivation rec { hicolor-icon-theme ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 76868bcd550a..c79e30a65802 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-embed-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-embed-plugin/default.nix @@ -33,7 +33,7 @@ in stdenv.mkDerivation rec { gtk2 ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 3ee90788137e..17fa349a1d98 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-eyes-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-eyes-plugin/default.nix @@ -35,7 +35,7 @@ in stdenv.mkDerivation rec { gtk3 ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 084cb764c627..1ba214611a65 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-fsguard-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-fsguard-plugin/default.nix @@ -35,7 +35,7 @@ in stdenv.mkDerivation rec { gtk3 ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 9700d515fbca..1f7225fe958b 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-genmon-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-genmon-plugin/default.nix @@ -33,7 +33,7 @@ in stdenv.mkDerivation rec { gtk3 ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 455370ca38bb..2e6d0e297bb0 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-mailwatch-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-mailwatch-plugin/default.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { libgcrypt ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 1f935ac4a4d4..da2c4298ec4a 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-mpc-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-mpc-plugin/default.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { exo ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-namebar-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-namebar-plugin/default.nix index ec64a60fb54a..e7f20a0ec7a8 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-namebar-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-namebar-plugin/default.nix @@ -1,5 +1,7 @@ { lib, stdenv, pkg-config, fetchFromGitHub, python3, vala -, gtk3, libwnck, libxfce4util, xfce4-panel, wafHook, xfce }: +, gtk3, libwnck, libxfce4util, xfce4-panel, wafHook, xfce +, gitUpdater +}: stdenv.mkDerivation rec { pname = "xfce4-namebar-plugin"; @@ -20,10 +22,9 @@ stdenv.mkDerivation rec { substituteInPlace src/preferences.vala --replace 'var dir_strings = Environment.get_system_data_dirs()' "string[] dir_strings = { \"$out/share\" }" ''; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = gitUpdater { inherit pname version; attrPath = "xfce.${pname}"; - versionLister = xfce.gitLister src.meta.homepage; rev-prefix = "v"; }; 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 c2a7aa694d7d..124bbfe8a633 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-notes-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-notes-plugin/default.nix @@ -31,7 +31,7 @@ in stdenv.mkDerivation rec { xfconf ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 c45fba5ebd79..8edface25a86 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin/default.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { "--with-pathnetcat=${netcat-gnu}/bin/netcat" ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 7236eb97d6de..ccdc051982fd 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-systemload-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-systemload-plugin/default.nix @@ -31,7 +31,7 @@ in stdenv.mkDerivation rec { xfconf ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 35840b9d244b..ad4add40c5bd 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-timer-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-timer-plugin/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; 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 4ce0fae5a391..f6a9bef823f3 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-weather-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-weather-plugin/default.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = xfce.genericUpdater { inherit pname version; attrPath = "xfce.${pname}"; versionLister = xfce.archiveLister category pname; diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-windowck-plugin/default.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-windowck-plugin/default.nix index 6a2386e0f89e..5e5e6c8aa694 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-windowck-plugin/default.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-windowck-plugin/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, pkg-config, intltool, python3, imagemagick, libwnck, libxfce4ui, xfce4-panel, xfconf, xfce4-dev-tools, xfce }: +{ lib, stdenv, fetchFromGitHub, pkg-config, intltool, python3, imagemagick, libwnck, libxfce4ui, xfce4-panel, xfconf, xfce4-dev-tools, xfce, gitUpdater }: stdenv.mkDerivation rec { pname = "xfce4-windowck-plugin"; @@ -33,10 +33,9 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = gitUpdater { inherit pname version; attrPath = "xfce.${pname}"; - versionLister = xfce.gitLister src.meta.homepage; rev-prefix = "v"; }; diff --git a/pkgs/desktops/xfce/thunar-plugins/dropbox/default.nix b/pkgs/desktops/xfce/thunar-plugins/dropbox/default.nix index 75ef2491fe15..e056c90a5502 100644 --- a/pkgs/desktops/xfce/thunar-plugins/dropbox/default.nix +++ b/pkgs/desktops/xfce/thunar-plugins/dropbox/default.nix @@ -6,6 +6,7 @@ , cmake , ninja , xfce +, gitUpdater }: stdenv.mkDerivation rec { @@ -30,10 +31,9 @@ stdenv.mkDerivation rec { gtk3 ]; - passthru.updateScript = xfce.updateScript { + passthru.updateScript = gitUpdater { inherit pname version; attrPath = "xfce.thunar-dropbox-plugin"; - versionLister = xfce.gitLister src.meta.homepage; }; meta = with lib; { diff --git a/pkgs/development/beam-modules/elvis-erlang/default.nix b/pkgs/development/beam-modules/elvis-erlang/default.nix index e077040c69c6..810486e2bc45 100644 --- a/pkgs/development/beam-modules/elvis-erlang/default.nix +++ b/pkgs/development/beam-modules/elvis-erlang/default.nix @@ -24,7 +24,7 @@ in rebar3Relx rec { set -euo pipefail - latest=$(list-git-tags https://github.com/${owner}/${repo}.git | sort -V | tail -1) + latest=$(list-git-tags --url=https://github.com/${owner}/${repo}.git | sort -V | tail -1) if [ "$latest" != "${version}" ]; then nixpkgs="$(git rev-parse --show-toplevel)" nix_path="$nixpkgs/pkgs/development/beam-modules/elvis-erlang" diff --git a/pkgs/development/beam-modules/erlang-ls/default.nix b/pkgs/development/beam-modules/erlang-ls/default.nix index 08ebb6136fc5..be9c647437ec 100644 --- a/pkgs/development/beam-modules/erlang-ls/default.nix +++ b/pkgs/development/beam-modules/erlang-ls/default.nix @@ -51,7 +51,7 @@ rebar3Relx { #! nix-shell -i bash -p common-updater-scripts coreutils git gnused gnutar gzip "rebar3WithPlugins { globalPlugins = [ beamPackages.rebar3-nix ]; }" set -ox errexit - latest=$(list-git-tags https://github.com/${owner}/${repo}.git | sed -n '/[\d\.]\+/p' | sort -V | tail -1) + latest=$(list-git-tags --url=https://github.com/${owner}/${repo}.git | sed -n '/[\d\.]\+/p' | sort -V | tail -1) if [[ "$latest" != "${version}" ]]; then nixpkgs="$(git rev-parse --show-toplevel)" nix_path="$nixpkgs/pkgs/development/beam-modules/erlang-ls" diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix index f4f7d6483545..667fb749d330 100644 --- a/pkgs/development/interpreters/erlang/generic-builder.nix +++ b/pkgs/development/interpreters/erlang/generic-builder.nix @@ -154,7 +154,7 @@ stdenv.mkDerivation ({ #!${stdenv.shell} set -ox errexit PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]} - latest=$(list-git-tags https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1) + latest=$(list-git-tags --url=https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1) if [ "$latest" != "${version}" ]; then nixpkgs="$(git rev-parse --show-toplevel)" nix_file="$nixpkgs/pkgs/development/interpreters/erlang/R${major}.nix" diff --git a/pkgs/development/libraries/gsettings-qt/default.nix b/pkgs/development/libraries/gsettings-qt/default.nix index 21b63875db6c..ed979c02c868 100644 --- a/pkgs/development/libraries/gsettings-qt/default.nix +++ b/pkgs/development/libraries/gsettings-qt/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, fetchFromGitLab, pkg-config , qmake, qtbase, qtdeclarative, wrapQtAppsHook , glib, gobject-introspection -, genericUpdater, common-updater-scripts +, gitUpdater }: stdenv.mkDerivation rec { @@ -55,10 +55,9 @@ stdenv.mkDerivation rec { done ''; - passthru.updateScript = genericUpdater { + passthru.updateScript = gitUpdater { inherit pname version; rev-prefix = "v"; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; }; meta = with lib; { diff --git a/pkgs/development/libraries/libyang/default.nix b/pkgs/development/libraries/libyang/default.nix index 6a07371261ae..d6efe0543db7 100644 --- a/pkgs/development/libraries/libyang/default.nix +++ b/pkgs/development/libraries/libyang/default.nix @@ -10,8 +10,7 @@ , pcre2 # update script -, genericUpdater -, common-updater-scripts +, gitUpdater }: stdenv.mkDerivation rec { @@ -40,9 +39,8 @@ stdenv.mkDerivation rec { "-DCMAKE_BUILD_TYPE:String=Release" ]; - passthru.updateScript = genericUpdater { + passthru.updateScript = gitUpdater { inherit pname version; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; rev-prefix = "v"; }; diff --git a/pkgs/development/libraries/mlt/default.nix b/pkgs/development/libraries/mlt/default.nix index b73289ca82ff..d3bcaa2658ba 100644 --- a/pkgs/development/libraries/mlt/default.nix +++ b/pkgs/development/libraries/mlt/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, fetchFromGitHub, makeWrapper , SDL, ffmpeg_4, frei0r, libjack2, libdv, libsamplerate, libexif , libvorbis, libxml2, movit, pkg-config, sox, fftw, opencv4, SDL2 -, gtk2, genericUpdater, common-updater-scripts, libebur128 +, gtk2, gitUpdater, libebur128 , jack2, ladspa-sdk, swig, which, ncurses , enablePython ? false, python3 }: @@ -51,9 +51,8 @@ stdenv.mkDerivation rec { sed -i ${outPythonPath}/mlt/__init__.py -e "s|return importlib.import_module('_mlt')|return importlib.import_module('mlt._mlt')|g" ''; - passthru.updateScript = genericUpdater { + passthru.updateScript = gitUpdater { inherit pname version; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; rev-prefix = "v"; }; diff --git a/pkgs/development/libraries/mlt/qt-5.nix b/pkgs/development/libraries/mlt/qt-5.nix index 948de303cefa..5c58aa4f8aec 100644 --- a/pkgs/development/libraries/mlt/qt-5.nix +++ b/pkgs/development/libraries/mlt/qt-5.nix @@ -18,8 +18,7 @@ , vid-stab , opencv3 , ladspa-sdk -, genericUpdater -, common-updater-scripts +, gitUpdater , ladspaPlugins , mkDerivation , which @@ -70,9 +69,8 @@ mkDerivation rec { inherit ffmpeg; }; - passthru.updateScript = genericUpdater { + passthru.updateScript = gitUpdater { inherit pname version; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; rev-prefix = "v"; }; diff --git a/pkgs/development/tools/build-managers/rebar3/default.nix b/pkgs/development/tools/build-managers/rebar3/default.nix index 37cb4dd86609..3ec37b89fd39 100644 --- a/pkgs/development/tools/build-managers/rebar3/default.nix +++ b/pkgs/development/tools/build-managers/rebar3/default.nix @@ -81,7 +81,7 @@ let (rebar3WithPlugins { globalPlugins = [rebar3-nix]; }) ] } - latest=$(list-git-tags https://github.com/${owner}/${pname}.git | sed -n '/[\d\.]\+/p' | sort -V | tail -1) + latest=$(list-git-tags --url=https://github.com/${owner}/${pname}.git | sed -n '/[\d\.]\+/p' | sort -V | tail -1) if [ "$latest" != "${version}" ]; then nixpkgs="$(git rev-parse --show-toplevel)" nix_path="$nixpkgs/pkgs/development/tools/build-managers/rebar3" diff --git a/pkgs/tools/backup/stenc/default.nix b/pkgs/tools/backup/stenc/default.nix index b2a53f8ad07d..c490edd1dc98 100644 --- a/pkgs/tools/backup/stenc/default.nix +++ b/pkgs/tools/backup/stenc/default.nix @@ -1,8 +1,7 @@ { lib , stdenv , fetchFromGitHub -, genericUpdater -, common-updater-scripts +, gitUpdater , autoreconfHook }: @@ -19,10 +18,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook ]; - passthru.updateScript = genericUpdater { - inherit pname version; - versionLister = "${common-updater-scripts}/bin/list-git-tags ${src.meta.homepage}"; - }; + passthru.updateScript = gitUpdater { inherit pname version; }; meta = { description = "SCSI Tape Encryption Manager"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4d94e08657e1..cf0796ffe21e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -107,6 +107,8 @@ with pkgs; genericUpdater = callPackage ../common-updater/generic-updater.nix { }; + gitUpdater = callPackage ../common-updater/git-updater.nix { }; + unstableGitUpdater = callPackage ../common-updater/unstable-updater.nix { }; nix-update-script = callPackage ../common-updater/nix-update.nix { }; From 005ac63a1910945086e40d197164a5aae4c38090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Romildo?= Date: Mon, 21 Feb 2022 12:10:33 -0300 Subject: [PATCH 2/2] httpTwoLevelsUpdater: init --- .../http-two-levels-updater.nix | 19 ++++++++++++++++ ...sions => list-archive-two-levels-versions} | 22 ++++++++++++------- pkgs/desktops/mate/default.nix | 5 ++--- .../xfce/applications/orage/default.nix | 5 ++--- .../xfce/art/xfce4-icon-theme/default.nix | 6 +---- .../xfce/art/xfwm4-themes/default.nix | 6 +---- pkgs/desktops/xfce/default.nix | 8 +++++-- .../xfce4-cpugraph-plugin/default.nix | 6 +---- .../xfce4-embed-plugin/default.nix | 6 +---- .../xfce4-eyes-plugin/default.nix | 6 +---- .../xfce4-fsguard-plugin/default.nix | 6 +---- .../xfce4-genmon-plugin/default.nix | 6 +---- .../xfce4-mailwatch-plugin/default.nix | 6 +---- .../xfce4-mpc-plugin/default.nix | 6 +---- .../xfce4-notes-plugin/default.nix | 6 +---- .../xfce4-sensors-plugin/default.nix | 6 +---- .../xfce4-systemload-plugin/default.nix | 6 +---- .../xfce4-timer-plugin/default.nix | 6 +---- .../xfce4-weather-plugin/default.nix | 6 +---- pkgs/top-level/all-packages.nix | 2 ++ 20 files changed, 59 insertions(+), 86 deletions(-) create mode 100644 pkgs/common-updater/http-two-levels-updater.nix rename pkgs/common-updater/scripts/{list-archive-two-level-versions => list-archive-two-levels-versions} (64%) 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 000000000000..f9e1e1b7204a --- /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 similarity index 64% rename from pkgs/common-updater/scripts/list-archive-two-level-versions rename to pkgs/common-updater/scripts/list-archive-two-levels-versions index ae29d533fc3b..4263a9de3ca3 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 17107ea8947f..2c5b45a653e5 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 7def10fb5973..4e5028a6a599 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 209547ea67c4..8c37dde65ccb 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 10270c7fde99..3665263ede05 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 de418dd432cd..1ec4cec5b31d 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 68e44437629c..33bdb052b6a9 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 c79e30a65802..cc4ce861e724 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 17fa349a1d98..08434ad25227 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 1ba214611a65..81498aea96f4 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 1f7225fe958b..1b794ff2b836 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 2e6d0e297bb0..fdd3af5fe402 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 da2c4298ec4a..566475869345 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 124bbfe8a633..6cb2fcc66c02 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 8edface25a86..22b4d8c4f40f 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 ccdc051982fd..d264181bd48f 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 ad4add40c5bd..c3cb16dfa830 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 f6a9bef823f3..5ceda9cb8bd3 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 cf0796ffe21e..6726ff8e0041 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 { };