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

Read from MYMETA.{json,yml} #33

Merged
merged 1 commit into from Mar 11, 2022
Merged

Read from MYMETA.{json,yml} #33

merged 1 commit into from Mar 11, 2022

Conversation

perlpunk
Copy link
Collaborator

@perlpunk perlpunk commented Mar 2, 2022

Note: I will run this branch for a week or so on the autoupdate host to check if the updates look ok.

Issue: https://progress.opensuse.org/issues/92122

I put the code to read META.{json,yml} into subroutines, so I could reuse
the code for MYMETA.

Along the way I did many small refactorings.

Now intrusive.pl and Intrusive.pm are not needed anymore.

} while ($path =~ s,^[^/]+/,,);
push(@pmfiles, "$args{module}")
} while ($path =~ s,^[^/]+/,,); # PP/LibYAML -> LibYAML
push(@pmfiles, "$args{module}") # DateTime
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coolo Shouldn't that be push(@pmfiles, "$args{module}.pm")?
I added module names as comments to actually see what this code is trying to do.
And then I saw that for modules without :: it would never add the .pm...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You ask me too much here - I didn't touch this code this decade. Sorry

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. it was worth a try, could be that you remembered ;-)

Copy link
Collaborator Author

@perlpunk perlpunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A problem with a v version came up:
https://build.opensuse.org/request/show/960460

BuildRequires: perl(Parallel::ForkManager) >= v0.7.6

I need to find out why such versions weren't a problem before.

@perlpunk
Copy link
Collaborator Author

perlpunk commented Mar 10, 2022

Actually we do already have modules where we require versions with a leading v:

% ack "BuildRequires:.* v\d"
perl-Class-DBI-Sweet/perl-Class-DBI-Sweet.spec
33:BuildRequires:  perl(Class::DBI) >= v3.0.12

perl-Config-Model/perl-Config-Model.spec
46:BuildRequires:  perl(Parse::RecDescent) >= v1.90.0

perl-Devel-Cover-Report-Codecov/perl-Devel-Cover-Report-Codecov.spec
50:BuildRequires:  perl(Test::Mock::Time) >= v0.1.6

perl-Module-CPANTS-Analyse/perl-Module-CPANTS-Analyse.spec
42:BuildRequires:  perl(File::Find::Object) >= v0.2.1

perl-Net-Stomp/perl-Net-Stomp.spec
39:BuildRequires:  perl(Test::NiceDump) >= v1.0.0

perl-Number-Phone/perl-Number-Phone.spec
37:BuildRequires:  perl(Parallel::ForkManager) >= v0.7.6

perl-Pod-Tree/perl-Pod-Tree.spec
39:BuildRequires:  perl(Test::Compile) >= v1.2.1

perl-Text-Xslate/perl-Text-Xslate.spec
39:BuildRequires:  perl(Mouse) >= v2.5.0

perl-Text-Table-Manifold/perl-Text-Table-Manifold.spec
31:BuildRequires:  perl(Const::Exporter) >= v0.2.3

That is something that cpanspec needs to handle in general, but this PR didn't introduce it, it just revealed the problem. I guess nobody noticed the wrong versions in the other modules so far.

I created the ticket with a detailed explanation and what we could do:
https://progress.opensuse.org/issues/108120

So the next step for cpanspec is to remove the leading v (and this is already done for the package version of the perl distribution itself).

I should do this in a seperate PR.

cpanspec Show resolved Hide resolved
cpanspec Outdated Show resolved Hide resolved
cpanspec Outdated Show resolved Hide resolved
Copy link

@Martchus Martchus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you know what you're doing. I only have some coding style remarks but I suppose at this point they're not very important.

elsif ($meta->{license} =~ /^unknown$/i) {
# do nothing, it's unknown and we know
}
else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And array with the patterns and their mappings would make sense. (So you could just loop through the array instead of having that many elsif-blocks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. But I just moved this code around, and cannot make everything nicer :)

my $sh;
if ($force) {
rename($script, "$script~") if (-e $script);
$sh = new FileHandle ">$script";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this way of calling the c'tor deprecated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, see above :)


print $sh "#!/bin/sh\n\n" . "\@\@PERL_PROV\@\@ \"\$\@\" | sed -e '/^$filter_provides[0]\$/d'";
if (@filter_provides > 1) {
for my $dep (@filter_provides[1 .. $#filter_provides]) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If @filter_provides isn't used anymore one you just shift-away the first element and use a simple loop.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand that sentence. But I also have no idea what this code and the --filter-provides option is doing at all and I just moved it into a subroutine (so I can forget about it ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the lack of tests, I second leaving it. Simplifying can backfire if you don't know the code

Issue: https://progress.opensuse.org/issues/92122

I put the code to read META.{json,yml} into subroutines, so I could reuse
the code for MYMETA.

Along the way I did many small refactorings.

Now intrusive.pl and Intrusive.pm are not needed anymore.
@perlpunk perlpunk merged commit 783bb14 into openSUSE:master Mar 11, 2022
@perlpunk perlpunk mentioned this pull request Mar 11, 2022
@perlpunk perlpunk deleted the mymeta branch May 5, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants