pkg repo problem when old stale packages present

Bengt Ahlgren bengta at sics.se
Fri Nov 1 17:33:23 UTC 2013


According to the pkg-repo man page:

   ...only the most recent package for each origin is included in the
   catalogue.

That sounded good, so I happily went along and updated my packages with
portmaster -g, and then rebuilt the pkg-repo directly in
/usr/ports/packages without removing the old versions of the packages.
I did so for a while, at least five times.

But this seems to not work properly.  As a simple test I put three
versions of the portmaster package in a directory and ran pkg repo:

[bga at ivy /storage/bga/repotest]$ ls -l All
total 160
drwxr-xr-x  2 bga  bga    512 Nov  1 17:06 ./
drwxr-xr-x  3 bga  bga    512 Nov  1 17:06 ../
-rw-r--r--  1 bga  bga  42688 Nov  1 17:04 portmaster-3.16.txz
-rw-r--r--  1 bga  bga  42776 Nov  1 17:04 portmaster-3.17.1.txz
-rw-r--r--  1 bga  bga  42768 Nov  1 17:04 portmaster-3.17.txz
[bga at ivy /storage/bga/repotest]$ pkg repo .
Generating repository catalog in .: |pkg: duplicate package origin: package All/portmaster-3.17.txz is not newer than version 3.17.1 already in repo for origin ports-mgmt/portmaster                                                          /pkg: duplicate package origin: package All/portmaster-3.16.txz is not newer than version 3.17.1 already in repo for origin ports-mgmt/portmaster
cannot create repository catalogue
[bga at ivy /storage/bga/repotest]$ ls -l
total 56
drwxr-xr-x  3 bga  bga    512 Nov  1 17:06 ./
drwxr-xr-x  7 bga  bga    512 Nov  1 17:04 ../
drwxr-xr-x  2 bga  bga    512 Nov  1 17:06 All/
-rw-r--r--  1 bga  bga      0 Nov  1 17:06 digests
-rw-r--r--  1 bga  bga   6085 Nov  1 17:06 packagesite.yaml
-rw-r--r--  1 bga  bga  22528 Nov  1 17:06 repo.sqlite

The first two messages are correct - 3.17.1 is the newest, but then it
fails with "cannot create repository catalogue".  packagesite.yaml has
info for all three versions, which does not seem correct, or?

Looking into the code a bit, there might be an issue with the return
code from pkg_create_repo which might be EPKG_END, if the last package
it tried was an old version.  exec_repo in pkg/repo.c might need to
check for EPKG_END too?

Bengt


More information about the freebsd-pkg mailing list