Formalise exa-packaging script

Every time I had to build exa, I copied the files manually and checked to make sure they all had the same name. There’s now a script that does all that stuff for me, so I don’t need to remember to do it anymore.

It also does some things that weren’t being done before, including stripping the binary and listing its linked dependencies to we can tell if something like libhttp_parser has slipped in there (see #194)
This commit is contained in:
Benjamin Sago 2017-08-20 18:19:58 +01:00
parent 0b30864f10
commit 414b347ae5
3 changed files with 34 additions and 6 deletions

2
.gitignore vendored
View File

@ -1,4 +1,6 @@
target target
/exa-linux-x86_64
/exa-linux-x86_64.zip
.vagrant .vagrant
ubuntu-xenial-16.04-cloudimg-console.log ubuntu-xenial-16.04-cloudimg-console.log

26
Vagrantfile vendored
View File

@ -21,7 +21,7 @@ Vagrant.configure(2) do |config|
config.vm.provision :shell, privileged: true, inline: <<-EOF config.vm.provision :shell, privileged: true, inline: <<-EOF
set -xe set -xe
apt-get install -qq -o=Dpkg::Use-Pty=0 -y \ apt-get install -qq -o=Dpkg::Use-Pty=0 -y \
git cmake curl attr libgit2-dev \ git cmake curl attr libgit2-dev zip \
fish zsh bash bash-completion fish zsh bash bash-completion
EOF EOF
@ -68,8 +68,30 @@ Vagrant.configure(2) do |config|
echo -e "#!/bin/sh\nbuild-exa && test-exa && run-xtests" > /usr/bin/compile-exa echo -e "#!/bin/sh\nbuild-exa && test-exa && run-xtests" > /usr/bin/compile-exa
ln -sf /usr/bin/compile-exa /usr/bin/c ln -sf /usr/bin/compile-exa /usr/bin/c
echo "#!/bin/bash" > /usr/bin/package-exa
echo "set -e" >> /usr/bin/package-exa
chmod +x /usr/bin/{exa,rexa,b,t,x,c,build-exa,test-exa,run-xtests,compile-exa} echo 'echo -e "\nCompiling release version of exa..."' >> /usr/bin/package-exa
echo "cargo build --release --manifest-path /vagrant/Cargo.toml" >> /usr/bin/package-exa
echo "cargo test --release --manifest-path /vagrant/Cargo.toml --lib" >> /usr/bin/package-exa
echo "/vagrant/xtests/run.sh --release" >> /usr/bin/package-exa
echo "cp /home/ubuntu/target/release/exa /vagrant/exa-linux-x86_64" >> /usr/bin/package-exa
echo 'echo -e "\nStripping binary..."' >> /usr/bin/package-exa
echo "strip /vagrant/exa-linux-x86_64" >> /usr/bin/package-exa
echo 'echo -e "\nZipping binary..."' >> /usr/bin/package-exa
echo "rm -f /vagrant/exa-linux-x86_64.zip" >> /usr/bin/package-exa
echo "zip /vagrant/exa-linux-x86_64.zip /vagrant/exa-linux-x86_64" >> /usr/bin/package-exa
echo 'echo -e "\nLibraries linked:"' >> /usr/bin/package-exa
echo "ldd /vagrant/exa-linux-x86_64" >> /usr/bin/package-exa
echo 'echo -e "\nAll done!"' >> /usr/bin/package-exa
echo '/vagrant/exa-linux-x86_64 /vagrant/exa-linux-x86_64* -lB' >> /usr/bin/package-exa
chmod +x /usr/bin/{exa,rexa,b,t,x,c,build-exa,test-exa,run-xtests,compile-exa,package-exa}
EOF EOF

View File

@ -2,12 +2,15 @@
set +xe set +xe
# The exa binary # Release mode
exa_binary="$HOME/target/debug/exa" case "$1" in
"--release") echo "Testing release exa..."; exa_binary="$HOME/target/release/exa" ;;
*) exa_binary="$HOME/target/debug/exa" ;;
esac
if [ ! -f "$exa_binary" ]; then if [ ! -f "$exa_binary" ]; then
echo "exa binary ($exa_binary) does not exist" echo "exa binary ($exa_binary) does not exist"
echo -e "create it first with \033[1;32mbuild-exa\033[0m or \033[1;32mb\033[0m" if [ "$1" != "--release" ]; then echo -e "create it first with \033[1;32mbuild-exa\033[0m or \033[1;32mb\033[0m"; fi
exit 1 exit 1
fi fi
@ -150,7 +153,8 @@ env LANG=ja_JP.UTF-8 $exa $testcases/dates -l | diff -q - $results/dates_jp ||
# Paths and directories # Paths and directories
# These directories are created in the VM users home directory (the default # These directories are created in the VM users home directory (the default
# location) when a Cargo build is done. # location) when a Cargo build is done.
(cd; $exa -1d target target/debug target/debug/build | diff -q - $results/dir_paths) || exit 1 (cd; mkdir -p target/debug/build
$exa -1d target target/debug target/debug/build | diff -q - $results/dir_paths) || exit 1
$exa -1d . .. / | diff -q - $results/dirs || exit 1 $exa -1d . .. / | diff -q - $results/dirs || exit 1