Bug 257406 - ports-mgmt/portupgrade: no support for .pkg
Summary: ports-mgmt/portupgrade: no support for .pkg
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-25 10:32 UTC by Helmut Ritter
Modified: 2023-04-21 13:28 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (bdrewery)


Attachments
portupgrade patch to make .pkg work (904 bytes, patch)
2023-02-01 23:42 UTC, gebhart
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Ritter 2021-07-25 10:32:58 UTC
Hi,

from https://github.com/freebsd/pkg/blob/master/NEWS:

Changes from 1.16.99.2 to 1.16.99.3
[...]
- change the package extension to .pkg (with symlink on the old format)

[helmut@BSDHelmut ~]$ sudo portupgrade -fPP mysql80-client
[Reading data from pkg(8) ... - 499 packages found - done]
--->  Checking for the latest package of 'databases/mysql80-client'
--->  Fetching the package(s) for 'mysql80-client-8.0.25_2' (databases/mysql80-client)
Updating MyRepo repository catalogue...
MyRepo repository is up to date.
All repositories are up to date.
--->  Fetching mysql80-client-8.0.25_2
[...]
New packages to be FETCHED:
        mysql80-client: 8.0.25_2 (4 MiB: 100.00% of the 4 MiB to download)

Number of packages to be fetched: 1

The process will require 4 MiB more space.
4 MiB to be downloaded.
Fetching mysql80-client-8.0.25_2.pkg: 100%    4 MiB   4.1MB/s    00:01
** Failed to fetch mysql80-client-8.0.25_2.txz
** Failed to fetch mysql80-client-8.0.25_2
** Listing the failed packages (-:ignored / *:skipped / !:failed)
        ! mysql80-client-8.0.25_2       (fetch error)
** Could not find the latest version (8.0.25_2)
** No package available: databases/mysql80-client
** Listing the failed packages (-:ignored / *:skipped / !:failed)
        ! databases/mysql80-client (mysql80-client-8.0.25_2)    (package not found)
[helmut@BSDHelmut ~]$

It downloads .pkg but then searches for .txz.
Comment 1 peter.larsen 2021-07-29 14:00:44 UTC
I found this since I was modering why my mesa-libs did not want to install my package..


pkg_fetch:
found 3 references for .txz, added .pkg in line 54, replaced txz with pkg in two other places


still no dice ;)


[Reading data from pkg(8) ... - 354 packages found - done]
--->  Checking for the latest package of 'graphics/mesa-libs'
--->  Fetching the package(s) for 'mesa-libs-21.1.5' (graphics/mesa-libs)
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
--->  Fetching mesa-libs-21.1.5
The following packages will be fetched:

New packages to be FETCHED:
	mesa-libs: 21.1.5 (258 KiB: 100.00% of the 258 KiB to download)

Number of packages to be fetched: 1

258 KiB to be downloaded.
Fetching mesa-libs-21.1.5.pkg: 100%  258 KiB 263.7kB/s    00:01    
--->  Downloaded as mesa-libs-21.1.5.pkg
--->  Identifying the package /var/tmp/portupgrade74yuLKjb/All/mesa-libs-21.1.5.pkg
--->  Saved as /usr/ports/packages/All/mesa-libs-21.1.5.pkg
** Could not find the latest version (21.1.5)
** No package available: graphics/mesa-libs
** Listing the failed packages (-:ignored / *:skipped / !:failed)
	! graphics/mesa-libs (mesa-libs-21.1.5)	(package not found)

what did I miss ?
Comment 2 peter.larsen 2021-07-31 11:45:57 UTC
this helps, but a manual rename from *.pkg to .txz is needed


I do that by (below patch is needed for it to work)

portupgrade --batch -PPF something


do the rename:
cd /usr/ports/packages/All 
for x in *.pkg; do cp "$x" "${x%.pkg}.txz"; done


install it:
portupgrade --batch -PP something





pkg_fetch diff's
# diff pkg_fetch pkg_fetch.old 
54c54
<   PKG_SUFFIXES = ['.tbz', '.txz', '.tgz', '.pkg']  
---
>   PKG_SUFFIXES = ['.tbz', '.txz', '.tgz']  
329c329
<     suffix = '.pkg'
---
>     suffix = '.txz'
368c368
<                      File.basename(uri, '.pkg'))
---
>                      File.basename(uri, '.txz'))





would be nice with a smart solution, please help  :)
Comment 3 gebhart 2023-01-25 19:26:05 UTC
The other piece of code that needs to be fixed is in portupgrade itself starting at about line 2180:

  glob_pkgfile = name + '-*.t[bgx]z'
  re_pkgfile = /^#{Regexp.quote(name)}-[^\-]+\.t[bgx]z$/

  if latest_link = $portsdb.latest_link(origin)
    glob_pkgfile = "{#{glob_pkgfile},#{latest_link}.t[bgx]z}"
    re_pkgfile = /(?:#{re_pkgfile.source}|^#Regexp.quote(latest_link)}\.t[bgx]z$)/

That makes the definition of the suffix ".pkg" obsolete in pkg_fetch.
Unfortunately I don't know ruby well enough to fix this (yet), but maybe someone else can do it.
Comment 4 gebhart 2023-02-01 23:42:44 UTC
Created attachment 239851 [details]
portupgrade patch to make .pkg work

As all other package formats are not needed anymore anyway, I simply replaced
the regexp 't[bgx]z' with 'pkg' and it works. No need to patch pkg_fetch also as described above. See patch.

It would be nice if the original package could be patched or at least my patch finds it's way into ports-mgmt/portupgrade/files .