Commit graph

707 commits

Author SHA1 Message Date
Franck Bret
b7b11887a0 Bower: Set VISIT_TYPE as 'git'
Origins url for Bower are git repositories. Set the VISIT_type as 'git'.
No need for a specific 'Bower' package loader.
2022-08-29 17:15:09 +02:00
Franck Bret
ceae8c42b5 Bower: List origins from registry.bower.io 2022-08-29 15:55:00 +02:00
Franck Bret
5410b6e3f3 Pub.dev lister for Dart and Flutter packages
Stateless lister for https://pub.dev based on http api to list package names
2022-08-26 10:24:08 +02:00
Valentin Lorentz
ce72969de5 aur: Simplify pathlib logic 2022-08-25 09:41:50 +02:00
Valentin Lorentz
766fbbcc91 arch: Un-nest long method 2022-08-25 09:41:44 +02:00
Valentin Lorentz
b7ec6cb120 tests: Simplify origin comparison and improve pytest diff on failure
By using a single equality instead of checking len() then zip()
to check one by one, pytest can find the common/missing elements
and print them nicely when the two lists are unequal.
2022-08-24 17:21:24 +02:00
Valentin Lorentz
4b511b4181 arch: Use lazy interpolation in logging statements 2022-08-23 13:43:07 +02:00
Valentin Lorentz
31c44330e8 gogs: Lower unnecessarily verbose logging statement 2022-08-23 13:40:19 +02:00
Valentin Lorentz
17a219ece0 gitea: Inherit from Gogs lister
This removes code and adds support for incremental pagination.

While both are essentially the same lister now, it still makes sense to
keep the Gitea lister separate, in order to:

1. display them in different categories on https://archive.softwareheritage.org/
2. support possible divergence of APIs in the future
2022-08-23 13:38:32 +02:00
Valentin Lorentz
dde7865ac4 arch: Fix broken ref 2022-08-19 19:07:55 +02:00
Franck Bret
7dd412e553 arch: Extra_loader_arguments consistency + documentation
Split extraloader_arguments artifacts to artifacts and arch_metadata
Add lister documentation at module level

Related T4233
2022-08-19 15:43:58 +02:00
Valentin Lorentz
3ab90cc0cd aur: Fix broken ref 2022-08-19 14:14:37 +02:00
Franck Bret
97b353bf0b Arch User Repository (AUR) lister
Add 'aur' module to swh-lister with data fixtures and tests.
For now, origin url are package vcs (Git) url.
2022-08-19 12:43:15 +02:00
KShivendu
6a53a6ad06 feat: Make the Gogs lister incremental 2022-08-17 15:01:32 +05:30
Antoine Lambert
cee6bcb514 maven: Use BeautifulSoup instead of xmltodict for parsing pom files
xmltodict cannot parse POM files with multi-byte encoding so prefer to
use the XML parser of BeautifulSoup based on lxml instead.

Also drop xmltodict requirement as it is no longer used in swh-lister
codebase.
2022-08-09 11:11:45 +02:00
Valentin Lorentz
d51bce0a1c crates: Fix broken ref 2022-08-08 20:43:54 +02:00
Franck Bret
751c3df1b7 crates: Add a developer documentation at module level
Mainly move documentation content from docs/user to crates module
(See D8199 for details)

Related T4104
2022-08-08 14:48:45 +02:00
Franck Bret
a6f796b268 crates.lister: Implement incremental mode:
Add incremental mode support based on a 'last_commit' state, used to get
new package versions from git diff range of commits.
2022-08-05 13:41:57 +02:00
KShivendu
d34a6232a6 gogs: Introduce Gogs lister 2022-08-03 16:22:06 +05:30
Franck Bret
1bf11aa26d Add arch lister module (origins from archives).
After a first attempt with D7812 this one use a different strategy to
retrieve origins.

Fetch and extract "core.files.tar.gz", "extra.files.tar.gz" and "community.files.tar.gz" from archives.archlinux.org. That step ensure that we have a list of "official" packages.
Parse metadata from 'desc' file to build origins url.
Scrap the origin url to get artifacts metadata that list all versions of a package.

It also fetch and extract unofficial 'arm' packages from archlinuxarm.org but in this case we can not get all versions of an arm package.

