policy: do not rebuild policy package if already built
PATCH 1/1 policy: do not rebuild policy package if already built
Right now, test_policy.pp is rebuilt on every make invocation. Tweak the Makefile so that it is only build when it hasn't been built, it has been cleaned, or the source files changed.
--- policy/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
policy/Makefile +2 -2
@@ -86,7 +86,7 @@ ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6)) TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te test_ibpkey.te, $(TARGETS)) endif -all: build +all: test_policy/test_policy.pp expand_check: # Test for "expand-check = 0" in /etc/selinux/semanage.conf
@@ -94,7 +94,7 @@ expand_check: (echo "ERROR: set 'expand-check = 0' in /etc/selinux/semanage.conf"; \ /bin/false) -build: $(TARGETS) +test_policy/test_policy.pp: $(TARGETS) test_policy.if # General policy build @if [ -d $(POLDEV) ]; then \ mkdir -p test_policy; \
Signature · 1 line
2.21.0
Quoted 32 lines · Ondrej Mosnacek
Right now, test_policy.pp is rebuilt on every make invocation. Tweak the
Makefileso that it is only build when it hasn't been built, it has been cleaned, or the source files changed.Signed-off-by Ondrej Mosnacek <[email protected]>--- policy/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)policy/Makefile +2
-3@@ -86,7 +86,7 @@ ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6)) TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te test_ibpkey.te, $(TARGETS)) endif -all: build +all: test_policy/test_policy.pp expand_check: # Test for "expand-check = 0" in /etc/selinux/semanage.conf@@ -94,7 +94,7 @@ expand_check: (echo "ERROR: set 'expand-check = 0' in /etc/selinux/semanage.conf"; \ /bin/false) -build: $(TARGETS) +test_policy/test_policy.pp: $(TARGETS) test_policy.if # General policy build @if [ -d $(POLDEV) ]; then \ mkdir -p test_policy; \ --
Quoted 2 lines
2.21.0
This doesn't make much of a difference performance-wise, but the behavior is more logical this way.
Signature · 3 lines
Ondrej Mosnacek <omosnace at redhat dot com> Software Engineer, Security Technologies Red Hat, Inc.
Quoted 3 lines · Ondrej Mosnacek
Right now, test_policy.pp is rebuilt on every make invocation. Tweak the
Makefileso that it is only build when it hasn't been built, it has been cleaned, or the source files changed.
It also needs to be rebuilt if anything under /usr/share/selinux/devel/include has changed e.g. upon an update of selinux-policy-devel.
Quoted 29 lines
Signed-off-by Ondrej Mosnacek <[email protected]>--- policy/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)policy/Makefile +2
-2@@ -86,7 +86,7 @@ ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6)) TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te test_ibpkey.te, $(TARGETS)) endif -all: build +all: test_policy/test_policy.pp expand_check: # Test for "expand-check = 0" in /etc/selinux/semanage.conf@@ -94,7 +94,7 @@ expand_check: (echo "ERROR: set 'expand-check = 0' in /etc/selinux/semanage.conf"; \ /bin/false) -build: $(TARGETS) +test_policy/test_policy.pp: $(TARGETS) test_policy.if # General policy build @if [ -d $(POLDEV) ]; then \ mkdir -p test_policy; \
Quoted 8 lines · Stephen Smalley
Quoted 3 lines · Ondrej Mosnacek
Right now, test_policy.pp is rebuilt on every make invocation. Tweak the
Makefileso that it is only build when it hasn't been built, it has been cleaned, or the source files changed.It also needs to be rebuilt if anything under
/usr/share/selinux/devel/includehas changed e.g. upon an update of selinux-policy-devel.
I am now testing a version that always executes the $(MAKE) -C test_policy -f $(POLDEV)/Makefile test_policy.pp step, relying on the system Makefile to rebuild the pp as needed (there already are proper dependencies on the include files). However, the package manager on Fedora preserves the timestamps of the installed files (from package build time), which means that make doesn't always detect that the files are newer than the already built policy package.
So it looks like we don't have any other choice than to always rebuild if we really need to auto-react to changing system files.
Quoted 31 lines
Quoted 30 lines
Signed-off-by Ondrej Mosnacek <[email protected]>--- policy/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)policy/Makefile +2
-2@@ -86,7 +86,7 @@ ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6)) TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te test_ibpkey.te, $(TARGETS)) endif -all: build +all: test_policy/test_policy.pp expand_check: # Test for "expand-check = 0" in /etc/selinux/semanage.conf@@ -94,7 +94,7 @@ expand_check: (echo "ERROR: set 'expand-check = 0' in /etc/selinux/semanage.conf"; \ /bin/false) -build: $(TARGETS) +test_policy/test_policy.pp: $(TARGETS) test_policy.if # General policy build @if [ -d $(POLDEV) ]; then \ mkdir -p test_policy; \
Signature · 3 lines
Ondrej Mosnacek <omosnace at redhat dot com> Software Engineer, Security Technologies Red Hat, Inc.
Quoted 18 lines · Ondrej Mosnacek
Quoted 8 lines · Stephen Smalley
Quoted 3 lines · Ondrej Mosnacek
Right now, test_policy.pp is rebuilt on every make invocation. Tweak the
Makefileso that it is only build when it hasn't been built, it has been cleaned, or the source files changed.It also needs to be rebuilt if anything under
/usr/share/selinux/devel/includehas changed e.g. upon an update of selinux-policy-devel.I am now testing a version that always executes the
$(MAKE) -C test_policy -f $(POLDEV)/Makefile test_policy.ppstep, relying on the systemMakefileto rebuild the pp as needed (there already are proper dependencies on the include files). However, the package manager on Fedora preserves the timestamps of the installed files (from package build time), which means that make doesn't always detect that the files are newer than the already built policy package.
Quoted 2 lines
So it looks like we don't have any other choice than to always rebuild if we really need to auto-react to changing system files.
I'd rather err on the side of rebuilding too often than using stale policy.
Quoted 34 lines
Quoted 32 lines
Quoted 31 lines
Signed-off-by Ondrej Mosnacek <[email protected]>--- policy/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)policy/Makefile +2
-2@@ -86,7 +86,7 @@ ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6)) TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te test_ibpkey.te, $(TARGETS)) endif -all: build +all: test_policy/test_policy.pp expand_check: # Test for "expand-check = 0" in /etc/selinux/semanage.conf@@ -94,7 +94,7 @@ expand_check: (echo "ERROR: set 'expand-check = 0' in /etc/selinux/semanage.conf"; \ /bin/false) -build: $(TARGETS) +test_policy/test_policy.pp: $(TARGETS) test_policy.if # General policy build @if [ -d $(POLDEV) ]; then \ mkdir -p test_policy; \
Paul Moore
maintainerQuoted 19 lines · Stephen Smalley
Quoted 18 lines · Ondrej Mosnacek
Quoted 8 lines · Stephen Smalley
Quoted 3 lines · Ondrej Mosnacek
Right now, test_policy.pp is rebuilt on every make invocation. Tweak the
Makefileso that it is only build when it hasn't been built, it has been cleaned, or the source files changed.It also needs to be rebuilt if anything under
/usr/share/selinux/devel/includehas changed e.g. upon an update of selinux-policy-devel.I am now testing a version that always executes the
$(MAKE) -C test_policy -f $(POLDEV)/Makefile test_policy.ppstep, relying on the systemMakefileto rebuild the pp as needed (there already are proper dependencies on the include files). However, the package manager on Fedora preserves the timestamps of the installed files (from package build time), which means that make doesn't always detect that the files are newer than the already built policy package.
Quoted 4 lines
Quoted 2 lines
So it looks like we don't have any other choice than to always rebuild if we really need to auto-react to changing system files.
I'd rather err on the side of rebuilding too often than using stale policy.
That would be my preference as well. In fact, I actually recommend doing a 'make clean' before building and running the tests simply to make sure everything in the dependency list and toolchain is still working properly with the bits in the test suite.
Signature · 2 lines
paul moore www.paul-moore.com