Re: Make sure all the modules have the same version number in a distribution

2013-02-19 Thread Aristotle Pagaltzis
* Dominique Dumont domi.dum...@free.fr [2013-02-16 09:45]:
 As Perl module developer, I'm guilty as charged: I haven't found
 a practical way to change $VERSION when a file has actually changed
 :-/

Nor should you. One day I’ll write that article, one day…

-- 
*AUTOLOAD=*_;sub _{s/::([^:]*)$/print$1,(,$\/, )[defined 
wantarray]/e;chop;$_}
Just-another-Perl-hack;
#Aristotle Pagaltzis // http://plasmasturm.org/


Re: Make sure all the modules have the same version number in a distribution

2013-02-19 Thread Yanick Champoux

On 13-02-19 08:30 AM, Aristotle Pagaltzis wrote:

One day I’ll write that article, one day…


You know how they say there is no time like the present... :-)

Do it!
`/anick


Re: Make sure all the modules have the same version number in a distribution

2013-02-16 Thread Yanick Champoux

On 13-02-16 03:39 AM, Dominique Dumont wrote:

Le jeudi 10 janvier 2013 19:34:51,yan...@babyl.dyndns.org  a écrit :

 So, yeah, I've embraced the per-dist version, and
have lived happily ever after...

Well, if you look at that diff [1] provided by CPAN, knowing that only*one*
file was really changed, you'll see a big drawback of this practice.

As Debian packager or Perl modules, I also have similar issues: when I want to
evaluate the changes brought by a new version of a Perl module, debdiff will
report similar cruft.


	If the diff added the option '--ignore-matching-lines=version', 
wouldn't that take care of a huge chunk of the problem?


	... now I'm just thinking wild, wild thoughts, but did anybody at any 
time proposed to have, just like $VERSION, a $DISTRIBUTION variable 
indicating to which dist the module belongs to? With that, the version 
mechanisms could be modified to report the version of the main dist 
module if no local version is present. Mind you, this implies either 
core CPAN changes and changes of the UNIVERSAL::VERSION behavior, or 
sneaky ninja moves, so this paragraph is nothing that could happen 
anytime fast. But still, it's an idea.


Joy,
`/anick


Re: Make sure all the modules have the same version number in a distribution

2013-02-16 Thread Dominique Dumont
Le samedi 16 février 2013 17:27:10, vous avez écrit :
 ... now I'm just thinking wild, wild thoughts, but did anybody at
 any  time proposed to have, just like $VERSION, a $DISTRIBUTION variable
 indicating to which dist the module belongs to? With that, the version
 mechanisms could be modified to report the version of the main dist module
 if no local version is present. Mind you, this implies either core CPAN
 changes and changes of the UNIVERSAL::VERSION behavior, or sneaky ninja
 moves, so this paragraph is nothing that could happen anytime fast. But
 still, it's an idea.

Unfortunately, this would not solve the problem for distributions tools like 
debdiff: this tool scan Debian package source and does not use code from CPAN.

Packagers for Fedora or RedHat will have a similar problem with rpmdiff.

All the best

Dominique


signature.asc
Description: This is a digitally signed message part.


Re: Make sure all the modules have the same version number in a distribution

2013-01-15 Thread David Cantrell
On Sat, Jan 12, 2013 at 12:34:15PM +0100, Aristotle Pagaltzis wrote:

 Applying the same version to all modules within a distribution is a non-
 obvious precondition for dependency resolution to work 100% reliably in
 all edge cases. I have notes for an article about it flying around here
 somewhere that I should really get around to writing and publishing.

I'd love to know what those edge cases are, because I can't think of
any.  Yes, please write and publish!

-- 
David Cantrell | Enforcer, South London Linguistic Massive

Never attribute to malice that which can be explained by stupidity
-- Hanlon's Razor

Stupidity maintained long enough is a form of malice
-- Richard Bos's corollary


Re: Make sure all the modules have the same version number in a distribution

