Commit graph

4,566 commits

Author SHA1 Message Date
525fa34387 lib.pm: Add parameter ec: ExecContext to functions

Functions in lib.pm (i.e. run_dpkg(), run_rpm() and friends) also get an ExecContext-type parameter. Use them in lib/distros/*/Distro.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 19:02:22 +01:00
1325222fbd lib.ExecContext,Local: Remove callback default params

Remove defaults from protected callback function parameters. They have to be decided by the base class's public API.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 19:02:22 +01:00
c6e8d38497 Release 1.0.0-180@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-03-06 15:23:29 +00:00
cb98f637d5 Release 1.0.0-179@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-03-06 15:22:49 +00:00
79b935a135 Release 1.0.0-180@suse-tumbleweed/x86_64 2026-03-06 14:28:15 +00:00
10ab026d4d Start version: 1.0.0-180 2026-03-06 14:27:40 +00:00
7fdba1b5db lib.util: Add ec: ExecContext to all subprocesses

Allow to pass an optional execution context to all functions spawning a subprocess defined in lib.util.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 15:14:13 +01:00
fadf1bca49 lib.util.run_cmd(): Add parameter ec: ExecContext

Allow to specify the ExecContext in a call to run_cmd(). This effectively makes run_cmd() an thin wrapper around ExecContext.run(), which is what's going to be used in the future. The wrapper is for backwards-compatibility.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 15:14:13 +01:00
3e897f4df8 lib.Distro, ExecContext: Add classes, refactor lib.distro

The code below lib.distro, as left behind by the previous commit, is geared towards being directly used as a command-line API. This commit introduces the abstract base class Distro, a proxy for distribution-specific interactions. The proxy abstracts distro specifics into an API with proper method prototypes, not argparse.Namespace contents, and can thus be more easily driven by arbitrary code.

The Distro class is initialized with a member variable of type ExecContext, another new class introduced by this commit. It is designed to abstract the communication channel to the distribution instance. Currently only one specialization exists, Local, which interacts with the distribution and root file system it is running in, but is planned to be subclassed to support interaction via SSH, serial, chroot, or chains thereof.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 14:56:46 +01:00
f24541dbe4 pkg.App: Add options --distro-id, --interactive

Add the global options --distro-id and --interactive, and expose them as properties App.distro_id and App.interactive, respectively.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 12:06:28 +01:00
7e7cee6d11 cmds.distro: Move all modules to lib

Functions abstracting the distribution are not only needed in the context of the distro subcommand, but also by other code, so make the bulk of the code abstracting the distribution available in some place more universally useful than below cmds.distro.

This commit leaves the source files mostly unchanged. They are only patched to fix import paths, so that functionality is preserved. Refactoring the code from command-line API to library API will be done by the next commit.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 12:06:28 +01:00
f94a2ac037 cmds.DistroBase: Add class

Move most of CmdDistro into the new class DistroBase, meant to serve as base class for distro-aware commands other than "distro".

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 12:06:28 +01:00
e9cb539ecf jw-pkg.py: Enable argcomplete

Register a bash-completion handler for jw-pkg.py, and mark it with PYTHON_ARGCOMPLETE_OK.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 12:06:28 +01:00
5d84eb0877 conf: Add subdir
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 12:06:28 +01:00
43464786dc project.conf: Remove nonsensical maintainer scripts

Remove maintainer scripts that are long since obsolete.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-06 12:06:28 +01:00
aedae29db5 Release 1.0.0-179@suse-tumbleweed/x86_64 2026-03-05 13:12:23 +00:00
119809eb87 Start version: 1.0.0-179 2026-03-05 13:11:46 +00:00
adbeba2b9b pkg.sh: Don't escape maintainer scripts
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-05 13:11:43 +00:00
05df80978d Release 1.0.0-178@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-03-05 06:43:42 +00:00
b68e88484f Start version: 1.0.0-178
Signed-off-by: janware DevOps <devops@janware.com>
2026-03-05 06:42:59 +00:00
ae902250bd jw/pkg/lib/util.run_cmd(): Chunked read_stream()

jw-pkg distro dup got hung in a chroot environment. strace shows that write(2) into a pipe is the hanging syscall, with the write buffer hinting at zypper dup output.

I strongly suspect that run_cmd() tries to write stdout into the pipe which read_stream() fails to empty. So, make read_stream() more resilient by using read(4096) instead of readline(), which I suspect to be prone to hang on overlong lines.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-05 06:42:57 +00:00
5805633550 Release 1.0.0-177@suse-tumbleweed/x86_64 2026-03-04 20:26:58 +00:00
e7d1a455c3 Start version: 1.0.0-177 2026-03-04 20:26:20 +00:00
f55a32024b pgit.sh get: Fix default revision for fresh clones

Fix detection of a project's revision if a project directory is freshly cloned, and hence doesn't exist, yet. The fix is to default to master for now.

2026-03-04 16:59:46 +00:00
404901bcff cmds.distro.backend.debian.Util: Remove --fix-broken

--fix-broken is added to apt-get options in non-interactive mode, but seems to work only with apt-get install, not with apt-get update. Don't add it at all for now.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:39:39 +00:00
a25701991d distro.backend.debian.Refresh.run(): Fix apt_get()

Fix call to apt_get(), needs to be a list, not a string.

2026-03-04 16:30:43 +00:00
4eeb12c12e cmds.distro.backend.debian.Util.apt_get(): Fix -yes

Fix a typo in the non-interactive command-line option (--yes) passed to apt_get().

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:16:20 +00:00
8ca8df859b cmds.distro.backend.debian.Delete: Add class

Add Debian supoort for single-package deletion.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:04:27 +00:00
a7293e0ac9 cmds.distro.backend.debian.Util.py: Add dpkg()

Add utility method .dpkg() to the backend.debian.Utils class, saving the need to import it, saving the need to import it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:04:27 +00:00
7e85076b44 cmds.distro.backend.debian.Install|Dup: Fix .apt_get()

.apt_get() is called on self, should be called on self.util instead, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:04:27 +00:00
9e8f5e3d2e cmds.distro.backend.debian.Util.apt_get(): Take list

apt_get(), like all other functions and methods spawning processes should take a list instead of a starred *args array. Implement that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:04:27 +00:00
39ab1885e6 cmds.distro.backend.suse.Util.rpm(): Relay args

Relay *args and **kwargs unchanged to run_rpm(), no need to limit them so far.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:02:44 +00:00
770920ef91 cmds.distro.CmdDelete: args.packages -> args.names

Rename the "packages" argument to "names" to be a little more consistent with the pkg subcommand argument nomenclature.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:02:38 +00:00
0c1c2b9351 lib.util.run_cmd(): Reduce interactive logging

run_cmd() with cmd_input == mode:interactive and verbose == true logs output too often. First, __log() is called, then pty.spawn() writes everything it reads from the PTY master to the terminal.

The fix it to not call __log() from _read() for the PTY reader.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 16:02:07 +00:00
e322629ac1 Release 1.0.0-176@suse-tumbleweed/x86_64 2026-03-04 14:14:46 +00:00
6d90813c67 Start version: 1.0.0-176 2026-03-04 14:14:09 +00:00
0317f46a01 cmds.distro.pkg.CmdMeta: Add class

Support distro pkg meta <package names ...>, returning meta information for the specified package names.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:56:11 +01:00
f55d3045e0 cmds.distro.backend.debian.Pkg: Add module

Add Debian support for the "pkg"-command.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:55:06 +01:00
2897ba849f cmds.distro.backend.debian.Select: Add class

Add Select for Debian backends.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:54:33 +01:00
7f72d17f7a cmds.distro.lib.dpkg: Add module

As with cmds.distro.lib.rpm, the dpkg module is a place for Python abstractions of the Debian package manager tools dpkg and friends.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:53:14 +01:00
1bb3c166d6 cmds.distro.lib.rpm.query_packages(): Add function

Replace all_installed_packages() by query_packages(). The function takes an optional list of packages to be queried. If it's empty, a list of all installed packages are returned.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:52:14 +01:00
3e9ec1f6c5 cmds.distro.lib.Package: Add more methods

Add more methods, to make Package more useful:

- __repr__()

- Class-mMethods to help with parsing of strings gathered from the OS-tools' output:
parse_spec_str() parse_specs_str() order_tags()

- Add field maintainer

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:49:11 +01:00
ecd077c93d cmds.distro.CmdPkg: args.name -> names

Make all pkg commands take a "names" argument (plural) instead of "name", and make it a non-option-argument, to be passed to the subcomand instead.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:48:46 +01:00
8bc22a3a68 lib.util.run_cmd(): Fix docstring

The docstring of run_cmd()'s signature documents a wrong return value, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:48:26 +01:00
9373550af6 create-mkdebian.sh: Fix Maintainer + Homepage

There's no "Homepage" meta tag in the .deb files created by jw-pkg, add one.

Also, generate an e-mail address <global.jw-maintainer>@janware.com to go into the Maintainer field. Not ideal, but a low-hanging fruit.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-04 14:45:38 +01:00
45fdf64446 Release 1.0.0-175@suse-tumbleweed/x86_64 2026-03-03 11:22:32 +00:00
cb8389726e Start version: 1.0.0-175 2026-03-03 11:21:55 +00:00
888ea9979a jw.pkg.cmds.distro.CmdDup: Support --donwload-only

Add --download-only to the options of jw-pkg.py distro dup, which makes the command only download packages from the repositories without installing them.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-03 11:24:49 +01:00
6af16d2dca jw.pkg.cmds.distro.CmdInstall: Support --only-update

Passing --only-update should keep "jw-pkg.py distro install" from installing packages that are not already installed on the the system.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-03 11:24:43 +01:00
79d40af558 jw.pkg.cmds.distro.CmdRebootRequired: Add class

Add the command distro.CmdRebootRequired, adding support for "distro reboot-required". The command exits with status code 1 if a reboot is required and 0 otherwise.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-03 11:24:22 +01:00