[libguestfs/f20] Rebuild to push change to PPC (secondary arches) RHBZ#1036742.

Richard W.M. Jones rjones at fedoraproject.org
Thu Dec 5 22:14:18 UTC 2013


commit 246a0912787843e0f9f6a86977a03ca793ecd315
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Thu Dec 5 22:11:19 2013 +0000

    Rebuild to push change to PPC (secondary arches) RHBZ#1036742.
    
    - Backport upstream (but not 1.24) patch to workaround changed btrfs behaviour.

 ...s-Upstream-btrfs-device-add-command-now-n.patch |   79 ++++++++++++++++++++
 libguestfs.spec                                    |    8 ++-
 2 files changed, 85 insertions(+), 2 deletions(-)
---
diff --git a/0001-daemon-btrfs-Upstream-btrfs-device-add-command-now-n.patch b/0001-daemon-btrfs-Upstream-btrfs-device-add-command-now-n.patch
new file mode 100644
index 0000000..d63d548
--- /dev/null
+++ b/0001-daemon-btrfs-Upstream-btrfs-device-add-command-now-n.patch
@@ -0,0 +1,79 @@
+From 59596810b009744316941da8ef18b7e75b503b9f Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones at 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
+
diff --git a/libguestfs.spec b/libguestfs.spec
index 4d59a89..3bf0de6 100644
--- a/libguestfs.spec
+++ b/libguestfs.spec
@@ -12,7 +12,7 @@ Summary:       Access and modify virtual machine disk images
 Name:          libguestfs
 Epoch:         1
 Version:       1.24.1
-Release:       4%{?dist}
+Release:       5%{?dist}
 License:       LGPLv2+
 
 # Source and patches.
@@ -64,6 +64,9 @@ Patch0036:     0036-mllib-Add-a-utility-function-for-safely-reading-from.patch
 Patch0037:     0037-Avoid-modulo-bias-in-random-password-generation.patch
 # Add any non-git patches here.
 
+# Upstream (but not 1.24) patch to workaround changed btrfs behaviour.
+Patch1000:     0001-daemon-btrfs-Upstream-btrfs-device-add-command-now-n.patch
+
 # Use git for patch management.
 BuildRequires: git
 
@@ -1053,8 +1056,9 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/libguestfs
 
 
 %changelog
-* Thu Dec 05 2013 Richard W.M. Jones <rjones at redhat.com> - 1:1.24.1-4
+* Thu Dec 05 2013 Richard W.M. Jones <rjones at redhat.com> - 1:1.24.1-5
 - Rebuild to push change to PPC (secondary arches) RHBZ#1036742.
+- Backport upstream (but not 1.24) patch to workaround changed btrfs behaviour.
 
 * Thu Nov 14 2013 Richard W.M. Jones <rjones at redhat.com> - 1:1.24.1-3
 - Backport further virt-builder fixes from upstream.


More information about the scm-commits mailing list