[Pkg-mono-svn-commits] rev 951 - mono/trunk/debian
Eduard Bloch
blade@haydn.debian.org
Sat, 12 Jun 2004 08:22:35 -0600
Author: blade
Date: 2004-06-12 08:22:32 -0600 (Sat, 12 Jun 2004)
New Revision: 951
Added:
mono/trunk/debian/dh_makenetlibs
mono/trunk/debian/dh_netdeps
Removed:
mono/trunk/debian/dh_dotnetdeps
Log:
Almost working versions of dh_tools
Deleted: mono/trunk/debian/dh_dotnetdeps
===================================================================
--- mono/trunk/debian/dh_dotnetdeps 2004-06-12 14:02:41 UTC (rev 950)
+++ mono/trunk/debian/dh_dotnetdeps 2004-06-12 14:22:32 UTC (rev 951)
@@ -1,215 +0,0 @@
-#!/usr/bin/perl -w
-
-=head1 NAME
-
-dh_dotnet - calculates .NET dependencies
-
-=cut
-
-use strict;
-use File::Find;
-use Debian::Debhelper::Dh_Lib;
-#eval 'use Debian::Debhelper::Dh_Lib';
-#print "You need to install the debhelper package in order to use this program!" if $@;
-
-
-=head1 SYNOPSIS
-
-FIXME: document debian/mono.local, document the usage
-
-B<dh_python> [S<I<debhelper options>>] [B<-n>] [B<-V> I<version>] [S<I<module dirs ...>>]
-
-=head1 DESCRIPTION
-
-dh_python is a debhelper program that is responsible for generating the
-${python:Depends} substitutions and adding them to substvars files. It
-will also add a postinst and a prerm script if required.
-
-The program will look at python scripts and modules in your package, and
-will use this information to generate a dependency on python, with the
-current major version, or on pythonX.Y if your scripts or modules need a
-specific python version. The dependency will be substituted into your
-package's control file wherever you place the token "${python:Depends}".
-
-If some modules need to be byte-compiled at install time, appropriate
-postinst and prerm scripts will be generated. If already byte-compiled
-modules are found, they are removed.
-
-If you use this program, your package should build-depend on python.
-
-=head1 OPTIONS
-
-=over 4
-
-=item I<module dirs>
-
-If your package installs python modules in non-standard directories, you
-can make dh_python check those directories by passing their names on the
-command line. By default, it will check /usr/lib/site-python,
-/usr/lib/$PACKAGE, /usr/share/$PACKAGE, /usr/lib/games/$PACKAGE,
-/usr/share/games/$PACKAGE and /usr/lib/python?.?/site-packages.
-
-Note: only /usr/lib/site-python, /usr/lib/python?.?/site-packages and the
-extra names on the command line are searched for binary (.so) modules.
-
-=item B<-V> I<version>
-
-If the .py files your package ships are meant to be used by a specific
-pythonX.Y version, you can set this option with the desired X.Y python
-version.
-Do not use if you ship modules in /usr/lib/site-python.
-
-=item B<-n>, B<--noscripts>
-
-Do not modify postinst/postrm scripts.
-
-=back
-
-=head1 CONFORMS TO
-
-Debian policy, version 3.5.7
-
-Python policy, version 0.3.7
-
-=cut
-
-init();
-
-my $cli = '/usr/bin/cli';
-
-# The current python major version
-# my $python_major;
-my $mono_version = `$cli -V 2>&1`;
-
-if (!-x "/usr/bin/monodis") {
- error("Package mono-utils is not installed, aborting. (Probably forgot to Build-Depend on mono-utils.)");
-}
-
-if(system "grep \"Build-Dep.*mono-utils\" debian/control") {
- print "Warning: no Build-Depends on mono-utils!\n";
-}
-
-if (! defined $mono_version || $mono_version eq "") {
- error("Mono is not installed, aborting. (Probably forgot to
- Build-Depend on cli-virtual-machine.)");
-}
-elsif ($mono_version =~ /(mint|version)\ ([\d\.]+)/) {
- $mono_version = "$2" ;
-} else {
- error("Unable to parse Mono version out of \"$mono_version\".");
-}
-
-# The next python version
-#my $python_nextversion = $python_version + 0.1;
-#my $python_nextmajor = $python_major + 1;
-#
-#my @python_allversions = ('1.5','2.1','2.2','2.3');
-#foreach (@python_allversions) {
-# s/^/python/;
-#}
-
-# Check for -V
-my $usemono = $mono_version;
-if($dh{V_FLAG_SET}) {
- $usemono = $dh{V_FLAG};
-}
-
-# Cleaning the paths given on the command line
-foreach (@ARGV) {
- s#/$##;
- s#^/##;
-}
-
-foreach my $package (@{$dh{DOPACKAGES}}) {
- my $tmp=tmpdir($package);
- my %deps;
- my %libs;
-
- delsubstvar($package, "mono:Depends"); # for idempotency
-
- # find binaries
- find sub {
- my $vers;
- return unless -f and /\.(exe|dll)$/;
- local *F;
- return unless open F, "monodis --assemblyref $_|";
- while(<F>) {
- $vers=$1 if /Version=(.*)\n/;
- $libs{$1}=$vers if /Name=(.*)\n/;
- }
- close F;
- }, $tmp;
-
- # we have a list of DLLs in %libs keys
-
- if (%libs) {
- my %libsLoc; # custom dll-to-pkgname map
- my %minvLoc; # custom pkgname-to-min-version map
- # first create reserve lists from mono.local
- if(-r "debian/monolibs.local") {
- my $l;
- open($l, "<debian/monolibs.local");
- while(<$l>) {
- # syntax:
- # foobar.dll package-name
- # optional with minimal/maximal version:
- # package-name: (<= any-version-string)
- # set 0 as version string to not match at a spec. version
- if(/^(.+).dll\s(\S+)/) { $libsLoc{$1}=$2; }
- if(/^[^:]+:\s*(.+)\n/) { $minvLoc{$1}=$2; }
- }
- }
-
- # fill %deps with pkg names as keys
- foreach my $lib (keys %libs) {
- my $kand = $libsLoc{$lib}; # resolve via local map
-# $kand = `dlocate -e /usr/lib/$lib.dll || dpkg -S /usr/lib/$lib.dll`
- $kand = `dpkg -S /usr/lib/$lib.dll` unless $kand;
-# $kand = `dlocate -e $lib.dll | grep /usr/share/dotnet` unless $kand;
- $kand = `dpkg -S $lib.dll | grep /usr/share/dotnet` unless $kand;
- $kand =~ s/:.*//;
- if($kand) {
- # we also don't want to have circular deps to this package
- $deps{$kand} = 1 if($kand ne $package);
- }
- else {
- print "Warning, $lib.dll not found on this system or in debian/mono.local!\n";
- }
- }
-
- # some overrides
- # $minvLoc{"mono-jit"} = ">= 0.29";
-
- # preset the cli dep
-
- addsubstvar($package, "mono:Depends", "mono-jit (>> 0.29) | cli-virtual-machine");
-
- # finaly resolve the version and add it to substvars
- foreach my $pkg (keys %deps) {
- my $version = $minvLoc{$pkg};
- $version =~ s#[\(\)]##g if $version;
- if(!$version && `dpkg -s $pkg` =~ /^Version:\s*(\S+)/m) {
- $version = ">= $1";
- # FIXME add an option to match the exact versions
- # match only the upstream version
- if(!0) {
- $version =~ s/-[^-]+$//;
- $version =~ s/=/>/;
- }
- }
- addsubstvar($package, "mono:Depends", $pkg, $version)
- }
- }
-}
-
-=head1 SEE ALSO
-
-L<debhelper(7)>
-
-This program may be a part of debhelper or mono-utils.
-
-=head1 AUTHOR
-
-Eduard Bloch <blade@debian.org>, partialy based on code from Brendan O'Dea <bod@debian.org>.
-
-=cut
Added: mono/trunk/debian/dh_makenetlibs
===================================================================
--- mono/trunk/debian/dh_makenetlibs 2004-06-12 14:02:41 UTC (rev 950)
+++ mono/trunk/debian/dh_makenetlibs 2004-06-12 14:22:32 UTC (rev 951)
@@ -0,0 +1,193 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_makenetlibs - automatically create netlibs file
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_makenetlibs> [S<I<debhelper options>>] [B<-m>I<major>] [B<-V>I<[dependancies]>] [B<-n>] [B<-X>I<item>]
+
+=head1 DESCRIPTION
+
+dh_makenetlibs is a debhelper program that automatically scans for shared
+libraries, and generates a netlibs file for the libraries it finds.
+
+It also adds a call to ldconfig in the postinst and postrm scripts (in
+V3 mode and above only) to any packages which it finds shared libraries in.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-m>I<major>, B<--major=>I<major>
+
+Instead of trying to guess the major number of the library with objdump,
+use the major number specified after the -m parameter. This is much less
+useful than it used to be, back in the bad old days when this program
+looked at library filenames rather than using objdump.
+
+=item B<-V>, B<-V>I<dependancies>
+
+=item B<--version-info>, B<--version-info=>I<dependancies>
+
+By default, the netlibs file generated by this program does not make packages
+depend on any particular version of the package containing the shared
+library. It may be necessary for you to add some version dependancy
+information to the netlibs file. If -V is specified with no dependancy
+information, the current version of the package is plugged into a
+dependancy that looks like "packagename (>= packageversion)". If -V is
+specified with parameters, the parameters can be used to specify the exact
+dependancy information needed (be sure to include the package name).
+
+Beware of using -V without any parameters; this is a conservative setting
+that always ensures that other packages' shared library dependencies are at
+least as tight as they need to be, so that if the maintainer screws up then
+they won't break. The flip side is that packages might end up with
+dependencies that are too tight and so find it harder to be upgraded.
+
+=item B<-n>, B<--noscripts>
+
+Do not modify postinst/postrm scripts.
+
+=item B<-X>I<item>, B<--exclude=>I<item>
+
+Exclude files that contain "item" anywhere in their filename or directory
+from being treated as shared libraries.
+
+=back
+
+=head1 EXAMPLES
+
+ dh_makenetlibs
+
+Assuming this is a package named libfoobar1, generates a netlibs file that
+looks something like:
+ libfoobar 1 libfoobar1
+
+ dh_makenetlibs -V
+
+Assuming the current version of the package is 1.0-3, generates a netlibs
+file that looks something like:
+ libfoobar 1 libfoobar1 (>= 1.0-3)
+
+ dh_makenetlibs -V 'libfoobar1 (>= 1.0)'
+
+Generates a netlibs file that looks something like:
+ libfoobar 1 libfoobar1 (>= 1.0)
+
+=cut
+
+init();
+
+sub extraDeps {
+ my $config=$_[0].".config";
+ return undef;
+}
+
+foreach my $package ( @{ $dh{DOPACKAGES} } ) {
+ next if is_udeb($package);
+
+ my $tmp = tmpdir($package);
+
+ my %seen;
+ my $need_ldconfig = 0;
+
+ doit( "rm", "-f", "$tmp/DEBIAN/netlibs" );
+
+ # So, we look for files or links to existing files with names that
+ # match "*.so*". Matching *.so.* is not good enough because of
+ # broken crap like db3. And we only look at real files not
+ # symlinks, so we don't accidentually add netlibs data to -dev
+ # packages. This may have a few false positives, which is ok,
+ # because only if we can get a library name and a major number from
+ # objdump is anything actually added.
+ my $exclude = '';
+ if ( defined( $dh{EXCLUDE_FIND} ) && $dh{EXCLUDE_FIND} ne '' ) {
+ $exclude = "! \\( $dh{EXCLUDE_FIND} \\) ";
+ }
+ open( FIND, "find $tmp -type f \\( -name '*.dll' \\) $exclude |" );
+ while (<FIND>) {
+ chomp;
+ my ( $library, $ver, $libfile );
+ $libfile = $_;
+ my $sig = `monosn -T $_`;
+ $sig=~s/.*token is //;
+ chomp($sig);
+ my $dis = `monodis --assembly $libfile`;
+ $dis =~ m/Name:\s+(\S+)/;
+ $library = $1;
+ $dis =~ m/Version:\s+(\S+)/;
+ $ver = $1;
+
+ if ( defined( $dh{M_PARAMS} ) && $dh{M_PARAMS} ne '' ) {
+ $ver = $dh{M_PARAMS};
+ }
+
+ if ( !-d "$tmp/DEBIAN" ) {
+ doit( "install", "-d", "$tmp/DEBIAN" );
+ }
+ my $deps = $package;
+ if ( -e "debian/$package.netlibs" ) {
+ complex_doit("cat debian/$package.netlibs >$tmp/DEBIAN/netlibs");
+ }
+ else {
+
+ # Call isnative becuase it sets $dh{VERSION}
+ # as a side effect.
+ isnative($package);
+ my $version = $dh{VERSION};
+
+ # Old compatability levels include the
+ # debian revision, while new do not.
+ if ( !compat(3) ) {
+
+ # Remove debian version, if any.
+ $version =~ s/-[^-]+$//;
+ }
+ $deps = "$package (>= $version)";
+ if ( defined($library)
+ && defined($ver)
+ && defined($deps)
+ && $library ne ''
+ && $ver ne ''
+ && $deps ne '' )
+ {
+
+ # Prevent duplicate lines from entering the file.
+ my $line = "$library $ver"."__$sig $deps";
+ if ( my $extra = extraDeps ($libfile) ) {
+ $line .= ", $extra";
+ }
+ if ( !$seen{$line} ) {
+ $seen{$line} = 1;
+ complex_doit("echo '$line' >>$tmp/DEBIAN/netlibs");
+ }
+ }
+ }
+ }
+ close FIND;
+
+ if ( -e "$tmp/DEBIAN/netlibs" ) {
+ doit( "chmod", 644, "$tmp/DEBIAN/netlibs" );
+ doit( "chown", "0:0", "$tmp/DEBIAN/netlibs" );
+ }
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Joey Hess <joeyh@debian.org>
+
+=cut
+
Property changes on: mono/trunk/debian/dh_makenetlibs
___________________________________________________________________
Name: svn:executable
+ *
Copied: mono/trunk/debian/dh_netdeps (from rev 948, mono/trunk/debian/dh_dotnetdeps)
===================================================================
--- mono/trunk/debian/dh_dotnetdeps 2004-06-12 08:18:36 UTC (rev 948)
+++ mono/trunk/debian/dh_netdeps 2004-06-12 14:22:32 UTC (rev 951)
@@ -0,0 +1,251 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_netdeps - calculates .NET dependencies
+
+=cut
+
+use strict;
+use File::Find;
+use Debian::Debhelper::Dh_Lib;
+
+#eval 'use Debian::Debhelper::Dh_Lib';
+#print "You need to install the debhelper package in order to use this program!" if $@;
+
+=head1 SYNOPSIS
+
+FIXME: document debian/mono.local, document the usage
+
+B<dh_python> [S<I<debhelper options>>] [B<-n>] [B<-V> I<version>] [S<I<module dirs ...>>]
+
+=head1 DESCRIPTION
+
+dh_python is a debhelper program that is responsible for generating the
+${python:Depends} substitutions and adding them to substvars files. It
+will also add a postinst and a prerm script if required.
+
+The program will look at python scripts and modules in your package, and
+will use this information to generate a dependency on python, with the
+current major version, or on pythonX.Y if your scripts or modules need a
+specific python version. The dependency will be substituted into your
+package's control file wherever you place the token "${python:Depends}".
+
+If some modules need to be byte-compiled at install time, appropriate
+postinst and prerm scripts will be generated. If already byte-compiled
+modules are found, they are removed.
+
+If you use this program, your package should build-depend on python.
+
+=head1 OPTIONS
+
+=over 4
+
+=item I<module dirs>
+
+If your package installs python modules in non-standard directories, you
+can make dh_python check those directories by passing their names on the
+command line. By default, it will check /usr/lib/site-python,
+/usr/lib/$PACKAGE, /usr/share/$PACKAGE, /usr/lib/games/$PACKAGE,
+/usr/share/games/$PACKAGE and /usr/lib/python?.?/site-packages.
+
+Note: only /usr/lib/site-python, /usr/lib/python?.?/site-packages and the
+extra names on the command line are searched for binary (.so) modules.
+
+=item B<-V> I<version>
+
+If the .py files your package ships are meant to be used by a specific
+pythonX.Y version, you can set this option with the desired X.Y python
+version.
+Do not use if you ship modules in /usr/lib/site-python.
+
+=item B<-n>, B<--noscripts>
+
+Do not modify postinst/postrm scripts.
+
+=back
+
+=head1 CONFORMS TO
+
+Debian policy, version 3.5.7
+
+Python policy, version 0.3.7
+
+=cut
+
+init();
+
+my $cli = '/usr/bin/cli';
+
+# The current python major version
+# my $python_major;
+my $mono_version = `$cli -V 2>&1`;
+
+if ( !-x "/usr/bin/monodis" ) {
+ error(
+"Package mono-utils is not installed, aborting. (Probably forgot to Build-Depend on mono-utils.)"
+ );
+}
+
+if ( system "grep \"Build-Dep.*mono-utils\" debian/control" ) {
+ print "Warning: no Build-Depends on mono-utils!\n";
+}
+
+if ( !defined $mono_version || $mono_version eq "" ) {
+ error( "Mono is not installed, aborting. (Probably forgot to
+ Build-Depend on cli-virtual-machine.)"
+ );
+}
+elsif ( $mono_version =~ /(mint|version)\ ([\d\.]+)/ ) {
+ $mono_version = "$2";
+}
+else {
+ error("Unable to parse Mono version out of \"$mono_version\".");
+}
+
+# The next python version
+#my $python_nextversion = $python_version + 0.1;
+#my $python_nextmajor = $python_major + 1;
+#
+#my @python_allversions = ('1.5','2.1','2.2','2.3');
+#foreach (@python_allversions) {
+# s/^/python/;
+#}
+
+# Check for -V
+my $usemono = $mono_version;
+if ( $dh{V_FLAG_SET} ) {
+ $usemono = $dh{V_FLAG};
+}
+
+# Cleaning the paths given on the command line
+foreach (@ARGV) {
+ s#/$##;
+ s#^/##;
+}
+
+my $fh;
+my %libdata;
+open( $fh, "cat /var/lib/dpkg/info/*.netlibs debian/*.netlibs 2>/dev/null |" );
+while (<$fh>) {
+ /(\S+)\s+(\S+)\s+(\S+)/;
+ $libdata{"$1/$2"} = $3;
+}
+
+#print (values %libdata);
+#exit 1;
+
+foreach my $package ( @{ $dh{DOPACKAGES} } ) {
+ my $tmp = tmpdir($package);
+ my %deps;
+ my %depkgs;
+
+ delsubstvar( $package, "net:Depends" ); # for idempotency
+
+ # find binaries
+ # total falsch hier
+ find sub {
+ my $vers;
+ return unless -f and /\.(exe|dll)$/;
+ local *F;
+ return unless open F, "monodis --assemblyref $_|";
+ our( $vers, $name, $key );
+ while (<F>) {
+ $vers = $1 if /Version=(.*)\n/;
+ $name = $1 if /Name=(.*)\n/;
+
+ if (/0x\S+:.([ABCDEF0123456789 ]+)\n/) {
+ $key = $1;
+ $key =~ s/\ //g;
+ $key = $vers . "__" . lc($key);
+ my $compat = "$name/$key";
+ if(!defined($libdata{$compat})) {
+ print "Warning: no Debian dependency data for $name ($key)!\n";
+ }
+ else {
+ $depkgs{$libdata{$compat}} = 1;
+ }
+ #print "ok, ".$deps{ "$name/$vers" . "__" . lc($key) };
+ }
+ }
+ close F;
+ }, $tmp;
+
+ print( keys %depkgs );
+ exit 1;
+
+ # we have a list of DLLs in %libs keys
+
+ # my %libs;
+ # if (%libs) {
+ # my %libsLoc; # custom dll-to-pkgname map
+ # my %minvLoc; # custom pkgname-to-min-version map
+ # # first create reserve lists from mono.local
+ # if(-r "debian/monolibs.local") {
+ # my $l;
+ # open($l, "<debian/monolibs.local");
+ # while(<$l>) {
+ # # syntax:
+ # # foobar.dll package-name
+ # # optional with minimal/maximal version:
+ # # package-name: (<= any-version-string)
+ # # set 0 as version string to not match at a spec. version
+ # if(/^(.+).dll\s(\S+)/) { $libsLoc{$1}=$2; }
+ # if(/^[^:]+:\s*(.+)\n/) { $minvLoc{$1}=$2; }
+ # }
+ # }
+ #
+ # # fill %deps with pkg names as keys
+ # foreach my $lib (keys %libs) {
+ # my $kand = $libsLoc{$lib}; # resolve via local map
+## $kand = `dlocate -e /usr/lib/$lib.dll || dpkg -S /usr/lib/$lib.dll`
+ # $kand = `dpkg -S /usr/lib/$lib.dll` unless $kand;
+## $kand = `dlocate -e $lib.dll | grep /usr/share/dotnet` unless $kand;
+ # $kand = `dpkg -S $lib.dll | grep /usr/share/dotnet` unless $kand;
+ # $kand =~ s/:.*//;
+ # if($kand) {
+ # # we also don't want to have circular deps to this package
+ # $deps{$kand} = 1 if($kand ne $package);
+ # }
+ # else {
+# print "Warning, $lib.dll not found on this system or in debian/mono.local!\n";
+ # }
+ # }
+
+ # some overrides
+ # $minvLoc{"mono-jit"} = ">= 0.29";
+
+ # preset the cli dep
+
+ addsubstvar( $package, "net:Depends",
+ "mono-jit (>> 0.29) | cli-virtual-machine" );
+
+ # # finaly resolve the version and add it to substvars
+ # foreach my $pkg (keys %deps) {
+ # my $version = $minvLoc{$pkg};
+ # $version =~ s#[\(\)]##g if $version;
+ # if(!$version && `dpkg -s $pkg` =~ /^Version:\s*(\S+)/m) {
+ # $version = ">= $1";
+ # # FIXME add an option to match the exact versions
+ # # match only the upstream version
+ # if(!0) {
+ # $version =~ s/-[^-]+$//;
+ # $version =~ s/=/>/;
+ # }
+ # }
+ # addsubstvar($package, "net:Depends", $pkg, $version);
+ # }
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program may be a part of debhelper or mono-utils.
+
+=head1 AUTHOR
+
+Eduard Bloch <blade@debian.org>, partialy based on code from Brendan O'Dea <bod@debian.org>.
+
+=cut
+