diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2022-02-18 01:51:13 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2022-02-22 18:57:32 +0300 |
commit | bfa6da62336781086b93b575b9490fabe58b1db6 (patch) | |
tree | 1d044a76a1c6908b17bd99b93384b3b1e5dbe618 | |
parent | 6610574590602b4eb857ec0fae1765ff593b596b (diff) |
Update perl annotation tool
Simply add a dependency on the current perl version provide, where
appropriate. We can do this now, as all the historical cases where it's
missing have been fixed.
Future work: Rather than hard-coding the current perl version provide,
in the case of vendored perl modules, we could extract the relevant
version from the /usr/share/perl5/vendor_perl/5.nn/ path that files are
installed into. Likewise, for modules linked with cygperl5_nn, we could
determine the relevant version by extracting them and examining their
dependencies.
-rw-r--r-- | calm/fix-annotate-perl-hint.py | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/calm/fix-annotate-perl-hint.py b/calm/fix-annotate-perl-hint.py index 126dd51..6959535 100644 --- a/calm/fix-annotate-perl-hint.py +++ b/calm/fix-annotate-perl-hint.py @@ -61,29 +61,23 @@ def fix_one_hint(dirpath, hintfile, tf): logging.error('invalid hints %s' % hintfile) return + annotation = '' modified = False - # if no annotation yet ... - if 'notes' not in hints: - requires = hints.get('requires', '').split() - if requires: - # is a perl provide is already present in requires? - if any(r.startswith('perl5_') for r in requires): - return - - # ... otherwise, add a perl annotation - if ('perl_base' in requires) or ('perl' in requires): - logging.info("%s has perl in requires and no annotations" % (hintfile)) - hints['notes'] = 'perl5_032' - modified = True + requires = hints.get('requires', '').split() + if requires: + # is a perl provide is already present in requires? + if any(r.startswith('perl5_') for r in requires): + return - # fix spelling mistake in 5_26 annotation - if hints.get('notes', '') == 'perl5_26': - hints['notes'] = 'perl5_026' + # ... otherwise, add a perl annotation + if ('perl_base' in requires) or ('perl' in requires): + logging.info("%s has perl but no perl5_nnn in requires" % (hintfile)) + annotation = 'perl5_032' # if annotated, check if this package installs into vendor_perl, and if so, # add the annotated perl version to requires, if not already present - if hints.get('notes', '').startswith('perl5_0'): + if annotation: ivp = False exe = False @@ -98,11 +92,11 @@ def fix_one_hint(dirpath, hintfile, tf): if ivp or knwn: requires = hints.get('requires', '').split() - if hints['notes'] not in requires: - requires.append(hints['notes']) + if annotation not in requires: + requires.append(annotation) requires = sorted(requires) modified = True - logging.warning("adding %s to requires in %s" % (hints['notes'], hintfile)) + logging.warning("adding %s to requires in %s" % (annotation, hintfile)) hints['requires'] = ' '.join(requires) else: if exe: |