# perl5 succeeds index



## r00ty (Oct 10, 2021)

Hi,

I did follow recommendations from /usr/ports/UPDATING to upgrade perl5 on 12.2. Looks like I missed something as now I'm getting following:

```
$ pkg ver -vx perl5
perl5-5.34.0                       >   succeeds index (index has 5.32.1_1)
```

Please help


----------



## Alain De Vos (Oct 10, 2021)

In my make.conf i have,

```
DEFAULT_VERSIONS+=perl=5.34
DEFAULT_VERSIONS+=perl5=5.34
```
Everything works fine.


----------



## Tieks (Oct 10, 2021)

r00ty said:


> perl5-5.34.0 > succeeds index (index has 5.32.1_1)


This means that the package you built and installed has a higher version than the one in the port index file /usr/ports/INDEX-12.db. That index file may be out of sync with the actual ports directory tree.
Compare the output of `pkg version -v` to `pkg version --ports -v`, the latter uses the actual ports tree, not the index. If it is indeed caused by the index, see portsdb() on how to re-create the index.


----------



## chrbr (Oct 10, 2021)

As far as I know re-creating the index file is quite time consuming. It should be ok to do as below.

```
cd /usr/ports
make fetchindex
```
In terms of versions the fetched index might be just slightly behind a self generated one.


----------



## SirDice (Oct 11, 2021)

Or add the `-R` option to force pkg-version(8) to compare with the remote repository.

If /usr/ports/INDEX-* exists it's going to prefer that one over the remote repository. You can add `-I`, `-P` or `-R` to force it to select a particular source.


```
The database of available packages	and versions to	compare	against	the
     installed packages	may be chosen by specifying one	of -P, -R or -I	or by
     setting VERSION_SOURCE in pkg.conf(5).  If	not specified then the ports
     index file	will be	used if	it exists (-I).	 Otherwise, should a ports
     tree exist	that will be used to compare versions (-P).  Failing either of
     those two choices,	the repository catalogue will be used (-R).
```


----------



## r00ty (Oct 22, 2021)

This is interesting

```
$ pkg version -vRx perl
Updating FreeBSD repository catalogue...
Fetching packagesite.pkg: 100%    6 MiB   6.7MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 31265 packages processed.
All repositories are up to date.
perl5-5.34.0                       >   succeeds remote (remote has 5.32.1_1)
$ pkg version -vx perl
perl5-5.34.0                       >   succeeds index (index has 5.32.1_1)
$ pkg version -v --ports -x perl
perl5-5.34.0                       =   up-to-date with port
```

I'm pretty sure I did build it from ports 

Anyways, `portsdb -Uu` did the trick, thanks guys!


----------



## r00ty (Oct 22, 2021)

Oh, so much fun. I just ran `portsnap fetch update` and getting `perl5-5.34.0                       >   succeeds index (index has 5.32.1_1)` again. Looks like `portsnap` is messing around with my index


----------



## r00ty (Oct 23, 2021)

MrSalty said:


> Mixing and matching packages and ports?


Nope. I always use ports to compile/install packages. I'm pretty sure I did `make -C /usr/ports/lang/perl5.34 install clean`

```
$ cat /usr/local/etc/pkg.conf
# System-wide configuration file for pkg(8)
# For more information on the file format and
# options please refer to the pkg.conf(5) man page

# Note: you don't need to have a pkg.conf file.  Many installations
# will work well with no pkg.conf at all or with an empty pkg.conf
# (other than comment lines).  You can also override any of these
# settings from the environment.

# Configuration options -- default values.

#PKG_DBDIR = "/var/db/pkg";
#PKG_CACHEDIR = "/var/cache/pkg";
#PORTSDIR = "/usr/ports";
#INDEXDIR = "";
#INDEXFILE = "INDEX-10";        # Autogenerated
#HANDLE_RC_SCRIPTS = false;
#DEFAULT_ALWAYS_YES = false;
#ASSUME_ALWAYS_YES = false;
#REPOS_DIR [
#    "/etc/pkg/",
#    "/usr/local/etc/pkg/repos/",
#]
#PLIST_KEYWORDS_DIR = "";
#SYSLOG = true;
#ABI = "freebsd:10:x86:64";     # Autogenerated
#DEVELOPER_MODE = false;
#VULNXML_SITE = "http://vuxml.freebsd.org/freebsd/vuln.xml.xz";
#FETCH_RETRY = 3;
#PKG_PLUGINS_DIR = "/usr/local/lib/pkg/";
#PKG_ENABLE_PLUGINS = true;
#PLUGINS [
#]
#DEBUG_SCRIPTS = false;
#PLUGINS_CONF_DIR = "/usr/local/etc/pkg/";
#PERMISSIVE = false;
#REPO_AUTOUPDATE = true;
#NAMESERVER = "";
#HTTP_USER_AGENT = "Custom_User_Manager";
#EVENT_PIPE = "";
#FETCH_TIMEOUT = 30;
#UNSET_TIMESTAMP = false;
#SSH_RESTRICT_DIR = "";
#PKG_ENV {
#}
#PKG_SSH_ARGS = "";
#DEBUG_LEVEL = 0;
#ALIAS {
#}
#CUDF_SOLVER = "";
#SAT_SOLVER = "";
#RUN_SCRIPTS = true;
#CASE_SENSITIVE_MATCH = false;
#IP_VERSION = 0

# Sample alias settings
ALIAS              : {
  all-depends: query %dn-%dv,
  annotations: info -A,
  build-depends: info -qd,
  cinfo: info -Cx,
  comment: query -i "%c",
  csearch: search -Cx,
  desc: query -i "%e",
  download: fetch,
  iinfo: info -ix,
  isearch: search -ix,
  prime-list: "query -e '%a = 0' '%n'",
  prime-origins: "query -e '%a = 0' '%o'",
  leaf: "query -e '%#r == 0' '%n-%v'",
  list: info -ql,
  noauto = "query -e '%a == 0' '%n-%v'",
  options: query -i "%n - %Ok: %Ov",
  origin: info -qo,
  provided-depends: info -qb,
  rall-depends: rquery %dn-%dv,
  raw: info -R,
  rcomment: rquery -i "%c",
  rdesc: rquery -i "%e",
  required-depends: info -qr,
  roptions: rquery -i "%n - %Ok: %Ov",
  shared-depends: info -qB,
  show: info -f -k,
  size: info -sq,
  unmaintained = "query -e '%m = \"ports@FreeBSD.org\"' '%o (%w)'",
  runmaintained = "rquery -e '%m = \"ports@FreeBSD.org\"' '%o (%w)'",
  }
```


