pause icon indicating copy to clipboard operation
pause copied to clipboard

Secondary packages in a file do not get the right VERSION in 02packages.details.txt

Open toddr opened this issue 3 years ago • 9 comments
trafficstars

I'm providing one example but from what I can tell, there are more.

zcat /root/.cpanpkgr/cache/02packages.details.txt.gz |grep UI::ContainerWidget
3:18 PM 
Curses::UI::ContainerWidget        1.12  M/MD/MDXI/Curses-UI-0.9609.tar.gz

but, when I look at the file Curses/UI/Widget.pm, I see:

package Curses::UI::Widget;
 
use strict;
use Carp qw(confess);
use Term::ReadKey;
use Curses;
use Curses::UI::Common;
require Exporter;
 
use vars qw(
    $VERSION 
    @ISA 
    @EXPORT
);
 
$VERSION = '1.12';

...

package Curses::UI::ContainerWidget;
 
# Not special at all. This class is especially used as a flag for
# container based widgets, so that we can detect these using
# $object->isa('Curses::UI::ContainerWidget').
 
use Curses::UI::Container;
use Curses::UI::Widget;
use vars qw(
    @ISA 
    $VERSION
);
 
$VERSION = '1.10';

At a glance, it looks like the version at the top of the file is being applied to all packages found in the file?

toddr avatar Jun 29 '22 20:06 toddr

PAUSE only ever tries to find the first version number in a file. ExtUtils::MakeMaker has the same behavior. Parse::PMFile as well.

haarg avatar Jul 01 '22 10:07 haarg

Are you saying this is intentional? Or the status quo?

toddr avatar Jul 01 '22 14:07 toddr

Secondary packages should not be in the PAUSE index because they cannot be declared separately. Therefore there is no reason to have a separate $VERSION for them. They should be declared like this so they are not indexed:

package # hide from PAUSE
  Foo::Bar;

karenetheridge avatar Jul 02 '22 00:07 karenetheridge

I would guess you meant "they cannot be required separately"

Grinnz avatar Jul 02 '22 02:07 Grinnz

yes, indeed :)

karenetheridge avatar Jul 02 '22 03:07 karenetheridge

How does the fact that you cannot directly require a secondary package imply that your code cannot need a particular version of that package?

ap avatar Jul 02 '22 11:07 ap

If you attempted to declare a dependency on a secondary package like this, even if it was in the PAUSE index, installers wouldn't be able to find the current installed version. Even if listed in provides metadata, that metadata is not installed by CPAN.pm, and can't be used to determine the installed versions of modules.

haarg avatar Jul 02 '22 12:07 haarg

Restating my original concern:

The issue I'm reporting on is the fact that 02packages.details.txt lists Curses::UI::ContainerWidget 1.12. I could go 2 ways with this and am ok with either outcome.

  1. Secondary packages in a pm file (especially if it doesn't correspond to the file name) should not be listed in 02packages.details.txt This means I don't have to do indexing or worry about it in my code. I am generating RPM/DEBs and I do actually advertise secondary modules (for good or for bad).

  2. Secondary packages should be listed in which case, I would prefer that the VERSION listed for the package be what was declared in the package.

toddr avatar Jul 07 '22 13:07 toddr

Any packages declared and not hidden from PAUSE need to be indexed and assigned permissions accordingly. So they will be listed, the only issue is the version. It's weird, but as mentioned it's not practically of any use to have a differing version anyway.

Grinnz avatar Jul 07 '22 19:07 Grinnz

This is a duplicate of #170, which was raised in 2015 by @kentfredric.

neilb avatar Apr 28 '23 11:04 neilb

Close as dupe.

rjbs avatar Apr 28 '23 12:04 rjbs