O que faz com que “debuild -S” falhe com o “comando não encontrado” quando o “dpkg-buildpackage -rfakeroot -d -us -uc -S” é bem-sucedido?

0

Considere o seguinte script:

#!/usr/bin/env bash

set -ex

wget -N http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3-2.dsc
wget -N http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3.orig.tar.gz
wget -N http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3-2.debian.tar.xz
dpkg-source -x ocaml-re_1.7.3-2.dsc
cd ocaml-re-1.7.3
dpkg-buildpackage -rfakeroot -d -us -uc -S || exit $?
debuild -S || exit $?

Quando eu corro, vejo

+ wget -N http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3-2.dsc
--2018-10-28 20:29:03--  http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3-2.dsc
Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.88.162, 91.189.88.149, 91.189.91.23, ...
Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.88.162|:80... connected.
HTTP request sent, awaiting response... 304 Not Modified
File ‘ocaml-re_1.7.3-2.dsc’ not modified on server. Omitting download.

+ wget -N http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3.orig.tar.gz
--2018-10-28 20:29:03--  http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3.orig.tar.gz
Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.88.152, 91.189.88.162, 91.189.88.149, ...
Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.88.152|:80... connected.
HTTP request sent, awaiting response... 304 Not Modified
File ‘ocaml-re_1.7.3.orig.tar.gz’ not modified on server. Omitting download.

+ wget -N http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3-2.debian.tar.xz
--2018-10-28 20:29:03--  http://archive.ubuntu.com/ubuntu/pool/universe/o/ocaml-re/ocaml-re_1.7.3-2.debian.tar.xz
Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.88.152, 91.189.88.162, 91.189.88.149, ...
Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.88.152|:80... connected.
HTTP request sent, awaiting response... 304 Not Modified
File ‘ocaml-re_1.7.3-2.debian.tar.xz’ not modified on server. Omitting download.

+ dpkg-source -x ocaml-re_1.7.3-2.dsc
dpkg-source: warning: extracting unsigned source package (ocaml-re_1.7.3-2.dsc)
dpkg-source: info: extracting ocaml-re in ocaml-re-1.7.3
dpkg-source: info: unpacking ocaml-re_1.7.3.orig.tar.gz
dpkg-source: info: unpacking ocaml-re_1.7.3-2.debian.tar.xz
+ cd ocaml-re-1.7.3
+ dpkg-buildpackage -rfakeroot -d -us -uc -S
dpkg-buildpackage: source package ocaml-re
dpkg-buildpackage: source version 1.7.3-2
dpkg-buildpackage: source distribution unstable
dpkg-buildpackage: source changed by Mehdi Dogguy <[email protected]>
 dpkg-source --before-build ocaml-re-1.7.3
 fakeroot debian/rules clean
dh clean --with ocaml
   dh_testdir
   dh_auto_clean
        make -j1 clean
make[1]: Entering directory '/home/jgross/Documents/repos/coq-debian-build-scripts/ocaml-stuff/debian-sources/foo/ocaml-re-1.7.3'
make[1]: Leaving directory '/home/jgross/Documents/repos/coq-debian-build-scripts/ocaml-stuff/debian-sources/foo/ocaml-re-1.7.3'
   dh_ocamlclean
   dh_clean
 dpkg-source -b ocaml-re-1.7.3
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building ocaml-re using existing ./ocaml-re_1.7.3.orig.tar.gz
dpkg-source: info: building ocaml-re in ocaml-re_1.7.3-2.debian.tar.xz
dpkg-source: info: building ocaml-re in ocaml-re_1.7.3-2.dsc
 dpkg-genchanges -S >../ocaml-re_1.7.3-2_source.changes
dpkg-genchanges: not including original source code in upload
 dpkg-source --after-build ocaml-re-1.7.3
dpkg-buildpackage: binary and diff upload (original source NOT included)
+ debuild -S
 dpkg-buildpackage -rfakeroot -d -us -uc -S
dpkg-buildpackage: source package ocaml-re
dpkg-buildpackage: source version 1.7.3-2
dpkg-buildpackage: source distribution unstable
dpkg-buildpackage: source changed by Mehdi Dogguy <[email protected]>
 dpkg-source --before-build ocaml-re-1.7.3
 fakeroot debian/rules clean
dh clean --with ocaml
   dh_testdir
   dh_auto_clean
        make -j1 clean
make[1]: Entering directory '/home/jgross/Documents/repos/coq-debian-build-scripts/ocaml-stuff/debian-sources/foo/ocaml-re-1.7.3'
make[1]: jbuilder: Command not found
Makefile:12: recipe for target 'clean' failed
make[1]: *** [clean] Error 127
make[1]: Leaving directory '/home/jgross/Documents/repos/coq-debian-build-scripts/ocaml-stuff/debian-sources/foo/ocaml-re-1.7.3'
dh_auto_clean: make -j1 clean returned exit code 2
debian/rules:13: recipe for target 'clean' failed
make: *** [clean] Error 2
Estou perplexo com o fato de que, apesar de eu ter o jbuilder instalado (via opam), debuild -S não pode encontrá-lo, mesmo que pareça estar rodando dpkg-buildpackage -rfakeroot -d -us -uc -S , o que dá certo. O que está acontecendo aqui?

    
por Jason Gross 29.10.2018 / 01:31

1 resposta

0

Depois de ler a manpage, descobri a seção sobre variáveis de ambiente , que diz:

As environment variables can affect the building of a package, often unintentionally, debuild sanitises the environment by removing all environment variables except for TERM, HOME, LOGNAME, GNUPGHOME, PGPPATH, GPG_AGENT_INFO, FAKEROOTKEY, DEB_*, the (C, CPP, CXX, LD and F)FLAGS variables and their _APPEND counterparts and the locale variables LANG and LC_*. TERM is set to dumb if it is unset, and PATH is set to "/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11".

[...]

Note that one may add directories to the beginning of the sanitised PATH, using the --prepend-path option. This is useful when one wishes to use tools such as ccache or distcc for building.

Portanto, o problema é que os binários opam estão em PATH e, portanto, não foram encontrados aqui.

    
por 29.10.2018 / 01:45