Commit graph

4,519 commits

Author SHA1 Message Date
63383cb683 lib.util.copy(): Add function

Add copy(src_uri, dst_uri), instatiating two ExecContext instances, and doing the obvious with them - copying from src_uri to dst_uri.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 12:55:47 +02:00
d803c66f70 App.__os_release(): Use ExecContext.get()

The property App.__os_release uses _run(['cat', '/etc/os-release']), use ExecContext.get() instead as the default way to fetch content.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:26 +02:00
60630676ef App.__aexit__(): Use to close exec context

Override lib.App.__aexit() to call close() on the App.exec_context instance if it exists.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:25 +02:00
3d27cc09d9 lib.App.run_sub_commands(): Instantiate as context manager

App currently has no hook to close async resources. Call it as context manager, so that __aexit__() gets invoked if run_sub_commands() exits.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:25 +02:00
4f17a9cc93 lib.ExecContext.log_name: Add property

Add a .log_name property to be used in log messages.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:25 +02:00
1214451c15 lib.ExecContext.close(): Add method

Add ExecContext.close() as a hook to clean up async resources living longer than an ExecContext method call.

Also, implement __aenter__() and __aexit__(), to allow using ExecContext as context manager. close() is invoked it goes out of scope.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:25 +02:00
f158ab76a8 lib.ExecContext: Add get(), _get(), put() and _put()

Add wrapper methods get() and put(), plus their wrapped methods _get() and _put(). The wrapped methods have default implementations, using POSIX utilities on the target machine over _run().

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:25 +02:00
dbf41d7b48 lib.ExecContext.create(): Support path-only URIs

ExecContext.create() relies on properly formed URLs with a schema for deciding which backend gets created. Create a Local instance if an URL doesn't have schema.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:25 +02:00
04b294917f lib.ExecContext: Support bytes-typed cmd_input

The Input instance passed as cmd_input to ExecContext.run() and .sudo() currently may be of type str. Allow to pass bytes, too.

At the same time, disallow None to be passed as cmd_input. Force the caller to be more explicit how it wants input to be handled, notably with respect to interactivity.

Along the way fix a bug: Content in cmd_input should result in CallContext.interactive == False but doesn't. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:25 +02:00
8ef478e63f lib.ExecContext: Code beautification

- Move _sudo() above sudo()

To have a pattern in lib.ExecContext and avoid future churn: If a public wrapper calls a protected method, define the protected method above the respective wrapper.

- sudo(): Make cmd_input default equal to run(): InputMode.OptInteractive

- CallContext: Expose parameters throw, wd, cmd as properties for later use
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-16 10:21:16 +02:00
3ce893b74b Release 1.0.0-203@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-13 16:06:46 +00:00
4c417adedd Release 1.0.0-203@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-13 15:33:06 +00:00
fc6f6597c5 Start version: 1.0.0-203
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-13 15:32:17 +00:00
fcf3836aae build-package.yaml: Add workflow

Make building jw-pkg packages via reusable.yaml the default for pushes and pull-requests.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-13 17:23:13 +02:00
281cdf4ec7 cmds.projects.CmdCanonicalizeRemotes: Add command

CmdCanonicalizeRemotes / canonicalize-remotes and the respective target in topdir.mk remove the /srv/git portion from all remotes' URLs pointing to git.janware.com.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-13 12:23:02 +02:00
d8653ac486 Remove /srv/git from janware Git URLs

git.janware.com has /srv/git removed from its Git URLs, follow suit.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-13 12:15:37 +02:00
1b2ebab33a lib.App.__run(): Beautify error logging

Without --backtrace, the outmost try-catch block logs exceptions plainly as their text. If it catches a key error, the exception text only consists of the key itself, which can be easily mistaken for a normal program output, so prefix it with a "Failed:".

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-13 12:14:03 +02:00
e33bc8e793 Release 1.0.0-202@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-11 15:52:02 +00:00
9e41b15435 Release 1.0.0-202@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-11 15:40:25 +00:00
1715189d61 Start version: 1.0.0-202
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-11 15:39:35 +00:00
5ad65f85fd cmds.secrets.lib.util: Add module

To be able to use secret handling code from other modules, move the bulk of it from the "secrets"-command centric implementation in cmds.secrets.Cmd into a new module cmds.secrets.lib.util.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:56:21 +02:00
d680d6c5ed lib.ec.ssh.Exec._run_ssh(): run_cmd(throw=False)

_run_ssh() of ssh.Exec doesn't pass throw=False to run_cmd(), which makes it throw exceptions, and effectively strips the caller of any chance to get hold of stdout and stderr. Pass throw=False and let run() decide according the the caller-provided throw parameter whether or not a problem should propagate up as exception or return value.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:55:30 +02:00
a58220a131 lib.ec.SSHClient.ssh_client(): Add type parameter

ssh_client() tries a predefined order of client class implementations until it finds a workable candidate. For testing all, it's desirable to be able to target the exact class. Add a "type" parameter to achieve that.

I'm aware that type is also a function. But the semantics look so compelling to me that I'm using the variable name anyway.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:53:12 +02:00
bafc7fed2a lib.ec.ssh.Exec: Honour self.interactive

The Exec SSHClient ignores the "interactive" argument passed to its constructor, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:53:07 +02:00
84375cd482 lib.ec.ssh: Don't quote shell operators

Naively join()ing a command list to be executed remotely via SSH also quotes shell operators which doesn't work, of course. Work around that. The workaround will not always work but covers lots of cases.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:52:15 +02:00
61c1a628a1 lib.ec.SSHClient: Exception for empty host name

