Skip to content

Conversation

@bhaskarbhar
Copy link

Added a new build-deb job to build a Debian package (.deb) for PcapPlusPlus on ubuntu-latest.

The job:

  • Checks out the source code.
  • Installs required dependencies (cmake, make, g++, libpcap-dev).
  • Builds and installs the project into a staged directory.
  • Creates a proper DEB control file using the release tag as version.
  • Builds the .deb package.

Issue: #1498

@bhaskarbhar bhaskarbhar requested a review from seladb as a code owner May 25, 2025 13:52
@codecov
Copy link

codecov bot commented May 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.46%. Comparing base (8b1a9a5) to head (27ebe4d).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1831      +/-   ##
==========================================
- Coverage   83.46%   83.46%   -0.01%     
==========================================
  Files         311      311              
  Lines       54568    54559       -9     
  Branches    11808    11507     -301     
==========================================
- Hits        45545    45535      -10     
+ Misses       8313     7827     -486     
- Partials      710     1197     +487     
Flag Coverage Δ
alpine320 75.89% <ø> (-0.01%) ⬇️
fedora42 75.46% <ø> (+<0.01%) ⬆️
macos-14 81.58% <ø> (ø)
macos-15 81.57% <ø> (-0.02%) ⬇️
mingw32 70.00% <ø> (ø)
mingw64 69.98% <ø> (+0.11%) ⬆️
npcap ?
rhel94 75.47% <ø> (-0.01%) ⬇️
ubuntu2004 59.48% <ø> (+0.01%) ⬆️
ubuntu2004-zstd 59.59% <ø> (+0.01%) ⬆️
ubuntu2204 75.41% <ø> (-0.01%) ⬇️
ubuntu2204-icpx 57.85% <ø> (ø)
ubuntu2404 75.51% <ø> (+0.01%) ⬆️
ubuntu2404-arm64 75.54% <ø> (-0.01%) ⬇️
unittest 83.46% <ø> (-0.01%) ⬇️
windows-2022 85.41% <ø> (+0.16%) ⬆️
windows-2025 85.44% <ø> (+0.11%) ⬆️
winpcap 85.44% <ø> (-0.09%) ⬇️
xdp 52.99% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines 421 to 422
apt-get update
apt-get install -y --no-install-recommends cmake make g++ libpcap-dev
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step fails because we don't run it as sudo, which made me notice that this runs directly on the GitHub runner VM. Why not run it inside one of our containers like seladb/ubuntu2404? This image should already have these dependencies pre-installed

cd "${{ env.BUILD_DIR }}"
cmake ..
make -j$(nproc)
make install DESTDIR=$PWD/install-root
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of installing PcapPlusPlus here, maybe we can build the deb file, install it, and add another step to test that it works?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into it

Version: ${{ github.event.release.tag_name }}
Section: libs
Architecture: amd64
Maintainer: Bhaskar Bhar <[email protected]>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add [email protected] as a maintainer?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sir

Comment on lines 450 to 456
- name: Upload DEB to release
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0
with:
draft: true
allowUpdates: true
updateOnlyUnreleased: true
artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb"
Copy link
Collaborator

@Dimi1010 Dimi1010 May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not have an if clause? The rest of the package CI's have the upload steps under if: github.ref_type == 'tag' clause?

@bhaskarbhar
Copy link
Author

bhaskarbhar commented May 28, 2025

@seladb @Dimi1010 Extremely sorry. Looks like my code has flaws in it. As I am a beginner in open source, I am making many mistakes. I will, for sure resolve the issues and also work on your suggestions.

@Dimi1010
Copy link
Collaborator

@bhaskarbhar No worries about the flaws. That is why the reviews are for. Ty for the effort. :)

@seladb
Copy link
Owner

seladb commented May 30, 2025

@bhaskarbhar why did you close the PR? 🤔

@bhaskarbhar bhaskarbhar reopened this May 30, 2025
@bhaskarbhar
Copy link
Author

bhaskarbhar commented May 30, 2025

@bhaskarbhar why did you close the PR? 🤔

As there were many flaws I thought to go through the package.yml and correct it rather than commiting everytime. Wanted to do a fresh PR with no flaws

@bhaskarbhar bhaskarbhar requested review from Dimi1010 and seladb June 7, 2025 02:37
@bhaskarbhar
Copy link
Author

@seladb @Dimi1010 checks are passed. Requesting a review.

@bhaskarbhar bhaskarbhar requested a review from Dimi1010 June 9, 2025 17:53
@bhaskarbhar
Copy link
Author

