Skip to content

Commit f670f86

Browse files
committed
meta: Simplified bootstraping cutekit using uv.
1 parent fd4eb8f commit f670f86

File tree

15 files changed

+154
-149
lines changed

15 files changed

+154
-149
lines changed

.github/workflows/check-darwin.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,11 @@ jobs:
1212
with:
1313
fetch-depth: 0
1414

15-
- name: Setup Python
16-
uses: actions/setup-python@v3
17-
with:
18-
python-version: '3.13'
19-
2015
- name: Setup Build Environment
2116
run: ./ck tools setup && ./ck tools doctor
2217

2318
- name: Build Libraries (Host)
24-
run: ./ck builder build
19+
run: ./ck build
2520

2621
- name: Test Libraries (Host)
27-
run: ./ck builder test
22+
run: ./ck test

.github/workflows/checks-linux.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,14 @@ jobs:
1111
with:
1212
fetch-depth: 0
1313

14-
- name: Setup Python
15-
uses: actions/setup-python@v3
16-
with:
17-
python-version: '3.13'
18-
1914
- name: Setup Build Environment
2015
run: ./ck tools setup && ./ck tools doctor
2116

22-
2317
- name: Build Libraries
24-
run: ./ck builder build
18+
run: ./ck build
2519

2620
- name: Test Libraries
27-
run: ./ck builder test
21+
run: ./ck test
2822

2923
- name: Run Reftests
3024
run: ./ck reftests run --headless
31-
32-
- name: Check for formatting errors
33-
run: ./meta/scripts/style-check.sh || echo "Please run ./meta/scripts/style-format.sh"

ck

Lines changed: 3 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,7 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
set -e
44

5-
function is_ubuntu() {
6-
if [ -f /etc/os-release ]; then
7-
grep -q "ubuntu" /etc/os-release
8-
return $?
9-
fi
10-
return 1
11-
}
12-
13-
function is_debian() {
14-
if [ -f /etc/os-release ]; then
15-
grep -q "debian" /etc/os-release
16-
return $?
17-
fi
18-
return 1
19-
}
20-
21-
function is_darwin() {
22-
if [ "$(uname)" == "Darwin" ]; then
23-
return 0
24-
fi
25-
return 1
26-
}
27-
28-
function is_arch() {
29-
if [ -f /etc/os-release ]; then
30-
grep -q "Arch Linux" /etc/os-release
31-
return $?
32-
fi
33-
return 1
34-
}
35-
36-
if [ "$EUID" -eq 0 ]; then
37-
export CUTEKIT_ELEVATOR=""
38-
elif [ -z "$CUTEKIT_ELEVATOR" ]; then
39-
export CUTEKIT_ELEVATOR="sudo"
40-
fi
41-
42-
if [ -z "$CUTEKIT_PYTHON" ]; then
43-
if command -v python3.11 &> /dev/null; then
44-
export CUTEKIT_PYTHON="python3.11"
45-
elif command -v python3.12 &> /dev/null; then
46-
export CUTEKIT_PYTHON="python3.12"
47-
else
48-
export CUTEKIT_PYTHON="python3"
49-
fi
50-
fi
51-
525
if [ "$EUID" -eq 0 ]; then
536
echo "Please do not run this script as root."
547

@@ -61,71 +14,5 @@ if [ "$EUID" -eq 0 ]; then
6114
fi
6215
fi
6316

64-
if [ "$CUTEKIT_NOVENV" == "1" ]; then
65-
echo "CUTEKIT_NOVENV is set, skipping virtual environment setup."
66-
exec cutekit $@
67-
fi
68-
69-
if [ "$1" == "tools" -a "$2" == "nuke" ]; then
70-
rm -rf .cutekit/tools .cutekit/venv .cutekit/tools-ready
71-
exit 0
72-
fi
73-
74-
if [ ! -f .cutekit/tools-ready ]; then
75-
if [ ! \( "$1" == "tools" -a "$2" == "setup" \) ]; then
76-
echo "Tools not installed."
77-
echo "This script will install the tooling required to build Paper Muncher into $PWD/.cutekit"
78-
79-
read -p "Do you want to continue? [Y/n] " -n 1 -r
80-
echo
81-
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
82-
echo "Aborting."
83-
exit 1
84-
fi
85-
else
86-
echo "Installing tools..."
87-
fi
88-
89-
if is_ubuntu; then
90-
echo "Detected Ubuntu, installing dependencies automatically..."
91-
$CUTEKIT_ELEVATOR ./meta/scripts/setup-ubuntu.sh
92-
elif is_debian; then
93-
echo "Detected Debian, installing dependencies automatically..."
94-
$CUTEKIT_ELEVATOR ./meta/scripts/setup-debian.sh
95-
elif is_arch; then
96-
echo "Detected Arch Linux, installing dependencies automatically..."
97-
$CUTEKIT_ELEVATOR ./meta/scripts/setup-arch.sh
98-
elif is_darwin; then
99-
echo "Detected macOS, installing dependencies automatically..."
100-
./meta/scripts/setup-darwin.sh
101-
fi
102-
103-
mkdir -p .cutekit
104-
if [ ! -d .cutekit/venv ]; then
105-
echo "Setting up Python virtual environment..."
106-
$CUTEKIT_PYTHON -m venv .cutekit/venv
107-
fi
108-
source .cutekit/venv/bin/activate
109-
110-
echo "Installing Tools..."
111-
pip3 install -r meta/plugins/requirements.txt
112-
113-
touch .cutekit/tools-ready
114-
echo "Done!"
115-
fi
116-
117-
if [ "$1" == "tools" -a "$2" == "setup" ]; then
118-
echo "Tools already installed."
119-
exit 0
120-
fi
121-
122-
if is_ubuntu; then
123-
source ./meta/scripts/env-ubuntu.sh
124-
elif is_darwin; then
125-
source ./meta/scripts/env-darwin.sh
126-
fi
127-
128-
source .cutekit/venv/bin/activate
129-
export PATH="$PATH:.cutekit/venv/bin"
130-
131-
cutekit $@
17+
source ./meta/scripts/setup-any.sh
18+
meta/scripts/cutekit-wrapper.py $@

