Commit graph

4,255 commits

Author SHA1 Message Date
2cc3b59e75 jw.pkg.cmds.distro.backend.BackendCmd -> Backend
Rename jw.pkg.cmds.distro.backend.BackendCmd to Backend, because it's
not necessarily a command, i.e. doesn't necessarily have a run()
method. It's more of a distribution abstraction of the steps needed
for for a specific command, the run() method itself is implemented in
jw.pkg.cmds.distro.CmdXxx.

This commit is the beginning of a bigger move to change the
distribution backend class hierarchy. At the end of this change set,
the backend command should not derive the backend classes from a base
specific to the respective distribution, but from an abstract base
class specific to the command run. The distribution specifics are
then going to be encapsulated in another class called "Util", an
instance of which is going to be provided to the backend as .util
member.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-18 01:20:25 +01:00
b1d4e20295 jw.pkg.util: Add sudo()
Move the body of BackendCmd.sudo() into a function. The rationale
behind that is that its functionality is independent of the calling
object for the most part, so having it in a function instead of a
method is the more modular pattern.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-18 01:20:25 +01:00
cb3ccaa338 pgit.sh: Auto-detect current project in toplevel dir
This commit allows pgit.sh to target not only multiple projects below
a projects-directory, but also one single project. If invoked from
the toplevel directory of a project, it uses that as the only project
it should deal with. This is meant to facilitate running the same VCS
abstraction logic for one project as for many projects. The project
or projects to deal with should probably be specified on the command
line, but changing the auto-detection mechanism buys us what we want
for now with low hassle.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-18 01:20:25 +01:00
f28ee62209 pgit.sh: Make some (!) variable names less messy
Some variable names are too short for global scope ($p, $pdir,
$pdirs), among others. For those mentioned: Make them longer and more
descriptive.

Also add a variable project_name, which denotes what a project is in
a remote repository, and which is currently but not necessarily
always the same as the project directory.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-18 01:20:25 +01:00
9f66cd9c2b Release 1.0.0-164@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-16 00:13:31 +00:00
479e407dcd Start version: 1.0.0-164
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-16 00:12:59 +00:00
2d08c2a12d jw.pkg.App.os_cascade: Add more fields
Add more fields to the OS cascade returned by App.os_cascade, based
on the ID field in /etc/os-release. This includes some new ones,
prefixed by pkg-, revealing which package format is used.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-15 16:13:21 +00:00
26e739ca0d src.python.jw.pkg.App: Add property distro_id
Add @property App.distro_id, returning the ID field of
/etc/os-release. It is supposed to be the most specific part of the
OS cascade.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-15 16:13:21 +00:00
bdb6ae69b3 apt-get install: Add --fix-broken to commandline
apt-get install suggests it wants to be called with -f to clean up
some mess left behind from a previous install. Adding -f in the hope
add it to the install options by default. OTOH, it wants to be called
that without arguments, not sure if always passing it along is a good
idea.

The man page says:

    -f, --fix-broken

   Fix; attempt to correct a system with broken dependencies in
   place. This option, when used with install/remove, can omit any
   packages to permit APT to deduce a likely solution. If packages
   are specified, these have to completely correct the problem. The
   option is sometimes necessary when running APT for the first time;
   APT itself does not allow broken package dependencies to exist on
   a system. It is possible that a system's dependency structure can
   be so corrupt as to require manual intervention (which usually
   means using dpkg --remove to eliminate some of the offending
   packages). Use of this option together with -m may produce an
   error in some situations. Configuration Item:
   APT::Get::Fix-Broken.

