Skip to content

Commit

Permalink
Merge pull request #92 from AkihiroSuda/dev
Browse files Browse the repository at this point in the history
`make artifacts`: remove dependency on GNU tar and GNU coreutils
  • Loading branch information
AkihiroSuda authored Nov 26, 2024
2 parents 117bee8 + 605e0d2 commit 2349471
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/qemu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: launchctl print system/io.github.lima-vm.socket_vmnet
- name: Install test dependencies
run: |
brew install qemu bash coreutils
brew install qemu bash
- name: Test (shared mode)
run: ./test/test.sh /var/run/socket_vmnet
# Bridged mode cannot be tested on GHA
3 changes: 1 addition & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: "Install dependencies"
# coreutils: For `gtouch -d @${SOURCE_DATE_EPOCH}`
# diffoscope: For `make test.repro`
run: brew install coreutils diffoscope
run: brew install diffoscope
- name: "Test reproducibility"
run: |
make test.repro
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ PREFIX ?= /opt/socket_vmnet
DEBUG ?=

export SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct)
# https://reproducible-builds.org/docs/archives/
TAR ?= gtar --sort=name --mtime="@$(SOURCE_DATE_EPOCH)" --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime
TOUCH ?= gtouch -d @$(SOURCE_DATE_EPOCH)
SOURCE_DATE_EPOCH_ISO8601 := $(shell date -u -Iseconds -r $(SOURCE_DATE_EPOCH) | sed -e s/+00:00/Z/)

TAR ?= tar --uid=0 --gid=0 --numeric-owner
TOUCH ?= touch -d $(SOURCE_DATE_EPOCH_ISO8601)
# Not necessary to use GNU's gzip
GZIP ?= gzip -9 -n
DIFFOSCOPE ?= diffoscope
Expand Down Expand Up @@ -130,7 +131,10 @@ define make_artifacts
rm -rf _artifacts/$(1)
$(MAKE) ARCH=$(1) DESTDIR=_artifacts/$(1) install.bin install.doc
file -bp _artifacts/$(1)/$(PREFIX)/bin/socket_vmnet | grep -q "Mach-O 64-bit executable $(1)"
$(TAR) -C _artifacts/$(1) -cf _artifacts/socket_vmnet-$(VERSION_TRIMMED)-$(1).tar ./
# BSD tar does not have `--mtime=TIMESTAMP` option
find _artifacts/$(1) -exec $(TOUCH) {} \;
# BSD tar does not have `--sort=name` option
(cd _artifacts/$(1) && find -s . -print0 | $(TAR) -cf ../socket_vmnet-$(VERSION_TRIMMED)-$(1).tar --null -n --files-from /dev/stdin)
$(GZIP) _artifacts/socket_vmnet-$(VERSION_TRIMMED)-$(1).tar
rm -rf _artifacts/$(1)
$(MAKE) clean
Expand Down

0 comments on commit 2349471

Please sign in to comment.