Skip to content

Commit ee06710

Browse files
committed
Centralize all dependancy information and also update some packages
1 parent d6fb436 commit ee06710

File tree

9 files changed

+51
-39
lines changed

9 files changed

+51
-39
lines changed

.github/workflows/parallel_tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ on:
2020
jobs:
2121

2222
test_installer: # test install_ubuntu.sh
23-
runs-on: panda-arc # Note 22.04 would work, but it requires docker > 20.10.7 which is not on our CI box (yet)
23+
runs-on: panda-arc
2424
container:
25-
image: ubuntu:20.04
25+
image: ubuntu:22.04
2626
steps:
2727
- name: Update
2828
run: apt-get -qq update -y
@@ -31,9 +31,9 @@ jobs:
3131
- name: Set up Python
3232
uses: actions/setup-python@v5
3333
with:
34-
python-version: 3.9
34+
python-version: '3.10'
3535
- name: Install Python dev headers
36-
run: apt-get -qq install -y libpython3.9-dev
36+
run: apt-get -qq install -y libpython3.10-dev
3737
- uses: actions/checkout@v4 # Clones to $GITHUB_WORKSPACE. NOTE: this requires git > 2.18 (not on ubuntu 18.04 by default) to get .git directory
3838
- name: Lint PyPANDA with flake8
3939
run: |

Dockerfile

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
ARG BASE_IMAGE="ubuntu:20.04"
22
ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu"
33
ARG LIBOSI_VERSION="v0.1.7"
4+
ARG INSTALL_PREFIX="/usr/local"
45

56
### BASE IMAGE
67
FROM $BASE_IMAGE as base
78
ARG BASE_IMAGE
9+
ARG INSTALL_PREFIX
810

911
# Copy dependencies lists into container. We copy them all and then do a mv because
1012
# we need to transform base_image into a windows compatible filename which we can't
@@ -24,14 +26,12 @@ FROM base AS builder
2426
ARG BASE_IMAGE
2527
ARG TARGET_LIST
2628
ARG LIBOSI_VERSION
29+
ARG INSTALL_PREFIX
2730

2831
RUN [ -e /tmp/build_dep.txt ] && \
2932
apt-get -qq update && \
3033
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $(cat /tmp/build_dep.txt | grep -o '^[^#]*') && \
3134
apt-get clean && \
32-
python3 -m pip install --upgrade --no-cache-dir pip && \
33-
python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" && \
34-
python3 -m pip install --upgrade --no-cache-dir "capstone" && \
3535
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
3636

3737
# Then install capstone from source
@@ -48,18 +48,20 @@ RUN cd /tmp && curl -LJO https://github.com/panda-re/libosi/releases/download/${
4848
# Build and install panda
4949
# Copy repo root directory to /panda, note we explicitly copy in .git directory
5050
# Note .dockerignore file keeps us from copying things we don't need
51+
# PyPANDA needs CFFI from pip (the version in apt is too old)
5152
COPY . /panda/
5253
COPY .git /panda/
54+
RUN pip install -r /panda/panda/python/core/requirements.txt
5355

5456
# Note we diable NUMA for docker builds because it causes make check to fail in docker
5557
RUN git -C /panda submodule update --init dtc && \
56-
git -C /panda rev-parse HEAD > /usr/local/panda_commit_hash && \
58+
git -C /panda rev-parse HEAD > ${INSTALL_PREFIX}/panda_commit_hash && \
5759
mkdir /panda/build && cd /panda/build && \
5860
python3 -m pip install setuptools_scm && \
5961
python3 -m setuptools_scm -r .. --strip-dev 2>/dev/null >/tmp/savedversion && \
6062
/panda/configure \
6163
--target-list="${TARGET_LIST}" \
62-
--prefix=/usr/local \
64+
--prefix=${INSTALL_PREFIX} \
6365
--disable-numa \
6466
--enable-llvm && \
6567
rm -rf /panda/.git
@@ -69,9 +71,9 @@ RUN PRETEND_VERSION=$(cat /tmp/savedversion) make -C /panda/build -j "$(nproc)"
6971

