[Pkg-mono-svn-commits] rev 1014 - mono/trunk/debian

Eduard Bloch blade@haydn.debian.org
Tue, 15 Jun 2004 06:26:12 -0600


Author: blade
Date: 2004-06-15 06:26:05 -0600 (Tue, 15 Jun 2004)
New Revision: 1014

Modified:
   mono/trunk/debian/dh_makenetlibs
   mono/trunk/debian/dh_netdeps
Log:

Better logics - the native shlibs dependency now moved completely to the
libfoo-cil packages, since those are the ones that really open the .so
libs. Still not perfect, now the resolution is only done by looking at
the .config file and assuming that it is complete. The other possible
(HALF!) solution is the resolveShlibs function which I disabled for now
since it is untested. The other method is looking with --moduleRef and
guessing where the module can be (for example libglibglue ->
libglibglue.so), but this is IMO highly unreliable and requires to
rebuilt all the resolution logic of mono in this script, which would
cause to much bloat, IMO.


Modified: mono/trunk/debian/dh_makenetlibs
===================================================================
--- mono/trunk/debian/dh_makenetlibs	2004-06-15 05:34:36 UTC (rev 1013)
+++ mono/trunk/debian/dh_makenetlibs	2004-06-15 12:26:05 UTC (rev 1014)
@@ -21,8 +21,7 @@
 
 By default, dh_makenetlibs scans the DLL files in the package
 directories and writes the discovered compatibility data (major/minor,
-build, token) to "netlibs" files int he appropriate packages. The
-dependencies on native shared libs are resolved using dpkg-shlibdeps.
+build, token) to "netlibs" files int he appropriate packages.
 
 However, if a file like debian/package.netlibs is found, this one will
 be installed and no scanning is performed.
@@ -192,7 +191,7 @@
             isnative($package);
             my $version = $dh{VERSION};
 
-            # Old compatability levels include the
+            # Old compatibility levels include the
             # debian revision, while new do not.
             if ( !compat(3) ) {
 
@@ -235,9 +234,12 @@
 
                 # Prevent duplicate lines from entering the file.
                 my $line = "$library $ver"."__$sig $deps";
-                if ( my $extra = extraDeps ($libfile) ) {
-                    $line .= ", $extra";
-                }
+                # extra dependencies are to be resolved by dh_netlibs,
+                # don't forward the dependency libs to the apps where it
+                # does not belong to
+#                if ( my $extra = extraDeps ($libfile) ) {
+#                    $line .= ", $extra";
+#                }
                 if ( !$seen{$line} ) {
                     $seen{$line} = 1;
                     complex_doit("echo '$line' >>$tmp/DEBIAN/netlibs");

Modified: mono/trunk/debian/dh_netdeps
===================================================================
--- mono/trunk/debian/dh_netdeps	2004-06-15 05:34:36 UTC (rev 1013)
+++ mono/trunk/debian/dh_netdeps	2004-06-15 12:26:05 UTC (rev 1014)
@@ -29,15 +29,20 @@
 packages). The dependency on a certain Mono version will be also added
 to the final variable.
 
-If you use this program, your package should build-depend on mono-utils.
+Note: the dependencies on shared libraries may be not resolved correctly
+if there are no .config files associated with the the .exe/.dll file
+which refers to the particular shared library (by its SONAME).
 
+If you use this program, your package should build-depend on mono-utils
+(>> 0.95).
+
 =head1 OPTIONS
 
 =over 4
 
 =item B<-d>
 
-Attempt to predict and avoid dupes that may appear if you package
+Attempt to predict and avoid duplicates that may appear if you package
 both, native shared libraries and DLL assemblies in one package.
 The list of possibly duplicating candidates is expected to be in the
 variable shlib:Depends from debian/package.substvars.
@@ -97,7 +102,7 @@
 
 my $fh;
 my %libdata;
-open( $fh, "cat debian/*/DEBIAN/netlibs /var/lib/dpkg/info/*.netlibs 2>/dev/null |" );
+open( $fh, "cat /var/lib/dpkg/info/*.netlibs debian/*/DEBIAN/netlibs 2>/dev/null |" );
 while (<$fh>) {
     /(\S+)\s+(\S+)\s+(\w.*)\n?/;
     $libdata{"$1/$2"} = $3;
@@ -116,6 +121,10 @@
             $shlibdata{"$1.so.$2"} = $3;
         }
     }
+#    if ( -r "$file.config"
+#        && `cat $file.config` =~
+#        /dll=\W*$name[^>]+\Wtarget\W*=\W*(\w[\w.\-_\d]+)/
+#        && defined( $shlibdata{$1} ) )
     if ( -r "$file.config"
         && `cat $file.config` =~
         /dll=\W*$name[^>]+\Wtarget\W*=\W*(\w[\w.\-_\d]+)/
@@ -127,6 +136,27 @@
     return 0;
 }
 
+sub extraDeps {
+   my $config=$_[0].".config";
+   my $ret=undef;
+
+   if(!%shlibdata) {
+      open( $fh, "cat /var/lib/dpkg/info/*.shlibs debian/shlibs.local debian/*/DEBIAN/shlibs 2>/dev/null |" );
+      while (<$fh>) {
+         /(\S+)\s+(\S+)\s+(\w.*)\n?/;
+         $shlibdata{"$1.so.$2"} = $3;
+      }
+   }
+
+   if( -r $config) {
+      $config=`cat $config`;
+      while($config=~s/\Wtarget\W*=\W*(\w[\w.\-\d]+)//) {
+         $ret.= (", ".$shlibdata{$1}) if(defined($shlibdata{$1}));
+      }
+   }
+   $ret=~s/^, // if $ret;
+   return $ret;
+}
 foreach my $package ( @{ $dh{DOPACKAGES} } ) {
     my $tmp = tmpdir($package);
     my %deps;
@@ -141,6 +171,9 @@
         local *F;
         my $file = $_;
         return unless open F, "monodis --assemblyref $file |";
+#        if ( my $extra = extraDeps ($file) ) {
+#           push ( @depkgs, $extra );
+#        }
         our( $vers, $name, $key );
         while (<F>) {
             $vers = $1 if /Version=(.*)\n/;
@@ -154,10 +187,11 @@
                 if ( !defined( $libdata{$compat} ) ) {
 
                     # reuse the key variable
-                    if ( resolveShlib( $file, $name, \$key ) ) {
-                        push ( @depkgs, $key );
-                    }
-                    else {
+                    #if ( resolveShlib( $file, $name, \$key ) ) {
+                    #    push ( @depkgs, $key );
+                    #}
+                    #else
+                    {
                         warning(
 "Warning! No Debian dependency data for $name ($key)!"
                         );
@@ -171,12 +205,13 @@
             }
         }
         close F;
-    }, $tmp;
-
+     }, $tmp;
     my %depkgsFiltered;
     for (@depkgs) {
        for ( split ( /\s*,\s*/, $_ ) ) {
-          $depkgsFiltered{$_} = 1;
+          # filter dupes and don't depend on this package
+          /^(\S+)/;
+          $depkgsFiltered{$_} = 1 if($1 ne $package);
        }
     }
     # now filter the dupes coming from shlibs
@@ -203,7 +238,6 @@
            $apkg=$&;
            $b=~/^\S+/;
            if($apkg eq $&) {
-              print STDERR "test, $apkg $&\n";
               return -1 if( ($a=~/>=/) && ($b=~/<</));
               return 1 if( ($b=~/>=/) && ($a=~/<</));
            }