Skip to content

Commit 2498326

Browse files
committed
Centralize all dependancy information and
also update some packages
1 parent cc88392 commit 2498326

File tree

10 files changed

+52
-38
lines changed

10 files changed

+52
-38
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: 31 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,13 @@ 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" && \
35+
python3 -m pip install "cffi>1.14.3" && \
3536
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
3637

3738
# Then install capstone from source
@@ -53,13 +54,13 @@ COPY .git /panda/
5354

5455
# Note we diable NUMA for docker builds because it causes make check to fail in docker
5556
RUN git -C /panda submodule update --init dtc && \
56-
git -C /panda rev-parse HEAD > /usr/local/panda_commit_hash && \
57+
git -C /panda rev-parse HEAD > ${INSTALL_PREFIX}/panda_commit_hash && \
5758
mkdir /panda/build && cd /panda/build && \
5859
python3 -m pip install setuptools_scm && \
5960
python3 -m setuptools_scm -r .. --strip-dev 2>/dev/null >/tmp/savedversion && \
6061
/panda/configure \
6162
--target-list="${TARGET_LIST}" \
62-
--prefix=/usr/local \
63+
--prefix=${INSTALL_PREFIX} \
6364
--disable-numa \
6465
--enable-llvm && \
6566
rm -rf /panda/.git
@@ -69,9 +70,9 @@ RUN PRETEND_VERSION=$(cat /tmp/savedversion) make -C /panda/build -j "$(nproc)"
6970

7071
#### Develop setup: panda built + pypanda installed (in develop mode) - Stage 3
7172
FROM builder as developer
73+
ARG INSTALL_PREFIX
7274
RUN cd /panda/panda/python/core && \
7375
PRETEND_VERSION=$(cat /tmp/savedversion) python3 setup.py develop && \
74-
ldconfig && \
7576
update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \
7677
cd /panda && \
7778
( git config --get-regexp http > /dev/null && \
@@ -81,17 +82,17 @@ WORKDIR /panda/
8182

8283
#### Install PANDA + pypanda from builder - Stage 4
8384
FROM builder as installer
85+
ARG INSTALL_PREFIX
8486
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
87+
rm -r ${INSTALL_PREFIX}/lib/panda/*/cosi \
88+
${INSTALL_PREFIX}/lib/panda/*/cosi_strace \
89+
${INSTALL_PREFIX}/lib/panda/*/gdb \
90+
${INSTALL_PREFIX}/lib/panda/*/snake_hook \
91+
${INSTALL_PREFIX}/lib/panda/*/rust_skeleton
9092

9193
# Install pypanda
9294
RUN cd /panda/panda/python/core && \
9395
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
9596
# Build a whl too
9697
RUN cd /panda/panda/python/core && \
9798
PRETEND_VERSION=$(cat /tmp/savedversion) python3 setup.py bdist_wheel
@@ -103,40 +104,46 @@ RUN bash -c "ls $(pip show pandare | grep Location: | awk '{print $2}')/pandare/
103104
# this layer is used to strip shared objects and change python data to be
104105
# symlinks to the installed panda data directory
105106
FROM installer as cleanup
106-
RUN find /usr/local/lib/panda -name "*.so" -exec strip {} \;
107+
ARG INSTALL_PREFIX
108+
RUN find ${INSTALL_PREFIX}/lib/panda -name "*.so" -exec strip {} \;
107109
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; \
110+
rm -rf $PKG/pc-bios && ln -s ${INSTALL_PREFIX}/share/panda $PKG/pc-bios; \
109111
for arch in `find $PKG -name "*-softmmu" -type d -exec basename {} \;` ; do \
110112
ARCHP=$PKG/$arch; \
111113
SARCH=`echo $arch | cut -d'-' -f 1`; \
112114
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; \
115+
ln -s ${INSTALL_PREFIX}/share/panda/llvm-helpers-$SARCH.bc $ARCHP/llvm-helpers-$SARCH.bc1; \
116+
ln -s ${INSTALL_PREFIX}/bin/libpanda-$SARCH.so $ARCHP/libpanda-$SARCH.so; \
115117
rm -rf $ARCHP/panda/plugins; \
116-
ln -s /usr/local/lib/panda/$SARCH/ $ARCHP/panda/plugins; \
118+
ln -s ${INSTALL_PREFIX}/lib/panda/$SARCH/ $ARCHP/panda/plugins; \
117119
done
118120

119121
### Copy files for panda+pypanda from installer - Stage 5
120122
FROM base as panda
123+
ARG INSTALL_PREFIX
124+
ARG TARGET_LIST
121125

122126
# Include dependency lists for packager
123127
COPY --from=base /tmp/base_dep.txt /tmp
124128
COPY --from=base /tmp/build_dep.txt /tmp
125129

126130
# Copy panda + libcapstone.so* + libosi libraries
127-
COPY --from=cleanup /usr/local /usr/local
131+
COPY --from=cleanup ${INSTALL_PREFIX} ${INSTALL_PREFIX}
128132
COPY --from=cleanup /usr/lib/libcapstone* /usr/lib/
129133
COPY --from=cleanup /lib/libosi.so /lib/libiohal.so /lib/liboffset.so /lib/
130134

131135
# 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
136+
RUN LD_LIBRARY_PATH="" && \
137+
for arch in $(echo $TARGET_LIST | tr ',' ' '); do \
138+
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${INSTALL_PREFIX}/lib/python3.8/dist-packages/pandare/data/${arch}/panda/plugins/"; \
139+
done && \
140+
export LD_LIBRARY_PATH
136141

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

138145
# Ensure runtime dependencies are installed for our libpanda objects and panda plugins
139146
RUN ldconfig && \
140147
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
148+
if (ldd ${INSTALL_PREFIX}/lib/python*/dist-packages/pandare/data/*-softmmu/libpanda-*.so | grep 'not found'); then exit 1; fi && \
149+
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

panda/plugins/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ members = [
88
"cosi/volatility_profile",
99
"snake_hook",
1010
]
11+
12+
[dependencies]
13+
inventory = "0.2.0"
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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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 python3 -m pip install "cffi>1.14.3"
140+
142141
progress "Building PANDA..."
143142
mkdir build
144143
pushd build

0 commit comments

Comments
 (0)