[DSE-Dev] Bug#875573: libselinux should stop using the stage1 profile

Helmut Grohne helmut at subdivi.de
Tue Sep 12 10:49:35 UTC 2017


Source: libselinux
Version: 2.7-1
Severity: wishlist
Tags: patch
User: helmutg at debian.org
Usertags: rebootstrap

Hi Laurent,

as discussed on irc, I am sending you the patch for making libselinux
stop using the stage1 profile. Rationale in #875562. Hope it helps.

Helmut
-------------- next part --------------
diff --minimal -Nru libselinux-2.7/debian/changelog libselinux-2.7/debian/changelog
--- libselinux-2.7/debian/changelog	2017-09-09 23:32:59.000000000 +0200
+++ libselinux-2.7/debian/changelog	2017-09-12 12:43:36.000000000 +0200
@@ -1,3 +1,10 @@
+libselinux (2.7-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Use profiles nopython and noruby rather than stage1. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 12 Sep 2017 12:43:36 +0200
+
 libselinux (2.7-1) unstable; urgency=medium
 
   * New upstream release
diff --minimal -Nru libselinux-2.7/debian/control libselinux-2.7/debian/control
--- libselinux-2.7/debian/control	2017-09-09 23:32:59.000000000 +0200
+++ libselinux-2.7/debian/control	2017-09-12 12:43:34.000000000 +0200
@@ -8,15 +8,15 @@
            Russell Coker <russell at coker.com.au>
 Standards-Version: 4.1.0
 Build-Depends: debhelper (>= 10),
-               dh-python <!stage1>,
+               dh-python <!nopython>,
                file,
-               gem2deb (>= 0.5.0~) <!stage1>,
+               gem2deb (>= 0.5.0~) <!noruby>,
                libsepol1-dev (>= 2.7),
                libpcre3-dev,
                pkg-config,
-               python-all-dev (>= 2.6.6-3~) <!stage1>,
-               python3-all-dev <!stage1>,
-               swig <!stage1>
+               python-all-dev (>= 2.6.6-3~) <!nopython>,
+               python3-all-dev <!nopython>,
+               swig <!nopython> <!noruby>
 X-Python-Version: >= 2.4
 X-Python3-Version: >= 3.2
 XS-Ruby-Versions: all
@@ -110,7 +110,7 @@
 Architecture: linux-any
 Depends: ruby | ruby-interpreter, ${misc:Depends}, ${shlibs:Depends}
 Section: ruby
-Build-Profiles: <!stage1>
+Build-Profiles: <!noruby>
 Description: Ruby bindings to SELinux shared libraries
  This package provides the Ruby bindings needed for developing Ruby
  SELinux applications.  Security-enhanced Linux is a patch of the
@@ -129,7 +129,7 @@
 Built-Using: ${Built-Using}
 Section: python
 Provides: ${python:Provides}
-Build-Profiles: <!stage1>
+Build-Profiles: <!nopython>
 Description: Python bindings to SELinux shared libraries
  This package provides the Python bindings needed for developing Python
  SELinux applications.
@@ -149,7 +149,7 @@
 Built-Using: ${Built-Using}
 Section: python
 Provides: ${python3:Provides}
-Build-Profiles: <!stage1>
+Build-Profiles: <!nopython>
 Description: Python3 bindings to SELinux shared libraries
  This package provides the Python3 bindings needed for developing Python
  SELinux applications.
diff --minimal -Nru libselinux-2.7/debian/rules libselinux-2.7/debian/rules
--- libselinux-2.7/debian/rules	2017-09-09 23:32:59.000000000 +0200
+++ libselinux-2.7/debian/rules	2017-09-12 12:41:55.000000000 +0200
@@ -10,6 +10,8 @@
 DEB_HOST_MULTIARCH	:= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 LIBDIR_LIBSEPOL		:= $(shell pkg-config --variable=libdir libsepol)
 
+DOPACKAGES = $(shell dh_listpackages)
+
 PREFIX = /usr
 
 BUILT_USING=$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W "libsepol1-dev")
@@ -32,22 +34,23 @@
 
 ## By default, pass everything through debhelper automatically
 export DH_OPTIONS
-%: FORCE
-ifeq ($(DEB_BUILD_PROFILES),stage1)
-	@dh $@
-else
-	@dh $@ --with=python2,python3,ruby
+DH_ADDONS =
+ifneq ($(filter python-selinux,$(DOPACKAGES)),)
+DH_ADDONS += --with=python2
 endif
+ifneq ($(filter python3-selinux,$(DOPACKAGES)),)
+DH_ADDONS += --with=python3
+endif
+ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
+DH_ADDONS += --with=ruby
+endif
+%: FORCE
+	@dh $@ $(DH_ADDONS)
 
 ## Don't try to rebuild the debian/rules file
 debian/rules:
 	@touch $@
 
-## Skip python/ruby packages during stage1 build
-ifeq ($(DEB_BUILD_PROFILES),stage1)
-DH_OPTIONS += -Npython-selinux -Nruby-selinux -Npython3-selinux
-endif
-
 ## Set up some variables to be passed to the upstream Makefile
 extra_make_args  = LIBSEPOLA=$(LIBDIR_LIBSEPOL)/libsepol.a
 extra_make_args += ARCH=$(DEB_HOST_GNU_CPU)
@@ -68,11 +71,11 @@
 	@# Fix up the broken library symlink
 	rm -f $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libselinux.so
 	ln -s /lib/$(DEB_HOST_MULTIARCH)/libselinux.so.1 $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libselinux.so
-ifneq ($(DEB_BUILD_PROFILES),stage1)
+ifneq ($(filter python-selinux python3-selinux,$(DOPACKAGES)),)
 	+$(MAKE) PREFIX="$(PREFIX)" $(python_extra_install_args) -f debian/python.mk
+endif
+ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
 	+$(MAKE) PREFIX="$(PREFIX)" $(extra_install_args) -f debian/ruby.mk
-else
-	@echo "Detected stage-1 bootstrap, skipping python/ruby bindings..."
 endif
 
 ## Generate a hard error for any upstream files we don't install


More information about the SELinux-devel mailing list