* If `$COCKPIT_BOTS_REF` is set, check out that bots version instead of
master.
* Use git cache in $XDG_CACHE_HOME if available. Our CI uses that to
save downloads, and it does not get in the way for local developers.
* Stop making "bots" a phony target, and drop the now unnecessary
`[ -d bots ]` check.
Closes#233
Commit 95b2aff0 was a thinko -- for our CI we *don't* want our test to
clobber a pre-existing bots/ checkout, as we often use this to run tests
against an updated image or to validate a changes to the bots project.
On developer machines, bots may also be a symlink to an actual bots
directory in development, so don't clobber that.
Closes#232
This is meant to only control webpack. But `npm install` skips
installing `devDependencies` under `NODE_ENV=production`, which breaks
the package build. So always unset it for npm.
This fixes `NODE_ENV=production make` in a clean tree.
`npm install` does not update/touch an already existing
package-lock.json. Thus after
make
touch package.json
make
a subsequent `make` would still run `npm install`. To fix this, remove
package-lock.json before `npm install`, so that (1) package-lock.json
always gets touched and thus the make rule actually works, and (2)
during development we always get up to date packages (we only really
want the "locking" behaviour for building from release tarballs).
Also run `npm prune` so that switching between git trees with
added/removed modules works correctly.
Closes#223
npm install has been generating package-lock.json [1] for long enough
for us to start relying on it.
Replace the unreliable and hacky `$NODE_MODULES_TEST` file with just
comparing package.json against package-lock.json to decide when to run
npm install. This will finally avoid unnecessary `npm install` runs, but
start to run these when git switching branches that have a different
package.json.
Ship package-lock.json in release tarballs, so that node_modules/ can be
reconstructed exactly as it was when making the release.
[1] https://docs.npmjs.com/files/package-lock.jsonCloses#222
The previous fix (commit 6e05f5b483) only cleaned
test/images/$(TEST_OS), which is just a symlink to $(TEST_OS).qcow.
Clean the actual image as well.
Closes#46
Remove the entire previous overlay instead of just removing the built
package. This ensures that there are no leftovers from previous
interactive debugging sessions.
This has already shown to lead to confusion in practice in
cockpit-podman.
Closes#44
When the topmost commit isn't tagged, rpmbuild otherwise fails with
error: line 2: Illegal char '-' (0x2d) in: Version: 176-1-g9101a30a
Replace the dashes from `git describe` with periods, to get a valid RPM
upstream version number.
Closes#45
This is only being used for extracting the package name from package
json, to avoid having to duplicate it in `Makefile`.
But for only this purpose, Python 3 is rather heavyweight. It's also not
available on RHEL/CentOS 7.
Our release tarballs only contain files, not their containing
directories, due to `git ls-files`. tar creates these directories on the
fly on unpack, with a current timestamp instead of an archived one. This
causes directories in src/ to be newer than dist/ and thus a `make` will
try to rebuild the webpack. This breaks RPM builds.
Release tarballs already have dist/. We can't rebuild the webpack in an
RPM as that requires npm and network access for `npm install`. But we
also don't want to ship the entire `node_modules/` as that is huge and
would require lots of careful license review.
So ship a stub node_modules/ that satisfies the Makefile dependency.
Make sure that this is not newer than package.json or anything in dist/,
so that none of the Makefile's rebuild rules trigger.
Closes#36
When building in production mode, there is no index.js, just an
index.min.js.gz. This previously caused unnecessary rebuilds, or even
RPM build failures in environments where npm was not available. Test for
index.html instead, which is reliable.
Also factor this out into a constant to make it easier to adjust in
forked projects.
This is easier to handle downstream, as the spec file can be used as-is,
instead of having to get rebuilt.
Adjust the clean rule to only remove the .spec if the .spec.in exists,
so that it gets removed in the upstream git, but not in unpacked release
tarball trees.
Building the *.po files requires the `po2json` module, so add a
dependency to it.
Put the example node module into a variable to avoid repeating it. Also
test for `po2json` instead of `react-lite`, as the latter is more likely
to get replaced by actual projects in favor of the full React.
Closes#33
Rename some files and change some identifiers to be neutral to the
application name. This makes it simpler to change everything to a proper
name when cloning this project.
Document in the README how to find the remaining places to change.
Closes#20
With this one does not need to type the full path to the VM. This is
useful to demonstrate how to use other test frameworks than cockpit's
test API.
Closes#19
Cockpit's testlib.py has no stable API guarantee, so check it out from a
stable tag instead of master. This should occasionally be bumped to stay
current.
Note that the same does not apply to bots/: Stable tags are useless
there as the old images get cleaned up. Also, testvm.py API needs to be
stable for Cockpit's own purposes already.
This needs to drop the slight git checkout optimization, but this also
makes the code more symmetric and easier to understand.
Closes#18
Don't always rebuild on "make" (in the phony "all" target), but
introduce a real file target dist/index.js and its requisites. This gets
rid of the "install-only" target, which is very non-standard and would
not on an unbuilt tree anyway.
Also add a "devel-install" target that does the usual symlinking of the
built source tree into ~/.local/share/cockpit.
Closes#17
This makes sure we always include all files in the repository when
disting.
Obsoletes webpack-with-stats, which had a bug anyway: it wasn't
reporting jslint errors.
This moves us one step closer to a normal source package. The sources
are now unpacked and we run "make install". We still don't build
since we don't have all the necessary tools.
Also, most importantly, the source tarball now includes our actual
sources in addition to the prebuilt binaries.