Skip to content

Commit

Permalink
Remove tools/, install schematyper on demand
Browse files Browse the repository at this point in the history
We've had a few build/CI flakes due to the `go install` invocations
happening as part of a build.  We previously removed `gomarkdoc`,
this completes things and stops building/installing `schematyper`
by default.

It's only need for developers to regenerate the schema; we commit
the generated code, so we don't need to build or ship it by default.
  • Loading branch information
cgwalters authored and dustymabe committed Sep 13, 2022
1 parent acb4294 commit 484c148
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 38 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ maipo/
*.pyo
*.shellchecked
.coverage
tools/bin
.idea
bin/
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ DESTDIR ?=
# W504 line break after binary operator
PYIGNORE ?= E128,E241,E402,E501,E722,W503,W504

.PHONY: all check shellcheck flake8 pycheck unittest clean mantle mantle-check install tools
.PHONY: all check shellcheck flake8 pycheck unittest clean mantle mantle-check install

MANTLE_BINARIES := ore kola plume

all: bin/coreos-assembler tools mantle
all: bin/coreos-assembler mantle

src:=$(shell find src -maxdepth 1 -type f -executable -print)
pysources=$(shell find src -type f -name '*.py') $(shell for x in $(src); do if head -1 $$x | grep -q python; then echo $$x; fi; done)
Expand Down Expand Up @@ -64,7 +64,6 @@ cosa-go-check:

clean:
rm -f ${src_checked} ${tests_checked} ${cwd_checked}
rm -rf tools/bin
find . -name "*.py[co]" -type f | xargs rm -f
find . -name "__pycache__" -type d | xargs rm -rf

Expand All @@ -78,9 +77,6 @@ $(MANTLE_BINARIES) kolet:
mantle-check:
cd mantle && $(MAKE) test

tools:
cd tools && $(MAKE)

.PHONY: schema
schema:
$(MAKE) -C schema
Expand Down Expand Up @@ -113,5 +109,4 @@ install:
ln -sf ../lib/coreos-assembler/cp-reflink $(DESTDIR)$(PREFIX)/bin/
ln -sf coreos-assembler $(DESTDIR)$(PREFIX)/bin/cosa
install -d $(DESTDIR)$(PREFIX)/lib/coreos-assembler/tests/kola
cd tools && $(MAKE) install DESTDIR=$(DESTDIR)
cd mantle && $(MAKE) install DESTDIR=$(DESTDIR)
2 changes: 1 addition & 1 deletion gangplank/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = $(shell cd .. && git log -n 1 --date=short --pretty=format:%cs.%h~${st
cosa_dir = $(shell test -d /usr/lib/coreos-assembler && echo /usr/lib/coreos-assembler)
ldflags=-X main.version=${version} -X main.cosaDir=${cosa_dir}
buildtags=containers_image_openpgp
export PATH := $(my_dir)/bin:$(shell readlink -f ../tools/bin):$(PATH)
export PATH := $(my_dir)/bin:$(PATH)

PREFIX ?= /usr
DESTDIR ?=
Expand Down
19 changes: 16 additions & 3 deletions schema/generate-schema.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash -xe
#!/bin/bash
set -euo pipefail
topdir=$(git rev-parse --show-toplevel)
mydir=$(dirname $(readlink -f $0))
tdir="${mydir}/tmp"
mkdir -p "${tdir}"
Expand All @@ -11,8 +13,19 @@ echo "Generating COSA Schema ${schema_version}"

out="${tdir}/cosa_${schema_version}.go"

"schematyper" \
"${schema_version}.json" \
schematyper=
if test -f ${topdir}/bin/schematyper; then
schematyper=${topdir}/bin/schematyper
else
schematyper=$(which schematyper 2>/dev/null || true)
fi
if test -z "${schematyper}"; then
env GOBIN=${topdir}/bin go install github.com/idubinskiy/schematyper@latest
schematyper=${topdir}/bin/schematyper
fi

${schematyper} \
${topdir}/src/"${schema_version}.json" \
-o "${out}" \
--package="builds" \
--root-type=Build \
Expand Down
20 changes: 0 additions & 20 deletions tools/Makefile

This file was deleted.

6 changes: 0 additions & 6 deletions tools/README.md

This file was deleted.

0 comments on commit 484c148

Please sign in to comment.