Bug 49506 - Dependency loop: python-univention - univention-debug-python
Dependency loop: python-univention - univention-debug-python
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: General
UCS 4.4
All Linux
: P5 normal (vote)
: UCS 4.4-0-errata
Assigned To: Philipp Hahn
Jürn Brodersen
:
Depends on: 49140
Blocks: 49130
  Show dependency treegraph
 
Reported: 2019-05-20 10:43 CEST by Philipp Hahn
Modified: 2024-02-23 13:33 CET (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Regression
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2019-05-20 10:43:55 CEST
+++ This bug was initially created as a clone of Bug #49140 +++

1. When 
 update-python-modules --force-rebuild-all -v
is called, it will overwrite /usr/lib/pymodules/python2.7/univention/__init__.py and break pysupport.

2. There's a cyclic dependency between "python-univention" and "univention-debug-python":
  univention-python: Depends: univention-debug
    for used functionality
  univention-debug: Depends: univention-python
    for use of the name-space
Comment 1 Philipp Hahn univentionstaff 2019-05-20 12:15:06 CEST
[4.4-0] a774694430 Bug #49506 python: Split univention namespace
 base/univention-python/.gitignore                  |  7 ++++
 base/univention-python/{modules => }/__init__.py   |  3 +-
 base/univention-python/debian/changelog            |  6 ++++
 base/univention-python/debian/control              | 35 +++++++++++++++-----
 .../debian/python-univention-namespace.install     |  2 ++
 .../debian/python-univention-namespace.postinst    | 37 ++++++++++++++++++++++
 .../debian/python-univention-namespace.prerm       | 37 ++++++++++++++++++++++
 .../debian/python-univention.install               |  1 -
 .../debian/python-univention.links                 |  2 --
 base/univention-python/debian/rules                |  1 +
 .../python-univention-namespace.public             |  1 +
 11 files changed, 119 insertions(+), 13 deletions(-)

Package: univention-python
Version: 12.0.0-10A~4.4.0.201905201201
Branch: ucs_4.4-0
Scope: errata4.4-0

[4.4-0] 09b99b3e4b Bug #49136: univention-python 12.0.0-9A~4.4.0.201905101454
 doc/errata/staging/univention-python.yaml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

QA: There is the new binary package "python-univention-namespace", which provides the "univention/__init__.py" file in "dist-packages/" and "pyshared/" respective "pymodules/" for backward compatibility with "python-support". For Python3 that file is no longer needed ad Python3.3 has support for PEP 420 <https://www.python.org/dev/peps/pep-0420/> over shipping empty "__init__.py" files. "python-debug" thus will only declare a dependency on "python-univention-namespece" for its Python2 package, but not for Python3.
The "Replaces/Breaks" is necessary to "python-univention-namespace" to take over the path of "__init__.py".
As "python-univention" depends on "python-univention-namespace", the existence of the namespace if given by transitivity.
Comment 2 Florian Best univentionstaff 2019-05-21 16:43:20 CEST
I received multiple reports of this error today, which is probably caused by this bug:

"""
Starting univention-upgrade. Current UCS version is 4.4-0 errata107

Checking for local repository:                          none
Checking for package updates:                           found

The following packages will be installed:
 python-univention-namespace
The following packages will be upgraded:
 samba-vfs-modules,python-samba,samba,smbclient,winbind,samba-common-bin,samba-common,samba-dsdb-modules,libsmbclient,samba-libs,libwbclient0,insserv,libunivention-debug1,python-univention,python-univention-debug,univention-management-console-module-apps,shell-univention-lib,python-univention-lib,univention-management-console-module-appcenter,univention-appcenter,univention-appcenter-docker,python-univention-appcenter,univention-bind,univention-errata-level,univention-management-console-module-setup,univention-system-setup,univention-nfs-server,univention-portal,univention-samba-local-config,univention-samba4,univention-samba4-sysvol-sync,intel-microcode

Do you want to continue [Y|n]? 

Starting package upgrade                                ERROR: update failed. Please check /var/log/univention/updater.log

Darin:

univention-errata-level (4.4.0-109) wird eingerichtet ...
Traceback (most recent call last):
  File "/usr/sbin/ucr", line 45, in <module>
    import univention.config_registry as ub
ImportError: No module named config_registry
dpkg: Fehler beim Bearbeiten des Paketes univention-errata-level (--configure):
 Unterprozess installiertes post-installation-Skript gab den Fehlerwert 1 zurück
"""
Comment 3 Florian Best univentionstaff 2019-05-21 19:59:22 CEST
The cause is happening during the update:

During a phase where python-support / preinst is not called(!?):
Vorbereitung zum Entpacken von .../32-univention-samba4_8.0.0-24A~4.4.0.201905211223_amd64.deb ...


root@master10:~# dpkg -l python-univention python-univention-namespace
iU  python-univention                                              12.0.0-10A~4.4.0.201905201201        all                                  UCS - common Python 2 modules
iU  python-univention-namespace                                    12.0.0-10A~4.4.0.201905201201        all                                  UCS - Python 2 namespace module

root@master10:~# ls -l /usr/lib/python2.7/dist-packages/univention/__init__.py /usr/share/pyshared/univention/__init__.py  
lrwxrwxrwx 1 root root   49 May 20  2019 /usr/lib/python2.7/dist-packages/univention/__init__.py -> ../../../../share/pyshared/univention/__init__.py
-rw-r--r-- 1 root root 1514 May 20  2019 /usr/share/pyshared/univention/__init__.py

root@master10:~# ls /usr/lib/pymodules/python2.7/univention/__init__.py
ls: cannot access '/usr/lib/pymodules/python2.7/univention/__init__.py': No such file or directory

→ This symlink is missing! Will be created by python-support in a later step...

Calling "update-python-modules python-univention-namespace.public" fixes this.
Comment 4 Philipp Hahn univentionstaff 2019-05-22 08:40:20 CEST
(In reply to Florian Best from comment #3)
> The cause is happening during the update:
...
> ls: cannot access '/usr/lib/pymodules/python2.7/univention/__init__.py': No
> such file or directory
> 
> → This symlink is missing! Will be created by python-support in a later
> step...
> 
> Calling "update-python-modules python-univention-namespace.public" fixes
> this.

I forgot to add the option --post-install when calling 'update-python-modules', which delays creating the symbolic link until trigger phase, which is too late for other packages already using the "univention" namespace in their "postinst" phase.

[4.4-0] 006de29ec2 Bug #49506 python: Make namespace switch more robust
 base/univention-python/debian/changelog                            | 6 ++++++
 base/univention-python/debian/python-univention-namespace.links    | 1 +
 base/univention-python/debian/python-univention-namespace.postinst | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

Package: univention-python
Version: 12.0.0-11A~4.4.0.201905220825
Branch: ucs_4.4-0
Scope: errata4.4-0

[4.4-0] 9b64b4c47b Bug #49136: univention-python 12.0.0-11A~4.4.0.201905220825
 doc/errata/staging/univention-python.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 5 Jürn Brodersen univentionstaff 2019-05-28 17:24:54 CEST
Mostly the same tests as for bug 49136:
What I tested:
The test was always the same:
'''
from univention.lib import password  # installed through pysupport
from univention.lib import error  # installed through dh_python
'''
and in a new process the other way around

Update from errata0 -> OK
Update from errata113 (includes updated univention-python) -> OK
Installing latest test iso -> OK

update-python-modules -f -> OK (__init__.py is not overwritten with an empty file and imports work)
No jenkins test failures seem to be related to this -> OK
python-univention-debug only depends on python-univention-namespace and python-univention-namespace does not depend on python-univention-debug -> OK

Typo in yaml:
[4.4-0 9305609e6a] Bug #49506: yaml

YAML -> OK
Comment 6 Arvid Requate univentionstaff 2019-05-29 13:24:27 CEST
<http://errata.software-univention.de/ucs/4.4/129.html>