3
0
Fork 0
forked from mirrors/nixpkgs

removing dropPath. It's used once and in that case it behaves like

builtins.dropPath

svn path=/nixpkgs/trunk/; revision=17018
This commit is contained in:
Marc Weber 2009-09-10 16:57:26 +00:00
parent 50ccc55d62
commit 60aa746f6b
2 changed files with 1 additions and 12 deletions

View file

@ -17,7 +17,7 @@ args:
then (getAttr name fetchInfos) { inherit fetchurl; }
else throw "no bleeding edge source attribute found in bleeding-edge-fetch-infos.nix with name ${name}\n"
"run NO_FETCH=1 nix-repository-manager <path to nixpkgs> --update <reponame> to add it automatically";
localTarGZ = managedRepoDir+"/dist/${ lib.dropPath (head fetchinfo.urls) }"; # hack, dropPath should be implemented as primop
localTarGZ = managedRepoDir+"/dist/${ builtins.baseNameOf (head fetchinfo.urls) }"; # hack, dropPath should be implemented as primop
fetchInfos = import ../../../misc/bleeding-edge-fetch-infos.nix; in
if (getConfig ["bleedingEdgeRepos" "useLocalRepos"] false && builtins.pathExists localTarGZ)
then localTarGZ else fetchinfo;

View file

@ -79,17 +79,6 @@ rec {
# [] for zsh
escapeShellArg = lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]");
# arg: http://foo/bar/bz.ext returns bz.ext
# !!! isn't this what the `baseNameOf' primop does?
dropPath = s :
if s == "" then "" else
let takeTillSlash = left : c : s :
if left == 0 then s
else if (substring left 1 s == "/") then
(substring (add left 1) (sub c 1) s)
else takeTillSlash (sub left 1) (add c 1) s; in
takeTillSlash (sub (stringLength s) 1) 1 s;
# Compares strings not requiring context equality
# Obviously, a workaround but works on all Nix versions
eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);