[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The difficulty or ease of packaging Perl/Python/Ruby/PHP applications



>>>>> On Mon, 4 Feb 2008 16:29:18 -0200, "Martín Ferrari" <martin.ferrari@gmail.com> said:

  > On Jan 23, 2008 5:18 PM, Martín Ferrari <martin.ferrari@gmail.com> wrote:
 >> Today, we're using /modules/02packages.details.txt.gz to get a list of
 >> distributions with their current versions. That doesn't include
 >> experimental releases, of course.

  > Today I found a problem with this approach, ironically concerning a
  > package written by Gabor:

Thanks for bringing this up. Gabor Egressy, could you please comment?

  > $ zgrep 'Text-Format[^a-zA-Z-]' 02packages.details.txt.gz
  > Text::Format                       0.52  G/GA/GABOR/Text-Format0.52.tar.gz
  > Text::NWrap                        0.11
  > G/GA/GABOR/Text-Format0.52+NWrap0.11.tar.gz

This looks extremely ugly and counter common practice. Indeed both
tarballs contain Text::Format and he who installs the latter
overwrites the former. Why is this so, Gabor? Cannot the two packages
live in peace each in their own tarball?

  > As I cannot know which module name to look for, I parse the filenames
  > with CPAN::DistnameInfo to extract dist name and version.

This is wrong. The filename can contain anything. The middle column
tells you which version of a package is in the tarball.

  > And the above two files map to the same distribution, so I have to
  > decide which one is newer, and the wrong one gets selected.

Of course, both are wrong because they are in conflict. We usually do
not allow two packages to contain the same file. But it is not
enforced, it is common practice.

  > I don't know how CPAN sorts versions (if it does at all, I suspect
  > that latest version is date-sorted and not version-sorted), so I
  > use debian sorting, and 0.52+foo is bigger than 0.52.

There are four different sorting algorithms: version.pm,
CPAN::Version, Sort::Version, Perl::Version. The first one is
designated to be the standard sorting method. Not every place has yet
adopted this standard because it is new in 5.10 and it needs a lot of
time and energy to determine the conflicts arising from a switch. The
second is currently used in CPAN.pm. The other two are folklore with
their own merits. In the CPAN.pm distribution you find test cases in
t/10version.t that demonstrate their subtle differences.

Your advantage is that you usually do not need do the sorting yourself
because the middle column of 02packages.details.txt.gz is what you can
take for granted. Erm, except where you can't.

Whenever you can't it's time to write a bugreport to rt.cpan.org. When
people upload 1.10 after 1.9 they get an automated email from the
indexer that they have a decreasing version number. But many ignore
these mails and so users need to file bug reports, boycott the new
files, patch them downstream, whatever.

-- 
andreas


Reply to: