forked from lix-project/lix
* Remove build directory from a package directory after building it.
This commit is contained in:
parent
76205df09c
commit
fcc5ae151b
11
src/nix.cc
11
src/nix.cc
|
@ -333,6 +333,11 @@ build:
|
||||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
||||||
throw Error("unable to build package");
|
throw Error("unable to build package");
|
||||||
|
|
||||||
|
/* Remove write permission from the build directory. */
|
||||||
|
int res = system(("chmod -R -w " + path).c_str()); // !!! escaping
|
||||||
|
if (WEXITSTATUS(res) != 0)
|
||||||
|
throw Error("cannot remove write permission from " + path);
|
||||||
|
|
||||||
} catch (exception &) {
|
} catch (exception &) {
|
||||||
system(("rm -rf " + path).c_str());
|
system(("rm -rf " + path).c_str());
|
||||||
throw;
|
throw;
|
||||||
|
@ -411,10 +416,10 @@ void delPkg(string hash)
|
||||||
string path;
|
string path;
|
||||||
checkHash(hash);
|
checkHash(hash);
|
||||||
if (queryDB(dbInstPkgs, hash, path)) {
|
if (queryDB(dbInstPkgs, hash, path)) {
|
||||||
int res = system(("rm -rf " + path).c_str()); // !!! escaping
|
int res = system(("chmod -R +w " + path + " && rm -rf " + path).c_str()); // !!! escaping
|
||||||
delDB(dbInstPkgs, hash); // not a bug
|
delDB(dbInstPkgs, hash); // not a bug ???
|
||||||
if (WEXITSTATUS(res) != 0)
|
if (WEXITSTATUS(res) != 0)
|
||||||
throw Error("cannot delete " + path);
|
cerr << "errors deleting " + path + ", ignoring" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue