2017-04-26 17:04:45 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
2011-10-10 20:12:40 +02:00
|
|
|
#include "EXTERN.h"
|
|
|
|
#include "perl.h"
|
|
|
|
#include "XSUB.h"
|
|
|
|
|
|
|
|
/* Prevent a clash between some Perl and libstdc++ macros. */
|
|
|
|
#undef do_open
|
|
|
|
#undef do_close
|
|
|
|
|
Eliminate the "store" global variable
Also, move a few free-standing functions into StoreAPI and Derivation.
Also, introduce a non-nullable smart pointer, ref<T>, which is just a
wrapper around std::shared_ptr ensuring that the pointer is never
null. (For reference-counted values, this is better than passing a
"T&", because the latter doesn't maintain the refcount. Usually, the
caller will have a shared_ptr keeping the value alive, but that's not
always the case, e.g., when passing a reference to a std::thread via
std::bind.)
2016-02-04 14:28:26 +01:00
|
|
|
#include "derivations.hh"
|
|
|
|
#include "globals.hh"
|
|
|
|
#include "store-api.hh"
|
|
|
|
#include "util.hh"
|
2016-02-16 16:38:44 +01:00
|
|
|
#include "crypto.hh"
|
2011-10-10 20:12:40 +02:00
|
|
|
|
2015-02-10 11:54:06 +01:00
|
|
|
#if HAVE_SODIUM
|
2015-02-04 16:43:32 +01:00
|
|
|
#include <sodium.h>
|
2015-02-10 11:54:06 +01:00
|
|
|
#endif
|
2015-02-04 16:43:32 +01:00
|
|
|
|
2011-10-10 20:12:40 +02:00
|
|
|
|
|
|
|
using namespace nix;
|
|
|
|
|
|
|
|
|
2016-02-04 14:48:42 +01:00
|
|
|
static ref<Store> store()
|
2011-10-10 20:12:40 +02:00
|
|
|
{
|
2016-02-04 14:48:42 +01:00
|
|
|
static std::shared_ptr<Store> _store;
|
Eliminate the "store" global variable
Also, move a few free-standing functions into StoreAPI and Derivation.
Also, introduce a non-nullable smart pointer, ref<T>, which is just a
wrapper around std::shared_ptr ensuring that the pointer is never
null. (For reference-counted values, this is better than passing a
"T&", because the latter doesn't maintain the refcount. Usually, the
caller will have a shared_ptr keeping the value alive, but that's not
always the case, e.g., when passing a reference to a std::thread via
std::bind.)
2016-02-04 14:28:26 +01:00
|
|
|
if (!_store) {
|
2011-10-10 20:12:40 +02:00
|
|
|
try {
|
2018-03-27 18:41:31 +02:00
|
|
|
loadConfFile();
|
2013-09-06 16:36:56 +02:00
|
|
|
settings.lockCPU = false;
|
Eliminate the "store" global variable
Also, move a few free-standing functions into StoreAPI and Derivation.
Also, introduce a non-nullable smart pointer, ref<T>, which is just a
wrapper around std::shared_ptr ensuring that the pointer is never
null. (For reference-counted values, this is better than passing a
"T&", because the latter doesn't maintain the refcount. Usually, the
caller will have a shared_ptr keeping the value alive, but that's not
always the case, e.g., when passing a reference to a std::thread via
std::bind.)
2016-02-04 14:28:26 +01:00
|
|
|
_store = openStore();
|
2011-10-10 20:12:40 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-10 20:12:40 +02:00
|
|
|
}
|
|
|
|
}
|
2016-02-04 14:48:42 +01:00
|
|
|
return ref<Store>(_store);
|
2011-10-10 20:12:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MODULE = Nix::Store PACKAGE = Nix::Store
|
|
|
|
PROTOTYPES: ENABLE
|
|
|
|
|
|
|
|
|
2014-01-21 16:38:03 +01:00
|
|
|
#undef dNOOP // Hack to work around "error: declaration of 'Perl___notused' has a different language linkage" error message on clang.
|
|
|
|
#define dNOOP
|
|
|
|
|
|
|
|
|
2011-10-10 20:12:40 +02:00
|
|
|
void init()
|
|
|
|
CODE:
|
Eliminate the "store" global variable
Also, move a few free-standing functions into StoreAPI and Derivation.
Also, introduce a non-nullable smart pointer, ref<T>, which is just a
wrapper around std::shared_ptr ensuring that the pointer is never
null. (For reference-counted values, this is better than passing a
"T&", because the latter doesn't maintain the refcount. Usually, the
caller will have a shared_ptr keeping the value alive, but that's not
always the case, e.g., when passing a reference to a std::thread via
std::bind.)
2016-02-04 14:28:26 +01:00
|
|
|
store();
|
2011-10-10 20:12:40 +02:00
|
|
|
|
|
|
|
|
2015-03-04 16:27:42 +01:00
|
|
|
void setVerbosity(int level)
|
|
|
|
CODE:
|
|
|
|
verbosity = (Verbosity) level;
|
|
|
|
|
|
|
|
|
2011-10-11 17:41:13 +02:00
|
|
|
int isValidPath(char * path)
|
2011-10-10 20:12:40 +02:00
|
|
|
CODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
RETVAL = store()->isValidPath(store()->parseStorePath(path));
|
2011-10-10 20:12:40 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-10 20:12:40 +02:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
|
2011-10-11 17:41:13 +02:00
|
|
|
SV * queryReferences(char * path)
|
2011-10-10 20:12:40 +02:00
|
|
|
PPCODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
for (auto & i : store()->queryPathInfo(store()->parseStorePath(path))->references)
|
|
|
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(i).c_str(), 0)));
|
2011-10-10 20:12:40 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-10 20:12:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-11 17:41:13 +02:00
|
|
|
SV * queryPathHash(char * path)
|
2011-10-10 20:12:40 +02:00
|
|
|
PPCODE:
|
|
|
|
try {
|
2020-06-19 20:41:33 +02:00
|
|
|
auto s = store()->queryPathInfo(store()->parseStorePath(path))->narHash->to_string(Base32, true);
|
2011-10-10 20:12:40 +02:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-10 20:12:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-11 17:41:13 +02:00
|
|
|
SV * queryDeriver(char * path)
|
2011-10-10 20:12:40 +02:00
|
|
|
PPCODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
auto info = store()->queryPathInfo(store()->parseStorePath(path));
|
|
|
|
if (!info->deriver) XSRETURN_UNDEF;
|
|
|
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(*info->deriver).c_str(), 0)));
|
2011-10-10 20:12:40 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-10 20:12:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-17 22:55:45 +02:00
|
|
|
SV * queryPathInfo(char * path, int base32)
|
2011-10-10 20:12:40 +02:00
|
|
|
PPCODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
auto info = store()->queryPathInfo(store()->parseStorePath(path));
|
2020-03-10 11:00:17 +01:00
|
|
|
if (!info->deriver)
|
2011-10-10 20:12:40 +02:00
|
|
|
XPUSHs(&PL_sv_undef);
|
|
|
|
else
|
2019-12-05 19:11:09 +01:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(*info->deriver).c_str(), 0)));
|
2020-06-19 20:41:33 +02:00
|
|
|
auto s = info->narHash->to_string(base32 ? Base32 : Base16, true);
|
2011-10-10 20:12:40 +02:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
2016-04-19 18:50:15 +02:00
|
|
|
mXPUSHi(info->registrationTime);
|
|
|
|
mXPUSHi(info->narSize);
|
2011-10-10 20:12:40 +02:00
|
|
|
AV * arr = newAV();
|
2019-12-05 19:11:09 +01:00
|
|
|
for (auto & i : info->references)
|
|
|
|
av_push(arr, newSVpv(store()->printStorePath(i).c_str(), 0));
|
2011-10-10 20:12:40 +02:00
|
|
|
XPUSHs(sv_2mortal(newRV((SV *) arr)));
|
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-10 20:12:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-18 00:55:39 +02:00
|
|
|
SV * queryPathFromHashPart(char * hashPart)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
auto path = store()->queryPathFromHashPart(hashPart);
|
|
|
|
XPUSHs(sv_2mortal(newSVpv(path ? store()->printStorePath(*path).c_str() : "", 0)));
|
2012-07-18 00:55:39 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2012-07-18 00:55:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-10 20:12:40 +02:00
|
|
|
SV * computeFSClosure(int flipDirection, int includeOutputs, ...)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
StorePathSet paths;
|
2011-10-10 20:12:40 +02:00
|
|
|
for (int n = 2; n < items; ++n)
|
2019-12-05 19:11:09 +01:00
|
|
|
store()->computeFSClosure(store()->parseStorePath(SvPV_nolen(ST(n))), paths, flipDirection, includeOutputs);
|
|
|
|
for (auto & i : paths)
|
|
|
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(i).c_str(), 0)));
|
2011-10-10 20:12:40 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-10 20:12:40 +02:00
|
|
|
}
|
2011-10-11 17:41:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
SV * topoSortPaths(...)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
StorePathSet paths;
|
|
|
|
for (int n = 0; n < items; ++n) paths.insert(store()->parseStorePath(SvPV_nolen(ST(n))));
|
|
|
|
auto sorted = store()->topoSortPaths(paths);
|
|
|
|
for (auto & i : sorted)
|
|
|
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(i).c_str(), 0)));
|
2011-10-11 17:41:13 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-11 17:41:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SV * followLinksToStorePath(char * path)
|
|
|
|
CODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
RETVAL = newSVpv(store()->printStorePath(store()->followLinksToStorePath(path)).c_str(), 0);
|
2011-10-11 17:41:13 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-10-11 17:41:13 +02:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
2011-11-23 16:13:37 +01:00
|
|
|
|
|
|
|
|
2016-05-03 15:11:14 +02:00
|
|
|
void exportPaths(int fd, ...)
|
2011-11-23 16:13:37 +01:00
|
|
|
PPCODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
StorePathSet paths;
|
|
|
|
for (int n = 1; n < items; ++n) paths.insert(store()->parseStorePath(SvPV_nolen(ST(n))));
|
2011-11-23 16:13:37 +01:00
|
|
|
FdSink sink(fd);
|
2016-05-03 15:11:14 +02:00
|
|
|
store()->exportPaths(paths, sink);
|
2011-11-23 16:13:37 +01:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-11-23 16:13:37 +01:00
|
|
|
}
|
2011-11-29 14:01:24 +01:00
|
|
|
|
|
|
|
|
2016-05-31 11:18:45 +02:00
|
|
|
void importPaths(int fd, int dontCheckSigs)
|
2014-07-11 16:02:19 +02:00
|
|
|
PPCODE:
|
|
|
|
try {
|
|
|
|
FdSource source(fd);
|
2020-07-13 17:37:44 +02:00
|
|
|
store()->importPaths(source, dontCheckSigs ? NoCheckSigs : CheckSigs);
|
2014-07-11 16:02:19 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2014-07-11 16:02:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-29 14:01:24 +01:00
|
|
|
SV * hashPath(char * algo, int base32, char * path)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
|
|
|
Hash h = hashPath(parseHashType(algo), path).first;
|
2017-07-04 14:47:59 +02:00
|
|
|
auto s = h.to_string(base32 ? Base32 : Base16, false);
|
2011-11-29 14:01:24 +01:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-11-29 14:01:24 +01:00
|
|
|
}
|
2011-12-02 13:09:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
SV * hashFile(char * algo, int base32, char * path)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
|
|
|
Hash h = hashFile(parseHashType(algo), path);
|
2017-07-04 14:47:59 +02:00
|
|
|
auto s = h.to_string(base32 ? Base32 : Base16, false);
|
2011-12-02 13:09:24 +01:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-12-02 13:09:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SV * hashString(char * algo, int base32, char * s)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
|
|
|
Hash h = hashString(parseHashType(algo), s);
|
2017-07-04 14:47:59 +02:00
|
|
|
auto s = h.to_string(base32 ? Base32 : Base16, false);
|
2011-12-02 13:09:24 +01:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-12-02 13:09:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-03 15:33:17 +02:00
|
|
|
SV * convertHash(char * algo, char * s, int toBase32)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
2017-07-04 14:47:59 +02:00
|
|
|
Hash h(s, parseHashType(algo));
|
|
|
|
string s = h.to_string(toBase32 ? Base32 : Base16, false);
|
2015-06-03 15:33:17 +02:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
|
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2015-06-03 15:33:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-16 16:38:44 +01:00
|
|
|
SV * signString(char * secretKey_, char * msg)
|
2015-02-04 16:43:32 +01:00
|
|
|
PPCODE:
|
|
|
|
try {
|
2015-02-10 11:54:06 +01:00
|
|
|
#if HAVE_SODIUM
|
2016-02-16 16:38:44 +01:00
|
|
|
auto sig = SecretKey(secretKey_).signDetached(msg);
|
|
|
|
XPUSHs(sv_2mortal(newSVpv(sig.c_str(), sig.size())));
|
2015-02-10 11:54:06 +01:00
|
|
|
#else
|
|
|
|
throw Error("Nix was not compiled with libsodium, required for signed binary cache support");
|
|
|
|
#endif
|
2015-02-04 16:43:32 +01:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2015-02-04 16:43:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int checkSignature(SV * publicKey_, SV * sig_, char * msg)
|
|
|
|
CODE:
|
|
|
|
try {
|
2015-02-10 11:54:06 +01:00
|
|
|
#if HAVE_SODIUM
|
2015-02-04 16:43:32 +01:00
|
|
|
STRLEN publicKeyLen;
|
|
|
|
unsigned char * publicKey = (unsigned char *) SvPV(publicKey_, publicKeyLen);
|
|
|
|
if (publicKeyLen != crypto_sign_PUBLICKEYBYTES)
|
|
|
|
throw Error("public key is not valid");
|
|
|
|
|
|
|
|
STRLEN sigLen;
|
|
|
|
unsigned char * sig = (unsigned char *) SvPV(sig_, sigLen);
|
|
|
|
if (sigLen != crypto_sign_BYTES)
|
|
|
|
throw Error("signature is not valid");
|
|
|
|
|
|
|
|
RETVAL = crypto_sign_verify_detached(sig, (unsigned char *) msg, strlen(msg), publicKey) == 0;
|
2015-02-10 11:54:06 +01:00
|
|
|
#else
|
|
|
|
throw Error("Nix was not compiled with libsodium, required for signed binary cache support");
|
|
|
|
#endif
|
2015-02-04 16:43:32 +01:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2015-02-04 16:43:32 +01:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
|
2011-12-02 13:09:24 +01:00
|
|
|
SV * addToStore(char * srcPath, int recursive, char * algo)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
2020-03-31 00:40:41 +02:00
|
|
|
auto method = recursive ? FileIngestionMethod::Recursive : FileIngestionMethod::Flat;
|
|
|
|
auto path = store()->addToStore(std::string(baseNameOf(srcPath)), srcPath, method, parseHashType(algo));
|
2019-12-05 19:11:09 +01:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(path).c_str(), 0)));
|
2011-12-02 13:09:24 +01:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-12-02 13:09:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SV * makeFixedOutputPath(int recursive, char * algo, char * hash, char * name)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
2017-07-04 14:47:59 +02:00
|
|
|
Hash h(hash, parseHashType(algo));
|
2020-03-31 00:40:41 +02:00
|
|
|
auto method = recursive ? FileIngestionMethod::Recursive : FileIngestionMethod::Flat;
|
|
|
|
auto path = store()->makeFixedOutputPath(method, h, name);
|
2019-12-05 19:11:09 +01:00
|
|
|
XPUSHs(sv_2mortal(newSVpv(store()->printStorePath(path).c_str(), 0)));
|
2011-12-02 13:09:24 +01:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2011-12-02 13:09:24 +01:00
|
|
|
}
|
2012-03-19 04:14:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
SV * derivationFromPath(char * drvPath)
|
|
|
|
PREINIT:
|
|
|
|
HV *hash;
|
|
|
|
CODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
Derivation drv = store()->derivationFromPath(store()->parseStorePath(drvPath));
|
2012-03-19 04:14:21 +01:00
|
|
|
hash = newHV();
|
2013-03-08 01:24:59 +01:00
|
|
|
|
|
|
|
HV * outputs = newHV();
|
2019-12-05 19:11:09 +01:00
|
|
|
for (auto & i : drv.outputs)
|
2020-07-12 20:26:10 +02:00
|
|
|
hv_store(
|
|
|
|
outputs, i.first.c_str(), i.first.size(),
|
|
|
|
newSVpv(store()->printStorePath(i.second.path(*store(), drv.name)).c_str(), 0),
|
|
|
|
0);
|
2013-03-08 01:24:59 +01:00
|
|
|
hv_stores(hash, "outputs", newRV((SV *) outputs));
|
|
|
|
|
2012-03-19 04:14:21 +01:00
|
|
|
AV * inputDrvs = newAV();
|
2019-12-05 19:11:09 +01:00
|
|
|
for (auto & i : drv.inputDrvs)
|
|
|
|
av_push(inputDrvs, newSVpv(store()->printStorePath(i.first).c_str(), 0)); // !!! ignores i->second
|
2012-03-19 04:14:21 +01:00
|
|
|
hv_stores(hash, "inputDrvs", newRV((SV *) inputDrvs));
|
2013-03-08 01:24:59 +01:00
|
|
|
|
2012-03-19 04:14:21 +01:00
|
|
|
AV * inputSrcs = newAV();
|
2019-12-05 19:11:09 +01:00
|
|
|
for (auto & i : drv.inputSrcs)
|
|
|
|
av_push(inputSrcs, newSVpv(store()->printStorePath(i).c_str(), 0));
|
2012-03-19 04:14:21 +01:00
|
|
|
hv_stores(hash, "inputSrcs", newRV((SV *) inputSrcs));
|
2013-03-08 01:24:59 +01:00
|
|
|
|
2012-03-19 04:14:21 +01:00
|
|
|
hv_stores(hash, "platform", newSVpv(drv.platform.c_str(), 0));
|
|
|
|
hv_stores(hash, "builder", newSVpv(drv.builder.c_str(), 0));
|
2013-03-08 01:24:59 +01:00
|
|
|
|
2012-03-19 04:14:21 +01:00
|
|
|
AV * args = newAV();
|
2019-12-05 19:11:09 +01:00
|
|
|
for (auto & i : drv.args)
|
|
|
|
av_push(args, newSVpv(i.c_str(), 0));
|
2012-03-19 04:14:21 +01:00
|
|
|
hv_stores(hash, "args", newRV((SV *) args));
|
2013-03-08 01:24:59 +01:00
|
|
|
|
2012-03-19 04:14:21 +01:00
|
|
|
HV * env = newHV();
|
2019-12-05 19:11:09 +01:00
|
|
|
for (auto & i : drv.env)
|
|
|
|
hv_store(env, i.first.c_str(), i.first.size(), newSVpv(i.second.c_str(), 0), 0);
|
2012-03-19 04:14:21 +01:00
|
|
|
hv_stores(hash, "env", newRV((SV *) env));
|
2013-03-08 01:24:59 +01:00
|
|
|
|
2012-03-19 04:14:21 +01:00
|
|
|
RETVAL = newRV_noinc((SV *)hash);
|
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2012-03-19 04:14:21 +01:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
2015-10-09 12:49:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
void addTempRoot(char * storePath)
|
|
|
|
PPCODE:
|
|
|
|
try {
|
2019-12-05 19:11:09 +01:00
|
|
|
store()->addTempRoot(store()->parseStorePath(storePath));
|
2015-10-09 12:49:47 +02:00
|
|
|
} catch (Error & e) {
|
2016-01-07 14:33:13 +01:00
|
|
|
croak("%s", e.what());
|
2015-10-09 12:49:47 +02:00
|
|
|
}
|