Carl Smedstad pushed to branch main at Arch Linux / Packaging / Packages / 
gemini-cli


Commits:
e3afb1f4 by Carl Smedstad at 2025-12-10T14:34:37+01:00
upgpkg: 1:0.20.0-2: Refactor build to reduce installed size by 90%

Package tarball with bundled source and dependencies during build instead of
using the tarball distributed from npmjs.org. Running upstream's bundling script
de-duplicates dependencies and ensures we don't install unused code and project
files. This reduces the installed size of gemini-cli by 90%:

    Packages (1) gemini-cli-1:0.20.0-2

    Total Installed Size:    28.50 MiB
    Net Upgrade Size:      -277.75 MiB

Packaging from Git source and producing an installable archive with 'npm pack'
also has the following additional benefits:

- Downloading of dependencies now occurs in prepare() and internet access is not
  needed in any other build step.

- Dependencies are downloaded with the '--ignore-scripts' options, mitigating
  malicious life cycle scripts in dependencies. This was the vector used by the
  recent supply-chain attacks on the NPM registry, Shai-Hulud version 1 and 2.

- - - - -


2 changed files:

- .SRCINFO
- PKGBUILD


Changes:

=====================================
.SRCINFO
=====================================
@@ -1,17 +1,18 @@
 pkgbase = gemini-cli
        pkgdesc = Open-source AI agent that brings the power of Gemini directly 
into your terminal
        pkgver = 0.20.0
-       pkgrel = 1
+       pkgrel = 2
        epoch = 1
        url = https://github.com/google-gemini/gemini-cli
        arch = x86_64
        license = Apache-2.0
+       makedepends = git
+       makedepends = jq
        makedepends = npm
        depends = gcc-libs
        depends = glibc
        depends = nodejs
-       noextract = gemini-cli-0.20.0.tgz
-       source = 
https://registry.npmjs.org/@google/gemini-cli/-/gemini-cli-0.20.0.tgz
-       sha512sums = 
627ecd1f0b9fd251e2f9a02cacb999fadd42cb961894749c6b40fc2649c94d40d8f386da3958a7540f6032b611a9311ad53a85226e77a81e8f4eaf2aa22334f5
+       source = git+https://github.com/google-gemini/gemini-cli.git#tag=v0.20.0
+       sha512sums = 
7a7b764cf30237d92e99622b7287c04c19351af5517db8efb2e3b8406593ddde0cc93dbdcc57c6dcb82b3d10896e3651e605b2b9b78433013e5aafda48c5fa59
 
 pkgname = gemini-cli


=====================================
PKGBUILD
=====================================
@@ -3,7 +3,7 @@
 
 pkgname=gemini-cli
 pkgver=0.20.0
-pkgrel=1
+pkgrel=2
 epoch=1
 pkgdesc="Open-source AI agent that brings the power of Gemini directly into 
your terminal"
 arch=(x86_64)
@@ -14,19 +14,37 @@ depends=(
   glibc
   nodejs
 )
-makedepends=(npm)
-source=("https://registry.npmjs.org/@google/$pkgname/-/$pkgname-$pkgver.tgz";)
-noextract=("$pkgname-$pkgver.tgz")
-sha512sums=('627ecd1f0b9fd251e2f9a02cacb999fadd42cb961894749c6b40fc2649c94d40d8f386da3958a7540f6032b611a9311ad53a85226e77a81e8f4eaf2aa22334f5')
+makedepends=(
+  git
+  jq
+  npm
+)
+source=("git+$url.git#tag=v$pkgver")
+sha512sums=('7a7b764cf30237d92e99622b7287c04c19351af5517db8efb2e3b8406593ddde0cc93dbdcc57c6dcb82b3d10896e3651e605b2b9b78433013e5aafda48c5fa59')
 
-package() {
-  npm install --global --omit=dev \
-    --cache "$srcdir/npm-cache" \
-    --prefix "$pkgdir/usr" \
-    $pkgname-$pkgver.tgz
+prepare() {
+  cd $pkgname
+  npm clean-install --ignore-scripts
+}
+
+build() {
+  cd $pkgname
+  npm run bundle
+  local bundled=$(jq '.dependencies + .optionalDependencies | keys' 
package.json)
+  npm pkg set --json bundledDependencies="$bundled"
+  npm pack
+}
+
+check() {
+  cd $pkgname
+  npm run build
+  npm test
+}
 
-  # Remove unnecessary files causing namcap warnings
-  rm -r 
"$pkgdir/usr/lib/node_modules/@google/gemini-cli/node_modules/marked/man"
-  rm 
"$pkgdir/usr/lib/node_modules/@google/gemini-cli/node_modules/shell-quote/print.py"
-  rm 
"$pkgdir/usr/lib/node_modules/@google/gemini-cli/node_modules/open/xdg-open"
+package() {
+  cd $pkgname
+  npm install --global --offline --prefix "$pkgdir/usr" \
+    google-$pkgname-$pkgver.tgz
+  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
+  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
 }



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/gemini-cli/-/commit/e3afb1f4de888a1b49463bcbddb444b28a583c1b

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/gemini-cli/-/commit/e3afb1f4de888a1b49463bcbddb444b28a583c1b
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to