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.
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.
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.
"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.
Continue to name variables in pgit.sh somewhat more consistently, notably turn somevar into some_var. Plus some additional cleanup. Still not a beauty.
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.
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 ..
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.
sudo is certainly not needed for the run package (which in itself is hardly useful at all), so move that dependency into the devel package. Same for gawk. /opt/jw-pkg/bin/get-os.sh depends on it, but I don't see where else but in a -devel context that would matter. And if it breaks something, it is going to be an easy fix without awk.
invocations. Those invocations typically happen in the context of pkg-%install, so add that target, specializing the pkg-% target.
The problem this solves is that /etc/profile is currently read only once before bootstrapping all software on a pristine system is started. This might lead to the situation that package A has installed environment variable definitions into /etc/profile.d, package B needs them for building, but never gets to read them.
Add a function get_profile_env(), a function returning environment variables from /etc/profile. Pass add=True to add its contents to the existing environment dictionary, overwriting old entries, or pass False to get the pristine content.
Add a parameter "output_encoding" to run_cmd(). The parameter allows the caller to specify if the output encoding should be detected as is by passing None (the default), if the output should be returned as undecoded bytes by passing the special string "bytes", or if the output should be treated as the encoding with the specified name and decoded to strings.
Don't log an Exception as {e} but as str(e) producing nicer output. Or as repr(e) if a backtrace is requested, because to people who can read backtraces, type info might be of interest. Also, remove pointless time stamps, those belong into the logging framework.
dc945537 (pkg.sh log-install: Log %attr(0777, ...) for links) fixed packaging symlink for Debian-based distros, but produces a warning on RPM based distros: Links may not have explicit attributes, so go back to not specifying them at all for RPM.