Move code around
This commit is contained in:
parent
d14b1c261c
commit
d33dd6e6c0
|
@ -14,7 +14,6 @@ impl<T> CBox<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let size = std::mem::size_of::<T>();
|
let size = std::mem::size_of::<T>();
|
||||||
let ptr = libc::malloc(size);
|
let ptr = libc::malloc(size);
|
||||||
eprintln!("PTR = {:?}, SIZE = {}", ptr, size);
|
|
||||||
*(ptr as *mut T) = t; // FIXME: probably UB
|
*(ptr as *mut T) = t; // FIXME: probably UB
|
||||||
Self {
|
Self {
|
||||||
ptr,
|
ptr,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "rust.hh"
|
|
||||||
#include "builtins.hh"
|
#include "builtins.hh"
|
||||||
#include "compression.hh"
|
#include "compression.hh"
|
||||||
|
#include "tarfile.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void builtinUnpackChannel(const BasicDerivation & drv)
|
||||||
decompressor->finish();
|
decompressor->finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
unpack_tarfile(*source, out).use()->unwrap();
|
unpackTarfile(*source, out);
|
||||||
|
|
||||||
auto entries = readDirectory(out);
|
auto entries = readDirectory(out);
|
||||||
if (entries.size() != 1)
|
if (entries.size() != 1)
|
||||||
|
|
|
@ -6,7 +6,7 @@ libstore_DIR := $(d)
|
||||||
|
|
||||||
libstore_SOURCES := $(wildcard $(d)/*.cc $(d)/builtins/*.cc)
|
libstore_SOURCES := $(wildcard $(d)/*.cc $(d)/builtins/*.cc)
|
||||||
|
|
||||||
libstore_LIBS = libutil libnixrust
|
libstore_LIBS = libutil
|
||||||
|
|
||||||
libstore_LDFLAGS = $(SQLITE3_LIBS) -lbz2 $(LIBCURL_LIBS) $(SODIUM_LIBS) -pthread
|
libstore_LDFLAGS = $(SQLITE3_LIBS) -lbz2 $(LIBCURL_LIBS) $(SODIUM_LIBS) -pthread
|
||||||
ifneq ($(OS), FreeBSD)
|
ifneq ($(OS), FreeBSD)
|
||||||
|
|
|
@ -7,3 +7,5 @@ libutil_DIR := $(d)
|
||||||
libutil_SOURCES := $(wildcard $(d)/*.cc)
|
libutil_SOURCES := $(wildcard $(d)/*.cc)
|
||||||
|
|
||||||
libutil_LDFLAGS = $(LIBLZMA_LIBS) -lbz2 -pthread $(OPENSSL_LIBS) $(LIBBROTLI_LIBS) $(BOOST_LDFLAGS) -lboost_context
|
libutil_LDFLAGS = $(LIBLZMA_LIBS) -lbz2 -pthread $(OPENSSL_LIBS) $(LIBBROTLI_LIBS) $(BOOST_LDFLAGS) -lboost_context
|
||||||
|
|
||||||
|
libutil_LIBS = libnixrust
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "logging.hh"
|
#include "logging.hh"
|
||||||
#include "rust.hh"
|
#include "rust-ffi.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
#include "serialise.hh"
|
|
||||||
#include "rust-ffi.hh"
|
#include "rust-ffi.hh"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
rust::CBox2<rust::Result<std::tuple<>>> unpack_tarfile(rust::Source source, rust::StringSlice dest_dir);
|
rust::CBox2<rust::Result<std::tuple<>>> unpack_tarfile(rust::Source source, rust::StringSlice dest_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace nix {
|
||||||
|
|
||||||
|
void unpackTarfile(Source & source, Path destDir)
|
||||||
|
{
|
||||||
|
unpack_tarfile(source, destDir).use()->unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
7
src/libutil/tarfile.hh
Normal file
7
src/libutil/tarfile.hh
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#include "serialise.hh"
|
||||||
|
|
||||||
|
namespace nix {
|
||||||
|
|
||||||
|
void unpackTarfile(Source & source, Path destDir);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue