mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-23 05:29:53 +00:00
Move debian package generation to a dispatch only workflow (#2543)
Some checks failed
Run Test / ${{ matrix.config.name }} (map[arch:x64 build-system:cmake diet-build:OFF enable-asan:OFF name:ubuntu-22.04 x64 cmake os:ubuntu-22.04]) (push) Has been cancelled
Run Test / ${{ matrix.config.name }} (map[arch:x64 build-system:cmake diet-build:OFF enable-asan:ON name:ubuntu-24.04 x64 ASAN os:ubuntu-24.04]) (push) Has been cancelled
Run Test / ${{ matrix.config.name }} (map[arch:x64 build-system:make diet-build:OFF enable-asan:OFF name:ubuntu-22.04 x64 make os:ubuntu-22.04]) (push) Has been cancelled
Run Test / ${{ matrix.config.name }} (map[arch:x64 name:windows x64 MSVC 64bit os:windows-latest platform:windows python-arch:x64 python-version:3.9]) (push) Has been cancelled
Run clang-tidy / clang-tidy (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / Build wheels on ${{ matrix.os }} (macos-latest) (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / Build wheels on ${{ matrix.os }} (ubuntu-latest) (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / Build wheels on ${{ matrix.os }} (windows-latest) (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / Make SDist (push) Has been cancelled
Python Package CI / build (macOS-14, 3.12) (push) Has been cancelled
Python Package CI / build (macOS-14, 3.8) (push) Has been cancelled
Python Package CI / build (ubuntu-24.04, 3.12) (push) Has been cancelled
Python Package CI / build (ubuntu-24.04, 3.8) (push) Has been cancelled
Python Package CI / build (windows-2022, 3.12) (push) Has been cancelled
Python Package CI / build (windows-2022, 3.8) (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / publish (push) Has been cancelled
Coverity Scan / latest (push) Has been cancelled
Some checks failed
Run Test / ${{ matrix.config.name }} (map[arch:x64 build-system:cmake diet-build:OFF enable-asan:OFF name:ubuntu-22.04 x64 cmake os:ubuntu-22.04]) (push) Has been cancelled
Run Test / ${{ matrix.config.name }} (map[arch:x64 build-system:cmake diet-build:OFF enable-asan:ON name:ubuntu-24.04 x64 ASAN os:ubuntu-24.04]) (push) Has been cancelled
Run Test / ${{ matrix.config.name }} (map[arch:x64 build-system:make diet-build:OFF enable-asan:OFF name:ubuntu-22.04 x64 make os:ubuntu-22.04]) (push) Has been cancelled
Run Test / ${{ matrix.config.name }} (map[arch:x64 name:windows x64 MSVC 64bit os:windows-latest platform:windows python-arch:x64 python-version:3.9]) (push) Has been cancelled
Run clang-tidy / clang-tidy (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / Build wheels on ${{ matrix.os }} (macos-latest) (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / Build wheels on ${{ matrix.os }} (ubuntu-latest) (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / Build wheels on ${{ matrix.os }} (windows-latest) (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / Make SDist (push) Has been cancelled
Python Package CI / build (macOS-14, 3.12) (push) Has been cancelled
Python Package CI / build (macOS-14, 3.8) (push) Has been cancelled
Python Package CI / build (ubuntu-24.04, 3.12) (push) Has been cancelled
Python Package CI / build (ubuntu-24.04, 3.8) (push) Has been cancelled
Python Package CI / build (windows-2022, 3.12) (push) Has been cancelled
Python Package CI / build (windows-2022, 3.8) (push) Has been cancelled
RELEASE BUILD - PyPI 📦 Distribution / publish (push) Has been cancelled
Coverity Scan / latest (push) Has been cancelled
* Move deb package gen files int package/deb * Fix basename check * Make debian package generation dispatch only
This commit is contained in:
parent
abbf32b431
commit
e3bc578d2c
26
.github/workflows/build_deb.yml
vendored
Normal file
26
.github/workflows/build_deb.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
name: Build Debian Package
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: true
|
||||||
|
|
||||||
|
- name: Build Debian Package
|
||||||
|
working-directory: ./packages/deb
|
||||||
|
run: ./setup.sh "$(git describe --tags --abbrev=0)"
|
||||||
|
|
||||||
|
- name: Run sanity checks on the Debian package
|
||||||
|
working-directory: ./packages/deb
|
||||||
|
run: |
|
||||||
|
./check_capstone.sh ./libcapstone-dev.deb "$(git describe --tags --abbrev=0)"
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
path: ./packages/deb/libcapstone-dev.deb
|
25
.github/workflows/build_release.yml
vendored
25
.github/workflows/build_release.yml
vendored
@ -15,30 +15,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Make setup.sh and check_capstone.sh are executable
|
- name: Create archive
|
||||||
run: |
|
|
||||||
chmod +x debian/setup.sh
|
|
||||||
chmod +x debian/check_capstone.sh
|
|
||||||
|
|
||||||
- name: Build Debian Package
|
|
||||||
working-directory: ./debian
|
|
||||||
run: ./setup.sh ${{ github.event.release.tag_name }}
|
|
||||||
|
|
||||||
- name: Run sanity checks on the Debian package
|
|
||||||
working-directory: ./debian
|
|
||||||
run: |
|
|
||||||
./check_capstone.sh ./libcapstone-dev.deb ${{ github.event.release.tag_name }}
|
|
||||||
|
|
||||||
- name: Upload debian package to release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.event.release.tag_name }}
|
|
||||||
files: |
|
|
||||||
./debian/*.deb
|
|
||||||
|
|
||||||
- name: archive
|
|
||||||
id: archive
|
id: archive
|
||||||
run: |
|
run: |
|
||||||
VERSION=${{ github.event.release.tag_name }}
|
VERSION=${{ github.event.release.tag_name }}
|
||||||
|
6
debian/postinst
vendored
6
debian/postinst
vendored
@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# postinst script for capstone package
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Update the shared library cache
|
|
||||||
ldconfig
|
|
@ -1,8 +1,7 @@
|
|||||||
ARG VERSION=""
|
ARG VERSION=""
|
||||||
|
|
||||||
# Assume this is run from capstone/debian directory
|
|
||||||
# Run in the root of the repo
|
# Run in the root of the repo
|
||||||
# docker build -f ./debian/Dockerfile -t packager .
|
# docker build -f ./packages/deb/Dockerfile -t packager .
|
||||||
FROM debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
# Install necessary tools for packaging
|
# Install necessary tools for packaging
|
||||||
@ -10,7 +9,7 @@ RUN apt-get -qq update && \
|
|||||||
DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \
|
DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \
|
||||||
fakeroot dpkg-dev dos2unix cmake
|
fakeroot dpkg-dev dos2unix cmake
|
||||||
|
|
||||||
# Copy your project files into the container
|
# Copy project files into the container
|
||||||
RUN mkdir /capstone
|
RUN mkdir /capstone
|
||||||
COPY . /capstone
|
COPY . /capstone
|
||||||
WORKDIR /capstone/
|
WORKDIR /capstone/
|
||||||
@ -23,36 +22,29 @@ RUN cmake --build build
|
|||||||
# List files before cmake install
|
# List files before cmake install
|
||||||
# RUN find / -type f > /before-install.txt
|
# RUN find / -type f > /before-install.txt
|
||||||
|
|
||||||
# Run cmake install, by default everything goes into /usr/local
|
# Make directories as needed
|
||||||
RUN cmake --install build
|
RUN mkdir -p /package-root/usr/include/capstone/
|
||||||
|
RUN mkdir -p /package-root/usr/lib/pkgconfig/
|
||||||
|
RUN mkdir -p /package-root/usr/bin/
|
||||||
|
|
||||||
|
# Run cmake install
|
||||||
|
RUN cmake --install build --prefix /package-root/usr/
|
||||||
|
|
||||||
# List files after cmake install
|
# List files after cmake install
|
||||||
# RUN find / -type f > /after-install.txt
|
# RUN find / -type f > /after-install.txt
|
||||||
|
|
||||||
# Make directories as needed
|
|
||||||
RUN mkdir -p /package-root/usr/local/include/capstone/
|
|
||||||
RUN mkdir -p /package-root/usr/local/lib/pkgconfig/
|
|
||||||
RUN mkdir -p /package-root/usr/local/bin/
|
|
||||||
|
|
||||||
# Copy /usr/local/include/capstone/ to /package-root/usr/local/include/capstone/ and all other cases
|
|
||||||
RUN cp -r /usr/local/include/capstone/* /package-root/usr/local/include/capstone/
|
|
||||||
RUN cp -r /usr/local/lib/libcapstone* /package-root/usr/local/lib/
|
|
||||||
RUN cp -r /usr/local/lib/pkgconfig/capstone* /package-root/usr/local/lib/pkgconfig/
|
|
||||||
RUN cp -r /usr/local/bin/cstool /package-root/usr/local/bin/
|
|
||||||
|
|
||||||
# Create DEBIAN directory and control file
|
# Create DEBIAN directory and control file
|
||||||
COPY ./debian/control /package-root/DEBIAN/control
|
COPY ./packages/deb/control /package-root/DEBIAN/control
|
||||||
|
|
||||||
# Update capstone.pc file with the correct version and remove archs field
|
# Update capstone.pc file with the correct version and remove archs field
|
||||||
# Update control file with the correct version
|
# Update control file with the correct version
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
RUN sed -i "s/^Version:.*/Version: ${VERSION}/" /package-root/DEBIAN/control
|
RUN sed -i "s/^Version:.*/Version: ${VERSION}/" /package-root/DEBIAN/control
|
||||||
RUN sed -i "s/^Version:.*/Version: ${VERSION}/" /package-root/usr/local/lib/pkgconfig/capstone.pc
|
RUN sed -i "s/^Version:.*/Version: ${VERSION}/" /package-root/usr/lib/pkgconfig/capstone.pc
|
||||||
RUN sed -i "/^archs=/d" /package-root/usr/local/lib/pkgconfig/capstone.pc
|
RUN sed -i "/^archs=/d" /package-root/usr/lib/pkgconfig/capstone.pc
|
||||||
|
|
||||||
# Add postinst script to run ldconfig after installation
|
# Add triggers script to run ldconfig after installation
|
||||||
COPY ./debian/postinst /package-root/DEBIAN/postinst
|
COPY ./packages/deb/triggers /package-root/DEBIAN/triggers
|
||||||
RUN chmod 755 /package-root/DEBIAN/postinst
|
|
||||||
|
|
||||||
# Build the package
|
# Build the package
|
||||||
RUN fakeroot dpkg-deb --build /package-root /libcapstone-dev.deb
|
RUN fakeroot dpkg-deb --build /package-root /libcapstone-dev.deb
|
7
packages/deb/README.md
Normal file
7
packages/deb/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Incomplete Debian package implementation.
|
||||||
|
It can be used to generate an easily installable Capstone, but misses a lot of
|
||||||
|
mandatory things to add it in the Debian repos (`debian/control` is incomplete, no dependencies added etc.).
|
||||||
|
|
||||||
|
You can build the package by dispatching the `Build Debian Package` workflow or executing the commands in the `Dockerfile`.
|
||||||
|
It assumes the current commit is tagged and `"$(git describe --tags --abbrev=0)"` returns a valid version number.
|
||||||
|
The package is uploaded as artifact.
|
6
debian/check_capstone.sh → packages/deb/check_capstone.sh
Normal file → Executable file
6
debian/check_capstone.sh → packages/deb/check_capstone.sh
Normal file → Executable file
@ -18,7 +18,7 @@ TEMP_DIR=$(mktemp -d)
|
|||||||
dpkg-deb -x "$DEB_FILE" "$TEMP_DIR"
|
dpkg-deb -x "$DEB_FILE" "$TEMP_DIR"
|
||||||
|
|
||||||
# Path to the capstone.pc file
|
# Path to the capstone.pc file
|
||||||
CAPSTONE_PC="$TEMP_DIR/usr/local/lib/pkgconfig/capstone.pc"
|
CAPSTONE_PC="$TEMP_DIR/usr/lib/pkgconfig/capstone.pc"
|
||||||
|
|
||||||
# Check if the capstone.pc file exists
|
# Check if the capstone.pc file exists
|
||||||
if [[ ! -f "$CAPSTONE_PC" ]]; then
|
if [[ ! -f "$CAPSTONE_PC" ]]; then
|
||||||
@ -48,7 +48,7 @@ if [[ "$ACTUAL_VERSION" != "$EXPECTED_VERSION" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if libcapstone.a is included in the package
|
# Check if libcapstone.a is included in the package
|
||||||
LIBCAPSTONE_A="$TEMP_DIR/usr/local/lib/libcapstone.a"
|
LIBCAPSTONE_A="$TEMP_DIR/usr/lib/libcapstone.a"
|
||||||
if [[ ! -f "$LIBCAPSTONE_A" ]]; then
|
if [[ ! -f "$LIBCAPSTONE_A" ]]; then
|
||||||
echo "libcapstone.a not found in the package!"
|
echo "libcapstone.a not found in the package!"
|
||||||
rm -rf "$TEMP_DIR"
|
rm -rf "$TEMP_DIR"
|
||||||
@ -56,7 +56,7 @@ if [[ ! -f "$LIBCAPSTONE_A" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if libcapstone.so is included in the package
|
# Check if libcapstone.so is included in the package
|
||||||
LIBCAPSTONE_SO="$TEMP_DIR/usr/local/lib/libcapstone.so"
|
LIBCAPSTONE_SO="$TEMP_DIR/usr/lib/libcapstone.so"
|
||||||
if [[ ! -f "$LIBCAPSTONE_SO" ]]; then
|
if [[ ! -f "$LIBCAPSTONE_SO" ]]; then
|
||||||
echo "libcapstone.so not found in the package!"
|
echo "libcapstone.so not found in the package!"
|
||||||
rm -rf "$TEMP_DIR"
|
rm -rf "$TEMP_DIR"
|
10
debian/setup.sh → packages/deb/setup.sh
Normal file → Executable file
10
debian/setup.sh → packages/deb/setup.sh
Normal file → Executable file
@ -6,9 +6,9 @@ get_os_version() {
|
|||||||
lsb_release -i -s 2>/dev/null
|
lsb_release -i -s 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if the script is running in the ./debian folder
|
# Check if the script is running in the ./packages/deb folder
|
||||||
if [[ $(basename "$PWD") != "debian" ]]; then
|
if [[ $(basename "$PWD") != "deb" ]]; then
|
||||||
echo "ERROR: Script must be run from the ./debian directory"
|
echo "ERROR: Script must be run from the ./deb directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Now build the packager container from that
|
# Now build the packager container from that
|
||||||
pushd ../
|
pushd ../../
|
||||||
docker build -f ./debian/Dockerfile -t packager --build-arg VERSION="${version}" .
|
docker build -f ./packages/deb/Dockerfile -t packager --build-arg VERSION="${version}" .
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Copy deb file out of container to host
|
# Copy deb file out of container to host
|
2
packages/deb/triggers
Normal file
2
packages/deb/triggers
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Trigger ldconfig after install
|
||||||
|
activate-noawait ldconfig
|
Loading…
Reference in New Issue
Block a user