commit ef933162261ea7b90975199ee7c1a53cf004a10b Author: Jérôme Poulin Date: Wed Feb 25 18:12:26 2026 -0500 feat: shallow sparse clone instead of full kernel mirror makepkg hardcodes git clone --mirror with no depth/filter/sparse support, pulling ~2.75 GB for the full kernel tree. Handle the clone manually with --depth=1 --filter=blob:none --sparse, fetching only fs/bcachefs and include (~92 MB). Switch pkgver to date-based format (works with --depth=1). diff --git a/PKGBUILD b/PKGBUILD index f3a5354..a0d91e1 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,8 @@ # Maintainer: neycrol <330578697@qq.com> pkgname=bcachefs-kernel-dkms-git _pkgname=bcachefs-kernel -pkgver=r1385308.357e37e +_branch=master +pkgver=20260223005232.357e37e pkgrel=1 # Required because earlier releases used timestamp-based pkgver values. epoch=1 @@ -18,28 +19,51 @@ optdepends=( # Compatibility: this package replaces alternative bcachefs DKMS/source providers. provides=("bcachefs-dkms=${pkgver}") conflicts=('bcachefs-dkms' 'bcachefs-git' 'bcachefs-source-git') +# Git source handled manually via _fetch_source() for shallow sparse clone +# (makepkg hardcodes --mirror with no depth/filter/sparse support). source=( - "${_pkgname}::git+https://github.com/koverstreet/bcachefs.git#branch=master" "dkms.conf.in" "Makefile.dkms" ) -sha256sums=('SKIP' - 'b57dd60f10e457258b894badc561f9a43339ae7491aebf3a98e56ef74934dfa0' +sha256sums=('b57dd60f10e457258b894badc561f9a43339ae7491aebf3a98e56ef74934dfa0' 'a37fa1baaf8825631ceff9410b3be78e06d19833814586cd3140b4af9c2f8d14') +_fetch_source() { + local _dir="$startdir/$_pkgname" + + # Migrate from old bare mirror clone left by makepkg's git source handler. + if [[ -f "$_dir/HEAD" && ! -d "$_dir/.git" ]]; then + msg2 "Removing old bare mirror clone..." + rm -rf "$_dir" + fi + + if [[ -d "$_dir/.git" ]]; then + msg2 "Updating shallow sparse clone..." + git -C "$_dir" fetch --depth=1 origin "$_branch" + git -c advice.detachedHead=false -C "$_dir" checkout FETCH_HEAD + else + msg2 "Cloning (shallow sparse)..." + git clone --depth=1 --filter=blob:none --no-checkout --sparse \ + "${url}.git" "$_dir" + git -C "$_dir" sparse-checkout set fs/bcachefs include + git -C "$_dir" checkout + fi + + ln -sfn "$_dir" "$srcdir/$_pkgname" +} + pkgver() { + _fetch_source >&2 cd "$srcdir/$_pkgname" - - # Arch VCS guideline-compatible, deterministic, and network-free. - printf "r%s.%s" \ - "$(git rev-list --count HEAD)" \ + printf "%s.%s" \ + "$(TZ=UTC git log -1 --format=%cd --date=format:%Y%m%d%H%M%S)" \ "$(git rev-parse --short=7 HEAD)" } prepare() { + _fetch_source local _repo_dir="$srcdir/$_pkgname" - # Sources come from makepkg source() stage; no network access here. rm -rf "$srcdir/build" install -dm755 "$srcdir/build"