[Pkg-cli-common-commits] [SCM] cli-common branch, master, updated. debian/0.7.1-12-ge9fac7a

Christopher James Halse Rogers raof at ubuntu.com
Tue Apr 5 21:07:59 UTC 2011


The following commit has been merged in the master branch:
commit 625a93a49af8651b12b069be4fb244d16f1a3a53
Author: Christopher James Halse Rogers <raof at ubuntu.com>
Date:   Tue Feb 9 15:33:38 2010 +1100

    Add resolvePrivateLibrary function and use it to make dh_clideps error rather than warn when shlib refs can't be resolved

diff --git a/dh_clideps b/dh_clideps
index e5e1d29..e4ff610 100755
--- a/dh_clideps
+++ b/dh_clideps
@@ -582,14 +582,24 @@ sub resolveShlibRefs {
        next;
      }
      my $target = $dllmapdata{$name};
+     my $fullTarget = $target;
      
      if (defined($target)) {
        $target = basename($target);
        verbose_print("Resolved moduleref via DLL map: $name to: $target");
      } elsif (defined($shlibdata{$name})) {
        verbose_print("Resolved moduleref via direct match in shlibs");
+     } elsif (resolvePrivateLibrary($package, $name, $package)) {
+       # There is no DllMap, but the package ships the private library alongside the assembly
+       verbose_print("Resolved moduleref to private library $name");
+       next;
+     } elsif (resolvePrivateLibrary($package, "lib" . $name . ".so", $package)) {
+       # There is no DllMap, the assembly is relying on Mono's "foo" -> "libfoo.so"
+       # translation, and is shipping libfoo.so alongside the assembly
+       verbose_print("Resolved moduleref to private library lib" . $name . ".so");
+       next;
      } else {
-       warning("Warning: Could not resolve moduleref: $name for: $assembly_filename!");
+       error("Could not resolve moduleref: $name for: $assembly_filename!");
        next;
      }
  
@@ -602,8 +612,24 @@ sub resolveShlibRefs {
        # for DLL maps that have an unversioned library as target
        $pkgref = $shlibdata{$target.".0"};
      } else {
-       warning("Warning: Missing shlibs entry: $target or $name for: $assembly_filename!");
-       next;
+	 if(!resolvePrivateLibrary($package, $fullTarget, $package)) {
+	     # Private library can't be found in the current package.  Try to resolve it
+	     # in the other binary packages, and add a strong dependency if we find it.
+	     foreach my $binary_package (@{$dh{DOPACKAGES}}) {
+		 if(resolvePrivateLibrary($package, $fullTarget, $binary_package)) {
+		     verbose_print("Found private library in $binary_package");
+		     $pkgref = $binary_package . " (= \${binary:Version})";
+		     verbose_print("pkgref is $pkgref");
+		     last;
+		 }
+	     }
+	     if (!defined($pkgref)) {
+		 error("Missing shlibs entry: $target or $name for: $assembly_filename!");
+	     }
+	 } else {
+	     verbose_print("Found private library $target for $name");
+	     next;
+	 }
      }
 
      my %overriddenRef = resolveOverride($package, $pkgref);
@@ -612,10 +638,42 @@ sub resolveShlibRefs {
      push(@{$ret{suggests}},   $overriddenRef{suggests});
    } 
    close(F);
-   
+
    return %ret;
 }
 
+sub resolvePrivateLibrary {
+    my $package = shift;
+    my $target = shift;
+    my $resolveIn = shift;
+    my $library_file;
+
+    use File::Spec;
+    if (File::Spec->file_name_is_absolute($target)) {
+	# If the DLLMap target is absolute, we should check that the target
+	# exists in that location.  Since we're currently in the directory
+	# with the assembly, we need to back out first.
+	my @targetDirs = File::Spec->splitdir($target);
+	my @cwdComponents = File::Spec->splitdir(File::Spec->rel2abs(File::Spec->curdir()));
+	my @upDirs = ("../", "../");
+
+	# Find where the last occurance of tmpdir is in $curdir, and add enough
+	# updirs to get there from cwd.
+	while(join("/", ($cwdComponents[-2], $cwdComponents[-1])) ne tmpdir($package)) {
+	    pop(@cwdComponents);
+	    push(@upDirs, "../");
+	}
+
+	$library_file = File::Spec->rel2abs(File::Spec->catdir((File::Spec->curdir(), @upDirs, tmpdir($resolveIn), @targetDirs)));
+    } else {
+	# If the DLLMap target is not absolute, look in the same directory
+	# as the assembly.
+	$library_file = basename($target);
+    }
+    verbose_print("Looking for $target at $library_file");
+    return 1 if -f $library_file || -s $library_file;
+}
+
 =head1 SEE ALSO
 
 L<debhelper(7)>

-- 
cli-common



More information about the Pkg-cli-common-commits mailing list