chiark / gitweb /
Enable building as non-root (Closes: #1089291)
authorMatthew Vernon <matthew@debian.org>
Sun, 8 Dec 2024 13:33:42 +0000 (13:33 +0000)
committerMatthew Vernon <matthew@debian.org>
Sun, 8 Dec 2024 13:40:32 +0000 (13:40 +0000)
Rather than doing a check-for-being root and then explicitly chowning
things to root during the build, instead make use of dpkg's
--root-owner-group which has been in dpkg since 1.19.0, before
oldoldstable.

debian/control
debian/rules

index de5fbd7c97974af5f49eea8c0fbdf85a72360d30..e33fc1aef6aaff27b0b8cf17235ef8648052e51c 100644 (file)
@@ -4,6 +4,7 @@ Priority: optional
 Maintainer: Matthew Vernon <matthew@debian.org>
 Build-Depends: libreadline-dev, debhelper-compat (= 12)
 Standards-Version: 4.5.1
+Rules-Requires-Root: no
 
 Package: bible-kjv
 Architecture: any
index 57e8174b743adabf3c6113183315dba644068520..6a1fd52f3a37de3c9e3702403fe9be31ac01ffd6 100755 (executable)
@@ -38,7 +38,7 @@ clean:
        -rm -rf debian/tmp debian/files* bible debian/bible-kjv-text \
                debian/randverse debian/substvars randverse
 
-binary-indep:  checkroot build
+binary-indep:  build
        $(checkdir)
        -rm -fr debian/tmp debian/bible-kjv-text/
        install -d debian/tmp/usr
@@ -55,11 +55,10 @@ binary-indep:       checkroot build
        cd debian/tmp && \
                mv `cat ../bible-kjv-text.files` ../bible-kjv-text/usr/lib
        dpkg-gencontrol -pbible-kjv-text -Pdebian/bible-kjv-text -isp
-       chown -R root.root debian/bible-kjv-text
        chmod -R go=rX debian/bible-kjv-text
-       dpkg --build debian/bible-kjv-text ..
+       dpkg-deb --build --root-owner-group debian/bible-kjv-text ..
 
-binary-arch:   checkroot build
+binary-arch:   build
        $(checkdir)
        -rm -rf debian/tmp debian/bible-kjv-text/
        install -d debian/tmp debian/tmp/DEBIAN
@@ -87,9 +86,8 @@ binary-arch:  checkroot build
                rm `cat ../bible-kjv-text.files`
        dpkg-shlibdeps bible
        dpkg-gencontrol -pbible-kjv -Pdebian/tmp -isp
-       chown -R root.root debian/tmp
        chmod -R g-ws debian/tmp
-       dpkg --build debian/tmp ..
+       dpkg-deb --build --root-owner-group debian/tmp ..
 
 binary: binary-indep binary-arch
 
@@ -100,8 +98,4 @@ endef
 source diff:
        @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
 
-checkroot:
-       $(checkdir)
-       test root = "`whoami`"
-
-.PHONY: binary binary-arch binary-indep clean checkroot build-arch build-indep
+.PHONY: binary binary-arch binary-indep clean build-arch build-indep