During a topdir "make all", caching variables is currently not the
first thing that happens. Instead, variables are cached as soon as a
project recurses into the make subdirectory. That was necessary,
because some makefiles were regenerated in the make subdirectory by
autoconf, potentially contributing variables that needed to be
cached.
As of now, autoconf is long gone and this is no longer true. And for
some variables, the two step process becomes involved, notably for
PYTHONPATH, which coding agents would like to look at from the topdir
very early on.
This commit moves the .project-cache.mk creation to topdir.mk, and
.projects-cache.mk creation to jw-pkg/Makefile to address that.
Signed-off-by: Jan Lindemann <jan@janware.com>
Every directory should have a test target, and the test target should
depend on all so that all files are generated that might be needed
for testing. This commit fixes some missing targets, and adds some
missing dependencies.
Signed-off-by: Jan Lindemann <jan@janware.com>
At present, the PREREQ-variable is effectively only used to detect if
prerequiste packages haven't run "make all" before make is run in a
given package. Also, it's only useful in $(TOPDIR). This commit
splits the variable up into PREREQ_BUILD and PREREQ_RUN, and makes
the variables available in every Makefile of a package by placing
them in defs.mk instead of topdir.mk.
This also fixes a problem that PREREQ was cached before being filled,
hence empty. Which effectively wasn't much of a problem, because it
was basically unused, but still.
Signed-off-by: Jan Lindemann <jan@janware.com>
The git-get-pub does not have the same effect as the other git-get-%
targets, and this commit makes it.
The other git-get-% targets run pgit.sh, which rebases the current
branch onto the fetched branch, and git-get-pub doesn't. Since devops
merges contributor forges fast-forward without a merge-commit, the
pub remote's master needs to be the last to be rebased on, because
otherwise it will not allow to force-push the result.
As soon as multiple forges with protected master branches contribute,
fast-forward merging of the master branch will need to be abolished
anyway, and the release machinery will need an overhaul.
Signed-off-by: Jan Lindemann <jan@janware.com>
Target all should create all necessary files in topdir. Currently
they're only needed for static file checks, but they might well be
prerequistes for the build to succeed in the future, so make target
all depend on topdir.
Also, place target all before the block of includes, so that the
execution order is defined in topdir.mk rather than the included
snippets.
Signed-off-by: Jan Lindemann <jan@janware.com>
make topdir doesn't reliably regenerate pyrightconfig.json because of
.SECONDEXPANSION. Adding a second dollar symbol $$(TD_GENERATE_FILES)
solves the problem.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add generic machinery to dynamically create files in $(TOPDIR). The
need arises because version controlled configuration files for
linters are going to be introduced.
For that, this commit introduces a variable $(TD_GENERATE_FILES),
which target all depends on, and which topdir.clean removes.
It defaults to another variable also introduced by this commit,
$(TD_COPY_FILES), which in turn defaults to $(TOPDIR)/conf/topdir.
This commit also adds support for JW_PKG_TOPDIR_COPY_PATH. It
supports a PATH-style syntax, which allows pointing to multiple
directories to be checked for source files. If they exist, they will
be appended to the files found in $(TOPDIR)/conf/topdir after
copying. Defining arbitray files to copy is not supported before
security implications during CI runs are better understood.
Having the copy prerequisites work comes at the cost of having to add
.SECONDEXPANSION. Since it's limited to the toplevel Makefile, I
suppose that's acceptable.
Signed-off-by: Jan Lindemann <jan@janware.com>
- Apply some style fixup to topdir.mk. Notably beautify indentation
and move the target area down below the area with the include
statements.
- Add the following targets:
format:
check-syntax:
check-format:
check: check-syntax check-format
These targets currently don't do anything and are meant as hooks
for individual linters to add dependencies.
- Make .PHONY depend on all phony non-pattern targets
- Make all phony pattern-targets depend on FORCE
Signed-off-by: Jan Lindemann <jan@janware.com>
Remove JW_PKG_EXTRA_SSH_OPTS before git pull in the context of
get-pub / git-get-pub because it contains -l username, which collides
with Forge-style git@<forge> remote URIs.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add get-pub for top directory / projects directory level. This is a
janware specific target needed for CI. It integrates the current
master branch from the new Forgejo-based Git repos.
That said, this will likely need to go along with other release
machinery. Packaging is good, but releasing over a bunch of
directories is an intricate process, as-is only usable by janware
itself, and doesn't need to be part of jw-pkg.
Signed-off-by: Jan Lindemann <jan@janware.com>
janware upstream development server moved from git.janware.com to
devgit.janware.com. This commit follows the move with pretty much a
simple
s/git.janware.com/devgit.janware.com/
over jw-pkg. It found 14 matches, that's pretty bad.
FIXME: Reduce the redundancy, or, better, replace the
devgit.janware.com goodies by a more generally useful concept
altogether.
Signed-off-by: Jan Lindemann <jan@janware.com>
With the exception of the "info" subcommand, nearly all of distro's
subcommands deal with package managing, so push them into their own
command category.
Signed-off-by: Jan Lindemann <jan@janware.com>
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>
jw-pkg supports more than RPM-based package managers, but for
historic reasons, lots of its Makefile variables still have "RPM" in
their names. This is misleading. Replace "RPM" in variable names by
the more generic "PKG" where appropriate.
Signed-off-by: Jan Lindemann <jan@janware.com>
make get-official already works as a pattern rule, but this commit
adds it explicitly to make tab-completion work.
Signed-off-by: Jan Lindemann <jan@janware.com>
Use pkg-requires --hide-self to find all prerequisites that should be
installed for a test run against packages installed from the
repositories, including self-built and self-hosted packages.
Signed-off-by: Jan Lindemann <jan@janware.com>
In a push to eventually merge the classes, somewhat align the
command-line API of CmdRequiredOsPkg to the one of
BaseCmdPkgRelations by using dependency flavours as mandatory, first
argument.
Signed-off-by: Jan Lindemann <jan@janware.com>
Move the dependencies listed in BASE_PKGS from projcts-dir.mk and
topdir.mk into project.conf.
Due to various hen-and-egg problems on a minimal system, in some
situations these packages can't be installed from project.conf. The
same is true with BASE_PKGS, however, so remove it, at least that
does away with some redundancy.
Signed-off-by: Jan Lindemann <jan@janware.com>
Make pkg-install-testbuild-deps an alias for
pkg-install-release-deps. At this point, they do nearly the same
thing, and the distinction between what the implementations should do
are blurry at best. This commit removes redundancy but keeps the use
cases distinct. Different implementations can be reinstantiated
should requirements for different implementations become clearer
later on.
Signed-off-by: Jan Lindemann <jan@janware.com>
The code below lib.distro, as left behind by the previous commit, is
geared towards being directly used as a command-line API. This commit
introduces the abstract base class Distro, a proxy for
distribution-specific interactions. The proxy abstracts distro
specifics into an API with proper method prototypes, not
argparse.Namespace contents, and can thus be more easily driven by
arbitrary code.
The Distro class is initialized with a member variable of type
ExecContext, another new class introduced by this commit. It is
designed to abstract the communication channel to the distribution
instance. Currently only one specialization exists, Local, which
interacts with the distribution and root file system it is running
in, but is planned to be subclassed to support interaction via SSH,
serial, chroot, or chains thereof.
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>
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>
"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>
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>
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>
Use pgit.sh to for the git-pull-% target. This should make
git-pull-maintainer work. To limit the blast radius for now, only use
it if the source user differs from the invoking user.
Signed-off-by: Jan Lindemann <jan@janware.com>
--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>
Retire pkg-manager.sh and replace it by the cleaner "jw-pkg.sh
distro" command, essentially providing the same functionality and
nearly the same command-line interface.
Not-so-fun-fact:
jw-pkg > git diff --stat jw-devops/master
...
71 files changed, 732 insertions(+), 340 deletions(-)
400 LOC more. That's what the move from a shell script to the more
maintainable Python versions costs. Still a good idea, and the
enhanced extensibility might pay off in terms of LOC with other shell
scripts in the future.
Signed-off-by: Jan Lindemann <jan@janware.com>
jw-projects.py is now a multi-call executable, with "projects" being
just one of its subcommands. Rename it to jw-pkg.py to reflect that.
Signed-off-by: Jan Lindemann <jan@janware.com>
Reorganize the Python module structure. Placing the command classes
under jw.cmds.projects instead of jw.build.cmds will allow to add a
nested command structure, with the current commands, being mostly
related to building software, found below a "projects" toplevel
command.
Other conceivable commands could be "package" for packaging, or
"distro" for commands wrapping the distribution's package manager.
Signed-off-by: Jan Lindemann <jan@janware.com>
Define Q ?= @, and replace @<command> in recipes by $(Q)<command>.
Meant to be overridden from the environment for debugging as in
Q= make
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit aims at improving speed by using better caching.
- Makefile, cache.mk: Split .cache.mk up
To allow caching of runtime path variables which are
project-specific, split .cache.mk up in .cache-project.mk and
.cache-projects.mk
- ldlibpath.mk: Cache ldlibpath, exepath and pythonpath
Place the output of $(call proj_query ldlibpath), $(call
proj_query, exepath) and $(call proj_query pythonpath) in
JW_PKG_LD_LIBRARY_PATH, JW_PKG_EXE_PATH, and JW_PKG_PYTHON_PATH
respectively, and cache the variables in make/.project-cache.mk.
- cache.mk: Use = instead of :=
Recursively expanded variables are nearly as fast as := variables
if the assigned value is a fixed string. And sometimes it's not,
rightly so, because variables get assigned below, as with
JW_PKG_XXX for instance.
- cache.mk: Use $(TOPDIR) as variable values
Replace absolute references to project's topdir by $(TOPDIR) with
sed. As soon as the project queries produce absolute paths, they
will be transformed into relative paths which allow the code base
to be moved to a different location and still remain functional
without a rebuild.
Signed-off-by: Jan Lindemann <jan@janware.com>
There's little system in the pkg-install-xxx targets, add one more to
increase the confusion. It's needed to install all packages needed to
do a standalone build against the packages installed into the system
via package manager. That said, the respective jw-projects.sh
commands need broader refactoring, as well as the pkg-install-xxx
target naming.
Signed-off-by: Jan Lindemann <jan@janware.com>
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>
git-pull-% pulls whatever $(GIT_MAIN_BRANCH) happens to be
from the remote jw-% into the current branch, with --rebase and
--autostash.
git-pull-maintainer does the same with <maintainer>. <maintainer> is
figured out from the configuration in projects.conf. If it's the
invoking user, origin is used.
Signed-off-by: Jan Lindemann <jan@janware.com>