From 69ec7bd4ee082e356f0d3234f3c1fde4e240e07b Mon Sep 17 00:00:00 2001 From: MusiKid Date: Mon, 9 Nov 2020 14:18:36 +0100 Subject: [PATCH] Add support for Debian packaging of the CLI --- .github/workflows/cli-release.yml | 71 +++++++++++++++++++ Cargo.lock | 109 +++++++++++++++++------------- Makefile | 2 +- cli/Makefile | 3 +- cli/debian/README | 6 ++ cli/debian/changelog | 5 ++ cli/debian/compat | 1 + cli/debian/control | 16 +++++ cli/debian/copyright | 6 ++ cli/debian/fancy-cli-docs.docs | 1 + cli/debian/manpage.1 | 56 +++++++++++++++ cli/debian/rules | 5 ++ 12 files changed, 231 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/cli-release.yml create mode 100644 cli/debian/README create mode 100644 cli/debian/changelog create mode 100644 cli/debian/compat create mode 100644 cli/debian/control create mode 100644 cli/debian/copyright create mode 100644 cli/debian/fancy-cli-docs.docs create mode 100644 cli/debian/manpage.1 create mode 100755 cli/debian/rules diff --git a/.github/workflows/cli-release.yml b/.github/workflows/cli-release.yml new file mode 100644 index 0000000..9379cba --- /dev/null +++ b/.github/workflows/cli-release.yml @@ -0,0 +1,71 @@ +name: Build cli releases +on: + push: + tags: + - "fancy-cli-*" + +jobs: +# Version is not properly formatted for direct use + filter: + runs-on: ubuntu-latest + name: Get version + outputs: + version: ${{ steps.filter.outputs.version }} + env: + VERSION: ${{ github.ref }} + steps: + - run: echo $VERSION | cut -d- -f3 | tr -d '[:space:]' | xargs printf "::set-output name=version::%s" + id: filter + + create_release: + runs-on: ubuntu-latest + name: Create release + needs: filter + outputs: + upload_url: ${{ steps.create.outputs.upload_url }} + steps: + - uses: actions/checkout@v2 + - uses: actions/create-release@v1 + id: create + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ format('Fancy CLI v{0}', needs.filter.outputs.version) }} + + ubuntu: + runs-on: ubuntu-latest + name: Build (Ubuntu) + needs: [create_release, filter] + steps: + - name: Install required packages + run: sudo apt update && sudo apt install -y libdbus-1-dev libgtk-3-dev build-essential debhelper dh-make devscripts fakeroot + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - uses: actions/checkout@v2 + + - name: Build the package + working-directory: ./cli + run: dpkg-buildpackage --no-sign + + - name: Find the package file + id: find_file + run: | + path=$(find .. -name '*.deb' -print -quit) + echo "::set-output name=path::$path" + echo "::set-output name=name::$(basename $path)" + + - name: Upload Debian package + id: upload-deb + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ${{ steps.find_file.outputs.path }} + asset_name: ${{ steps.find_file.outputs.name }} + asset_content_type: application/vnd.debian.binary-package diff --git a/Cargo.lock b/Cargo.lock index 2ba9d6d..e43c280 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.13" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ "memchr", ] @@ -18,12 +18,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "arc-swap" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" - [[package]] name = "atty" version = "0.2.14" @@ -77,9 +71,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.59" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381" +checksum = "f1770ced377336a88a67c473594ccc14eca6f4559217c34f64aac8f83d641b40" [[package]] name = "cfg-if" @@ -177,9 +171,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" dependencies = [ "cfg-if", "libc", @@ -194,9 +188,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "hermit-abi" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" +checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" dependencies = [ "libc", ] @@ -224,9 +218,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.76" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3" +checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" [[package]] name = "libdbus-sys" @@ -248,9 +242,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "nix" @@ -273,15 +267,15 @@ checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" [[package]] name = "pkg-config" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "pretty_env_logger" @@ -295,24 +289,24 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.19" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ "unicode-xid 0.2.1", ] [[package]] name = "psutil" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "094d0f0f32f77f62cd7d137d9b9599ef257d5c1323b36b25746679de2806f547" +checksum = "7cdb732329774b8765346796abd1e896e9b3c86aae7f135bb1dda98c2c460f55" dependencies = [ "cfg-if", "glob", "nix", "once_cell", - "snafu", + "thiserror", ] [[package]] @@ -389,9 +383,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.9" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" dependencies = [ "aho-corasick", "memchr", @@ -401,28 +395,28 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.18" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" [[package]] name = "serde" -version = "1.0.115" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" +checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.115" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48" +checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" dependencies = [ "proc-macro2", "quote 1.0.7", - "syn 1.0.39", + "syn 1.0.48", ] [[package]] @@ -437,19 +431,18 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" +checksum = "ce32ea0c6c56d5eacaeb814fbed9960547021d3edd010ded1425f180536b20ab" dependencies = [ - "arc-swap", "libc", ] [[package]] name = "snafu" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f5aed652511f5c9123cf2afbe9c244c29db6effa2abb05c866e965c82405ce" +checksum = "9c4e6046e4691afe918fd1b603fd6e515bcda5388a1092a9edbada307d159f09" dependencies = [ "doc-comment", "snafu-derive", @@ -457,13 +450,13 @@ dependencies = [ [[package]] name = "snafu-derive" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf8f7d5720104a9df0f7076a8682024e958bba0fe9848767bb44f251f3648e9" +checksum = "7073448732a89f2f3e6581989106067f403d378faeafb4a50812eb814170d3e5" dependencies = [ "proc-macro2", "quote 1.0.7", - "syn 1.0.39", + "syn 1.0.48", ] [[package]] @@ -485,9 +478,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.39" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9" +checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" dependencies = [ "proc-macro2", "quote 1.0.7", @@ -521,6 +514,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56" +dependencies = [ + "proc-macro2", + "quote 1.0.7", + "syn 1.0.48", +] + [[package]] name = "thread_local" version = "1.0.1" @@ -532,9 +545,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" +checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" dependencies = [ "serde", ] diff --git a/Makefile b/Makefile index 3a6df5d..17869dc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: cli service -.PHONY: cli service install uninstall +.PHONY: cli service cli: make -C cli/ diff --git a/cli/Makefile b/cli/Makefile index e42a6e8..36204b9 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -1,4 +1,5 @@ BINDIR := $(DESTDIR)/usr/bin +TARGET_NAME := fancy-cli NAME := fancy all: @@ -8,7 +9,7 @@ test: cargo test --release install: - [ -e "../Cargo.toml" ] && install -Dm744 -s ../target/release/"$(NAME)" "$(BINDIR)/$(NAME)" || install -Dm744 -s target/release/"$(NAME)" "$(BINDIR)/$(NAME)" + [ -e "../Cargo.toml" ] && install -Dm744 -s ../target/release/"$(TARGET_NAME)" "$(BINDIR)/$(NAME)" || install -Dm744 -s target/release/"$(TARGET_NAME)" "$(BINDIR)/$(NAME)" uninstall: rm "$(BINDIR)/$(NAME)" diff --git a/cli/debian/README b/cli/debian/README new file mode 100644 index 0000000..5c396a3 --- /dev/null +++ b/cli/debian/README @@ -0,0 +1,6 @@ +The Debian Package fancy-cli +---------------------------- + +Comments regarding the Package + + -- Musikid Sat, 22 Aug 2020 23:19:09 +0000 diff --git a/cli/debian/changelog b/cli/debian/changelog new file mode 100644 index 0000000..e38c1aa --- /dev/null +++ b/cli/debian/changelog @@ -0,0 +1,5 @@ +fancy-cli (0.1.0) unstable; urgency=medium + + * Initial Release. + + -- Musikid Sat, 22 Aug 2020 23:19:09 +0000 diff --git a/cli/debian/compat b/cli/debian/compat new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/cli/debian/compat @@ -0,0 +1 @@ +11 diff --git a/cli/debian/control b/cli/debian/control new file mode 100644 index 0000000..f5c6d8d --- /dev/null +++ b/cli/debian/control @@ -0,0 +1,16 @@ +Source: fancy-cli +Section: misc +Priority: optional +Maintainer: Musikid +Build-Depends: debhelper (>= 11), dbus +#FIXME: rust should be in the deps +Standards-Version: 4.1.3 +Homepage: https://github.com/MusiKid/fancy +Vcs-Browser: https://github.com/MusiKid/fancy +Vcs-Git: https://github.com/MusiKid/fancy.git + +Package: fancy-cli +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, dbus +Recommends: systemd +Description: CLI for Fancy, a set of software to control laptop fans diff --git a/cli/debian/copyright b/cli/debian/copyright new file mode 100644 index 0000000..59e50a6 --- /dev/null +++ b/cli/debian/copyright @@ -0,0 +1,6 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: fancy-cli +Source: https://github.com/MusiKid/fancy.git +Files: * +Copyright: 2020 Musikid +License: MPL-2.0 diff --git a/cli/debian/fancy-cli-docs.docs b/cli/debian/fancy-cli-docs.docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/cli/debian/fancy-cli-docs.docs @@ -0,0 +1 @@ +README diff --git a/cli/debian/manpage.1 b/cli/debian/manpage.1 new file mode 100644 index 0000000..3a66ba7 --- /dev/null +++ b/cli/debian/manpage.1 @@ -0,0 +1,56 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" (C) Copyright 2020 Musikid , +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH FANCY-CLI 8 "August 22 2020" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +fancy-cli \- program to do something +.SH SYNOPSIS +.B fancy +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B fancy-cli +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBfancy-cli\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. diff --git a/cli/debian/rules b/cli/debian/rules new file mode 100755 index 0000000..b5b77e2 --- /dev/null +++ b/cli/debian/rules @@ -0,0 +1,5 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) + +%: + dh $@