Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 2014 21:28:13 +1100
From:      John Marshall <john.marshall@riverwillow.com.au>
To:        freebsd-ports@freebsd.org
Subject:   Re: 'pkg version -I index' ignores index argument
Message-ID:  <20140215102813.GB34708@rwpc15.gfn.riverwillow.net.au>
In-Reply-To: <20140213203038.GA30069@rwpc15.gfn.riverwillow.net.au>
References:  <20140213203038.GA30069@rwpc15.gfn.riverwillow.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help

--E39vaYmALEf/7YXx
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, 14 Feb 2014, 07:30 +1100, John Marshall wrote:
> Prompted by the recent EOL announcement and the very loud pkg_install
> warning, I recently migrated about a dozen systems to pkgng.  So far the
> only thing I've tripped over is the pkg-version(8) tool ignoring its
> index argument.  The tool appears to do a good job of maintaining
> backwards compatibility with its venerable predecessor:
>=20
> usage: pkg_version [-hIoqv] [-l limchar] [-L limchar] [[-X] -s string]
>                    [-O origin] [index]
>        pkg_version -t v1 v2
>        pkg_version -T name pattern
>=20
> Usage: pkg version [-IPR] [-hoqvU] [-l limchar] [-L limchar] [-egix patte=
rn]
>                    [-r reponame] [-O origin] [index]
>        pkg version -t <version1> <version2>
>        pkg version -T <pkgname> <pattern>
>=20
> but the new tool completely ignores its optional [index] argument and,
> if I request use of an INDEX via -I, it will only work if there is an
> INDEX file in the ports tree directory.  A missing ports tree directory
> is also a fatal error.
>=20
> I have submitted a PR (ports/186671) in which I provide a patch to
> pkg/version.c to rectify this problem.  The patch:
>=20
>  - removes the requirement for /usr/ports when using an index (-I)
>=20
>  - reads and uses the optional index file argument which, if present,
>    will supersede the default file in /usr/ports.

That worked fine with the '-I' option.  I discovered, after the Friday
night periodic weekly jobs had run, that the new weekly 400.status-pkg
job didn't give me the expected result.  It turns out that this job
passes the index file argument without setting -I.  The original
pkg_install version of this weekly periodic job does the same thing but
it would use the index in the absence of a ports tree.

I checked the old pkg_version code and saw that it uses the index
argument (with no -I option) as a fallback if it cannot find a ports
tree.  I have updated the PR (ports/186671) with a new patch for
pkg/version.c to restore this functionality.  With the new patch, the
version source selection precedence, if not overridden by any of (-IPR),
is as follows:

 - use ports tree if present
 - fall back to index if index argument is present and file readable
 - fall back to remote repository

--=20
John Marshall

--E39vaYmALEf/7YXx
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iEYEARECAAYFAlL/QT0ACgkQw/tAaKKahKKMUwCgzjMJd3QSs+sscFMDVNFFwsRd
+/kAn0LsGrwYmm/MIUweyna/kZyXfIni
=4JCh
-----END PGP SIGNATURE-----

--E39vaYmALEf/7YXx--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140215102813.GB34708>