Page MenuHomeSoftware Heritage

maven: Use most recent release of a package as default version
ClosedPublic

Authored by anlambert on May 2 2022, 4:10 PM.

Details

Summary

artifacts list sent by the lister is not guaranteed to be sorted
by artifact time so the last element is not necessarily the most
recent artifact (see for instance the releases of that maven origin,
the default version (star icon) does not target the most recent release.

So ensure to use the most recent artifact as default version by
sorting the artifacts by their ISO 8601 date representation
(designed for lexicographical sort). If a date failed to be
parsed by the lister (edge case but can happen), the time value
will be an empty string so the sort operation will not end up
with error.

Related to T3874

Diff Detail

Repository
rDLDBASE Generic VCS/Package Loader
Branch
maven-loader-default-version
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 29020
Build 45367: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 45366: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D7728 (id=27940)

Rebasing onto 82e1bfad5c...

Current branch diff-target is up to date.
Changes applied before test
commit 9ef76a6f0cf82a106a6a13aba82876d90e1c4757
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon May 2 15:57:39 2022 +0200

    maven: Use most recent release of a package as default version
    
    artifacts list sent by the lister is not guaranteed to be sorted
    by artifact time so the last element is not necessarily the most
    recent artifact.
    
    So ensure to use the most recent artifact as default version by
    sorting the artifacts by their ISO 8601 date representation
    (designed for lexicographical sort). If a date failed to be
    parsed by the lister (edge case but can happen), the time value
    will be an empty string so the sort operation will not end up
    with error.
    
    Related to T3874

See https://jenkins.softwareheritage.org/job/DLDBASE/job/tests-on-diff/767/ for more details.

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/loader/package/maven/loader.py
153
This revision now requires changes to proceed.May 3 2022, 11:47 AM
swh/loader/package/maven/loader.py
153

Python is awesome, thanks !

This revision is now accepted and ready to land.May 3 2022, 11:52 AM

Build is green

Patch application report for D7728 (id=27947)

Rebasing onto 82e1bfad5c...

Current branch diff-target is up to date.
Changes applied before test
commit c06305e78a04dbcaf2f05a55998929980248c171
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon May 2 15:57:39 2022 +0200

    maven: Use most recent release of a package as default version
    
    artifacts list sent by the lister is not guaranteed to be sorted
    by artifact time so the last element is not necessarily the most
    recent artifact.
    
    So ensure to use the most recent artifact as default version by
    sorting the artifacts by their ISO 8601 date representation
    (designed for lexicographical sort). If a date failed to be
    parsed by the lister (edge case but can happen), the time value
    will be an empty string so the sort operation will not end up
    with error.
    
    Related to T3874

See https://jenkins.softwareheritage.org/job/DLDBASE/job/tests-on-diff/768/ for more details.