Skip to content

Providing DEB #1831

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
wants to merge 15 commits into
base: dev
Choose a base branch
from
Open

Providing DEB #1831

wants to merge 15 commits into from

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

codecov bot commented May 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.99%. Comparing base (147f901) to head (38b3732).
Report is 3 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1831      +/-   ##
==========================================
- Coverage   83.00%   82.99%   -0.01%     
==========================================
  Files         284      285       +1     
  Lines       49006    49012       +6     
  Branches    10574    10343     -231     
==========================================
+ Hits        40676    40679       +3     
- Misses       7215     7216       +1     
- Partials     1115     1117       +2     
Flag Coverage Δ
alpine320 75.08% <ø> (-0.02%) ⬇️
fedora42 75.19% <ø> (-0.01%) ⬇️
macos-13 80.52% <ø> (-0.01%) ⬇️
macos-14 80.52% <ø> (-0.01%) ⬇️
macos-15 80.50% <ø> (-0.01%) ⬇️
mingw32 71.33% <ø> (-0.05%) ⬇️
mingw64 71.32% <ø> (-0.05%) ⬇️
npcap 84.98% <ø> (-0.02%) ⬇️
rhel94 74.95% <ø> (-0.03%) ⬇️
ubuntu2004 58.66% <ø> (+<0.01%) ⬆️
ubuntu2004-zstd 58.78% <ø> (-0.01%) ⬇️
ubuntu2204 74.90% <ø> (ø)
ubuntu2204-icpx 61.48% <ø> (+<0.01%) ⬆️
ubuntu2404 75.14% <ø> (+<0.01%) ⬆️
ubuntu2404-arm64 75.10% <ø> (-0.03%) ⬇️
unittest 82.99% <ø> (-0.01%) ⬇️
windows-2019 85.01% <ø> (-0.01%) ⬇️
windows-2022 85.02% <ø> (-0.01%) ⬇️
winpcap 85.16% <ø> (+<0.01%) ⬆️
xdp 50.55% <ø> (-0.01%) ⬇️

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 <bhaskarbhar007@yahoo.com>
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 pcapplusplus@gmail.com 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 seladb and Dimi1010 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/

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.

4 participants