Also turn the short options -yq into long options --yes --quiet for
more obvious debugging if something goes awry.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-15 16:13:12 +00:00
c84e119e6f pkg.sh milk-install-log: Clean up Debian filters
Among other atrocities, the Debian path filter contains some horrible
redundancies in an sed regular expression. Be a little less redundant
about it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-15 16:04:59 +00:00
dc94553732 pkg.sh log-install: Log %attr(0777, ...) for links
Not logging any attribute for links, as it's now, breaks Debian's
parser. So, log %attr(0777, $owner, $mode). This fixes the parser on
the Debian side and hopefully leaves the RPM side intact.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-15 16:04:45 +00:00
93c24c657d pkg.sh log-install: -f package-format is ignored
pkg.sh log-install ignores the -f option passed to pkg.sh, and always
defaults to "rpm". Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-15 16:04:39 +00:00
37b436c04f defs.mk: Pass -f $(PKG_FORMAT) to pkg.sh log-install
pkg.sh log-install needs to know what package format it should log
an install for, so specify it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-15 16:04:33 +00:00
143096663d Release 1.0.0-163@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-15 00:12:40 +00:00
f47dd2a8d7 Start version: 1.0.0-163
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-15 00:12:03 +00:00
a967924102 jw.pkg.App: Add property projs_root
projs_root is used read-only by CmdBuild and CmdModules, so add that
property back.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-14 20:59:23 +01:00
75041d5505 src/python/jw/pkg/cmds/CmdDistro: Fix ID regex
The ID regex on /etc/os-release also matches ID_LIKE, which is
obviously nonsense. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-14 20:58:33 +01:00
2f49bc18d4 jw.pkg.cmds.distro.Cmd._backend: Support Kali Linux
If Kali Linux is detected as distribution, use the Debian backend for
package management.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-14 20:41:41 +01:00
060ff5159b jw.pkg.cmds.projects.CmdGetAuthInfo: Fix run_cmd()
CmdGetAuthInfo calls run_cmd() with a list instead of a *-expanded
list of arguments. Fix this to match the current run_cmd() prototype.

And think again if the current prototype conforms to the priciple of
least surprise: Most exec- / run- / whatever- functions do expect
ether a string to be run by the shell, or an argv list.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-14 19:18:48 +01:00
17eb03bb28 dpm.sh: Add it back for building Debian distros
make pkg-install pkg-rebuild-reinstall needs it, so put it back into
service.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-14 18:35:46 +01:00
152fa65f57 project.conf: pkg.requires.jw.devel = jw-pkg-run
jw-pkg-devel doesn't depend on jw-pkg-run, which is wrong, because it
needs jw-pkg.py.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-14 09:20:24 +01:00
0bc06b7c41 jw.pkg.cmds.distro.backend.BackendCmd: Add sudo(opts)
Prepending --login to the argument list of BackendCmd.sudo() fails if
run as root, because BackendCmd.sudo() detects that and leaves the
/usr/bin/sudo out from the exec call. Fix that by adding an
opts: list[str] parameter to sudo, defaulting to an empty list, with
options that should be passed to /usr/bin/sudo.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-14 09:20:24 +01:00
cc8dd012b7 Release 1.0.0-162@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-13 00:12:31 +00:00
e18f26f7cf Start version: 1.0.0-162
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-13 00:12:00 +00:00
ffb84ad8c0 jw.pkg.cmds.distro.backend.Base: sudo --login
On OpenSUSE, run sudo with --login. This picks up a possible
ZYPP_CONF config variable definition in /etc/profile.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-12 20:38:12 +01:00
f669bd0af5 project.conf: pkg.requires.os.devel = make
Add a package dependency on make for the -devel package. Installing
jw-pkg's Makefiles doesn't make much sense without it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-12 20:37:24 +01:00
ec093d3cc9 defs.mk: Add $(wildcard *.socket) to LOCAL_SYSTEMD
By default, install systemd socket definitions found in a config
directory.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-12 20:37:10 +01:00
6f6b7cc85c Release 1.0.0-161@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-11 00:13:46 +00:00
660efa1972 Start version: 1.0.0-161
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-11 00:13:15 +00:00
d50a33d9ab jw.pkg.cmds.lib.Cmd: Define run()
Define run(), which calls _run() in the abstract base class Cmd, not
in lib.Cmd. Otherwise lib.Cmd is not abstract, which will predictably
confuse including code outside of jw-pkg.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-10 10:00:46 +01:00
4932c6816c projects.mk: ?= -assign VERSION_FILE
If VERSION_FILE is not found, trying to include makefile snippets
triggers the attempt to regenerate it. This happened for installed
Makefiles of jw-docker-images: It defines TOPDIR to
/opt/jw-docker-images, projects.mk looks there, but the version file
is installed under /usr/share/doc/packages/jw-docker-images/VERSION.

