Merge ~michael.nelson/gpgservice:add-tarball-target into gpgservice:master
Proposed by
Michael Nelson
Status: | Merged |
---|---|
Approved by: | Michael Nelson |
Approved revision: | b7e28d4d5a4941c000ea8f9470317d3050646f35 |
Merged at revision: | b7e28d4d5a4941c000ea8f9470317d3050646f35 |
Proposed branch: | ~michael.nelson/gpgservice:add-tarball-target |
Merge into: | gpgservice:master |
Diff against target: |
83 lines (+32/-7) 2 files modified
Makefile (+30/-5) Makefile.db (+2/-2) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | Needs Fixing | ||
Colin Watson (community) | Approve | ||
Review via email: mp+283255@code.launchpad.net |
Commit message
Initial tarball Makefile target - enables creating a tarball from a commit hash, defaulting to HEAD of current branch
Description of the change
There may be easier ways to get an export of the git repo at a given commit hash - not sure, but this seems to work.
tarballs are saved in tmp/${GITHASH}
To post a comment you must log in.
On Wed, Jan 20, 2016 at 05:47:24AM -0000, Michael Nelson wrote:
> +GITREF ?= $(shell git symbolic-ref HEAD)
> +GITHASH ?= $(shell git show-ref --verify --hash $(GITREF))
> +ifndef GITHASH
> + $(error "There was no reference '${GITREF}' found.")
> +endif
Requiring a full ref path seems a bit unnecessarily unfriendly to people
overriding GITREF. How about just using the porcelain command instead
of the plumbing command?
GITHASH ?= $(shell git rev-parse $(GITREF))
> +BUILD_DIR ?= /tmp/canonical- gpg-service- builds
Can we please not have scripts using well-known names in /tmp? The
builds should probably just live in a subdirectory of $(TMPDIR).
> +$(TARBALL_PATH): DIR}/canonical- gpg-service/ DIR}/canonical- gpg-service ${BUILD_ DIR}/canonical- gpg-service/ env DIR}/${ GITHASH} / gpg-service
> + @rm -rf ${BUILD_DIR}
> + @mkdir -p ${BUILD_DIR}
> + @git clone . ${BUILD_DIR}/repo
> + @cd ${BUILD_DIR}/repo/ && git reset ${GITHASH} && git checkout-index -a --prefix ${BUILD_
> + @make -C ${BUILD_
> + @mkdir -p ${TARBALLS_
> + @tar -czf $(TARBALL_PATH) -C ${BUILD_DIR} canonical-
How about this (untested), which is a bit easier to read:
$(TARBALL_PATH): DIR}/canonical- gpg-service DIR}/canonical- gpg-service ${GITHASH} DIR}/canonical- gpg-service ${BUILD_ DIR}/canonical- gpg-service/ env DIR}/${ GITHASH} / gpg-service
@rm -rf ${BUILD_DIR}
@git clone . ${BUILD_
@git checkout -C ${BUILD_
@make -C ${BUILD_
@mkdir -p ${TARBALLS_
@tar -czf $(TARBALL_PATH) --exclude-vcs -C ${BUILD_DIR} canonical-
@echo "Tarball created at ${TARBALL_PATH}"
(I also wouldn't personally @-prefix any of these commands except for
the final echo, but perhaps you differ on that.)