From c0dceea9f03c54418139b864b426dd36ad5956c7 Mon Sep 17 00:00:00 2001 From: Wouter den Breejen Date: Mon, 22 Oct 2007 13:22:56 +0000 Subject: [PATCH] --- doc/manual/writing-nix-expressions.xml | 16 +++++-- install_install_d.sh | 16 +++++++ mergeTrunkBackIn.sh | 25 +++++++++++ restartDaemon.sh | 9 ++++ scripts/download-using-manifests.pl.in | 2 - scripts/nix-copy-closure.in | 2 +- src/libstore/build.cc | 2 +- src/libstore/local-store.cc | 14 +----- src/libstore/store-state.cc | 60 ++++++++------------------ src/nix-env/help.txt | 2 +- src/nix-state/nix-state.cc | 5 ++- startNixosDaemon.sh | 6 +++ 12 files changed, 95 insertions(+), 64 deletions(-) create mode 100755 install_install_d.sh create mode 100755 mergeTrunkBackIn.sh create mode 100755 restartDaemon.sh create mode 100755 startNixosDaemon.sh diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml index 01194d4c6..ce6c1f4ad 100644 --- a/doc/manual/writing-nix-expressions.xml +++ b/doc/manual/writing-nix-expressions.xml @@ -526,7 +526,15 @@ genericBuild bin subdirectory, it's added to PATH; if it has a include subdirectory, it's added to GCC's header search path; and so - on. + on.How does it work? setup + tries to source the file + pkg/nix-support/setup-hook + of all dependencies. These “setup hooks” can then set up whatever + environment variables they want; for instance, the setup hook for + Perl sets the PERL5LIB environment variable to + contain the lib/site_perl directories of all + inputs. + @@ -1217,9 +1225,9 @@ set, the attributes of which specify the inputs of the build. They are simply concatenated, separated by spaces. - true is passed as - 1, false - and null are passed as empty string. + true is passed as the string + 1, false and + null are passed as an empty string. diff --git a/install_install_d.sh b/install_install_d.sh new file mode 100755 index 000000000..c3fb68464 --- /dev/null +++ b/install_install_d.sh @@ -0,0 +1,16 @@ +#! /bin/sh -e + +if [ $(whoami) = "root" ] +then + +su - wouterdb -c "cd /home/wouterdb/dev/nix-state/; make" +make install +chown -R wouterdb.wouterdb /nixstate2/nix/ + +./restartDaemon.sh + +else + echo "You must be ROOT to run this script." + exit 0 +fi + diff --git a/mergeTrunkBackIn.sh b/mergeTrunkBackIn.sh new file mode 100755 index 000000000..45b57d888 --- /dev/null +++ b/mergeTrunkBackIn.sh @@ -0,0 +1,25 @@ +svn merge -r 9476:9506 https://svn.cs.uu.nl:12443/repos/trace/nix/trunk + +#already done: +# 8628 +# 8632 +# 8634 +# 8636 +# 8655 +# 8691 +# 8698 +# 8711 +# 8864 +# 9063 +# 9105 +# 9207 +# 9217 +# 9332 +# 9429 +# 9433 +# 9435 +# 9437 +# 9439 +# 9445 +# 9476 +# 9506 diff --git a/restartDaemon.sh b/restartDaemon.sh new file mode 100755 index 000000000..1c9b728ad --- /dev/null +++ b/restartDaemon.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +initctl stop nix-daemon +killproc.sh nix-worker +sleep 2 + +#/nixstate2/nix/bin/nix-worker --daemon > /dev/null 2>&1 & +/nixstate2/nix/bin/nix-worker --daemon +#gdb --args /nixstate2/nix/bin/nix-worker --daemon diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in index b4b7fac03..6014ab462 100644 --- a/scripts/download-using-manifests.pl.in +++ b/scripts/download-using-manifests.pl.in @@ -19,8 +19,6 @@ chdir $tmpDir or die "cannot change to `$tmpDir': $!"; my $tmpNar = "$tmpDir/nar"; my $tmpNar2 = "$tmpDir/nar2"; -END { unlink $tmpNar; unlink $tmpNar2; rmdir $tmpDir; } - # Load all manifests. my %narFiles; diff --git a/scripts/nix-copy-closure.in b/scripts/nix-copy-closure.in index 1b1b3ebc8..0fa4e870f 100644 --- a/scripts/nix-copy-closure.in +++ b/scripts/nix-copy-closure.in @@ -6,7 +6,7 @@ $binDir = "@bindir@" unless defined $binDir; if (scalar @ARGV < 1) { print STDERR <second.begin(); j != i->second.end(); ++j) if (inDrv.outputs.find(*j) != inDrv.outputs.end()){ computeFSClosure(inDrv.outputs[*j].path, inputPaths, true, false, 0); //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!! WE (MAY) ALSO NEED TO COPY STATE (done?) - computeFSClosure(inDrv.outputs[*j].path, inputStatePaths, false, true, 0); //TODO!!!!!!!!!!!!! HOW CAN THESE PATHS ALREADY BE VALID ..... ????????????????????? + computeFSClosure(inDrv.outputs[*j].path, inputStatePaths, false, true, 0); } else throw BuildError( diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index c91416baf..807be2c46 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -94,13 +94,12 @@ static TableId dbDerivers = 0; */ static TableId dbStateCounters = 0; -/* dbStateInfo :: Path -> +/* dbStateInfo :: StorePath -> [(StatePath, identifier, username)] * * This table lists all the store components, that are state-store components * meaning that this component has a /nix/state/ entry to store its state * and thus this component (should) have a reference to that state path * - * TODO the value is now empty but we could store the entire DRV in here in the future */ static TableId dbStateInfo = 0; @@ -133,17 +132,8 @@ static TableId dbStateRevisionsComments = 0; * * /nix/state/HASH-A-1.0-test-KEY-1185473750 * --> - * [ 1185473750, 00118547375 ] // TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PATH-SS + * [ (statePath/log, 1185473750), (statePath/output.dat, 1185473751) ] * - * The timestamps are ordered based on the path of the subfolder !! - * - * So if a has: - * - * /nix/state/....A../log - * /nix/state/....A../cache - * - * then ./cache has TS 1185473750 - * and ./log has TS 00118547375 * */ static TableId dbStateSnapshots = 0; diff --git a/src/libstore/store-state.cc b/src/libstore/store-state.cc index 2a6c97b0e..c448b557d 100644 --- a/src/libstore/store-state.cc +++ b/src/libstore/store-state.cc @@ -132,16 +132,10 @@ void revertToRevisionTxn(const Transaction & txn, const Path & statePath, const //Dir: Remove a slash at the end, we create /nix/state/...../cachedir@1234/ //File: Or create /nix/state/..../logfile.txt@1234 string revertPathOrFile_e; - if(revertPathOrFile.substr(revertPathOrFile.length() -1 , revertPathOrFile.length()) == "/"){ + if(revertPathOrFile.substr(revertPathOrFile.length() -1 , revertPathOrFile.length()) == "/") revertPathOrFile_e = revertPathOrFile.substr(0 , revertPathOrFile.length() -1) + "@" + unsignedInt2String(epoch) + "/"; - - //TODO IF IS FILE: REMOVE THE FILE todo MOVE THIS INTO RSYNCPATHS??? - } - else{ + else revertPathOrFile_e = revertPathOrFile + "@" + unsignedInt2String(epoch); - - //TODO IF IS DIR: REMOVE THE DIR - } rsyncPaths(revertPathOrFile_e, revertPathOrFile, false); } @@ -235,7 +229,6 @@ Snapshots commitStatePathTxn(const Transaction & txn, const Path & statePath) } //TODO include this call in the validate function -//TODO ONLY CALL THIS FUNCTION ON A NON-SHARED STATE PATH!!!!!!!!!!! void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePath , PathSet & newFoundComponentReferences, PathSet & newFoundStateReferences) //only for recursion { @@ -245,10 +238,8 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa //printMsg(lvlError, format("scanAndUpdateAllReferencesTxn: '%1%' - %2%") % statePath % revision); - //TODO check if path is not a shared path ! - //TODO - //TODO Unshare the path: - //TODO Path statePath_ns = toNonSharedPathTxn(txn, statePath); + //Check if path is not a shared path + Path statePath_ns = toNonSharedPathTxn(txn, statePath); //get all possible state and component references PathSet allComponentPaths; @@ -266,14 +257,14 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa //TODO maybe only scan in the changeset (patch) for new references? (this will be difficult and depending on the underlying versioning system) //Scan in for (new) component and state references - PathSet state_references = scanForReferences(statePath, allComponentPaths2); - PathSet state_stateReferences = scanForStateReferences(statePath, allStatePaths); + PathSet state_references = scanForReferences(statePath_ns, allComponentPaths2); + PathSet state_stateReferences = scanForStateReferences(statePath_ns, allStatePaths); //Retrieve old references PathSet old_references; PathSet old_state_references; - queryXReferencesTxn(txn, statePath, old_references, true, 0); //get the latsest references - queryXReferencesTxn(txn, statePath, old_state_references, false, 0); + queryXReferencesTxn(txn, statePath_ns, old_references, true, 0); //get the latsest references + queryXReferencesTxn(txn, statePath_ns, old_state_references, false, 0); //Check for added and removed paths PathSet diff_references_removed; @@ -290,22 +281,22 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa //Print error, but we could also throw an error. if(diff_references_added.size() != 0) for (PathSet::iterator i = diff_references_added.begin(); i != diff_references_added.end(); ++i) - printMsg(lvlError, format("Added component reference found!: '%1%' in state path '%2%'") % (*i) % statePath); + printMsg(lvlError, format("Added component reference found!: '%1%' in state path '%2%'") % (*i) % statePath_ns); if(diff_references_removed.size() != 0) for (PathSet::iterator i = diff_references_removed.begin(); i != diff_references_removed.end(); ++i) - printMsg(lvlError, format("Removed component reference found!: '%1%' in state path '%2%'") % (*i) % statePath); + printMsg(lvlError, format("Removed component reference found!: '%1%' in state path '%2%'") % (*i) % statePath_ns); if(diff_state_references_added.size() != 0) for (PathSet::iterator i = diff_state_references_added.begin(); i != diff_state_references_added.end(); ++i) - printMsg(lvlError, format("Added state reference found!: '%1%' in state path '%2%'") % (*i) % statePath); + printMsg(lvlError, format("Added state reference found!: '%1%' in state path '%2%'") % (*i) % statePath_ns); if(diff_state_references_removed.size() != 0) for (PathSet::iterator i = diff_state_references_removed.begin(); i != diff_state_references_removed.end(); ++i) - printMsg(lvlError, format("Removed state reference found!: '%1%' in state path '%2%'") % (*i) % statePath); + printMsg(lvlError, format("Removed state reference found!: '%1%' in state path '%2%'") % (*i) % statePath_ns); //We always set the referernces so we know they were scanned (maybe the same) at a certain time - printMsg(lvlError, format("Updating new references for statepath: '%1%'") % statePath); - Path drvPath = queryStatePathDrvTxn(txn, statePath); + printMsg(lvlError, format("Updating new references for statepath: '%1%'") % statePath_ns); + Path drvPath = queryStatePathDrvTxn(txn, statePath_ns); registerValidPath(txn, - statePath, + statePath_ns, Hash(), //emtpy hash state_references, state_stateReferences, @@ -350,6 +341,10 @@ void rsyncPaths(const Path & from, const Path & to, const bool addSlashes) //TO if(!DirectoryExist(to)) throw Error(format("Path `%1%' doenst exist ...") % to); */ + + //TODO IF IS FILE: REMOVE THE FILE todo MOVE THIS INTO RSYNCPATHS??? + //TODO IF IS DIR: REMOVE THE DIR + Path from2 = from; Path to2 = to; @@ -684,23 +679,6 @@ bool queryStateRevisions(Database & nixDB, const Transaction & txn, TableId revi unsigned int getTimestamp; splitDBRevKey(*i, getStatePath, getTimestamp); - //query state versioined directorys/files - //TODO REMOVE - /* - vector sortedPaths; - Derivation drv = derivationFromPathTxn(txn, queryStatePathDrvTxn(txn, getStatePath)); - DerivationStateOutputs stateOutputs = drv.stateOutputs; - DerivationStateOutputDirs stateOutputDirs = drv.stateOutputDirs; - for (DerivationStateOutputDirs::const_iterator j = stateOutputDirs.begin(); j != stateOutputDirs.end(); ++j){ - string thisdir = (j->second).path; - string fullstatedir = getStatePath + "/" + thisdir; - if(thisdir == "/") //exception for the root dir - fullstatedir = statePath + "/"; - sortedPaths.push_back(fullstatedir); - } - sort(sortedPaths.begin(), sortedPaths.end()); //sort - */ - Strings snapshots_s; Snapshots snapshots; nixDB.queryStrings(txn, snapshots_table, *i, snapshots_s); diff --git a/src/nix-env/help.txt b/src/nix-env/help.txt index b10c4b492..f2201c575 100644 --- a/src/nix-env/help.txt +++ b/src/nix-env/help.txt @@ -55,7 +55,7 @@ Query flags: --xml: show output in XML format --status / -s: print installed/present status --no-name: hide derivation names - --attr / -A: shows the unambiguous attribute name of the + --attr-path / -P: shows the unambiguous attribute name of the derivation which can be used when installing with -A --system: print the platform type of the derivation --compare-versions / -c: compare version to available or installed diff --git a/src/nix-state/nix-state.cc b/src/nix-state/nix-state.cc index deba1e95d..407ed478d 100644 --- a/src/nix-state/nix-state.cc +++ b/src/nix-state/nix-state.cc @@ -333,10 +333,11 @@ static void opRunComponent(Strings opFlags, Strings opArgs) r_commit = false; } else if(*i == "--statehelp"){ - printMsg(lvlError, format("%1%") % padd("", '-', 100)); + //printMsg(lvlError, format("%1%") % padd("", '-', 100)); printHelp(); r_scanforReferences = false; r_commit = false; + return; } //printMsg(lvlError, format("ARG %1%") % *i); @@ -357,7 +358,7 @@ static void opRunComponent(Strings opFlags, Strings opArgs) //******************* Scan for new references if neccecary if(r_scanforReferences) - store->scanAndUpdateAllReferences(root_statePath, true); //TODO make recursive a paramter? + store->scanAndUpdateAllReferences(root_statePath, true); //TODO make recursive a paramter? TXN??? //******************* With everything in place, we call the commit script on all statePaths (in)directly referenced ********************** diff --git a/startNixosDaemon.sh b/startNixosDaemon.sh new file mode 100755 index 000000000..4229c7f3c --- /dev/null +++ b/startNixosDaemon.sh @@ -0,0 +1,6 @@ +#! /bin/sh + +initctl stop nix-daemon +killproc.sh nix-worker +sleep 2 +initctl start nix-daemon