Skip to content

Commit d30a251

Browse files
committed
Implement proper Debian packaging
1 parent 02e77fa commit d30a251

File tree

8 files changed

+120
-22
lines changed

8 files changed

+120
-22
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ rust:
77
addons:
88
apt:
99
packages:
10-
- liblzma-dev
10+
- debhelper
11+
- fakeroot
1112

1213
cache:
1314
cargo: true
@@ -30,14 +31,13 @@ jobs:
3031
- stage: release
3132
if: tag IS present
3233
script:
33-
- "rm -f \"./target/debian/*.deb\""
34-
- cargo install cargo-deb
35-
- env CARGO_TARGET_DIR=target CARGO_INCREMENTAL=0 cargo deb
34+
- rm -f "./pkg/deb/*.deb"
35+
- ./pkg/deb/makedeb
3636
deploy:
3737
provider: releases
3838

3939
file_glob: true
40-
file: "./target/debian/*.deb"
40+
file: "./pkg/deb/*.deb"
4141

4242
api_key:
4343
secure: oqadPMv+UVvrZ/33Bkgch8tc4cSqdaeMNesRm8lcNOGdLfEYhOFWu8kD9ZKSteLgA5KyWYmxKZxfjfqzRLYgPlkSOBb2Xgxhwm/MRZNU0DnqR6TSeyzcLWU9k6EQ5I8JoNferwKosy69MqoOmh0YNQT/lHoGviqsL1GTiiwBiSTUE5Jve73+vNqxbZZ+TnjvZrrSHP+clgbFR15WxR7yxMifZoqNFGLkloxFFKkB/RkArKh+it4SZNv05ZiyuP5AikvqTYlwct/efR8wcu1BOAUSzEPLAP2RFc+anJbnz5UKVH85MDv0Iyru6m35+xMAx6zkmSCBTa1Y8vkoe0OKD7s0tapcpXUyCzP2uMsQPBLssP1c+SkavwSotElLvSx6JZ9RvqyDKn/sMDngrtUf9zCa0ve4g+jlNG7ebQODLUAy1qTgYiELWObAk+eMt61sKmmNIg3teoBJ9YcxdLHCmKmykk+KJaPP0JsexT8m2gs05EScoAVrbs0ZZl8dfONUPHimuF2k1ikrfTtblmtwKxjGMbo9LDyJ++cz1InGvxzl6eK/KCnCO0DCawuWuL2sRtGvhYZgsWOLgaaT5lHnJFQu560xGbScE8swIe30wZ06NfW04zKgEqp5N9YU6eqMpwrY8CBXziDLwQGPvJ2w2kRzTPhxERX/jkWkA1p/Dy8=

Cargo.toml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,6 @@ license = "MIT"
1111
edition = "2018"
1212
build = "build.rs"
1313

14-
15-
[package.metadata.deb]
16-
maintainer = "Maximilian Luz <[email protected]>"
17-
license-file = ["LICENSE", "0"]
18-
extended-description = """\
19-
Control various aspects of Microsoft Surface devices, such as
20-
performance-modes and dGPU power, from the Command Line."""
21-
depends = "$auto"
22-
section = "utility"
23-
priority = "optional"
24-
assets = [
25-
["target/release/surface", "usr/bin/", "755"],
26-
["target/surface.bash", "usr/share/bash-completion/completions/surface", "644"],
27-
["target/_surface", "usr/share/zsh/vendor-completions/_surface", "644"],
28-
["target/surface.fish", "usr/share/fish/completions/surface.fish", "644"],
29-
]
30-
3114
[dependencies]
3215
clap = "2.33.0"
3316
indoc = "0.3.4"

pkg/deb/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
src/
2+
*.tar
3+
*.buildinfo
4+
*.changes
5+
*.deb

pkg/deb/debian/changelog

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
surface-control (0.2.3) unstable; urgency=medium
2+
3+
* Update dependencies
4+
5+
-- Maximilian Luz <[email protected]> Thu, 05 Sep 2019 01:49:30 +0200
6+
7+
surface-control (0.2.2) unstable; urgency=medium
8+
9+
* Bugfixes
10+
11+
-- Maximilian Luz <[email protected]> Fri, 10 May 2019 01:48:19 +0200
12+
13+
surface-control (0.2.1) unstable; urgency=medium
14+
15+
* Minor usability improvements
16+
17+
-- Maximilian Luz <[email protected]> Tue, 15 Apr 2019 01:47:46 +0200
18+
19+
surface-control (0.2.0) unstable; urgency=medium
20+
21+
* UX Improvements
22+
23+
-- Maximilian Luz <[email protected]> Mon, 14 Apr 2019 01:46:22 +0200
24+
25+
surface-control (0.1.0) unstable; urgency=medium
26+
27+
* Initial release
28+
29+
-- Maximilian Luz <[email protected]> Sun, 13 Apr 2019 16:50:43 +0000
30+

pkg/deb/debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10

pkg/deb/debian/control

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Source: surface-control
2+
Section: misc
3+
Priority: optional
4+
Maintainer: Maximilian Luz <[email protected]>
5+
Build-Depends: build-essential, debhelper (>= 10), cargo, rustc (>= 1.34.0)
6+
7+
Package: surface-control
8+
Architecture: amd64
9+
Depends: libc6 (>= 2.19), libgcc1 (>= 1:4.9.2)
10+
Description: Control various aspects of Microsoft Surface devices on Linux from the Command-Line

pkg/deb/debian/rules

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/make -f
2+
export DH_VERBOSE = 1
3+
4+
pkgdir = debian/surface-control
5+
6+
clean:
7+
dh clean
8+
cargo clean
9+
10+
build:
11+
dh build
12+
env CARGO_TARGET_DIR="${PWD}/target" CARGO_INCREMENTAL=0 cargo build --release --locked
13+
14+
override_dh_install:
15+
# binary files
16+
install -D -m755 "target/release/surface" "${pkgdir}/usr/bin/surface"
17+
18+
# completion files
19+
install -D -m644 "target/surface.bash" "${pkgdir}/usr/share/bash-completion/completions/surface"
20+
install -D -m644 "target/_surface" "${pkgdir}/usr/share/zsh/vendor-completions/_surface"
21+
install -D -m644 "target/surface.fish" "${pkgdir}/usr/share/fish/completions/surface.fish"
22+
23+
%:
24+
dh $@

pkg/deb/makedeb

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
set -e
3+
4+
branch="HEAD"
5+
basepath="pkg/deb"
6+
7+
8+
pushd() {
9+
command pushd "$@" > /dev/null
10+
}
11+
12+
popd() {
13+
command popd "$@" > /dev/null
14+
}
15+
16+
17+
chkdir() {
18+
if [ ! -d ".git" ]
19+
then
20+
echo "Error: Script must be run from the root directory"
21+
exit 1
22+
fi
23+
}
24+
25+
prepare() {
26+
archive="src.tar"
27+
28+
git archive --format tar "$branch" > "$basepath/$archive"
29+
30+
mkdir -p "$basepath/src"
31+
tar xf "$basepath/$archive" --directory "$basepath/src"
32+
33+
cp -r "$basepath/debian" "$basepath/src/"
34+
}
35+
36+
build() {
37+
pushd "$basepath/src"
38+
dpkg-buildpackage -b -d -us -uc
39+
popd
40+
}
41+
42+
43+
chkdir
44+
prepare
45+
build

0 commit comments

Comments
 (0)