From 60dfa7081ba9191d0006e451d2cd467638474995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Sun, 25 Aug 2019 15:44:45 +0200 Subject: [PATCH] move build_p2pd.sh to nimbus-build-system --- Makefile | 2 +- scripts/build_p2pd.sh | 74 -------------------------------------- vendor/nimbus-build-system | 2 +- 3 files changed, 2 insertions(+), 76 deletions(-) delete mode 100755 scripts/build_p2pd.sh diff --git a/Makefile b/Makefile index 840cd4466..162a96a43 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ P2PD_CACHE := p2pd: | go-checks BUILD_MSG="$(BUILD_MSG) $@" \ V=$(V) \ - $(ENV_SCRIPT) scripts/build_p2pd.sh "$(P2PD_CACHE)" + $(ENV_SCRIPT) $(BUILD_SYSTEM_DIR)/scripts/build_p2pd.sh "$(P2PD_CACHE)" # Windows 10 with WSL enabled, but no distro installed, fails if "../../nimble.sh" is executed directly # in a Makefile recipe but works when prefixing it with `bash`. No idea how the PATH is overridden. diff --git a/scripts/build_p2pd.sh b/scripts/build_p2pd.sh deleted file mode 100755 index 31c5db547..000000000 --- a/scripts/build_p2pd.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2018-2019 Status Research & Development GmbH. Licensed under -# either of: -# - Apache License, version 2.0 -# - MIT license -# at your option. This file may not be copied, modified, or distributed except -# according to those terms. - -set -e - -SUBREPO_DIR="vendor/go/src/github.com/libp2p/go-libp2p-daemon" -CACHE_DIR="$1" # optional parameter pointing to a CI cache dir. - -## env vars -# verbosity level -[[ -z "$V" ]] && V=0 -[[ -z "$BUILD_MSG" ]] && BUILD_MSG="Building p2pd" - -# Windows detection -if uname | grep -qiE "mingw|msys"; then - EXE_SUFFIX=".exe" -else - EXE_SUFFIX="" -fi - -# macOS -if uname | grep -qi "darwin"; then - STAT_FORMAT="-f %m" -else - STAT_FORMAT="-c %Y" -fi - -TARGET_DIR="vendor/go/bin" -TARGET_BINARY="${TARGET_DIR}/p2pd${EXE_SUFFIX}" - -target_needs_rebuilding() { - REBUILD=0 - NO_REBUILD=1 - - if [[ -n "$CACHE_DIR" && -e "${CACHE_DIR}/p2pd${EXE_SUFFIX}" ]]; then - mkdir -p "${TARGET_DIR}" - cp -a "$CACHE_DIR"/* "${TARGET_DIR}/" - fi - - # compare binary mtime to the date of the last commit (keep in mind that Git doesn't preserve file timestamps) - if [[ -e "$TARGET_BINARY" && $(stat $STAT_FORMAT "$TARGET_BINARY") -gt $(cd "$SUBREPO_DIR"; git log --pretty=format:%cd -n 1 --date=unix) ]]; then - return $NO_REBUILD - else - return $REBUILD - fi -} - -build_target() { - echo -e "$BUILD_MSG" - [[ "$V" == "0" ]] && exec &>/dev/null - - pushd "$SUBREPO_DIR" - go get ./... - go install ./... - popd - - # update the CI cache - if [[ -n "$CACHE_DIR" ]]; then - rm -rf "$CACHE_DIR" - mkdir "$CACHE_DIR" - cp -a "$TARGET_DIR"/* "$CACHE_DIR"/ - fi -} - -if target_needs_rebuilding; then - build_target -fi - diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system index ed1683909..e359e1744 160000 --- a/vendor/nimbus-build-system +++ b/vendor/nimbus-build-system @@ -1 +1 @@ -Subproject commit ed16839098d615c977a139e089e4aa354176a94d +Subproject commit e359e17445c0fb868620c58d8bab436b45d935ca