「dpkg-buildpackage -rfakeroot -d -us -uc -S」が成功すると、「debuild -S」が「コマンドが見つかりません」で失敗する原因は何ですか?

「dpkg-buildpackage -rfakeroot -d -us -uc -S」が成功すると、「debuild -S」が「コマンドが見つかりません」で失敗する原因は何ですか?

次のスクリプトを考えてみましょう。

#!/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 $?

実行してみるとわかりますが

+ 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

私が混乱しているのは、jbuilderを(opam経由で)インストールしましたが、正しくdebuild -S実行され成功したようですが、見つからないことです。dpkg-buildpackage -rfakeroot -d -us -uc -Sここで何が起こっているのでしょうか?

ベストアンサー1

私が見つけたマニュアルページを読んだ後環境変数について、内容は次のとおりです。

環境変数はパッケージのビルドに影響を与える可能性があるため、デビルドはしばしばTERMHOMELOGNAMEGNUPGHOMEPGPPATHGPG_AGENT_INFO、 、FAKEROOTKEYDEB_*、 ( CCPP、 、 CXX) 変数とその変数を除くすべての環境変数とロケール変数と環境を削除して誤って整理します。 。未設定の場合に設定され、未設定の場合に設定されます。LDFFLAGS_APPENDLANGLC_*TERMdumbPATH"/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"

[...]

削除されたPATHの先頭にディレクトリを追加するオプションがあります --prepend-path 。これはccache、同じツールを使用してdistccビルドしたい場合に便利です。

したがって、問題はopamバイナリが存在するため、PATHここで見つけることができないということです。

おすすめ記事