fetchmtn: move logic to default args
svn path=/nixpkgs/trunk/; revision=28786
This commit is contained in:
parent
08605870da
commit
1e981a7deb
|
@ -1,25 +1,23 @@
|
||||||
# You can specify some extra mirrors and a cache DB via options
|
# You can specify some extra mirrors and a cache DB via options
|
||||||
{stdenv, monotone, defaultDBMirrors ? [], cacheDB ? ""}:
|
{stdenv, monotone, defaultDBMirrors ? [], cacheDB ? "./mtn-checkout.db"}:
|
||||||
# dbs is a list of strings
|
# dbs is a list of strings
|
||||||
# each is an url for sync
|
# each is an url for sync
|
||||||
|
|
||||||
# selector is mtn selector, like h:org.example.branch
|
# selector is mtn selector, like h:org.example.branch
|
||||||
#
|
#
|
||||||
{name ? "", dbs ? [], selector ? "", branch, md5 ? "", sha1 ? "", sha256 ? ""}:
|
{name ? "mtn-checkout", dbs ? [], sha256
|
||||||
|
, selector ? "h:" + branch, branch}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = if name != "" then name else "mtn-checkout";
|
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
buildInputs = [monotone];
|
buildNativeInputs = [monotone];
|
||||||
|
|
||||||
outputHashAlgo = if sha256 == "" then (if sha1 == "" then "md5" else "sha1") else "sha256";
|
outputHashAlgo = "sha256";
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHash = if sha256 == "" then (if sha1 == "" then md5 else sha1) else sha256;
|
outputHash = sha256;
|
||||||
|
|
||||||
dbs = defaultDBMirrors ++ dbs;
|
dbs = defaultDBMirrors ++ dbs;
|
||||||
cacheDB = if cacheDB != "" then cacheDB else "./mtn-checkout.db";
|
inherit branch cacheDB name selector;
|
||||||
selector = if selector != "" then selector else "h:" + branch;
|
|
||||||
inherit branch;
|
|
||||||
|
|
||||||
impureEnvVars = [
|
impureEnvVars = [
|
||||||
# We borrow these environment variables from the caller to allow
|
# We borrow these environment variables from the caller to allow
|
||||||
|
|
|
@ -266,11 +266,7 @@ let
|
||||||
|
|
||||||
fetchgitrevision = import ../build-support/fetchgitrevision runCommand git;
|
fetchgitrevision = import ../build-support/fetchgitrevision runCommand git;
|
||||||
|
|
||||||
fetchmtn = import ../build-support/fetchmtn {
|
fetchmtn = callPackage ../build-support/fetchmtn (getConfig ["fetchmtn"] {});
|
||||||
inherit monotone stdenv;
|
|
||||||
cacheDB = getConfig ["fetchmtn" "cacheDB"] "";
|
|
||||||
defaultDBMirrors = getConfig ["fetchmtn" "defaultDBMirrors"] [];
|
|
||||||
};
|
|
||||||
|
|
||||||
fetchsvn = import ../build-support/fetchsvn {
|
fetchsvn = import ../build-support/fetchsvn {
|
||||||
inherit stdenv subversion openssh;
|
inherit stdenv subversion openssh;
|
||||||
|
|
Loading…
Reference in New Issue