aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2020-09-20 04:37:31 +0200
committerRobin Krahl <robin.krahl@ireas.org>2020-09-20 11:39:07 +0200
commit2b367a30df6e155621c116c41cc262dd96ad1a33 (patch)
treef915f625a44cec8ccdfe78f380b563c15d0aeef6
parent7394a6b188c2a6c0d5ae72f8bba5fddc9720613b (diff)
downloadnitrokey-sys-rs-2b367a30df6e155621c116c41cc262dd96ad1a33.tar.gz
nitrokey-sys-rs-2b367a30df6e155621c116c41cc262dd96ad1a33.tar.bz2
Use quilt to manage modifications in src/ffi.rs
Previously, we manually modified the src/ffi.rs file to add deprecation attributes. With this patch, we use quilt to automatically apply patches with the changes.
-rw-r--r--.gitignore2
-rw-r--r--Makefile2
-rw-r--r--patches/deprecated.diff24
-rw-r--r--patches/series1
4 files changed, 29 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index a821aa9..6091280 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@
/target
**/*.rs.bk
Cargo.lock
+.pc
+patches/*~
diff --git a/Makefile b/Makefile
index dc55e2f..bf47813 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@ BINDGEN ?= bindgen
LIBNITROKEY ?= $(wildcard libnitrokey-v*)
src/ffi.rs: ${LIBNITROKEY}/NK_C_API.h
+ quilt pop -af || true
${BINDGEN} \
--whitelist-function "NK_.*" \
--whitelist-var "NK_.*" \
@@ -9,3 +10,4 @@ src/ffi.rs: ${LIBNITROKEY}/NK_C_API.h
--output "$@" \
"$<" \
-- "-I${LIBNITROKEY}/libnitrokey"
+ quilt push -a
diff --git a/patches/deprecated.diff b/patches/deprecated.diff
new file mode 100644
index 0000000..dff4b55
--- /dev/null
+++ b/patches/deprecated.diff
@@ -0,0 +1,24 @@
+Add deprecated attribute to depracted functions
+
+bindgen does add the deprecated attribute to deprecated functions. This patch
+manually adds the attributes libnitrokey’s deprecated functions.
+Index: nitrokey-sys-rs/src/ffi.rs
+===================================================================
+--- nitrokey-sys-rs.orig/src/ffi.rs
++++ nitrokey-sys-rs/src/ffi.rs
+@@ -763,6 +763,7 @@ extern "C" {
+ /// deprecated in favor of NK_get_status_as_string.
+ /// @return string representation of the status or an empty string
+ /// if the command failed
++ #[deprecated(since = "3.5.0", note="use `NK_get_status_as_string` instead")]
+ pub fn NK_status() -> *mut ::std::os::raw::c_char;
+ }
+ extern "C" {
+@@ -1017,6 +1018,7 @@ extern "C" {
+ pub fn NK_totp_set_time_soft(time: u64) -> ::std::os::raw::c_int;
+ }
+ extern "C" {
++ #[deprecated(since = "3.4.0", note="use `NK_totp_set_time_soft` instead")]
+ pub fn NK_totp_get_time() -> ::std::os::raw::c_int;
+ }
+ extern "C" {
diff --git a/patches/series b/patches/series
new file mode 100644
index 0000000..82bbc83
--- /dev/null
+++ b/patches/series
@@ -0,0 +1 @@
+deprecated.diff