Problem building for Ubuntu 20.04

Hi again @Ellson.

When I tried to build for Ubuntu 20.04 (beta), I got dh_install: warning: Cannot find (any matches for) "usr/lib/graphviz/python" (tried in debian/tmp, debian/tmp).

I tried this patch:

diff --git a/debian/libgv-python.install b/debian/libgv-python.install
index 2b952cf14..509b244db 100644
--- a/debian/libgv-python.install
+++ b/debian/libgv-python.install
@@ -1,4 +1,4 @@
-usr/lib/graphviz/python
+usr/lib/graphviz/python3
 #usr/lib/graphviz/python24
 #usr/lib/graphviz/python25
 #usr/lib/graphviz/python26

which worked fine for 20.04, but caused E: dh_python2:430: extension linked to libpython3.6 and shipped in python2.7's dist-packages: _gv.so for 18.04, 19.04, 19.10. See https://gitlab.com/magjac/graphviz/pipelines/135171050 for details.

I don’t really know what I’m doing so I’d appreciate some help.

More of the log from the original problem with 20.04:

d-devlibdeps \
	--override s/libpathplan4-dev// \
	--override s/libcgraph6-dev//   \
	--override s/libgraph5-dev//    \
	--override s/libxdot4-dev//     \
	--override s/libcdt5-dev//      \
	--override s/libgvpr2-dev//      \
	--override s/libgvc6-dev//      \
	--override s/libexpr4-dev//      \
	--override s/libgts-0.7-5-dev/libgts-dev/ \
	--override s/libexpat1-dev// \
	--override s/libltdl7-dev// \
	--override s/zlib1g-dev// \
	/workdir/graphviz-2.45.20200412.0919/debian/libgraphviz-dev.substvars \
	/workdir/graphviz-2.45.20200412.0919/debian/tmp/usr/lib/*.so
# Move from debian/tmp to the appropriate packages, rename one binary
dh_install --sourcedir=debian/tmp --list-missing
dh_install: warning: Compatibility levels before 9 are deprecated (level 8 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) "usr/lib/graphviz/python" (tried in debian/tmp, debian/tmp)

dh_install: warning: libgv-python missing files: usr/lib/graphviz/python
dh_install: error: missing files, aborting
make: *** [debian/rules:146: install] Error 25

I noticed that the git history for this file contains earlier struggles :grimacing::

commit 601954bda89d2fd562180f58c870c54bf29506c3
Author: Magnus Jacobsson <Magnus.Jacobsson@berotec.se>
Date:   Sun Apr 12 16:39:03 2020 +0200

    Replace python with python3 for python bindings
    
    In order to work on Ubuntu 20.04 which does not have a "python" lib,
    only "python3" and "python2".
    
    See https://www.fosslinux.com/26413/ubuntu-20-04-lts-focal-fossa-set-to-remove-python-2.htm.

commit ac5923b73253ab784ccdbc6deda18106cfefc34d
Author: Dwight Perry <dperry@research.att.com>
Date:   Tue Oct 18 13:16:18 2011 -0400

    Changes to support ubuntu11

commit 5b4b86c86caa41e2f0da5b4d584f1e299ab74ce2
Author: ellson <devnull@localhost>
Date:   Sat Jun 13 17:30:52 2009 +0000

    default to disabling the versioned pythons

commit 4449aac979cc5c9f987b6a92f3f6c89fb0f16c17
Author: ellson <devnull@localhost>
Date:   Thu Jun 11 16:03:37 2009 +0000

    this sucks!

commit 29adc5175b0e9206653792f38e7e9db52d0d2eb7
Author: ellson <devnull@localhost>
Date:   Thu Jun 11 15:18:18 2009 +0000

    trying to get python bindings to work on ubuntu9

commit 4bf462cb3cb6e4565d7c62ed2510cc6ab89e046e
Author: ellson <devnull@localhost>
Date:   Fri Aug 29 15:30:33 2008 +0000

    ubuntu fixes

commit 87487f19d5266e5342a1c121611a206bd35542ed
Author: ellson <devnull@localhost>
Date:   Mon Aug 25 19:20:38 2008 +0000

    update debian starting point to: graphviz_2.18-1ubuntu2.diff.gz

commit 4e7a9007eaa402e334002fd3f93bf1cfc8658346
Author: ellson <devnull@localhost>
Date:   Mon Aug 25 19:06:22 2008 +0000

    first-cut ubuntu packaging from graphviz_2.16-3ubuntu2.diff.gz

I’m sure python3 must be what you want…

Please try adding ,3 to debian/pyversions which is use from debian/rules.

1 Like

Did you mean this as a fix for older Ubuntu versions together with my patch or instead of my patch for Ubuntu 20.04? I tried both, but neither had any effect.

I guess that python3 is not available on older ubuntu, so there has to be some conditional somewhere to use it on ubuntu2.

Maybe get it working on an isolate ubuntu20 builder and then work out how to make the changes conditional.

I think ./configure works out what version is available. Result should be in config.statud.

I don’t have enough debian-foo to know what needs changing in debian/rules

Do you have a ubuntu20 branch with the right Dicker image that we can play on without rebuilding everything with each change? Something like my windows branch (work in progress) ?

Both python2 & python3 are available on all Ubuntus that we are building, but python (without number) is not available on Ubuntu 20.04.

That’s what I had in my original post. See above. I’ll try to make it conditional.

Yes: https://gitlab.com/magjac/graphviz/-/commits/add-build-of-ubuntu-20.04.

See it run without my patch at https://gitlab.com/magjac/graphviz/pipelines/135292501 (20.04 fails).

See it run with my patch: https://gitlab.com/magjac/graphviz/pipelines/135312195 (20.04 ok, but the others fail).

You can also pull the docker image if you don’t want to build it yourself:

docker pull graphviz/graphviz:ubuntu-20.04

Can you try this?

$ git diff
diff --git a/debian/libgv-python.install b/debian/libgv-python.install
index 2b952cf14…9f15557d6 100644
— a/debian/libgv-python.install
+++ b/debian/libgv-python.install
@@ -1,6 +1,2 @@
-usr/lib/graphviz/python
-#usr/lib/graphviz/python24
-#usr/lib/graphviz/python25
-#usr/lib/graphviz/python26
-#usr/lib/graphviz/python27
+usr/lib/graphviz/python*
usr/share/man/man3/gv.3python

Yes, in combination with a replacement of pyversions which found only Python 2 versions, this works for all Ubuntu versions. Please see my comments in https://gitlab.com/magjac/graphviz/-/commit/b861a44f39521be6c5c81f0d7aa39bdedae6be82 and suggest improvements if you find any.

All build & test stages are now successful: https://gitlab.com/magjac/graphviz/pipelines/135847942 :sunglasses:

@Ellson Any suggestions about this?

Sorry, I’m not understanding your open question?

Looks like you have solved the python3 issue.

I thought you were still working on a simplified replacement for test.sh, one that used the binaries installed from rpm or deb packages, and avoided use of ./configure

Would you like me to take a shot at that? If so, could you merge your changes so far?

It’s me that should be sorry for being unclear. Which I am. Sorry.

From https://gitlab.com/magjac/graphviz/-/commit/b861a44f39521be6c5c81f0d7aa39bdedae6be82:

Also needed was to replace pyversion which found only Python 2
versions. Possibly this can done in a better way by someone who
understands Debian packaging in general and Lintian in particular.

See https://lintian.debian.org/tags/debian-pyversions-is-obsolete.html.

I thought you might:

  1. Look at the commit diff
  2. Hopefully understand what I’m doing (I don’t). Apparently PYTHON_VERSIONS has been just 2.x for a long time. Now it’s 2.x 3.y. What’s the impact of that other than that it’s needed for Ubuntu 20.04 to build? It is the language bindings, right? Do they work or not for both pyhon2 and python3 in the releases that we have made? (I’ve started to develop tests to find out).
  3. Look at the kludgy solution to replace pyversions and follow the link about Lintian. There it says “Since dh_python2 it has been recommended to use the X-Python3-Version field in debian/control instead.”
  4. If you understand what that means, you might have a better solution in debian/control based on X-Python3-Version.

If you don’t have any suggestions; that’s fine. I’ll merge it as it is.

I’m working on many things in parallel. This was just support for Ubuntu 20.04. I’ll let you know if I need help on the other things. Thanks.

The add-build-of-ubuntu-20.04 branch has now been merged. Feel free to suggest improvements in retrospect. The pipeline ran ok here: https://gitlab.com/graphviz/graphviz/pipelines/138525075