Instantiating a SSHClient-derived class with an invalid or missing uri parameter is accepted and fails later down the road. Raise an Exception early on to make the error log more comprehensible.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:51:50 +02:00
0e18d4abac lib.ec.ssh.Exec|Paramiko: Don't # export

The SSHClient classes Paramiko and Exec are exported via # export. This is a bad idea, because if Paramiko is not installed, none of the other's can be instantiated either: On the attempt to load them, __init__.py is loaded first and fails. SSHClient.ssh_client() knows what to do, no need to auto-import them into the lib.ec.ssh module.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:51:19 +02:00
41b0b8f023 defs.mk: Remove installation type SCRIPT

Installation type SCRIPT has beed disabled long ago because of its overlap with EXE. Remove the dead code around it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:51:11 +02:00
30c4d7101f projects-dir.mk: list-files: Don't use /usr/bin/file

/usr/bin/file <candidate> | grep text is used to detect if a file is a text file or not. Replace that with grep -I., because that adds some files left out by /usr/bin/file, notably systemd service files.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:50:44 +02:00
1caae611ba App.os_release: Fix debug logging

cat /etc/os-release sometimes fails over the wire, and the reason should be logged but isn't. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-11 14:50:24 +02:00
2852c65bf1 Release 1.0.0-201@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-09 05:28:39 +00:00
f98236a941 Release 1.0.0-201@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-08 23:10:04 +00:00
0ce734ae57 Start version: 1.0.0-201
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-08 23:09:15 +00:00
c5c621366b scripts/usr-bin: scripts.mk -> std-targets.mk

jw-pkg is copied into $(TOPDIR)/bin during build, that's wrong. Write a rule precisely targeted at installing /usr/bin/jw-pkg, and cut all the scripts.mk machinery.

Also, make jw-pkg a relative link to avoid the respective RPM warning.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-08 16:47:00 +02:00
98ad7442d9 cmds.projects.CmdListRepos: Beautify error logging

Call run_curl() with parse_json=True to make that explicit, and be a little more verbose about the outcome.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-08 10:49:58 +02:00
f18575a267 lib.util.run_curl(): Add decode parameter

run_curl() has no clear API of whether or not the return values should be decoded. It has parse_json, which should imply decoding, but there's no way to specify that explicitly. Moreover, when it tries to decode, it decodes on the coroutine returned from run_cmd(), not the awaited coroutine return value.

Add a decode parameter, defaulting to False, change the parse_json parameter's default from True to False, and fix the run_cmd() return value evaluation.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-08 10:49:52 +02:00
5fded01d00 cmds.projects.CmdListRepos: Init SSHClient with app opts

Use the global --verbose and --interactive command-line options as defaults for constructing a SSHClient instance for use with listing repos over SSH.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-07 15:39:29 +02:00
5ae2dde608 pgit.sh list-repos with --interactive false

pgit.sh list-repos runs jw-pkg.py projects list-repos. Interactivity hurts here, turn it off.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-07 15:38:00 +02:00
5af68a6541 projects-dir-minimal.mk: get-auth-info --interactive false

PROJECTS_DIR_REMOTE_BASE and JANWARE_USER is determined by jw-pkg.py get-auth-info. Interactivity hurts here, though, turn it off.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-07 15:34:52 +02:00
1029cdca25 Release 1.0.0-200@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-06 23:22:27 +00:00
9287153211 Release 1.0.0-200@kali-rolling/amd64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-06 23:08:52 +00:00
9fa63bb35e Start version: 1.0.0-200
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-06 23:08:04 +00:00
40511947c9 cmds.projects.BaseCmdPkgRelations: Add --hide-jw-pkg

Support --hide-jw-pkg. This is a step towards replacing required-os-pkg, which leaves out packages from pkg.requires.jw sections.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-06 16:47:46 +02:00
ad0e03f14c cmds.projects.BaseCmdPkgRelations: Fix cross-sec deps

If a package P is added, only those of its dependendencies are added along which are in the same os-cascade section as P. That's wrong, fix it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-06 16:02:34 +02:00
a0dcf59277 cmds.projects.BaseCmdPkgRelations: Better variables

Make variable names a little more readable and searchable within the long pkg_relations_list() method by making their names longer and truer to what they actually mean.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-06 16:02:34 +02:00
8c34dae526 cmds.projects.CmdPrereq: Remove class

CmdPrereq was mostly redundant to PkgRequired all along. CmdPrereq has grown more versatile, and CmdPrereq is not used throughout jw-pkg anylonger by now. Remove it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-06 16:02:34 +02:00
18a2ee6c99 App.get_value(): Beautify debug logging

Enclose sections / keys taken from project.conf in [square.brackets], hinting at what they are supposed to mean.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-06 16:02:27 +02:00
af6de30546 scripts/usr-bin: Install symlink /usr/bin/jw-pkg

Install a symlink /usr/bin/jw-pkg -> /opt/jw-pkg/bin/jw-pkg.py in order to have jw-pkg in $PATH.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-06 15:58:11 +02:00
67eab4b864 pgit.sh: Fix log_start_stop()

log_start_stop() is responsible for logging markers at the beginning and end of a decorated log. They should not be applied if pgit.sh is run with --porcelain. In fact, they are, and vice versa. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-04-06 15:57:30 +02:00
25bde31d75 Release 1.0.0-199@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-04-04 17:22:55 +00:00