Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkconfig.pl: don't re-invent version comparison #2412

Merged
merged 2 commits into from Apr 19, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -17,6 +17,7 @@
use strict;
use lib "$ENV{LJHOME}/extlib/lib/perl5";
use Getopt::Long;
use version;

my $debs_only = 0;
my ($only_check, $no_check, $opt_nolocal);
@@ -107,23 +108,7 @@ sub check_modules {
# assumes there will never be a version part prepended
# only appended
if ( $ver_want && $ver_got ) {
my @parts_want = split( /\./, $ver_want );
my @parts_got = split( /\./, $ver_got );
my $invalid = 0;

while ( scalar @parts_want ) {
my $want_part = shift @parts_want || 0;
my $got_part = shift @parts_got || 0;

# If want_part is greater then got_part, older
# If got_part is greater then want_part, newer
# If they are the same, look at the next part pair
if ( $want_part != $got_part ) {
$invalid = $want_part > $got_part ? 1 : 0;
last;
}
}
if ( $invalid ) {
if ( version->parse($ver_want) > version->parse($ver_got) ) {
This conversation was marked as resolved by nfagerlund

This comment has been minimized.

Copy link
@nfagerlund

nfagerlund Apr 9, 2019

Author Contributor

@alierak 👍🏼 !

This file's style is kind of all over the place (probs bc age), but do you mean like this?

Suggested change
if ( version->parse($ver_want) > version->parse($ver_got) ) {
if ( version->parse( $ver_want ) > version->parse( $ver_got ) ) {

This comment has been minimized.

Copy link
@alierak
if ( $modules{$mod}->{opt} ) {
print STDERR "Out of date optional module: $mod (need $ver_want, $ver_got installed)\n";
} else {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.