Skip to content
Myr

Merge pull request #1593 from sharkdp/deb-improvements

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Deb improvements

authored by Thayne McCombs · committed by GitHub · parents e9fe337, 830fed4 · Browse files · 2 files+139 added−107 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+139 added−107 removed

  • other:+139 added−107 removed

2 files+139 added−107 removed

modified:.github/workflows/CICD.yml+5 added-107 removed
214 unmodified lines
215 - name: Create Debian package216 id: debian-package217 shell: bash218 if: startsWith(matrix.job.os, 'ubuntu')219 run: |220 COPYRIGHT_YEARS="2018 - "$(date "+%Y")221 DPKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/debian-package"222 DPKG_DIR="${DPKG_STAGING}/dpkg"223 mkdir -p "${DPKG_DIR}"219 run: bash scripts/create-deb.sh220 env:221 TARGET: ${{ matrix.job.target }}222 DPKG_VERSION: ${{ needs.crate_metadata.version }}223 BIN_PATH: ${{ steps.bin.outputs.BIN_PATH }}224225 DPKG_BASENAME=${{ needs.crate_metadata.outputs.name }}226 DPKG_CONFLICTS=${{ needs.crate_metadata.outputs.name }}-musl227 case ${{ matrix.job.target }} in *-musl*) DPKG_BASENAME=${{ needs.crate_metadata.outputs.name }}-musl ; DPKG_CONFLICTS=${{ needs.crate_metadata.outputs.name }} ;; esac;228 DPKG_VERSION=${{ needs.crate_metadata.outputs.version }}229230 unset DPKG_ARCH231 case ${{ matrix.job.target }} in232 aarch64-*-linux-*) DPKG_ARCH=arm64 ;;233 arm-*-linux-*hf) DPKG_ARCH=armhf ;;234 i686-*-linux-*) DPKG_ARCH=i686 ;;235 x86_64-*-linux-*) DPKG_ARCH=amd64 ;;236 *) DPKG_ARCH=notset ;;237 esac;238239 DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"240 echo "DPKG_NAME=${DPKG_NAME}" >> $GITHUB_OUTPUT241242 # Binary243 install -Dm755 "${{ steps.bin.outputs.BIN_PATH }}" "${DPKG_DIR}/usr/bin/${{ steps.bin.outputs.BIN_NAME }}"244245 # Man page246 install -Dm644 'doc/${{ needs.crate_metadata.outputs.name }}.1' "${DPKG_DIR}/usr/share/man/man1/${{ needs.crate_metadata.outputs.name }}.1"247 gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${{ needs.crate_metadata.outputs.name }}.1"248249 # Autocompletion files250 install -Dm644 'autocomplete/fd.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/${{ needs.crate_metadata.outputs.name }}"251 install -Dm644 'autocomplete/fd.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ needs.crate_metadata.outputs.name }}.fish"252 install -Dm644 'autocomplete/_fd' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ needs.crate_metadata.outputs.name }}"253254 # README and LICENSE255 install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md"256 install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT"257 install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE"258 install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"259 gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"260261 cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" <<EOF262 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/263 Upstream-Name: ${{ needs.crate_metadata.outputs.name }}264 Source: ${{ needs.crate_metadata.outputs.homepage }}265266 Files: *267 Copyright: ${{ needs.crate_metadata.outputs.maintainer }}268 Copyright: $COPYRIGHT_YEARS ${{ needs.crate_metadata.outputs.maintainer }}269 License: Apache-2.0 or MIT270271 License: Apache-2.0272 On Debian systems, the complete text of the Apache-2.0 can be found in the273 file /usr/share/common-licenses/Apache-2.0.274275 License: MIT276 Permission is hereby granted, free of charge, to any277 person obtaining a copy of this software and associated278 documentation files (the "Software"), to deal in the279 Software without restriction, including without280 limitation the rights to use, copy, modify, merge,281 publish, distribute, sublicense, and/or sell copies of282 the Software, and to permit persons to whom the Software283 is furnished to do so, subject to the following284 conditions:285 .286 The above copyright notice and this permission notice287 shall be included in all copies or substantial portions288 of the Software.289 .290 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF291 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED292 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A293 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT294 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY295 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION296 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR297 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER298 DEALINGS IN THE SOFTWARE.299 EOF300 chmod 644 "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright"301302 # control file303 mkdir -p "${DPKG_DIR}/DEBIAN"304 cat > "${DPKG_DIR}/DEBIAN/control" <<EOF305 Package: ${DPKG_BASENAME}306 Version: ${DPKG_VERSION}307 Section: utils308 Priority: optional309 Maintainer: ${{ needs.crate_metadata.outputs.maintainer }}310 Homepage: ${{ needs.crate_metadata.outputs.homepage }}311 Architecture: ${DPKG_ARCH}312 Provides: ${{ needs.crate_metadata.outputs.name }}313 Conflicts: ${DPKG_CONFLICTS}314 Description: simple, fast and user-friendly alternative to find315 fd is a program to find entries in your filesystem.316 It is a simple, fast and user-friendly alternative to find.317 While it does not aim to support all of finds powerful functionality, it provides318 sensible (opinionated) defaults for a majority of use cases.319 EOF320321 DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"322 echo "DPKG_PATH=${DPKG_PATH}" >> $GITHUB_OUTPUT323324 # build dpkg325 fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}"326225 - name: "Artifact upload: tarball"226 uses: actions/upload-artifact@master227 with:228 name: ${{ steps.package.outputs.PKG_NAME }}
37 unmodified lines
added:scripts/create-deb.sh+134 added
1#!/bin/bash2COPYRIGHT_YEARS="2018 - "$(date "+%Y")3MAINTAINER="David Peter <mail@david-peter.de>"4REPO="https://github.com/sharkdp/fd"5DPKG_STAGING="${CICD_INTERMEDIATES_DIR:-.}/debian-package"6DPKG_DIR="${DPKG_STAGING}/dpkg"7mkdir -p "${DPKG_DIR}"89if [[ -z "$TARGET" ]]; then10 TARGET="$(rustc -vV | sed -n 's|host: \(.*\)|\1|p')"11fi1213case "$TARGET" in14 *-musl*)15 DPKG_BASENAME=fd-musl16 DPKG_CONFLICTS="fd, fd-find"17 ;;18 *)19 DPKG_BASENAME=fd20 DPKG_CONFLICTS="fd-musl, fd-find"21 ;;22esac2324if [[ -z "$DPKG_VERSION" ]]; then25 DPKG_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r .packages[0].version)26fi2728unset DPKG_ARCH29case "${TARGET}" in30 aarch64-*-linux-*) DPKG_ARCH=arm64 ;;31 arm-*-linux-*hf) DPKG_ARCH=armhf ;;32 i686-*-linux-*) DPKG_ARCH=i686 ;;33 x86_64-*-linux-*) DPKG_ARCH=amd64 ;;34 *) DPKG_ARCH=notset ;;35esac;3637DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"3839BIN_PATH=${BIN_PATH:-target/${TARGET}/release/fd}4041# Binary42install -Dm755 "${BIN_PATH}" "${DPKG_DIR}/usr/bin/fd"4344# Man page45install -Dm644 'doc/fd.1' "${DPKG_DIR}/usr/share/man/man1/fd.1"46gzip -n --best "${DPKG_DIR}/usr/share/man/man1/fd.1"4748# Autocompletion files49install -Dm644 'autocomplete/fd.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/fd"50install -Dm644 'autocomplete/fd.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/fd.fish"51install -Dm644 'autocomplete/_fd' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_fd"5253# README and LICENSE54install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md"55install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT"56install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE"57install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"58gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"5960# Create symlinks so fdfind can be used as well:61ln -s "/usr/bin/fd" "${DPKG_DIR}/usr/bin/fdfind"62ln -s './fd.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/fdfind"63ln -s './fd.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/fdfind.fish"64ln -s './_fd' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_fdfind"6566cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" <<EOF67Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/68Upstream-Name: fd69Source: ${REPO}7071Files: *72Copyright: ${MAINTAINER}73Copyright: $COPYRIGHT_YEARS ${MAINTAINER}74License: Apache-2.0 or MIT7576License: Apache-2.077 On Debian systems, the complete text of the Apache-2.0 can be found in the78 file /usr/share/common-licenses/Apache-2.0.7980License: MIT81 Permission is hereby granted, free of charge, to any82 person obtaining a copy of this software and associated83 documentation files (the "Software"), to deal in the84 Software without restriction, including without85 limitation the rights to use, copy, modify, merge,86 publish, distribute, sublicense, and/or sell copies of87 the Software, and to permit persons to whom the Software88 is furnished to do so, subject to the following89 conditions:90 .91 The above copyright notice and this permission notice92 shall be included in all copies or substantial portions93 of the Software.94 .95 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF96 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED97 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A98 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT99 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY100 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION101 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR102 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER103 DEALINGS IN THE SOFTWARE.104EOF105 chmod 644 "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright"106107 # control file108 mkdir -p "${DPKG_DIR}/DEBIAN"109 cat > "${DPKG_DIR}/DEBIAN/control" <<EOF110Package: ${DPKG_BASENAME}111Version: ${DPKG_VERSION}112Section: utils113Priority: optional114Maintainer: ${MAINTAINER}115Homepage: ${REPO}116Architecture: ${DPKG_ARCH}117Provides: fd118Conflicts: ${DPKG_CONFLICTS}119Description: simple, fast and user-friendly alternative to find120 fd is a program to find entries in your filesystem.121 It is a simple, fast and user-friendly alternative to find.122 While it does not aim to support all of finds powerful functionality, it provides123 sensible (opinionated) defaults for a majority of use cases.124EOF125126DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"127128if [[ -n $GITHUB_OUTPUT ]]; then129 echo "DPKG_NAME=${DPKG_NAME}" >> "$GITHUB_OUTPUT"130 echo "DPKG_PATH=${DPKG_PATH}" >> "$GITHUB_OUTPUT"131fi132133# build dpkg134fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}"