Package Details: glab-git 1.22.0.r168.g11a81099-2

Git Clone URL: https://aur.archlinux.org/glab-git.git (read-only, click to copy)
Package Base: glab-git
Description: Cli tool to help work seamlessly with Gitlab from the command line
Upstream URL: https://gitlab.com/gitlab-org/cli
Keywords: cli gitlab glab shell terminal
Licenses: MIT
Conflicts: glab
Provides: glab
Replaces: gitlab-glab-git
Submitter: Humandoodlebug
Maintainer: Humandoodlebug (BreD1810)
Last Packager: Humandoodlebug
Votes: 2
Popularity: 0.004193
First Submitted: 2022-03-18 10:53 (UTC)
Last Updated: 2022-10-30 09:55 (UTC)

Dependencies (3)

Required by (0)

Sources (1)

Pinned Comments

Humandoodlebug commented on 2024-03-29 09:00 (UTC) (edited on 2024-03-29 09:02 (UTC) by Humandoodlebug)

Before it gets flagged out-of-date again: This is a VCS package. It may show an out-of-date version, but the correct version will be calculated at build time. I have just checked and it still builds and installs the latest version (currently 1.37.0.r8.g3fc655c9) just fine.

If you have any issues, let me know in the comments before marking the package out-of-date.

Latest Comments

Humandoodlebug commented on 2024-03-29 09:00 (UTC) (edited on 2024-03-29 09:02 (UTC) by Humandoodlebug)

Before it gets flagged out-of-date again: This is a VCS package. It may show an out-of-date version, but the correct version will be calculated at build time. I have just checked and it still builds and installs the latest version (currently 1.37.0.r8.g3fc655c9) just fine.

If you have any issues, let me know in the comments before marking the package out-of-date.

Humandoodlebug commented on 2023-04-12 13:24 (UTC)

@m040601 this package was previously named gitlab-glab-git before the glab package made it into the official repos, at which point I renamed it to match. Is the replaces field causing an issue for you? If so, I can remove it.

m040601 commented on 2023-04-12 04:05 (UTC) (edited on 2023-04-12 04:08 (UTC) by m040601)

   Replaces:     gitlab-glab-git

There is nothing called "gitlab-glab-git" on the AUR. There is the official Arch packaged "glab" in community. And somebody published today in the AUR a "glab-bin", which I dont see the point.

Humandoodlebug commented on 2022-10-30 10:07 (UTC)

@alerque tyvm! That's definitely made for a cleaner PKGBUILD. I originally based this on the gitlab-glab package, but I see a lot changed when it was migrated to the official repos.

alerque commented on 2022-10-30 07:44 (UTC) (edited on 2022-10-30 07:46 (UTC) by alerque)

Actually there are quite a few issues with this PKGBUILD. It doesn't follow the Arch guidelines on fields at all. The generated binary doesn't have RELRO support because the wrong Go flags are setup. It isn't reproducible because the date field doesn't take that support into account. And so forth.

I've cleaned it up so it builds in a clean chroot and follows all or most Arch packaging guidance. Here is a patch you can save to a file and apply to your Git repo with git am file.patch:

From c3dee3d732fde29d6a85cba2254dc310756d604a Mon Sep 17 00:00:00 2001
From: Caleb Maclennan <caleb@alerque.com>
Date: Sun, 30 Oct 2022 10:41:32 +0300
Subject: [PATCH] Overhaul package to fix Go flags, reproducible builds,
 dependencies, and Arch package guidelines

Signed-off-by: Caleb Maclennan <caleb@alerque.com>
---
 .SRCINFO |  9 ++++----
 PKGBUILD | 65 +++++++++++++++++++++++++-------------------------------
 2 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/.SRCINFO b/.SRCINFO
index b229696..0dbed66 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,17 @@
 pkgbase = glab-git
    pkgdesc = Cli tool to help work seamlessly with Gitlab from the command line
    pkgver = 1.22.0.r168.g11a81099
-   pkgrel = 1
+   pkgrel = 2
    url = https://gitlab.com/gitlab-org/cli
    arch = x86_64
    license = MIT
+   makedepends = git
    makedepends = go
    depends = glibc
-   provides = glab
+   provides = glab=1.22.0.r168.g11a81099
    conflicts = glab
    replaces = gitlab-glab-git
-   source = git+https://gitlab.com/gitlab-org/cli.git
-   md5sums = SKIP
+   source = glab-git::git+https://gitlab.com/gitlab-org/cli.git
+   sha256sums = SKIP

 pkgname = glab-git
