[arch-commits] Commit in lhapdf/trunk (PKGBUILD fix_installed_pdf_permissions.patch)

Konstantin Gizdov kgizdov at gemini.archlinux.org
Fri Aug 19 14:55:43 UTC 2022


    Date: Friday, August 19, 2022 @ 14:55:43
  Author: kgizdov
Revision: 1270915

add LDFLAGS, LTOFLAGS and fix PDF install permissions

Added:
  lhapdf/trunk/fix_installed_pdf_permissions.patch
Modified:
  lhapdf/trunk/PKGBUILD

-------------------------------------+
 PKGBUILD                            |   17 ++++++++++-------
 fix_installed_pdf_permissions.patch |   30 ++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 7 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-08-19 14:44:02 UTC (rev 1270914)
+++ PKGBUILD	2022-08-19 14:55:43 UTC (rev 1270915)
@@ -3,7 +3,7 @@
 # Contributor: JP-Ellis <josh at jpellis dot me>
 pkgname=lhapdf
 pkgver=6.5.2
-pkgrel=3
+pkgrel=4
 pkgdesc="A particle physics tool for evaluating PDFs from discretised data files"
 arch=('x86_64')
 url="https://lhapdf.hepforge.org/"
@@ -11,12 +11,18 @@
 makedepends=('cython')
 depends=('python-numpy')
 install=lhapdf.install
-source=("https://www.hepforge.org/archive/lhapdf/LHAPDF-${pkgver}.tar.gz")
-sha256sums=('608a2753455e067a9940b5c16bc86ab6c47e2c749bc9dd19796996eb4352b2fd')
+source=("https://www.hepforge.org/archive/lhapdf/LHAPDF-${pkgver}.tar.gz"
+        'fix_installed_pdf_permissions.patch')
+b2sums=('630846f6105351d0561619f59810d23d936043842b0524d3818153416d116833ca550a940824a74ee9c6684d8d2ea59e72f3a74b3238fd3dc2828937c1422185'
+        'c875018d666331588051adc394b24c40321d78573ec33ef9312ea8779eeb6cf15ea845a5267d4dc6530cc82050e782affc908b9a6727aa3125b9f0086f1917a2')
 
 prepare() {
   cd "${srcdir}/LHAPDF-${pkgver}"
-  sed -e 's/print Cython.Compiler.Version.version/print (Cython.Compiler.Version.version)/g' -i m4/cython.m4
+
+  # add in correct flags
+  sed -e 's/-L at abs_top_builddir@\/src\/.libs/-L at abs_top_builddir@\/src\/.libs '"${LDFLAGS} ${LTOFLAGS}"'/g' -i wrappers/python/build.py.in
+  # installed PDFs must respect system permissions and ownership structure
+  patch -Np1 -i "${srcdir}/fix_installed_pdf_permissions.patch"
 }
 
 build() {
@@ -23,9 +29,6 @@
   cd "${srcdir}/LHAPDF-${pkgver}"
   export CXXFLAGS="$CFLAGS"  # do not define _GLIBCXX_ASSERTIONS
   autoreconf -i
-  ## need to rebuild Python extension code with up-to-date Cython for Python 3.7+
-  ## will eventually be fixed upstream
-  touch wrappers/python/lhapdf.pyx
   ./configure \
     --prefix=/usr \
     --sysconfdir=/etc \

Added: fix_installed_pdf_permissions.patch
===================================================================
--- fix_installed_pdf_permissions.patch	                        (rev 0)
+++ fix_installed_pdf_permissions.patch	2022-08-19 14:55:43 UTC (rev 1270915)
@@ -0,0 +1,30 @@
+diff --color -aur LHAPDF-6.5.2-old/bin/lhapdf LHAPDF-6.5.2-new/bin/lhapdf
+--- LHAPDF-6.5.2-old/bin/lhapdf	2022-08-19 17:25:17.896370763 +0300
++++ LHAPDF-6.5.2-new/bin/lhapdf	2022-08-19 17:26:41.193035357 +0300
+@@ -169,8 +169,26 @@
+ 
+     tarpath = os.path.join(dest_dir, tar_filename)
+     try:
++        import stat
+         import tarfile
++        stat_info = os.stat(tarpath)
++        # we only really care if destination is world readable
++        world_readable = bool(stat_info.st_mode & stat.S_IROTH)
++        file_mode = 0o644 if world_readable else 0o640
++        dir_mode = 0o755 if world_readable else 0o750
++        # load PDF tar file
+         tar_file = tarfile.open(tarpath, "r:gz")
++        for tar_info in tar_file.getmembers():
++            # adjust tar file properties
++            tar_info.uid = 0
++            tar_info.gid = 0
++            tar_info.uname = ""
++            tar_info.gname = ""
++            if tar_info.isfile():
++                tar_info.mode = file_mode
++            if tar_info.isdir():
++                tar_info.mode = dir_mode
++        # extract PDF tar file
+         tar_file.extractall(dest_dir)
+         tar_file.close()
+     except:



More information about the arch-commits mailing list