Related T4233
2022-06-15 09:11:57 +02:00
Antoine R. Dumont (@ardumont)
263db667d0
Adapt maven lister to list canonical gh urls if any
That means detected github urls {https,git,http}://github.com/${user_repo}(.git) are
canonicalized to https://github.com/${user_repo} format.

This avoids duplication of origins.

Related to T4232
2022-05-23 14:47:11 +02:00
Antoine R. Dumont (@ardumont)
2ffe9c2aea
Use swh.core.github.pytest_plugin in github tests
Related to T4232
2022-05-20 16:06:11 +02:00
Antoine Lambert
3f6c7edc24 maven: Prevent UnicodeDecodeError when processing pom file
Pass the raw bytes of pom file content in xmltodict.parse and let
it do the string decoding based on the encoding declared in pom file.

If the string decoding failed due to an invalid declared encoding,
xml.parsers.expat.ExpatError will be raised and will be caught by
the lister, ignoring the pom file and continuing listing.

Related to T3874
2022-05-02 14:01:58 +02:00
Antoine Lambert
0222a8f5c4 maven: Handle null mtime value in index for jar archive
It exists cases where the modification time for a jar archive in
a maven index is null which was leading to a processing error
by the lister.

So handle that case to avoid premature exit of the listing process.

Related to T3874
2022-04-29 13:59:17 +02:00
Antoine Lambert
378613ad82 maven: Remove extraction of groupId and artifactId from pom files
When parsing pom files, we are only interested to extract a VCS URL
(git, hg, svn) in order to create associated loading tasks.

In that case, the groupId and artifactId are not used by the lister
so better removing their extraction, plus it will prevent errors when
those info are missing in pom files.
2022-04-29 11:15:03 +02:00
Antoine Lambert
22bcd9deb2 maven: Create one origin per package instead of one per package version
Previously the maven lister was creating an origin for each source
archive (jar, zip) it discovered during the listing process.

This is not the way Software Heritage decided to archive sources
coming from package managers. Instead one origin should be created
per package and all its versions should be found as releases in the
snapshot produced by the package loader.

So modify the maven lister in order to create one origin per package
grouping all its versions.

This change also modifies the way incremental listing is handled,
ListedOrigin instances will be yielded only if we discovered new
versions of a package since the last listing.

Tests have been updated to reflect these changes.

Related to T3874
2022-04-29 10:57:04 +02:00
Franck Bret
985b71e80c crates: Create one origin per package instead of per version
Previously we had as many origins as version for a crate package, url was a link
to a specific crate version package.

Refactor to have one origin per package name and add an 'artifacts' entry to
extra_loader_arguments that list all versions, package url and checksum.
Origin url is now a link to the related http api endpoint for a package name.

Related to T4104
2022-04-28 16:10:33 +02:00
Valentin Lorentz
d715aaf903 Make user_agent a parameter of GitHubSession
So it can be set when used by other packages
2022-04-26 11:08:53 +02:00
Valentin Lorentz
2d04244cc9 Move GitHubSession from github/lister.py to github/utils.py
So it can be reused by other packages without importing lister.py itself
2022-04-26 11:08:49 +02:00
Valentin Lorentz
9ee4a99f15 github: Refactor rate-limiting out of the GitHubLister class
This will allow the GitHub Metadata Fetcher to reuse the logic
by importing the GitHubSession class.
2022-04-26 11:08:45 +02:00
Antoine Lambert
334c54091e maven: Remove duplicated code related to setting instance from netloc
That processing is already handled in the base Lister class constructor.
2022-04-25 17:31:02 +02:00
Valentin Lorentz
d0924f39d0 github: Remove dead code
Authentication is handled directly in the session
2022-04-21 20:32:45 +02:00
Antoine Lambert
2fa9f0abd2 sourceforge: Fix listing of bzr projects
Fix sourceforge origin URL for bzr projects,
http://project.bzr.sourceforge.net/bzrroot/project
redirects to http://project.bzr.sourceforge.net/bzr/project.

Handle bzr projects with multiple branches, one listed origin
must be created per branch.

