Skip to content
Snippets Groups Projects
  1. Aug 28, 2023
    • Antoine Lambert's avatar
      rpm: Adapt to latest changes in lister and fix some issues · f8900ff6
      Antoine Lambert authored
      Do no attempt to parse version with the packaging.version module as rpm
      version format do not match Python package one and thus numerous parsing
      were failing.
      
      Use package intrinsic version in the message for each produced release in
      order for the loader to not create different releases targeting the same
      directory.
      
      Adapt input data sent by the RPM lister to its latest changes, notably in
      tests.
      
      Related to swh/meta#5011.
      f8900ff6
  2. Aug 08, 2023
  3. Jul 25, 2023
    • Antoine Lambert's avatar
      package/utils: Prevent content automatic deflate in download function · 9f187c9d
      Antoine Lambert authored
      The python requests library automatically deflate downloaded content bytes
      if the response header content-encoding is set to a supported encoding.
      
      However some HTTP servers can serve a tarball with content-type set to
      application/x-gzip and content-encoding set to gzip which is wrong as
      tarball is uncompressed while downloading it.
      
      That behavior can make a file checksum check after download fail as the
      expected checksum was computed on the compressed version of the file, not
      the uncompressed one.
      
      So ensure to prevent automatic deflate by reading response raw content
      instead of using the iter_content method when the content-type and
      content-encoding headers are both set to gzip format.
      9f187c9d
  4. Jul 10, 2023
  5. Jul 04, 2023
    • Antoine Lambert's avatar
      opam: Optimize the number of calls to the opam binary · c6a71c29
      Antoine Lambert authored
      Instead of calling opam for each package metadata fields to extract,
      get all these fields using a single opam call.
      c6a71c29
    • Antoine Lambert's avatar
      opam: Simplify calls to opam binary and check return codes · 3fc7ea8c
      Antoine Lambert authored
      Use subprocess.run instead of subprocess.call and subprocess.Popen
      and check opam command return codes to catch any possible issues.
      3fc7ea8c
    • Antoine Lambert's avatar
      opam: Ensure to initialize or update opam root when required · c3bccd53
      Antoine Lambert authored
      When using the loader not in production context (in docker for instance),
      the opam root folder is usually not present so ensure to initialize it
      or update its repositories otherwise the loading of packages will fail.
      c3bccd53
    • Antoine Lambert's avatar
      opam: Use proper way to list all versions of a package · 7bfc2c59
      Antoine Lambert authored
      opam 2.1 stores packages metadata in a tarball instead of having its
      content unpacked as with previous opam versions, so the workaround of
      walking the inner directories of the opam root to get all versions of
      a package is no longer working with opam 2.1.
      
      So use proper way to get all versions of a package by calling the
      following command:
      
      $ opam show --root <opam_root> <package> --field all-versions
      
      The previous issue reported in TODO comment was due to the fact that
      new opam repositories were not added in the default opam switch, this
      is now fixed and packages metadata from all repositories can be displayed
      using the opam show command.
      7bfc2c59
    • Antoine Lambert's avatar
      opam: Add support for opam 2.1 · f84adabe
      Antoine Lambert authored
      Opam 2.1 removed some CLI options and our tests data is in opam 2.0
      format so we need to force their upgrade to 2.1 format.
      f84adabe
  6. Jun 21, 2023
  7. Jun 08, 2023
  8. Jun 06, 2023
  9. Jun 01, 2023
    • Jérémy Bobbio (Lunar)'s avatar
      Fix documentation build issues because of Sphinx limitations · eeebfd2f
      Jérémy Bobbio (Lunar) authored
      The recent refactoring done in abe741a9, then used in swh-loader-svn@72dfc41,
      introduced build issues with the documentation:
      
          …/swh/loader/svn/directory.py:docstring of swh.loader.svn.directory.SvnDirectoryLoader.snapshot:1:
              WARNING: more than one target found for cross-reference 'Snapshot': swh.fuse.fs.artifact.Snapshot, swh.model.model.Snapshot
          …/swh/loader/svn/directory.py:docstring of swh.loader.svn.directory.SvnDirectoryLoader.cnts:1:
              WARNING: more than one target found for cross-reference 'Content': swh.fuse.fs.artifact.Content, swh.model.from_disk.Content, swh.model.model.Content
          …/swh/loader/svn/directory.py:docstring of swh.loader.svn.directory.SvnDirectoryLoader.dirs:1:
              WARNING: more than one target found for cross-reference 'Directory': swh.fuse.fs.artifact.Directory, swh.model.from_disk.Directory, swh.model.model.Directory
      
      vlorentz explained the cause:
      
      > SvnDirectoryLoader inherits from BaseDirectoryLoader which inherits
      > from NodeLoader, which defines:
      >
      >     self.snapshot: Optional[Snapshot] = None
      >
      > and it loses the annotation's value (only keeps its string
      > representation) because of the inheritence:
      > https://github.com/sphinx-doc/sphinx/issues/10124
      
      In order to fix this, we now use a qualified type reference in the
      initializers of NodeLoader and BaseDirectoryLoader.
      eeebfd2f
  10. May 31, 2023
  11. May 30, 2023
  12. May 25, 2023
    • Antoine R. Dumont's avatar
    • Antoine R. Dumont's avatar
      loader: Split DirectoryLoader in BaseDirectoryLoader and TarballDirectoryLoader · a0f9d62b
      Antoine R. Dumont authored
      The former is the base class and the latter is one specific implementation for tarball.
      Previously it was a single class.
      
      This explicits the current use for tarball directories. This will also allow to declare
      other directory loader implementations to deal with other origin types (vcs 'tree' as
      git, svn, hg). For this, developers need to provide a new class implementation per
      directory types. This class needs to inherit from BaseDirectoryLoader, and provide only
      the `fetch_directory` method.
      
      Now the BaseDirectoryLoader class is an abstract class and TarballDirectoryLoader is the
      first implementation in charge of ingesting 'directory' coming from a tarball.
      
      Further MRs will be opened to deal with Directory coming from Git, Hg or Svn in their
      respective loader package.
      
      Refs. swh/meta#4979
      a0f9d62b
  13. May 15, 2023
  14. May 05, 2023
  15. Apr 26, 2023
    • Antoine R. Dumont's avatar
      NodeLoader: Rename checksums_computation to checksum_layout · f84cbc26
      Antoine R. Dumont authored
      NodeLoader as in {Content|Directory}Loader. Those can directly ingest respectively
      a (remote) file (as Content) or a (remote) tarball artifact (as Directory). They are
      currently listed by the nixguix lister. Depending on the checksum_layout (standard,
      nar), they will compute checksums differently. With "standard" checksum layout, they are
      computing usual "swh" checksums (sha1, sha1_git, ...) and validate them. With "nar"
      checksum layout, they will compute the "nar" checksums and store those (once validated)
      as ExtID.
      
      This keeps the node loader construtor retro-compatible with the previous version. It
      still deals with `checksums_computation` as `checksum_layout` and falls back to
      "standard" layout when nothing is provided.
      
      Refs. swh/meta#4979
      f84cbc26
  16. Apr 25, 2023
  17. Apr 13, 2023
    • Antoine Lambert's avatar
      package/utils: Use http_retry decorator from swh.core.retry · 900f8184
      Antoine Lambert authored
      The http_retry decorator from swh-lister has been moved to swh-core so
      we can now use it in swh-loader-core instead of duplicating retry code.
      
      Moreover, it also enables to retry HTTP requests on errors like 502, 503
      or 504 instead on simply retrying on 429.
      900f8184
  18. Apr 06, 2023
  19. Apr 05, 2023
    • Antoine Lambert's avatar
      debian: Handle invalid version string when parsing changelog · 9868dcbc
      Antoine Lambert authored
      Some packages can have an invalid version string in their changelog
      which raises a ValueError when attempting to parse it in the
      get_intrinsic_package_metadata method of the loader.
      
      As a consequence each package release with such bogus entry in the
      changelog was discarded from the snapshot created by the loader.
      
      So prefer to get the raw string version instead of parsing it to
      workaround that issue.
      
      Fix #1493.
      9868dcbc
    • Antoine R. Dumont's avatar
      Make core loader use swh.loader.core.nar module · f41a28d1
      Antoine R. Dumont authored
      This pushes options from cli to the Nar class. This also bootstraps tests reusing
      existing test cases from before (using the nix binary).
      
      Refs. swh/meta#4979
      f41a28d1
    • Antoine R. Dumont's avatar
      Add swh.loader.core.nar module · 23cb3549
      Antoine R. Dumont authored
      This also exposes a `swh nar` cli.
      
      ```
      $ Usage: swh nar [OPTIONS] DIRECTORY
      
        Compute NAR hashes on a directory.
      
      Options:
        -x, --exclude-vcs               exclude version control directories
        -H, --hash-algo [sha256|sha1]
        -f, --format-output [hex|base32|base64]
        --debug / --no-debug
        -h, --help                      Show this message and exit.
      ```
      
      Refs. swh/meta#4979
      23cb3549
  20. Apr 04, 2023
  21. Mar 27, 2023
    • Jérémy Bobbio (Lunar)'s avatar
      Fix presentation of the loader specification table · f47294fd
      Jérémy Bobbio (Lunar) authored
      After switching to the PyData Sphinx theme, the very large table
      with the loader specification became too wide to be readable.
      These changes make the table scrollable again, remove the right sidebar,
      highlight the name column and add stripe to rows.
      
      They are stopgap measure as such a table might not the best way to
      present this information.
      f47294fd
  22. Mar 08, 2023
    • Antoine Lambert's avatar
      pubdev: Handle packages with dash in version numbers · fa5f1566
      Antoine Lambert authored
      Version number of a pubdev package containing a dash character fails
      to be parsed by packaging.parse_version.
      
      So ensure to split version number by dash to extract parsable part
      in it and fix loading of such packages.
      
      Resolves #4741
      fa5f1566
  23. Feb 23, 2023
Loading