mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-16 17:14:00 +00:00
genericUpdater: fix ignoredVersions
ignoredVersions silently failed if GNU grep was not in `PATH`.
This commit is contained in:
parent
5f81b2812e
commit
a87dd78cdd
@ -1,4 +1,12 @@
|
|||||||
{ stdenv, writeScript, coreutils, gnugrep, gnused, common-updater-scripts, nix }:
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, common-updater-scripts
|
||||||
|
, coreutils
|
||||||
|
, gnugrep
|
||||||
|
, gnused
|
||||||
|
, nix
|
||||||
|
, writeScript
|
||||||
|
}:
|
||||||
|
|
||||||
{ name ? null
|
{ name ? null
|
||||||
, pname ? null
|
, pname ? null
|
||||||
@ -15,6 +23,9 @@ let
|
|||||||
# where to print git commands and debugging messages
|
# where to print git commands and debugging messages
|
||||||
fileForGitCommands = "update-git-commits.txt";
|
fileForGitCommands = "update-git-commits.txt";
|
||||||
|
|
||||||
|
grep = lib.getExe gnugrep;
|
||||||
|
sed = lib.getExe gnused;
|
||||||
|
|
||||||
# shell script to update package
|
# shell script to update package
|
||||||
updateScript = writeScript "generic-update-script.sh" ''
|
updateScript = writeScript "generic-update-script.sh" ''
|
||||||
#! ${stdenv.shell}
|
#! ${stdenv.shell}
|
||||||
@ -41,20 +52,20 @@ 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 "$ignored_versions" <<< "$tag"
|
||||||
}
|
}
|
||||||
|
|
||||||
function version_is_unstable() {
|
function version_is_unstable() {
|
||||||
local tag="$1"
|
local tag="$1"
|
||||||
local enforce="$2"
|
local enforce="$2"
|
||||||
if [ -n "$odd_unstable" -o -n "$enforce" ]; then
|
if [ -n "$odd_unstable" -o -n "$enforce" ]; then
|
||||||
local minor=$(echo "$tag" | ${gnused}/bin/sed -rne 's,^[0-9]+\.([0-9]+).*,\1,p')
|
local minor=$(echo "$tag" | ${sed} -rne 's,^[0-9]+\.([0-9]+).*,\1,p')
|
||||||
if [ $((minor % 2)) -eq 1 ]; then
|
if [ $((minor % 2)) -eq 1 ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -n "$patchlevel_unstable" -o -n "$enforce" ]; then
|
if [ -n "$patchlevel_unstable" -o -n "$enforce" ]; then
|
||||||
local patchlevel=$(echo "$tag" | ${gnused}/bin/sed -rne 's,^[0-9]+\.[0-9]+\.([0-9]+).*$,\1,p')
|
local patchlevel=$(echo "$tag" | ${sed} -rne 's,^[0-9]+\.[0-9]+\.([0-9]+).*$,\1,p')
|
||||||
if ((patchlevel >= 90)); then
|
if ((patchlevel >= 90)); then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -71,10 +82,10 @@ let
|
|||||||
|
|
||||||
# cut any revision prefix not used in the NixOS package version
|
# cut any revision prefix not used in the NixOS package version
|
||||||
if [ -n "$rev_prefix" ]; then
|
if [ -n "$rev_prefix" ]; then
|
||||||
tags=$(echo "$tags" | ${gnugrep}/bin/grep "^$rev_prefix")
|
tags=$(echo "$tags" | ${grep} "^$rev_prefix")
|
||||||
tags=$(echo "$tags" | ${gnused}/bin/sed -e "s,^$rev_prefix,,")
|
tags=$(echo "$tags" | ${sed} -e "s,^$rev_prefix,,")
|
||||||
fi
|
fi
|
||||||
tags=$(echo "$tags" | ${gnugrep}/bin/grep "^[0-9]")
|
tags=$(echo "$tags" | ${grep} "^[0-9]")
|
||||||
|
|
||||||
# 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user