Update of /cvsroot/fink/dists/10.4/stable/main/finkinfo/devel
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv856

Added Files:
        fink-package-precedence.info fink-package-precedence.patch 
Log Message:
we'll be needing this for upcoming gnome migration


--- NEW FILE: fink-package-precedence.info ---
Package: fink-package-precedence
Version: 0.9
Revision: 1

BuildDepends: fink (>= 0.24.12-1)

Source: none
PatchFile: %n.patch
PatchFile-MD5: cf0b25f11b3cb9035a8ed29d49c07980
PatchScript: sed 's,@PREFIX@,%p,' < %{PatchFile} | patch -p1

CompileScript: #
InstallScript: <<
        mkdir -p %i/bin
        install -m755 fink-package-precedence %i/bin
<<

Description: Check fink masking of system libs
DescUsage: <<
fink-package-precedence [options] <list of locations>

See 'fink-package-precedence --help' for details
<<
#Homepage: 
License: GPL
Maintainer: Daniel Macks <dma...@netspace.org>

--- NEW FILE: fink-package-precedence.patch ---
diff -Nurd -x'*~' fink-package-precedence-0.9.orig/fink-package-precedence 
fink-package-precedence-0.9/fink-package-precedence
--- fink-package-precedence-0.9.orig/fink-package-precedence    1969-12-31 
19:00:00.000000000 -0500
+++ fink-package-precedence-0.9/fink-package-precedence 2010-07-01 
19:26:44.000000000 -0400
@@ -0,0 +1,281 @@
+#!/usr/bin/perl
+# -*- mode: Perl; tab-width: 4; -*-
+
+# A dirty hack by Daniel Macks
+
+use warnings;
+use strict;
+
+use File::Find;
+use Getopt::Long;
+use Cwd qw/ abs_path /;
+
+my %opts = (
+       'headers' => 1,                         # scan .h in -M dependency 
files?
+       'depfile-ext' => [],            # extensions for header-dep scan
+       'prohibit-bdep' => [],          # whine if .h supplied by these packages
+       'libs' => 1,                            # scan otool -L of compiled 
binaries?
+       'help' => 0,                            # print usage msg?
+       );
+
+GetOptions(
+       \%opts,
+       'headers!',
+       'depfile-ext=s@',
+       'prohibit-bdep=s@',
+       'libs!',
+       'help|?',
+       ) or $opts{'help'} = 1;
+if (!$opts{'headers'} && !$opts{'libs'}) {
+       # must specify at least one mode
+       $opts{'help'} = 1;
+};
+if (@{$opts{'prohibit-bdep'}}) {
+       # handle comma-separated list like multiply-passed flag
+       $opts{'prohibit-bdep'} = [ split /,/, join ',', 
@{$opts{'prohibit-bdep'}} ];
+
+       if (!$opts{'headers'}) {
+               # can't disallow bdep based on header scan if not scanning 
headers
+               $opts{'help'} = 1;
+       }
+}
+if (@{$opts{'depfile-ext'}}) {
+       # handle comma-separated list like multiply-passed flag
+       $opts{'depfile-ext'} = [ split /,/, join ',', @{$opts{'depfile-ext'}} ];
+
+       if (!$opts{'headers'}) {
+               # can't specify header depfile extensions if not scanning 
headers
+               $opts{'help'} = 1;
+       }
+} else {
+       $opts{'depfile-ext'} = ['\.Plo', '\.Po'];
+}
+if (!...@argv) {
+       # must specify at least one location
+       $opts{'help'} = 1;
+}
+if ($opts{'help'}) {
+       my $msg = <<EOMSG;
+
+Usage: $0 [options] <list of locations>
+
+Options:
+
+  --headers/--no-headers  Scan dependency files (*1) for:
+                          * Use of system headers that should be
+                            masked by fink ones (*2)
+                            (bad -I ordering or missing BuildDepends)
+                          * Fink packages that supply headers used
+                            (packages to list in BuildDepends)
+
+  --depfile-ext=<pkg>     Which files to scan for --headers scan
+                          * Defaults to {\.Plo,\.Po} if not specified
+                          * Left-truncated regex for full pathname
+                            (beware of regex-quoting and shell-quoting)
+
+  --prohibit-bdep=<pkg>   Test if --headers finds a .h that is supplied
+                          by installed fink package <pkg> (*2)
+                          (comma-separated list or multiple use of this
+                          flag is allowed)
+
+  --libs/--no-libs        Scan compiled binaries for:
+                          * System libraries that should be masked by
+                            fink ones (*2)
+                            (bad -L ordering or missing BuildDepends)
+
+  --help                  Display this help message and exit
+
+  *1 For example, generated by gcc -M flags as activated by
+     ./configure --enable-dependency-tracking
+
+  *2 error-code on exit if this condition occurs
+
+  <list of locations> can be dependency filenames, compiled-
+  binary filenames, or directories to scan for these files.
+
+EOMSG
+
+       die $msg;
+}
+# /  <-- this slash keeps emacs syntax-highlighting less confused
+
+if ($opts{'headers'}) {
+
+print "Scanning /", join( ",", @{$opts{'depfile-ext'}} ), "\$/ dependency 
files...\n";
+
+my $dep_re = '(' . join( '|', @{$opts{'depfile-ext'}} ) . ')$';
+$dep_re = qr/$dep_re/;
+
+my %deps;                                              # key=included file
+                                                               # value=first 
dependencies file where it's listed
+
+my $plo_count = 0;
+foreach my $argv (@ARGV) {
+       my $argv_abs_dir_regex;
+       if (-d $argv) {
+               $argv_abs_dir_regex = abs_path($argv);
+               $argv_abs_dir_regex = qr/^\Q$argv_abs_dir_regex\E/;
+       }
+
+find sub {
+       return unless $File::Find::name =~ /$dep_re/;   # skip files that 
aren't our dependency lists
+
+       print "\t$File::Find::name\n";
+       $plo_count++;
+       open my $plo, '<', $_ or die "Could not read $_: $!\n";
+       while ( defined ( $_ = <$plo> ) ) {
+               next if /^\s*$/;                # usually lots of blank lines
+               s/^[^:]*://;                            # only care deps; 
filename is key dependant
+               foreach (split) {
+                       next unless /^\//;              # skip continuation 
markers and
+                                                                       # 
build-dir local files
+                       next if /$argv_abs_dir_regex/; # alt format of 
build-dir local
+                       $deps{$_} = $File::Find::name if ! exists $deps{$_};
+               }
+       }
+       close $plo;
+}, $argv;
+}
+
+if (! $plo_count) {
+       die "No dependency files found.\n";
+}
+
+print "Looking for incorrect headers in ", $plo_count, " dependency 
files...\n";
+
+# regexes for headers to disallow.
+# * /usr/local is bad news!
+# * OSX or X11 files for which fink has replacements
+my $repl_regex = '^' . join '|', (
+       '/usr/local/include',
+       '/usr/include/iconv\.h',
+       '/usr/include/libxml2',
+       '/usr/include/libxslt',
+       '/usr/include/pcap',
+       '/usr/.*/ft2build\.h',
+       '/usr/.*/freetype2',
+       '/usr/.*/fontconfig',
+       '/usr/.*/expat\.h',
+       '/usr/.*/Xft',
+       '/usr/.*/cairo',
+       '/usr/.*/glitz',
+       '/usr/.*/pixman',
+       '/usr/.*/png.h',
+       '/usr/.*/pngconf.h',
+);
+$repl_regex = qr/$repl_regex/; # pre-compile (will use many times)
+my $fink_prefix = '@PREFIX@';
+my $fink_prefix_regex = qr/^\Q$fink_prefix\E/;
+
+my @fink_headers;
+
+my $bad_system = 0;
+foreach (sort keys %deps) {
+       if (/$repl_regex/) {
+               print "\t $deps{$_} uses $_\n";
+               $bad_system = 1;
+       } elsif (/$fink_prefix_regex/) {
+               push @fink_headers, $_;
+       }
+}
+if ($bad_system) {
+       die "Please fix build process to get consistent use of fink's 
headers.\n";
+}
+
+
+my %fink_pkgs;
+my @not_found;
+my $dpkg_S = "$fink_prefix/bin/dpkg -S";
+my $progress = 1;
+print "Determining fink providers of ", scalar(@fink_headers), " headers...\n";
+while (@fink_headers) {
+       # do in blocks of files using heuristic to avoid shell cmd-line limit
+       # ('dpkg -S' is expensive!)
+       my @chunk = splice @fink_headers, 0, 100;
+       print "\t$progress - ", ($progres...@chunk)-1, "\n";
+
+       open my $dpkg_S_fh, "$dpkg_S @chunk 2>&1 |" or die "Could not fork 
$dpkg_S: $!\n";
+       while (<$dpkg_S_fh>) {
+               if (/^dpkg: (.*\.)$/) {
+                       # 'dpkg: $filename not found.' but "not found" may be 
localized
+                       push @not_found, $1;
+               } elsif (/^([^:]+):/) {
+                       $fink_pkgs{$1} = 1;
+               }
+       }
+       close $dpkg_S_fh;                # or die "Error reading $dpkg_S: $! 
$?\n";
+       # must not trap close() error, since that is expected if a file is
+       # not found in dpkh -S database
+}
+
+print "Found use of headers from ", scalar(keys %fink_pkgs), " fink 
packages:\n";
+map { print "\t$_\n" } sort keys %fink_pkgs;
+if (@not_found) {
+       print "Could not determine fink package for ", scalar(@not_found), " 
headers:\n";
+       map { print "\t$_\n" } sort @not_found;
+}
+
+my @bad_bdep = grep { exists $fink_pkgs{$_} } @{$opts{'prohibit-bdep'}};
+if (@bad_bdep) {
+       print "Use of headers from prohibited installed packages:\n";
+       map { print "\t$_\n" } sort @bad_bdep;
+       die "Please fix build process to avoid seeing them.\n";
+}
+
+}
+
+if ($opts{'libs'}) {
+       my $otool = '/usr/bin/otool';
+       if (!-x $otool) {
+               die "Cannot scan binary linking without $otool\n";
+       }
+
+print "Scanning binaries for incorrect dyld linking...\n";
+
+my %deps;                                              # key=linked lib
+                                                               # value=first 
binary that links against it
+
+find sub {
+       return unless -f;
+       return if /\.class$/;
+       open my $otool_L_fh, '-|', $otool, '-L', $_ or die "Could not fork 
$otool -L $_: $!\n";
+       while ( defined ( $_ = <$otool_L_fh> ) ) {
+               next unless /^\t(.+) \(/;       # only read dyld links
+               $deps{$1} = $File::Find::name if ! exists $deps{$1};
+       }
+       close $otool_L_fh or die "Error reading $otool -L: $! $?\n";
+}, @ARGV;
+
+# regexes for libraries to disallow.
+# * /usr/local is bad news!
+# * OSX or X11 files for which fink has replacements
+my $repl_regex = '^' . join '|', (
+       '/usr/local/lib',
+       '/usr/lib/libiconv',
+       '/usr/lib/liblibxml',
+       '/usr/lib/libxslt',
+       '/usr/lib/libpcap',
+       '/usr/X11.*/libfreetype',
+       '/usr/X11.*/libfontconfig',
+       '/usr/.*/libexpat',
+       '/usr/X11.*/libXft',
+       '/usr/X11.*/libcairo',
+       '/usr/X11.*/libglitz',
+       '/usr/X11.*/libpixman',
+       '/usr/X11.*/libpng',
+);
+$repl_regex = qr/$repl_regex/; # pre-compile (will use many times)
+
+my $bad_system = 0;
+foreach (sort keys %deps) {
+       if (/$repl_regex/) {
+               print "\t $deps{$_} uses $_\n";
+               $bad_system = 1;
+       }
+}
+if ($bad_system) {
+       die "Please fix build process to get consistent use of fink's 
libraries.\n";
+}
+
+
+}


------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to