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 fileTake 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 back1#!/usr/bin/env bash2# Building and packaging for release34set -ex56build() {7 cargo build --target "$TARGET" --release --verbose8}910pack() {11 local tempdir12 local out_dir13 local package_nameEnable ARM cross-compilationsharkdpbefore adoption6fb5004
line 14why, one step back14 local gcc_prefixUpdate error message if command could not be foundsharkdpbefore adoption5ed7514
lines 15–19why, one step back1516 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)17 out_dir=$(pwd)18 package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"19Add ARM static binary #320 (arm-unknown-linux-musleabihf)Duncan Finneybefore adoption831f517
line 20why, one step back20 if [[ $TARGET == arm-unknown-linux-* ]]; thenEnable ARM cross-compilationsharkdpbefore adoption6fb5004
lines 21–25why, one step back21 gcc_prefix="arm-linux-gnueabihf-"22 else23 gcc_prefix=""24 fi25Update error message if command could not be foundsharkdpbefore adoption5ed7514
lines 26–31why, one step back26 # create a "staging" directory27 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 back32 "${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"Update error message if command could not be foundsharkdpbefore adoption5ed7514
lines 33–40why, one step back3334 # 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 autocompleteFix path of bash completionsharkdpbefore adoption9192bc1
line 41why, one step back41 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 back42 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}51Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
lines 52–57why, one step back52make_deb() {53 local tempdir54 local architecture55 local version56 local dpkgname57 local conflictnameAdd copyright file for deb packageLaurent Arnoudbefore adoption97908be
lines 58–59why, one step back58 local homepage59 local maintainerCreate deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
line 60why, one step back60Add copyright file for deb packageLaurent Arnoudbefore adoption97908be
lines 61–63why, one step back61 homepage="https://github.com/sharkdp/fd"62 maintainer="David Peter <mail@david-peter.de>"63Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
lines 64–71why, one step back64 case $TARGET in65 x86_64*)66 architecture=amd6467 ;;68 i686*)69 architecture=i38670 ;;71 *)Enable ARM cross-compilationsharkdpbefore adoption6fb5004
lines 72–73why, one step back72 echo "make_deb: skipping target '${TARGET}'" >&273 return 0Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
lines 74–77why, one step back74 ;;75 esac76 version=${TRAVIS_TAG#v}77 if [[ $TARGET = *musl* ]]; thenFix deb buildThayne McCombsbefore adoption8914b43
lines 78–79why, one step back78 dpkgname=$PROJECT_NAME-musl79 conflictname=$PROJECT_NAMECreate deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
line 80why, one step back80 elseFix deb buildThayne McCombsbefore adoption8914b43
lines 81–82why, one step back81 dpkgname=$PROJECT_NAME82 conflictname=$PROJECT_NAME-muslCreate deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
lines 83–87why, one step back83 fi8485 tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)8687 # copy the main binaryFix deb buildThayne McCombsbefore adoption8914b43
line 88why, one step back88 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 back89 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 back93 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 back9495 # readme and licenseFix deb buildThayne McCombsbefore adoption8914b43
lines 96–98why, one step back96 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 back99 cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF100Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/101Upstream-Name: $PROJECT_NAME102Source: $homepageCreate deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
line 103why, one step back103Add copyright file for deb packageLaurent Arnoudbefore adoption97908be
lines 104–105why, one step back104Files: *105Copyright: $maintainerUse dual license on DebianLaurent Arnoudbefore adoption35945c4
lines 106–107why, one step back106License: Apache-2.0 or MIT107Add copyright file for deb packageLaurent Arnoudbefore adoption97908be
line 108why, one step back108License: Apache-2.0Use dual license on DebianLaurent Arnoudbefore adoption35945c4
lines 109–135why, one step back109 On Debian systems, the complete text of the Apache-2.0 can be found in the110 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 back136EOF137Create deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
line 138why, one step back138 # completionsFix shell completion directories for Ubuntusharkdpbefore adoptionc5b920b
lines 139–141why, one step back139 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 back142143 # Control file144 mkdir "$tempdir/DEBIAN"145 cat > "$tempdir/DEBIAN/control" <<EOF146Package: $dpkgname147Version: $version148Section: utils149Priority: optionalAdd copyright file for deb packageLaurent Arnoudbefore adoption97908be
line 150why, one step back150Maintainer: $maintainerCreate deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
line 151why, one step back151Architecture: $architectureFix deb buildThayne McCombsbefore adoption8914b43
line 152why, one step back152Provides: $PROJECT_NAMECreate deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
line 153why, one step back153Conflicts: $conflictnameAdd copyright file for deb packageLaurent Arnoudbefore adoption97908be
line 154why, one step back154Homepage: $homepageCreate deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
line 155why, one step back155Description: Simple, fast and user-friendly alternative to findFix file owner in deb package, closes #213sharkdpbefore adoption050fa9c
lines 156–157why, one step back156 While fd does not seek to mirror all of find's powerful functionality, it157 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 back158EOF159Fix file owner in deb package, closes #213sharkdpbefore adoption050fa9c
line 160why, one step back160 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 back161}162163Update error message if command could not be foundsharkdpbefore adoption5ed7514
lines 164–166why, one step back164main() {165 build166 packCreate deb file as part of CI build. WIPThayne McCombsbefore adoption59ea560
lines 167–169why, one step back167 if [[ $TARGET = *linux* ]]; then168 make_deb169 fiUpdate error message if command could not be foundsharkdpbefore adoption5ed7514
lines 170–172why, one step back170}171172main