From 52e6bd7cc34862eca690b2a0332a623252d216ff Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 12 Sep 2019 08:39:04 +0100 Subject: [PATCH] Add upstream patch to fix nbdsh (for nbdkit tests). --- 0001-nbdsh-Fix-behaviour-of-globals.patch | 30 +++++++++++++++++++++++ libnbd.spec | 8 +++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 0001-nbdsh-Fix-behaviour-of-globals.patch diff --git a/0001-nbdsh-Fix-behaviour-of-globals.patch b/0001-nbdsh-Fix-behaviour-of-globals.patch new file mode 100644 index 0000000..c97e2d6 --- /dev/null +++ b/0001-nbdsh-Fix-behaviour-of-globals.patch @@ -0,0 +1,30 @@ +From d6cbd130101add28431bd6e67aa2ea0430a9234e Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 11 Sep 2019 22:25:57 +0100 +Subject: [PATCH] nbdsh: Fix behaviour of globals. + +https://stackoverflow.com/a/11754346 +--- + python/nbdsh.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/python/nbdsh.py b/python/nbdsh.py +index bb0db64..553e632 100644 +--- a/python/nbdsh.py ++++ b/python/nbdsh.py +@@ -57,8 +57,10 @@ help (nbd) # Display documentation + if not args.command: + code.interact (banner = banner, local = locals(), exitmsg = '') + else: ++ # https://stackoverflow.com/a/11754346 ++ d = dict (locals(), **globals()) + for c in args.command: + if c != '-': +- exec (c) ++ exec (c, d, d) + else: +- exec (sys.stdin.read ()) ++ exec (sys.stdin.read (), d, d) +-- +2.23.0 + diff --git a/libnbd.spec b/libnbd.spec index 1b3fcec..ada7fb8 100644 --- a/libnbd.spec +++ b/libnbd.spec @@ -9,7 +9,7 @@ Name: libnbd Version: 1.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: NBD client library in userspace License: LGPLv2+ @@ -22,6 +22,9 @@ Source1: http://libguestfs.org/download/libnbd/%{source_directory}/%{name # https://pgp.key-server.io/pks/lookup?search=rjones%40redhat.com&fingerprint=on&op=vindex Source2: libguestfs.keyring +# Upstream patch to fix nbdsh. +Patch0001: 0001-nbdsh-Fix-behaviour-of-globals.patch + %if 0%{patches_touch_autotools} BuildRequires: autoconf, automake, libtool %endif @@ -219,6 +222,9 @@ make %{?_smp_mflags} check || { %changelog +* Thu Sep 12 2019 Richard W.M. Jones - 1.1.1-2 +- Add upstream patch to fix nbdsh (for nbdkit tests). + * Sun Sep 08 2019 Richard W.M. Jones - 1.1.1-1 - New development version 1.1.1.