Commit graph

14 commits

Author SHA1 Message Date
Antoine Lambert
8d7dccc54a opam: Fix 'opam init' error when relisting an opam instance
When relisting an opam instance and the opam root directory is already
populated, the '--set-default' parameter must be provided otherwise the
following error is reported:

No switch is currently set. Please use 'opam switch' to set or install a switch

Related to swh/infra/sysadm-environment#4971.
2023-06-29 17:49:21 +02:00
Antoine Lambert
01be6ce581 opam: Only capture stdout when calling 'opam list'
Ensure opam errors are displayed when attempting to list all packages
in order to ease debugging.

Related to swh/infra/sysadm-environment#4971.
2023-06-29 17:49:08 +02:00
Antoine Lambert
d20803ddae opam: Ensure CalledProcessError is raised when an opam command failed
Use subprocess.run instead of subprocess.call and subprocess.Popen to
call opam commands and set check parameter to True in order to raise
CalledProcessError exception when an opam command failed.

This should help spotting issues with the opam lister.

Related to swh/infra/sysadm-environment#4971.
2023-06-29 14:02:00 +00:00
Nicolas Dandrimont
ad6644a663 opam: retrieve opam from $PATH with shutil.which
The default behavior of subprocess is to pull executables from a
hardcoded list, which doesn't work when opam is installed manually in
the user's home directory.
2023-06-21 14:53:17 +02:00
Nicolas Dandrimont
e785e67315 Hook up recently introduced options to all listers
Hopefully one day we'll be able to replace all of this mess with PEP692
TypedDict kwargs, but that's only on track for Python 3.12.
2022-12-05 16:33:45 +01:00
Valentin Lorentz
8ea4200909 Validate origin URLs before sending to the scheduler 2022-11-04 15:58:45 +01:00
Antoine Lambert
d38e05cff7 python: Reformat code with black 22.3.0
Related to T3922
2022-04-08 15:15:09 +02:00
Antoine R. Dumont (@ardumont)
97553d8984
opam: Stop leaking temporary folders on machine 2021-11-10 16:58:35 +01:00
Antoine R. Dumont (@ardumont)
e7716c0122
opam: Share opam root directory even on multiple instances
That avoids having multiple distinct opam root directories per opam lister instance. The
current opam commands used by the lister are actually listing specifically per instance.

Related to P1171
2021-09-24 11:55:07 +02:00
Antoine R. Dumont (@ardumont)
332ed8e543
opam: Allow defining where to actually install the opam_root folder
Related to T3590
2021-09-21 11:17:16 +02:00
Antoine R. Dumont (@ardumont)
ff5e86ff48
opam: Make the instance optional and derived from the url
This matches how it's done for all other multi instances listers.

Related to T3590
2021-09-21 11:17:16 +02:00
Antoine R. Dumont (@ardumont)
b69b0b7fd6
opam: Move the state initialization into the get_pages method
We should avoid side-effects in the constructor as much as possible. That avoids
surprising behavior at object instantiation time. The state if needed must be
initialized into the `swh.lister.pattern.Lister.get_pages` method, as preconized in the
class docstring.

This also fixes the current test that actually bootstrap a real opam local "clone" in
/tmp.

Related to T3590
2021-09-21 11:17:16 +02:00
Antoine R. Dumont (@ardumont)
f00d41d0cd
opam: Directly use the --root flag instead of using an env variable
This aligns the behavior with the opam loader

Related to T3358
2021-07-20 16:46:10 +02:00
zapashcanon
fe01d08cd9
add opam lister 2021-07-06 15:19:00 +02:00