mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-16 02:33:25 +00:00
Cherry-picking versionOlder from trunk: seems to be non-rebuild-causing, and needed to build NixOS trunk
svn path=/nixpkgs/branches/glib-2.30-take2/; revision=33368
This commit is contained in:
parent
f5cc572d8b
commit
e4762ec355
@ -82,15 +82,18 @@ rec {
|
|||||||
map f (stringToCharacters s)
|
map f (stringToCharacters s)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
# same as vim escape function.
|
# same as vim escape function.
|
||||||
# Each character contained in list is prefixed by "\"
|
# Each character contained in list is prefixed by "\"
|
||||||
escape = list : string :
|
escape = list : string :
|
||||||
stringAsChars (c: if lib.elem c list then "\\${c}" else c) string;
|
stringAsChars (c: if lib.elem c list then "\\${c}" else c) string;
|
||||||
|
|
||||||
|
|
||||||
# still ugly slow. But more correct now
|
# still ugly slow. But more correct now
|
||||||
# [] for zsh
|
# [] for zsh
|
||||||
escapeShellArg = lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]");
|
escapeShellArg = lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]");
|
||||||
|
|
||||||
|
|
||||||
# replace characters by their substitutes. This function is equivalent to
|
# replace characters by their substitutes. This function is equivalent to
|
||||||
# the `tr' command except that one character can be replace by multiple
|
# the `tr' command except that one character can be replace by multiple
|
||||||
# ones. e.g.,
|
# ones. e.g.,
|
||||||
@ -105,10 +108,12 @@ rec {
|
|||||||
in
|
in
|
||||||
stringAsChars subst s;
|
stringAsChars subst s;
|
||||||
|
|
||||||
|
|
||||||
# Compares strings not requiring context equality
|
# Compares strings not requiring context equality
|
||||||
# Obviously, a workaround but works on all Nix versions
|
# Obviously, a workaround but works on all Nix versions
|
||||||
eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);
|
eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);
|
||||||
|
|
||||||
|
|
||||||
# Cut a string with a separator and produces a list of strings which were
|
# Cut a string with a separator and produces a list of strings which were
|
||||||
# separated by this separator. e.g.,
|
# separated by this separator. e.g.,
|
||||||
# `splitString "." "foo.bar.baz"' returns ["foo" "bar" "baz"].
|
# `splitString "." "foo.bar.baz"' returns ["foo" "bar" "baz"].
|
||||||
@ -133,6 +138,7 @@ rec {
|
|||||||
in
|
in
|
||||||
recurse 0 0;
|
recurse 0 0;
|
||||||
|
|
||||||
|
|
||||||
# return the suffix of the second argument if the first argument match its
|
# return the suffix of the second argument if the first argument match its
|
||||||
# prefix. e.g.,
|
# prefix. e.g.,
|
||||||
# `removePrefix "foo." "foo.bar.baz"' returns "bar.baz".
|
# `removePrefix "foo." "foo.bar.baz"' returns "bar.baz".
|
||||||
@ -146,6 +152,13 @@ rec {
|
|||||||
else
|
else
|
||||||
s;
|
s;
|
||||||
|
|
||||||
|
|
||||||
|
# Why do we need this if we have baseNameOf?
|
||||||
basename = s: lib.last (splitString "/" s);
|
basename = s: lib.last (splitString "/" s);
|
||||||
|
|
||||||
|
|
||||||
|
# Return true iff string v1 denotes a version older than v2.
|
||||||
|
versionOlder = v1: v2: builtins.compareVersions v2 v1 == 1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ in stdenv.mkDerivation {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://www.intel.com;
|
homepage = http://www.intel.com/;
|
||||||
description = "Microcode for Intel processors";
|
description = "Microcode for Intel processors";
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user