Skip to content

Commit a87dd78

Browse files
committed
genericUpdater: fix ignoredVersions
ignoredVersions silently failed if GNU grep was not in `PATH`.
1 parent 5f81b28 commit a87dd78

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

pkgs/common-updater/generic-updater.nix

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
{ stdenv, writeScript, coreutils, gnugrep, gnused, common-updater-scripts, nix }:
1+
{ lib
2+
, stdenv
3+
, common-updater-scripts
4+
, coreutils
5+
, gnugrep
6+
, gnused
7+
, nix
8+
, writeScript
9+
}:
210

311
{ name ? null
412
, pname ? null
@@ -15,6 +23,9 @@ let
1523
# where to print git commands and debugging messages
1624
fileForGitCommands = "update-git-commits.txt";
1725

26+
grep = lib.getExe gnugrep;
27+
sed = lib.getExe gnused;
28+
1829
# shell script to update package
1930
updateScript = writeScript "generic-update-script.sh" ''
2031
#! ${stdenv.shell}
@@ -41,20 +52,20 @@ let
4152
4253
function version_is_ignored() {
4354
local tag="$1"
44-
[ -n "$ignored_versions" ] && grep -E "$ignored_versions" <<< "$tag"
55+
[ -n "$ignored_versions" ] && ${grep} -E "$ignored_versions" <<< "$tag"
4556
}
4657
4758
function version_is_unstable() {
4859
local tag="$1"
4960
local enforce="$2"
5061
if [ -n "$odd_unstable" -o -n "$enforce" ]; then
51-
local minor=$(echo "$tag" | ${gnused}/bin/sed -rne 's,^[0-9]+\.([0-9]+).*,\1,p')
62+
local minor=$(echo "$tag" | ${sed} -rne 's,^[0-9]+\.([0-9]+).*,\1,p')
5263
if [ $((minor % 2)) -eq 1 ]; then
5364
return 0
5465
fi
5566
fi
5667
if [ -n "$patchlevel_unstable" -o -n "$enforce" ]; then
57-
local patchlevel=$(echo "$tag" | ${gnused}/bin/sed -rne 's,^[0-9]+\.[0-9]+\.([0-9]+).*$,\1,p')
68+
local patchlevel=$(echo "$tag" | ${sed} -rne 's,^[0-9]+\.[0-9]+\.([0-9]+).*$,\1,p')
5869
if ((patchlevel >= 90)); then
5970
return 0
6071
fi
@@ -71,10 +82,10 @@ let
7182
7283
# cut any revision prefix not used in the NixOS package version
7384
if [ -n "$rev_prefix" ]; then
74-
tags=$(echo "$tags" | ${gnugrep}/bin/grep "^$rev_prefix")
75-
tags=$(echo "$tags" | ${gnused}/bin/sed -e "s,^$rev_prefix,,")
85+
tags=$(echo "$tags" | ${grep} "^$rev_prefix")
86+
tags=$(echo "$tags" | ${sed} -e "s,^$rev_prefix,,")
7687
fi
77-
tags=$(echo "$tags" | ${gnugrep}/bin/grep "^[0-9]")
88+
tags=$(echo "$tags" | ${grep} "^[0-9]")
7889
7990
# sort the tags in decreasing order
8091
tags=$(echo "$tags" | ${coreutils}/bin/sort --reverse --version-sort)

0 commit comments

Comments
 (0)