'pkg version -I index' ignores index argument

John Marshall john.marshall at riverwillow.com.au
Sat Feb 15 10:28:19 UTC 2014


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:
> 
> usage: pkg_version [-hIoqv] [-l limchar] [-L limchar] [[-X] -s string]
>                    [-O origin] [index]
>        pkg_version -t v1 v2
>        pkg_version -T name pattern
> 
> Usage: pkg version [-IPR] [-hoqvU] [-l limchar] [-L limchar] [-egix pattern]
>                    [-r reponame] [-O origin] [index]
>        pkg version -t <version1> <version2>
>        pkg version -T <pkgname> <pattern>
> 
> 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.
> 
> I have submitted a PR (ports/186671) in which I provide a patch to
> pkg/version.c to rectify this problem.  The patch:
> 
>  - removes the requirement for /usr/ports when using an index (-I)
> 
>  - 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

-- 
John Marshall
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20140215/f48e25c2/attachment.sig>


More information about the freebsd-ports mailing list