You are not logged in.

#1 2021-12-02 20:04:02

alfalfa
Member
Registered: 2017-06-30
Posts: 62
Website

(Solved) Download source with --single-branch parameter in PKGBUILD

My project has a stale branch to store large files unused at build time, such as to binaries and screenshots. The source can be cloned manually using git clone <url> --single-branch. In the PKGBUILD however, adding a fragment (#branch=master) still download the whole repository. I read that the source may be pulled from the prepare() function instead, but found no examples. Is it possible to bypass the automated source download and pass custom arguments to git? If so, can anyone provide a working example?

My PKGBUILD file;

pkgname=primenote-git
pkgver=0
pkgrel=1
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
pkgdesc="Fanciest sticky note-taking application (now with Vim!)"
url="https://gitlab.com/william.belanger/${pkgname%-git}"
arch=("any")
license=("GPL3")
depends=("python" "python-setuptools" "python-pyqt5" "python-requests")
optdepends=("qtermwidget: support for console and Vim modes"
            "vim: support for Vim mode")
source=("git+https://gitlab.com/william.belanger/${pkgname%-git}.git#branch=master")
md5sums=("SKIP")

pkgver()
{
  cd "${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

package()
{
  cd "${pkgname%-git}"
  python setup.py install --optimize="1" --root="$pkgdir"
}

Last edited by alfalfa (2021-12-03 01:54:19)

Offline

#2 2021-12-02 22:39:43

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,126
Website

Re: (Solved) Download source with --single-branch parameter in PKGBUILD

All you do is remove the git entry from the source line, then use whatever git command you want in prepare().

Offline

#3 2021-12-02 22:48:12

alfalfa
Member
Registered: 2017-06-30
Posts: 62
Website

Re: (Solved) Download source with --single-branch parameter in PKGBUILD

I tried to, but removing source gives
==> ERROR: Integrity checks (md5) differ in size from the source array.

and putting an empty string gives
==> ERROR:  was not found in the build directory and is not a URL.

Offline

#4 2021-12-03 01:19:18

loqs
Member
Registered: 2014-03-06
Posts: 14,462

Re: (Solved) Download source with --single-branch parameter in PKGBUILD

pkgname=NAME
pkgver=VERSION
pkgrel=1
pkgdesc=""
arch=('any')
url=""
license=('GPL')
makedepends=('git')

prepare() {
	git clone https://github.com/archlinux/svntogit-packages.git --single-branch --branch "packages/pacman" pacman
}

Offline

#5 2021-12-03 01:59:38

alfalfa
Member
Registered: 2017-06-30
Posts: 62
Website

Re: (Solved) Download source with --single-branch parameter in PKGBUILD

It works with makedepends. Thank you.

pkgver=r494.36db029
pkgrel=1
pkgname=primenote-git
pkgdesc="Fanciest sticky note-taking application (now with Vim!)"
arch=("any")
url="https://gitlab.com/william.belanger/${pkgname%-git}"
license=("GPL3")
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")

makedepends=("git")
depends=("python" "python-setuptools" "python-pyqt5" "python-requests")
optdepends=("qtermwidget: support for console and Vim modes"
            "vim: support for Vim mode")

pkgver()
{
  cd "${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  git clone https://gitlab.com/william.belanger/${pkgname%-git}.git --single-branch
}

package()
{
  cd "${pkgname%-git}"
  python setup.py install --optimize="1" --root="$pkgdir"
}

Offline

Board footer

Powered by FluxBB