Page MenuHomeSoftware Heritage

deposit.client.cli: Expose --create-origin flag and deprecate --slug
ClosedPublic

Authored by ardumont on Jan 11 2021, 2:00 PM.

Details

Summary

The --slug behavior is marked as deprecated but still usable. The new --create-origin
flag allows to generate the proper xml stanza when the client does not provide any
metadata xml file.

Related to T2860

Test Plan

tox

Diff Detail

Repository
rDDEP Push deposit
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 18270
Build 28204: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 28203: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D4834 (id=17126)

Rebasing onto 83a5ded409...

Current branch diff-target is up to date.
Changes applied before test
commit fecd951e9d0ea1d8ead230ab4d1a1deb0fa85743
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jan 11 13:58:04 2021 +0100

    deposit.client.cli: Expose --create-origin flag and deprecate --slug
    
    Related to T2860

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

missing tests

swh/deposit/cli/client.py
425–429

this one should be an error

This revision now requires changes to proceed.Jan 11 2021, 4:05 PM
  • Add tests
  • Generate proper xml stanza for the --create-origin flag
  • Improve commit message

Build is green

Patch application report for D4834 (id=17145)

Rebasing onto 82a26b5e86...

Current branch diff-target is up to date.
Changes applied before test
commit 40e04b73519a74eada25844fdf3375bd8bdbaab4
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jan 11 13:58:04 2021 +0100

    deposit.client.cli: Expose --create-origin flag and deprecate --slug
    
    The --slug behavior is marked as deprecated but still usable. The new --create-origin
    flag allows to generate the proper xml stanza when the client does not provide any
    metadata xml file.
    
    Related to T2860

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

Update --create-origin flag docstring

Build is green

Patch application report for D4834 (id=17146)

Rebasing onto 82a26b5e86...

Current branch diff-target is up to date.
Changes applied before test
commit 565bb8fefeeb25acb03fbc5be780e8a14a191b4f
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jan 11 13:58:04 2021 +0100

    deposit.client.cli: Expose --create-origin flag and deprecate --slug
    
    The --slug behavior is marked as deprecated but still usable. The new --create-origin
    flag allows to generate the proper xml stanza when the client does not provide any
    metadata xml file.
    
    Related to T2860

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

swh/deposit/cli/client.py
118

?

Drop duplicated xmlns:codemeta header introduced by mistake

(that must have been my initial attempt to add the xmlns:swh header which started as a
duplicate)

ardumont added inline comments.
swh/deposit/cli/client.py
118

indeed, fixed.

Build is green

Patch application report for D4834 (id=17203)

Rebasing onto 82a26b5e86...

Current branch diff-target is up to date.
Changes applied before test
commit 89fa88ab697afc8d0c2e6d2654cf91a81638ab86
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jan 11 13:58:04 2021 +0100

    deposit.client.cli: Expose --create-origin flag and deprecate --slug
    
    The --slug behavior is marked as deprecated but still usable. The new --create-origin
    flag allows to generate the proper xml stanza when the client does not provide any
    metadata xml file.
    
    Related to T2860

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

This revision is now accepted and ready to land.Jan 14 2021, 12:13 PM
ardumont marked an inline comment as done.

Rebase

Build is green

Patch application report for D4834 (id=17211)

Rebasing onto 38788d907c...

Current branch diff-target is up to date.
Changes applied before test
commit 2c47667ab6257aed298baff0330a6e5ee1e0ac26
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Jan 11 13:58:04 2021 +0100

    deposit.client.cli: Expose --create-origin flag and deprecate --slug
    
    The --slug behavior is marked as deprecated but still usable. The new --create-origin
    flag allows to generate the proper xml stanza when the client does not provide any
    metadata xml file.
    
    Related to T2860

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

@vlorentz @moranegg

That diff annoyed me a bit. It felt incomplete so far without pinpointing exactly the issue.
I think i grok it now.

It deprecates the --slug behavior by telling it as much through a warning. So the behavior is kept.
It introduces a new --create-origin which "only" allows to generate the <create_origin>
stanza when users do not provide the xml themselves.

That's what feels incomplete. That leaves totally alone the current users which do provide their xml.
I don't really know how to take care of that part though.

any thought on whether we want to take care of this at all? And if so, how to properly do it?

Thanks for the input.

Cheers,

You can make an other diff to make the client parse the XML and check if there is <swh:create_origin>/<swh:add_to_origin> in it; and show a warning if there isn't.

You can make an other diff to make the client parse the XML and check if there is <swh:create_origin>/<swh:add_to_origin> in it; and show a warning if there isn't.

sounds good, thanks.