Files
mixer-tools/Makefile
T
Tudor Marcu 97cbbfd480 Release v5.3.0
This release includes the following updates:
- Revert bundles:Update os-release file with mix info
- Add minversion header to MoM
    When the minVersion argument is provided to createManifests
    populate a header in the MoM with this version. If no flag is
    provided and the previous MoM had a minversion set populate the
    new MoM with this version.

    Write the minversion to the manifest header when the minversion
    != 0.  Since we only set minversion for the MoM the minversion
    will only be written to the MoM and not to bundle manifests.
- Fix warnings message in checkNotContains() for helpers_test
- Update comment parsing for package files to ignore # and trim
  white space

Critical Updates:
----------------
* New format bump process script (afb.sh) and test added to describe
the new format bump flow that should be followed. It outlines a much
simpler way to do bumps, and does not require moving back and forth
between formats or tooling.

* Do not update deletes over minversions
    Minversions should not update deleted files to the minversion as
    this may cause swupd to attempt to delete content twice. This
    exacerbates issues where a directory (/usr/local/bin) was
    mistakenly deleted in a version because it was mistakenly added
    earlier. Updating the delete to the minversion then causes the
    directory to be deleted off the client system again.

* Enable backwards compatible build update
    This commit enables mixer to write different manifest formats
    based on the configured format value. When introducing a
    breaking change to a manifest it will be registered with
    the format it requires. Existing template is registered to
    everything through format25 to remain compatible with Clear
    Linux OS format. Everything above the current format gets the
    new template, in this case with the minversion added to the MoM.

    This means that format bumps do not need two different versions
    of mixer installed since it will always know how to build the
    correct format based on the configured value.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-10-15 11:26:07 -07:00

121 lines
3.6 KiB
Makefile

# Makefile used to create packages for mixer-tools. It doesn't assume
# that the code is inside a GOPATH, and always copy the files into a
# new workspace to get the work done. Go tools doesn't reliably work
# with symbolic links.
#
# For historical purposes, it also works in a development environment
# when the repository is already inside a GOPATH.
include Makefile.bats
.NOTPARALLEL:
VERSION=5.3.0
GO_PACKAGE_PREFIX := github.com/clearlinux/mixer-tools
.PHONY: gopath
# Strictly speaking we should check if it the directory is inside an
# actual GOPATH, but the directory structure matching is likely enough.
ifeq (,$(findstring ${GO_PACKAGE_PREFIX},${CURDIR}))
LOCAL_GOPATH := ${CURDIR}/.gopath
export GOPATH := ${LOCAL_GOPATH}
gopath:
@rm -rf ${LOCAL_GOPATH}/src
@mkdir -p ${LOCAL_GOPATH}/src/${GO_PACKAGE_PREFIX}
@cp -af * ${LOCAL_GOPATH}/src/${GO_PACKAGE_PREFIX}
@echo "Prepared a local GOPATH=${GOPATH}"
else
LOCAL_GOPATH :=
GOPATH ?= ${HOME}/go
gopath:
@echo "Code already in existing GOPATH=${GOPATH}"
endif
.PHONY: build install clean check
.DEFAULT_GOAL := build
build: gopath
go install -ldflags="-X ${GO_PACKAGE_PREFIX}/builder.Version=${VERSION}" ${GO_PACKAGE_PREFIX}/mixer
go install ${GO_PACKAGE_PREFIX}/mixin
go install ${GO_PACKAGE_PREFIX}/swupd-extract
go install ${GO_PACKAGE_PREFIX}/swupd-inspector
go install ${GO_PACKAGE_PREFIX}/mixer-completion
install: gopath
test -d $(DESTDIR)/usr/bin || install -D -d -m 00755 $(DESTDIR)/usr/bin;
install -m 00755 $(GOPATH)/bin/mixer $(DESTDIR)/usr/bin/.
install -m 00755 $(GOPATH)/bin/mixin $(DESTDIR)/usr/bin/.
install -m 00755 $(GOPATH)/bin/swupd-extract $(DESTDIR)/usr/bin/.
install -m 00755 $(GOPATH)/bin/swupd-inspector $(DESTDIR)/usr/bin/.
$(GOPATH)/bin/mixer-completion bash --path $(DESTDIR)/usr/share/bash-completion/completions/mixer
$(GOPATH)/bin/mixer-completion zsh --path $(DESTDIR)/usr/share/zsh/site-functions/_mixer
test -d $(DESTDIR)/usr/share/man/man1 || install -D -d -m 00755 $(DESTDIR)/usr/share/man/man1
install -m 00644 $(MANPAGES) $(DESTDIR)/usr/share/man/man1/
check: gopath
go test -cover ${GO_PACKAGE_PREFIX}/...
# TODO: when Go 1.10 comes out we will have support for passing multiple packages
# to coverprofile, so there will be no need to pass an individual package.
# At that time we can merge this target into check and run it against all
# packages every time.
.PHONY: checkcoverage
checkcoverage: gopath
ifeq (,${PKG})
$(error PKG is not set, try make PKG=swupd checkcoverage)
else
go test -cover ${GO_PACKAGE_PREFIX}/${PKG} -coverprofile=coverage.out
go tool cover -html=coverage.out
endif
.PHONY: lint
lint: gopath
@gometalinter.v2 --deadline=10m --tests --vendor --disable-all \
--enable=misspell \
--enable=vet \
--enable=ineffassign \
--enable=gofmt \
$${CYCLO_MAX:+--enable=gocyclo --cyclo-over=$${CYCLO_MAX}} \
--enable=golint \
--enable=deadcode \
--enable=varcheck \
--enable=structcheck \
--enable=unused \
--enable=vetshadow \
--enable=errcheck \
./...
clean:
ifeq (,${LOCAL_GOPATH})
go clean -i -x
else
rm -rf ${LOCAL_GOPATH}
endif
rm -f mixer-tools-*.tar.gz
release:
@if [ ! -d .git ]; then \
echo "Release needs to be used from a git repository"; \
exit 1; \
fi
git archive --format=tar.gz --verbose -o mixer-tools-${VERSION}.tar.gz HEAD --prefix=mixer-tools-${VERSION}/
MANPAGES = \
docs/mixer.1 \
docs/mixer.add-rpms.1 \
docs/mixer.build.1 \
docs/mixer.bundle.1 \
docs/mixer.config.1 \
docs/mixer.init.1 \
docs/mixer.repo.1 \
docs/mixer.versions.1 \
docs/mixin.1
man: $(MANPAGES)
% : %.rst
mkdir -p "$$(dirname $@)"
rst2man.py "$<" > "$@.tmp" && mv -f "$@.tmp" "$@"