summaryrefslogtreecommitdiffstats
path: root/nix-rust
diff options
context:
space:
mode:
Diffstat (limited to 'nix-rust')
-rw-r--r--nix-rust/Cargo.lock34
-rw-r--r--nix-rust/Cargo.toml1
-rw-r--r--nix-rust/src/c.rs20
-rw-r--r--nix-rust/src/foreign.rs14
-rw-r--r--nix-rust/src/lib.rs1
-rw-r--r--nix-rust/src/util/mod.rs1
-rw-r--r--nix-rust/src/util/tarfile.rs56
7 files changed, 1 insertions, 126 deletions
diff --git a/nix-rust/Cargo.lock b/nix-rust/Cargo.lock
index 6e5ecf45d..957c01e5a 100644
--- a/nix-rust/Cargo.lock
+++ b/nix-rust/Cargo.lock
@@ -55,17 +55,6 @@ dependencies = [
]
[[package]]
-name = "filetime"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "fnv"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -109,7 +98,6 @@ dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"proptest 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -320,17 +308,6 @@ dependencies = [
]
[[package]]
-name = "tar"
-version = "0.4.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
- "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "tempfile"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -375,14 +352,6 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-[[package]]
-name = "xattr"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
[metadata]
"checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5"
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
@@ -393,7 +362,6 @@ dependencies = [
"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
-"checksum filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d"
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407"
@@ -423,11 +391,9 @@ dependencies = [
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
"checksum rusty-fork 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3dd93264e10c577503e926bd1430193eeb5d21b059148910082245309b424fae"
-"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3"
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
"checksum wait-timeout 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
diff --git a/nix-rust/Cargo.toml b/nix-rust/Cargo.toml
index cd388bed6..1372e5a73 100644
--- a/nix-rust/Cargo.toml
+++ b/nix-rust/Cargo.toml
@@ -9,7 +9,6 @@ name = "nixrust"
crate-type = ["cdylib"]
[dependencies]
-tar = "0.4"
libc = "0.2"
#futures-preview = { version = "=0.3.0-alpha.19" }
#hyper = "0.13.0-alpha.4"
diff --git a/nix-rust/src/c.rs b/nix-rust/src/c.rs
index 8d2507d37..c1358545f 100644
--- a/nix-rust/src/c.rs
+++ b/nix-rust/src/c.rs
@@ -1,22 +1,4 @@
-use super::{
- error,
- foreign::{self},
- store::path,
- store::StorePath,
- util,
-};
-
-#[no_mangle]
-pub unsafe extern "C" fn unpack_tarfile(
- source: foreign::Source,
- dest_dir: &str,
- out: *mut Result<(), error::CppException>,
-) {
- out.write(
- util::tarfile::unpack_tarfile(source, std::path::Path::new(dest_dir))
- .map_err(|err| err.into()),
- );
-}
+use super::{error, store::path, store::StorePath, util};
#[no_mangle]
pub unsafe extern "C" fn ffi_String_new(s: &str, out: *mut String) {
diff --git a/nix-rust/src/foreign.rs b/nix-rust/src/foreign.rs
deleted file mode 100644
index 7bce7753c..000000000
--- a/nix-rust/src/foreign.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-/// A wrapper around Nix's Source class that provides the Read trait.
-#[repr(C)]
-pub struct Source {
- fun: extern "C" fn(this: *mut libc::c_void, data: &mut [u8]) -> usize,
- this: *mut libc::c_void,
-}
-
-impl std::io::Read for Source {
- fn read(&mut self, buf: &mut [u8]) -> std::result::Result<usize, std::io::Error> {
- let n = (self.fun)(self.this, buf);
- assert!(n <= buf.len());
- Ok(n)
- }
-}
diff --git a/nix-rust/src/lib.rs b/nix-rust/src/lib.rs
index 9935cd27a..e62613ba8 100644
--- a/nix-rust/src/lib.rs
+++ b/nix-rust/src/lib.rs
@@ -12,7 +12,6 @@ extern crate proptest;
#[cfg(not(test))]
mod c;
mod error;
-mod foreign;
#[cfg(unused)]
mod nar;
mod store;
diff --git a/nix-rust/src/util/mod.rs b/nix-rust/src/util/mod.rs
index cd852c55f..eaad9d406 100644
--- a/nix-rust/src/util/mod.rs
+++ b/nix-rust/src/util/mod.rs
@@ -1,2 +1 @@
pub mod base32;
-pub mod tarfile;
diff --git a/nix-rust/src/util/tarfile.rs b/nix-rust/src/util/tarfile.rs
deleted file mode 100644
index 74d60692c..000000000
--- a/nix-rust/src/util/tarfile.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-use crate::{foreign::Source, Error};
-use std::fs;
-use std::io;
-use std::os::unix::fs::OpenOptionsExt;
-use std::path::{Component, Path};
-use tar::Archive;
-
-pub fn unpack_tarfile(source: Source, dest_dir: &Path) -> Result<(), Error> {
- fs::create_dir_all(dest_dir)?;
-
- let mut tar = Archive::new(source);
-
- for file in tar.entries()? {
- let mut file = file?;
-
- let path = file.path()?;
-
- for i in path.components() {
- if let Component::Prefix(_) | Component::RootDir | Component::ParentDir = i {
- return Err(Error::BadTarFileMemberName(
- file.path()?.to_str().unwrap().to_string(),
- ));
- }
- }
-
- let dest_file = dest_dir.join(path);
-
- fs::create_dir_all(dest_file.parent().unwrap())?;
-
- match file.header().entry_type() {
- tar::EntryType::Directory => {
- fs::create_dir(dest_file)?;
- }
- tar::EntryType::Regular => {
- let mode = if file.header().mode()? & (libc::S_IXUSR as u32) == 0 {
- 0o666
- } else {
- 0o777
- };
- let mut f = fs::OpenOptions::new()
- .create(true)
- .write(true)
- .mode(mode)
- .open(dest_file)?;
- io::copy(&mut file, &mut f)?;
- }
- tar::EntryType::Symlink => {
- std::os::unix::fs::symlink(file.header().link_name()?.unwrap(), dest_file)?;
- }
- tar::EntryType::XGlobalHeader | tar::EntryType::XHeader => {}
- t => return Err(Error::Misc(format!("unsupported tar entry type '{:?}'", t))),
- }
- }
-
- Ok(())
-}