Followup-For: Bug #985066

Hi,

attached is a new version of the patch that also solves some of the
circular dependency issues. That seems to fix all the upgrade issues I
encountered when upgrading mono packages from buster to bullseye.

Andreas
diff -Nru mono-6.8.0.105+dfsg/debian/changelog 
mono-6.8.0.105+dfsg/debian/changelog
--- mono-6.8.0.105+dfsg/debian/changelog        2020-04-08 15:11:12.000000000 
+0200
+++ mono-6.8.0.105+dfsg/debian/changelog        2021-03-31 13:38:34.000000000 
+0200
@@ -1,3 +1,24 @@
+mono (6.8.0.105+dfsg-4) UNRELEASED; urgency=medium
+
+  * mono-gac: Add Pre-Depends: mono-runtime-common (>= 5.20) and stop messing
+    with /etc/mono/config manually. gacutil is used from hooks called by
+    maintainer scripts and must stay functional even if unpacked and not yet
+    configured.  (Closes: #985066)
+  * Move mono-gac dependency from mono-runtime-common to mono-runtime-sgen and
+    mono-runtime-boehm to avoid introducing a new dependency cycle.
+  * libmono-system4.0-cil, libmono-system-configuration4.0-cil: Drop
+    mono-runtime dependency, all their rdepends also depend on
+    libmono-corlib4.5-cil which already has the mono-runtime dependency.
+  * Move the actual library from libmono-corlib4.5-cil to
+    libmono-corlib4.5-core-cil and redirect the circular libmono-*
+    dependencies there to break the dependency cycle between mono-runtime and
+    libmono-*.  (Closes: #940301, #528090, #656895, #986275, #986293)
+  * mono-mcs: Clean up obsolete alternatives.  (Closes: #801789)
+  * Ship /etc/mono/registry/LocalMachine/.
+  * Clean up empty /usr/lib/mono/aot-cache/${MONOARCH}/.
+
+ -- Andreas Beckmann <a...@debian.org>  Wed, 31 Mar 2021 13:38:34 +0200
+
 mono (6.8.0.105+dfsg-3) unstable; urgency=high
 
   * [2501df4] Workaround for gacutil System.Native mapping dependency 
diff -Nru mono-6.8.0.105+dfsg/debian/control mono-6.8.0.105+dfsg/debian/control
--- mono-6.8.0.105+dfsg/debian/control  2020-02-25 22:34:26.000000000 +0100
+++ mono-6.8.0.105+dfsg/debian/control  2021-03-31 13:38:34.000000000 +0200
@@ -40,7 +40,6 @@
 Depends: ${shlibs:Depends},
          ${misc:Depends},
          binutils,
-         mono-gac (= ${source:Version})
 Description: Mono runtime - common files
  Mono is a platform for running and developing applications based on the
  ECMA/ISO Standards. Mono is an open source effort led by Xamarin.
@@ -78,6 +77,7 @@
 Architecture: amd64 armel arm64 armhf i386 mipsel kfreebsd-amd64 kfreebsd-i386 
powerpc ppc64 ppc64el s390x
 Depends: ${shlibs:Depends},
          ${misc:Depends},
+         mono-gac (= ${source:Version}),
          mono-runtime-common (= ${binary:Version})
 Homepage: http://www.mono-project.com/Compacting_GC
 Description: Mono runtime - SGen
@@ -100,6 +100,7 @@
 Architecture: amd64 armel armhf i386 mipsel kfreebsd-amd64 kfreebsd-i386 
powerpc ppc64 ppc64el s390x
 Depends: ${shlibs:Depends},
          ${misc:Depends},
+         mono-gac (= ${source:Version}),
          mono-runtime-common (= ${binary:Version})
 Description: Mono runtime - Boehm
  Mono is a platform for running and developing applications based on the
@@ -663,7 +664,8 @@
 
 Package: libmono-corlib4.5-cil
 Architecture: all
-Depends: ${misc:Depends}, tzdata,
+Depends: ${misc:Depends},
+         libmono-corlib4.5-core-cil (= ${source:Version}),
          mono-runtime (>= ${mono:upversion}), mono-runtime (<< 
${mono:next-upversion})
 Recommends: libmono-i18n-west4.0-cil
 Suggests: libmono-i18n4.0-all
@@ -682,6 +684,26 @@
  US-ASCII, ISO 8859-1 (Latin 1) and UTF-8 users don't need any extra I18N
  packages.
 
+Package: libmono-corlib4.5-core-cil
+Architecture: all
+Depends: ${misc:Depends}, tzdata,
+Breaks: libmono-corlib4.5-cil (<< 6.8.0.105+dfsg-3.1~)
+Replaces: libmono-corlib4.5-cil (<< 6.8.0.105+dfsg-3.1~)
+Description: Mono core library (for CLI 4.5)
+ Mono is a platform for running and developing applications based on the
+ ECMA/ISO Standards. Mono is an open source effort led by Xamarin.
+ Mono provides a complete CLR (Common Language Runtime) including compiler and
+ runtime, which can produce and execute CIL (Common Intermediate Language)
+ bytecode (aka assemblies), and a class library.
+ .
+ This package contains the Core Library (mscorlib.dll) of Mono for CLI 4.5,
+ which is the glue between the BCL (Base Class Libraries) and the JIT.
+ .
+ You should install libmono-i18n-west4.0-cil if you are using
+ ISO 8859-15 (Latin 9) or other common Western European code pages.
+ US-ASCII, ISO 8859-1 (Latin 1) and UTF-8 users don't need any extra I18N
+ packages.
+
 Package: libmono-i18n4.0-all
 Architecture: all
 Depends: ${misc:Depends},
@@ -802,7 +824,7 @@
 Recommends: ca-certificates-mono (= ${source:Version})
 Depends: ${misc:Depends},
          ${cli:Depends},
-         mono-runtime (>= ${mono:upversion}), mono-runtime (<< 
${mono:next-upversion})
+#        mono-runtime (>= ${mono:upversion}), mono-runtime (<< 
${mono:next-upversion})
 Description: Mono System libraries (for CLI 4.0)
  Mono is a platform for running and developing applications based on the
  ECMA/ISO Standards. Mono is an open source effort led by Xamarin.
@@ -844,7 +866,7 @@
 Architecture: all
 Depends: ${misc:Depends},
          ${cli:Depends},
-         mono-runtime (>= ${mono:upversion}), mono-runtime (<< 
${mono:next-upversion})
+#        mono-runtime (>= ${mono:upversion}), mono-runtime (<< 
${mono:next-upversion})
 Description: Mono System.Configuration library (for CLI 4.0)
  Mono is a platform for running and developing applications based on the
  ECMA/ISO Standards. Mono is an open source effort led by Xamarin.
@@ -2970,6 +2992,7 @@
 
 Package: mono-gac
 Architecture: all
+Pre-Depends: mono-runtime-common (>= 5.20),
 Depends: ${misc:Depends},
          mono-4.0-gac (= ${source:Version})
 Provides: global-assembly-cache-tool
diff -Nru mono-6.8.0.105+dfsg/debian/mono-gac.postinst 
mono-6.8.0.105+dfsg/debian/mono-gac.postinst
--- mono-6.8.0.105+dfsg/debian/mono-gac.postinst        2020-02-25 
20:06:42.000000000 +0100
+++ mono-6.8.0.105+dfsg/debian/mono-gac.postinst        2021-03-31 
13:38:31.000000000 +0200
@@ -1,10 +1,5 @@
 #!/bin/sh -e
 
-# Work around for gacutil needing /etc/mono/config >= 5.20
-if [ -e /etc/mono/config.dpkg-new ]; then
-       mv /etc/mono/config.dpkg-new /etc/mono/config
-fi
-
 # On upgrades we need to repopulate the GAC and framework paths
 # to accomodate any changes in layout
 #
diff -Nru mono-6.8.0.105+dfsg/debian/mono-mcs.postinst 
mono-6.8.0.105+dfsg/debian/mono-mcs.postinst
--- mono-6.8.0.105+dfsg/debian/mono-mcs.postinst        1970-01-01 
01:00:00.000000000 +0100
+++ mono-6.8.0.105+dfsg/debian/mono-mcs.postinst        2021-03-31 
13:38:34.000000000 +0200
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = "configure" ]; then
+       # clean up obsolete alternatives, can be removed after bullseye
+       update-alternatives --remove c-sharp-compiler /usr/bin/mcs
+fi
+
+#DEBHELPER#
diff -Nru mono-6.8.0.105+dfsg/debian/mono-runtime-common.dirs 
mono-6.8.0.105+dfsg/debian/mono-runtime-common.dirs
--- mono-6.8.0.105+dfsg/debian/mono-runtime-common.dirs 2020-02-25 
20:06:42.000000000 +0100
+++ mono-6.8.0.105+dfsg/debian/mono-runtime-common.dirs 2021-03-31 
13:38:34.000000000 +0200
@@ -1,2 +1,3 @@
+etc/mono/registry/LocalMachine
 usr/share/binfmts
 usr/share/dotnet
