Skip to content

Provide DEB or RPM #1498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tigercosmos opened this issue Jul 17, 2024 · 11 comments
Open

Provide DEB or RPM #1498

tigercosmos opened this issue Jul 17, 2024 · 11 comments

Comments

@tigercosmos
Copy link
Collaborator

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

@bhaskarbhar
Copy link

Working on it

@bhaskarbhar
Copy link

@seladb @tigercosmos How to provide the deb file?

@bhaskarbhar
Copy link

bhaskarbhar commented May 25, 2025

@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

@seladb
Copy link
Owner

seladb commented May 25, 2025

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.

@tigercosmos
Copy link
Collaborator Author

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

@bhaskarbhar
Copy link

@bhaskarbhar
Copy link

bhaskarbhar commented May 25, 2025

@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
Copy link

@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
Copy link

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

That' s a great idea.

@tigercosmos
Copy link
Collaborator Author

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

@bhaskarbhar
Copy link

bhaskarbhar commented May 25, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants