Question about fields in INDEX files

Matthew Seaman m.seaman at infracaninophile.co.uk
Sun May 6 02:40:24 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Garrett Cooper wrote:
> Hello all,
>     As part of my Google SoC project I'm taking a look at INDEX-{ver}
> and revising it to fit Berkeley DB objects combined with pkg_*, much
> like pkgdb does.
> 
>     I have a few questions about the meanings of the fields though and
> their use. I'm using net/DarwinStreamingServer as an example, because
> it's short, and contains all of the fields I could find present in all
> of the INDEX entries, and this comes from INDEX-7, not INDEX-5 or INDEX-6.
> 
> =======
> Entry:
> =======
> DarwinStreamingServer-5.5.4_1|/usr/ports/net/DarwinStreamingServer|/usr/local|Darwin
> Streaming Server, a MP3, MPEG4 and QuickTime streaming
> server|/usr/ports/net/DarwinStreamingServer/pkg-descr|nork at FreeBSD.org|net||p5-Net-SSLeay-1.30_1
> perl-5.8.8|http://developer.apple.com/darwin/projects/streaming/|||
> 
> =======
> 
> The fields are as following (separated by pipes):
> 1. [Port name (without category)]-[version][{:_revision}]
> 2. Full path to port.
> 3. Installation prefix (?)
> 4. Comment
> 5. Full path to pkg-descr file
> 6. Maintainer
> 7. Category
> 8. [unknown] -- blank field
> 9. Direct dependencies
> 10. Developer's / Project's Webpage
> 11., 12. [unknown] (x2) -- blank fields
> 
> =======
> 
> If someone can correct me on the meanings of these fields, that would be
>  fantastic. Also, if someone can help me discover the secret identities
> of some of the unknown fields (in particular the last 2 blank fields),
> that would be helpful as well. I understand that the majority of these
> lines do come from the Makefiles, but I'm not sure what additional
> fields could be involved in this.
> 
> Also, I was wondering if fields 3. and 5. are really necessary in the
> INDEX file. 3. can be user specified, or default to a particular value.
> 
> Also, 5. can be automatically assumed to {2.}/pkg-descr in all cases
> that I've seen. So, given this observation is there any real case that
> this assumption would be false?
> 
> Thanks for any and all help!
> -Garrett

Been there, done that.  Take a look at the code in Port.pm from my
FreeBSD::Portindex stuff.  Particularly the print() method:


#
# Print out one line of the INDEX file
#
sub print ($*;$)
{
    my $self     = shift;
    my $fh       = shift;
    my $allports = shift;
    my $counter  = shift;

    print $fh $self->PKGNAME(), '|';
    print $fh $self->ORIGIN(),  '|';
    print $fh $self->STUFF(),   '|';
    print $fh $self->_chase_deps( $allports, 'BUILD_DEPENDS' ), '|';
    print $fh $self->_chase_deps( $allports, 'RUN_DEPENDS' ),   '|';
    print $fh $self->WWW(), '|';
    print $fh $self->_chase_deps( $allports, 'EXTRACT_DEPENDS' ), '|';
    print $fh $self->_chase_deps( $allports, 'PATCH_DEPENDS' ),   '|';
    print $fh $self->_chase_deps( $allports, 'FETCH_DEPENDS' ),   "\n";

    counter( \%::Config, $counter );
    return $self;
}

STUFF is the amalgamation of fields 3,4,5,6,7 which you've already
identified. The PREFIX (field 3) is usually /usr/local although for
a limited time there are still a number of X11 related entries using
/usr/X11R6.  Similarly the pkg-desc (field 5) is almost always /usr/ports/<category>/<portname>/pkg-descr -- but there are a
significant number of exceptions, which are slave ports.  Eg. compare
these two INDEX entries:

% grep ^mod_jk INDEX-6  
mod_jk-1.2.21,1|/usr/ports/www/mod_jk|/usr/local|Apache JK module for connecting to Tomcat using AJP1X|/usr/ports/www/mod_jk/pkg-descr|girgen at FreeBSD.org|www|apache-1.3.37_3 expat-2.0.0_1 gettext-0.16.1_1 gmake-3.81_1 libiconv-1.9.2_2 perl-5.8.8|apache-1.3.37_3 expat-2.0.0_1 perl-5.8.8|http://tomcat.apache.org/connectors-doc/|||
mod_jk-ap2-1.2.21|/usr/ports/www/mod_jk-apache2|/usr/local|Apache2 JK module for connecting to Tomcat using AJP1X|/usr/ports/www/mod_jk-apache2/../mod_jk/pkg-descr|girgen at FreeBSD.org|www|apache-2.0.59 expat-2.0.0_1 gettext-0.16.1_1 gmake-3.81_1 libiconv-1.9.2_2 perl-5.8.8|apache-2.0.59 expat-2.0.0_1 libiconv-1.9.2_2 perl-5.8.8|http://tomcat.apache.org/connectors-doc/|||

Note that either of these fields can vary with local customization as
well -- nothing says that you've always got to keep the ports tree rooted
at /usr/ports or install everything with a prefix of /usr/local, although
if you change any of that, you're going to be building your own INDEX
anyhow.

The 5 'DEPENDS' entries in the last 6 fields consist of the output of
various FOO_DEPENDS variables from the port's Makefile processed to turn
the port origins 'editors/emacs21' into the package names 'emacs-21.3_9'

These values are then combined in various ways, ie. RUN_DEPENDS in the
Index file is the combination of the values from the $RUN_DEPENDS and
$LIB_DEPENDS variables from the Makefile, plus the accumulated sum of
the RUN_DEPENDS for each of the dependencies, and each of their
dependencies, recursively.

eg. If '$EXTRACT_DEPENDS' in the port Makefile is set to:

EXTRACT_DEPENDS= rpm2cpio.pl:${PORTSDIR}/archivers/rpm2cpio

then the EXTRACT_DEPENDS field in the Index will be set to:

perl-5.8.8 rpm2cpio-1.2_2

ie. the direct dependency rpm2cpio-1.2_2 plus all of the RUN_DEPENDS
for rpm2cpio-1.2_2, vis perl-5.8.8.  Perl doesn't have any other
RUN_DEPENDS so the expansion stops there.

	Cheers,

	Matthew

- -- 
Dr Matthew J Seaman MA, D.Phil.                       7 Priory Courtyard
                                                      Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.3 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGPaJ08Mjk52CukIwRCJ+dAJ0YEt6iNRhiWrgTTbHtQAANQ0mpNACfQwoC
JIBs3yGT0sT8vHugSJvobCY=
=C+w6
-----END PGP SIGNATURE-----


More information about the freebsd-ports mailing list