Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into ca-drv
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Jun 17, 2020
2 parents 74b251b + 2954286 commit 49308ef
Show file tree
Hide file tree
Showing 139 changed files with 2,584 additions and 1,692 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ perl/Makefile.config
# /src/libstore/
*.gen.*

# /src/libutil/
/src/libutil/tests/libutil-tests

/src/nix/nix

# /src/nix-env/
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
makefiles = \
mk/precompiled-headers.mk \
local.mk \
nix-rust/local.mk \
src/libutil/local.mk \
src/libutil/tests/local.mk \
src/libstore/local.mk \
Expand Down
6 changes: 5 additions & 1 deletion doc/manual/command-ref/opt-common-syn.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<nop xmlns="http://docbook.org/ns/docbook">

<arg><option>--help</option></arg>
<arg><option>--version</option></arg>
<arg rep='repeat'>
Expand All @@ -11,6 +11,10 @@
<arg>
<arg choice='plain'><option>--quiet</option></arg>
</arg>
<arg>
<option>--log-format</option>
<replaceable>format</replaceable>
</arg>
<arg>
<group choice='plain'>
<arg choice='plain'><option>--no-build-output</option></arg>
Expand Down
31 changes: 31 additions & 0 deletions doc/manual/command-ref/opt-common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,37 @@
</varlistentry>


<varlistentry xml:id="opt-log-format"><term><option>--log-format</option> <replaceable>format</replaceable></term>

<listitem>

<para>This option can be used to change the output of the log format, with
<replaceable>format</replaceable> being one of:</para>

<variablelist>

<varlistentry><term>raw</term>
<listitem><para>This is the raw format, as outputted by nix-build.</para></listitem>
</varlistentry>

<varlistentry><term>internal-json</term>
<listitem><para>Outputs the logs in a structured manner. NOTE: the json schema is not guarantees to be stable between releases.</para></listitem>
</varlistentry>

<varlistentry><term>bar</term>
<listitem><para>Only display a progress bar during the builds.</para></listitem>
</varlistentry>

<varlistentry><term>bar-with-logs</term>
<listitem><para>Display the raw logs, with the progress bar at the bottom.</para></listitem>
</varlistentry>

</variablelist>

</listitem>

</varlistentry>

<varlistentry><term><option>--no-build-output</option> / <option>-Q</option></term>