Allow VERSION_FILE to be overridden including code to keep that from
happening.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-10 10:00:17 +01:00
26cf7f7823 project.conf: Use Group Development/Tools/Building
Change package group from System/Libraries to
Development/Tools/Building because that expresses the purpose of the
package better.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-10 09:59:24 +01:00
ef52a2810a defs.mk: Add $(wildcard *.timer) to LOCAL_SYSTEMD
By default, install sytemd timer definitions found in a config
directory.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-10 09:58:30 +01:00
67e56146f8 lo.mk: Fix warning that targets were not remade
make complains for plugins that soandso.dll has not been remade. The
problem is that it tries to remake all targets of a multi-target.
Split that up into two rules.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-10 09:57:59 +01:00
1e9ab195a6 pgit.sh: Pass --autostash to rebase
Calling make git-pull-xxx from a projects directory stops iterating
projects if one has a dirty workspace. Calling --autostash fixes
that.

With this in place, a failed rebase leaves the local changes behind
stashed. So, after manually fixing the rebase, the stash needs to be
manually reapplied. The commands that led up to the failure are
logged right before, so I have hope that this is learnable, and not
too much of a footgun.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-10 09:55:59 +01:00
05378a6e7e Release 1.0.0-160@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-05 00:21:11 +00:00
00af90c768 Start version: 1.0.0-160
Signed-off-by: janware DevOps <devops@janware.com>
2026-02-05 00:20:39 +00:00
eaa38113bb jw.pkg.App.get_libname(): Fix typo
get_project_refs() is invoked with projects_only=true, which should
read names_only. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-04 16:00:45 +01:00
a55dd8175c jw.pkg.cmds.projects.CmdProjectDir: Fix warning typo
Trying to find the directory of a project should log a warning. It
throws an exception instead. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-02 15:56:19 +01:00
53ba9e6fbe lib.App: Stay functional without autocomplete
If Python's autocomplete is not installed, jw-pkg.py fails to run
commands. Fix that in order stay compatible with minimal excecution
environments.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-02 12:15:41 +01:00
741a3b6db2 make: Install cache-projects.mk
.cache-projects.mk is not installed / packaged, which makes builds
against an installed jw-pkg considerably slower. Change that, at the
risk of making the installed jw-pkg-devel less versatile. This commit
installs a cache file cache-projects.mk, renamed from
.cache-projects.mk, because there's no justification for hiding an
installed makefile. At least I can't think of one.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-02-01 09:50:52 +01:00
4431993665 pgit.sh pull: Rebase target branch before merge
Before merging the remote branch, do a rebase. This may fail and
prompt conflict resolution, but that seems the canonical outcome for
the common use case "interactive make git pull-xxx" with master
out-of-sync.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-31 11:13:41 +01:00
059cdc0fe7 Release 1.0.0-159@suse-tumbleweed/x86_64
Signed-off-by: janware DevOps <devops@janware.com>
2026-01-30 00:21:12 +00:00
3f2a9bffef Start version: 1.0.0-159
Signed-off-by: janware DevOps <devops@janware.com>
2026-01-30 00:20:41 +00:00
845e7a3577 projects-dir.mk: Fix typo JW_PKG_PY_PRJECTS
Fix misspelled variable JW_PKG_PY_PRJECTS.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-29 13:29:50 +01:00
4ff29ba255 projects-dir.mk: Add target pkg-manager-dup
There's pkg-manager-refresh already, so by adding pkg-manager-dup the
distribution can be upgraded by distribution agnostic targets only
through the Makefile. This might come in handy for CI, so add it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-29 12:53:06 +01:00
e075e8902b jw.pkg.cmds.CmdDistro: Default --interactive to true
Better safe than sorry: If things are to happen unattendedly, enforce
the need to explicitly request that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-29 11:32:32 +01:00
6ca4af77d7 jw.pkg.App: Code beautification
Major - but not yet sufficient - code beautification starting from
jw.pkg.App.

  - Make more methods private
  - Rename methods to be more self-explanatory
  - Same for method arguments, notably clean up some inconsistent
    uses of "module" vs "project"
  - Add more type hints

Fix API breakage in the command modules.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-29 11:32:14 +01:00
2bbf5bd8e7 jw.pkg.cmds.projects.CmdRequiredOsPkg: Support --quote
--quote puts double quotation marks around the listed dependencies,
protecting version requirements (>= 1.0) and parenthesis "perl(GD)"
from the shell.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-29 11:28:17 +01:00
26bfda109c cmds.projects.CmdListRepos: Try Forgejo users and orgs
A "username" in jw-pkg terms, as in $(CLONE_FROM_USER), is not
sufficient to identify a remote API URL on a Forgejo server, it can
denote both an organization and a user, so try organizations first,
then users, and stop on the first occasion found.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-01-28 18:11:10 +01:00