2013-01-15 Thread Johan Vromans
David Cantrell da...@cantrell.org.uk writes:

 I'd love to know what those edge cases are, because I can't think of
 any.

My guess is this applies to distributions that contain a number of
modules, some (most) of them not relevant to the end user since they're
internal to the distribution. If you cannot (want not) hide them, the
best thing to do is give them all the same version numbers.

-- Johan



Re: Make sure all the modules have the same version number in a distribution

2013-01-12 Thread Aristotle Pagaltzis
* Lutz Gehlen lrg...@gmx.net [2013-01-09 16:20]:
 On Tuesday, January 08, 2013 09:04:31 Gabor Szabo wrote:
  I just wanted to update a distribution and ensure that all the
  modules in a distribution have version number and they are all the
  same.

 Please excuse this digression, but would you be so kind to explain why
 you find this desirable? In my distributions, I deliberately only bump
 the version number of a module to the current value of the
 distribution when I modify the module. Like that I can easily see when
 I last modified a certain module.

Applying the same version to all modules within a distribution is a non-
obvious precondition for dependency resolution to work 100% reliably in
all edge cases. I have notes for an article about it flying around here
somewhere that I should really get around to writing and publishing.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/


Re: Make sure all the modules have the same version number in a distribution

2013-01-10 Thread Philippe Bruhat (BooK)
On Wed, Jan 09, 2013 at 08:38:55PM +0200, Gabor Szabo wrote:
 On Wed, Jan 9, 2013 at 5:17 PM, Lutz Gehlen lrg...@gmx.net wrote:
  Hi Gabor,
 
  On Tuesday, January 08, 2013 09:04:31 Gabor Szabo wrote:
  I just wanted to update a distribution and ensure that all the
  modules in a distribution have
  version number and they are all the same.
 
  Please excuse this digression, but would you be so kind to explain
  why you find this desirable? In my distributions, I deliberately
  only bump the version number of a module to the current value of the
  distribution when I modify the module. Like that I can easily see
  when I last modified a certain module.
 
 I think you strategy - updating the version numbers only when they change -
 might be better, but I am too lazy for that, and I am afraid I'll
 forget to do it.
 If you know a tool that can ensure this, I'd be happy to hear about it.

A first step, from the command-line:

V=`git describe --abbrev=0`..;git diff-tree -r $V|cut -f2|xargs -IF sh -c 
git blame $V -- F|grep -q '^[^^].*\$VERSION'echo +F||echo =F

As a git alias:

   checkversion = !f(){ V=`git describe --abbrev=0`..;git diff-tree -r $V|cut 
-f2|xargs -IF sh -c \git blame $V -- F|grep -q '^[^^].*\\$VERSION'echo 
+F||echo =F\;};f

