* Cleanup.
This commit is contained in:
parent
be88248add
commit
33ecb42991
1 changed files with 9 additions and 22 deletions
|
@ -830,8 +830,7 @@ void DerivationGoal::haveDerivation()
|
||||||
/* Get the derivation. */
|
/* Get the derivation. */
|
||||||
drv = derivationFromPath(drvPath);
|
drv = derivationFromPath(drvPath);
|
||||||
|
|
||||||
for (DerivationOutputs::iterator i = drv.outputs.begin();
|
foreach (DerivationOutputs::iterator, i, drv.outputs)
|
||||||
i != drv.outputs.end(); ++i)
|
|
||||||
worker.store.addTempRoot(i->second.path);
|
worker.store.addTempRoot(i->second.path);
|
||||||
|
|
||||||
/* Check what outputs paths are not already valid. */
|
/* Check what outputs paths are not already valid. */
|
||||||
|
@ -850,8 +849,7 @@ void DerivationGoal::haveDerivation()
|
||||||
where some other process is building it is handled through
|
where some other process is building it is handled through
|
||||||
normal locking mechanisms.) So if any output paths are already
|
normal locking mechanisms.) So if any output paths are already
|
||||||
being built, put this goal to sleep. */
|
being built, put this goal to sleep. */
|
||||||
for (PathSet::iterator i = invalidOutputs.begin();
|
foreach (PathSet::iterator, i, invalidOutputs)
|
||||||
i != invalidOutputs.end(); ++i)
|
|
||||||
if (pathIsLockedByMe(*i)) {
|
if (pathIsLockedByMe(*i)) {
|
||||||
/* Wait until any goal finishes (hopefully the one that is
|
/* Wait until any goal finishes (hopefully the one that is
|
||||||
locking *i), then retry haveDerivation(). */
|
locking *i), then retry haveDerivation(). */
|
||||||
|
@ -862,8 +860,7 @@ void DerivationGoal::haveDerivation()
|
||||||
/* We are first going to try to create the invalid output paths
|
/* We are first going to try to create the invalid output paths
|
||||||
through substitutes. If that doesn't work, we'll build
|
through substitutes. If that doesn't work, we'll build
|
||||||
them. */
|
them. */
|
||||||
for (PathSet::iterator i = invalidOutputs.begin();
|
foreach (PathSet::iterator, i, invalidOutputs)
|
||||||
i != invalidOutputs.end(); ++i)
|
|
||||||
/* Don't bother creating a substitution goal if there are no
|
/* Don't bother creating a substitution goal if there are no
|
||||||
substitutes. */
|
substitutes. */
|
||||||
if (worker.store.hasSubstitutes(*i))
|
if (worker.store.hasSubstitutes(*i))
|
||||||
|
@ -2755,9 +2752,7 @@ void Worker::waitForInput()
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
if (maxSilentTime != 0) {
|
if (maxSilentTime != 0) {
|
||||||
time_t oldest = 0;
|
time_t oldest = 0;
|
||||||
for (Children::iterator i = children.begin();
|
foreach (Children::iterator, i, children) {
|
||||||
i != children.end(); ++i)
|
|
||||||
{
|
|
||||||
oldest = oldest == 0 || i->second.lastOutput < oldest
|
oldest = oldest == 0 || i->second.lastOutput < oldest
|
||||||
? i->second.lastOutput : oldest;
|
? i->second.lastOutput : oldest;
|
||||||
}
|
}
|
||||||
|
@ -2774,12 +2769,8 @@ void Worker::waitForInput()
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
int fdMax = 0;
|
int fdMax = 0;
|
||||||
for (Children::iterator i = children.begin();
|
foreach (Children::iterator, i, children) {
|
||||||
i != children.end(); ++i)
|
foreach (set<int>::iterator, j, i->second.fds) {
|
||||||
{
|
|
||||||
for (set<int>::iterator j = i->second.fds.begin();
|
|
||||||
j != i->second.fds.end(); ++j)
|
|
||||||
{
|
|
||||||
FD_SET(*j, &fds);
|
FD_SET(*j, &fds);
|
||||||
if (*j >= fdMax) fdMax = *j + 1;
|
if (*j >= fdMax) fdMax = *j + 1;
|
||||||
}
|
}
|
||||||
|
@ -2799,13 +2790,9 @@ void Worker::waitForInput()
|
||||||
careful that we don't keep iterators alive across calls to
|
careful that we don't keep iterators alive across calls to
|
||||||
cancel(). */
|
cancel(). */
|
||||||
set<pid_t> pids;
|
set<pid_t> pids;
|
||||||
for (Children::iterator i = children.begin();
|
foreach (Children::iterator, i, children) pids.insert(i->first);
|
||||||
i != children.end(); ++i)
|
|
||||||
pids.insert(i->first);
|
|
||||||
|
|
||||||
for (set<pid_t>::iterator i = pids.begin();
|
foreach (set<pid_t>::iterator, i, pids) {
|
||||||
i != pids.end(); ++i)
|
|
||||||
{
|
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
Children::iterator j = children.find(*i);
|
Children::iterator j = children.find(*i);
|
||||||
if (j == children.end()) continue; // child destroyed
|
if (j == children.end()) continue; // child destroyed
|
||||||
|
@ -2813,7 +2800,7 @@ void Worker::waitForInput()
|
||||||
assert(goal);
|
assert(goal);
|
||||||
|
|
||||||
set<int> fds2(j->second.fds);
|
set<int> fds2(j->second.fds);
|
||||||
for (set<int>::iterator k = fds2.begin(); k != fds2.end(); ++k) {
|
foreach (set<int>::iterator, k, fds2) {
|
||||||
if (FD_ISSET(*k, &fds)) {
|
if (FD_ISSET(*k, &fds)) {
|
||||||
unsigned char buffer[4096];
|
unsigned char buffer[4096];
|
||||||
ssize_t rd = read(*k, buffer, sizeof(buffer));
|
ssize_t rd = read(*k, buffer, sizeof(buffer));
|
||||||
|
|
Loading…
Reference in a new issue