httpTwoLevelsUpdater: init

This commit is contained in:
José Romildo 2022-02-21 12:10:33 -03:00
parent ba59355e81
commit 005ac63a19
20 changed files with 59 additions and 86 deletions

View file

@ -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}"}";
}

View file

@ -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

View file

@ -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 { };

View file

@ -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; {

View file

@ -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/";

View file

@ -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/";

View file

@ -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 { };

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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 { };