(Adapted from http://twitter.com/clunk_eth/status/203966679091384321)

This:
- picks the closest tag from the current commit
- makes a diff of the tree between that tag and the current commit,
  to find all files modified since
- runs a git blame on each to find lines modified since the tag that
  contain '$VERSION'
- prints the filename with a + ($VERSION line modified) or an = ($VERSION
  line not modified)

 I think having the same version number is still much better than having no
 version number at all. That's why I was looking for that solution.

Dist::Zilla's VersionPkg plugin will write the distribution version in every
.pm file of the project.

-- 
 Philippe Bruhat (BooK)

 Life is a play. The secret is to know your lines, respect the other players
 and make a good exit.  (Moral from Groo The Wanderer #12 (Epic))


Re: Make sure all the modules have the same version number in a distribution

2013-01-10 Thread John M. Gamble
On Wed, January 9, 2013 9:03 pm, David Christensen wrote:

 There seems to be two competing points of view regarding version
 numbering for software source code files:

 1.  Per-file -- a unique version number for each file that increments
 when that file changes.  RCS and CVS use this approach.  They also
 provide keywords that can be embedded in files for accessing version
 control system meta-data.  For example, I use CVS and embedded it's
 $Revision$ keyword in my Perl files with the following incantation to
 set the Perl $VERSION variable:

 our $VERSION  = sprintf %d.%03d, q$Revision: 1.32 $ =~ /(\d+)/g;

 http://ximbiot.com/cvs/manual/cvs-1.12.13/cvs_12.html#SEC99

 2.  Per-set -- unique version number for a set of files that increments
 when any one of them changes (and is the same for all the files in the
 set).  I believe Subversion and Git use this approach (and Mercurial?).


Yeah, after dithering about it for a few days, I went with the philosophy
that the package has the version, not the individual modules. For the
simple reason that the package as a whole is what's being developed, from
the documentation to the scripts to the README file to, of course, the
actual modules themselves.

Hmm. I use the 'dist_version' key in my Build.PL file. Maybe I can take
Gabor's idea and update my $VERSION values automatically using Build.PL as
the starting point. This would maintain the holistic approach, and give
me a single file to update instead of worrying about every file with a
version number (which for me would be the README file and any *.pm files
under the lib directory).


 Perhaps Gabor should consider using the second type of version control
 system that allows a Perl incantation similar to the first.


Except that PAUSE (which is the primary driver of the $VERSION use) wouldn't
be able to make use of it. As far as I can tell, it loads the .pm files to
find the $VERSION number, and doesn't look at META.json at all.

 -john



Re: Make sure all the modules have the same version number in a distribution

2013-01-10 Thread yanick
On Thu, Jan 10, 2013 at 10:06:10AM -0600, John M. Gamble wrote:
 Yeah, after dithering about it for a few days, I went with the philosophy
 that the package has the version, not the individual modules. For the
 simple reason that the package as a whole is what's being developed, from
 the documentation to the scripts to the README file to, of course, the
 actual modules themselves.

For what it's worth, my own opinion goes in that direction as
well. For a long time, I was in the one version per module in the dist
camp, but then I realized, on top of the arguments given by John that:

a) In real life, I never saw any user actually care about
per-module changes (as, as mentioned above, it's the holistic dist
blob that matters).

b) and if anyone would care about what files exactly have
changes from one release to the next... well, there's the 
repositories for that (and if there is no public repositories, 
that's nothing that 'git-cpan --backpan import' can't solve)

c) it also simplify things when you want to specify versions in
use statements. Using Foo::Bar in code A, and Foo::Baz in code B? If
they are both from dist Foo and its version is 1.23, then you'll have  
consistent 'use Foo::Bar 1.23' and 'use Foo::Baz 1.23' (and although,
true, you could do 'use Foo 1.23', there are cases of main module Foo
where you wouldn't want to do that).

So, yeah, I've embraced the per-dist version, and 
have lived happily ever after... 

Now, numerical version or semantic version format... that's
an altogether more entertaining can of worms. ;-)

