From 892db3bb8c23305b66e24e2b600b03ae197aa0c3 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 14 Oct 2008 14:01:00 +0000 Subject: [PATCH] update bleeding edge repo management it now figures out the dist name from the url and the revision is added to the url This way a new version doesn't override the old one and you can keep multiple dist tar.gz files svn path=/nixpkgs/trunk/; revision=13065 --- .../misc/bleeding-edge-repos/default.nix | 17 ++++++++++------- pkgs/lib/default.nix | 10 ++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/pkgs/development/misc/bleeding-edge-repos/default.nix b/pkgs/development/misc/bleeding-edge-repos/default.nix index 8ed2c80bacc4..9635e0b2aeb5 100644 --- a/pkgs/development/misc/bleeding-edge-repos/default.nix +++ b/pkgs/development/misc/bleeding-edge-repos/default.nix @@ -1,6 +1,6 @@ args: with args; - let inherit (builtins) pathExists; in + let inherit (builtins) pathExists hasAttr getAttr head; in rec { /* tries to get source in this order @@ -13,13 +13,14 @@ args: managedRepoDir = getConfig [ "bleedingEdgeRepos" "managedRepoDir" ] (builtins.getEnv "HOME" + "/managed_repos"); sourceByName = name : - let localTarGZ = managedRepoDir+"/dist/${name}.tar.gz"; + let fetchinfo = if (hasAttr name fetchInfos) + 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 --update to add it automatically"; + localTarGZ = managedRepoDir+"/dist/${ lib.dropPath (head fetchinfo.urls) }"; # hack, dropPath should be implemented as primop fetchInfos = import ../../../misc/bleeding-edge-fetch-infos.nix; in - if (getConfig ["bleedingEdgeRepos" "useLocalRepos"] false ) && pathExists localTarGZ - then localTarGZ - else if __hasAttr name fetchInfos - then (__getAttr name fetchInfos) { inherit fetchurl; } - else throw "warning, no bleeding edge source attribute found in bleeding-edge-fetch-infos.nix with name ${name}"; + if (getConfig ["bleedingEdgeRepos" "useLocalRepos"] false ) + then localTarGZ else fetchinfo; repos = let kde4support = builtins.listToAttrs (map (n: lib.nv ("kdesupport_"+n) { type = "svn"; url = "svn://anonsvn.kde.org/home/kde/trunk/kdesupport/${n}"; groups="kdesupport"; }) @@ -64,6 +65,8 @@ args: kdepimlibs = { type="svn"; url="svn://anonsvn.kde.org/home/kde/trunk/KDE/kdepimlibs"; groups = "kde"; }; kdebase = { type="svn"; url="svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase"; groups = "kde"; }; + cinelerra = { type="git"; url="git://git.cinelerra.org/j6t/cinelerra.git"; }; + # git repositories hypertable = { type="git"; url="git://scm.hypertable.org/pub/repos/hypertable.git"; groups=""; }; } // kde4support // getConfig [ "bleedingEdgeRepos" "repos" ] {}; diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index 34d1cdda148b..ece410ab55ab 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -507,6 +507,16 @@ rec { defineShList = name : list : "\n${name}=(${concatStringsSep " " (map escapeShellArg list)})\n"; + # this as well :-) arg: http://foo/bar/bz.ext returns bz.ext + 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; + # calls a function (f attr value ) for each record item. returns a list mapRecordFlatten = f : r : map (attr: f attr (builtins.getAttr attr r) ) (attrNames r);