Build failed with Permission denied

Asked by VinsS on 2019-02-07

A resume of the build log:

------------------------------------------------------
make[1]: Leaving directory `/<<PKGBUILDDIR>>'
   dh_auto_test -a
touch build-stamp
 fakeroot debian/rules binary-arch
dh install --with python3
   debian/rules build
make[1]: Entering directory `/<<PKGBUILDDIR>>'
make[1]: Nothing to be done for `build'.
make[1]: Leaving directory `/<<PKGBUILDDIR>>'
   debian/rules build-arch
make[1]: Entering directory `/<<PKGBUILDDIR>>'
make[1]: Nothing to be done for `build-arch'.
make[1]: Leaving directory `/<<PKGBUILDDIR>>'
   dh_testroot
   dh_prep
   debian/rules override_dh_auto_install
make[1]: Entering directory `/<<PKGBUILDDIR>>'
set -e; \
 /bin/sh build.sh -i
install libexiv2python.so to /usr/lib/python3/dist-packages
cp: cannot create regular file ‘/usr/lib/python3/dist-packages/libexiv2python.so’: Permission denied
mkdir: cannot create directory ‘/usr/lib/python3/dist-packages/pyexiv2’: Permission denied
cp: cannot create regular file ‘/usr/lib/python3/dist-packages/pyexiv2/__init__.py’: No such file or directory
cp: cannot create regular file ‘/usr/lib/python3/dist-packages/pyexiv2/exif.py’: No such file or directory
cp: cannot create regular file ‘/usr/lib/python3/dist-packages/pyexiv2/iptc.py’: No such file or directory
cp: cannot create regular file ‘/usr/lib/python3/dist-packages/pyexiv2/metadata.py’: No such file or directory
cp: cannot create regular file ‘/usr/lib/python3/dist-packages/pyexiv2/preview.py’: No such file or directory
cp: cannot create regular file ‘/usr/lib/python3/dist-packages/pyexiv2/utils.py’: No such file or directory
cp: cannot create regular file ‘/usr/lib/python3/dist-packages/pyexiv2/xmp.py’: No such file or directory
make[1]: *** [override_dh_auto_install] Error 1
--------------------------------------------------------
The complete log is here:
https://launchpadlibrarian.net/410131273/buildlog_ubuntu-trusty-amd64.py3exiv2_0.6.0-0ubuntu1_BUILDING.txt.gz

The compat version is 9
And this is the file rules:
------------------------------------------------------
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PYVERSIONS=$(shell py3versions -v -r)

override_dh_auto_configure:

override_dh_auto_build:
 set -e; \
 python3 configure.py ; \
 /bin/sh build.sh

override_dh_auto_clean:
 rm -rf build

override_dh_auto_install:
 set -e; \
 /bin/sh build.sh -i

override_dh_installchangelogs:
 dh_installchangelogs NEWS

override_dh_compress:
 dh_compress -X.txt -X.js -X.ico

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp:
 dh build-arch --with python3
 touch $@

clean:
 dh $@ --with python3

install: build
 dh $@ --with python3

# Build architecture-independent files here.
binary-indep: build install
 dh $@ --with python3

# Build architecture-dependent files here.
binary-arch: build install
 dh $@ --with python3

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
--------------------------------------------------------
I've used the same rules for the same package the 30 January without problem.

Thanks for all advices
Vincent

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
VinsS
Solved:
2019-02-07
Last query:
2019-02-07
Last reply:
2019-02-07
Colin Watson (cjwatson) said : #1

If you diff the working package against the broken one using debdiff on the two .dsc files, you'll find this among the output:

diff -Nru py3exiv2-0.5.0/configure.py py3exiv2-0.6.0/configure.py
--- py3exiv2-0.5.0/configure.py 2018-05-17 12:17:04.000000000 +0100
+++ py3exiv2-0.6.0/configure.py 2015-02-12 13:22:42.000000000 +0000
@@ -65,19 +65,19 @@
     dct['wrp'] = 'exiv2wrapper'
     dct['wrpy'] = 'exiv2wrapper_python'
     dct['flags'] = '-c -fPIC'
- dct['deb'] = 'debian/python3-exiv2'
     txt = """#!/bin/sh

 if [ "$1" = "-i" ]; then
- test -d %(deb)s%(pyexiv)s || mkdir -p %(deb)s%(pyexiv)s
- cp build/libexiv2python.so %(deb)s%(dist)s/libexiv2python.so
- cp src/pyexiv2/__init__.py %(deb)s%(pyexiv)s/__init__.py
- cp src/pyexiv2/exif.py %(deb)s%(pyexiv)s/exif.py
- cp src/pyexiv2/iptc.py %(deb)s%(pyexiv)s/iptc.py
- cp src/pyexiv2/metadata.py %(deb)s%(pyexiv)s/metadata.py
- cp src/pyexiv2/preview.py %(deb)s%(pyexiv)s/preview.py
- cp src/pyexiv2/utils.py %(deb)s%(pyexiv)s/utils.py
- cp src/pyexiv2/xmp.py %(deb)s%(pyexiv)s/xmp.py
+ echo "install libexiv2python.so to %(dist)s"
+ cp build/libexiv2python.so %(dist)s/libexiv2python.so
+ test -d %(pyexiv)s || mkdir -p %(pyexiv)s
+ cp src/pyexiv2/__init__.py %(pyexiv)s/__init__.py
+ cp src/pyexiv2/exif.py %(pyexiv)s/exif.py
+ cp src/pyexiv2/iptc.py %(pyexiv)s/iptc.py
+ cp src/pyexiv2/metadata.py %(pyexiv)s/metadata.py
+ cp src/pyexiv2/preview.py %(pyexiv)s/preview.py
+ cp src/pyexiv2/utils.py %(pyexiv)s/utils.py
+ cp src/pyexiv2/xmp.py %(pyexiv)s/xmp.py

 else
     g++ -o build/%(wrp)s.os %(flags)s -I%(py)s src/%(wrp)s.cpp

So you removed upstream code that forced "sh build.sh -i" to install under debian/python3-exiv2/, and so "sh build.sh -i" is now trying to install files directly into /usr rather than into the staging directory that's due to be packed up into the output .deb. Your job with your packager hat on is to figure out how to adapt your packaging for that change.

I don't think you have any way to fix this without patching configure.py. However, I wouldn't recommend just reverting to the previous code, as hardcoding debian/python3-exiv2 in upstream code was a layering violation. I would suggest changing the upstream configure.py to generate code in build.sh that honours the environment variable DESTDIR, prefixing its value to installation paths if it's set; you could then set that variable to debian/python3-exiv2 or similar in the override_dh_auto_install target in debian/rules.

(Alternatively, you could work out how to get a standard Python build system such as setuptools to do what you need rather than rolling your own build system, as they usually come with this sort of feature and are already well-integrated into Debian packaging tools.)

VinsS (vincent-vandevyvre) said : #2

Ooops, I've used the bad config.py.

I'm the packager and the maintainer and this config.py is for my venv wher I work on my lib.

Now, with the good config.py the build was succeed.

Many thanks Colin.
Vincent