tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposed fix for long-standing +CONTENTS bug



* On 2020-04-22 at 12:10 BST, Jonathan Perkin wrote:

> * On 2020-04-22 at 12:01 BST, Jonathan Perkin wrote:
> 
> > Doing something like trying to match for the non-PKGNAME part of a
> > pattern feels like it could be pretty fragile.  For now my best idea
> > is for pkg_add to re-arrange its command line arguments to ensure that
> > packages are upgraded in dependency order, as either putting vim-share
> > last or removing it completely as I mentioned will avoid the problem,
> > but if anyone has any better ideas...
> 
> Oh, I see mk/pkgformat/pkg/replace.mk just kludges the +CONTENTS
> files.  I thought about that but it feels wrong to me, but maybe it's
> the best (only?) option for pkg_install to do the same?

Sorry for the monologue, I think the way I'm going to fix it for my
use-case (binary package upgrades with pkgin) is along the lines of:

 * Adding a new pkg_add flag "-i" to ignore dependency errors, the
   "fulfilled" warning message will still be printed, but the exit
   status will be 0 and no "package addition failed" message will be
   printed, so pkgin will consider the command a success even if the
   package was not upgraded.

 * Switch pkgin to use "pkg_add -iU" instead of "pkg_add -DU"

pkgin will always complete a full refresh and upgrade of packages, so
this should in theory work out (if vim-share comes before vim-gtk2 in
the list of packages to upgrade, then it will be ignored, before
vim-gtk2 later ensures it is upgraded correctly).

Currently it already works if I just change it to -U, it's just that
pkgin will report the operation as having failed due to that line in
the log:

  $ pkg_info | grep vim
  vim-share-8.1.2200  Data files for the vim editor (vi clone)
  vim-gtk2-8.1.2200   Vim editor (vi clone) with X11 GTK2 GUI

  $ pkgin ug
  [...]
  24 packages to upgrade:
    vim-share-8.2.0303 sqlite3-3.31.1nb1 vim-gtk2-8.2.0303nb3 ...
  [...]
  upgrading vim-share-8.2.0303...
  upgrading vim-gtk2-8.2.0303nb3...
  [...]
  pkg_install warnings: 0, errors: 1
  pkg_install error log can be found in /var/db/pkgin/pkg_install-err.log

  $ grep pkg_add /var/db/pkgin/pkg_install-err.log
  pkg_add: Dependency of vim-gtk2-8.1.2200 fulfilled by vim-share-8.1.2200, but not by vim-share-8.2.0303
  pkg_add: 1 package addition failed

  $ pkg_info
  vim-gtk2-8.2.0303nb3 Vim editor (vi clone) with X11 GTK2 GUI
  vim-share-8.2.0303  Data files for the vim editor (vi clone)

  $ cat /opt/local/pkg/vim-share-8.2.0303/+REQUIRED_BY 
  vim-gtk2-8.2.0303nb3

  $ pkgin ug
  nothing to do.

I don't like the thought of munging the pkgdb, so this way is cleaner
for me, but I realise it's somewhat specific to the pkgin use-case.

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com


Home | Main Index | Thread Index | Old Index