Bug#430367: Integrate support of a newer dpkg-shlibdeps working at the symbol level

2007-07-01 Thread Frank Lichtenheld
On Sat, Jun 23, 2007 at 09:17:24PM +0100, Raphael Hertzog wrote:
 It creates a set of modules in /usr/lib/dpkg/Dpkg/ as I need some shared
 code between dpkg-gensymbols and dpkg-shlibdeps.
 
 There's no documentation update yet, but I shall work on that once the
 code is integrated. I'll maintain that code over time and do any possible
 bugfixes and enhancements that may appear.
 
 I expect at least some enhancements in the way we handle the symbols files
 over the set of architectures (ie to share some information instead of
 having simply debian/package.symbols.arch).

Ok. I would be willing to start integrating this into dpkg. I don't like
the overall quality of the code, though. It might not be bad compared to
the code that can currently be found in dpkg-dev, but it doesn't really
measure up to any objective standards (e.g. there are too many open
calls that use the older, much more insecure and somwhat slower syntax).

My proposed plan would be to:

1) Apply the part of the patch that adds the modules. Since that doesn't
   add anything useful to dpkg in its own right, we should probably make
   this in a branch
2) Do some code clean-up
3) Add a minimal test suite (no excuse not to do this for entirely new code!)
   Something simple with Test::More should suffice, but if someone
   prefers a more sophisticated framework, I will not stand in his way.
4) when satisfied with the result, apply the rest of the patch
5) Merge to trunk/

I would give Raphael commit rights to the repository with the
understanding that he limits himself to the branch integrating his work
for now (I really see no need for technical measures enforcing that, we
are all grown-ups, right?)

Objections? Comments?

Gruesse,
-- 
Frank Lichtenheld [EMAIL PROTECTED]
www: http://www.djpig.de/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#430367: Integrate support of a newer dpkg-shlibdeps working at the symbol level

2007-07-01 Thread Frank Lichtenheld
On Sun, Jul 01, 2007 at 12:45:56PM +0200, Frank Lichtenheld wrote:
 1) Apply the part of the patch that adds the modules. Since that doesn't
add anything useful to dpkg in its own right, we should probably make
this in a branch
 2) Do some code clean-up
 3) Add a minimal test suite (no excuse not to do this for entirely new code!)
Something simple with Test::More should suffice, but if someone
prefers a more sophisticated framework, I will not stand in his way.
 4) when satisfied with the result, apply the rest of the patch
 5) Merge to trunk/

On second thought: as we don't apply the patch in trunk/, I will apply
it completly and not in separate steps

Gruesse,
-- 
Frank Lichtenheld [EMAIL PROTECTED]
www: http://www.djpig.de/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#430367: Integrate support of a newer dpkg-shlibdeps working at the symbol level

2007-07-01 Thread Raphael Hertzog
On Sun, 01 Jul 2007, Frank Lichtenheld wrote:
 On Sun, Jul 01, 2007 at 12:45:56PM +0200, Frank Lichtenheld wrote:
  1) Apply the part of the patch that adds the modules. Since that doesn't
 add anything useful to dpkg in its own right, we should probably make
 this in a branch
  2) Do some code clean-up

I'll gladly do the code cleanup if you can elaborate on what's not okay
according to your (perl coding) standards. 

In general, I might even be interested in doing this for more of the perl
code contained in dpkg (though I don't want to promise anything).

  3) Add a minimal test suite (no excuse not to do this for entirely new 
  code!)
 Something simple with Test::More should suffice, but if someone
 prefers a more sophisticated framework, I will not stand in his way.

What do you want to test? The scripts or the modules or both? 

We always need binaries and libraries to do the test, how do you expect me
to handle that? 

  4) when satisfied with the result, apply the rest of the patch
  5) Merge to trunk/
 
 On second thought: as we don't apply the patch in trunk/, I will apply
 it completly and not in separate steps

Please find attached a patch rebased on the latest trunk (as requested on
IRC).

Cheers,
-- 
Raphaël Hertzog

Premier livre français sur Debian GNU/Linux :
http://www.ouaza.com/livre/admin-debian/
diff --git a/configure.ac b/configure.ac
index a023b03..1b899ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,7 @@ AC_CONFIG_FILES([ Makefile
 		  origins/Makefile
 		  po/Makefile.in
 		  scripts/Makefile
+		  scripts/modules/Makefile
 		  scripts/po/Makefile.in
 		  src/Makefile
 		  utils/Makefile ])
diff --git a/debian/dpkg-dev.install b/debian/dpkg-dev.install
index fda7604..d5e165c 100644
--- a/debian/dpkg-dev.install
+++ b/debian/dpkg-dev.install
@@ -8,6 +8,7 @@ usr/bin/dpkg-checkbuilddeps
 usr/bin/dpkg-distaddfile
 usr/bin/dpkg-genchanges
 usr/bin/dpkg-gencontrol
+usr/bin/dpkg-gensymbols
 usr/bin/dpkg-name
 usr/bin/dpkg-parsechangelog
 usr/bin/dpkg-scanpackages
