Christian Hesse pushed to branch main at Arch Linux / Packaging / Packages / 
grep


Commits:
e7a24b27 by Robin Candau at 2025-12-05T13:47:26+01:00
Fix unstable GNU translations

GNU does not include PO files (used for translations) in their git repositories.
When building GNU software from git sources, PO files are downloaded during the 
bootstrap script in `prepare()` from https://translationproject.org/latest/ in 
an unstable way (see `/latest/` in the URL).

This is problematic because:

- It implies file downloading **during** the build process (which should 
generally be avoided)
- It may break reproducibility
- It may ship unstable / unmatching translation files to users

Fully switching back to dist tarball as the *primary* source for the package is 
not desirable as per our guidelines established in [RFC 
46](https://rfc.archlinux.page/0046-upstream-package-sources/).
As such, we are only building & installing translation files from the dist 
tarball, the software itself is still compiled against git / "transparent" 
sources.

See the [related ToDo 
list](https://archlinux.org/todo/unstable-gnu-translations/) (and additional 
links there) for more details and rationale.

- - - - -


2 changed files:

- .SRCINFO
- PKGBUILD


Changes:

=====================================
.SRCINFO
=====================================
@@ -16,8 +16,12 @@ pkgbase = grep
        depends = sh
        source = git+https://git.savannah.gnu.org/git/grep.git#tag=v3.12?signed
        source = git+https://git.savannah.gnu.org/git/gnulib.git
+       source = https://ftp.gnu.org/gnu/grep/grep-3.12.tar.gz
+       source = https://ftp.gnu.org/gnu/grep/grep-3.12.tar.gz.sig
        validpgpkeys = 155D3FC500C834486D1EEA677FD9FCCB000BEEEE
        sha256sums = 
9543190d9ca2201ea46fddaeb39031a0acde1f6aa4351a72f33ef3455e6dd41e
        sha256sums = SKIP
+       sha256sums = 
badda546dfc4b9d97e992e2c35f3b5c7f20522ffcbe2f01ba1e9cdcbe7644cdc
+       sha256sums = SKIP
 
 pkgname = grep


=====================================
PKGBUILD
=====================================
@@ -14,13 +14,21 @@ makedepends=('gperf' 'git' 'python' 'texinfo' 'wget')
 checkdepends=('glibc-locales')
 validpgpkeys=('155D3FC500C834486D1EEA677FD9FCCB000BEEEE') # Jim Meyering
 source=("git+https://git.savannah.gnu.org/git/grep.git#tag=v${pkgver}?signed";
-        "git+https://git.savannah.gnu.org/git/gnulib.git";)
+        "git+https://git.savannah.gnu.org/git/gnulib.git";
+        "https://ftp.gnu.org/gnu/grep/grep-${pkgver}.tar.gz"{,.sig})
 sha256sums=('9543190d9ca2201ea46fddaeb39031a0acde1f6aa4351a72f33ef3455e6dd41e'
+            'SKIP'
+            'badda546dfc4b9d97e992e2c35f3b5c7f20522ffcbe2f01ba1e9cdcbe7644cdc'
             'SKIP')
 
 prepare() {
   cd $pkgname
 
+  # Skip downloading unstable po files in bootstrap scripts to avoid 
non-deterministic builds
+  export SKIP_PO="1"
+  # The $SKIP_PO environment variable is only honored by the gnulib submodule 
if using its "sh" implementation
+  export GNULIB_TOOL_IMPL="sh"
+
   git submodule init
   git config submodule.gnulib.url "${srcdir}/gnulib"
   git -c protocol.file.allow=always submodule update
@@ -35,6 +43,12 @@ build() {
   cd $pkgname
   ./configure --prefix=/usr
   make
+
+  # Generate grep mo files from dist tarball
+  cd "${srcdir}/${pkgname}-${pkgver}/po"
+  for po in *.po; do
+    msgfmt "${po}" -o "${po%.po}.mo"
+  done
 }
 
 check() {
@@ -45,4 +59,10 @@ check() {
 package() {
   cd $pkgname
   make DESTDIR="$pkgdir" install
+
+  # Install grep mo files from dist tarball
+  cd "${srcdir}/${pkgname}-${pkgver}/po"
+  for mo in *.mo; do
+    install -Dm 644 "${mo}" 
"${pkgdir}/usr/share/locale/${mo%.mo}/LC_MESSAGES/${pkgname}.mo"
+  done
 }



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/grep/-/commit/e7a24b27b5b9a0d3c25c8e140e7f5ba6b6d80bd0

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


Reply via email to