<listitem><para>By default, output written by builders to standard
Expand Down
8 changes: 6 additions & 2 deletions maintainers/upload-release.pl
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,12 @@ sub downloadFile {
sub getStorePath {
my ($jobName) = @_;
my $buildInfo = decode_json(fetch("$evalUrl/job/$jobName", 'application/json'));
die unless $buildInfo->{buildproducts}->{1}->{type} eq "nix-build";
return $buildInfo->{buildproducts}->{1}->{path};
for my $product (values %{$buildInfo->{buildproducts}}) {
next unless $product->{type} eq "nix-build";
next if $product->{path} =~ /[a-z]+$/;
return $product->{path};
}
die;
}

write_file("$nixpkgsDir/nixos/modules/installer/tools/nix-fallback-paths.nix",
Expand Down
3 changes: 2 additions & 1 deletion mk/libraries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ define build-library
$(1)_PATH := $$(_d)/$$($(1)_NAME).a

$$($(1)_PATH): $$($(1)_OBJS) | $$(_d)/
$(trace-ar) $(AR) crs $$@ $$?
$(trace-ld) $(LD) -Ur -o $$(_d)/$$($(1)_NAME).o $$?
$(trace-ar) $(AR) crs $$@ $$(_d)/$$($(1)_NAME).o

$(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)

Expand Down
4 changes: 2 additions & 2 deletions perl/lib/Nix/Store.xs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ SV * queryReferences(char * path)
SV * queryPathHash(char * path)
PPCODE:
try {
auto s = store()->queryPathInfo(store()->parseStorePath(path))->narHash.to_string();
auto s = store()->queryPathInfo(store()->parseStorePath(path))->narHash.to_string(Base32, true);
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
} catch (Error & e) {
croak("%s", e.what());
Expand All @@ -106,7 +106,7 @@ SV * queryPathInfo(char * path, int base32)
XPUSHs(&PL_sv_undef);
else
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(*info->deriver).c_str(), 0)));
auto s = info->narHash.to_string(base32 ? Base32 : Base16);
auto s = info->narHash.to_string(base32 ? Base32 : Base16, true);
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
mXPUSHi(info->registrationTime);
mXPUSHi(info->narSize);
Expand Down
1 change: 0 additions & 1 deletion release-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ rec {
libarchive
boost
nlohmann_json
rustc cargo

# Tests
git
Expand Down
63 changes: 0 additions & 63 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,64 +12,8 @@ let
builtins.readFile ./.version
+ (if officialRelease then "" else "pre${toString nix.revCount}_${nix.shortRev}");

# Create a "vendor" directory that contains the crates listed in
# Cargo.lock. This allows Nix to be built without network access.
vendoredCrates' =
let
lockFile = builtins.fromTOML (builtins.readFile nix-rust/Cargo.lock);

files = map (pkg: import <nix/fetchurl.nix> {
url = "https://crates.io/api/v1/crates/${pkg.name}/${pkg.version}/download";
sha256 = lockFile.metadata."checksum ${pkg.name} ${pkg.version} (registry+https://github.com/rust-lang/crates.io-index)";
}) (builtins.filter (pkg: pkg.source or "" == "registry+https://github.com/rust-lang/crates.io-index") lockFile.package);

in pkgs.runCommand "cargo-vendor-dir" {}
''
mkdir -p $out/vendor
cat > $out/vendor/config <<EOF
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
EOF
${toString (builtins.map (file: ''
mkdir $out/vendor/tmp
tar xvf ${file} -C $out/vendor/tmp
dir=$(echo $out/vendor/tmp/*)
# Add just enough metadata to keep Cargo happy.
printf '{"files":{},"package":"${file.outputHash}"}' > "$dir/.cargo-checksum.json"
# Clean up some cruft from the winapi crates. FIXME: find
# a way to remove winapi* from our dependencies.
if [[ $dir =~ /winapi ]]; then
find $dir -name "*.a" -print0 | xargs -0 rm -f --
fi
mv "$dir" $out/vendor/
rm -rf $out/vendor/tmp
'') files)}
'';

jobs = rec {

vendoredCrates =
with pkgs;
runCommand "vendored-crates" {}
''
mkdir -p $out/nix-support
name=nix-vendored-crates-${version}
fn=$out/$name.tar.xz
tar cvfJ $fn -C ${vendoredCrates'} vendor \
--owner=0 --group=0 --mode=u+rw,uga+r \
--transform "s,vendor,$name,"
echo "file crates-tarball $fn" >> $out/nix-support/hydra-build-products
'';

build = pkgs.lib.genAttrs systems (system:

let pkgs = import nixpkgs { inherit system; }; in
Expand Down Expand Up @@ -101,8 +45,6 @@ let
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
''}
ln -sfn ${vendoredCrates'}/vendor/ nix-rust/vendor
(cd perl; autoreconf --install --force --verbose)
'';

Expand Down Expand Up @@ -247,11 +189,6 @@ let

src = nix;

preConfigure =
''
ln -sfn ${vendoredCrates'}/vendor/ nix-rust/vendor
'';

enableParallelBuilding = true;

buildInputs = buildDeps ++ propagatedDeps;
Expand Down
11 changes: 7 additions & 4 deletions src/build-remote/build-remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,12 @@ static int _main(int argc, char * * argv)

} catch (std::exception & e) {
auto msg = chomp(drainFD(5, false));
printError("cannot build on '%s': %s%s",
bestMachine->storeUri, e.what(),
(msg.empty() ? "" : ": " + msg));
logError({
.name = "Remote build",
.hint = hintfmt("cannot build on '%s': %s%s",
bestMachine->storeUri, e.what(),
(msg.empty() ? "" : ": " + msg))
});
bestMachine->enabled = false;
continue;
}
Expand Down Expand Up @@ -241,7 +244,7 @@ static int _main(int argc, char * * argv)

uploadLock = -1;

BasicDerivation drv(readDerivation(*store, store->realStoreDir + "/" + std::string(drvPath->to_string())));
auto drv = store->readDerivation(*drvPath);
drv.inputSrcs = store->parseStorePathSet(inputs);

auto result = sshStore->buildDerivation(*drvPath, drv);
Expand Down
66 changes: 0 additions & 66 deletions src/error-demo/error-demo.cc

This file was deleted.

12 changes: 0 additions & 12 deletions src/error-demo/local.mk

This file was deleted.

16 changes: 8 additions & 8 deletions src/libexpr/attr-path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static Strings parseAttrPath(const string & s)
++i;
while (1) {
if (i == s.end())
throw Error(format("missing closing quote in selection path '%1%'") % s);
throw Error("missing closing quote in selection path '%1%'", s);
if (*i == '"') break;
cur.push_back(*i++);
}
Expand Down Expand Up @@ -60,11 +60,11 @@ std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attr

if (v->type != tAttrs)
throw TypeError(
format("the expression selected by the selection path '%1%' should be a set but is %2%")
% attrPath % showType(*v));

"the expression selected by the selection path '%1%' should be a set but is %2%",
attrPath,
showType(*v));
if (attr.empty())
throw Error(format("empty attribute name in selection path '%1%'") % attrPath);
throw Error("empty attribute name in selection path '%1%'", attrPath);

Bindings::iterator a = v->attrs->find(state.symbols.create(attr));
if (a == v->attrs->end())
Expand All @@ -77,9 +77,9 @@ std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attr

if (!v->isList())
throw TypeError(
format("the expression selected by the selection path '%1%' should be a list but is %2%")
% attrPath % showType(*v));

"the expression selected by the selection path '%1%' should be a list but is %2%",
attrPath,
showType(*v));
if (attrIndex >= v->listSize())
throw AttrPathNotFound("list index %1% in selection path '%2%' is out of range", attrIndex, attrPath);

Expand Down
6 changes: 5 additions & 1 deletion src/libexpr/attr-set.hh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public:
{
auto a = get(name);
if (!a)
throw Error("attribute '%s' missing, at %s", name, pos);
throw Error({
.hint = hintfmt("attribute '%s' missing", name),
.nixCode = NixCode { .errPos = pos }
});

return *a;
}

Expand Down
Loading

0 comments on commit 49308ef

Please sign in to comment.