diff -Nru mono-6.8.0.105+dfsg/debian/mono-runtime-common.postinst 
mono-6.8.0.105+dfsg/debian/mono-runtime-common.postinst
--- mono-6.8.0.105+dfsg/debian/mono-runtime-common.postinst     2020-02-25 
20:06:42.000000000 +0100
+++ mono-6.8.0.105+dfsg/debian/mono-runtime-common.postinst     2021-03-31 
13:38:34.000000000 +0200
@@ -13,5 +13,4 @@
        ldconfig
 fi
         
-mkdir -p /etc/mono/registry/LocalMachine/
 #DEBHELPER#
diff -Nru mono-6.8.0.105+dfsg/debian/prerm-monoaot 
mono-6.8.0.105+dfsg/debian/prerm-monoaot
--- mono-6.8.0.105+dfsg/debian/prerm-monoaot    2020-02-25 20:06:42.000000000 
+0100
+++ mono-6.8.0.105+dfsg/debian/prerm-monoaot    2021-03-31 13:38:34.000000000 
+0200
@@ -1 +1,4 @@
-rm -f /usr/lib/mono/aot-cache/`mono --version | grep Architecture | sed 's/.*: 
 //' | sed 's/el,.*//'`/`basename #FILE#`
+MONOARCH=`mono --version | grep Architecture | sed 's/.*:  //' | sed 
's/el,.*//'`
+rm -f /usr/lib/mono/aot-cache/${MONOARCH}/`basename #FILE#`
+test ! -d /usr/lib/mono/aot-cache/${MONOARCH} || rmdir 
--ignore-fail-on-non-empty /usr/lib/mono/aot-cache/${MONOARCH}
+test ! -d /usr/lib/mono/aot-cache || rmdir --ignore-fail-on-non-empty 
/usr/lib/mono/aot-cache
diff -Nru mono-6.8.0.105+dfsg/debian/rules mono-6.8.0.105+dfsg/debian/rules
--- mono-6.8.0.105+dfsg/debian/rules    2020-02-25 20:06:42.000000000 +0100
+++ mono-6.8.0.105+dfsg/debian/rules    2021-03-31 13:38:34.000000000 +0200
@@ -371,6 +371,20 @@
        #DH_VERBOSE=1 debian/dh_clideps -i -l debian/tmp 
