Remove patch which is now upstream.

This commit is contained in:
Richard W.M. Jones 2013-11-20 13:25:14 +00:00
parent 6c086cccf0
commit 8584059215
2 changed files with 0 additions and 84 deletions

View File

@ -1,79 +0,0 @@
From 59596810b009744316941da8ef18b7e75b503b9f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 15 Nov 2013 09:05:43 +0000
Subject: [PATCH] daemon: btrfs: Upstream 'btrfs device add' command now needs
'--force' option to work.
However earlier versions didn't have the --force option, so we
have to detect it.
---
daemon/btrfs.c | 35 +++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 765dec6..0b877f8 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -588,14 +588,29 @@ do_btrfs_filesystem_balance (const char *fs)
return 0;
}
+/* Test if 'btrfs device add' needs the --force option (added
+ * c.2013-09) in order to work.
+ */
+static int
+test_btrfs_device_add_needs_force (void)
+{
+ int r;
+ CLEANUP_FREE char *out = NULL, *err = NULL;
+
+ r = command (&out, &err, "btrfs", "device", "add", "--help", NULL);
+ if (r == -1) {
+ reply_with_error ("%s: %s", "btrfs device add --help", err);
+ return -1;
+ }
+
+ return strstr (out, "--force") != NULL;
+}
+
int
do_btrfs_device_add (char *const *devices, const char *fs)
{
+ static int btrfs_device_add_needs_force = -1;
size_t nr_devices = count_strings (devices);
-
- if (nr_devices == 0)
- return 0;
-
size_t MAX_ARGS = nr_devices + 8;
const char *argv[MAX_ARGS];
size_t i = 0, j;
@@ -603,6 +618,15 @@ do_btrfs_device_add (char *const *devices, const char *fs)
CLEANUP_FREE char *err = NULL;
int r;
+ if (nr_devices == 0)
+ return 0;
+
+ if (btrfs_device_add_needs_force == -1) {
+ btrfs_device_add_needs_force = test_btrfs_device_add_needs_force ();
+ if (btrfs_device_add_needs_force == -1)
+ return -1;
+ }
+
fs_buf = sysroot_path (fs);
if (fs_buf == NULL) {
reply_with_perror ("malloc");
@@ -613,6 +637,9 @@ do_btrfs_device_add (char *const *devices, const char *fs)
ADD_ARG (argv, i, "device");
ADD_ARG (argv, i, "add");
+ if (btrfs_device_add_needs_force)
+ ADD_ARG (argv, i, "--force");
+
for (j = 0; j < nr_devices; ++j)
ADD_ARG (argv, i, devices[j]);
--
1.8.3.1

View File

@ -19,9 +19,6 @@ License: LGPLv2+
URL: http://libguestfs.org/ URL: http://libguestfs.org/
Source0: http://libguestfs.org/download/1.25-development/%{name}-%{version}.tar.gz Source0: http://libguestfs.org/download/1.25-development/%{name}-%{version}.tar.gz
# Upstream patch to fix btrfs tests.
Patch1: 0001-daemon-btrfs-Upstream-btrfs-device-add-command-now-n.patch
# Basic build requirements: # Basic build requirements:
BuildRequires: perl(Pod::Simple) BuildRequires: perl(Pod::Simple)
BuildRequires: perl(Pod::Man) BuildRequires: perl(Pod::Man)
@ -570,8 +567,6 @@ for %{name}.
%prep %prep
%setup -q %setup -q
%patch1 -p1
if [ "$(getenforce | tr '[A-Z]' '[a-z]')" != "disabled" ]; then if [ "$(getenforce | tr '[A-Z]' '[a-z]')" != "disabled" ]; then
# For sVirt to work, the local temporary directory we use in the # For sVirt to work, the local temporary directory we use in the
# tests must be labelled the same way as /tmp. # tests must be labelled the same way as /tmp.