bhaskarbhar commented Jun 9, 2025

@Dimi1010 Removed Test, corrected indentation. The build-deb check in Package and Release are passed.

Copy link
Collaborator

@Dimi1010 Dimi1010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@seladb
Copy link
Owner

seladb commented Jun 14, 2025

@clementperon @egecetin @tigercosmos I'm not an expert in this domain, maybe you can also take a look?
@Dimi1010 already approved

@clementperon
Copy link
Collaborator

clementperon commented Jun 14, 2025

@seladb Cmake can handle deb generation. I think this MR is a bit complicated and could be simplified using cmake deb packaging no ?
See https://cmake.org/cmake/help/latest/cpack_gen/deb.html

@bhaskarbhar
Copy link
Author

@seladb Cmake can handle deb generation. I think this MR is a bit complicated and could be simplified using cmake deb packaging no ? See https://cmake.org/cmake/help/latest/cpack_gen/deb.html

Looking into it.

@bhaskarbhar
Copy link
Author

bhaskarbhar commented Jun 14, 2025

@seladb Cmake can handle deb generation. I think this MR is a bit complicated and could be simplified using cmake deb packaging no ? See https://cmake.org/cmake/help/latest/cpack_gen/deb.html

I found this in CmakeLists.txt:

if("${DISTRO_ID}" STREQUAL "ubuntu")
 # set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB)
endif()

According to you suggestion, I will remove the comment from CmakeLists and rebuild the build-deb job.

@bhaskarbhar bhaskarbhar reopened this Jun 14, 2025
@clementperon
Copy link
Collaborator

@seladb Cmake can handle deb generation. I think this MR is a bit complicated and could be simplified using cmake deb packaging no ? See https://cmake.org/cmake/help/latest/cpack_gen/deb.html

I found this in CmakeLists.txt:

if("${DISTRO_ID}" STREQUAL "ubuntu")
 # set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB)
endif()

According to you suggestion, I will remove the comment from CmakeLists and rebuild the build-deb job.

Exactly then maybe the actual package pipeline need some rework but not much I think.

Also there should be two deb generated.
One for the dev package and one for the runtime.

@bhaskarbhar
Copy link
Author

@seladb Cmake can handle deb generation. I think this MR is a bit complicated and could be simplified using cmake deb packaging no ? See https://cmake.org/cmake/help/latest/cpack_gen/deb.html

I found this in CmakeLists.txt:

if("${DISTRO_ID}" STREQUAL "ubuntu")
 # set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB)
endif()

According to you suggestion, I will remove the comment from CmakeLists and rebuild the build-deb job.

Exactly then maybe the actual package pipeline need some rework but not much I think.

Also there should be two deb generated. One for the dev package and one for the runtime.

Dev and runtime??? Two deb?? I need clarification in this. I have only updated the CmakeLists and package.yml for now. Please guide me as I am unable to understand what are the requirements now.

@clementperon
Copy link
Collaborator

clementperon commented Jun 14, 2025

@seladb Cmake can handle deb generation. I think this MR is a bit complicated and could be simplified using cmake deb packaging no ? See https://cmake.org/cmake/help/latest/cpack_gen/deb.html

I found this in CmakeLists.txt:

if("${DISTRO_ID}" STREQUAL "ubuntu")
 # set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB)
endif()

According to you suggestion, I will remove the comment from CmakeLists and rebuild the build-deb job.

Exactly then maybe the actual package pipeline need some rework but not much I think.
Also there should be two deb generated. One for the dev package and one for the runtime.

Dev and runtime??? Two deb?? I need clarification in this. I have only updated the CmakeLists and package.yml for now. Please guide me as I am unable to understand what are the requirements now.

I think that's why I didn't enable it yet.
A library have multiple usualy two components the "release" and the "dev".
E.g: when you do "sudo apt install libpcap" != "sudo apt install libpcap-dev"
This should be similar with deb.

  • One "libpcapplusplus" for final user with only ".so"
  • and one "libpcapplusplus-dev" for dev user with "Cmake files and .h"
  • we could also have one "libpcapplusplus-staticdev" for dev that want static libraries ".a"

@seladb @Dimi1010 at the moment only uncomment the # CPACK_DEB will generate also bin, cmake and .h.
i think we should clean a bit this before activating the Deb generator.
Also IMO final user except shared libraries no ?

You can find .deb example here: https://github.com/clementperon/PcapPlusPlus/releases/tag/25.06

