Skip to content
Myr

before_deploy.bash

This file

Path

ci/before_deploy.bash

172 lines · 5.4 KiB · Shell

Last changed by

Use dual license on DebianLaurent Arnoudbefore adoption35945c4

History of this file

Take it

The walk stopped after 200 commits: lines older than 5ed7514 point at it.

Update error message if command could not be foundsharkdpbefore adoption5ed7514

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

Enable ARM cross-compilationsharkdpbefore adoption6fb5004

line 14why, one step back
14 local gcc_prefix

Update error message if command could not be foundsharkdpbefore adoption5ed7514

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 static binary #320 (arm-unknown-linux-musleabihf)Duncan Finneybefore adoption831f517

line 20why, one step back
20 if [[ $TARGET == arm-unknown-linux-* ]]; then

Enable ARM cross-compilationsharkdpbefore adoption6fb5004

lines 21–25why, one step back
21 gcc_prefix="arm-linux-gnueabihf-"
22 else23 gcc_prefix=""24 fi25

Update error message if command could not be foundsharkdpbefore adoption5ed7514

lines 26–31why, one step back
26 # create a "staging" directory
27 mkdir "$tempdir/$package_name"28 mkdir "$tempdir/$package_name/autocomplete"2930 # copying the main binary31 cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"

Enable ARM cross-compilationsharkdpbefore adoption6fb5004

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

Update error message if command could not be foundsharkdpbefore adoption5ed7514

lines 33–40why, one step back
33
34 # manpage, readme and license35 cp "doc/$PROJECT_NAME.1" "$tempdir/$package_name"36 cp README.md "$tempdir/$package_name"37 cp LICENSE-MIT "$tempdir/$package_name"38 cp LICENSE-APACHE "$tempdir/$package_name"3940 # various autocomplete

Fix path of bash completionsharkdpbefore adoption9192bc1

line 41why, one step back
41 cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"

Update error message if command could not be foundsharkdpbefore adoption5ed7514

lines 42–51why, one step back
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"4445 # archiving46 pushd "$tempdir"47 tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*48 popd49 rm -r "$tempdir"50}51

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 52–57why, one step back
52make_deb() {
53 local tempdir54 local architecture55 local version56 local dpkgname57 local conflictname

Add copyright file for deb packageLaurent Arnoudbefore adoption97908be

lines 58–59why, one step back
58 local homepage
59 local maintainer

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

line 60why, one step back
60

Add copyright file for deb packageLaurent Arnoudbefore adoption97908be

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

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 64–71why, one step back
64 case $TARGET in
65 x86_64*)66 architecture=amd6467 ;;68 i686*)69 architecture=i38670 ;;71 *)

Enable ARM cross-compilationsharkdpbefore adoption6fb5004

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

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 74–77why, one step back
74 ;;
75 esac76 version=${TRAVIS_TAG#v}77 if [[ $TARGET = *musl* ]]; then

Fix deb buildThayne McCombsbefore adoption8914b43

lines 78–79why, one step back
78 dpkgname=$PROJECT_NAME-musl
79 conflictname=$PROJECT_NAME

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

line 80why, one step back
80 else

Fix deb buildThayne McCombsbefore adoption8914b43

lines 81–82why, one step back
81 dpkgname=$PROJECT_NAME
82 conflictname=$PROJECT_NAME-musl

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 83–87why, one step back
83 fi
8485 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)8687 # copy the main binary

Fix deb buildThayne McCombsbefore adoption8914b43

line 88why, one step back
88 install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 89–92why, one step back
89 strip "$tempdir/usr/bin/$PROJECT_NAME"
9091 # manpage92 install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"

Fix file owner in deb package, closes #213sharkdpbefore adoption050fa9c

line 93why, one step back
93 gzip --best "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 94–95why, one step back
94
95 # readme and license

Fix deb buildThayne McCombsbefore adoption8914b43

lines 96–98why, one step back
96 install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"
97 install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"98 install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"

Add copyright file for deb packageLaurent Arnoudbefore adoption97908be

lines 99–102why, one step back
99 cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF
100Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/101Upstream-Name: $PROJECT_NAME102Source: $homepage

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

line 103why, one step back
103

Add copyright file for deb packageLaurent Arnoudbefore adoption97908be

lines 104–105why, one step back
104Files: *
105Copyright: $maintainer

Use dual license on DebianLaurent Arnoudbefore adoption35945c4

lines 106–107why, one step back
106License: Apache-2.0 or MIT
107

Add copyright file for deb packageLaurent Arnoudbefore adoption97908be

line 108why, one step back
108License: Apache-2.0

Use dual license on DebianLaurent Arnoudbefore adoption35945c4

lines 109–135why, one step back
109 On Debian systems, the complete text of the Apache-2.0 can be found in the
110 file /usr/share/common-licenses/Apache-2.0.111112License: MIT113 Permission is hereby granted, free of charge, to any114 person obtaining a copy of this software and associated115 documentation files (the "Software"), to deal in the116 Software without restriction, including without117 limitation the rights to use, copy, modify, merge,118 publish, distribute, sublicense, and/or sell copies of119 the Software, and to permit persons to whom the Software120 is furnished to do so, subject to the following121 conditions:122 .123 The above copyright notice and this permission notice124 shall be included in all copies or substantial portions125 of the Software.126 .127 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF128 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED129 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A130 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT131 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY132 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION133 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR134 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER135 DEALINGS IN THE SOFTWARE.

Add copyright file for deb packageLaurent Arnoudbefore adoption97908be

lines 136–137why, one step back
136EOF
137

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

line 138why, one step back
138 # completions

Fix shell completion directories for Ubuntusharkdpbefore adoptionc5b920b

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

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 142–149why, one step back
142
143 # Control file144 mkdir "$tempdir/DEBIAN"145 cat > "$tempdir/DEBIAN/control" <<EOF146Package: $dpkgname147Version: $version148Section: utils149Priority: optional

Add copyright file for deb packageLaurent Arnoudbefore adoption97908be

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

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

line 151why, one step back
151Architecture: $architecture

Fix deb buildThayne McCombsbefore adoption8914b43

line 152why, one step back
152Provides: $PROJECT_NAME

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

line 153why, one step back
153Conflicts: $conflictname

Add copyright file for deb packageLaurent Arnoudbefore adoption97908be

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

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

line 155why, one step back
155Description: Simple, fast and user-friendly alternative to find

Fix file owner in deb package, closes #213sharkdpbefore adoption050fa9c

lines 156–157why, one step back
156 While fd does not seek to mirror all of find's powerful functionality, it
157 provides sensible (opinionated) defaults for 80% of the use cases.

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 158–159why, one step back
158EOF
159

Fix file owner in deb package, closes #213sharkdpbefore adoption050fa9c

line 160why, one step back
160 fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 161–163why, one step back
161}
162163

Update error message if command could not be foundsharkdpbefore adoption5ed7514

lines 164–166why, one step back
164main() {
165 build166 pack

Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560

lines 167–169why, one step back
167 if [[ $TARGET = *linux* ]]; then
168 make_deb169 fi

Update error message if command could not be foundsharkdpbefore adoption5ed7514

lines 170–172why, one step back
170}
171172main