Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Oct 2016 08:49:06 +0100
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-ports@freebsd.org
Subject:   Re: private ports and pkgs versioning
Message-ID:  <ed1e5d26-3a0f-3889-665f-5e32dc708c7f@FreeBSD.org>
In-Reply-To: <1cba6ef9-89af-c3b8-48df-0cbdc8499b6c@freebsd.org>
References:  <1cba6ef9-89af-c3b8-48df-0cbdc8499b6c@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--J9qhpPBKcgig5GLkcTLI3OdQxhnJ8SSve
Content-Type: multipart/mixed; boundary="RMicARUG3A8jDhjllnuvtidrEWBt8FI1D";
 protected-headers="v1"
From: Matthew Seaman <matthew@FreeBSD.org>
To: freebsd-ports@freebsd.org
Message-ID: <ed1e5d26-3a0f-3889-665f-5e32dc708c7f@FreeBSD.org>
Subject: Re: private ports and pkgs versioning
References: <1cba6ef9-89af-c3b8-48df-0cbdc8499b6c@freebsd.org>
In-Reply-To: <1cba6ef9-89af-c3b8-48df-0cbdc8499b6c@freebsd.org>

--RMicARUG3A8jDhjllnuvtidrEWBt8FI1D
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On 18/10/2016 06:58, Julian Elischer wrote:
> Is there a standard way of naming a pkg that is locally compiled (maybe=

> with a different set of options, or a local patch) so that it doesn't
> get confused with generic ports that are from freeBSD.org?

If you're not making local changes to the port, it's usual that you'ld
just call your locally compiled package the same as the generic ports.

If you're creating a new local port, or a variant on one of the standard
ports, then you should use a distinct name.  Using PKGNAMEPREFIX is
probably the simplest way to do that, but obviously that may cause
problems where PKGNAMEPREFIX is already in use -- eg. any python or perl
or apache24 port.  Similarly there's a PKGNAMESUFFIX but similar caveats
apply.  If you go down this route, you'ld also have to chase any
dependency lines in ports you want to use that depend on your local
variant, so you might end up with a quite significantly modified ports tr=
ee.

