"Fossies" - the Fresh Open Source Software Archive

Member "fd-8.1.1/ci/before_deploy.bash" (25 May 2020, 5709 Bytes) of package /linux/privat/fd-8.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "before_deploy.bash": 7.3.0_vs_7.4.0.

    1 #!/usr/bin/env bash
    2 # Building and packaging for release
    3 
    4 set -ex
    5 
    6 build() {
    7     cargo build --target "$TARGET" --release --verbose
    8 }
    9 
   10 pack() {
   11     local tempdir
   12     local out_dir
   13     local package_name
   14     local gcc_prefix
   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 
   20     if [[ $TARGET == arm-unknown-linux-* ]]; then
   21         gcc_prefix="arm-linux-gnueabihf-"
   22     else
   23         gcc_prefix=""
   24     fi
   25 
   26     # create a "staging" directory
   27     mkdir "$tempdir/$package_name"
   28     mkdir "$tempdir/$package_name/autocomplete"
   29 
   30     # copying the main binary
   31     cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
   32     "${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
   33 
   34     # manpage, readme and license
   35     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"
   39 
   40     # various autocomplete
   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 
   45     # archiving
   46     pushd "$tempdir"
   47     tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*
   48     popd
   49     rm -r "$tempdir"
   50 }
   51 
   52 make_deb() {
   53     local tempdir
   54     local architecture
   55     local version
   56     local dpkgname
   57     local conflictname
   58     local homepage
   59     local maintainer
   60     local gcc_prefix
   61 
   62     homepage="https://github.com/sharkdp/fd"
   63     maintainer="David Peter <mail@david-peter.de>"
   64 
   65     case $TARGET in
   66         x86_64*)
   67             architecture=amd64
   68             gcc_prefix=""
   69             ;;
   70         i686*)
   71             architecture=i386
   72             gcc_prefix=""
   73             ;;
   74         arm*hf)
   75             architecture=armhf
   76             gcc_prefix="arm-linux-gnueabihf-"
   77             ;;
   78         *)
   79             echo "make_deb: skipping target '${TARGET}'" >&2
   80             return 0
   81             ;;
   82     esac
   83     version=${TRAVIS_TAG#v}
   84     if [[ $TARGET = *musl* ]]; then
   85       dpkgname=$PROJECT_NAME-musl
   86       conflictname=$PROJECT_NAME
   87     else
   88       dpkgname=$PROJECT_NAME
   89       conflictname=$PROJECT_NAME-musl
   90     fi
   91 
   92     tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
   93 
   94     # copy the main binary
   95     install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
   96     "${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"
   97 
   98     # manpage
   99     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"
  101 
  102     # readme and license
  103     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"
  106     cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF
  107 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
  108 Upstream-Name: $PROJECT_NAME
  109 Source: $homepage
  110 
  111 Files: *
  112 Copyright: $maintainer
  113 License: Apache-2.0 or MIT
  114 
  115 License: Apache-2.0
  116  On Debian systems, the complete text of the Apache-2.0 can be found in the
  117  file /usr/share/common-licenses/Apache-2.0.
  118 
  119 License: MIT
  120  Permission is hereby granted, free of charge, to any
  121  person obtaining a copy of this software and associated
  122  documentation files (the "Software"), to deal in the
  123  Software without restriction, including without
  124  limitation the rights to use, copy, modify, merge,
  125  publish, distribute, sublicense, and/or sell copies of
  126  the Software, and to permit persons to whom the Software
  127  is furnished to do so, subject to the following
  128  conditions:
  129  .
  130  The above copyright notice and this permission notice
  131  shall be included in all copies or substantial portions
  132  of the Software.
  133  .
  134  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
  135  ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  136  TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  137  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
  138  SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  139  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  140  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  141  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  142  DEALINGS IN THE SOFTWARE.
  143 EOF
  144 
  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"
  149 
  150     # Control file
  151     mkdir "$tempdir/DEBIAN"
  152     cat > "$tempdir/DEBIAN/control" <<EOF
  153 Package: $dpkgname
  154 Version: $version
  155 Section: utils
  156 Priority: optional
  157 Maintainer: $maintainer
  158 Architecture: $architecture
  159 Provides: $PROJECT_NAME
  160 Conflicts: $conflictname
  161 Homepage: $homepage
  162 Description: Simple, fast and user-friendly alternative to find
  163  While fd does not seek to mirror all of find's powerful functionality, it
  164  provides sensible (opinionated) defaults for 80% of the use cases.
  165 EOF
  166 
  167     fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"
  168 }
  169 
  170 
  171 main() {
  172     build
  173     pack
  174     if [[ $TARGET = *linux* ]]; then
  175       make_deb
  176     fi
  177 }
  178 
  179 main