meta/packaging/build

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
meta/packaging/debian-bookworm/build
6+
meta/packaging/ubuntu-jammy/build
7+
meta/packaging/ubuntu-noble/build

meta/packaging/debian-bookworm/build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
rm -rf .cutekit/venv
33
rm -rf .cutekit/tools-ready
44
rm -rf sysroot/
5+
56
podman run \
67
--rm \
78
-v "$PWD:/src" \
@@ -10,10 +11,10 @@ podman run \
1011
debian:bookworm \
1112
bash -c " \
1213
./ck tools setup && \
13-
./ck install --release --prefix=/opt/paper-muncher --sysroot=/src/sysroot paper-muncher && \
14+
./ck install --release --prefix=/opt/${COMPONENT} --sysroot=/src/sysroot ${COMPONENT} && \
1415
mkdir /deb && \
1516
mkdir /deb/DEBIAN && \
1617
cp -r /src/sysroot/* /deb && \
1718
cp -r meta/packaging/debian-bookworm/debian/* /deb/DEBIAN && \
1819
mkdir -p /src/dist && \
19-
dpkg-deb --build /deb /src/dist/paper-muncher_$(CUTEKIT_VERSION)_bookworm_amd64.deb"
20+
dpkg-deb --build /deb /src/dist/${COMPONENT}_${VERSION}_bookworm_amd64.deb"

meta/packaging/ubuntu-jammy/build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
rm -rf .cutekit/venv
33
rm -rf .cutekit/tools-ready
44
rm -rf sysroot/
5+
56
podman run \
67
--rm \
78
-v "$PWD:/src" \
89
-w "/src" \
910
-e CUTEKIT_ALLOW_ROOT=1 \
10-
-e CUTEKIT_PYTHON=python3.11 \
1111
ubuntu:jammy \
1212
bash -c " \
1313
./ck tools setup && \
14-
./ck install --release --prefix=/opt/paper-muncher --sysroot=/src/sysroot paper-muncher && \
14+
./ck install --release --prefix=/opt/${COMPONENT} --sysroot=/src/sysroot ${COMPONENT} && \
1515
mkdir /deb && \
1616
mkdir /deb/DEBIAN && \
1717
cp -r /src/sysroot/* /deb && \
1818
cp -r meta/packaging/ubuntu-jammy/debian/* /deb/DEBIAN && \
1919
mkdir -p /src/dist && \
20-
dpkg-deb --build /deb /src/dist/paper-muncher_$(CUTEKIT_VERSION)_jammy_amd64.deb"
20+
dpkg-deb --build /deb /src/dist/${COMPONENT}_${VERSION}_jammy_amd64.deb"

meta/packaging/ubuntu-noble/build

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
rm -rf .cutekit/venv
3+
rm -rf .cutekit/tools-ready
4+
rm -rf sysroot/
5+
6+
podman run \
7+
--rm \
8+
-v "$PWD:/src" \
9+
-w "/src" \
10+
-e CUTEKIT_ALLOW_ROOT=1 \
11+
ubuntu:noble \
12+
bash -c " \
13+
./ck tools setup && \
14+
./ck install --release --prefix=/opt/${COMPONENT} --sysroot=/src/sysroot ${COMPONENT} && \
15+
mkdir /deb && \
16+
mkdir /deb/DEBIAN && \
17+
cp -r /src/sysroot/* /deb && \
18+
cp -r meta/packaging/ubuntu-noble/debian/* /deb/DEBIAN && \
19+
mkdir -p /src/dist && \
20+
dpkg-deb --build /deb /src/dist/${COMPONENT}_${VERSION}_noble_amd64.deb"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Package: paper-muncher
2+
Description: Munch the web into crisp documents
3+
Version: 0.1.0-alpha
4+
Section: utils
5+
Priority: optional
6+
Architecture: amd64
7+
Maintainer: Odoo S.A. <[email protected]>
8+
Depends: liburing2, libseccomp2

meta/plugins/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

meta/plugins/tools.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def checkForSymbol(header: str, symbol: str) -> bool:
134134
)
135135

136136

137-
@cli.command("n", "tools/nuke", "Nuke the development tools")
138137
@cli.command("s", "tools/setup", "Setup the development environment")
139138
def _():
140139
raise RuntimeError("Don't use ck directly, use ./ck instead.")

0 commit comments

Comments
 (0)