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
Provenance
- Commit
9cf415c- Tree
dfd5ca8- Author
Thayne McCombs <astrothayne@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
e9fe337- Parent 2
830fed4
2 files changed+139 added−107 removed
modified:.github/workflows/CICD.yml+5 added-107 removed
214 unmodified lines215 - 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 }}224 225- 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 }}229-230- 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;238-239- DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"240- echo "DPKG_NAME=${DPKG_NAME}" >> $GITHUB_OUTPUT241-242- # Binary243- install -Dm755 "${{ steps.bin.outputs.BIN_PATH }}" "${DPKG_DIR}/usr/bin/${{ steps.bin.outputs.BIN_NAME }}"244-245- # 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"248-249- # 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 }}"253-254- # 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"260-261- 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 }}265-266- Files: *267- Copyright: ${{ needs.crate_metadata.outputs.maintainer }}268- Copyright: $COPYRIGHT_YEARS ${{ needs.crate_metadata.outputs.maintainer }}269- License: Apache-2.0 or MIT270-271- 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.274-275- 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"301-302- # 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- EOF320-321- DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"322- echo "DPKG_PATH=${DPKG_PATH}" >> $GITHUB_OUTPUT323-324- # build dpkg325- fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}"326-225 - name: "Artifact upload: tarball"226 uses: actions/upload-artifact@master227 with:228 name: ${{ steps.package.outputs.PKG_NAME }}37 unmodified linesadded:scripts/create-deb.sh+134 added
1+#!/bin/bash2+COPYRIGHT_YEARS="2018 - "$(date "+%Y")3+MAINTAINER="David Peter <mail@david-peter.de>"4+REPO="https://github.com/sharkdp/fd"5+DPKG_STAGING="${CICD_INTERMEDIATES_DIR:-.}/debian-package"6+DPKG_DIR="${DPKG_STAGING}/dpkg"7+mkdir -p "${DPKG_DIR}"8+9+if [[ -z "$TARGET" ]]; then10+ TARGET="$(rustc -vV | sed -n 's|host: \(.*\)|\1|p')"11+fi12+13+case "$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+ ;;22+esac23+24+if [[ -z "$DPKG_VERSION" ]]; then25+ DPKG_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r .packages[0].version)26+fi27+28+unset DPKG_ARCH29+case "${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 ;;35+esac;36+37+DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"38+39+BIN_PATH=${BIN_PATH:-target/${TARGET}/release/fd}40+41+# Binary42+install -Dm755 "${BIN_PATH}" "${DPKG_DIR}/usr/bin/fd"43+44+# Man page45+install -Dm644 'doc/fd.1' "${DPKG_DIR}/usr/share/man/man1/fd.1"46+gzip -n --best "${DPKG_DIR}/usr/share/man/man1/fd.1"47+48+# Autocompletion files49+install -Dm644 'autocomplete/fd.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/fd"50+install -Dm644 'autocomplete/fd.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/fd.fish"51+install -Dm644 'autocomplete/_fd' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_fd"52+53+# README and LICENSE54+install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md"55+install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT"56+install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE"57+install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"58+gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"59+60+# Create symlinks so fdfind can be used as well:61+ln -s "/usr/bin/fd" "${DPKG_DIR}/usr/bin/fdfind"62+ln -s './fd.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/fdfind"63+ln -s './fd.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/fdfind.fish"64+ln -s './_fd' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_fdfind"65+66+cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" <<EOF67+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/68+Upstream-Name: fd69+Source: ${REPO}70+71+Files: *72+Copyright: ${MAINTAINER}73+Copyright: $COPYRIGHT_YEARS ${MAINTAINER}74+License: Apache-2.0 or MIT75+76+License: 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.79+80+License: 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.104+EOF105+ chmod 644 "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright"106+107+ # control file108+ mkdir -p "${DPKG_DIR}/DEBIAN"109+ cat > "${DPKG_DIR}/DEBIAN/control" <<EOF110+Package: ${DPKG_BASENAME}111+Version: ${DPKG_VERSION}112+Section: utils113+Priority: optional114+Maintainer: ${MAINTAINER}115+Homepage: ${REPO}116+Architecture: ${DPKG_ARCH}117+Provides: fd118+Conflicts: ${DPKG_CONFLICTS}119+Description: 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.124+EOF125+126+DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"127+128+if [[ -n $GITHUB_OUTPUT ]]; then129+ echo "DPKG_NAME=${DPKG_NAME}" >> "$GITHUB_OUTPUT"130+ echo "DPKG_PATH=${DPKG_PATH}" >> "$GITHUB_OUTPUT"131+fi132+133+# build dpkg134+fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}"