Subject: pkg summary file format proposal
To: None <tech-pkg@NetBSD.org>
From: Dieter Baron <dillo@danbala.tuwien.ac.at>
List: tech-pkg
Date: 02/04/2006 19:18:00
hi,

since at least three package management tools (pkg_chk, pkg_select,
the script Havard posted yesterday) need more information than a
simple listing of available packages and need a summary file to work
well with remote package repositories, I would like to suggest a
common format for such a summary file, and a way to create it.  Jeremy
proposed a format a while back, on which this proposal is based.

0) The File Name

I propose the file be called `pkg_summary.txt' and be placed in the
same directory as the binary packages themselves (the `All' directory
in the standard layout).  Since it can grow quite large, we may want
to compress it with gzip and call it `pkg_summary.txt.gz'


1) The Format

Contrary to Jeremy's proposal, I propose the format already used in
the +BUILD_INFO and +INSTALLED_INFO files: lines of the form
`VARIABLE=value'.

  To save space, I would like to change the way multi-line values are
stored (both in the summary and the +{BUILD,INSTALLED}_INFO files).
They are currently stored as multiple lines:

REQUIRES=/usr/pkg/lib/libjpeg.so.62
REQUIRES=/usr/pkg/lib/libpng.so.3

while I would like to have continuation lines start with a single tab
character:

REQUIRES=/usr/pkg/lib/libjpeg.so.62
	/usr/pkg/lib/libpng.so.3

2) The Information Contained

I propose including the following variables:

variable name	example			description
------------------------------------------------------------------------
PKGNAME		apache-1.3.34		name and version of package
PKGPATH		www/apache		package directory in pkgsrc
CATEGORIES	www			categories package is in
COMMENT		Apache HTTP server	one-line description of package
DESCRIPTION	The Apache HTTP ...	full description of package
HOMEPAGE	http://www.apache.org/	homepage of package
LICENSE					license of package, if non-OSI
CONFLICTS	hpijs-[0-9]*		dewey pattern of conflicting packages
DEPENDS		expat>=1.95.8nb2	dewey pattern of dependency
PROVIDES	/usr/pkg/lib/libfoo.so.3	included shared library
REQUIRES	/usr/pkg/lib/libexpat.so.1	needed shared library
DIGEST		RMD160:d66900250b0...	digest of binary package *)
FILE_SIZE	2792376			size of binary package

*) One line for each type of hash, of the format <HASH-TYPE>:<HASH-IN-HEX>

and maybe also:

variable name	example			description
------------------------------------------------------------------------
SIZE_PKG	1768565			installed size
OPSYS		NetBSD			OS package was compiled on
OS_VERSION	2.0.2			version OS package was compiled on
MACHINE_ARCH	i386			architecture package was compiled on
OBJECT_FMT	ELF			object format package uses

  Comments are welcome if I missed anything important or if any of
these are superfluous.


3) The Way to Create It

  For speed and ease of using existing code, I suggest adding an
option to pkg_info that will output this information about an
installed or binary package in the above format.  For lack of a better
available letter, I suggest `C' (for Cache).

  This allows easy integration of the summary information creation
into bulk builds, by running the following command at the end:

	pkg_info -C *.tgz | gzip -9 > pkg_summary.txt.gz