Date: Friday, January 6, 2023 @ 14:02:15
  Author: dvzrv
Revision: 466076

upgpkg: audit 3.0.9-1: Upgrade to 3.0.9.

Add patches provided by upstream to deal with broken build due to swig.
Switch to linux-api-headers in makedepends, as it is providing 
/usr/include/linux/audit.h for the build.
Use local array to simplify the use of configure options in build().
Pick files for python-audit in audit's build() instead of running make twice 
and deleting files.

Added:
  audit/trunk/audit-3.0.9-flex_array_workaround.patch
  audit/trunk/audit-3.0.9-undo_flex_array_workaround.patch
Modified:
  audit/trunk/PKGBUILD

----------------------------------------------+
 PKGBUILD                                     |   72 ++++++++++++++++++-------
 audit-3.0.9-flex_array_workaround.patch      |   37 ++++++++++++
 audit-3.0.9-undo_flex_array_workaround.patch |   12 ++++
 3 files changed, 101 insertions(+), 20 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-01-06 13:25:13 UTC (rev 466075)
+++ PKGBUILD    2023-01-06 14:02:15 UTC (rev 466076)
@@ -9,38 +9,64 @@
 
 pkgbase=audit
 pkgname=(audit python-audit)
-pkgver=3.0.8
+pkgver=3.0.9
 pkgrel=1
 pkgdesc='Userspace components of the audit framework'
 url='https://people.redhat.com/sgrubb/audit'
 arch=(x86_64)
-makedepends=(glibc krb5 libcap-ng libldap linux-headers python swig)
+makedepends=(glibc krb5 libcap-ng libldap linux-api-headers python swig)
 license=(GPL2 LGPL2.1)
 options=(debug emptydirs)
 source=(
-  https://people.redhat.com/sgrubb/audit/$pkgname-$pkgver.tar.gz
+  
$pkgbase-userspace-$pkgver.tar.gz::https://github.com/linux-audit/audit-userspace/archive/refs/tags/v$pkgver.tar.gz
   $pkgbase-3.0.8-config_paths.patch
+  $pkgbase-3.0.9-flex_array_workaround.patch
+  $pkgbase-3.0.9-undo_flex_array_workaround.patch
 )
-sha512sums=('8379bf425d68381d182300e628e42de8460d2f3e15b2395e10880f94b9989656852a50a9bece75b632ec8a04c40c9e666ff4c9d6b25ace3a8f50d2011506afab'
-            
'bc699123f810abcf9300728bf61d7fcfcc83677b75fbeb713fb24cc11b2f9edf687661aab70766acde7c3c41c6a62f8e0a54cdfb49d1c7ce2246b67fbe3feec5')
-b2sums=('38a35a7540e608127cfc54a2de2cb12df8c29e778799ca53318824c84565a67b7ea131f9bba455fa469ce9139a27908738f571a6e383ce9a3274f70c09d27ec7'
-        
'50be1b4f76ace20d8d14b4c57a9bb69daa3da35fd654aca8730bc287682fe38f1c1917b37469fb087daf9f309ffc15cca15f54166ece0a055f540c2604778fc6')
+sha512sums=('c0b35d40d3aecb3450ce99422115efe40d56ad199d8f035f836dae94df0d55a4561659673c70fc49056a316bdc8531d7014f4c2a2d60aac66bdf69c262ee3ca0'
+            
'bc699123f810abcf9300728bf61d7fcfcc83677b75fbeb713fb24cc11b2f9edf687661aab70766acde7c3c41c6a62f8e0a54cdfb49d1c7ce2246b67fbe3feec5'
+            
'442bffac895abbd0abe455c36ebc03ed5a9faee16b57347ef1f37c0d9c33777e204da917be3bbe11c56173c2ec96eed60646ac7214da47f828eef5fa104c1ebb'
+            
'92ba0f9b3d3721bf64b56e2f3e2ac4e54b2b6acd9d5646a5ee97eea244cb165e19a56c362de16834925ae063c79e6505687749f1dd67dd0f2997919aea7cb2ef')
+b2sums=('921db4ecce0ecd3d412003861f03bb4fd9a9e3b9f721a783cc2f70ad26666f8a4c2585051eac351606e699cda8f47d202cf12523747f19a647d5e2e416ff08a4'
+        
'50be1b4f76ace20d8d14b4c57a9bb69daa3da35fd654aca8730bc287682fe38f1c1917b37469fb087daf9f309ffc15cca15f54166ece0a055f540c2604778fc6'
+        
'2241c3dd29c803493ac8e85afd6031749a46b583514829b8761c24ae12061999b7c95107ec2948dd7edb239f805ca088b7b24229abb5445a4767702539779b0f'
+        
'd89110c32da33c2ca9292391ead930352e4c8935aa86111640130d9e3fbc0ebe27b069a83812530dfbbf28f4ddd33545658c8061d87bfac9a9d3a6a5ff0be4b8')
 
