[Pkg-mono-svn-commits] rev 245 - mono/branches/experimental/trunk/debian

Eduard Bloch blade@quantz.debian.org
Sun, 15 Feb 2004 13:51:36 +0100


Author: blade
Date: 2004-02-15 13:51:35 +0100 (Sun, 15 Feb 2004)
New Revision: 245

Modified:
   mono/branches/experimental/trunk/debian/dh_mono
Log:
The fixme edition


Modified: mono/branches/experimental/trunk/debian/dh_mono
===================================================================
--- mono/branches/experimental/trunk/debian/dh_mono	2004-02-15 10:52:18 UTC (rev 244)
+++ mono/branches/experimental/trunk/debian/dh_mono	2004-02-15 12:51:35 UTC (rev 245)
@@ -8,13 +8,14 @@
 
 use strict;
 use File::Find;
-eval 'use Debian::Debhelper::Dh_Lib';
-print "You need to install the debhelper package in order to use this program!" if $@;
+use Debian::Debhelper::Dh_Lib;
+#eval 'use Debian::Debhelper::Dh_Lib';
+#print "You need to install the debhelper package in order to use this program!" if $@;
 
 
 =head1 SYNOPSIS
 
-FIXME: document debian/mono.local
+FIXME: document debian/mono.local, document the usage
 
 B<dh_python> [S<I<debhelper options>>] [B<-n>] [B<-V> I<version>] [S<I<module dirs ...>>]
 
@@ -92,7 +93,7 @@
 	error("Mono is not installed, aborting. (Probably forgot to
   Build-Depend on cli-virtual-machine.)");
 }
-elsif ($python_version =~ /(mint|version)\ ([\d\.]+)/) {
+elsif ($mono_version =~ /(mint|version)\ ([\d\.]+)/) {
 	$mono_version = "$2" ;
 } else { 
 	error("Unable to parse Mono version out of \"$mono_version\".");
@@ -139,48 +140,58 @@
 		close F;
 	}, $tmp;
 
-	if (%libs) {
-     foreach $lib (keys %libs) {
-        my $kand;
-        if(!$kand) {
-           my $l;
-           open($l, "<debian/mono.local");
-           # FIXME: construct a parser that saves the exact information for
-           # fooBar.dll: PkgName (>=><< versioninfo)
-           $kand = `grep $lib.dll debian/mono.local`
+  # we have a list of DLLs in %libs keys
+
+  if (%libs) {
+     my %libsLoc; # custom dll-to-pkgname map
+     my %minvLoc; # custom pkgname-to-min-version map
+     # first create reserve lists from mono.local
+     if(-r "debian/mono.local") {
+        my $l;
+        open($l, "<debian/mono.local");
+        while(<$l>) {
+           # syntax: 
+           # foobar.dll package-name
+           # optional with minimal/maximal version:
+           # package-name: (<= any-version-string)
+           # set 0 as version string to not match at a spec. version
+           if(/^(.+).dll\s(\S+)/) { $libsLoc{$1}=$2; }
+           if(/^[^:]+:\s*(.+)\n/) { $minvLoc{$1}=$2; }
         }
+     }
 
-        $kand = `dlocate /usr/lib/$lib.dll || dpkg -S /usr/lib/$lib.dll`;
+     # feel %deps with pkg names as keys
+     foreach my $lib (keys %libs) {
+        my $kand = $libsLoc{$lib}; # resolve via local map
+        $kand = `dlocate /usr/lib/$lib.dll || dpkg -S /usr/lib/$lib.dll` 
+          unless $kand;
         $kand = `dlocate $lib.dll | grep /usr/share/dotnet` unless $kand;
         $kand = `dpkg -S $lib.dll | grep /usr/share/dotnet` unless $kand;
-        print "Warning, $lib.dll not found on this system or in debian/mono.local!\n";
-        $kand =~ /^([^:]+)/;
-        $deps{$1} = 0;
+        $kand =~ s/:.*//;
+        if($kand) { 
+           $deps{$kand} = 1;
+        }
+        else {
+           print "Warning, $lib.dll not found on this system or in debian/mono.local!\n";
+        }
      }
 
-     foreach $pkg (keys %libs) {
-        ($version) = `dpkg -s $perl` =~ /^Version:\s*(\S+)/m
-          unless $ignoreversions;
-       }
+     # some overrides
+     # $minvLoc{"mono-jit"} = ">= 0.29";
 
-#		my $version="";
-#		if ($deps & XS_MODULE or $dh{V_FLAG_SET}) {
-#			($version) = `dpkg -s $perl` =~ /^Version:\s*(\S+)/m
-#				unless $version;
-#			$version = ">= $version";
-#		}
-#		elsif ($deps & PM_MODULE) {
-#			$version = ">= $min_version";
-##		}
-#		
-#		# no need to depend on an un-versioned perl-base -- it's
-#		# essential
-#		addsubstvar($package, "perl:Depends", $perl, $version)
-#			unless $perl eq 'perl-base' && ! length($version);
-#
-#		# add perlapi-<ver> for XS modules
-#		addsubstvar($package, "perl:Depends", "perlapi-$Config{version}")
-#			if $deps & XS_MODULE;
+     # preset the cli dep
+     
+        addsubstvar($package, "mono:Depends", "mono-jit (>> 0.29) | cli-virtual-machine");
+     
+     # finaly resolve the version and add it to substvars
+     foreach my $pkg (keys %deps) {
+        my $version = $minvLoc{$pkg};
+        $version =~ s#[\(\)]##g;
+        if(!$version && `dpkg -s $pkg` =~ /^Version:\s*(\S+)/) {
+           $version = ">= $1";
+        }
+        addsubstvar($package, "mono:Depends", $pkg, $version)
+     }
 	}
 }
 
@@ -188,10 +199,10 @@
 
 L<debhelper(7)>
 
-This program is a part of debhelper.
+This program may be a part of debhelper or mono-utils.
 
 =head1 AUTHOR
 
-Brendan O'Dea <bod@debian.org>
+Eduard Bloch <blade@debian.org>, partialy based on code from Brendan O'Dea <bod@debian.org>.
 
 =cut