mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
Merge pull request #322284 from rhendric/rhendric/genericUpdater-allowedVersions
common-updater-scripts: add allowedVersions parameter
This commit is contained in:
commit
c81ecdf95b
@ -97,7 +97,7 @@ stdenv.mkDerivation rec {
|
|||||||
installFlags = [ "PREFIX=${placeholder "out"}" ];
|
installFlags = [ "PREFIX=${placeholder "out"}" ];
|
||||||
|
|
||||||
passthru.updateScript = gitUpdater {
|
passthru.updateScript = gitUpdater {
|
||||||
ignoredVersions = "^([^1]|1[^.])"; # ignore anything other than 1.x
|
allowedVersions = "^1\\.";
|
||||||
url = src.gitRepoUrl;
|
url = src.gitRepoUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
url = "https://git.efficios.com/babeltrace.git";
|
url = "https://git.efficios.com/babeltrace.git";
|
||||||
rev-prefix = "v";
|
rev-prefix = "v";
|
||||||
# Versions 2.x are packaged independently as babeltrace2
|
# Versions 2.x are packaged independently as babeltrace2
|
||||||
ignoredVersions = "^[^1]";
|
allowedVersions = "^1\\.";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
{ pname ? null
|
{ pname ? null
|
||||||
, version ? null
|
, version ? null
|
||||||
, attrPath ? null
|
, attrPath ? null
|
||||||
|
, allowedVersions ? ""
|
||||||
, ignoredVersions ? ""
|
, ignoredVersions ? ""
|
||||||
, rev-prefix ? ""
|
, rev-prefix ? ""
|
||||||
, odd-unstable ? false
|
, odd-unstable ? false
|
||||||
@ -15,6 +16,6 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
genericUpdater {
|
genericUpdater {
|
||||||
inherit pname version attrPath ignoredVersions rev-prefix odd-unstable patchlevel-unstable;
|
inherit pname version attrPath allowedVersions ignoredVersions rev-prefix odd-unstable patchlevel-unstable;
|
||||||
versionLister = "${common-updater-scripts}/bin/list-directory-versions ${lib.optionalString (url != null) "--url=${lib.escapeShellArg url}"} ${lib.optionalString (extraRegex != null) "--extra-regex=${lib.escapeShellArg extraRegex}"}";
|
versionLister = "${common-updater-scripts}/bin/list-directory-versions ${lib.optionalString (url != null) "--url=${lib.escapeShellArg url}"} ${lib.optionalString (extraRegex != null) "--extra-regex=${lib.escapeShellArg extraRegex}"}";
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
, version ? null
|
, version ? null
|
||||||
, attrPath ? null
|
, attrPath ? null
|
||||||
, versionLister
|
, versionLister
|
||||||
|
, allowedVersions ? ""
|
||||||
, ignoredVersions ? ""
|
, ignoredVersions ? ""
|
||||||
, rev-prefix ? ""
|
, rev-prefix ? ""
|
||||||
, odd-unstable ? false
|
, odd-unstable ? false
|
||||||
@ -37,10 +38,11 @@ let
|
|||||||
version="$3"
|
version="$3"
|
||||||
attr_path="$4"
|
attr_path="$4"
|
||||||
version_lister="$5"
|
version_lister="$5"
|
||||||
ignored_versions="$6"
|
allowed_versions="$6"
|
||||||
rev_prefix="$7"
|
ignored_versions="$7"
|
||||||
odd_unstable="$8"
|
rev_prefix="$8"
|
||||||
patchlevel_unstable="$9"
|
odd_unstable="$9"
|
||||||
|
patchlevel_unstable="$${10}"
|
||||||
|
|
||||||
[[ -n "$name" ]] || name="$UPDATE_NIX_NAME"
|
[[ -n "$name" ]] || name="$UPDATE_NIX_NAME"
|
||||||
[[ -n "$pname" ]] || pname="$UPDATE_NIX_PNAME"
|
[[ -n "$pname" ]] || pname="$UPDATE_NIX_PNAME"
|
||||||
@ -52,7 +54,7 @@ let
|
|||||||
|
|
||||||
function version_is_ignored() {
|
function version_is_ignored() {
|
||||||
local tag="$1"
|
local tag="$1"
|
||||||
[ -n "$ignored_versions" ] && ${grep} -E "$ignored_versions" <<< "$tag"
|
[ -n "$ignored_versions" ] && ${grep} -E -e "$ignored_versions" <<< "$tag"
|
||||||
}
|
}
|
||||||
|
|
||||||
function version_is_unstable() {
|
function version_is_unstable() {
|
||||||
@ -86,6 +88,9 @@ let
|
|||||||
tags=$(echo "$tags" | ${sed} -e "s,^$rev_prefix,,")
|
tags=$(echo "$tags" | ${sed} -e "s,^$rev_prefix,,")
|
||||||
fi
|
fi
|
||||||
tags=$(echo "$tags" | ${grep} "^[0-9]")
|
tags=$(echo "$tags" | ${grep} "^[0-9]")
|
||||||
|
if [ -n "$allowed_versions" ]; then
|
||||||
|
tags=$(echo "$tags" | ${grep} -E -e "$allowed_versions")
|
||||||
|
fi
|
||||||
|
|
||||||
# sort the tags in decreasing order
|
# sort the tags in decreasing order
|
||||||
tags=$(echo "$tags" | ${coreutils}/bin/sort --reverse --version-sort)
|
tags=$(echo "$tags" | ${coreutils}/bin/sort --reverse --version-sort)
|
||||||
@ -127,7 +132,7 @@ let
|
|||||||
|
|
||||||
in {
|
in {
|
||||||
name = "generic-update-script";
|
name = "generic-update-script";
|
||||||
command = [ updateScript name pname version attrPath versionLister ignoredVersions rev-prefix odd-unstable patchlevel-unstable ];
|
command = [ updateScript name pname version attrPath versionLister allowedVersions ignoredVersions rev-prefix odd-unstable patchlevel-unstable ];
|
||||||
supportedFeatures = [
|
supportedFeatures = [
|
||||||
# Stdout must contain output according to the updateScript commit protocol when the update script finishes with a non-zero exit code.
|
# Stdout must contain output according to the updateScript commit protocol when the update script finishes with a non-zero exit code.
|
||||||
"commit"
|
"commit"
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
{ pname ? null
|
{ pname ? null
|
||||||
, version ? null
|
, version ? null
|
||||||
, attrPath ? null
|
, attrPath ? null
|
||||||
|
, allowedVersions ? ""
|
||||||
, ignoredVersions ? ""
|
, ignoredVersions ? ""
|
||||||
, rev-prefix ? ""
|
, rev-prefix ? ""
|
||||||
, odd-unstable ? false
|
, odd-unstable ? false
|
||||||
@ -16,6 +17,6 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
genericUpdater {
|
genericUpdater {
|
||||||
inherit pname version attrPath ignoredVersions rev-prefix odd-unstable patchlevel-unstable;
|
inherit pname version attrPath allowedVersions ignoredVersions rev-prefix odd-unstable patchlevel-unstable;
|
||||||
versionLister = "${common-updater-scripts}/bin/list-git-tags ${lib.optionalString (url != null) "--url=${url}"}";
|
versionLister = "${common-updater-scripts}/bin/list-git-tags ${lib.optionalString (url != null) "--url=${url}"}";
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
{ pname ? null
|
{ pname ? null
|
||||||
, version ? null
|
, version ? null
|
||||||
, attrPath ? null
|
, attrPath ? null
|
||||||
|
, allowedVersions ? ""
|
||||||
, ignoredVersions ? ""
|
, ignoredVersions ? ""
|
||||||
, rev-prefix ? ""
|
, rev-prefix ? ""
|
||||||
, odd-unstable ? false
|
, odd-unstable ? false
|
||||||
@ -14,6 +15,6 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
genericUpdater {
|
genericUpdater {
|
||||||
inherit pname version attrPath ignoredVersions rev-prefix odd-unstable patchlevel-unstable;
|
inherit pname version attrPath allowedVersions ignoredVersions rev-prefix odd-unstable patchlevel-unstable;
|
||||||
versionLister = "${common-updater-scripts}/bin/list-archive-two-levels-versions ${lib.optionalString (url != null) "--url=${lib.escapeShellArg url}"}";
|
versionLister = "${common-updater-scripts}/bin/list-archive-two-levels-versions ${lib.optionalString (url != null) "--url=${lib.escapeShellArg url}"}";
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.updateScript = gitUpdater {
|
passthru.updateScript = gitUpdater {
|
||||||
ignoredVersions = "^[^.]+$|.*-android$";
|
allowedVersions = "\\.";
|
||||||
|
ignoredVersions = "-android$";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
passthru.updateScript = gitUpdater {
|
passthru.updateScript = gitUpdater {
|
||||||
rev-prefix = "v";
|
rev-prefix = "v";
|
||||||
ignoredVersions = "^[^.]+$"; # ignore versions without a dot
|
allowedVersions = "\\.";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
Loading…
Reference in New Issue
Block a user