Commit graph

30 commits

Author SHA1 Message Date
4ad7091159 cmds.CmdBuild: import time
import time is missing from CmdBuild, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-28 20:18:52 +01:00
441051ea4a jw.pkg: Add Makefile
Re-add Python modules into the installed package by adding
src/python/jw/pkg/Makefile.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-28 15:34:24 +01:00
6340eeace9 Everywhere: Replace "jw_build" by "jw_pkg"
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-28 13:35:56 +01:00
9217d38964 Everywhere: Rename package "jw-build" to "jw-pkg"
jw-build doesn't stop at building software, packaging it afterwards
is also a core feature, so this commit gives the package a better
name.

The commit replaces strings s/jw-build/jw-pkg/ in text files and file
names. Fallout to the functionality is fixed, variable names are left
as they are, though. To be adjusted by later commits.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-28 13:35:56 +01:00
fc02dad92c projects-dir-minimal.mk: Default PROJECTS_DIR_REMOTE_BASE to jw-build's remote
If jw-build is already cloned, infect all other repositories with its
remote via PROJECTS_DIR_REMOTE_BASE.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 16:54:04 +01:00
f4106e9da2 build.lib.cmds.SSHClient: Fix dtor exception
SSHClient's destructor raises an exception because of broken
os.environ syntax, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 15:48:13 +01:00
babf58e2dd build.lib.cmds.SSHClient: Finish __init_askpass()
Finish and test the __init_askpass() method, works.

__init_askpass() had never been tested. Finish it and make sure it
works.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 12:42:45 +01:00
27e9b23849 build.cmds.CmdListRepos: Support username/password authentication
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 11:29:50 +01:00
50744fc41e build.cmds.CmdListRepos: Pass -f to curl
curl exits with 0 success status, even if the server returns HTTP
401. Passing -f fixes that and has curl error out with exit code 22.
It doesn't show which error, though.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 10:56:47 +01:00
150bc97fc9 build.lib.util, build.App: Beautify exceptions
Make exceptions somewhat more readable.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 10:44:14 +01:00
9d06e0bf2e CmdGetAuthInfo: Code beautification
Fix clumsy code printing auth info.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-20 10:26:16 +01:00
e95f91aff8 CmdGetAuthInfo: Fix: Suppress user name "None"
Don't print username="None" if there's no such user

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-19 20:00:13 +01:00
f750b2cf05 CmdGetAuthInfo: Don't use non-git jw-build
Don't try to use non-git jw-build repositories to retrieve auth info.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-19 09:15:13 +01:00
bf6a83ccac build.cmds.CmdListRepos: Fix ssh://git.janware.com
A typo breaks enumeration of Git repos on git.janware.com, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-19 08:40:24 +01:00
1187c10c86 build.cmds.GetAuthInfo: Add module
Add command get-auth-info to jw-projects.py. It is meant to retrieve
JANWARE_USER from an already cloned jw-build tree.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-19 08:14:43 +01:00
d484749b79 cmds.CmdListRepos: Don't import from lib
Don't directly import from lib (i.e. from __init__.py), because that
won't work until "make all" has not run through, i.e. during fresh
checkout.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 20:09:23 +01:00
9b85b3e8a6 build.cmds.CmdListRepos: Add module
Add the command list-repos to jw-projects.py. It is meant to do the
same thing as "git-srv-adm.sh list-personal-projects", i.e. enumerate
remote Git repositories, but also support additional servers and
protocols.  As of this commit, support for https://github.com and for
forgejo installations over HTTPS is implemented.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 12:56:14 +01:00
b5ab0a3d26 build.lib.SSHClient: Add module
SSHClient(hostname) is an abstract class for SSH / SCP operations. It
comes with two implementations, SSHClientInternal an SSHClientCmd.
The former needs paramiko installed, which might be a reason to fail
on unprepared systems, the latter is slower and more limited.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 12:11:31 +01:00
9f15868dd4 build.lib.utils: Add module
Add some utility functions, namely:

  run_cmd(cmd: list[str], wd=None, throw=True, verbose=False) -> str|None
  run_curl(args: list[str], parse_json: bool=True) -> dict|str
  get_username(args: Namespace|None=None, url: str|None=None) -> str
  get_password(args: Namespace|None=None, url: str|None=None, askpass_env: list[str]=[]) -> str

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 12:07:02 +01:00
bc2033490f jw.build.lib: Add module
Add jw.build.lib as a location for generic utility modules.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 12:05:58 +01:00
a863bb9747 jw.build.App: Unroll run_from_cmd_module()
run_from_cmd_module() is a helper function used to allow command
selection alongside the legacy and now obsolete method. Unrolling it
is a step towards adding proper argparse subparsers, so do that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 15:42:16 +01:00
75820eee7c jw.build.App: Fix commands missing from help message
jw-projects.py --help doesn't list the commands, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-18 15:41:28 +01:00
0cd5ffa378 jw.__init__.py: Add empty file
Make $(TOPDIR)/src/python/jw a module. Needed since $(TOPDIR/make
now also runs jw-python.py.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-16 19:43:49 +01:00
ded9588396 jw.build: Disable generation of __init__.py
The default behaviour of a generated __init__.py is to load all
exported symbols in the respective directory. Since jw-python.py is
invoked often, this hampers performance, so disable it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-16 18:44:46 +01:00
2a67708fb1 build.cmds.BaseCmdPkgRelations: Add Module
For requires, provides and conflicts, isolate the bulk of the code in
BaseCmdPkgRelations, then derive CmdPkgConflicts, CmdPkgProvides and
CmdPkgRequires from that class.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-16 18:05:10 +01:00
31537a0bd6 build.cmds.CmdCreatePkgConfig: Add module
Implement the functionality of create-pkg-config.sh in a Python
module CmdCreatePkgConfig.py. This allows to remove
create-pkg-config.sh and jw-build-functions.sh.

Note that the translation was done pretty literally to play it safe.
More code can and should be removed by taking advantage of the fact
that jw-projects.py knows more about the project than the shell
scripts.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-16 17:31:16 +01:00
3370dd6236 build.App: Remove some cruft
Remove code

  - Explicitly marked as unused
  - Meant to provide Python2 compatibility
  - Meant to run App.py as main module
  - Turned obsolete by removing the command functions from
    Projects.py

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-16 14:26:03 +01:00
ac583f76e1 build.cmds: Move build.App.cmd_xxx() here
For every cmd_xxx() method in build.App, create a class that's
instatiated for running the respective command. This has the
advantage of making App.py smaller (and faster), and having smaller,
more maintainable command modules adhering to a common interface.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-16 11:39:27 +01:00
17bf98cb7a build.Cmd: Add module
Cmd is meant as a base class for classes representing commands
currently still implemented as methods of the Project class.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-15 14:41:07 +01:00
aa3e2efd84 projects.py: Move bulk of code into module
Move nearly all of projects.py into src/python/jw/build/App.py. The
plan is to split the script into parts and import them.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-15 11:08:52 +01:00