Skip to content

Commit e3a96d9

Browse files
authored
Debian package (#3955)
This PR sets up a Debian package build for the Haskell backend, similarly to code that already exists for the LLVM backend and K Frontend. The changes here are additive and do not affect any of the build details of the existing backend code.
1 parent ac6c535 commit e3a96d9

File tree

11 files changed

+155
-2
lines changed

11 files changed

+155
-2
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,65 @@ jobs:
5555
- name: Build
5656
run: nix build .#kore-exec .#kore-rpc-booster
5757

58+
ubuntu-package:
59+
name: 'Build Ubuntu package'
60+
needs: draft-release
61+
runs-on: ubuntu-22.04
62+
steps:
63+
- name: Check out code
64+
uses: actions/checkout@v4
65+
with:
66+
submodules: recursive
67+
68+
- name: Cache Stack root
69+
uses: actions/cache@v4
70+
with:
71+
path: ~/.stack
72+
key: stack-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('stack.yaml.lock') }}
73+
restore-keys: |
74+
stack-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}
75+
stack-${{ runner.os }}-ghc-${{ env.ghc_version }}
76+
77+
- uses: haskell-actions/[email protected]
78+
id: setup-haskell-stack
79+
with:
80+
ghc-version: ${{ env.ghc_version }}
81+
stack-version: ${{ env.stack_version }}
82+
enable-stack: true
83+
stack-setup-ghc: true
84+
85+
- name: Build Ubuntu package
86+
run: ./package/debian/build-package jammy k-haskell-backend.deb
87+
88+
- name: 'Upload to release'
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
run: |
92+
set -x
93+
VERSION=v$(cat package/version)
94+
cp k-haskell-backend.deb k-haskell-backend_${VERSION}_amd64_ubuntu_jammy.deb
95+
gh release upload ${VERSION} \
96+
--repo runtimeverification/haskell-backend \
97+
--clobber \
98+
k-haskell-backend_${VERSION}_amd64_ubuntu_jammy.deb
99+
100+
- name: 'On failure, delete drafted release'
101+
if: failure()
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
run: |
105+
set -x
106+
VERSION=v$(cat package/version)
107+
gh release delete ${VERSION} \
108+
--repo runtimeverification/haskell-backend \
109+
--yes \
110+
--cleanup-tag
111+
58112
update-dependents:
59113
name: 'Publish Release'
60114
runs-on: ubuntu-latest
61115
environment: production
62-
needs: [draft-release, release]
116+
needs: [draft-release, ubuntu-package, release]
63117
env:
64118
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65119
VERSION: ${{ needs.draft-release.outputs.version }}

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ jobs:
191191
steps:
192192
- name: Install prerequisites
193193
run: |
194-
sudo apt install --yes z3 libsecp256k1-dev
194+
sudo apt install --yes debhelper z3 libsecp256k1-dev
195195
196196
- uses: actions/checkout@v4
197197
with:
@@ -230,6 +230,9 @@ jobs:
230230
- name: Run unit tests
231231
run: stack test kore:kore-test hs-backend-booster:unit-tests
232232

233+
- name: Build Ubuntu package
234+
run: ./package/debian/build-package jammy k-haskell-backend.deb
235+
233236
hlint:
234237
name: 'HLint'
235238
needs: formatting

package/debian/build-package

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -euxo pipefail
4+
5+
base_distro="$1" ; shift
6+
pkg_name="$1" ; shift
7+
8+
mkdir debian
9+
10+
mv package/debian/changelog debian/changelog
11+
mv package/debian/copyright debian/copyright
12+
mv package/debian/k-haskell-backend-docs.docs debian/k-haskell-backend-docs.docs
13+
mv package/debian/source debian/source
14+
15+
mv package/debian/compat.${base_distro} debian/compat
16+
mv package/debian/control.${base_distro} debian/control
17+
mv package/debian/rules.${base_distro} debian/rules
18+
19+
dpkg-buildpackage
20+
21+
mv ../k-haskell-backend_$(cat package/version)_amd64.deb ${pkg_name}

package/debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
k-haskell-backend (0.1.0) unstable; urgency=medium
2+
3+
* Initial release
4+
5+
-- Bruce Collie <[email protected]> Fri, 26 Apr 2024 15:43:00 +0100

package/debian/compat.jammy

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

package/debian/control.jammy

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Source: k-haskell-backend
2+
Section: devel
3+
Priority: optional
4+
Maintainer: Bruce Collie <[email protected]>
5+
Build-Depends: debhelper (>=10)
6+
Standards-Version: 3.9.6
7+
Homepage: https://github.com/runtimeverification/haskell-backend
8+
9+
Package: k-haskell-backend
10+
Architecture: any
11+
Section: devel
12+
Priority: optional
13+
Depends: libsecp256k1-dev , z3
14+
Description: K Framework Haskell Backend
15+
The symbolic execution engine powering the K Framework
16+
Homepage: https://github.com/runtimeverification/haskell-backend

package/debian/copyright

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: k-haskell-backend
3+
Upstream-Contact: Bruce Collie <[email protected]>
4+
Source: https://github.com/runtimeverification/haskell-backend
5+
6+
Files: *
7+
Copyright: 2018-2024 K Team <[email protected]>
8+
License: BSD-3-Clause
9+
10+
License: BSD-3-Clause
11+
Redistribution and use in source and binary forms, with or without
12+
modification, are permitted provided that the following conditions are met:
13+
14+
1. Redistributions of source code must retain the above copyright notice, this
15+
list of conditions and the following disclaimer.
16+
17+
2. Redistributions in binary form must reproduce the above copyright notice,
18+
this list of conditions and the following disclaimer in the documentation
19+
and/or other materials provided with the distribution.
20+
21+
3. Neither the name of the copyright holder nor the names of its
22+
contributors may be used to endorse or promote products derived from
23+
this software without specific prior written permission.
24+
25+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package/debian/k-haskell-backend-docs.docs

Whitespace-only changes.

package/debian/rules.jammy

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/make -f
2+
3+
DESTDIR=$(shell pwd)/debian/k-haskell-backend
4+
PREFIX=/usr
5+
export DESTDIR
6+
export PREFIX
7+
8+
%:
9+
dh $@
10+
11+
override_dh_auto_build:
12+
stack build
13+
14+
override_dh_auto_install:
15+
stack install --local-bin-path $(DESTDIR)$(PREFIX)/bin
16+
17+
override_dh_auto_test:

package/debian/source/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (native)

package/version.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ version_sub() {
3232
sed -i "s/^version: '.*'$/version: '${version}'/" booster/package.yaml
3333
sed -i "s/^version: .*$/version: ${version}/" kore/kore.cabal
3434
sed -i "s/^version: .*$/version: ${version}/" ./kore-rpc-types/kore-rpc-types.cabal
35+
sed -i 's/^k-haskell-backend (.*) unstable; urgency=medium$/k-haskell-backend ('"$version"') unstable; urgency=medium/' package/debian/changelog
3536
}
3637

3738
version_command="$1" ; shift

0 commit comments

Comments
 (0)