Skip to content
Myr

before_deploy.bash

This file

Path

ci/before_deploy.bash

177 lines · 5.4 KiB · Shell

Last changed by

Add ARM binariesDavid Peterbefore adoption699d8ca

History of this file

Take it

The walk stopped after 200 commits: lines older than 78a0422 point at it.

Remove conda badgeDavid Peterbefore adoption78a0422

lines 1–13why, one step back
1#!/usr/bin/env bash
2# Building and packaging for release34set -ex56build() {7 cargo build --target "$TARGET" --release --verbose8}910pack() {11 local tempdir12 local out_dir13 local package_name

Add ARM binariesDavid Peterbefore adoption699d8ca

line 14why, one step back
14 local gcc_prefix

Remove conda badgeDavid Peterbefore adoption78a0422

lines 15–19why, one step back
15
16 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)17 out_dir=$(pwd)18 package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"19

Add ARM binariesDavid Peterbefore adoption699d8ca

lines 20–25why, one step back
20 if [[ $TARGET == arm-unknown-linux-* ]]; then
21 gcc_prefix="arm-linux-gnueabihf-"22 else23 gcc_prefix=""24 fi25

Remove conda badgeDavid Peterbefore adoption78a0422

lines 26–27why, one step back
26 # create a "staging" directory
27 mkdir "$tempdir/$package_name"

Add ARM binariesDavid Peterbefore adoption699d8ca

line 28why, one step back
28 mkdir "$tempdir/$package_name/autocomplete"

Remove conda badgeDavid Peterbefore adoption78a0422

lines 29–31why, one step back
29
30 # copying the main binary31 cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"

Add ARM binariesDavid Peterbefore adoption699d8ca

line 32why, one step back
32 "${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"

Remove conda badgeDavid Peterbefore adoption78a0422

line 33why, one step back
33

Address code review:Cade Ekblad-Frankbefore adoptione595be7

lines 34–35why, one step back
34 # manpage, readme and license
35 cp "doc/$PROJECT_NAME.1" "$tempdir/$package_name"

Remove conda badgeDavid Peterbefore adoption78a0422

lines 36–39why, one step back
36 cp README.md "$tempdir/$package_name"
37 cp LICENSE-MIT "$tempdir/$package_name"38 cp LICENSE-APACHE "$tempdir/$package_name"39

Bugfix: missing shell completion dir for packagingfour0000fourbefore adoption137329d

line 40why, one step back
40 # various autocomplete

Use clap to generate shell completionsfour0000fourbefore adoptiondeb5723

lines 41–44why, one step back
41 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"
42 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"43 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"44

Remove conda badgeDavid Peterbefore adoption78a0422

lines 45–57why, one step back
45 # archiving
46 pushd "$tempdir"47 tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*48 popd49 rm -r "$tempdir"50}5152make_deb() {53 local tempdir54 local architecture55 local version56 local dpkgname57 local conflictname

Add ARM binariesDavid Peterbefore adoption699d8ca

lines 58–60why, one step back
58 local homepage
59 local maintainer60 local gcc_prefix

Remove conda badgeDavid Peterbefore adoption78a0422

line 61why, one step back
61

Add ARM binariesDavid Peterbefore adoption699d8ca

lines 62–64why, one step back
62 homepage="https://github.com/sharkdp/$PROJECT_NAME"
63 maintainer="David Peter <mail@david-peter.de>"64

Remove conda badgeDavid Peterbefore adoption78a0422

lines 65–67why, one step back
65 case $TARGET in
66 x86_64*)67 architecture=amd64

Add ARM binariesDavid Peterbefore adoption699d8ca

line 68why, one step back
68 gcc_prefix=""

Remove conda badgeDavid Peterbefore adoption78a0422

lines 69–71why, one step back
69 ;;
70 i686*)71 architecture=i386

Add ARM binariesDavid Peterbefore adoption699d8ca

line 72why, one step back
72 gcc_prefix=""

Remove conda badgeDavid Peterbefore adoption78a0422

line 73why, one step back
73 ;;

Add ARM binariesDavid Peterbefore adoption699d8ca

