我正在尝试建立https://github.com/wallix/redemption在 Ubuntu 20.04 上。
编译实际上成功了,然后我意识到他们有一个可以创建 .deb 文件的 python 脚本,工具/packager.py。它使用dh_install
( 中的工具sudo apt install debhelper
),并且显然引用了这些文件包装/模板/debian/规则- 和包装/模板/debian/redemption.install,其中仅包含以下内容:
%ETC_PREFIX%/*
%PREFIX%/bin/*
%PREFIX%/share/rdpproxy/*
%LIB_PREFIX%/libredrec.so
好的,所以我像这样运行脚本,但失败了:
$ ./tools/packager.py --build-package --force-build
...
dh_installdocs: warning: Compatibility levels before 9 are deprecated (level 7 in use)
install -d debian/.debhelper/generated/redemption
install -p -m0644 debian/copyright debian/redemption/usr/share/doc/redemption/copyright
# install files into package build directories
# debian/redemption.install list the files to install into each package
# and the directory they should be installed to. It destination directory
# is missing dh_install guess for destination.
#--list-missing or --fail-missing
# This option makes dh_install keep track of the files it installs, and
# then at the end, compare that list with the files in the source directory.
# If any of the files (and symlinks) in the source directory were not
# installed to somewhere, it will warn on stderr about that (or fail).
# --sourcedir=dir
# Look in the specified directory for files to be installed.
# default is to look in debian/tmp
dh_install --sourcedir=debian/buildtmp --list-missing
dh_install: warning: Compatibility levels before 9 are deprecated (level 7 in use)
dh_install: warning: Please use dh_missing --list-missing/--fail-missing instead
dh_install: warning: This feature will be removed in compat 12.
dh_install: warning: Cannot find (any matches for) "etc/rdpproxy/*" (tried in debian/buildtmp, debian/tmp)
dh_install: warning: redemption missing files: etc/rdpproxy/*
dh_install: warning: Cannot find (any matches for) "usr/local/bin/*" (tried in debian/buildtmp, debian/tmp)
dh_install: warning: redemption missing files: usr/local/bin/*
dh_install: warning: Cannot find (any matches for) "usr/local/share/rdpproxy/*" (tried in debian/buildtmp, debian/tmp)
dh_install: warning: redemption missing files: usr/local/share/rdpproxy/*
dh_install: warning: Cannot find (any matches for) "/libredrec.so" (tried in debian/buildtmp, debian/tmp)
dh_install: warning: redemption missing files: /libredrec.so
dh_install: error: missing files, aborting
make: *** [debian/rules:66: binary-arch] Error 255
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2
Build failed: system fail with code 512: dpkg-buildpackage -b -tc -us -uc -r
---------
ERROR:root:Traceback (most recent call last):
File "./tools/packager.py", line 497, in <module>
try_system("dpkg-buildpackage -b -tc -us -uc -r")
File "./tools/packager.py", line 40, in try_system
raise Exception("system fail with code %d: %s" % (status, cmd))
Exception: system fail with code 512: dpkg-buildpackage -b -tc -us -uc -r
好的,所以它说“*找不到(任何匹配项)”“ /libredrec.so
(在debian/buildtmp
“中尝试过”;但是,如果我搜索,我会得到:
$ find . -name libredrec.so
./bin/gcc-9/release/libredrec.so
./debian/buildtmpusr/local/lib/libredrec.so
那么,有是a libredrec.so
in ./debian/buildtmpusr/local/lib/
- 但我猜该路径不匹配debian/buildtmp
。
我可以做什么/更改来完成此脚本?
答案1
事实上,@StephenKitt 是对的 - 这是关于“缺失斜线问题”,尽管它最终稍微复杂一些。
事实证明,有这样的文件包装/目标/拉伸(也buster
和jessie
),有:
PREFIX=/usr/local
ETC_PREFIX=/etc/rdpproxy
CERT_PREFIX=/etc/rdpproxy/cert
...
LIB_PREFIX=/usr/local/lib
...
...字符串开头显然有一个斜杠。
然而,如前所述,我正在 Ubuntu 20.04 上构建 - 因此上述目标分发文件都不适合我。这意味着我要依靠中的设置工具/packager.py- 确实,缺少一个斜杠(并且LIB_PREFIX
也缺少)。
最后,这些是我所做的更改,以便./tools/packager.py --build-package --force-build
有效,通过以下方式获得git diff
:
diff --git a/packaging/template/debian/compat b/packaging/template/debian/compat
index e30739cb5..3b0923b7e 100755
--- a/packaging/template/debian/compat
+++ b/packaging/template/debian/compat
@@ -1 +1 @@
-7
+9
diff --git a/packaging/template/debian/rules b/packaging/template/debian/rules
index 014c470e4..49253265c 100755
--- a/packaging/template/debian/rules
+++ b/packaging/template/debian/rules
@@ -63,7 +63,9 @@ binary-arch: build install
# --sourcedir=dir
# Look in the specified directory for files to be installed.
# default is to look in debian/tmp
- dh_install --sourcedir=$(DESTDIR) --list-missing
+ #dh_install --sourcedir=$(DESTDIR) --list-missing
+ dh_missing --list-missing
+ dh_install --sourcedir=$(DESTDIR)
dh_strip
dh_compress
dh_fixperms
diff --git a/tools/distroinfo.py b/tools/distroinfo.py
index 143acc628..e0ff2c0f0 100644
--- a/tools/distroinfo.py
+++ b/tools/distroinfo.py
@@ -52,7 +52,8 @@ def get_distro():
'17.04': ('Zesty', 'Zapus'),
'17.10': ('Artful', 'Aardvark'),
'18.04': ('B', 'B'),
- '18.10': ('C', 'C')
+ '18.10': ('C', 'C'),
+ '20.04': ('Focal', 'Fossa')
}
name = codenames[version][0].lower()
else:
diff --git a/tools/packager.py b/tools/packager.py
index d4eafa002..1af49dcd7 100755
--- a/tools/packager.py
+++ b/tools/packager.py
@@ -59,9 +59,13 @@ class opts(object):
force_build = False
config = {}
- config["%PREFIX%"] = 'usr/local'
- config["%ETC_PREFIX%"] = 'etc/rdpproxy'
- config["%CERT_PREFIX%"] = 'etc/rdpproxy/cert'
+ #config["%PREFIX%"] = 'usr/local'
+ #config["%ETC_PREFIX%"] = 'etc/rdpproxy'
+ #config["%CERT_PREFIX%"] = 'etc/rdpproxy/cert'
+ config["%PREFIX%"] = '/usr/local'
+ config["%ETC_PREFIX%"] = '/etc/rdpproxy'
+ config["%CERT_PREFIX%"] = '/etc/rdpproxy/cert'
+ config["%LIB_PREFIX%"] = '/usr/local/lib'
config["%METRICS_PATH%"] = '/var/rdpproxy/recorded/metrics'
config["%RECORD_PATH%"] = '/var/rdpproxy/recorded/rdp'
config["%RECORD_TMP_PATH%"] = '/var/rdpproxy/tmp'
完成后./tools/packager.py --build-package --force-build
,我得到了../redemption_10.4.41+focal_amd64.deb
(在存储 git 存储库的父目录中)。
编辑:如果您想在此项目中放入更多目标可执行文件(请参阅grep '^exe' targets.jam
和grep '^exe' ./Jamroot
),那么还可以进行以下更改:
diff --git a/Jamroot b/Jamroot
index eb4188fdd..e4834c55c 100644
--- a/Jamroot
+++ b/Jamroot
@@ -155,7 +155,8 @@ alias install :
install-share
install-gettext
;
-alias exe : rdpproxy rdpclient rdpinichecker ;
+#alias exe : rdpproxy rdpclient rdpinichecker ;
+alias exe : rdpproxy rdpclient rdpinichecker mwrm3_editor headlessclient nla_server proxy_recorder display_learning extract_text ppocr_extract_text redrec ;
alias libs : libredrec ;
alias ocr_tools : display_learning extract_text ppocr_extract_text ;
EDIT2:如果您还想包含 qtclient,这会变得相当棘手,但是可行的 - 请参阅https://stackoverflow.com/questions/75340407/bjam-build-subfolder-project-change-directory-to-subfolder-project-before-bui