tree
.
├── bin
│   ├── Arping
│   ├── ArpSpoofing
│   ├── BenchmarkExample
│   ├── BenchmarkExampleGoogle
│   ├── DNSResolver
│   ├── DnsSpoofing
│   ├── HttpAnalyzer
│   ├── IcmpFileTransfer-catcher
│   ├── IcmpFileTransfer-pitcher
│   ├── IPDefragUtil
│   ├── IPFragUtil
│   ├── PcapPrinter
│   ├── PcapSearch
│   ├── PcapSplitter
│   ├── SSLAnalyzer
│   ├── TcpReassembly
│   └── TLSFingerprinting
├── include
│   └── pcapplusplus
│       ├── ArpLayer.h
│       ├── Asn1Codec.h
│       ├── BgpLayer.h
│       ├── CiscoHdlcLayer.h
│       ├── CotpLayer.h
│       ├── DeprecationUtils.h
│       ├── Device.h
│       ├── DeviceListBase.h
│       ├── DhcpLayer.h
│       ├── DhcpV6Layer.h
│       ├── DnsLayerEnums.h
│       ├── DnsLayer.h
│       ├── DnsResourceData.h
│       ├── DnsResource.h
│       ├── EthDot3Layer.h
│       ├── EthLayer.h
│       ├── FtpLayer.h
│       ├── GeneralUtils.h
│       ├── GreLayer.h
│       ├── GtpLayer.h
│       ├── HttpLayer.h
│       ├── IcmpLayer.h
│       ├── IcmpV6Layer.h
│       ├── IgmpLayer.h
│       ├── IpAddress.h
│       ├── IpAddressUtils.h
│       ├── IPLayer.h
│       ├── IPReassembly.h
│       ├── IPSecLayer.h
│       ├── IpUtils.h
│       ├── IPv4Layer.h
│       ├── IPv6Extensions.h
│       ├── IPv6Layer.h
│       ├── Layer.h
│       ├── LdapLayer.h
│       ├── LinuxNicInformationSocket.h
│       ├── LLCLayer.h
│       ├── Logger.h
│       ├── LRUList.h
│       ├── MacAddress.h
│       ├── MplsLayer.h
│       ├── NdpLayer.h
│       ├── NetworkUtils.h
│       ├── NflogLayer.h
│       ├── NtpLayer.h
│       ├── NullLoopbackLayer.h
│       ├── ObjectPool.h
│       ├── OUILookup.h
│       ├── Packet.h
│       ├── PacketTrailerLayer.h
│       ├── PacketUtils.h
│       ├── PayloadLayer.h
│       ├── PcapDevice.h
│       ├── PcapFileDevice.h
│       ├── PcapFilter.h
│       ├── PcapLiveDevice.h
│       ├── PcapLiveDeviceList.h
│       ├── PcapPlusPlusVersion.h
│       ├── PointerVector.h
│       ├── PPPoELayer.h
│       ├── ProtocolType.h
│       ├── RadiusLayer.h
│       ├── RawPacket.h
│       ├── RawSocketDevice.h
│       ├── S7CommLayer.h
│       ├── SdpLayer.h
│       ├── SingleCommandTextProtocol.h
│       ├── SipLayer.h
│       ├── Sll2Layer.h
│       ├── SllLayer.h
│       ├── SmtpLayer.h
│       ├── SomeIpLayer.h
│       ├── SomeIpSdLayer.h
│       ├── SSHLayer.h
│       ├── SSLCommon.h
│       ├── SSLHandshake.h
│       ├── SSLLayer.h
│       ├── StpLayer.h
│       ├── SystemUtils.h
│       ├── TablePrinter.h
│       ├── TcpLayer.h
│       ├── TcpReassembly.h
│       ├── TelnetLayer.h
│       ├── TextBasedProtocol.h
│       ├── TimespecTimeval.h
│       ├── TLVData.h
│       ├── TpktLayer.h
│       ├── UdpLayer.h
│       ├── VlanLayer.h
│       ├── VrrpLayer.h
│       ├── VxlanLayer.h
│       ├── WakeOnLanLayer.h
│       └── WireGuardLayer.h
└── lib
  ├── cmake
  │   └── pcapplusplus
  │       ├── FindPCAP.cmake
  │       ├── PcapPlusPlusConfig.cmake
  │       ├── PcapPlusPlusConfigVersion.cmake
  │       ├── PcapPlusPlusTargets.cmake
  │       └── PcapPlusPlusTargets-release.cmake
  ├── libCommon++.a
  ├── libPacket++.a
  ├── libPcap++.a
  └── pkgconfig
      └── PcapPlusPlus.pc