@@ -15,6 +16,7 @@ usr/bin/dpkg-scansources
 usr/bin/dpkg-shlibdeps
 usr/bin/dpkg-source
 usr/lib/dpkg/controllib.pl
+usr/lib/dpkg/Dpkg
 usr/lib/dpkg/parsechangelog
 usr/share/locale/*/LC_MESSAGES/dpkg-dev.mo
 usr/share/man/*/*/822-date.1
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index b8b3643..45eaedf 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = po
+SUBDIRS = po modules
 
 bin_SCRIPTS = \
 	822-date \
@@ -10,6 +10,7 @@ bin_SCRIPTS = \
 	dpkg-distaddfile \
 	dpkg-genchanges \
 	dpkg-gencontrol \
+	dpkg-gensymbols \
 	dpkg-name \
 	dpkg-parsechangelog \
 	dpkg-scanpackages \
@@ -36,6 +37,7 @@ EXTRA_DIST = \
 	dpkg-distaddfile.pl \
 	dpkg-genchanges.pl \
 	dpkg-gencontrol.pl \
+	dpkg-gensymbols.pl \
 	dpkg-name.sh \
 	dpkg-parsechangelog.pl \
 	dpkg-scanpackages.pl \
diff --git a/scripts/dpkg-gensymbols.pl b/scripts/dpkg-gensymbols.pl
new file mode 100755
index 000..c1066e0
--- /dev/null
+++ b/scripts/dpkg-gensymbols.pl
@@ -0,0 +1,235 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+our $version;
+our $dpkglibdir;
+BEGIN {
+$version=1.14.4; # This line modified by Makefile
+$dpkglibdir=/usr/lib/dpkg; # This line modified by Makefile
+push(@INC,$dpkglibdir);
+}
+require 'controllib.pl';
+
+use Dpkg::Version qw(compare_versions);
+use Dpkg::Shlibs qw(@librarypaths);
+use Dpkg::Shlibs::Objdump;
+use Dpkg::Shlibs::SymbolFile;
+
+our $progname;
+our (%f, %fi);
+our %p2i;
+our @librarypaths;
+
+our $host_arch= `dpkg-architecture -qDEB_HOST_ARCH`;
+chomp $host_arch;
+
+require 'dpkg-gettext.pl';
+textdomain(dpkg-dev);
+
+my $controlfile = 'debian/control';
+my $changelogfile = 'debian/changelog';
+my $packagebuilddir = 'debian/tmp';
+
+my $sourceversion;
+my $stdout;
+my $oppackage;
+my $compare = 1; # Bail on missing symbols by default
+my $output;
+my $debug = 0;
+
+sub version {
+printf _g(Debian %s version %s.\n), $progname, $version;
+
+printf _g(
+Copyright (C) 2007 Raphael Hertzog.
+);
+
+printf _g(
+This is free software; see the GNU General Public Licence version 2 or
+later for copying conditions. There is NO warranty.
+);
+}
+
+sub usage {
+printf _g(
+Usage: %s [option ...]
+
+Options:
+  -ppackage  generate symbols file for package.
+  -Ppackagebuilddir  temporary build dir instead of debian/tmp.
+  -elibrary  explicitely list libraries to scan.
+  -vversion  version of the packages (defaults to
+   version extracted from debian/changelog).
+  -clevelcompare generated symbols file with the
+   reference file in the debian directory.
+			   Fails if difference are too important
+			   (level goes from 0 for no check, to 4
+			   for all checks). By default checks at
+			   level 1.
+  -Ofile write to file, not .../DEBIAN/symbols.
+ 

Bug#430367: Integrate support of a newer dpkg-shlibdeps working at the symbol level

2007-07-01 Thread Raphael Hertzog
On Sun, 01 Jul 2007, Frank Lichtenheld wrote:
 I would give Raphael commit rights to the repository with the
 understanding that he limits himself to the branch integrating his work
 for now (I really see no need for technical measures enforcing that, we
 are all grown-ups, right?)

Sure, I have no problem with that.

Cheers,
-- 
Raphaël Hertzog

Premier livre français sur Debian GNU/Linux :
http://www.ouaza.com/livre/admin-debian/




Bug#430367: Integrate support of a newer dpkg-shlibdeps working at the symbol level

2007-06-23 Thread Raphael Hertzog
Package: dpkg
Version: 1.14.4

Please find attached a patch integrating my work on dpkg-shlibdeps in the
current dpkg version. I've put my work in a git repository on
git://git.debian.org/git/private/hertzog/dpkg (branch dpkg-shlibdeps)

It creates a set of modules in /usr/lib/dpkg/Dpkg/ as I need some shared
code between dpkg-gensymbols and dpkg-shlibdeps.

There's no documentation update yet, but I shall work on that once the
code is integrated. I'll maintain that code over time and do any possible
bugfixes and enhancements that may appear.

I expect at least some enhancements in the way we handle the symbols files
over the set of architectures (ie to share some information instead of
having simply debian/package.symbols.arch).

Any comments welcome. Please note that the code in the bzr branch is
outdated now. I did substantial changes to put some code in modules.

For reference, the following wiki page contains the initial spec that lead
me in this work:
http://wiki.debian.org/Projects/ImprovedDpkgShlibdeps

Cheers,
-- 
Raphaël Hertzog

Premier livre français sur Debian GNU/Linux :
http://www.ouaza.com/livre/admin-debian/
diff --git a/configure.ac b/configure.ac
index a023b03..1b899ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,7 @@ AC_CONFIG_FILES([ Makefile
 		  origins/Makefile
 		  po/Makefile.in
 		  scripts/Makefile
+		  scripts/modules/Makefile
 		  scripts/po/Makefile.in
 		  src/Makefile
 		  utils/Makefile ])
diff --git a/debian/dpkg-dev.install b/debian/dpkg-dev.install
index fda7604..d5e165c 100644
--- a/debian/dpkg-dev.install
+++ b/debian/dpkg-dev.install
@@ -8,6 +8,7 @@ usr/bin/dpkg-checkbuilddeps
 usr/bin/dpkg-distaddfile
 usr/bin/dpkg-genchanges
 usr/bin/dpkg-gencontrol
+usr/bin/dpkg-gensymbols
 usr/bin/dpkg-name
 usr/bin/dpkg-parsechangelog
 usr/bin/dpkg-scanpackages
@@ -15,6 +16,7 @@ usr/bin/dpkg-scansources
 usr/bin/dpkg-shlibdeps
 usr/bin/dpkg-source
 usr/lib/dpkg/controllib.pl
+usr/lib/dpkg/Dpkg
 usr/lib/dpkg/parsechangelog
 usr/share/locale/*/LC_MESSAGES/dpkg-dev.mo
 usr/share/man/*/*/822-date.1
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index b8b3643..45eaedf 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = po
+SUBDIRS = po modules
 
 bin_SCRIPTS = \
 	822-date \
@@ -10,6 +10,7 @@ bin_SCRIPTS = \
 	dpkg-distaddfile \
 	dpkg-genchanges \
 	dpkg-gencontrol \
+	dpkg-gensymbols \
 	dpkg-name \
 	dpkg-parsechangelog \
 	dpkg-scanpackages \
@@ -36,6 +37,7 @@ EXTRA_DIST = \
 	dpkg-distaddfile.pl \
 	dpkg-genchanges.pl \
 	dpkg-gencontrol.pl \
+	dpkg-gensymbols.pl \
 	dpkg-name.sh \
 	dpkg-parsechangelog.pl \
 	dpkg-scanpackages.pl \
diff --git a/scripts/dpkg-gensymbols.pl b/scripts/dpkg-gensymbols.pl
new file mode 100755
index 000..c1066e0
--- /dev/null
+++ b/scripts/dpkg-gensymbols.pl
@@ -0,0 +1,235 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+our $version;
+our $dpkglibdir;
+BEGIN {
+$version=1.14.4; # This line modified by Makefile
+$dpkglibdir=/usr/lib/dpkg; # This line modified by Makefile
+push(@INC,$dpkglibdir);
+}
+require 'controllib.pl';
+
+use Dpkg::Version qw(compare_versions);
+use Dpkg::Shlibs qw(@librarypaths);
+use Dpkg::Shlibs::Objdump;
+use Dpkg::Shlibs::SymbolFile;
+
+our $progname;
+our (%f, %fi);
+our %p2i;
+our @librarypaths;
+
+our $host_arch= `dpkg-architecture -qDEB_HOST_ARCH`;
+chomp $host_arch;
+
+require 'dpkg-gettext.pl';
+textdomain(dpkg-dev);
+
+my $controlfile = 'debian/control';
+my $changelogfile = 'debian/changelog';
+my $packagebuilddir = 'debian/tmp';
+
+my $sourceversion;
+my $stdout;
+my $oppackage;
+my $compare = 1; # Bail on missing symbols by default
+my $output;
+my $debug = 0;
+
+sub version {
+printf _g(Debian %s version %s.\n), $progname, $version;
+
+printf _g(
+Copyright (C) 2007 Raphael Hertzog.
+);
+
+printf _g(
+This is free software; see the GNU General Public Licence version 2 or
+later for copying conditions. There is NO warranty.
+);
+}
+
+sub usage {
+printf _g(
+Usage: %s [option ...]
+
+Options:
+  -ppackage  generate symbols file for package.
+  -Ppackagebuilddir  temporary build dir instead of debian/tmp.
+  -elibrary  explicitely list libraries to scan.
+  -vversion  version of the packages (defaults to
+   version extracted from debian/changelog).
+  -clevelcompare generated symbols file with the
+   reference file in the debian directory.
+			   Fails if difference are too important
+			   (level goes from 0 for no check, to 4
+			   for all checks). By default checks at
+			   level 1.
+  -Ofile write to file, not .../DEBIAN/symbols.
+  -O   write to stdout, not .../DEBIAN/symbols.
+  -d   display debug information during work.
+  -h, --help   show this help message.
+  --version