Skip to contentSkip to conversation

cgl_common_security_flags.inc: add to fix building with security flags

PATCH New Dmitry Eremin-Solenikov 1 participant 10 messages May 8, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/10 cgl_common_security_flags.inc: add to fix building with security flags

Package openhpi is currently broken if distro uses security_flags.inc. Flx that by adding layer-wide include file for such exceptions.

---
 meta-cgl-common/conf/distro/include/cgl_common_security_flags.inc | 1 +
 meta-cgl-common/conf/layer.conf                                   | 2 ++
 2 files changed, 3 insertions(+)
 create mode 100644 meta-cgl-common/conf/distro/include/cgl_common_security_flags.inc
meta-cgl-common/conf/distro/include/cgl_common_security_flags.inc new file +1 -0
new file mode 100644
index 0000000..358ce58
@@ -0,0 +1 @@
+SECURITY_CFLAGS_pn-openhpi = "${SECURITY_NO_PIE_CFLAGS}"
meta-cgl-common/conf/layer.conf +2 -0
index f5a0190..0c19a95 100644
@@ -10,3 +10,5 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
 BBFILE_COLLECTIONS += "cgl-common"
 BBFILE_PATTERN_cgl-common = "^${LAYERDIR}/"
 BBFILE_PRIORITY_cgl-common = "7"
+
+require conf/distro/include/cgl_common_security_flags.inc
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/10 pacemaker: use useradd class to add required user and group

---
 meta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.0.9.1.bb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
meta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.0.9.1.bb +5 -4
index 43769bf..8bef6f4 100644
@@ -32,7 +32,7 @@ SRC_URI = " \
 SRC_URI_append_libc-uclibc = " file://kill-stack-protector.patch"
 SRC_URI[md5sum] = "103fb2e804be3f8ace17021c5d9ad15d"
 SRC_URI[sha256sum] = "aabfc9ee1c66804151d973d0ed0323798ffebe49e1c2219fa804dc6898a69a1e"
-inherit autotools-brokensep python-dir pkgconfig
+inherit autotools-brokensep python-dir pkgconfig useradd
 
 S = "${WORKDIR}/pacemaker-1.0-Pacemaker-${PV}"
 
