Просмотр исходного кода

Avoid creating empty DEBIAN/symbols files during build.

Once invoked, dpkg-gensymbols used to always write out a file
even if the scan didn't find any symbol information. Now, unless
the output file has been manually specified, it won't do so
anymore. With this change, it's now possible to always add
a dpkg-gensymbols call in debian/rules and it will really be a
no-op if the package doesn't contain a library.
Raphael Hertzog лет назад: 19
Родитель
Сommit
a0880440c9
2 измененных файлов с 15 добавлено и 4 удалено
  1. 5 0
      scripts/Dpkg/Shlibs/SymbolFile.pm
  2. 10 4
      scripts/dpkg-gensymbols.pl

+ 5 - 0
scripts/Dpkg/Shlibs/SymbolFile.pm

@@ -164,6 +164,11 @@ sub merge_symbols {
     }
 }
 
+sub is_empty {
+    my ($self) = @_;
+    return scalar(keys %{$self->{objects}}) ? 0 : 1;
+}
+
 sub has_object {
     my ($self, $soname) = @_;
     return exists $self->{objects}{$soname};

+ 10 - 4
scripts/dpkg-gensymbols.pl

@@ -183,11 +183,17 @@ if ($stdout) {
     $symfile->save("-");
 } else {
     unless (defined($output)) {
-	$output = "$packagebuilddir/DEBIAN/symbols";
-	mkdir("$packagebuilddir/DEBIAN") if not -e "$packagebuilddir/DEBIAN";
+	unless($symfile->is_empty()) {
+	    $output = "$packagebuilddir/DEBIAN/symbols";
+	    mkdir("$packagebuilddir/DEBIAN") if not -e "$packagebuilddir/DEBIAN";
+	}
+    }
+    if (defined($output)) {
+	print "Storing symbols in $output.\n" if $debug;
+	$symfile->save($output);
+    } else {
+	print "No symbol information to store.\n" if $debug;
     }
-    print "Storing symbols in $output.\n" if $debug;
-    $symfile->save($output);
 }
 
 # Check if generated files differs from reference file