> I want to use mostly standard pkgs but need to compile a few myself
> (this can't be an uncommon requirement).

The usual way of handling this is to build your own repo using poudriere
(or otherwise), and add this to /usr/local/etc/pkg/repos/foo.conf at
higher priority than the generic FreeBSD repos.  pkg(8) will generally
prefer packages from higher priority repos.

Note that building a repo like this with poudriere will include not just
the packages you're interested in but also all of their build- and run-
time dependencies.

> How can I name my variant pkgs so the the pkg program (and ports) can
> still know that it is a satisfactory supplier of prerequisite component=
s?
>=20
> e.g.  if a pkg wants a specific rev of libxml2 how much does it use of
> the name libxml2-2.9.2_2 ?

pkg(8) doesn't have a mechanism for only looking for one specific
version of a package -- it's always going to look for the most recent
version of any package.

You could take a local copy of the port and add a PORTEPOCH, but
otherwise freeze the port at your preferred version.  The PORTEPOCH will
automatically make your copy a higher version that what's available from
the general ports tree, so pkg(8) should prefer it.

Note that doing this will foil the mechanisms used by pkg-audit(8) to
warn you of any vulnerabilities in libxml2

> Can (should) I add stuff after the '_'?  If I do will it still recognis=
e
> my pkg file and if I do are there any rules regarding *WHAT* I can put
> there.

Package versions look like this:

    aa.aa.aa_b,c

where aa.aa.aa is the upstream version number, or derived from it.  'b'
is the PORTREVISION which is an integer and omitted if zero. 'c' is the
PORTEPOCH -- again an integer and ommitted when zero.  PORTREVISION is
reset to zero whenever the upstream version changes, but PORTEPOCH if
used is there for ever and much be monotonically increasing.  When
comparing two versions, the PORTEPOCH has the greatest significance,
then the upstream version, then the PORTREVISION.

Only the upstream version can contain non-digits -- '.' as a field
separator and single alpha characters in some fields.  The ports will
take the upstream DISTVERSION and automatically produce a PORTVERSION
modified according to these rules.  The point of this transformation is
to ensure that versions sort in a useful way.

So, for example, the lang/perl5.22 port contains:

PORTNAME=3D       perl
DISTVERSION=3D    ${PERL_VERSION}-RC4
PORTREVISION=3D   0

where:

% make -V PERL_VERSION
5.22.3

and this results in a PKGNAME of:

% pkg info -x perl5
perl5-5.22.3.r4

> lastly is there somewhere I should be looking to read all this
> information rather than pestering the mailing list?

The Porter's Handbook contains a lot of this stuff, and there is a lot
of documentation in the comments in /usr/ports/Mk/bsd.port.mk and other
Makefiles in that directory.

The rules on package version numbers are expressed in code in
pkg-version(8) -- here:

https://github.com/freebsd/pkg/blob/master/libpkg/pkg_version.c

> What I'd like to have is my own depot with something like:
>=20
> =3D=3D=3D
>=20
> libsmi-0.4.8_1.txz
> libxcb-1.11.1.txz
> libxml2-2.9.2_2-mumble.3.txz
> lsof-4.88,8.txz
> lsof-4.90.b,8.txz
> m4-1.4.17_1,1.txz
>=20
> =3D=3D=3D
>=20
> where 'mumble.3' is a locally defined addition, but all the rest of the=

> pkgs are straight from pkg.freebsd.org, (or at least compile in default=

> form).

That 2.9.2_2-mumble.3 version string doesn't play by the rules.  For a
start, the system will consider the version number to be everything
after the *last* '-' character in the pkg name, not counting any .txz or
similar suffix.  So your version here is 'mumble.3'  which is still
illegal according to the rules.

It also considered everything before the last '-' character to be the
package name so instead of 'libxml2' you've now got 'libxml2-2.9.2_2'
and that won't match properly when trying to resolve dependencies.

You'ld be better off aiming for a version like this:

   libxml2-2.9.2.m3_2.txz

which you could achieve by directly modifying PORTVERSION or DISTVERSION
in your private copy of the port.

Or add your own PORTEPOCH to get

   libxml2-2.9.2,1.txz

The former will not sort as a higher version should the upstream version
get bumped, but the latter will.  Use 'pkg version -t' to test where the
modified version would sorts in relation to the regular one.

> This "kind-of" works, but the rules of play are not defined anyhere I
> have read, so I don't know if it's going to suddenly fail one day.
>=20
> Also it's be really nice if there were a variable I could set to
> "mumble.3" so that I don't have to do a manual rename, because between
> the time that the package is made and it is renamed there is a
> 'misnamed' package sitting around acting as a potential source of
> confusion.

Yes, there is a lot of useful stuff in the ports tree to support local
ports or even whole local categories of ports.  I can't recall now how I
learned about all this stuff -- it may well have been just be a
combination of reading Makefiles and hints dropped on mailing lists.  I
cannot recall a document describing this stuff anywhere.

	Cheers,

	Matthew






--RMicARUG3A8jDhjllnuvtidrEWBt8FI1D--

--J9qhpPBKcgig5GLkcTLI3OdQxhnJ8SSve
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJ8BAEBCgBmBQJYBdP3XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NTNBNjhCOTEzQTRFNkNGM0UxRTEzMjZC
QjIzQUY1MThFMUE0MDEzAAoJELsjr1GOGkATY5YP/3OwVxPoLpXIFlxtCtPtJrRF
qo6IkdiM3fQUXyTrr8KoDJem4bbG2NbJhaK2GOc8Xu1bmT0+PtjyK0JV6G2tA1q8
gzgUSAZ6upRZ5oQ9lsibSKnHdLG6SevpaU2ENOTBsUnwmy7+3AgXyULlPAhq+mPx
Rdm1Krnx0GTB8hVeGZi/90Ot5RmjOUyU+Id/ylbip8/ITLIdOW+/lAcsmRLAIoT6
18mDSPkTNLDlbcJ9rbv+uBVp2pkmA3wmKrjUoMQQAvxF4K6IiSxPZ38sA1ZCr8y+
nXg7ev+99bc7UpwwVNKkdxeWBKc6/UySseQvtm5sWns/EguioHAFaRVawQYbc2da
+vmGt8f9cnJPlK89KVhv4DJG6xNV0ybUB4MZa+A+3AGdRJ1M8611kEWTzUNKvozx
isck0fvsGvsxJih+QMw151PpFJppBsVs7nwctvH+exh7xBtywCKohYD1YAxYOM/W
BcOE4gGXQ8defFyFslcBBhez7WC6UmqtMhsRAM+tf/fL60ixFxiyufDET2hTYbmo
/Hdw+EQSOMp2N6ZvJX65ja2nL1ua9UIgWgs+9CNDag9n89LZMCCnkC5DvKOzDEDy
zH79291V/OHVM+opLzmLZOZ07p0fprWNw0K50uXM6BRddUWJsX7ALLsDD0G/bEiv
MH31XfoaPcFfa/TVnmxg
=xuol
-----END PGP SIGNATURE-----

--J9qhpPBKcgig5GLkcTLI3OdQxhnJ8SSve--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ed1e5d26-3a0f-3889-665f-5e32dc708c7f>