----------



## SirDice (Oct 23, 2021)

The INDEX-* file is dependent on the `DEFAULT_VERSIONS` that are set. The index you get from portsnap(8) is built with the standard default versions. The standard default Perl version is 5.32. You've installed Perl 5.34, which means your Perl version is _newer_ than the set default. Which is what pkg-version(8) is telling you. 

If you set your default Perl version to 5.34 (as Alain De Vos showed) and rebuild the index (`make index` or `portsdb -U`), pkg-version(8) is going to show a `=` to show you your installed Perl version is the same version as the default. Unless your installed version just happened to be out of date, then it would show a `>` for obvious reasons. 

For portupgrade(8) to work properly you have to keep the INDEX-* file _and_ the INDEX.db updated _every_ time you update your ports tree. Failing to do this will cause a disconnect with the information from the index and the actual port versions.


----------



## r00ty (Oct 23, 2021)

Hey SirDice, I'm sorry I didn't fully understand your point. So you're saying it does *NOT* matter what I have in my `make.conf` since `portsnap` uses some standard default versions list? Or do you mean `portsnap` uses defaults when a corresponding record is missing in `make.conf`?

Just to be super clear, I do have `perl5=5.34` in `DEFAULT_VERSIONS`. I follow `/usr/ports/UPDATING`, so I did this step when I just started updating everything.

```
$ cat /etc/make.conf
#
# Options
#
#WITHOUT="X11"
OPTIONS_UNSET=X11
#ALLOW_UNSUPPORTED_SYSTEM=yes
#
# Compile
#
CPUTYPE?=       corei7
CFLAGS=         -O2 -fno-strict-aliasing -pipe
COPTFLAGS=      -O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing
#
#
DEFAULT_VERSIONS+= ssl=openssl perl5=5.34
```



SirDice said:


> For portupgrade(8) to work properly you have to keep the INDEX-* file _and_ the INDEX.db updated _every_ time you update your ports tree.


Umm, I thought `portsnap` does it for me


----------



## SirDice (Oct 23, 2021)

You have an order issue. I'll try to explain better.


 You update your ports tree with portsnap(8). This gives you an updated INDEX-* file. This index was generated based on the standard defaults on the server that created the portsnap(8) files you downloaded. Which means Perl is set to 5.32 as the default version. If you run pkg-version(8) it's going to show your currently installed Perl 5.34 as _newer_ than the 5.32 default. 
 You rebuild INDEX-* using `make index` or `portsdb -U`. This rebuild will create an index based on the DEFAULT_VERSIONS you have set in /etc/make.conf. Here you've set the Perl default to 5.34. Now running pkg-version(8) will compare against that updated index and will show your Perl version as being up to date.

What you need to realize is that INDEX-* depends on whatever defaults are set. The one you downloaded and updated with portsnap(8) will be based on the standard defaults, not on your _local_ DEFAULT_VERSIONS. In order to make INDEX-* fit your locally set defaults you will need to _rebuild_ it.

The thing about pkg-version(8) is the _order_ in which the version information is collected. If a /usr/ports/INDEX-* file exists it will be used. 


```
The database of available packages and versions to compare against the
     installed packages may be chosen by specifying one of -P, -R or -I or by
     setting VERSION_SOURCE in pkg.conf(5).  If not specified then the ports
     index file will be used if it exists (-I).  Otherwise, should a ports
     tree exist that will be used to compare versions (-P).  Failing either of
     those two choices, the repository catalogue will be used (-R).
```

I would tell you not to use INDEX-* but you are using portupgrade(8). That tool only works properly if INDEX.db is correct. INDEX.db is based on your current INDEX-*. So you're stuck with keeping INDEX-* and rebuilding it based on your _locally_ set DEFAULT_VERSIONS.


----------