+_pick() {
+  local p="$1" f d; shift
+  for f; do
+    d="$srcdir/$p/${f#$pkgdir/}"
+    mkdir -p "$(dirname "$d")"
+    mv "$f" "$d"
+    rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
+  done
+}
+
 prepare() {
   # replace the use of /sbin with /usr/bin in configs
-  patch -Np1 -d $pkgbase-$pkgver -i ../$pkgbase-3.0.8-config_paths.patch
+  patch -Np1 -d $pkgbase-userspace-$pkgver -i 
../$pkgbase-3.0.8-config_paths.patch
+
+  # fix broken userspace build due to swig: 
https://listman.redhat.com/archives/linux-audit/2022-February/018843.html
+  cp -v /usr/include/linux/audit.h $pkgbase-userspace-$pkgver/lib/
+  patch -Np1 -d $pkgbase-userspace-$pkgver -i 
../$pkgbase-3.0.9-flex_array_workaround.patch
+
+  cd $pkgbase-userspace-$pkgver
+  autoreconf -fiv
 }
 
 build() {
-  cd $pkgbase-$pkgver
-  ./configure \
-    --prefix=/usr \
-    --sbindir=/usr/bin \
-    --sysconfdir=/etc \
-    --libexecdir=/usr/lib/audit \
-    --enable-gssapi-krb5=yes \
-    --enable-systemd=yes \
+  local configure_options=(
+    --prefix=/usr
+    --sbindir=/usr/bin
+    --sysconfdir=/etc
+    --libexecdir=/usr/lib/audit
+    --enable-gssapi-krb5=yes
+    --enable-systemd=yes
     --with-libcap-ng=yes
+  )
+
+  cd $pkgbase-userspace-$pkgver
+  ./configure "${configure_options[@]}"
   # prevent excessive overlinking due to libtool
   sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
   make
@@ -62,8 +88,12 @@
     etc/audit/plugins.d/syslog.conf
   )
 
-  make DESTDIR="$pkgdir" install -C $pkgbase-$pkgver
+  make DESTDIR="$pkgdir" install -C $pkgbase-userspace-$pkgver
 
+  # undo fix for broken swig, so that other programs may use the header file 
correctly
+  patch -Np0 -d "$pkgdir" -i 
"$srcdir/$pkgbase-3.0.9-undo_flex_array_workaround.patch"
+  rm -v "$pkgdir/usr/include/libaudit.h.orig"
+
   # add log dir
   install -vdm 700 "$pkgdir/var/log/$pkgname"
 
@@ -70,8 +100,10 @@
   # remove legacy files
   rm -frv "$pkgdir/usr/lib/audit"
 