@@ -40,6 +40,10 @@ EXTRA_OECONF = "--with-ais --without-heartbeat --disable-fatal-warnings --disabl
 
 CFLAGS += "-I${STAGING_INCDIR}/heartbeat -lncurses"
 
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = "--home-dir=${localstatedir}/lib/heartbeat -g haclient -r hacluster"
+GROUPADD_PARAM_${PN} = "-r haclient"
+
 do_install_append() {
 	install -d ${D}${sysconfdir}/default/volatiles
 	install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/06_pacemaker
@@ -49,9 +53,6 @@ do_install_append() {
 }
 
 pkg_postinst_${PN} () {
-	set -e
-	grep haclient /etc/group || addgroup haclient
-	grep hacluster /etc/passwd || adduser --disabled-password --home=${localstatedir}/lib/heartbeat --ingroup haclient -g "HA cluster" hacluster
 	/etc/init.d/populate-volatile.sh update
 }
 FILES_${PN}-doc += "${datadir}/pacemaker/crm_cli.txt ${datadir}/pacemaker/templates/"
Signature · 1 line
2.1.4
#2 lore raw

PATCH 3/10 pacemaker: provide tmpfiles configuration

In reply to Dmitry Eremin-Solenikov

provide systemd-tmpfiles configuration for distributions using systemd.

---
 meta-cgl-common/recipes-cgl/pacemaker/files/tmpfiles       |  5 +++++
 meta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.0.9.1.bb | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 meta-cgl-common/recipes-cgl/pacemaker/files/tmpfiles
meta-cgl-common/recipes-cgl/pacemaker/files/tmpfiles new file +5 -0
new file mode 100644
index 0000000..1d2b295
@@ -0,0 +1,5 @@
+d /var/lib/heartbeat/crm 0750 hacluster haclient -
+d /var/lib/pengine 0755 hacluster haclient -
+d /var/run/heartbeat 0755 hacluster haclient -
+d /var/run/heartbeat/rsctmp 0755 hacluster haclient -
+d /var/run/crm 0755 hacluster haclient -
meta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.0.9.1.bb +10 -1
index 8bef6f4..a5cd284 100644
@@ -28,6 +28,7 @@ SRC_URI = " \
     file://pacemaker-fix-xml-config.patch \
     file://pacemaker-no-bash.patch \
 	file://volatiles \
+	file://tmpfiles \
 	"
 SRC_URI_append_libc-uclibc = " file://kill-stack-protector.patch"
 SRC_URI[md5sum] = "103fb2e804be3f8ace17021c5d9ad15d"
@@ -47,13 +48,21 @@ GROUPADD_PARAM_${PN} = "-r haclient"
 do_install_append() {
 	install -d ${D}${sysconfdir}/default/volatiles
 	install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/06_pacemaker
+	install -d ${D}${sysconfdir}/tmpfiles.d
+	install -m 0644 ${WORKDIR}/tmpfiles ${D}${sysconfdir}/tmpfiles.d/${PN}.conf
 	find ${D} -name "*.pyo" -exec rm {} \;
 	find ${D} -name "*.pyc" -exec rm {} \;
 	find ${D} -name "*.py" | xargs sed -i -e "s:${STAGING_BINDIR_NATIVE}:${bindir}:g"
 }
 
 pkg_postinst_${PN} () {
-	/etc/init.d/populate-volatile.sh update
+	if [ -z "$D" ]; then
+		if type systemd-tmpfiles >/dev/null; then
+			systemd-tmpfiles --create
+		elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
+			${sysconfdir}/init.d/populate-volatile.sh update
+		fi
+	fi
 }
 FILES_${PN}-doc += "${datadir}/pacemaker/crm_cli.txt ${datadir}/pacemaker/templates/"
 FILES_${PN} += " \
Signature · 1 line
2.1.4
#3 lore raw

PATCH 4/10 cluster-glue: use useradd class to add required user and group

In reply to Dmitry Eremin-Solenikov
---
 meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue_1.0.5.bb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue_1.0.5.bb +5 -4
index c31c85d..adf3b48 100644
@@ -20,7 +20,7 @@ SRC_URI[sha256sum] = "0e1922373aba1c3811f6ef61559a9c407c0bec71d2ebc451a4db5b940d
 
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
 
-inherit autotools
+inherit autotools useradd
 
 S = "${WORKDIR}/Reusable-Cluster-Components-glue--glue-${PV}"
 
@@ -28,6 +28,10 @@ EXTRA_OECONF = "--with-daemon-user=hacluster --with-daemon-group=haclient --disa
 
 CACHED_CONFIGUREVARS="ac_cv_path_XML2CONFIG=0"
 
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = "--home-dir=${localstatedir}/lib/heartbeat -g haclient -r hacluster"
+GROUPADD_PARAM_${PN} = "-r haclient"
+
 do_configure_prepend() {
     ln -sf ${PKG_CONFIG_SYSROOT_DIR}/usr/include/libxml2/libxml ${PKG_CONFIG_SYSROOT_DIR}/usr/include/libxml
 }
@@ -38,9 +42,6 @@ do_install_append() {
 }
 
 pkg_postinst_${PN} () {
-	set -e
-	grep haclient /etc/group || addgroup haclient
-	grep hacluster /etc/passwd || adduser --disabled-password --home=${localstatedir}/lib/heartbeat --ingroup haclient -g "HA cluster" hacluster
 	/etc/init.d/populate-volatile.sh update
 }
 
Signature · 1 line
2.1.4
#4 lore raw

PATCH 5/10 cluster-glue: provide tmpfiles configuration

In reply to Dmitry Eremin-Solenikov

provide systemd-tmpfiles configuration for distributions using systemd.

---
 .../recipes-cgl/cluster-glue/cluster-glue/tmpfiles            |  7 +++++++
 .../recipes-cgl/cluster-glue/cluster-glue_1.0.5.bb            | 11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue/tmpfiles
meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue/tmpfiles new file +7 -0
new file mode 100644
index 0000000..252e13f
@@ -0,0 +1,7 @@
+d /var/lib/heartbeat 0755 root root -
+d /var/lib/heartbeat/pengine 0750 hacluster haclient -
+d /var/lib/heartbeat/cores 0755 hacluster haclient -
+d /var/lib/heartbeat/cores/hacluster 0700 hacluster haclient -
+d /var/lib/heartbeat/cores/root 0700 root root -
+d /var/lib/heartbeat/cores/nobody 0700 nobody nogroup -
+
meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue_1.0.5.bb +10 -1
index adf3b48..f1b4a78 100644
@@ -13,6 +13,7 @@ SRC_URI = " \
     file://glue-remove-getpid-check.patch \
     file://fix-const-cast.patch \
     file://volatiles \
+    file://tmpfiles \
 	"
 SRC_URI_append_libc-uclibc = " file://kill-stack-protector.patch"
 SRC_URI[md5sum] = "d2b6f798e58ef2497526e404b8ad640a"
@@ -39,10 +40,18 @@ do_configure_prepend() {
 do_install_append() {
 	install -d ${D}${sysconfdir}/default/volatiles
 	install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/04_cluster-glue
+	install -d ${D}${sysconfdir}/tmpfiles.d
+	install -m 0644 ${WORKDIR}/tmpfiles ${D}${sysconfdir}/tmpfiles.d/${PN}.conf
 }
 
 pkg_postinst_${PN} () {
-	/etc/init.d/populate-volatile.sh update
+	if [ -z "$D" ]; then
+		if type systemd-tmpfiles >/dev/null; then
+			systemd-tmpfiles --create
+		elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
+			${sysconfdir}/init.d/populate-volatile.sh update
+		fi
+	fi
 }
 
 PACKAGES += "\
Signature · 1 line
2.1.4
#5 lore raw

PATCH 6/10 cluster-glue: add another directory to volatiles and tmpfiles config

In reply to Dmitry Eremin-Solenikov

Add /var/run/heartbeat directory to volatiles and tmpfiles configuration.

---
 meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue/tmpfiles  | 1 +
 meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue/volatiles | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue/tmpfiles +1 -0
index 252e13f..b683b28 100644
@@ -4,4 +4,5 @@ d /var/lib/heartbeat/cores 0755 hacluster haclient -
 d /var/lib/heartbeat/cores/hacluster 0700 hacluster haclient -
 d /var/lib/heartbeat/cores/root 0700 root root -
 d /var/lib/heartbeat/cores/nobody 0700 nobody nogroup -
+d /var/run/heartbeat 0755 root root -
 
meta-cgl-common/recipes-cgl/cluster-glue/cluster-glue/volatiles +2 -1
index 892db1b..d6f0c87 100644
@@ -3,4 +3,5 @@ d hacluster haclient 0750 /var/lib/heartbeat/pengine none
 d hacluster haclient 0755 /var/lib/heartbeat/cores none
 d hacluster haclient 0700 /var/lib/heartbeat/cores/hacluster none
 d root root 0700 /var/lib/heartbeat/cores/root none
-d nobody nogroup 0700 /var/lib/heartbeat/cores/nobody none
\ No newline at end of file
+d nobody nogroup 0700 /var/lib/heartbeat/cores/nobody none
+d root root 0755  /var/run/heartbeat none
Signature · 1 line
2.1.4
#6 lore raw

PATCH 7/10 ocfs2-tools: properly handle systemd DISTRO_FEATURE

In reply to Dmitry Eremin-Solenikov

Always inherit systemd bbclass (otherwise it is not pulled in even if systemd is enabled). This makes few other settings in the recipe unnecessary, thus they are dropped.

---
 meta-cgl-common/recipes-cgl/ocfs2-tools/ocfs2-tools_1.4.3.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta-cgl-common/recipes-cgl/ocfs2-tools/ocfs2-tools_1.4.3.bb +1 -4
index 4e171f4..1296fd6 100644
@@ -42,11 +42,8 @@ do_compile_prepend() {
     done
 }
 
-inherit ${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
+inherit systemd
 SYSTEMD_SERVICE_${PN} = "o2cb.service ocfs2.service"
-SYSTEMD_AUTO_ENABLE = "enable"
-
-FILES_${PN} += "${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','${systemd_unitdir}','', d)}"
 
 do_install() {
     install -d ${D}/etc/init.d
Signature · 1 line
2.1.4
#7 lore raw

PATCH 8/10 heartbeat: make bootstrap work without checking for libtool command

In reply to Dmitry Eremin-Solenikov

There is no use for just 'libtool' script, other than deriving libtoolize from it. Make bootstrap script look for libtoolize directly and forget about libtool completely.

---
 .../heartbeat/heartbeat-bootstrap-libtool.patch    | 52 ++++++++++++++++++++++
 .../recipes-cgl/heartbeat/heartbeat_3.0.5.bb       |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 meta-cgl-common/recipes-cgl/heartbeat/heartbeat/heartbeat-bootstrap-libtool.patch
meta-cgl-common/recipes-cgl/heartbeat/heartbeat/heartbeat-bootstrap-libtool.patch new file +52 -0
new file mode 100644
index 0000000..bcddab2
@@ -0,0 +1,52 @@
+Index: Heartbeat-3-0-7e3a82377fa8/bootstrap
+===================================================================
+--- Heartbeat-3-0-7e3a82377fa8.orig/bootstrap
++++ Heartbeat-3-0-7e3a82377fa8/bootstrap
+@@ -173,23 +173,22 @@ ln -s `which $automake` ./automake
+ 
+ # Check for Libtool
+ pkg="libtool"
+-for command in libtool libtool14 libtool15 glibtool
++for command in libtoolize libtoolize14 libtoolize15 glibtoolize
+ do
+   URL=$gnu/$pkg/
+   if
+     testProgram $command
+   then
+     : OK $pkg is installed
+-    libtool=$command
+-    libtoolize=`echo  "$libtool" | sed -e 's/libtool/libtoolize/'`
++    libtoolize=$command
+   fi
+ done
+ 
+ # Check to see if we got a valid command.
+ if 
+-    $libtool --version </dev/null >/dev/null 2>&1
++    $libtoolize --version </dev/null >/dev/null 2>&1
+ then
+-    echo "Libtool package $libtool found."
++    echo "Libtool package $libtoolize found."
+ else
+     RC=$?
+     cat <<-EOF >&2
+@@ -200,10 +199,6 @@ else
+ 	EOF
+ fi
+ 
+-# Create local copy so that the incremental updates will work.
+-rm -f          ./libtool
+-ln -s `which $libtool` ./libtool
+-
+ case $RC in
+   0)	;;
+   *)	exit $RC;;
+@@ -217,7 +212,7 @@ oneline() {
+   read x; echo "$x"
+ }
+ 
+-LT_version=`$libtool --version | oneline | sed -e 's%^[^0-9]*%%' -e s'% .*%%'`
++LT_version=`$libtoolize --version | oneline | sed -e 's%^[^0-9]*%%' -e s'% .*%%'`
+ LT_majvers=`echo "$LT_version" | sed -e 's%\..*%%'`
+ LT_minvers=`echo "$LT_version" | sed -e 's%^[^.]*\.%%' `
+ LT_minnum=`echo  "$LT_minvers" | sed -e 's%[^0-9].*%%'`
meta-cgl-common/recipes-cgl/heartbeat/heartbeat_3.0.5.bb +1 -0
index 369bd23..184ad22 100644
@@ -34,6 +34,7 @@ SRC_URI = " \
     file://ucast.c-fix-compile-errors.patch \
     file://configure.in-Error-and-warning-fix.patch \
     file://heartbeat-init.d-heartbeat.in-modify-parameter.patch \
+    file://heartbeat-bootstrap-libtool.patch \
     file://heartbeat.service \
 "
 SRC_URI[md5sum] = "396510e3c143a9c2288bc52cfc9caa3c"
Signature · 1 line
2.1.4
#8 lore raw

PATCH 9/10 heartbeat: add gnutls dependency

In reply to Dmitry Eremin-Solenikov

Add dependency on gnutls as noted by the following QA warnings:

WARNING: QA Issue: heartbeat rdepends on nettle, but it isn't a build dependency? [build-deps]
WARNING: QA Issue: heartbeat rdepends on gnutls, but it isn't a build dependency? [build-deps]
WARNING: QA Issue: heartbeat rdepends on gmp, but it isn't a build dependency? [build-deps]

Both nettle and gmp are used by gnutls, so there is no point adding them to the dependencies list -- those are indirect dependencies anyway.

---
 meta-cgl-common/recipes-cgl/heartbeat/heartbeat_3.0.5.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-cgl-common/recipes-cgl/heartbeat/heartbeat_3.0.5.bb +1 -1
index 184ad22..5128c53 100644
@@ -40,7 +40,7 @@ SRC_URI = " \
 SRC_URI[md5sum] = "396510e3c143a9c2288bc52cfc9caa3c"
 SRC_URI[sha256sum] = "085013154511f3c270b5e9a3281732dbbb9812924ae24d9c3c6db1af4dd260d0"
 S = "${WORKDIR}/Heartbeat-3-0-7e3a82377fa8/"
-DEPENDS = "cluster-glue corosync"
+DEPENDS = "cluster-glue corosync gnutls"
 inherit autotools-brokensep pkgconfig useradd
 EXTRA_OECONF = " \
     STAGING_DIR_TARGET=${STAGING_DIR_TARGET} \
Signature · 1 line
2.1.4
#9 lore raw

PATCH 10/10 heartbeat: properly handle systemd DISTRO_FEATURE

In reply to Dmitry Eremin-Solenikov

Always inherit systemd bbclass (otherwise it is not pulled in even if systemd is enabled). This makes few other settings in the recipe unnecessary, thus they are dropped.

---
 meta-cgl-common/recipes-cgl/heartbeat/heartbeat_3.0.5.bb | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
meta-cgl-common/recipes-cgl/heartbeat/heartbeat_3.0.5.bb +1 -3
index 5128c53..3a02d35 100644
@@ -100,10 +100,8 @@ do_install() {
     install -m 0600 ${S}/doc/authkeys ${D}/etc/ha.d/authkeys
 }
 
-inherit ${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','',d)}
-SYSTEMD_PACKAGES = "${PN}"
+inherit systemd
 SYSTEMD_SERVICE_${PN} = "heartbeat.service"
-SYSTEMD_AUTO_ENABLE = "disable"
 
 USERADD_PACKAGES = "${PN}"
 GROUPADD_PARAM_${PN} = "-r haclient"
Signature · 1 line
2.1.4