Discard bzr projects that no longer exist from listing.
2022-04-21 18:19:07 +02:00
Antoine Lambert
63a744559f sourceforge: Do not consider Attic as a valid CVS module
The Attic folder that can sometimes be found in a CVS respository
is a special one used by CVS to store RCS files and should not be
considered as a valid module name when listing CVS projects.
2022-04-21 16:08:16 +02:00
Antoine R. Dumont (@ardumont)
10bb8db345
maven: Fix argument of type 'NoneType' is not iterable
Related to T3874
2022-04-14 15:33:24 +02:00
Antoine R. Dumont (@ardumont)
7c8428d01c
maven: Continue listing if unable to retrieve pom information
This aligns the behavior with other listers (e.g. sourceforge, ...) to continue listing
if some information is not retrievable at all.

Related to T3874
2022-04-13 17:59:20 +02:00
Antoine R. Dumont (@ardumont)
e4b27a1e98
maven: log error message when not able to retrieve the index to read
Without this, the lister legitimately cannot list anything.
2022-04-13 17:41:44 +02:00
Antoine Lambert
d38e05cff7 python: Reformat code with black 22.3.0
Related to T3922
2022-04-08 15:15:09 +02:00
Franck Bret
fea6fc04aa lister: Add new rust crates lister
The Crates lister retrieves crates package for Rust lang.

It basically fetches https://github.com/rust-lang/crates.io-index.git
to a temp directory and then walks through each file to get the
crate's info.
2022-03-28 08:42:31 +02:00
Antoine Lambert
fd03941c5f sourceforge: Fix incremental listing since CVS origin URLs modification
Commit 6a7479553e modified the origin URLs for CVS projects
hosted on SourceForge but it also broke incremental listing
due to a no longer valid assertion, so fix that issue.
2022-03-11 11:48:15 +01:00
Antoine R. Dumont (@ardumont)
2568ecc7c2
launchpad: Ignore erratic page and continue listing next page
The decorator is dropped on `get_origins_from_page` as we cannot retry an iterator
consumption anyway.

Related to T3948
2022-02-18 10:36:54 +01:00
Antoine Lambert
6a7479553e sourceforge: Fix origin URLs for CVS projects
CVS projects are different from other VCS ones, they use the rsync
protocol, a list of modules needs to be fetched from an info page
and multiple origin URLs can be produced for a same project.

Related to T3789
2022-02-17 13:51:52 +01:00
Antoine R. Dumont (@ardumont)
4265e5dd77
launchpad: Drop extra filtering step which is no longer necessary
as the scheduler is now able to deduplicate it when recording listed origins.

Related to T3945
2022-02-17 12:11:25 +01:00
Antoine R. Dumont (@ardumont)
c86e4b43f4
launchpad: Use tuple instead of list
Related to T3945
2022-02-17 12:11:24 +01:00
Antoine R. Dumont (@ardumont)
fc2edd24aa
launchpad: Manage unhandled exceptions when listing
Prior to this commit, the listing could fail when either reading a page or the page of
results (lauchpad api raises RestfulError). This now retries when those kind of
exceptions happen. If the error persists (after multiple tryouts and exponential
backoff), the listing continues nonetheless (with warning logs).

Note that if the page ends up being empty, it's no longer accounted for.

This actually allows the listing to finish in case of issues.

Related to T3945
2022-02-17 12:11:09 +01:00
Antoine R. Dumont (@ardumont)
262f9369c8
launchpad: Allow bzr origins listing
Related to T3945
2022-02-16 17:56:13 +01:00
Raphaël Gomès
31b4429ced sourceforge: fix support for listing bzr origins
Bazaar support was removed a long time ago and predates a lot of the new
mechanisms in place in the API. Unfortunately, it looks like a lot of
the URLs are offline now, but there are still a few projects that can be
listed, this is pretty low-effort.
2022-02-14 14:56:38 +01:00
Antoine Lambert
b7524bbae0 debian/test_lister: Fix typo detected with codespell 2022-02-10 16:25:42 +01:00
Antoine R. Dumont (@ardumont)
7ff1390378
maven: Fix last update datetime
We need to avoid using naive datetime as this fails during conversion.

Related to T3746
Related to P1280
2022-02-09 16:59:40 +01:00
Boris Baldassari
d4e1e8212a maven: Fix undef last_update in ListedOrigins. 2022-02-08 07:51:01 +01:00