Skip to content

Commit 5a0cd0d

Browse files
committed
feat(Makefile): vendor-hash
1 parent d1d2aec commit 5a0cd0d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,23 @@ deep-clean: clean git-clean
401401
tidy:
402402
go mod tidy
403403

404+
# Temporarily redirect the well-known `vendor` target to `vendor-hash`.
405+
# This target will be removed in the future.
406+
vendor: vendor-hash
407+
408+
# https://gitlab.com/peerdb/peerdb/-/blob/d1dbd0c6533dca16bf57322b57cc8fb6ab897a66/nix-update.sh
409+
# After stopping vendoring https://github.com/status-im/status-go/pull/6951,
410+
# we have to manually update `vendorHash` in the nix derivation.
411+
# This target runs the nix build, extracts the expected vendorHash and updates with it the nix derivation.
412+
vendor-hash:
413+
@echo "$(GREEN)Running nix build...$(RESET)"; \
414+
NIX_OUTPUT="$$(nix build --extra-experimental-features 'nix-command flakes' '.?submodules=1#status-go-library' 2>&1)"; \
415+
CURRENT_VENDOR_HASH="$$(echo $${NIX_OUTPUT} | sed -n 's/.*specified:[[:space:]]*\(sha256-[A-Za-z0-9+/=]*\).*/\1/p' | head -1)"; \
416+
NEW_VENDOR_HASH="$$(echo $${NIX_OUTPUT} | sed -n 's/.*got:[[:space:]]*\(sha256-[A-Za-z0-9+/=]*\).*/\1/p' | head -1)"; \
417+
sed -i '' "s|vendorHash = \"$${CURRENT_VENDOR_HASH}\";|vendorHash = \"$${NEW_VENDOR_HASH}\";|g" ./nix/pkgs/status-go/library/default.nix; \
418+
echo "Replaced vendorHash $${CURRENT_VENDOR_HASH} with $${NEW_VENDOR_HASH}"
419+
420+
404421
migration: DEFAULT_MIGRATION_PATH := appdatabase/migrations/sql
405422
migration:
406423
touch $(DEFAULT_MIGRATION_PATH)/$$(date '+%s')_$(D).up.sql

0 commit comments

Comments
 (0)