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 META.json and more #29

Merged
merged 12 commits into from May 4, 2021
Merged

Read from META.json and more #29

merged 12 commits into from May 4, 2021

Conversation

perlpunk
Copy link
Collaborator

@perlpunk perlpunk commented Apr 29, 2021

Summary:

  • Add a Dockerfile with everything necessary to run cpanspec
  • Add reading several things from META.json (dependencies, dynamic_config, provides)
  • Skip parsing the code if provides exists in META.(json|yaml)
  • Skip calling Makefile.PL etc. if dynamic_config exists in META.(json|yaml) and is false
  • Move the code to call Makefile.PL etc. into it's own subprocessto avoid influencing the result
  • Fix a case where the root directory of cpanspec was added to @INC and a Build.PL of a module was calling require "Makefile.PL" effectively calling cpanspec/Makefile.pL
  • Add statistics output
  • Add a script for batch processing a list of packages

Issue: https://progress.opensuse.org/issues/90047, #21

and use list of provided packages from META.json or META.yml
... and pass result as JSON to cpanspec.

Scripts like Makefile.PL or Build.PL should not be loaded from inside
a script.
First look into the meta files for prereqs and provides.
If not found or 'dynamic_config' is set, only then execute
Makefile.PL/Build.PL etc.
Fix checking for dynamic_config
@perlpunk
Copy link
Collaborator Author

perlpunk commented Apr 29, 2021

Example statistics output:

# STATS # # JSON::Validator, 4.17
# STATS # ---
# STATS # abstract:
# STATS #   metajson: Validate data against a JSON schema
# STATS #   metayaml: Validate data against a JSON schema
# STATS # dynamic: 0
# STATS # got_prereqs: 1
# STATS # license:
# STATS #   metajson:
# STATS #   - artistic_2
# STATS #   metayaml: artistic_2
# STATS #   spec: Artistic-2.0
# STATS # metajson: 1
# STATS # metayaml: 1
# STATS # name: JSON::Validator
# STATS # provides: 0
# STATS # summary: Validate data against a JSON schema
# STATS # version: '4.17'

So the logs can easily be analyzed with this:

% perl -nwlE'if (s/^# STATS # //) { print }' logfile
# Outputs list of YAML documents which can be loaded in perl or other languages to analyze

cpanspec Outdated Show resolved Hide resolved
cpanspec Outdated Show resolved Hide resolved
lib/CPAN2OBS.pm Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
It wasn't actually used anymore, and it is unreliable.
We only rely on META.(json|yaml) and Makefle.PL etc. now.
@perlpunk perlpunk merged commit 2e4901d into openSUSE:master May 4, 2021
@perlpunk perlpunk deleted the metajson branch May 5, 2022 09:21
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

2 participants