7072
#### Develop setup: panda built + pypanda installed (in develop mode) - Stage 3
7173
FROM builder as developer
74+
ARG INSTALL_PREFIX
7275
RUN cd /panda/panda/python/core && \
7376
PRETEND_VERSION=$(cat /tmp/savedversion) python3 setup.py develop && \
74-
ldconfig && \
7577
update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \
7678
cd /panda && \
7779
( git config --get-regexp http > /dev/null && \
@@ -81,17 +83,17 @@ WORKDIR /panda/
8183

8284
#### Install PANDA + pypanda from builder - Stage 4
8385
FROM builder as installer
86+
ARG INSTALL_PREFIX
8487
RUN make -C /panda/build install && \
85-
rm -r /usr/local/lib/panda/*/cosi \
86-
/usr/local/lib/panda/*/cosi_strace \
87-
/usr/local/lib/panda/*/gdb \
88-
/usr/local/lib/panda/*/snake_hook \
89-
/usr/local/lib/panda/*/rust_skeleton
88+
rm -r ${INSTALL_PREFIX}/lib/panda/*/cosi \
89+
${INSTALL_PREFIX}/lib/panda/*/cosi_strace \
90+
${INSTALL_PREFIX}/lib/panda/*/gdb \
91+
${INSTALL_PREFIX}/lib/panda/*/snake_hook \
92+
${INSTALL_PREFIX}/lib/panda/*/rust_skeleton
9093

9194
# Install pypanda
9295
RUN cd /panda/panda/python/core && \
9396
PRETEND_VERSION=$(cat /tmp/savedversion) python3 setup.py install
94-
RUN python3 -m pip install --ignore-install pycparser && python3 -m pip install --force-reinstall --no-binary :all: cffi
9597
# Build a whl too
9698
RUN cd /panda/panda/python/core && \
9799
PRETEND_VERSION=$(cat /tmp/savedversion) python3 setup.py bdist_wheel
@@ -103,40 +105,46 @@ RUN bash -c "ls $(pip show pandare | grep Location: | awk '{print $2}')/pandare/
103105
# this layer is used to strip shared objects and change python data to be
104106
# symlinks to the installed panda data directory
105107
FROM installer as cleanup
106-
RUN find /usr/local/lib/panda -name "*.so" -exec strip {} \;
108+
ARG INSTALL_PREFIX
109+
RUN find ${INSTALL_PREFIX}/lib/panda -name "*.so" -exec strip {} \;
107110
RUN PKG=`pip show pandare | grep Location: | awk '{print $2}'`/pandare/data; \
108-
rm -rf $PKG/pc-bios && ln -s /usr/local/share/panda $PKG/pc-bios; \
111+
rm -rf $PKG/pc-bios && ln -s ${INSTALL_PREFIX}/share/panda $PKG/pc-bios; \
109112
for arch in `find $PKG -name "*-softmmu" -type d -exec basename {} \;` ; do \
110113
ARCHP=$PKG/$arch; \
111114
SARCH=`echo $arch | cut -d'-' -f 1`; \
112115
rm $ARCHP/libpanda-$SARCH.so $ARCHP/llvm-helpers-$SARCH.bc; \
113-
ln -s /usr/local/share/panda/llvm-helpers-$SARCH.bc $ARCHP/llvm-helpers-$SARCH.bc1; \
114-
ln -s /usr/local/bin/libpanda-$SARCH.so $ARCHP/libpanda-$SARCH.so; \
116+
ln -s ${INSTALL_PREFIX}/share/panda/llvm-helpers-$SARCH.bc $ARCHP/llvm-helpers-$SARCH.bc1; \
117+
ln -s ${INSTALL_PREFIX}/bin/libpanda-$SARCH.so $ARCHP/libpanda-$SARCH.so; \
115118
rm -rf $ARCHP/panda/plugins; \
116-
ln -s /usr/local/lib/panda/$SARCH/ $ARCHP/panda/plugins; \
119+
ln -s ${INSTALL_PREFIX}/lib/panda/$SARCH/ $ARCHP/panda/plugins; \
117120
done
118121

119122
### Copy files for panda+pypanda from installer - Stage 5
120123
FROM base as panda
124+
ARG INSTALL_PREFIX
125+
ARG TARGET_LIST
121126

122127
# Include dependency lists for packager
123128
COPY --from=base /tmp/base_dep.txt /tmp
124129
COPY --from=base /tmp/build_dep.txt /tmp
125130

126131
# Copy panda + libcapstone.so* + libosi libraries
127-
COPY --from=cleanup /usr/local /usr/local
132+
COPY --from=cleanup ${INSTALL_PREFIX} ${INSTALL_PREFIX}
128133
COPY --from=cleanup /usr/lib/libcapstone* /usr/lib/
129134
COPY --from=cleanup /lib/libosi.so /lib/libiohal.so /lib/liboffset.so /lib/
130135

131136
# Workaround issue #901 - ensure LD_LIBRARY_PATH contains the panda plugins directories
132-
#ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu"
133-
ENV LD_LIBRARY_PATH /usr/local/lib/python3.8/dist-packages/pandare/data/x86_64-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/i386-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/arm-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/ppc-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/mips-softmmu/panda/plugins/:/usr/local/lib/python3.8/dist-packages/pandare/data/mipsel-softmmu/panda/plugins/
134-
#PANDA_PATH is used by rust plugins
135-
ENV PANDA_PATH /usr/local/lib/python3.8/dist-packages/pandare/data
137+
RUN LD_LIBRARY_PATH="" && \
138+
for arch in $(echo $TARGET_LIST | tr ',' ' '); do \
139+
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${INSTALL_PREFIX}/lib/python3.8/dist-packages/pandare/data/${arch}/panda/plugins/"; \
140+
done && \
141+
export LD_LIBRARY_PATH
136142

143+
# PANDA_PATH is used by rust plugins
144+
ENV PANDA_PATH ${INSTALL_PREFIX}/lib/python3.8/dist-packages/pandare/data
137145

138146
# Ensure runtime dependencies are installed for our libpanda objects and panda plugins
139147
RUN ldconfig && \
140148
update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \
141-
if (ldd /usr/local/lib/python*/dist-packages/pandare/data/*-softmmu/libpanda-*.so | grep 'not found'); then exit 1; fi && \
142-
if (ldd /usr/local/lib/python*/dist-packages/pandare/data/*-softmmu/panda/plugins/*.so | grep 'not found'); then exit 1; fi
149+
if (ldd ${INSTALL_PREFIX}/lib/python*/dist-packages/pandare/data/*-softmmu/libpanda-*.so | grep 'not found'); then exit 1; fi && \
150+
if (ldd ${INSTALL_PREFIX}/lib/python*/dist-packages/pandare/data/*-softmmu/panda/plugins/*.so | grep 'not found'); then exit 1; fi

panda/debian/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
panda.deb
1+
*.deb
2+
*.whl

panda/dependencies/ubuntu_18.04_base.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ unzip
1818
# pyperipheral (only needed for armel)
1919
libpython3-dev
2020

21-
# pypanda dependencies
21+
# panda python dependencies
2222
genisoimage
2323
libffi-dev
2424
python3-protobuf
2525
python3-colorama
26+
python3-capstone
2627

2728
# apt-rdepends qemu-system-common
2829
acl

panda/dependencies/ubuntu_20.04_base.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ wget
1717
# pyperipheral (only needed for armel)
1818
libpython3-dev
1919

20-
# pypanda dependencies
20+
# panda python dependencies
2121
genisoimage
2222
libffi-dev
2323
python3-protobuf
2424
python3-colorama
25+
python3-capstone
2526

2627
# Not sure what this one is needed for
2728
liblzo2-2

panda/dependencies/ubuntu_22.04_base.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ wget
1717
# pyperipheral (only needed for armel)
1818
libpython3-dev
1919

20-
# pypanda dependencies
20+
# panda python dependencies
2121
genisoimage
2222
libffi-dev
2323
python3-protobuf
2424
python3-colorama
25+
python3-capstone
2526

2627
# Not sure what this one is needed for
2728
liblzo2-2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Jinja2==3.1.2
1+
Jinja2>=3.1.4
22
MarkupSafe==2.1.3

panda/python/core/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ data
88
a
99
__pycache__
1010
*.egg-info
11+
.eggs/

panda/scripts/install_ubuntu.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ lsb_release --help &>/dev/null || $SUDO apt-get update -qq && $SUDO apt-get -qq
2525
git --help &>/dev/null || $SUDO apt-get -qq update && $SUDO apt-get -qq install -y --no-install-recommends git
2626

2727
# some globals
28-
LIBOSI_VERSION="0.1.7"
28+
LIBOSI_VERSION="0.1.9"
2929
UBUNTU_VERSION=$(lsb_release -r | awk '{print $2}')
3030
PANDA_GIT="https://github.com/panda-re/panda.git"
3131

@@ -126,11 +126,6 @@ if [[ !$(dpkg -l | grep -q libosi) ]]; then
126126
popd
127127
fi
128128

129-
# PyPANDA needs CFFI from pip (the version in apt is too old)
130-
# Install system-wide since PyPANDA install will also be system-wide
131-
$SUDO python3 -m pip install pip
132-
$SUDO python3 -m pip install "cffi>1.14.3"
133-
134129
progress "Trying to update DTC submodule"
135130
git submodule update --init dtc || true
136131

@@ -139,6 +134,10 @@ if [ -d "build" ]; then
139134
rm -rf "build"
140135
fi
141136

137+
# PyPANDA needs CFFI from pip (the version in apt is too old)
138+
# Install system-wide since PyPANDA install will also be system-wide
139+
$SUDO pip install -r ./panda/python/core/requirements.txt
140+
142141
progress "Building PANDA..."
143142
mkdir build
144143
pushd build

0 commit comments

Comments
 (0)