Page MenuHomeSoftware Heritage

Use swh-model objects in package loader.
ClosedPublic

Authored by vlorentz on Feb 24 2020, 4:36 PM.

Details

Test Plan

Tests will fail because they depend on D2713 and D2720

Diff Detail

Repository
rDLDBASE Generic VCS/Package Loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont added inline comments.
swh/loader/package/loader.py
340

Why not directly make it a snapshot object and then use its compute_hash method?

That would make us use less swh.model code.
Also we avoid building 2 objects (dict, snapshot) for one use.

swh/loader/package/loader.py
41

Those 3 lines can be dropped as, that's taking care of here ;)

Tests will fail because they depend on D2713.

Quick, let's land and tag those then (they got accepted ;)

swh/loader/package/loader.py
415

wondering whether the build_revision (old name) should return a Revision object directly (i know..., more work...).

426

Use Revision.compute_hash?

Oh, I forgot about compute_hash. And also that the id is "optional" (well not optional, but can be set to b'')

Also, compute_hash is a staticmethod that takes a dict as argument.

Make build_revision return Revision objects instead of dicts.

swh/loader/package/npm/loader.py
138

remove the prints ;)

Restarted build.
(in the mean time, fixing the debian build for swh-model)

Build is green

\m/

(in the mean time, fixing the debian build for swh-model)

  • unstable fixed.
  • stable still fails though... [1] /me is sad

[1] https://jenkins.softwareheritage.org/view/Debian%20packages/job/debian/job/packages/job/DMOD/job/gbp-buildpackage/74/console

This revision is now accepted and ready to land.Feb 27 2020, 3:43 PM