$(DH_INTERNAL_MONO_PARAM)
        # mono-1.0/2.0-gac needs special runtime dep, to prevent circular dep 
(mono-runtime <-> mono-1.0/2.0-gac)
        debian/dh_clideps -p mono-4.0-gac -r $(DH_INTERNAL_MONO_PARAM)
+       # HACK to break the dependency cycle between runtime and libmono*
+       debian/dh_clideps -p libmono-system4.0-cil -r $(DH_INTERNAL_MONO_PARAM)
+       debian/dh_clideps -p libmono-system-core4.0-cil -r 
$(DH_INTERNAL_MONO_PARAM)
+       mv debian/libmono-corlib4.5-cil/usr/lib 
debian/libmono-corlib4.5-core-cil/usr/
+       mv debian/libmono-corlib4.5-cil/DEBIAN/clilibs 
debian/libmono-corlib4.5-core-cil/DEBIAN/
+       sed -i s/libmono-corlib4.5-cil/libmono-corlib4.5-core-cil/ \
+               debian/libmono-system4.0-cil.substvars \
+               debian/libmono-system-configuration4.0-cil.substvars \
+               debian/libmono-system-core4.0-cil.substvars \
+               debian/libmono-system-numerics4.0-cil.substvars \
+               debian/libmono-system-security4.0-cil.substvars \
+               debian/libmono-system-xml4.0-cil.substvars \
+               debian/libmono-security4.0-cil.substvars \
+               debian/mono-4.0-gac.substvars
        dh_gencontrol -i -- -Vmono:upversion=$(UPVERSION) 
-Vmono:next-upversion=$(NEXT_UPVERSION)
        dh_md5sums -i
        dh_builddeb -i

Reply via email to