Error "pkg: unknown format pkg, using the default" from pkg during portupgrade

Every one of several dozen systems with FreeBSD 12-STABLE has been giving this warning when using portupgrade. A web search shows only one hit, and that is in an unrelated question.

Back "in the old days", a # pkgdb -F would usually be all that was needed to fix this warning. But doing that now gives:

Code:
(0:81) hostname:/sysprog/terry# pkgdb -F
pkgdb -F not supported with PKGNG yet. Use 'pkg check' directly.

man pkg-check doesn't seem to show anything relevant - it is all about fixing problems with package dependencies, not the database itself. Presumably that's the reason for the "Use 'pkg check' directly." handwave instead of specifying the actual command line needed.

Any ideas?
 
portupgrade(1) is annoying pkg when it creates the backup pkg. This is the portupgrade script source:

Code:
 backquote!(PkgDB::command(:pkg), 'create', '-o', $tmpdir, '-f', $portsdb.pkg_sufx, pkgname)

-f format, --format format
Set format as the package output format. It can be
one of tzst, txz, tbz, tgz or tar which are
currently the only supported formats. If an
invalid or no format is specified txz is assumed.

So it's a problem with the value in the variable $portsdb.pkg_sufx which I determined is "pkg" by changing the backing up message in portupgrade thus:

Code:
2081c2081
<   progress_message "Backing up the old version"
---
>   progress_message "Backing up the old version - " + $portsdb.pkg_sufx

My quick hack solution was simply to edit the script at /usr/local/sbin/portupgrade to remove '-f', $portsdb.pkg_sufx, from the two lines in which it occurs.

Code:
diff portupgrade  /usr/local/sbin/portupgrade

1080c1080
<       system!(PkgDB::command(:pkg), 'create', '-o', $packages_dir, '-f', $portsdb.pkg_sufx, pkgname)
---
>       system!(PkgDB::command(:pkg), 'create', '-o', $packages_dir, pkgname)
2087c2087
<     backquote!(PkgDB::command(:pkg), 'create', '-o', $tmpdir, '-f', $portsdb.pkg_sufx, pkgname)
---
>     backquote!(PkgDB::command(:pkg), 'create', '-o', $tmpdir, pkgname)

Caveat Utilitor: It works for me, but be warned, I have never programmed in Ruby.
 
Old thread, but thought I would add this as I remembered, I figured out a fix myself.

I added this to /usr/local/etc/pkgtools.conf.

Code:
  # pkg 1.7.0 compat, tar no compress, txz faster compress
  ENV['PKG_SUFX'] ||= '.tar'
  #ENV['PKG_NOCOMPRESS'] ||= 'yes'
  ENV['_PKG_TRANSITIONING_TO_NEW_EXT'] ||= 'yes'
  ENV['PKG_TRANSITIONING_TO_NEW_EXT'] ||= 'yes'
  ENV['PKG_COMPRESSION_FORMAT'] ||= '.tar'

However I will be using the above fix as I think that will have more longevity and is cleaner.
 
Back
Top