compression-webpack-plugin fixes https://www.npmjs.com/advisories/1548
Adjust to new copy-webpack-plugin API.
Thew new modules now create dist/index.html.gz in `NODE_ENV=production`
mode, so switch `WEBPACK_TEST` to index.css instead (which remains
uncompressed in both modes).
We previously made directories depend on files for the synthetic
serialization of git commands. git does not track directories, and
time stamps across repos (starter-kit vs. bots) work rather poorly --
for example, this broke "bots" being a symlink to a previously existing
checkout.
Use file locking instead, which is a more direct way of ensuring that
there is only one git operation that affects the current checkout. We
don't need to flock bots/, as that's an independent git repository.
Closes#371
This is a relatively recent git feature which is not present in e.g.
Debian 9 yet. Use `git reset` instead, like in the test/common rule.
Fixes#369Closes#370
The `bots`, `test/common`, and `src/lib/patternfly` targets cannot be
run in parallel, as they compete for the git lock.
Serialize them by adding arbitrary dependencies to them.
Avoid phony dependencies, as they break timestamp comparison and thus
always cause rebuilding of the tarball, rpm, and (the very expensive) VM
for each `make check`, even if only the tests (or nothing at all)
changed.
Use `rpmspec` to predict the name of the built rpm. Use the .spec.in
file directly, as we can't depend on the generated .spec file in the
variable definition.
Closes#290
Use `%{VERSION}` as version macro instead of `@VERSION@`, so that the
.spec.in file is syntactically a correct spec file that can be parsed
with `rpmspec`.
We don't need the full cockpit metapackage with cockpit-docker, etc.
The starter-kit RPM will already pull in cockpit-system, so we just need
cockpit-ws.
* 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