Dear Fink developers,

For some time, I've wanted to have a way to validate that packages are
using the BuildDependsOnly field correctly.  The test I want to employ
is this: if the package installs anything into /sw/include, it should
be declaring BuildDependsOnly to be true.  (This doesn't guarantee that
the dylib symlinks have been put into the correct place, but it does
guard against someone overlooking the need to declare BuildDependsOnly
in a -dev splitoff.)

Now this is a bit tricky: we need to do the validation on the .deb file
in order to see if anything was installed into /sw/include, but the 
BuildDependsOnly declaration is in the .info file.  And there is no way
to track which .info file was used to create a .deb file.

One thing we might do is to gzip the .info file and put it into the .deb.
That seems like overkill for the moment, so I propose a different strategy.

For each package, at build time I'll touch one of the following two files
(after creating the appropriate directory):
  /sw/share/BuildDependsOnly/true/%n
or
 /sw/share/BuildDependsOnly/false/%n

It's then pretty easy to do the validation just by examining the contents
of the .deb.

There is a drawback: when we implement this, any .deb's built after the
change will be different than .deb's built before the change.  On the
other hand, I've written the validation code so that it won't complain
about older .deb's, so this shouldn't really be a problem.

Any comments?  Is this too quick-and-dirty?  (The alternative would be
to do something like store %n.info.gz in the .deb file, accessible via
"ar", but as I said above, that strikes me as overkill at the moment.)

  -- Dave

P.S. Here's a possible implementation:


--- PkgVersion.pm.orig  Sat May  8 13:40:32 2004
+++ PkgVersion.pm       Sun May 30 10:34:30 2004
@@ -1843,6 +1843,16 @@
                }
        }
 
+       # generate commands to record the BuildDependsOnly status
+       $install_script .= "\n/usr/bin/install -d -m 755 %i/share/BuildDependsOnly";
+       if ($self->param_boolean("BuildDependsOnly")) {
+               $install_script .= "\n/usr/bin/install -d -m 755 
%i/share/BuildDependsOnly/true";
+               $install_script .= "\n/usr/bin/touch 
%i/share/BuildDependsOnly/true/%n";
+       } else {
+               $install_script .= "\n/usr/bin/install -d -m 755 
%i/share/BuildDependsOnly/false";
+               $install_script .= "\n/usr/bin/touch 
%i/share/BuildDependsOnly/false/%n";
+       }
+
        $install_script .= "\n/bin/rm -f %i/info/dir %i/info/dir.old %i/share/info/dir 
%i/share/info/dir.old";
 
        ### install

--- Validation.pm.orig  Tue Apr 27 17:51:56 2004
+++ Validation.pm       Sun May 30 11:15:07 2004
@@ -696,6 +696,8 @@
 #     - installation of .elc files
 #     - (it's now OK to install files directly into
 #        /sw/share/emacs/site-lisp, so we no longer check for this)
+# - BuildDependsOnly: if package stores files in /sw/include, it should
+#     declare BuildDependsOnly true
 # - ideas?
 #
 sub validate_dpkg_file {
@@ -708,6 +710,8 @@
        my ($pid, $bad_dir);
        my $filename;
        my $looks_good = 1;
+       my $BDO_false = 0;
+       my $installed_headers = 0;
 
        print "Validating .deb file $dpkg_filename...\n";
        
@@ -734,6 +738,10 @@
                                        ($dpkg_filename =~ /xemacs/)))) {
                                $looks_good = 0;
                                print "Warning: Compiled .elc file installed. Package 
should install .el files, and provide a 
/sw/lib/emacsen-common/packages/install/<package> script that byte compiles them for 
each installed Emacs flavour.\n  Offending file: $1\n";
+                       } elsif ( $filename =~/^$basepath\/include/ ) {
+                               $installed_headers = 1;
+                       } elsif ( $filename 
=~/^$basepath\/share\/BuildDependsOnly\/false/ ) {
+                               $BDO_false = 1;
                        } else {
                                foreach $bad_dir (@bad_dirs) {
                                        # Directory from this list are not allowed to 
exist in the .deb.
@@ -750,6 +758,10 @@
        }
        close(DPKG_CONTENTS) or die "Error on close: $!\n";
        
+       if ($installed_headers and $BDO_false) {
+               print "Warning: Headers installed in $basepath/include but package 
does not declare BuildDependsOnly to be true\n";
+       }
+
        if ($looks_good and Fink::Config::verbosity_level() == 3) {
                print "Package looks good!\n";
        }


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to