2

I'm trying to build https://github.com/wallix/redemption on Ubuntu 20.04.

The compilation actually succeeded, and then I realized they have a python script that would create a .deb file, tools/packager.py. It uses dh_install (tools that are in sudo apt install debhelper), and apparently refers to the files packaging/template/debian/rules - and packaging/template/debian/redemption.install, which contains just this:

%ETC_PREFIX%/*
%PREFIX%/bin/*
%PREFIX%/share/rdpproxy/*
%LIB_PREFIX%/libredrec.so

Ok, so I run the script like this, and it fails:

$ ./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

Ok, so it says "*Cannot find (any matches for) "/libredrec.so" (tried in debian/buildtmp"; however, if I search, I get:

$ find . -name libredrec.so
./bin/gcc-9/release/libredrec.so
./debian/buildtmpusr/local/lib/libredrec.so

So, there is a libredrec.so in ./debian/buildtmpusr/local/lib/ - but that path does not match debian/buildtmp, I guess.

What can I do/change to have this script complete?

sdbbs
  • 480
  • 1
    Perhaps I’m misreading, but the messages say “tried in debian/buildtmp”, with no *. This feels like a missing slash problem (the files should be installed in debian/buildtmp/usr/…). – Stephen Kitt Feb 03 '23 at 13:51
  • Many thanks, @StephenKitt - I am persuaded I copy-pasted that snippet with the *, but I just re-ran the process, and you're absolutely right, no * in the mentions of debian/buildtmp - so I've edited the post ... Any suggestions where I could try adding a missing slash? – sdbbs Feb 03 '23 at 14:02

1 Answers1

1

Indeed, @StephenKitt was right - this was about a "missing slash problem", though it ended up slightly more complicated.

It turns out, there are files like packaging/targets/stretch (also buster and jessie), that have:

PREFIX=/usr/local
ETC_PREFIX=/etc/rdpproxy
CERT_PREFIX=/etc/rdpproxy/cert
...
LIB_PREFIX=/usr/local/lib
...

... where there clearly is a slash at start of string.

However, as mentioned, I'm building on Ubuntu 20.04 - so neither of the above target distribution files match for me. And that means, that I fall back on the settings in tools/packager.py - which, indeed, were missing a slash (and LIB_PREFIX was also missing).

So finally, these are the changes I've made, so that ./tools/packager.py --build-package --force-build works, obtained via 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'

Once the ./tools/packager.py --build-package --force-build completed, I got ../redemption_10.4.41+focal_amd64.deb (in the parent directory of where the git repo was stored).


EDIT: if you want to put more of the target executables in this project (see grep '^exe' targets.jam and grep '^exe' ./Jamroot), then also do this change:

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: If you also want to include qtclient, that gets quite tricky, but is doable - see https://stackoverflow.com/questions/75340407/bjam-build-subfolder-project-change-directory-to-subfolder-project-before-bui

sdbbs
  • 480