summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Krahl2019-01-28 20:43:50 +0000
committerRobin Krahl2019-01-28 21:45:06 +0100
commitc23fdd226858c4a49e3eab51419843d66f8e4a69 (patch)
tree8754f578d596d5ad58d684080aec03e6774c082f
parent137db228372c6b0c389bc4dde9d81653128ae87c (diff)
downloadaur-c23fdd226858c4a49e3eab51419843d66f8e4a69.tar.gz
Update to nitrocli v0.2.3
Additionally, this patch adds cargo configuration to avoid writing the srcdir into the binary. It also removes the use-system-libary.patch and uses the USE_SYSTEM_LIBNITROKEY environment variable instead.
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD15
-rw-r--r--use-system-library.patch158
3 files changed, 13 insertions, 168 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 246b9336fd31..eb8d2f63408f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = nitrocli
pkgdesc = Command-line interface for Nitrokey devices
- pkgver = 0.2.2
+ pkgver = 0.2.3
pkgrel = 1
url = https://github.com/d-e-s-o/nitrocli
arch = x86_64
@@ -8,10 +8,8 @@ pkgbase = nitrocli
makedepends = cargo
depends = libnitrokey>=3.4.1
depends = gnupg
- source = nitrocli-0.2.2.tar.gz::https://github.com/d-e-s-o/nitrocli/archive/v0.2.2.tar.gz
- source = use-system-library.patch
- sha512sums = 3304591001675e3fff3bdf43fb464739308e498e66362b49704c29a8b71104176c6c2401b75a78e951f32007464f13174a9736c7fb90bc89108c38b2f7afcb24
- sha512sums = c4fb3e9db2c599bce900047289a1a9791263d334440af72ed79ba14d3356bfcea9a1356b97bc124fd278735f31d70489625ee06bd77f3700b115505ae5f505f8
+ source = nitrocli-0.2.3.tar.gz::https://github.com/d-e-s-o/nitrocli/archive/v0.2.3.tar.gz
+ sha512sums = b777fb634961f9c7c677f78743176df32a170da5793c53c8c46f8ff9f62fa51e616ac12b5b589f3531285d194996b130b313d77c02762c2aa97c7919b7b2e0de
pkgname = nitrocli
diff --git a/PKGBUILD b/PKGBUILD
index e3ab28f76e1c..b58065bb95f2 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
# Maintainer: Robin Krahl <robin.krahl@ireas.org>
pkgname=nitrocli
-pkgver=0.2.2
+pkgver=0.2.3
pkgrel=1
pkgdesc="Command-line interface for Nitrokey devices"
arch=('x86_64')
@@ -8,17 +8,22 @@ url="https://github.com/d-e-s-o/nitrocli"
license=('GPL3')
depends=('libnitrokey>=3.4.1' 'gnupg')
makedepends=('cargo')
-source=("$pkgname-$pkgver.tar.gz"::https://github.com/d-e-s-o/nitrocli/archive/v${pkgver}.tar.gz "use-system-library.patch")
-sha512sums=('3304591001675e3fff3bdf43fb464739308e498e66362b49704c29a8b71104176c6c2401b75a78e951f32007464f13174a9736c7fb90bc89108c38b2f7afcb24'
- 'c4fb3e9db2c599bce900047289a1a9791263d334440af72ed79ba14d3356bfcea9a1356b97bc124fd278735f31d70489625ee06bd77f3700b115505ae5f505f8')
+source=("$pkgname-$pkgver.tar.gz"::https://github.com/d-e-s-o/nitrocli/archive/v${pkgver}.tar.gz)
+sha512sums=('b777fb634961f9c7c677f78743176df32a170da5793c53c8c46f8ff9f62fa51e616ac12b5b589f3531285d194996b130b313d77c02762c2aa97c7919b7b2e0de')
prepare() {
cd "$pkgname-$pkgver"
- patch -p1 -i "$srcdir/use-system-library.patch"
+ # Configure cargo not to put the srcdir in the binary
+ mkdir -p .cargo
+ cat <<EOF > .cargo/config
+[build]
+rustflags = ["--remap-path-prefix", "$srcdir=/usr/share/cargo/registry/$pkgname"]
+EOF
}
build() {
cd "$pkgname-$pkgver/nitrocli"
+ export USE_SYSTEM_LIBNITROKEY=1
cargo build --release --frozen
}
diff --git a/use-system-library.patch b/use-system-library.patch
deleted file mode 100644
index 4aea1e65e7c7..000000000000
--- a/use-system-library.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-diff -ura nitrocli-0.2.2.orig/nitrocli/Cargo.lock nitrocli-0.2.2.new/nitrocli/Cargo.lock
---- nitrocli-0.2.2.orig/nitrocli/Cargo.lock 2019-01-14 03:25:50.000000000 +0000
-+++ nitrocli-0.2.2.new/nitrocli/Cargo.lock 2019-01-14 11:48:45.277717389 +0000
-@@ -20,16 +20,6 @@
- source = "registry+https://github.com/rust-lang/crates.io-index"
-
- [[package]]
--name = "cc"
--version = "1.0.28"
--
--[[package]]
--name = "cc"
--version = "1.0.28"
--source = "registry+https://github.com/rust-lang/crates.io-index"
--replace = "cc 1.0.28"
--
--[[package]]
- name = "cfg-if"
- version = "0.1.6"
- source = "registry+https://github.com/rust-lang/crates.io-index"
-@@ -105,9 +95,6 @@
- [[package]]
- name = "nitrokey-sys"
- version = "3.4.1"
--dependencies = [
-- "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
--]
-
- [[package]]
- name = "nitrokey-sys"
-@@ -321,7 +308,6 @@
- [metadata]
- "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
- "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
--"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749"
- "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
- "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
- "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
-Only in nitrocli-0.2.2.new/nitrocli: target
-diff -ura nitrocli-0.2.2.orig/nitrokey-sys/build.rs nitrocli-0.2.2.new/nitrokey-sys/build.rs
---- nitrocli-0.2.2.orig/nitrokey-sys/build.rs 2019-01-14 03:25:50.000000000 +0000
-+++ nitrocli-0.2.2.new/nitrokey-sys/build.rs 2019-01-14 11:46:43.052438908 +0000
-@@ -1,104 +1,3 @@
--extern crate cc;
--
--use std::env;
--use std::io;
--use std::io::{Read, Write};
--use std::fs;
--use std::path;
--
--struct Version {
-- major: String,
-- minor: String,
-- git: String,
--}
--
--fn stringify(err: env::VarError) -> String {
-- format!("{}", err)
--}
--
--fn extract_git_version(pre: &str) -> Result<String, String> {
-- // If a pre-release version is set, it is expected to have the format
-- // pre.v<maj>.<min>.<n>.g<hash>, where <maj> and <min> are the last major and minor version,
-- // <n> is the number of commits since this version and <hash> is the hash of the last commit.
-- let parts: Vec<&str> = pre.split('.').collect();
-- if parts.len() != 5 {
-- return Err(format!("'{}' is not a valid pre-release version", pre));
-- }
-- Ok(format!("{}.{}-{}-{}", parts[1], parts[2], parts[3], parts[4]))
--}
--
--fn get_version() -> Result<Version, String> {
-- let major = env::var("CARGO_PKG_VERSION_MAJOR").map_err(stringify)?;
-- let minor = env::var("CARGO_PKG_VERSION_MINOR").map_err(stringify)?;
-- let patch = env::var("CARGO_PKG_VERSION_PATCH").map_err(stringify)?;
-- let pre = env::var("CARGO_PKG_VERSION_PRE").map_err(stringify)?;
--
-- let git = match pre.is_empty() {
-- true => match patch.is_empty() {
-- true => format!("v{}.{}", major, minor),
-- false => format!("v{}.{}.{}", major, minor, patch),
-- },
-- false => extract_git_version(&pre)?,
-- };
--
-- Ok(Version {
-- major,
-- minor,
-- git,
-- })
--}
--
--fn prepare_version_source(
-- version: &Version,
-- out_path: &path::Path,
-- library_path: &path::Path
--) -> io::Result<path::PathBuf> {
-- let out = out_path.join("version.cc");
-- let template = library_path.join("version.cc.in");
--
-- let mut file = fs::File::open(template)?;
-- let mut data = String::new();
-- file.read_to_string(&mut data)?;
-- drop(file);
--
-- let data = data
-- .replace("@PROJECT_VERSION_MAJOR@", &version.major)
-- .replace("@PROJECT_VERSION_MINOR@", &version.minor)
-- .replace("@PROJECT_VERSION_GIT@", &version.git);
--
-- let mut file = fs::File::create(&out)?;
-- file.write_all(data.as_bytes())?;
--
-- Ok(out)
--}
--
- fn main() {
-- let out_dir = env::var("OUT_DIR").expect("Environment variable OUT_DIR is not set");
-- let out_path = path::PathBuf::from(out_dir);
--
-- let version = get_version().expect("Could not extract library version");
--
-- let sources = [
-- "DeviceCommunicationExceptions.cpp",
-- "NK_C_API.cc",
-- "NitrokeyManager.cc",
-- "command_id.cc",
-- "device.cc",
-- "log.cc",
-- "misc.cc",
-- ];
-- let library_dir = format!("libnitrokey-{}", version.git);
-- let library_path = path::Path::new(&library_dir);
--
-- let version_source = prepare_version_source(&version, &out_path, &library_path)
-- .expect("Could not prepare the version source file");
--
-- cc::Build::new()
-- .cpp(true)
-- .include(library_path.join("libnitrokey"))
-- .files(sources.iter().map(|s| library_path.join(s)))
-- .file(version_source)
-- .compile("libnitrokey.a");
--
-- println!("cargo:rustc-link-lib=hidapi-libusb");
-+ println!("cargo:rustc-link-lib=nitrokey");
- }
-diff -ura nitrocli-0.2.2.orig/nitrokey-sys/Cargo.toml nitrocli-0.2.2.new/nitrokey-sys/Cargo.toml
---- nitrocli-0.2.2.orig/nitrokey-sys/Cargo.toml 2019-01-14 03:25:50.000000000 +0000
-+++ nitrocli-0.2.2.new/nitrokey-sys/Cargo.toml 2019-01-14 11:46:43.052438908 +0000
-@@ -10,6 +10,3 @@
- links = "nitrokey"
- build = "build.rs"
- readme = "README.md"
--
--[build-dependencies]
--cc = "1.0"