Bug#510362: dh-make-perl: should not run 'make test' under fakeroot

gregor herrmann gregoa at debian.org
Wed Dec 31 23:52:49 UTC 2008


On Wed, 31 Dec 2008 14:16:10 -0800, Mark Hedges wrote:

> `make test` should not be run as a root user.  It fails for
> packages that require Apache::Test to spawn an apache server.
> dh-make-perl should first run `make test` and then do fakeroot
> to build the package.

dh-make-perl doesn't run `make test` or any other "building" stuff,
unless explicitly told so with the --build option.
--build simply calls "fakeroot debian/rules binary" which may or may
not succedd.
 
> Try making a temp directory as a non-privileged user and run
> `dh-make-perl --cpan Apache2::AuthCookie`
> (with libapache2-mod-perl2) installed.

I tried (without libapache2-mod-perl2 but that shouldn't change
anything in general):

$ dh-make-perl --cpan Apache2::AuthCookie
Dispatching deprecated method 'CPAN::Config::load' to CPAN::HandleConfig
[cpan stuff]
Apache-AuthCookie-3.12/
Apache-AuthCookie-3.12/MANIFEST
Apache-AuthCookie-3.12/README
Apache-AuthCookie-3.12/Makefile.PL
Apache-AuthCookie-3.12/MANIFEST.SKIP
Apache-AuthCookie-3.12/README.modperl2
Apache-AuthCookie-3.12/Changes
Apache-AuthCookie-3.12/t/
Apache-AuthCookie-3.12/t/TEST.PL
Apache-AuthCookie-3.12/t/conf/
Apache-AuthCookie-3.12/t/conf/extra.conf.in
Apache-AuthCookie-3.12/t/Skeleton/
Apache-AuthCookie-3.12/t/Skeleton/AuthCookieHandler.pm
Apache-AuthCookie-3.12/t/lib/
Apache-AuthCookie-3.12/t/lib/Sample/
Apache-AuthCookie-3.12/t/lib/Sample/AuthCookieHandler.pm.mp1
Apache-AuthCookie-3.12/t/lib/Sample/AuthCookieHandler.pm.mp2
Apache-AuthCookie-3.12/t/startup.pl
Apache-AuthCookie-3.12/t/htdocs/
Apache-AuthCookie-3.12/t/htdocs/docs/
Apache-AuthCookie-3.12/t/htdocs/docs/stimeout/
Apache-AuthCookie-3.12/t/htdocs/docs/stimeout/get_me.html
Apache-AuthCookie-3.12/t/htdocs/docs/protected/
Apache-AuthCookie-3.12/t/htdocs/docs/protected/echo_user.pl
Apache-AuthCookie-3.12/t/htdocs/docs/protected/get_me.html
Apache-AuthCookie-3.12/t/htdocs/docs/index.html
Apache-AuthCookie-3.12/t/htdocs/docs/login.pl
Apache-AuthCookie-3.12/t/htdocs/docs/cookiename/
Apache-AuthCookie-3.12/t/htdocs/docs/cookiename/get_me.html
Apache-AuthCookie-3.12/t/htdocs/docs/logout.pl
Apache-AuthCookie-3.12/t/htdocs/docs/authany/
Apache-AuthCookie-3.12/t/htdocs/docs/authany/get_me.html
Apache-AuthCookie-3.12/t/htdocs/docs/echo_cookie.pl
Apache-AuthCookie-3.12/t/htdocs/docs/authall/
Apache-AuthCookie-3.12/t/htdocs/docs/authall/get_me.html
Apache-AuthCookie-3.12/t/real.t
Apache-AuthCookie-3.12/lib/
Apache-AuthCookie-3.12/lib/Apache2/
Apache-AuthCookie-3.12/lib/Apache2/AuthCookie.pm
Apache-AuthCookie-3.12/lib/Apache/
Apache-AuthCookie-3.12/lib/Apache/AuthCookie.pm
Apache-AuthCookie-3.12/lib/Apache/AuthCookie/
Apache-AuthCookie-3.12/lib/Apache/AuthCookie/Util.pm
Apache-AuthCookie-3.12/META.yml
CPAN: File::Temp loaded ok (v0.18)
Found: Apache-AuthCookie 3.12 (libapache-authcookie-perl arch=all)
Searching for package containing Apache::Test using apt-file.
Searching for package containing mod_perl2 using apt-file.

