buildah: fix build with btrfs-tools 6.1

We'd really prefer to bump the vendor SRCREV and allow the fetcher
to bring in the pending change without needing a patch, but there
are other API changes that trickle through the code.

So we extract just the patch we need, and leave the SRCREV info
in the recipe, to document the source. When the upstream updates
its vendor/ directory, we can drop this (as the patch will no
longer apply)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Bruce Ashfield 2023-01-10 13:32:59 -05:00
parent 67e8b34d99
commit 0b9260ade5
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 246ba3062e8b551026aef2708eee747014ce5c52 Mon Sep 17 00:00:00 2001
From: Rui Chen <rui@chenrui.dev>
Date: Wed, 28 Dec 2022 18:26:39 -0500
Subject: [PATCH] fix: workaround field rename in btrfs-progs 6.1
same as kdave/btrfs-progs@0345143
Signed-off-by: Rui Chen <rui@chenrui.dev>
---
drivers/btrfs/btrfs.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/btrfs/btrfs.go b/drivers/btrfs/btrfs.go
index e8b16b858..3d9053297 100644
--- a/drivers/btrfs/btrfs.go
+++ b/drivers/btrfs/btrfs.go
@@ -6,6 +6,9 @@ package btrfs
/*
#include <stdlib.h>
#include <dirent.h>
+
+// keep struct field name compatible with btrfs-progs < 6.1.
+#define max_referenced max_rfer
#include <btrfs/ioctl.h>
#include <btrfs/ctree.h>
@@ -382,7 +385,7 @@ func subvolLimitQgroup(path string, size uint64) error {
defer closeDir(dir)
var args C.struct_btrfs_ioctl_qgroup_limit_args
- args.lim.max_referenced = C.__u64(size)
+ args.lim.max_rfer = C.__u64(size)
args.lim.flags = C.BTRFS_QGROUP_LIMIT_MAX_RFER
_, _, errno := unix.Syscall(unix.SYS_IOCTL, getDirFd(dir), C.BTRFS_IOC_QGROUP_LIMIT,
uintptr(unsafe.Pointer(&args)))
--
2.34.1

View File

@ -9,7 +9,6 @@ LIC_FILES_CHKSUM = "file://src/github.com/containers/buildah/LICENSE;md5=e3fc50a
S = "${WORKDIR}/git"
BUILDAH_VERSION = "1.28"
SRCREV_buildah = "cfefbb64ea1fe3639c231f73e7b09bfe300744ac"
PV = "${BUILDAH_VERSION}"
@ -22,9 +21,18 @@ GO_INSTALL = "${GO_IMPORT}"
GO_WORKDIR = "${GO_INSTALL}"
GOBUILDFLAGS += "-mod vendor"
SRCREV_FORMAT = "buildah_storage"
SRCREV_buildah = "cfefbb64ea1fe3639c231f73e7b09bfe300744ac"
SRCREV_storage = "246ba3062e8b551026aef2708eee747014ce5c52"
SRC_URI = " \
git://github.com/containers/buildah;branch=release-${BUILDAH_VERSION};name=buildah;protocol=https \
"
# Due to some other API changes, we can't directly import containers/storage at
# the right commit, so we instead extract a patch and apply it to the tree
# SRC_URI += "git://github.com/containers/storage;protocol=https;name=storage;branch=main;destsuffix=git/src/github.com/containers/buildah/vendor/github.com/containers/storage"
SRC_URI += "file://0001-fix-workaround-field-rename-in-btrfs-progs-6.1.patch;patchdir=src/github.com/containers/buildah/vendor/github.com/containers/storage"
DEPENDS = "libdevmapper btrfs-tools gpgme"
RDEPENDS:${PN} = "cgroup-lite fuse-overlayfs libdevmapper podman"