Throwing my 2 cents in,
`/anick

-- 


Re: Make sure all the modules have the same version number in a distribution

2013-01-09 Thread Lutz Gehlen
Hi Gabor,

On Tuesday, January 08, 2013 09:04:31 Gabor Szabo wrote:
 I just wanted to update a distribution and ensure that all the
 modules in a distribution have
 version number and they are all the same.

Please excuse this digression, but would you be so kind to explain 
why you find this desirable? In my distributions, I deliberately 
only bump the version number of a module to the current value of the 
distribution when I modify the module. Like that I can easily see 
when I last modified a certain module.

Cheers,
Lutz


Re: Make sure all the modules have the same version number in a distribution

2013-01-09 Thread Gabor Szabo
On Wed, Jan 9, 2013 at 5:17 PM, Lutz Gehlen lrg...@gmx.net wrote:
 Hi Gabor,

 On Tuesday, January 08, 2013 09:04:31 Gabor Szabo wrote:
 I just wanted to update a distribution and ensure that all the
 modules in a distribution have
 version number and they are all the same.

 Please excuse this digression, but would you be so kind to explain
 why you find this desirable? In my distributions, I deliberately
 only bump the version number of a module to the current value of the
 distribution when I modify the module. Like that I can easily see
 when I last modified a certain module.

I think you strategy - updating the version numbers only when they change -
might be better, but I am too lazy for that, and I am afraid I'll
forget to do it.
If you know a tool that can ensure this, I'd be happy to hear about it.

I think having the same version number is still much better than having no
version number at all. That's why I was looking for that solution.

Actually for the people who are not deeply involved in the project this
might be even better than the one you do as it will make it easier to notice
if one of the files is out of sync.

I think.

regards
Gabor


Re: Make sure all the modules have the same version number in a distribution

2013-01-09 Thread David Christensen

On 01/09/13 07:17, Lutz Gehlen wrote:

Hi Gabor,

On Tuesday, January 08, 2013 09:04:31 Gabor Szabo wrote:

I just wanted to update a distribution and ensure that all the
modules in a distribution have
version number and they are all the same.


Please excuse this digression, but would you be so kind to explain
why you find this desirable? In my distributions, I deliberately
only bump the version number of a module to the current value of the
distribution when I modify the module. Like that I can easily see
when I last modified a certain module.


There seems to be two competing points of view regarding version 
numbering for software source code files:


1.  Per-file -- a unique version number for each file that increments 
when that file changes.  RCS and CVS use this approach.  They also 
provide keywords that can be embedded in files for accessing version 
control system meta-data.  For example, I use CVS and embedded it's 
$Revision$ keyword in my Perl files with the following incantation to 
set the Perl $VERSION variable:


our $VERSION  = sprintf %d.%03d, q$Revision: 1.32 $ =~ /(\d+)/g;

http://ximbiot.com/cvs/manual/cvs-1.12.13/cvs_12.html#SEC99

2.  Per-set -- unique version number for a set of files that increments 
when any one of them changes (and is the same for all the files in the 
set).  I believe Subversion and Git use this approach (and Mercurial?).



Perhaps Gabor should consider using the second type of version control 
system that allows a Perl incantation similar to the first.



HTH,

David


Re: Make sure all the modules have the same version number in a distribution

2013-01-08 Thread Ben Deutsch

Hello,


I just wanted to update a  distribution and ensure that all the

 modules in a distribution have version number and they are all the
 same. I guess Dist::Zilla would do that, but this distribution I am
 patching use Module::Build.

 I found Test::HasVersion but as I can see it only checks if there is
 a version number. Not if they are the same.

 Do you have any suggestions for the above?

I've found Test::ConsistentVersion, but not tried it yet. It seems to 
claim to be able to do that (I found it via Test::Version, which has the 
combination of Test::HasVersion, Test::ConsistentVersion and 
Test::GreaterVersion as a goal – it does not seem to have reached it yet.)


A question of my own: I immediately thought of the single point of 
truth idiom, and would have written something like this:


package My::Sub::Module;
use My::Base::Module;
our $VERSION = $My::Base::Module::VERSION;

or similar. Would this trip up some version processing infrastructure 
somewhere?


Regards,
Ben Deutsch


Re: Make sure all the modules have the same version number in a distribution

2013-01-08 Thread David Cantrell

On 08/01/2013 19:16, Ben Deutsch wrote:


A question of my own: I immediately thought of the single point of
truth idiom, and would have written something like this:

package My::Sub::Module;
use My::Base::Module;
our $VERSION = $My::Base::Module::VERSION;

or similar. Would this trip up some version processing infrastructure
somewhere?


Yes, it will trip up anything that tries to extract the version from the 
code without running it.  This includes the PAUSE indexer so your code 
will either not get indexed or will get indexed wrongly.


--
David Cantrell | Cake Smuggler Extraordinaire

Every normal man must be tempted at times to spit on his hands,
 hoist the black flag, and begin slitting throats. -- H. L. Mencken