Skip to contentSkip to conversation

Apparmor: add apache2 to PACKAGECONF and check for webserver layer

PATCH New Armin Kuster 1 participant 2 messages Sep 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Apparmor: add apache2 to PACKAGECONF and check for webserver layer

Don't want to add layer depends for one package unless needed.

---
 recipes-security/AppArmor/apparmor_2.11.0.bb | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)
recipes-security/AppArmor/apparmor_2.11.0.bb +22 -4
index d9572e4..ae3391d 100644
@@ -11,7 +11,7 @@ SECTION = "admin"
 LICENSE = "GPLv2 & GPLv2+ & BSD-3-Clause & LGPLv2.1+"
 LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=fd57a4b0bc782d7b80fd431f10bbf9d0"
 
-DEPENDS = "bison-native apr apache2 gettext-native coreutils-native"
+DEPENDS = "bison-native apr gettext-native coreutils-native"
 
 SRC_URI = " \
 	http://archive.ubuntu.com/ubuntu/pool/main/a/${BPN}/${BPN}_${PV}.orig.tar.gz \
@@ -38,8 +38,18 @@ PACKAGECONFIG ?="man python perl"
 PACKAGECONFIG[man] = "--enable-man-pages, --disable-man-pages"
 PACKAGECONFIG[python] = "--with-python, --without-python, python3 swig-native"
 PACKAGECONFIG[perl] = "--with-perl, --without-perl, perl perl-native swig-native"
+PACKAGECONFIG[apache2] = ",,apache2,"
 
 PAMLIB="${@bb.utils.contains('DISTRO_FEATURES', 'pam', '1', '0', d)}"
+HTTPD="${@bb.utils.contains('PACKAGECONFIG', 'apache2', '1', '0', d)}"
+
+
+python() {
+    if 'apache2' in d.getVar('PACKAGECONFIG').split() and \
+	'webserver' not in d.getVar('BBFILE_COLLECTIONS').split():
+        raise bb.parse.SkipRecipe('Requires meta-webserver to be present.')
+}
+
 
 do_configure() {
 	cd ${S}/libraries/libapparmor
@@ -57,7 +67,10 @@ do_compile () {
         oe_runmake -C ${B}/utils
         oe_runmake -C ${B}/parser
         oe_runmake -C ${B}/profiles
-        oe_runmake -C ${B}/changehat/mod_apparmor
+
+	if test -z "${HTTPD}" ; then
+        	oe_runmake -C ${B}/changehat/mod_apparmor
+	fi	
 
 	if test -z "${PAMLIB}" ; then
         	oe_runmake -C ${B}/changehat/pam_apparmor
@@ -73,7 +86,10 @@ do_install () {
 	oe_runmake -C ${B}/utils DESTDIR="${D}" install
 	oe_runmake -C ${B}/parser DESTDIR="${D}" install
 	oe_runmake -C ${B}/profiles DESTDIR="${D}" install
-	oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install
+
+	if test -z "${HTTPD}" ; then
+		oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install
+	fi
 
 	if test -z "${PAMLIB}" ; then
 		oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install
@@ -122,11 +138,13 @@ SYSTEMD_PACKAGES = "${PN}"
 SYSTEMD_SERVICE_${PN} = "apparmor.service"
 SYSTEMD_AUTO_ENABLE = "disable"
 
-PACKAGES += "mod-${PN}"
+PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'mod-${PN}', '', d)}"
 
 FILES_${PN} += "/lib/apparmor/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}"
 FILES_mod-${PN} = "${libdir}/apache2/modules/*"
 
+ALLOW_EMPTY_${PN} = "1"
+
 RDEPENDS_${PN} += "bash lsb"
 RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG','python','python3 python3-modules','', d)}"
 RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}"
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 apparmor: fix a few build issues

configure.ac:8: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
| configure.ac:8: error: version mismatch. This is Automake 1.15.1,
| configure.ac:8: but the definition used by this AM_INIT_AUTOMAKE

add aclocal

and

make: Entering directory '/home/akuster/oss/clean/poky/build/tmp/work/mips64-poky-linux/apparmor/2.11.0-r0/apparmor-2.11.0/binutils'
| error: ../libraries/libapparmor//src/.libs/libapparmor.a is missing. Pick one of these possible solutions:

remove --disable-static

and

ERROR: apparmor-2.11.0-r0 do_package_qa: QA Issue: /usr/lib/apparmor/ptest/testsuite/parser/tst/gen-dbus.pl contained in package apparmor-ptest requires /usr/bin/perl, but no providers found in RDEPENDS_apparmor-ptest? [file-rdeps]

add perl to ptest RDEPENDS

---
 recipes-security/AppArmor/apparmor_2.11.0.bb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
recipes-security/AppArmor/apparmor_2.11.0.bb +5 -2
index ae3391d..a83c2c3 100644
@@ -50,11 +50,14 @@ python() {
         raise bb.parse.SkipRecipe('Requires meta-webserver to be present.')
 }
 
+CONFIGUREOPTS_remove = "--disable-static"
+EXTRA_OECONF_append = " --enable-static"
 
 do_configure() {
 	cd ${S}/libraries/libapparmor
+	aclocal
 	autoconf --force
-	libtoolize --automake -c
+	libtoolize --automake -c --force
 	automake -ac
 	./configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
 	sed -i -e 's#^YACC.*#YACC := bison#' ${S}/parser/Makefile
@@ -148,4 +151,4 @@ ALLOW_EMPTY_${PN} = "1"
 RDEPENDS_${PN} += "bash lsb"
 RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG','python','python3 python3-modules','', d)}"
 RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}"
-RDEPENDS_${PN}-ptest += "coreutils dbus-lib"
+RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib"
Signature · 1 line
2.7.4