@bhaskarbhar
Copy link
Author

@seladb Cmake can handle deb generation. I think this MR is a bit complicated and could be simplified using cmake deb packaging no ? See https://cmake.org/cmake/help/latest/cpack_gen/deb.html

I found this in CmakeLists.txt:

if("${DISTRO_ID}" STREQUAL "ubuntu")
 # set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB)
endif()

According to you suggestion, I will remove the comment from CmakeLists and rebuild the build-deb job.

Exactly then maybe the actual package pipeline need some rework but not much I think.
Also there should be two deb generated. One for the dev package and one for the runtime.

Dev and runtime??? Two deb?? I need clarification in this. I have only updated the CmakeLists and package.yml for now. Please guide me as I am unable to understand what are the requirements now.

I think that's why I didn't enable it yet. A library have multiple usualy two components the "release" and the "dev". E.g: when you do "sudo apt install libpcap" != "sudo apt install libpcap-dev" This should be similar with deb.

  • One "libpcapplusplus" for final user with only ".so"
  • and one "libpcapplusplus-dev" for dev user with "Cmake files and .h"
  • we could also have one "libpcapplusplus-staticdev" for dev that want static libraries ".a"

@seladb @Dimi1010 at the moment only uncomment the # CPACK_DEB will generate also bin, cmake and .h. i think we should clean a bit this before activating the Deb generator. Also IMO final user except shared libraries no ?

You can find .deb example here: https://github.com/clementperon/PcapPlusPlus/releases/tag/25.06

tree
.
├── bin
│   ├── Arping
│   ├── ArpSpoofing
│   ├── BenchmarkExample
│   ├── BenchmarkExampleGoogle
│   ├── DNSResolver
│   ├── DnsSpoofing
│   ├── HttpAnalyzer
│   ├── IcmpFileTransfer-catcher
│   ├── IcmpFileTransfer-pitcher
│   ├── IPDefragUtil
│   ├── IPFragUtil
│   ├── PcapPrinter
│   ├── PcapSearch
│   ├── PcapSplitter
│   ├── SSLAnalyzer
│   ├── TcpReassembly
│   └── TLSFingerprinting
├── include
│   └── pcapplusplus
│       ├── ArpLayer.h
│       ├── Asn1Codec.h
│       ├── BgpLayer.h
│       ├── CiscoHdlcLayer.h
│       ├── CotpLayer.h
│       ├── DeprecationUtils.h
│       ├── Device.h
│       ├── DeviceListBase.h
│       ├── DhcpLayer.h
│       ├── DhcpV6Layer.h
│       ├── DnsLayerEnums.h
│       ├── DnsLayer.h
│       ├── DnsResourceData.h
│       ├── DnsResource.h
│       ├── EthDot3Layer.h
│       ├── EthLayer.h
│       ├── FtpLayer.h
│       ├── GeneralUtils.h
│       ├── GreLayer.h
│       ├── GtpLayer.h
│       ├── HttpLayer.h
│       ├── IcmpLayer.h
│       ├── IcmpV6Layer.h
│       ├── IgmpLayer.h
│       ├── IpAddress.h
│       ├── IpAddressUtils.h
│       ├── IPLayer.h
│       ├── IPReassembly.h
│       ├── IPSecLayer.h
│       ├── IpUtils.h
│       ├── IPv4Layer.h
│       ├── IPv6Extensions.h
│       ├── IPv6Layer.h
│       ├── Layer.h
│       ├── LdapLayer.h
│       ├── LinuxNicInformationSocket.h
│       ├── LLCLayer.h
│       ├── Logger.h
│       ├── LRUList.h
│       ├── MacAddress.h
│       ├── MplsLayer.h
│       ├── NdpLayer.h
│       ├── NetworkUtils.h
│       ├── NflogLayer.h
│       ├── NtpLayer.h
│       ├── NullLoopbackLayer.h
│       ├── ObjectPool.h
│       ├── OUILookup.h
│       ├── Packet.h
│       ├── PacketTrailerLayer.h
│       ├── PacketUtils.h
│       ├── PayloadLayer.h
│       ├── PcapDevice.h
│       ├── PcapFileDevice.h
│       ├── PcapFilter.h
│       ├── PcapLiveDevice.h
│       ├── PcapLiveDeviceList.h
│       ├── PcapPlusPlusVersion.h
│       ├── PointerVector.h
│       ├── PPPoELayer.h
│       ├── ProtocolType.h
│       ├── RadiusLayer.h
│       ├── RawPacket.h
│       ├── RawSocketDevice.h
│       ├── S7CommLayer.h
│       ├── SdpLayer.h
│       ├── SingleCommandTextProtocol.h
│       ├── SipLayer.h
│       ├── Sll2Layer.h
│       ├── SllLayer.h
│       ├── SmtpLayer.h
│       ├── SomeIpLayer.h
│       ├── SomeIpSdLayer.h
│       ├── SSHLayer.h
│       ├── SSLCommon.h
│       ├── SSLHandshake.h
│       ├── SSLLayer.h
│       ├── StpLayer.h
│       ├── SystemUtils.h
│       ├── TablePrinter.h
│       ├── TcpLayer.h
│       ├── TcpReassembly.h
│       ├── TelnetLayer.h
│       ├── TextBasedProtocol.h
│       ├── TimespecTimeval.h
│       ├── TLVData.h
│       ├── TpktLayer.h
│       ├── UdpLayer.h
│       ├── VlanLayer.h
│       ├── VrrpLayer.h
│       ├── VxlanLayer.h
│       ├── WakeOnLanLayer.h
│       └── WireGuardLayer.h
└── lib
  ├── cmake
  │   └── pcapplusplus
  │       ├── FindPCAP.cmake
  │       ├── PcapPlusPlusConfig.cmake
  │       ├── PcapPlusPlusConfigVersion.cmake
  │       ├── PcapPlusPlusTargets.cmake
  │       └── PcapPlusPlusTargets-release.cmake
  ├── libCommon++.a
  ├── libPacket++.a
  ├── libPcap++.a
  └── pkgconfig
      └── PcapPlusPlus.pc

