From 2e2598c9a0fe6e84b0e41e2821787b024d8f54a0 Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Sun, 8 Oct 2017 20:44:34 +0100 Subject: [PATCH] Rename the zips for weekly releases --- Vagrantfile | 4 ++-- build.rs | 4 +++- devtools/dev-package-for-linux.sh | 12 +++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 189cfd5..9f7b72a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -78,8 +78,8 @@ Vagrant.configure(2) do |config| echo -e "#!/bin/sh\nbuild-exa && test-exa && run-xtests" > /usr/bin/compile-exa ln -sf /usr/bin/compile-exa /usr/bin/c - echo -e "#!/bin/sh\nbash /vagrant/devtools/dev-package-for-linux.sh" > /usr/bin/package-exa - echo -e "#!/bin/sh\ncat /etc/motd" > /usr/bin/halp + echo -e "#!/bin/sh\nbash /vagrant/devtools/dev-package-for-linux.sh \\$@" > /usr/bin/package-exa + echo -e "#!/bin/sh\ncat /etc/motd" > /usr/bin/halp chmod +x /usr/bin/{exa,rexa,b,t,x,c,build-exa,test-exa,run-xtests,compile-exa,package-exa,halp} EOF diff --git a/build.rs b/build.rs index 909633b..79a0174 100644 --- a/build.rs +++ b/build.rs @@ -29,7 +29,9 @@ fn main() { } fn is_development_version() -> bool { - env::var("PROFILE").unwrap() == "debug" + // Both weekly releases and actual releases are --release releases, + // but actual releases will have a proper version number + cargo_version().ends_with("-pre") || env::var("PROFILE").unwrap() == "debug" } fn cargo_version() -> String { diff --git a/devtools/dev-package-for-linux.sh b/devtools/dev-package-for-linux.sh index ff64c5e..8c33e2d 100644 --- a/devtools/dev-package-for-linux.sh +++ b/devtools/dev-package-for-linux.sh @@ -25,6 +25,13 @@ eval exa_$(grep version $toml_file | head -n 1 | sed "s/ //g") if [ -z "$exa_version" ]; then echo "Failed to parse version number! Can't build exa!" exit 1 +fi + +# Weekly builds have a bit more information in their version number (see build.rs). +if [[ "$1" == "--weekly" ]]; then + git_hash=`GIT_DIR=/vagrant/.git git rev-parse --short --verify HEAD` + date=`date +"%Y-%m-%d"` + echo "Building exa weekly v$exa_version, date $date, Git hash $git_hash" else echo "Building exa v$exa_version" fi @@ -50,7 +57,10 @@ strip -v "$exa_linux_binary" # the binaries can have consistent names, and it’s still possible to tell # different *downloads* apart. echo -e "\n\033[4mZipping binary...\033[0m" -exa_linux_zip="/vagrant/exa-linux-x86_64-${exa_version}.zip" +if [[ "$1" == "--weekly" ]] + then exa_linux_zip="/vagrant/exa-linux-x86_64-${exa_version}-${date}-${git_hash}.zip" + else exa_linux_zip="/vagrant/exa-linux-x86_64-${exa_version}.zip" +fi rm -vf "$exa_linux_zip" zip -j "$exa_linux_zip" "$exa_linux_binary"