Skip to content

Commit 548c5d5

Browse files
AndrewQuijanolacraig2
authored andcommitted
Implement Ubuntu 24 Container/Debian Packages
1 parent 5b13ee0 commit 548c5d5

File tree

6 files changed

+44
-52
lines changed

6 files changed

+44
-52
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Explicitly enforce LF for specific files, if these are in CRLF it breaks the Debian package...
22
panda/debian/control eol=lf
3-
pnada/debian/triggers eol=lf
3+
panda/debian/triggers eol=lf

.github/workflows/publish_docker.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111

1212
jobs:
1313
get_version:
14-
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
14+
if: github.repository == 'panda-re/panda' && github.ref == 'refs/heads/dev'
1515
runs-on: panda-arc
1616
outputs:
1717
v-version: ${{ steps.version.outputs.v-version }}
@@ -111,7 +111,7 @@ jobs:
111111
matrix:
112112
ubuntu_version:
113113
- 22.04
114-
114+
- 24.04
115115
steps:
116116
- name: Install git
117117
run: sudo apt-get -qq update -y && sudo apt-get -qq install git curl jq -y
@@ -137,7 +137,12 @@ jobs:
137137
echo "Fetching certificate from registry"
138138
openssl s_client -showcerts -connect ${{ secrets.PANDA_ARC_REGISTRY }}:443 < /dev/null 2>/dev/null | openssl x509 -outform PEM | sudo tee /usr/local/share/ca-certificates/harbor.crt > /dev/null
139139
sudo update-ca-certificates
140-
140+
# Remove the leading v from the version string and set it as an environment variable
141+
- name: Extract PACKAGE_VERSION without 'v'
142+
run: |
143+
VERSION=${{ needs.get_version.outputs.v-version }}
144+
VERSION=${VERSION#v}
145+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
141146
- name: Log in to Rehosting Arc Registry
142147
uses: docker/login-action@v3
143148
with:
@@ -161,22 +166,24 @@ jobs:
161166
type=registry,ref=${{secrets.PANDA_ARC_REGISTRY}}/pandare/panda:packagecache,mode=max
162167
build-args: |
163168
REGISTRY=${{ secrets.PANDA_ARC_REGISTRY }}/proxy
169+
BASE_IMAGE=ubuntu:${{ matrix.ubuntu_version }}
170+
PACKAGE_VERSION=${{ env.RELEASE_VERSION }}
164171
165172
- name: Build package
166173
working-directory: panda/debian
167174
run: |
168175
docker run --rm -v $(pwd):/out packager bash -c "cp /*.whl /pandare.deb /out"
169176
mv pandare.deb pandare_${{ matrix.ubuntu_version }}.deb
170177
- name: Upload deb packages as artifacts
171-
uses: actions/upload-artifact@v4
178+
uses: actions/upload-artifact@v5
172179
with:
173180
name: pandare_${{ matrix.ubuntu_version }}
174181
path: panda/debian/pandare*.deb
175182
if-no-files-found: error
176183

177184
- name: Upload whl package as artifact
178185
if: ${{ matrix.ubuntu_version == env.PANDA_CONTAINER_UBUNTU_VERSION }}
179-
uses: actions/upload-artifact@v4
186+
uses: actions/upload-artifact@v5
180187
with:
181188
name: pypanda
182189
path: panda/debian/pandare*.whl

Dockerfile

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#syntax=docker/dockerfile:1.17-labs
22
ARG REGISTRY="docker.io"
3-
ARG UBUNTU_MAJOR_VERSION="22"
43
ARG BASE_IMAGE="ubuntu:22.04"
54
ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu"
65
ARG CAPSTONE_VERSION="5.0.5"
@@ -26,10 +25,20 @@ COPY ./panda/dependencies/${BASE_IMAGE/:/_}_build.txt /tmp/build_dep.txt
2625
RUN apt-get -qq update && \
2726
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $(cat /tmp/build_dep.txt | grep -o '^[^#]*') && \
2827
apt-get clean && \
29-
python3 -m pip install --upgrade --no-cache-dir pip && \
30-
python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" && \
31-
python3 -m pip install --upgrade --no-cache-dir "capstone" && \
32-
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
28+
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal && \
29+
UBUNTU_VERSION=$(lsb_release -rs) && \
30+
if dpkg --compare-versions "$UBUNTU_VERSION" ge "23.04"; then \
31+
python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" --break-system-packages && \
32+
python3 -m pip install --upgrade --no-cache-dir "capstone" --break-system-packages; \
33+
python3 -m pip install setuptools_scm --break-system-packages && \
34+
python3 -m pip install build --break-system-packages; \
35+
else \
36+
python3 -m pip install --upgrade --no-cache-dir pip && \
37+
python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" && \
38+
python3 -m pip install --upgrade --no-cache-dir "capstone"; \
39+
python3 -m pip install setuptools_scm && \
40+
python3 -m pip install build; \
41+
fi
3342

3443
# Then install capstone debian package
3544
RUN cd /tmp && \
@@ -67,13 +76,13 @@ COPY .git /panda/
6776
RUN git -C /panda submodule update --init dtc && \
6877
git -C /panda rev-parse HEAD > /usr/local/panda_commit_hash && \
6978
mkdir /panda/build && cd /panda/build && \
70-
python3 -m pip install setuptools_scm && \
71-
python3 -m pip install build && \
7279
python3 -m setuptools_scm -r .. --strip-dev 2>/dev/null >/tmp/savedversion && \
7380
/panda/configure \
7481
--target-list="${TARGET_LIST}" \
7582
--prefix=/usr/local \
7683
--disable-numa \
84+
--extra-cflags=-Wno-error \
85+
--extra-cxxflags=-Wno-error \
7786
--enable-llvm && \
7887
rm -rf /panda/.git
7988

@@ -105,7 +114,12 @@ RUN make -C /panda/build install && \
105114
RUN cd /panda/panda/python/core && \
106115
python3 create_panda_datatypes.py --install && \
107116
PRETEND_VERSION=$(cat /tmp/savedversion) python3 -m build --wheel . && \
108-
PRETEND_VERSION=$(cat /tmp/savedversion) pip install .
117+
UBUNTU_VERSION=$(lsb_release -rs) && \
118+
if dpkg --compare-versions "$UBUNTU_VERSION" ge "23.04"; then \
119+
python3 -m pip install dist/*.whl --break-system-packages; \
120+
else \
121+
python3 -m pip install dist/*.whl; \
122+
fi
109123

110124
# BUG: PANDA sometimes fails to generate all the necessary files for PyPANDA. This is a temporary fix to detect and fail when this occurs
111125
RUN ls -alt $(pip show pandare | grep Location: | awk '{print $2}')/pandare/autogen/
@@ -153,6 +167,7 @@ RUN ldconfig && \
153167

154168

155169
FROM base AS packager
170+
ARG PACKAGE_VERSION
156171

157172
# Install necessary tools for packaging
158173
RUN apt-get -qq update && \
@@ -180,7 +195,6 @@ RUN cd /package-root && \
180195
find . -type f ! -path './DEBIAN/*' -exec md5sum {} + | sed 's| \./| |' > /package-root/DEBIAN/md5sums
181196

182197
# Update control file with the correct version, and place installed size
183-
ARG PACKAGE_VERSION
184198
RUN INSTALLED_SIZE=$(du -sk /package-root | cut -f1) && \
185199
sed -i "s/^Installed-Size:.*/Installed-Size: ${INSTALLED_SIZE}/" /package-root/DEBIAN/control
186200
RUN sed -i "s/^Version:.*/Version: ${PACKAGE_VERSION}/" /package-root/DEBIAN/control

panda/debian/Dockerfile

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

panda/dependencies/ubuntu_22.04_base.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Note that libcapstone >= v4.1 is also required, but that's not available in apt
33
git
44
libdwarf1
5+
dwarfdump
56
libjsoncpp-dev
67
libllvm14
78
libprotobuf-c-dev
@@ -14,6 +15,9 @@ python3
1415
python3-pip
1516
wget
1617

18+
# Get Ubuntu Version
19+
lsb-release
20+
1721
# pyperipheral (only needed for armel)
1822
libpython3-dev
1923

panda/dependencies/ubuntu_24.04_base.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Note that libcapstone >= v4.1 is also required, but that's not available in apt
33
git
44
libdwarf-dev
5+
dwarfdump
56
libjsoncpp-dev
67
libllvm14t64
78
libprotobuf-c-dev
@@ -14,6 +15,9 @@ python3
1415
python3-pip
1516
wget
1617

18+
# Get Ubuntu Version
19+
lsb-release
20+
1721
# pyperipheral (only needed for armel)
1822
libpython3-dev
1923

0 commit comments

Comments
 (0)