diff --git a/PKGBUILD b/PKGBUILD
index 864eb98..6999206 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,60 +1,53 @@
 # Maintainer: Samuel Collins <samuel.collins@live.co.uk>
 # Co-Maintainer: Bradley Garrod <bradleybredgarrod@gmail.com>
+# Contributor: Caleb Maclennan <caleb@alerque.com>

 pkgname=glab-git
-_reponame=cli
 pkgver=1.22.0.r168.g11a81099
-pkgrel=1
-epoch=
-pkgdesc="Cli tool to help work seamlessly with Gitlab from the command line"
+pkgrel=2
+pkgdesc='Cli tool to help work seamlessly with Gitlab from the command line'
 arch=(x86_64)
 url="https://gitlab.com/gitlab-org/cli"
-license=('MIT')
-groups=()
+license=(MIT)
 depends=(glibc)
-makedepends=(go)
-checkdepends=()
-optdepends=()
-provides=(glab)
+makedepends=(git
+             go)
+provides=("glab=$pkgver")
 conflicts=(glab)
 replaces=(gitlab-glab-git)
-backup=()
-options=()
-install=
-changelog=
-source=(git+$url.git)
-noextract=()
-md5sums=(SKIP)
-validpgpkeys=()
+source=("$pkgname::git+$url.git")
+sha256sums=(SKIP)

 pkgver() {
-    cd "${_reponame}"
+    cd "$pkgname"
     git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
 }

 prepare(){
-  cd "${_reponame}"
-  mkdir -p build/
+    cd "$pkgname"
+    mkdir -p build
 }

 build() {
-  export GOPATH="$srcdir"/gopath
-  cd "${_reponame}"
-  export CGO_CPPFLAGS="${CPPFLAGS}"
-  export CGO_CFLAGS="${CFLAGS}"
-  export CGO_CXXFLAGS="${CXXFLAGS}"
-  export CGO_LDFLAGS="${LDFLAGS}"
-  _builddate=$(date -u +%m/%d/%Y)
-  go build -o build -trimpath -buildmode=pie -ldflags "-extldflags \"${LDFLAGS}\" -X main.version=v${pkgver} -X main.build=${_builddate} -X main.usageMode=prod -s -w" -modcacherw ./cmd/glab/main.go
+    cd "$pkgname"
+    export GOPATH="$srcdir"/gopath
+    local _date=$(date +'%Y/%m/%d' ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})
+    go build \
+      -trimpath \
+      -buildmode=pie \
+      -modcacherw \
+      -ldflags "-linkmode external -extldflags \"$LDFLAGS\" -X main.version=v$pkgver -X main.build=$_date -X main.usageMode=prod -s -w" \
+      -o build \
+      ./cmd/glab/main.go
 }

 package() {
-  cd "${_reponame}"
-  install -Dm755 build/main "$pkgdir"/usr/bin/glab
-  install -Dm644 $srcdir/${_reponame}/LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
+    cd "$pkgname"
+    install -Dm0755 build/main "$pkgdir/usr/bin/glab"
+    install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE

-   # Shell completions
-   build/main completion -s bash | install -Dm644 /dev/stdin "${pkgdir}/usr/share/bash-completion/completions/glab"
-   build/main completion -s zsh | install -Dm644 /dev/stdin "${pkgdir}/usr/share/zsh/site-functions/_glab"
-   build/main completion -s fish | install -Dm644 /dev/stdin "${pkgdir}/usr/share/fish/vendor_completions.d/glab.fish"
+    # Shell completions
+    build/main completion -s bash | install -Dm0644 /dev/stdin "$pkgdir/usr/share/bash-completion/completions/glab"
+    build/main completion -s zsh  | install -Dm0644 /dev/stdin "$pkgdir/usr/share/zsh/site-functions/_glab"
+    build/main completion -s fish | install -Dm0644 /dev/stdin "$pkgdir/usr/share/fish/vendor_completions.d/glab.fish"
 }
-- 
2.38.1

alerque commented on 2022-10-30 07:26 (UTC) (edited on 2022-10-30 07:27 (UTC) by alerque)

Thanks!

One more thing: this is missing makedepends=(git) which is required to build.

alerque commented on 2022-10-29 14:45 (UTC)

Please update this to the new upstream repository location, it no longer builds the latest code since the repo moved to GitLab.