pkg.run is not evaluated on Debian, fix that. For now it's hacked
into pkg.sh, which is bound to be replaced by Python. The limited
hassle is still worth the detour.
Signed-off-by: Jan Lindemann <jan@janware.com>
Support --remote-owner-base in the command CmdGetAuthInfo. Make it
return what currently --remote-base returned: A URL including the
user / organization specific prefix of the Git remote's URL that
jw-pkg was pulled from.
https://my-company.com/src/theowner/jw-pkg.git
would have a --remote-owner-base of
https://my-company.com/src/theowner
Also, change what --remote-base returns to
https://my-company.com/src
Signed-off-by: Jan Lindemann <jan@janware.com>
Rename the --from-user option to --from-owner. Forgejo supports users
and organizations under the more general term "owner", so that's the
better term.
Signed-off-by: Jan Lindemann <jan@janware.com>
list-repos tries /users/ and /orgs/ to find a working repo URL in a
Forgejo instance, logs a failure and doesn't log anything if it finds
one that works. In the context, that can be mildly confusing,
beautify the output somewhat.
Signed-off-by: Jan Lindemann <jan@janware.com>
Make some incomprensible parser error messages if run_curl() returns
nothing slightly less incomprehensible.
Signed-off-by: Jan Lindemann <jan@janware.com>
base-url is not used as a prefix in its entirety, but massaged in a
janware-specific way. Still is, but at least this commit is a step
towards being more generic.
Signed-off-by: Jan Lindemann <jan@janware.com>
This is a code maintenance commit: some run_xxx() helper functions
take a string, some a list, and some just digest all arguments and
pass them on as a list to exec() to be executed. That's highly
inconsistent. This commit changes that to list-only.
Except for the run_cmd() method of SSHClient, which is still run as a
shell method, because, erm, it's a shell. Might be changed in the
future for consistency reasons.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add a VCS-independent rule rule get-%, currently an alias for
git-get-%, with an empty recipe to keep GNU Make satisfied.
Signed-off-by: Jan Lindemann <jan@janware.com>
Don't use the master branch as target when getting code from
somebody, merge into the branch currently checked out.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add the distro subcommand class CmdPkg, together with a first
subcommand ls, which prints a list of files contained in a package.
Signed-off-by: Jan Lindemann <jan@janware.com>
Deduce module search path for the calling module's subcommands
directly from the module path of the calling module. That's more
generic than the previous detection algorithm, because it recursively
works for subcommands of subcommands as well.
Signed-off-by: Jan Lindemann <jan@janware.com>
Currently git-get-% pulls into the master branch. Change that to pull
into the branch currently checked out in the workspace, because
that's the more likely use case if you want a quick update from
somewhere.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add a command "exec", which takes its arguments and runs it as a
shell command within all projects in $PGIT_SH_PROJECTS.
Signed-off-by: Jan Lindemann <jan@janware.com>
PGIT_SH_PROJECTS currently only sets the projects to operate on for
the get command. Extend this to all commands. And replace the
environment variable by a command-line option, likely after this
script has been ported to Python.
Signed-off-by: Jan Lindemann <jan@janware.com>
"clone" in the Git sense means to copy a remote project over from
scratch. pgit.sh clone has come from that, but has since evolved into
something different, a mixture of clone, pull and fetch, so find a
different name. "get" seems generic enough and doesn't clash with a
Git meaning. Adapt variable names accordingly across the project.
Signed-off-by: Jan Lindemann <jan@janware.com>
Continue to name variables in pgit.sh somewhat more consistently,
notably turn somevar into some_var. Plus some additional cleanup.
Still not a beauty.
Signed-off-by: Jan Lindemann <jan@janware.com>
The fat marker with counter (# ==== [1/1] Fetching ...) is
distracting if shown for only one project, so only show a regular
marker without counter.
Signed-off-by: Jan Lindemann <jan@janware.com>
To be explicit about what's happening during make fetch, default the
fetch refspec to $(CLONE_FROM_USER):current-branch:current-branch.
Signed-off-by: Jan Lindemann <jan@janware.com>
If "current-branch" is specified within --refspec, either as from-ref
or as to-ref, expand that to the branch the working directory has
currently checked out.
Signed-off-by: Jan Lindemann <jan@janware.com>
jw.pkg.lib.Cmd._run() is abstract, but it's nice to give it a default
implementation which calls self.parent._run() in case parent is also
a command class. That allows for some default processing in _run()
for each node up the parent chain.
The children / derived classes just need to make sure all classes in
the hierarchy do:
async def _run(self, args):
return await super()._run(args)
... add main command logic here ..
Signed-off-by: Jan Lindemann <jan@janware.com>
git-pull-<username> doesn't use pgit.sh if username == login.
pgit.sh should handle that case fine now, so remove the distinction
from topdir.mk and make it in one place, i.e. pgit.sh. This has the
additional advantage that pull as done by pgit.sh conveniently uses
--autostash.
Signed-off-by: Jan Lindemann <jan@janware.com>
The cases from-user == login and from-user != login have different
code paths and can be streamlined somewhat, so do that.
Signed-off-by: Jan Lindemann <jan@janware.com>
Purging the environment of pkg-release-reinstall did a tad too much:
Add SSH_AUTH_SOCK back to allow SSH agent-based authentication to go
through.
Signed-off-by: Jan Lindemann <jan@janware.com>
Replace --source-profile by --env-reinit and --env-keep to allow more
fine-grained control over environment manipulation.
Signed-off-by: Jan Lindemann <jan@janware.com>
Replace the boolean parameter "add" with the richer "keep":
- False -> Don't keep anything
- True -> Keep what's in the current environment
- List of strings -> Keep those variables
Signed-off-by: Jan Lindemann <jan@janware.com>
Change commit message of first commit from "initial checkin" to
"First commit", because that's more to the point.
Signed-off-by: Jan Lindemann <jan@janware.com>