Needs the following modules for which there are no debian packages available
 - Apache::Test
 - mod_perl2
Using maintainer: gregor herrmann <gregoa at guinan.comodo.priv.at>
Found changelog: Changes
Found docs: README README.modperl2
Found examples: t/lib/Sample/*
Using rules: /usr/share/dh-make-perl/rules.MakeMaker.noxs
Done
$
 
Only if I explicitly add "--build" dh-make-perl tries to build the
pacakge by calling "fakeroot debian/rules binary").

$ dh-make-perl --cpan Apache2::AuthCookie --build
Dispatching deprecated method 'CPAN::Config::load' to CPAN::HandleConfig
[cpan stuff]
Apache-AuthCookie-3.12/
Apache-AuthCookie-3.12/MANIFEST
Apache-AuthCookie-3.12/README
Apache-AuthCookie-3.12/Makefile.PL
Apache-AuthCookie-3.12/MANIFEST.SKIP
Apache-AuthCookie-3.12/README.modperl2
Apache-AuthCookie-3.12/Changes
Apache-AuthCookie-3.12/t/
Apache-AuthCookie-3.12/t/TEST.PL
Apache-AuthCookie-3.12/t/conf/
Apache-AuthCookie-3.12/t/conf/extra.conf.in
Apache-AuthCookie-3.12/t/Skeleton/
Apache-AuthCookie-3.12/t/Skeleton/AuthCookieHandler.pm
Apache-AuthCookie-3.12/t/lib/
Apache-AuthCookie-3.12/t/lib/Sample/
Apache-AuthCookie-3.12/t/lib/Sample/AuthCookieHandler.pm.mp1
Apache-AuthCookie-3.12/t/lib/Sample/AuthCookieHandler.pm.mp2
Apache-AuthCookie-3.12/t/startup.pl
Apache-AuthCookie-3.12/t/htdocs/
Apache-AuthCookie-3.12/t/htdocs/docs/
Apache-AuthCookie-3.12/t/htdocs/docs/stimeout/
Apache-AuthCookie-3.12/t/htdocs/docs/stimeout/get_me.html
Apache-AuthCookie-3.12/t/htdocs/docs/protected/
Apache-AuthCookie-3.12/t/htdocs/docs/protected/echo_user.pl
Apache-AuthCookie-3.12/t/htdocs/docs/protected/get_me.html
Apache-AuthCookie-3.12/t/htdocs/docs/index.html
Apache-AuthCookie-3.12/t/htdocs/docs/login.pl
Apache-AuthCookie-3.12/t/htdocs/docs/cookiename/
Apache-AuthCookie-3.12/t/htdocs/docs/cookiename/get_me.html
Apache-AuthCookie-3.12/t/htdocs/docs/logout.pl
Apache-AuthCookie-3.12/t/htdocs/docs/authany/
Apache-AuthCookie-3.12/t/htdocs/docs/authany/get_me.html
Apache-AuthCookie-3.12/t/htdocs/docs/echo_cookie.pl
Apache-AuthCookie-3.12/t/htdocs/docs/authall/
Apache-AuthCookie-3.12/t/htdocs/docs/authall/get_me.html
Apache-AuthCookie-3.12/t/real.t
Apache-AuthCookie-3.12/lib/
Apache-AuthCookie-3.12/lib/Apache2/
Apache-AuthCookie-3.12/lib/Apache2/AuthCookie.pm
Apache-AuthCookie-3.12/lib/Apache/
Apache-AuthCookie-3.12/lib/Apache/AuthCookie.pm
Apache-AuthCookie-3.12/lib/Apache/AuthCookie/
Apache-AuthCookie-3.12/lib/Apache/AuthCookie/Util.pm
Apache-AuthCookie-3.12/META.yml
CPAN: File::Temp loaded ok (v0.18)
Found: Apache-AuthCookie 3.12 (libapache-authcookie-perl arch=all)
Searching for package containing Apache::Test using apt-file.
Searching for package containing mod_perl2 using apt-file.

Needs the following modules for which there are no debian packages available
 - Apache::Test
 - mod_perl2
Using maintainer: gregor herrmann <gregoa at guinan.comodo.priv.at>
Found changelog: Changes
Found docs: README README.modperl2
Found examples: t/lib/Sample/*
Using rules: /usr/share/dh-make-perl/rules.MakeMaker.noxs
make: Entering directory `/tmp/authcookie/Apache-AuthCookie-3.12'
dh_testdir
dh_testroot
dh_clean build-stamp install-stamp
# Add commands to clean up after the build process here
[ ! -f Makefile ] || make realclean
make: Leaving directory `/tmp/authcookie/Apache-AuthCookie-3.12'
make: Entering directory `/tmp/authcookie/Apache-AuthCookie-3.12'
dh_testdir
# Add commands to compile the package here
/usr/bin/perl Makefile.PL INSTALLDIRS=vendor
no supported mod_perl version was found
selected t/lib/Sample/AuthCookieHandler.pm.mp2
***: You should install Apache::Test to do real testing
Checking if your kit is complete...
Looks good
Warning: prerequisite Apache::Test 1.22 not found.
Warning: prerequisite mod_perl2 1.9922 not found.
Writing Makefile for Apache::AuthCookie
make
make[1]: Entering directory `/tmp/authcookie/Apache-AuthCookie-3.12'
cp lib/Apache/AuthCookie/Util.pm blib/lib/Apache/AuthCookie/Util.pm
cp lib/Apache2/AuthCookie.pm blib/lib/Apache2/AuthCookie.pm
cp lib/Apache/AuthCookie.pm blib/lib/Apache/AuthCookie.pm
Manifying blib/man3/Apache2::AuthCookie.3pm
Manifying blib/man3/Apache::AuthCookie.3pm
make[1]: Leaving directory `/tmp/authcookie/Apache-AuthCookie-3.12'
make test
make[1]: Entering directory `/tmp/authcookie/Apache-AuthCookie-3.12'
*** This test suite requires Apache::Test available from CPAN
make[1]: Leaving directory `/tmp/authcookie/Apache-AuthCookie-3.12'
touch build-stamp
dh_testdir
dh_testroot
dh_clean -k
# Add commands to install the package into /tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl here
make install DESTDIR=/tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl PREFIX=/usr
make[1]: Entering directory `/tmp/authcookie/Apache-AuthCookie-3.12'
Installing /tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl/usr/share/perl5/Apache/AuthCookie.pm
Installing /tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl/usr/share/perl5/Apache/AuthCookie/Util.pm
Installing /tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl/usr/share/perl5/Apache2/AuthCookie.pm
Installing /tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl/usr/share/man/man3/Apache2::AuthCookie.3pm
Installing /tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl/usr/share/man/man3/Apache::AuthCookie.3pm
make[1]: Leaving directory `/tmp/authcookie/Apache-AuthCookie-3.12'
[ ! -d /tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl/usr/lib/perl5 ] || \
                rmdir --ignore-fail-on-non-empty --parents --verbose \
                /tmp/authcookie/Apache-AuthCookie-3.12/debian/libapache-authcookie-perl/usr/lib/perl5
touch install-stamp
dh_testdir
dh_testroot
dh_installexamples t/lib/Sample/*
dh_installdocs README README.modperl2
dh_installchangelogs Changes
dh_perl
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dpkg-gencontrol: warning: unknown substitution variable ${misc:Depends}
dh_md5sums
dh_builddeb
dpkg-deb: building package `libapache-authcookie-perl' in `../libapache-authcookie-perl_3.12-1_all.deb'.
make: Leaving directory `/tmp/authcookie/Apache-AuthCookie-3.12'
Done

And 'fakeroot' is necessary because the files in the .deb must be own
by root. Without fakreoot we get:

$ debian/rules binary
[..]
dh_testroot
dh_testroot: You must run this as root (or use fakeroot).
make: *** [install-stamp] Error 1


Summary:
* A build is only attempted with "--build".
* "--build" calls "fakeroot debian/rules binary".
* This needs root or fakeroot.

We can of course think about other possibilities on how to build the
package but in the end we always will need (fake)root privileges.

Cheers,
gregor
-- 
 .''`.   Home: http://info.comodo.priv.at/{,blog/} / GPG Key ID: 0x00F3CFE4
 : :' :  Debian GNU/Linux user, admin, & developer - http://www.debian.org/
 `. `'   Member of VIBE!AT, SPI Inc., fellow of FSFE | http://got.to/quote/
   `-    NP: R.E.M.: Everybody Hurts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20090101/030e0401/attachment.pgp 


More information about the pkg-perl-maintainers mailing list