mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
* Maintain integrity of the substitute and successor mappings when
deleting a path in the store. * Allow absolute paths in Nix expressions. * Get nix-prefetch-url to work again. * Various other fixes.
This commit is contained in:
parent
40d9eb14df
commit
ab0bc4999a
15 changed files with 152 additions and 199 deletions
|
@ -1,10 +1,11 @@
|
||||||
all-local: fetchurl.sh
|
all-local: builder.sh
|
||||||
|
|
||||||
install-exec-local:
|
install-exec-local:
|
||||||
$(INSTALL) -d $(datadir)/fix/fetchurl
|
$(INSTALL) -d $(datadir)/nix/corepkgs
|
||||||
$(INSTALL_DATA) fetchurl.fix $(datadir)/fix/fetchurl
|
$(INSTALL) -d $(datadir)/nix/corepkgs/fetchurl
|
||||||
$(INSTALL_PROGRAM) fetchurl.sh $(datadir)/fix/fetchurl
|
$(INSTALL_DATA) default.nix $(datadir)/nix/corepkgs/fetchurl
|
||||||
|
$(INSTALL_PROGRAM) builder.sh $(datadir)/nix/corepkgs/fetchurl
|
||||||
|
|
||||||
include ../../substitute.mk
|
include ../../substitute.mk
|
||||||
|
|
||||||
EXTRA_DIST = fetchurl.fix fetchurl.sh.in
|
EXTRA_DIST = default.nix builder.sh.in
|
||||||
|
|
8
corepkgs/fetchurl/default.nix
Normal file
8
corepkgs/fetchurl/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{system, url, md5}: derivation {
|
||||||
|
name = baseNameOf (toString url);
|
||||||
|
system = system;
|
||||||
|
builder = ./builder.sh;
|
||||||
|
url = url;
|
||||||
|
md5 = md5;
|
||||||
|
id = md5;
|
||||||
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
Function(["url", "md5"],
|
|
||||||
Package(
|
|
||||||
[ ("build", Relative("fetchurl/fetchurl.sh"))
|
|
||||||
, ("url", Var("url"))
|
|
||||||
, ("md5", Var("md5"))
|
|
||||||
, ("name", BaseName(Var("url")))
|
|
||||||
, ("id", Var("md5"))
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
|
@ -1,4 +1,4 @@
|
||||||
bin_SCRIPTS = nix-switch nix-collect-garbage \
|
bin_SCRIPTS = nix-collect-garbage \
|
||||||
nix-pull nix-push nix-prefetch-url
|
nix-pull nix-push nix-prefetch-url
|
||||||
|
|
||||||
noinst_SCRIPTS = nix-profile.sh
|
noinst_SCRIPTS = nix-profile.sh
|
||||||
|
|
|
@ -22,27 +22,29 @@ print "file has hash $hash\n";
|
||||||
my $out2 = "@prefix@/store/nix-prefetch-url-$hash";
|
my $out2 = "@prefix@/store/nix-prefetch-url-$hash";
|
||||||
rename $out, $out2;
|
rename $out, $out2;
|
||||||
|
|
||||||
# Create a Fix expression.
|
# Create a Nix expression.
|
||||||
my $fixexpr =
|
my $nixexpr =
|
||||||
"App(IncludeFix(\"fetchurl/fetchurl.fix\"), " .
|
"(import @datadir@/nix/corepkgs/fetchurl) " .
|
||||||
"[(\"url\", \"$url\"), (\"md5\", \"$hash\")])";
|
"{url = $url; md5 = \"$hash\"; system = \"@host@\"}";
|
||||||
|
|
||||||
|
print "expr: $nixexpr\n";
|
||||||
|
|
||||||
# Instantiate a Nix expression.
|
# Instantiate a Nix expression.
|
||||||
print STDERR "running fix...\n";
|
print STDERR "instantiating Nix expression...\n";
|
||||||
my $pid = open2(\*READ, \*WRITE, "fix -") or die "cannot run fix";
|
my $pid = open2(\*READ, \*WRITE, "nix-instantiate -") or die "cannot run nix-instantiate";
|
||||||
|
|
||||||
print WRITE $fixexpr;
|
print WRITE $nixexpr;
|
||||||
close WRITE;
|
close WRITE;
|
||||||
|
|
||||||
my $id = <READ>;
|
my $drvpath = <READ>;
|
||||||
chomp $id;
|
chomp $drvpath;
|
||||||
|
|
||||||
waitpid $pid, 0;
|
waitpid $pid, 0;
|
||||||
$? == 0 or die "fix failed";
|
$? == 0 or die "nix-instantiate failed";
|
||||||
|
|
||||||
# Run Nix.
|
# Run Nix.
|
||||||
print STDERR "running nix...\n";
|
print STDERR "realising store expression $drvpath...\n";
|
||||||
system "nix --install $id > /dev/null";
|
system "nix-store --realise $drvpath > /dev/null";
|
||||||
$? == 0 or die "`nix --install' failed";
|
$? == 0 or die "realisation failed";
|
||||||
|
|
||||||
unlink $out2;
|
unlink $out2;
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
#! /usr/bin/perl -w
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
my $keep = 0;
|
|
||||||
my $sourceroot = 1;
|
|
||||||
my $name = "current";
|
|
||||||
my $srcid;
|
|
||||||
|
|
||||||
my $argnr = 0;
|
|
||||||
while ($argnr < scalar @ARGV) {
|
|
||||||
my $arg = $ARGV[$argnr++];
|
|
||||||
if ($arg eq "--keep") { $keep = 1; }
|
|
||||||
elsif ($arg eq "--no-source") { $sourceroot = 0; }
|
|
||||||
elsif ($arg eq "--name") { $name = $ARGV[$argnr++]; }
|
|
||||||
elsif ($arg =~ /^\//) { $srcid = $arg; }
|
|
||||||
else { die "unknown argument `$arg'" };
|
|
||||||
}
|
|
||||||
|
|
||||||
my $linkdir = "@localstatedir@/nix/links";
|
|
||||||
|
|
||||||
# Build the specified package, and all its dependencies.
|
|
||||||
my $nfid = `nix --install $srcid`;
|
|
||||||
if ($?) { die "`nix --install' failed"; }
|
|
||||||
chomp $nfid;
|
|
||||||
die unless $nfid =~ /^\//;
|
|
||||||
|
|
||||||
my $pkgdir = `nix --query --list $nfid`;
|
|
||||||
if ($?) { die "`nix --query --list' failed"; }
|
|
||||||
chomp $pkgdir;
|
|
||||||
|
|
||||||
# Figure out a generation number.
|
|
||||||
opendir(DIR, $linkdir);
|
|
||||||
my $nr = 0;
|
|
||||||
foreach my $n (sort(readdir(DIR))) {
|
|
||||||
next if (!($n =~ /^\d+$/));
|
|
||||||
$nr = $n + 1 if ($n >= $nr);
|
|
||||||
}
|
|
||||||
closedir(DIR);
|
|
||||||
|
|
||||||
my $link = "$linkdir/$nr";
|
|
||||||
|
|
||||||
# Create a symlink from $link to $pkgdir.
|
|
||||||
symlink($pkgdir, $link) or die "cannot create $link: $!";
|
|
||||||
|
|
||||||
# Store the id of the normal form. This is useful for garbage
|
|
||||||
# collection and the like.
|
|
||||||
my $idfile = "$linkdir/$nr.id";
|
|
||||||
open ID, "> $idfile" or die "cannot create $idfile";
|
|
||||||
print ID "$nfid\n";
|
|
||||||
close ID;
|
|
||||||
|
|
||||||
# Optionally store the source id.
|
|
||||||
if ($sourceroot) {
|
|
||||||
$idfile = "$linkdir/$nr-src.id";
|
|
||||||
open ID, "> $idfile" or die "cannot create $idfile";
|
|
||||||
print ID "$srcid\n";
|
|
||||||
close ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $current = "$linkdir/$name";
|
|
||||||
|
|
||||||
# Read the current generation so that we can delete it (if --keep
|
|
||||||
# wasn't specified).
|
|
||||||
my $oldlink = readlink($current);
|
|
||||||
|
|
||||||
# Make $link the current generation by pointing $linkdir/current to
|
|
||||||
# it. The rename() system call is supposed to be essentially atomic
|
|
||||||
# on Unix. That is, if we have links `current -> X' and `new_current
|
|
||||||
# -> Y', and we rename new_current to current, a process accessing
|
|
||||||
# current will see X or Y, but never a file-not-found or other error
|
|
||||||
# condition. This is sufficient to atomically switch the current link
|
|
||||||
# tree.
|
|
||||||
|
|
||||||
print "switching $current to $link\n";
|
|
||||||
|
|
||||||
my $tmplink = "$linkdir/.new_$name";
|
|
||||||
symlink($link, $tmplink) or die "cannot create $tmplink";
|
|
||||||
rename($tmplink, $current) or die "cannot rename $tmplink";
|
|
||||||
|
|
||||||
if (!$keep && defined $oldlink) {
|
|
||||||
print "deleting old $oldlink\n";
|
|
||||||
unlink($oldlink) == 1 or print "cannot delete $oldlink\n";
|
|
||||||
unlink("$oldlink.id") == 1 or print "cannot delete $oldlink.id\n";
|
|
||||||
unlink("$oldlink-src.id");
|
|
||||||
}
|
|
|
@ -104,6 +104,7 @@ exports
|
||||||
"\"" ~[\n\"]* "\"" -> Str
|
"\"" ~[\n\"]* "\"" -> Str
|
||||||
|
|
||||||
PathComp ("/" PathComp)+ -> Path
|
PathComp ("/" PathComp)+ -> Path
|
||||||
|
("/" PathComp)+ -> Path
|
||||||
[a-zA-Z0-9\.\_\-\+]+ -> PathComp
|
[a-zA-Z0-9\.\_\-\+]+ -> PathComp
|
||||||
|
|
||||||
"true" -> Bool
|
"true" -> Bool
|
||||||
|
@ -184,7 +185,7 @@ exports
|
||||||
[0-9] -> Udigit
|
[0-9] -> Udigit
|
||||||
|
|
||||||
lexical restrictions
|
lexical restrictions
|
||||||
Uri -/- [a-zA-Z0-9\-\_\.\!\~\*\'\(\)]
|
Uri -/- [a-zA-Z0-9\-\_\.\!\~\*\'\(\)\/]
|
||||||
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -66,23 +66,9 @@ struct Cleanup : TermFun
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Expr parseExprFromFile(Path path)
|
static Expr parse(const char * text, const string & location,
|
||||||
|
const Path & basePath)
|
||||||
{
|
{
|
||||||
assert(path[0] == '/');
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Perhaps this is already an imploded parse tree? */
|
|
||||||
Expr e = ATreadFromNamedFile(path.c_str());
|
|
||||||
if (e) return e;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If `path' refers to a directory, append `/default.nix'. */
|
|
||||||
struct stat st;
|
|
||||||
if (stat(path.c_str(), &st))
|
|
||||||
throw SysError(format("getting status of `%1%'") % path);
|
|
||||||
if (S_ISDIR(st.st_mode))
|
|
||||||
path = canonPath(path + "/default.nix");
|
|
||||||
|
|
||||||
/* Initialise the SDF libraries. */
|
/* Initialise the SDF libraries. */
|
||||||
static bool initialised = false;
|
static bool initialised = false;
|
||||||
static ATerm parseTable = 0;
|
static ATerm parseTable = 0;
|
||||||
|
@ -113,26 +99,13 @@ Expr parseExprFromFile(Path path)
|
||||||
initialised = true;
|
initialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the input file. We can't use SGparseFile() because it's
|
|
||||||
broken, so we read the input ourselves and call
|
|
||||||
SGparseString(). */
|
|
||||||
AutoCloseFD fd = open(path.c_str(), O_RDONLY);
|
|
||||||
if (fd == -1) throw SysError(format("opening `%1%'") % path);
|
|
||||||
|
|
||||||
if (fstat(fd, &st) == -1)
|
|
||||||
throw SysError(format("statting `%1%'") % path);
|
|
||||||
|
|
||||||
char text[st.st_size + 1];
|
|
||||||
readFull(fd, (unsigned char *) text, st.st_size);
|
|
||||||
text[st.st_size] = 0;
|
|
||||||
|
|
||||||
/* Parse it. */
|
/* Parse it. */
|
||||||
ATerm result = SGparseString(lang, "Expr", text);
|
ATerm result = SGparseString(lang, "Expr", (char *) text);
|
||||||
if (!result)
|
if (!result)
|
||||||
throw SysError(format("parse failed in `%1%'") % path);
|
throw SysError(format("parse failed in `%1%'") % location);
|
||||||
if (SGisParseError(result))
|
if (SGisParseError(result))
|
||||||
throw Error(format("parse error in `%1%': %2%")
|
throw Error(format("parse error in `%1%': %2%")
|
||||||
% path % result);
|
% location % result);
|
||||||
|
|
||||||
/* Implode it. */
|
/* Implode it. */
|
||||||
PT_ParseTree tree = PT_makeParseTreeFromTerm(result);
|
PT_ParseTree tree = PT_makeParseTreeFromTerm(result);
|
||||||
|
@ -155,10 +128,50 @@ Expr parseExprFromFile(Path path)
|
||||||
throw Error(format("cannot implode parse tree"));
|
throw Error(format("cannot implode parse tree"));
|
||||||
|
|
||||||
printMsg(lvlVomit, format("imploded parse tree of `%1%': %2%")
|
printMsg(lvlVomit, format("imploded parse tree of `%1%': %2%")
|
||||||
% path % imploded);
|
% location % imploded);
|
||||||
|
|
||||||
/* Finally, clean it up. */
|
/* Finally, clean it up. */
|
||||||
Cleanup cleanup;
|
Cleanup cleanup;
|
||||||
cleanup.basePath = dirOf(path);
|
cleanup.basePath = basePath;
|
||||||
return bottomupRewrite(cleanup, imploded);
|
return bottomupRewrite(cleanup, imploded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Expr parseExprFromFile(Path path)
|
||||||
|
{
|
||||||
|
assert(path[0] == '/');
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Perhaps this is already an imploded parse tree? */
|
||||||
|
Expr e = ATreadFromNamedFile(path.c_str());
|
||||||
|
if (e) return e;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If `path' refers to a directory, append `/default.nix'. */
|
||||||
|
struct stat st;
|
||||||
|
if (stat(path.c_str(), &st))
|
||||||
|
throw SysError(format("getting status of `%1%'") % path);
|
||||||
|
if (S_ISDIR(st.st_mode))
|
||||||
|
path = canonPath(path + "/default.nix");
|
||||||
|
|
||||||
|
/* Read the input file. We can't use SGparseFile() because it's
|
||||||
|
broken, so we read the input ourselves and call
|
||||||
|
SGparseString(). */
|
||||||
|
AutoCloseFD fd = open(path.c_str(), O_RDONLY);
|
||||||
|
if (fd == -1) throw SysError(format("opening `%1%'") % path);
|
||||||
|
|
||||||
|
if (fstat(fd, &st) == -1)
|
||||||
|
throw SysError(format("statting `%1%'") % path);
|
||||||
|
|
||||||
|
char text[st.st_size + 1];
|
||||||
|
readFull(fd, (unsigned char *) text, st.st_size);
|
||||||
|
text[st.st_size] = 0;
|
||||||
|
|
||||||
|
return parse(text, path, dirOf(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Expr parseExprFromString(const string & s, const Path & basePath)
|
||||||
|
{
|
||||||
|
return parse(s.c_str(), "(string)", basePath);
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,13 @@
|
||||||
#include "nixexpr.hh"
|
#include "nixexpr.hh"
|
||||||
|
|
||||||
|
|
||||||
|
/* Parse a Nix expression from the specified file. If `path' refers
|
||||||
|
to a directory, the "/default.nix" is appended. */
|
||||||
Expr parseExprFromFile(Path path);
|
Expr parseExprFromFile(Path path);
|
||||||
|
|
||||||
|
/* Parse a Nix expression from the specified string. */
|
||||||
|
Expr parseExprFromString(const string & s,
|
||||||
|
const Path & basePath);
|
||||||
|
|
||||||
|
|
||||||
#endif /* !__PARSER_H */
|
#endif /* !__PARSER_H */
|
||||||
|
|
|
@ -82,6 +82,7 @@ Path normaliseStoreExpr(const Path & _nePath, PathSet pending)
|
||||||
debug(format("skipping build of expression `%1%', someone beat us to it")
|
debug(format("skipping build of expression `%1%', someone beat us to it")
|
||||||
% (string) nePath);
|
% (string) nePath);
|
||||||
if (ne.type != StoreExpr::neClosure) abort();
|
if (ne.type != StoreExpr::neClosure) abort();
|
||||||
|
outputLocks.setDeletion(true);
|
||||||
return nePath2;
|
return nePath2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,16 +243,33 @@ bool isValidPath(const Path & path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void unregisterValidPath(const Path & _path)
|
static void invalidatePath(const Path & path, Transaction & txn)
|
||||||
{
|
{
|
||||||
Path path(canonPath(_path));
|
|
||||||
Transaction txn(nixDB);
|
|
||||||
|
|
||||||
debug(format("unregistering path `%1%'") % path);
|
debug(format("unregistering path `%1%'") % path);
|
||||||
|
|
||||||
nixDB.delPair(txn, dbValidPaths, path);
|
nixDB.delPair(txn, dbValidPaths, path);
|
||||||
|
|
||||||
txn.commit();
|
/* Remove any successor mappings to this path (but not *from*
|
||||||
|
it). */
|
||||||
|
Paths revs;
|
||||||
|
nixDB.queryStrings(txn, dbSuccessorsRev, path, revs);
|
||||||
|
for (Paths::iterator i = revs.begin(); i != revs.end(); ++i)
|
||||||
|
nixDB.delPair(txn, dbSuccessors, *i);
|
||||||
|
nixDB.delPair(txn, dbSuccessorsRev, path);
|
||||||
|
|
||||||
|
/* Remove any substitute mappings to this path. */
|
||||||
|
revs.clear();
|
||||||
|
nixDB.queryStrings(txn, dbSubstitutesRev, path, revs);
|
||||||
|
for (Paths::iterator i = revs.begin(); i != revs.end(); ++i) {
|
||||||
|
Paths subs;
|
||||||
|
nixDB.queryStrings(txn, dbSubstitutes, *i, subs);
|
||||||
|
remove(subs.begin(), subs.end(), path);
|
||||||
|
if (subs.size() > 0)
|
||||||
|
nixDB.setStrings(txn, dbSubstitutes, *i, subs);
|
||||||
|
else
|
||||||
|
nixDB.delPair(txn, dbSubstitutes, *i);
|
||||||
|
}
|
||||||
|
nixDB.delPair(txn, dbSubstitutesRev, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -289,6 +306,8 @@ Path addToStore(const Path & _srcPath)
|
||||||
registerValidPath(txn, dstPath);
|
registerValidPath(txn, dstPath);
|
||||||
txn.commit();
|
txn.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outputLock.setDeletion(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dstPath;
|
return dstPath;
|
||||||
|
@ -310,6 +329,8 @@ void addTextToStore(const Path & dstPath, const string & s)
|
||||||
registerValidPath(txn, dstPath);
|
registerValidPath(txn, dstPath);
|
||||||
txn.commit();
|
txn.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outputLock.setDeletion(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +342,9 @@ void deleteFromStore(const Path & _path)
|
||||||
if (!isInPrefix(path, nixStore))
|
if (!isInPrefix(path, nixStore))
|
||||||
throw Error(format("path `%1%' is not in the store") % path);
|
throw Error(format("path `%1%' is not in the store") % path);
|
||||||
|
|
||||||
unregisterValidPath(path);
|
Transaction txn(nixDB);
|
||||||
|
invalidatePath(path, txn);
|
||||||
|
txn.commit();
|
||||||
|
|
||||||
deletePath(path);
|
deletePath(path);
|
||||||
}
|
}
|
||||||
|
@ -332,50 +355,43 @@ void verifyStore()
|
||||||
Transaction txn(nixDB);
|
Transaction txn(nixDB);
|
||||||
|
|
||||||
Paths paths;
|
Paths paths;
|
||||||
|
PathSet validPaths;
|
||||||
nixDB.enumTable(txn, dbValidPaths, paths);
|
nixDB.enumTable(txn, dbValidPaths, paths);
|
||||||
|
|
||||||
for (Paths::iterator i = paths.begin();
|
for (Paths::iterator i = paths.begin(); i != paths.end(); ++i)
|
||||||
i != paths.end(); i++)
|
|
||||||
{
|
{
|
||||||
Path path = *i;
|
Path path = *i;
|
||||||
if (!pathExists(path)) {
|
if (!pathExists(path)) {
|
||||||
debug(format("path `%1%' disappeared") % path);
|
debug(format("path `%1%' disappeared") % path);
|
||||||
nixDB.delPair(txn, dbValidPaths, path);
|
invalidatePath(path, txn);
|
||||||
nixDB.delPair(txn, dbSuccessorsRev, path);
|
} else
|
||||||
nixDB.delPair(txn, dbSubstitutesRev, path);
|
validPaths.insert(path);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
Paths sucs;
|
||||||
Strings subs;
|
nixDB.enumTable(txn, dbSuccessors, sucs);
|
||||||
nixDB.enumTable(txn, dbSubstitutes, subs);
|
for (Paths::iterator i = sucs.begin(); i != sucs.end(); ++i) {
|
||||||
|
/* Note that *i itself does not have to be valid, just its
|
||||||
for (Strings::iterator i = subs.begin();
|
successor. */
|
||||||
i != subs.end(); i++)
|
Path sucPath;
|
||||||
{
|
if (nixDB.queryString(txn, dbSuccessors, *i, sucPath) &&
|
||||||
FSId srcId = parseHash(*i);
|
validPaths.find(sucPath) == validPaths.end())
|
||||||
|
|
||||||
Strings subIds;
|
|
||||||
nixDB.queryStrings(txn, dbSubstitutes, srcId, subIds);
|
|
||||||
|
|
||||||
for (Strings::iterator j = subIds.begin();
|
|
||||||
j != subIds.end(); )
|
|
||||||
{
|
{
|
||||||
FSId subId = parseHash(*j);
|
debug(format("found successor mapping to non-existent path `%1%'") % sucPath);
|
||||||
|
nixDB.delPair(txn, dbSuccessors, *i);
|
||||||
Strings subPaths;
|
|
||||||
nixDB.queryStrings(txn, dbId2Paths, subId, subPaths);
|
|
||||||
if (subPaths.size() == 0) {
|
|
||||||
debug(format("erasing substitute %1% for %2%")
|
|
||||||
% (string) subId % (string) srcId);
|
|
||||||
j = subIds.erase(j);
|
|
||||||
} else j++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nixDB.setStrings(txn, dbSubstitutes, srcId, subIds);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
Paths rsucs;
|
||||||
|
nixDB.enumTable(txn, dbSuccessorsRev, rsucs);
|
||||||
|
for (Paths::iterator i = rsucs.begin(); i != rsucs.end(); ++i) {
|
||||||
|
if (validPaths.find(*i) == validPaths.end()) {
|
||||||
|
debug(format("found reverse successor mapping for non-existent path `%1%'") % *i);
|
||||||
|
nixDB.delPair(txn, dbSuccessorsRev, *i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
Paths sucs;
|
Paths sucs;
|
||||||
nixDB.enumTable(txn, dbSuccessors, sucs);
|
nixDB.enumTable(txn, dbSuccessors, sucs);
|
||||||
|
|
||||||
|
@ -395,6 +411,7 @@ void verifyStore()
|
||||||
nixDB.setStrings(txn, dbSuccessorsRev, sucPath, revs);
|
nixDB.setStrings(txn, dbSuccessorsRev, sucPath, revs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,6 @@ Paths querySubstitutes(const Path & srcPath);
|
||||||
/* Register the validity of a path. */
|
/* Register the validity of a path. */
|
||||||
void registerValidPath(const Transaction & txn, const Path & path);
|
void registerValidPath(const Transaction & txn, const Path & path);
|
||||||
|
|
||||||
/* Unregister the validity of a path. */
|
|
||||||
void unregisterValidPath(const Path & path);
|
|
||||||
|
|
||||||
/* Checks whether a path is valid. */
|
/* Checks whether a path is valid. */
|
||||||
bool isValidPath(const Path & path);
|
bool isValidPath(const Path & path);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "normalise.hh"
|
#include "normalise.hh"
|
||||||
#include "shared.hh"
|
#include "shared.hh"
|
||||||
#include "eval.hh"
|
#include "eval.hh"
|
||||||
|
#include "parser.hh"
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -29,9 +30,9 @@ static Path searchPath(const Paths & searchDirs, const Path & relPath)
|
||||||
static Expr evalStdin(EvalState & state)
|
static Expr evalStdin(EvalState & state)
|
||||||
{
|
{
|
||||||
startNest(nest, lvlTalkative, format("evaluating standard input"));
|
startNest(nest, lvlTalkative, format("evaluating standard input"));
|
||||||
Expr e = ATreadFromFile(stdin);
|
string s, s2;
|
||||||
if (!e)
|
while (getline(cin, s2)) s += s2 + "\n";
|
||||||
throw Error(format("unable to read a term from stdin"));
|
Expr e = parseExprFromString(s, absPath("."));
|
||||||
return evalExpr(state, e);
|
return evalExpr(state, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
%: %.in Makefile
|
%: %.in Makefile
|
||||||
sed \
|
sed \
|
||||||
-e s^@prefix\@^$(prefix)^g \
|
-e "s^@prefix\@^$(prefix)^g" \
|
||||||
-e s^@bindir\@^$(bindir)^g \
|
-e "s^@bindir\@^$(bindir)^g" \
|
||||||
-e s^@sysconfdir\@^$(sysconfdir)^g \
|
-e "s^@sysconfdir\@^$(sysconfdir)^g" \
|
||||||
-e s^@localstatedir\@^$(localstatedir)^g \
|
-e "s^@localstatedir\@^$(localstatedir)^g" \
|
||||||
-e s^@wget\@^$(wget)^g \
|
-e "s^@datadir\@^$(datadir)^g" \
|
||||||
|
-e "s^@host\@^$(host)^g" \
|
||||||
|
-e "s^@wget\@^$(wget)^g" \
|
||||||
< $< > $@ || rm $@
|
< $< > $@ || rm $@
|
||||||
chmod +x $@
|
chmod +x $@
|
||||||
|
|
Loading…
Reference in a new issue