]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_installman
r1916: * dh_installman: When --language is used, be smarter about stripping
[debhelper.git] / dh_installman
index df0ad44e5f6f6d636601de6fff93948e40189e52..7f39b9348ef06a221edb33615d00b729b9c10f8b 100755 (executable)
@@ -143,17 +143,19 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
        
                my $destdir="$tmp/usr/share/man/man$realsection/";
                my $langcode;
-               if (! exists $dh{LANGUAGE}) {
+               if (! defined $dh{LANGUAGE} || ! exists $dh{LANGUAGE}) {
                        # Translated man pages are typically specified by adding the
                        # language code to the filename, so detect that and
                        # redirect to appropriate directory, stripping the code.
                        ($langcode)=$basename=~m/.*\.([a-z][a-z](?:_[A-Z][A-Z])?)\.(?:[1-9]|man)/;
-                       # Strip the language code from the instname.
-                       $instname=~s/\.$langcode$//;
                }
                elsif ($dh{LANGUAGE} ne 'C') {
                        $langcode=$dh{LANGUAGE};
-                       ($instname)=$basename=~m/(.*?)\./;
+               }
+               
+               if (defined $langcode && $langcode ne '') {
+                       # Strip the language code from the instname.
+                       $instname=~s/\.$langcode$//;
                }
                
                if (defined $langcode && $langcode ne '') {
@@ -203,6 +205,11 @@ sub find_so_man {
        }
        my $l=<SOTEST>;
        close SOTEST;
+
+       if (! defined $l) {
+               error("failed to read $_");
+       }
+       
        if ($l=~m/\.so\s+(.*)\s*/) {
                my $solink=$1;
                # This test is here to prevent links like ... man8/../man8/foo.8