remove option allowBuiltinFetchers

This commit is contained in:
DavHau 2021-10-22 15:52:06 +07:00
parent 055102e698
commit 68f38ac988
12 changed files with 12 additions and 80 deletions

View File

@ -35,7 +35,7 @@ class PackageCommand(Command):
None,
"store only one hash for all sources combined"
" (smaller lock file but larger FOD)",
flag=False
flag=True
),
option(
"extra-arg",
@ -264,7 +264,7 @@ class PackageCommand(Command):
'--translator',
f"{translator['subsystem']}.{translator['type']}.{translator['name']}",
] + (
["--combined", combined] if combined else []
["--combined"] if combined else []
) + [
f"--extra-arg {n}={v}" for n, v in specified_extra_args.items()
])

View File

@ -10,15 +10,9 @@ dream2nix_src = os.environ.get("dream2nixSrc")
def checkLockJSON(lock):
try:
lock_schema_raw=open(dream2nix_src+"/specifications/dream-lock-schema.json").read()
lock_schema=json.loads(lock_schema_raw)
except Exception as e:
print(e)
try:
validate(lock, schema=lock_schema)
except Exception as e1:
print(e1)
lock_schema_raw=open(dream2nix_src+"/specifications/dream-lock-schema.json").read()
lock_schema=json.loads(lock_schema_raw)
validate(lock, schema=lock_schema)
def callNixFunction(function_path, **kwargs):

View File

@ -1,3 +1,3 @@
{
"allowBuiltinFetchers": true
}

View File

@ -49,9 +49,7 @@ let
builders = callPackageDream ./builders {};
# fetcher implementations
fetchers = callPackageDream ./fetchers {
inherit (config) allowBuiltinFetchers;
};
fetchers = callPackageDream ./fetchers {};
# updater modules to find newest package versions
updaters = callPackageDream ./updaters {};
@ -110,13 +108,11 @@ rec {
dreamLock,
fetcher ? findFetcher (parseLock dreamLock),
sourceOverrides ? oldSources: {},
allowBuiltinFetchers ? true,
}:
let
# if generic lock is a file, read and parse it
dreamLock' = (parseLock dreamLock);
fetched = fetcher {
inherit allowBuiltinFetchers;
sources = dreamLock'.sources;
sourcesCombinedHash = dreamLock'.generic.sourcesCombinedHash;
};
@ -191,7 +187,6 @@ rec {
sourceOverrides ? oldSources: {},
packageOverrides ? {},
builderArgs ? {},
allowBuiltinFetchers ? true,
}@args:
let
# if generic lock is a file, read and parse it
@ -201,7 +196,7 @@ rec {
{
dreamLock = dreamLock';
fetchedSources = (fetchSources {
inherit dreamLock fetcher sourceOverrides allowBuiltinFetchers;
inherit dreamLock fetcher sourceOverrides;
}).fetchedSources;
}
// builderArgs

View File

@ -9,7 +9,6 @@
{
# sources attrset from generic lock
sources,
allowBuiltinFetchers,
...
}:

View File

@ -4,15 +4,12 @@
# dream2nix
callPackageDream,
utils,
allowBuiltinFetchers,
...
}:
let
b = builtins;
callFetcher = file: args: callPackageDream file ({
inherit allowBuiltinFetchers;
} // args);
callFetcher = file: args: callPackageDream file args;
in
rec {

View File

@ -2,8 +2,6 @@
fetchurl,
utils,
# config
allowBuiltinFetchers,
...
}:
{

View File

@ -3,8 +3,6 @@
lib,
utils,
# config
allowBuiltinFetchers,
...
}:
let

View File

@ -5,8 +5,6 @@
runCommand,
utils,
# config
allowBuiltinFetchers,
...
}:
{
@ -24,35 +22,6 @@
outputs = { owner, repo, rev, ... }@inp:
let
b = builtins;
githubMissingHashErrorText = pname: ''
Error: Cannot verify the integrity of the source of '${pname}'
It is a github reference with no hash providedand.
Solve this problem via any of the wollowing ways:
- (alternative 1): allow the use of builtin fetchers (which can verify using git rev).
```
dream2nix.buildPackage {
...
allowBuiltinFetchers = true;
...
}
```
- (alternative 2): add a hash to the source via override
```
dream2nix.buildPackage {
...
sourceOverrides = oldSources: {
"${pname}" = oldSources."${pname}".overrideAttrs (_:{
hash = "";
})
}
...
}
```
'';
in
{
@ -61,21 +30,9 @@
});
fetched = hash:
if hash == null then
b.trace "using fetchGit"
(if allowBuiltinFetchers then
builtins.fetchGit {
inherit rev;
allRefs = true;
url = "https://github.com/${owner}/${repo}";
}
else
throw githubMissingHashErrorText (inp.pname or repo))
else
b.trace "using fetchFromGithub"
fetchFromGitHub {
inherit owner repo rev hash;
};
fetchFromGitHub {
inherit owner repo rev hash;
};
};
}

View File

@ -2,8 +2,6 @@
fetchFromGitLab,
utils,
# config
allowBuiltinFetchers,
...
}:
{

View File

@ -1,7 +1,5 @@
{
utils,
# config
allowBuiltinFetchers,
...
}:
{

View File

@ -3,8 +3,6 @@
python3,
utils,
# config
allowBuiltinFetchers,
...
}:
{