Pack_install upgrade doesn't work

pack_install(..., [upgrade(true)]) doesn’t upgrade for both rdet and logtalk.

The work-around is to find all files and directories in ~/.local with the pack name and delete them.

$ swipl -q
1 ?- pack_install(logtalk, [interactive(false), upgrade(true)]).
pack_install(logtalk, [interactive(false), upgrade(true)]).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% Pack `logtalk' is already installed @3.30.0
true.

$ rm -rf ~/.local/share/swi-prolog/pack/logtalk rm -rf ~/.local/share/swi-prolog/pack/Downloads/logtalk-*
$ swipl -q
1 ?- pack_install(logtalk, [interactive(false), upgrade(true)]).
pack_install(logtalk, [interactive(false), upgrade(true)]).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% "logtalk-3.31.0.tgz" was downloaded 2 times
Package:                logtalk
Title:                  Logtalk - Object-Oriented Logic Programming Language
Installed version:      3.31.0
Author:                 Paulo Moura <pmoura@logtalk.org>
Maintainer:             Paulo Moura <pmoura@logtalk.org>
Packager:               Paulo Moura <pmoura@logtalk.org>
Home page:              https://logtalk.org/
Download URL:           https://logtalk.org/files/swi-prolog/packs/logtalk-3.31.0.tgz
true.

Thanks for reporting. I don’t think it’s an issue in any of the packs. I looked into the pack files for Logtalk and their data seems correct. I would guess the same for the rdet pack. Maybe some issue with the recent changes to pack location?

I had previously removed all the “pack” files from /usr/lib/swi-prolog and had re-installed all my packs (which went into ~/.local/share/swi-prolog/pack).

Note that upgrade works using the wildchart URL in the pack description: it asks for the page after removing the file pattern, expecting an HTML page with links where it gets all links that match the pattern, computes the versions and compares the latest version to the installed.

When I look at the rdet pack page, I see that its URL has changed between github and rlaanemets.com … would that account for the problems with upgrading that package?

The pack.pl file doesn’t provide a download URL pattern as specified in https://www.swi-prolog.org/howto/PackInfo.html. Older version used a git download and this upgrade simply means git pull.

Fixed in the current git version for the Logtalk packs (https://github.com/LogtalkDotOrg/logtalk3/commit/f7e093e4c58520b7c8f0f78b4bb231b10ca9de09).

Still not working (for logtalk 3.30.0 -> 3.31.0):

?- pack_install(logtalk, [upgrade(true)]).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% Pack `logtalk' is already installed @3.30.0
true.

?- pack_remove(logtalk).
% Removing '/home/peter/.local/share/swi-prolog/pack/logtalk' and contents
true.

?- pack_install(logtalk, [upgrade(true)]).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
Install logtalk@3.31.0 from https://logtalk.org/files/swi-prolog/packs/logtalk-3.31.0.tgz Y/n?
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% "logtalk-3.31.0.tgz" was downloaded 5 times
Package:                logtalk
Title:                  Logtalk - Object-Oriented Logic Programming Language
Installed version:      3.31.0
Author:                 Paulo Moura <pmoura@logtalk.org>
Maintainer:             Paulo Moura <pmoura@logtalk.org>
Packager:               Paulo Moura <pmoura@logtalk.org>
Home page:              https://logtalk.org/
Download URL:           https://logtalk.org/files/swi-prolog/packs/logtalk-3.31.0.tgz
Install "logtalk-3.31.0.tgz" (17,242,461 bytes) Y/n?
true.

The fix I mentioned in in the Logtalk git version. The packs are only created for stable versions. It should work when the next Logtalk stable version (3.32.0) is released (expected in November).

But shouldn’t upgrade(true) always get a new version, regardless of what the current version is? There’s nothing displayed about stable vs non-stable version, as far as I can tell; and nothing I could find in the SWI-Prolog documentation about stable/non-stable.

The bug, as Jan mentioned, is that the existing packs contain a fixed URL for the specific version instead of the URL pattern required for the upgrade to work. My reference to “stable” was about Logtalk stable vs git (i.e. development) versions, not SWI-Prolog. I.e., rephrasing, the packs are only created for Logtalk stable versions.

Do I understand you correctly – that if the URL in the currently installed version of a package isn’t of a particular form, then upgrade won’t work? That seems to be a design bug.
(And it also means that if the package is moved to a different server, then upgrade won’t work.)

That’s my understanding from Jan’s reply, the documentation he mentioned, and from looking into the URLs of other packs.

The pack system was designed to work without a central authority. Using a URL pattern to fetch a new version allows for that. The price is indeed that you cannot migrate to another server. The central database that keep track of packs being downloaded can do so, but after some issues the rules were tightened not to allow registering a new version from a different location as well.

I think the current pack system is a bit too simple. It did prove the need for one and I guess it is time for some redesign …

1 Like