lines 74–77why, one step back
74 arm*hf)
75 architecture=armhf76 gcc_prefix="arm-linux-gnueabihf-"77 ;;

Remove conda badgeDavid Peterbefore adoption78a0422

line 78why, one step back
78 *)

Add ARM binariesDavid Peterbefore adoption699d8ca

lines 79–80why, one step back
79 echo "make_deb: skipping target '${TARGET}'" >&2
80 return 0

Remove conda badgeDavid Peterbefore adoption78a0422

lines 81–95why, one step back
81 ;;
82 esac83 version=${TRAVIS_TAG#v}84 if [[ $TARGET = *musl* ]]; then85 dpkgname=$PROJECT_NAME-musl86 conflictname=$PROJECT_NAME87 else88 dpkgname=$PROJECT_NAME89 conflictname=$PROJECT_NAME-musl90 fi9192 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)9394 # copy the main binary95 install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"

Add ARM binariesDavid Peterbefore adoption699d8ca

line 96why, one step back
96 "${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"

Address code review:Cade Ekblad-Frankbefore adoptione595be7

lines 97–100why, one step back
97
98 # manpage99 install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"100 gzip --best "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"

Remove conda badgeDavid Peterbefore adoption78a0422

lines 101–105why, one step back
101
102 # readme and license103 install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"104 install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"105 install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"

Add ARM binariesDavid Peterbefore adoption699d8ca

lines 106–109why, one step back
106 cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF
107Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/108Upstream-Name: $PROJECT_NAME109Source: $homepage

Use clap to generate shell completionsfour0000fourbefore adoptiondeb5723

line 110why, one step back
110

Add ARM binariesDavid Peterbefore adoption699d8ca

lines 111–144why, one step back
111Files: *
112Copyright: $maintainer113License: Apache-2.0 or MIT114115License: Apache-2.0116 On Debian systems, the complete text of the Apache-2.0 can be found in the117 file /usr/share/common-licenses/Apache-2.0.118119License: MIT120 Permission is hereby granted, free of charge, to any121 person obtaining a copy of this software and associated122 documentation files (the "Software"), to deal in the123 Software without restriction, including without124 limitation the rights to use, copy, modify, merge,125 publish, distribute, sublicense, and/or sell copies of126 the Software, and to permit persons to whom the Software127 is furnished to do so, subject to the following128 conditions:129 .130 The above copyright notice and this permission notice131 shall be included in all copies or substantial portions132 of the Software.133 .134 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF135 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED136 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A137 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT138 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY139 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION140 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR141 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER142 DEALINGS IN THE SOFTWARE.143EOF144

Use clap to generate shell completionsfour0000fourbefore adoptiondeb5723

lines 145–148why, one step back
145 # completions
146 install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.bash "$tempdir/usr/share/bash-completion/completions/${PROJECT_NAME}"147 install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.fish "$tempdir/usr/share/fish/completions/$PROJECT_NAME.fish"148 install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/_$PROJECT_NAME "$tempdir/usr/share/zsh/vendor-completions/_$PROJECT_NAME"

Remove conda badgeDavid Peterbefore adoption78a0422

lines 149–156why, one step back
149
150 # Control file151 mkdir "$tempdir/DEBIAN"152 cat > "$tempdir/DEBIAN/control" <<EOF153Package: $dpkgname154Version: $version155Section: utils156Priority: optional

Add ARM binariesDavid Peterbefore adoption699d8ca

line 157why, one step back
157Maintainer: $maintainer

Remove conda badgeDavid Peterbefore adoption78a0422

lines 158–160why, one step back
158Architecture: $architecture
159Provides: $PROJECT_NAME160Conflicts: $conflictname

Add ARM binariesDavid Peterbefore adoption699d8ca

line 161why, one step back
161Homepage: $homepage

Remove conda badgeDavid Peterbefore adoption78a0422

lines 162–177why, one step back
162Description: A command-line benchmarking tool.
163EOF164165 fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"166}167168169main() {170 build171 pack172 if [[ $TARGET = *linux* ]]; then173 make_deb174 fi175}176177main