@clementperon Will the original issue change now (Issue: #1498)? As both dev and runtime are required. I created this https://github.com/bhaskarbhar/PcapPlusPlus/releases/download/v25.05-deb/pcapplusplus_25.05_amd64.deb at the very beginning. I created this using the previous methods before you suggested usig cmake -G. I guess its now more complex for me as I am just a beginner in open source :(( , but I will try meeting the requirements. For now can you review the latest build-deb job in package.yml.

@clementperon
Copy link
Collaborator

@bhaskarbhar I have pushed on my repo an example but don't have time to properly test everything right now.
https://github.com/clementperon/PcapPlusPlus/commits/master/

@bhaskarbhar
Copy link
Author

Understood. Also the build-deb passed the Package and Release workflow and its making this:
CPack: - package: /__w/PcapPlusPlus/PcapPlusPlus/Dist/pcapplusplus-25.05+-ubuntu-24.04-gcc-13.3.0-x86_64.deb generated.

@bhaskarbhar I have pushed on my repo an example but don't have time to properly test everything right now. https://github.com/clementperon/PcapPlusPlus/commits/master/

@seladb
Copy link
Owner

seladb commented Nov 15, 2025

@clementperon @Dimi1010 @egecetin @tigercosmos I don't know much about Debian packages. Can one of you test it?
@Dimi1010 already reviewed, but maybe someone else can review also?

@seladb seladb linked an issue Nov 30, 2025 that may be closed by this pull request
@seladb
Copy link
Owner

seladb commented Dec 2, 2025

@clementperon how many changes do we need to make to have 2 separate DEB packages (one for runtime, one for dev)?
From what I understand the runtime should only contain the .so files, and the dev should contain headers, static library, cmake, etc. So if it's a lot of work to create the runtime, maybe we can start with the dev package which is more or less what we already have?

Also - in which package should the example binaries be? 🤔

@clementperon
Copy link
Collaborator

@seladb you can see the commit here clementperon@bcf7577

IMO example binaries should be shipped separatly or in the "-dev"
But ss a dev do you expect to "sudo apt install libopencv-dev" to install some /usr/bin/opencv-examples ?

@seladb
Copy link
Owner

seladb commented Dec 3, 2025

@seladb you can see the commit here clementperon@bcf7577

IMO example binaries should be shipped separatly or in the "-dev" But ss a dev do you expect to "sudo apt install libopencv-dev" to install some /usr/bin/opencv-examples ?

Yes @clementperon I think you're right. We should probably build 3 DEB packages:

  • Runtime - libpcapplusplus - only the shared libraries
  • Developer - libpcapplusplus-dev - static files, headers, cmake, pkg-config, maybe the example source files?
  • libpcapplusplus-tools / libpcapplusplus-examples - the executable binaries of the examples

How far away from it are we? Will this require many changes in the current build system?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide DEB or RPM

5 participants