-  # remove files provided by python-audit
-  rm -frv "$pkgdir/usr/lib/python"*
+  (
+    cd "$pkgdir"
+    _pick python-audit usr/lib/python*
+  )
 }
 
 package_python-audit() {
@@ -78,7 +110,7 @@
   depends=(audit libaudit.so libauparse.so glibc python)
   pkgdesc+=' (python bindings)'
 
-  make DESTDIR="$pkgdir" install -C $pkgbase-$pkgver/bindings
+  mv -v $pkgname/* "$pkgdir"
 }
 
 # vim: ts=2 sw=2 et:

Added: audit-3.0.9-flex_array_workaround.patch
===================================================================
--- audit-3.0.9-flex_array_workaround.patch                             (rev 0)
+++ audit-3.0.9-flex_array_workaround.patch     2023-01-06 14:02:15 UTC (rev 
466076)
@@ -0,0 +1,37 @@
+diff -urp audit-3.0.8.orig/bindings/swig/src/auditswig.i 
audit-3.0.8/bindings/swig/src/auditswig.i
+--- audit-3.0.8.orig/bindings/swig/src/auditswig.i     2022-03-29 
16:52:34.000000000 -0400
++++ audit-3.0.8/bindings/swig/src/auditswig.i  2022-03-29 17:31:15.810268855 
-0400
+@@ -39,7 +39,7 @@ signed
+ #define __attribute(X) /*nothing*/
+ typedef unsigned __u32;
+ typedef unsigned uid_t;
+-%include "/usr/include/linux/audit.h"
++%include "../lib/audit.h"
+ #define __extension__ /*nothing*/
+ %include <stdint.i>
+ %include "../lib/libaudit.h"
+diff -urp audit-3.0.8.orig/lib/audit.h audit-3.0.8/lib/audit.h
+--- audit-3.0.8.orig/lib/audit.h       2022-03-29 17:29:30.358211892 -0400
++++ audit-3.0.8/lib/audit.h    2022-03-29 17:31:15.811268833 -0400
+@@ -514,7 +514,7 @@ struct audit_rule_data {
+       __u32           values[AUDIT_MAX_FIELDS];
+       __u32           fieldflags[AUDIT_MAX_FIELDS];
+       __u32           buflen; /* total length of string fields */
+-      char            buf[];  /* string fields buffer */
++      char            buf[0]; /* string fields buffer */
+ };
+ 
+ #endif /* _LINUX_AUDIT_H_ */
+diff -urp audit-3.0.8.orig/lib/libaudit.h audit-3.0.8/lib/libaudit.h
+--- audit-3.0.8.orig/lib/libaudit.h    2022-03-29 16:52:34.000000000 -0400
++++ audit-3.0.8/lib/libaudit.h 2022-03-29 17:31:15.812268812 -0400
+@@ -27,7 +27,7 @@
+ #include <stdint.h>
+ #include <sys/socket.h>
+ #include <linux/netlink.h>
+-#include <linux/audit.h>
++#include "audit.h"
+ #include <stdarg.h>
+ #include <syslog.h>
+ #ifndef __attr_access
+Only in audit-3.0.8/lib: libaudit.h.orig

Added: audit-3.0.9-undo_flex_array_workaround.patch
===================================================================
--- audit-3.0.9-undo_flex_array_workaround.patch                                
(rev 0)
+++ audit-3.0.9-undo_flex_array_workaround.patch        2023-01-06 14:02:15 UTC 
(rev 466076)
@@ -0,0 +1,12 @@
+diff -urp usr.orig/include/libaudit.h.orig usr/include/libaudit.h
+--- usr.orig/include/libaudit.h.orig   2022-02-14 14:14:08.000000000 -0500
++++ usr/include/libaudit.h     2022-02-23 13:35:52.638340789 -0500
+@@ -39,7 +39,7 @@ extern "C" {
+ #include <stdint.h>
+ #include <sys/socket.h>
+ #include <linux/netlink.h>
+-#include "audit.h"
++#include <linux/audit.h>
+ #include <stdarg.h>
+ #include <syslog.h>
+ 

Reply via email to