PcapPlusPlus icon indicating copy to clipboard operation
PcapPlusPlus copied to clipboard

Provide DEB or RPM

Open tigercosmos opened this issue 1 year ago • 11 comments

For Linux, we can consider to provide DEB or RPM.

tigercosmos avatar Jul 17 '24 11:07 tigercosmos

Working on it

bhaskarbhar avatar May 25 '25 03:05 bhaskarbhar

@seladb @tigercosmos How to provide the deb file?

bhaskarbhar avatar May 25 '25 05:05 bhaskarbhar

@seladb @tigercosmos I have made the deb file. The name of the deb file is pcapplusplus_25.05_amd64.deb I have written a small test:

// file: test.cpp #include <PcapLiveDeviceList.h> #include

int main() { auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); std::cout << "Found " << devList.size() << " network devices.\n"; }

Compilation: g++ test.cpp -o test_app
-lPcap++ -lPacket++ -lCommon++ -lpcap
-I/usr/local/include/pcapplusplus -L/usr/local/lib

Ouput:

Image

bhaskarbhar avatar May 25 '25 05:05 bhaskarbhar

Thank you @bhaskarbhar for working on it! 🙏

Where is your DEB file hosted? I think we'd like to add it to every release from now on, so we need to add building the DEB/RPM to our CI (probably to package.yml), and make sure they are included in the release.

Please let me know what you think.

seladb avatar May 25 '25 07:05 seladb

@seladb We can also think about how we can put PCPP into the apt source list.

tigercosmos avatar May 25 '25 08:05 tigercosmos

@seladb @tigercosmos

https://github.com/bhaskarbhar/PcapPlusPlus/releases/tag/v25.05-deb

bhaskarbhar avatar May 25 '25 09:05 bhaskarbhar

@seladb @tigercosmos I created the .deb using the following steps:

cd PcapPlusPlus
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install DESTDIR=$PWD/install-root

cd install-root
mkdir -p DEBIAN
cat <<EOF > DEBIAN/control
Package: pcapplusplus
Version: 25.05
Section: libs
Architecture: amd64
Maintainer: Bhaskar Bhar <[email protected]>
Description: PcapPlusPlus - C++ library for packet parsing and crafting
EOF

dpkg-deb --build install-root pcapplusplus_25.05_amd64.deb

For CI, I we can automate this in package.yml using the same steps to build .deb.

bhaskarbhar avatar May 25 '25 09:05 bhaskarbhar

@seladb For CI I have written a package.yml, I dont know, this is correct or not. Need your support:

name: Build and Release DEB Package

on:
release:
 types: [published]

jobs:
build-deb:
 runs-on: ubuntu-latest

 steps:
   - name: Checkout source
     uses: actions/checkout@v3

   - name: Install dependencies
     run: |
       sudo apt-get update
       sudo apt-get install -y --no-install-recommends cmake make g++ libpcap-dev

   - name: Build project
     run: |
       mkdir build
       cd build
       cmake ..
       make -j$(nproc)
       make install DESTDIR=$PWD/install-root

   - name: Create DEB control file
     run: |
       cd build/install-root
       mkdir -p DEBIAN
       cat <<EOF > DEBIAN/control
Package: pcapplusplus
Version: ${{ github.event.release.tag_name }}
Section: libs
Architecture: amd64
Maintainer: Bhaskar Bhar <[email protected]>
Description: PcapPlusPlus - C++ library for packet parsing and crafting
EOF

   - name: Build DEB package
     run: |
       cd build
       dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb

   - name: Upload DEB to release
     uses: softprops/action-gh-release@v1
     with:
       files: build/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb
     env:
       GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

bhaskarbhar avatar May 25 '25 09:05 bhaskarbhar

@seladb We can also think about how we can put PCPP into the apt source list.

That' s a great idea.

bhaskarbhar avatar May 25 '25 09:05 bhaskarbhar

@bhaskarbhar Could you open a PR? We will go through the code review.

tigercosmos avatar May 25 '25 09:05 tigercosmos

Opened a PR. PR failed due to pre-commit.

bhaskarbhar avatar May 25 '25 12:05 bhaskarbhar