From a0880440c9b169ced9a4fc9af84d44fe0ad94876 Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Fri, 3 Aug 2007 16:57:49 +0200 Subject: [PATCH] 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. --- scripts/Dpkg/Shlibs/SymbolFile.pm | 5 +++++ scripts/dpkg-gensymbols.pl | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index 5930c8d3..b66c6666 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/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}; diff --git a/scripts/dpkg-gensymbols.pl b/scripts/dpkg-gensymbols.pl index 6173ce26..84ebd77c 100755 --- a/scripts/dpkg-gensymbols.pl +++ b/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 -- 2.39.5