You are not logged in.

#1 2023-12-28 19:59:55

herr_brain
Member
Registered: 2023-11-26
Posts: 5

Split PKGBUILD -- how do I manually extract a git repo?

Hello, I've been making my own PKGBUILD for zfs, and I'm trying to implement it as a split package since zfs-dkms and zfs-utils share the same source repository. However, I've run into a few caveats:

  1. I use pkgver() to determine the tag of the latest release, so I can't specify the fragment in the sources URL. This causes makepkg to create a non-tracking branch that I can't use.

  2. Since each package has a separate build configuration, I end up creating a worktree in srcdir. This results in an error that prevents me from rebuilding without passing the -C option to makepkg.

Ideally, I would like to be able to include git+https://github.com/openzfs/zfs.git in the noextract list and perform my the branch/checkout operation myself in prepare().

Here is my current prepare() implementation:

prepare() {
    cd "${srcdir}/zfs"

    # Verify signature and create separate worktree for dkms
    git tag --verify "zfs-${pkgver}"
    git checkout "zfs-${pkgver}"
    git worktree add -d ../zfs-dkms "zfs-${pkgver}"

    # Generate makefiles for zfs-utils
    ./autogen.sh

    # Apply build config changes for zfs-dkms
    cd "${srcdir}/zfs-dkms"
    patch -p1 -i ../dkms-configure.ac.patch
    patch -p1 -i ../dkms.mkconf.patch
    ./autogen.sh
}

Offline

#2 2023-12-28 22:51:01

yochananmarqos
Member
Registered: 2020-02-05
Posts: 192

Re: Split PKGBUILD -- how do I manually extract a git repo?

VCS sources aren't extracted because there's nothing to extract since the source is not an archive. However, makepkg is going to do a git pull no matter what. You can control it in the source() array, don't do it in prepare().

source=("git+https://github.com/openzfs/zfs.git#tag=$pkgver?signed"
validpgpkeys=('4F3BA9AB6D1F8D683DC2DFB56AD860EED4598027'  # Tony Hutter (GPG key for signing ZFS releases) <hutter2@llnl.gov>
              'C33DF142657ED1F7C328A2960AB9E991C6AF658B') # Brian Behlendorf <behlendorf1@llnl.gov>

pkgver() {
  cd "$pkgname"
  git describe --tags | sed 's/-/+/g'
}

Offline

#3 2023-12-28 23:29:38

herr_brain
Member
Registered: 2023-11-26
Posts: 5

Re: Split PKGBUILD -- how do I manually extract a git repo?

yochananmarqos wrote:

VCS sources aren't extracted because there's nothing to extract since the source is not an archive. However, makepkg is going to do a git pull no matter what. You can control it in the source() array, don't do it in prepare().

The issue is that pkgver() is called later, which results in the wrong version being checked out.

Offline

#4 2023-12-28 23:37:51

yochananmarqos
Member
Registered: 2020-02-05
Posts: 192

Re: Split PKGBUILD -- how do I manually extract a git repo?

The pkgver() function does not do anything except generate the pkgver. Again, the source() array is where git tags are checked out. The prepare() function runs before pkgver(), by the way.

Offline

#5 2023-12-29 00:31:33

herr_brain
Member
Registered: 2023-11-26
Posts: 5

Re: Split PKGBUILD -- how do I manually extract a git repo?

So, does that mean I can't/shouldn't be checking out my own tags in prepare()?

Offline

#6 2023-12-29 00:33:34

yochananmarqos
Member
Registered: 2020-02-05
Posts: 192

Re: Split PKGBUILD -- how do I manually extract a git repo?

Right.

Offline

#7 2023-12-29 00:38:57

herr_brain
Member
Registered: 2023-11-26
Posts: 5

Re: Split PKGBUILD -- how do I manually extract a git repo?

In that case, how should I be handling this? I'm wanting to track the latest official release automatically. Since both packages are built from the same source tree (and the build order matters), I would like it to be a split package.

Offline

#8 2023-12-29 00:46:20

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,309

Re: Split PKGBUILD -- how do I manually extract a git repo?

First off, you either use a VCS package, building from git HEAD, or you use a release package, building from a specific commit/tag. You can't make a PKGBUILD that updates automatically to the latest release.

Second, a single git repo doesn't make it a split package, a single build does. If it's separate builds, make separate PKGBUILDs. Set SRCDEST so it doesn't have to clone from upstream again.

Offline

#9 2023-12-29 14:05:16

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,812

Re: Split PKGBUILD -- how do I manually extract a git repo?

Is it important for you that both packages are build from the same commit ?

If yes, https://bbs.archlinux.org/viewtopic.php?id=285786

If not, SRCDEST is the way to go.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

Board footer

Powered by FluxBB