From dc82f1dd1b43ddb412e4c44f2bc2a2323bfe4b87 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Sun, 25 May 2025 17:17:16 +0530 Subject: [PATCH 01/13] package/deb --- .github/workflows/package.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2e733a741..9f572581b 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -403,3 +403,55 @@ jobs: allowUpdates: true updateOnlyUnreleased: true artifacts: "${{ env.PACKAGE_DIR }}.tar.gz" + + build-deb: + runs-on: ubuntu-latest + permissions: + contents: write + attestations: write + id-token: write + env: + BUILD_DIR: Dist + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install dependencies + run: | + apt-get update + apt-get install -y --no-install-recommends cmake make g++ libpcap-dev + + - name: Build project + run: | + mkdir -p "${{ env.BUILD_DIR }}" + cd "${{ env.BUILD_DIR }}" + cmake .. + make -j$(nproc) + make install DESTDIR=$PWD/install-root + + - name: Create DEB control file + run: | + cd "${{ env.BUILD_DIR }}/install-root" + mkdir -p DEBIAN + cat < DEBIAN/control + Package: pcapplusplus + Version: ${{ github.event.release.tag_name }} + Section: libs + Architecture: amd64 + Maintainer: Bhaskar Bhar + Description: PcapPlusPlus - C++ library for packet parsing and crafting + EOF + + - name: Build DEB package + run: | + cd "${{ env.BUILD_DIR }}" + dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + + - 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" + From 1804ff29e86d0b775d87816ddbaed776df7f2fad Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Sun, 25 May 2025 19:19:01 +0530 Subject: [PATCH 02/13] yaml_precommit_errors_fixed --- .github/workflows/package.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 9f572581b..31f084aa6 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -403,7 +403,7 @@ jobs: allowUpdates: true updateOnlyUnreleased: true artifacts: "${{ env.PACKAGE_DIR }}.tar.gz" - + build-deb: runs-on: ubuntu-latest permissions: @@ -454,4 +454,3 @@ jobs: allowUpdates: true updateOnlyUnreleased: true artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb" - From 7e4dcf9702a8a5d28601c2578593efb032a87ec6 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Wed, 28 May 2025 19:57:07 +0530 Subject: [PATCH 03/13] Add files via upload --- .github/workflows/package.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 31f084aa6..2fd55adb9 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -404,8 +404,9 @@ jobs: updateOnlyUnreleased: true artifacts: "${{ env.PACKAGE_DIR }}.tar.gz" - build-deb: + build-deb: runs-on: ubuntu-latest + container: seladb/ubuntu2404 permissions: contents: write attestations: write @@ -418,8 +419,8 @@ jobs: - name: Install dependencies run: | - apt-get update - apt-get install -y --no-install-recommends cmake make g++ libpcap-dev + sudo apt-get update + sudo apt-get install -y --no-install-recommends cmake make g++ libpcap-dev dpkg-dev - name: Build project run: | @@ -427,27 +428,41 @@ jobs: cd "${{ env.BUILD_DIR }}" cmake .. make -j$(nproc) - make install DESTDIR=$PWD/install-root + sudo make install DESTDIR=$PWD/install-root - name: Create DEB control file run: | cd "${{ env.BUILD_DIR }}/install-root" mkdir -p DEBIAN - cat < DEBIAN/control + cat < + Maintainer: PcapPlusPlus Team Description: PcapPlusPlus - C++ library for packet parsing and crafting EOF - name: Build DEB package run: | cd "${{ env.BUILD_DIR }}" - dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + sudo dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + + - name: Test DEB install + run: | + sudo apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + echo '#include + #include + int main() { + auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); + std::cout << "Found " << devList.size() << " devices\n"; + return 0; + }' > test.cpp + g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ + ./test - name: Upload DEB to release + if: github.ref_type == 'tag' uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 with: draft: true From e883d53d1cf4d2da414f46970a3e45ef44d9266e Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Wed, 28 May 2025 20:00:10 +0530 Subject: [PATCH 04/13] update package.yml --- .github/workflows/package.yml | 122 +++++++++++++++++----------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2fd55adb9..10601ac3f 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -405,67 +405,67 @@ jobs: artifacts: "${{ env.PACKAGE_DIR }}.tar.gz" build-deb: - runs-on: ubuntu-latest - container: seladb/ubuntu2404 - permissions: - contents: write - attestations: write - id-token: write - env: - BUILD_DIR: Dist - steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends cmake make g++ libpcap-dev dpkg-dev + runs-on: ubuntu-latest + container: seladb/ubuntu2404 + permissions: + contents: write + attestations: write + id-token: write + env: + BUILD_DIR: Dist + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends cmake make g++ libpcap-dev dpkg-dev - - name: Build project - run: | - mkdir -p "${{ env.BUILD_DIR }}" - cd "${{ env.BUILD_DIR }}" - cmake .. - make -j$(nproc) - sudo make install DESTDIR=$PWD/install-root + - name: Build project + run: | + mkdir -p "${{ env.BUILD_DIR }}" + cd "${{ env.BUILD_DIR }}" + cmake .. + make -j$(nproc) + sudo make install DESTDIR=$PWD/install-root - - name: Create DEB control file - run: | - cd "${{ env.BUILD_DIR }}/install-root" - mkdir -p DEBIAN - cat < - Description: PcapPlusPlus - C++ library for packet parsing and crafting - EOF - - - name: Build DEB package - run: | - cd "${{ env.BUILD_DIR }}" - sudo dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + - name: Create DEB control file + run: | + cd "${{ env.BUILD_DIR }}/install-root" + mkdir -p DEBIAN + cat < + Description: PcapPlusPlus - C++ library for packet parsing and crafting + EOF + + - name: Build DEB package + run: | + cd "${{ env.BUILD_DIR }}" + sudo dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb - - name: Test DEB install - run: | - sudo apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb - echo '#include - #include - int main() { - auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); - std::cout << "Found " << devList.size() << " devices\n"; - return 0; - }' > test.cpp - g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ - ./test - - - name: Upload DEB to release - if: github.ref_type == 'tag' - 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" + - name: Test DEB install + run: | + sudo apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + echo '#include + #include + int main() { + auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); + std::cout << "Found " << devList.size() << " devices\n"; + return 0; + }' > test.cpp + g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ + ./test + + - name: Upload DEB to release + if: github.ref_type == 'tag' + 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" From 6820b0db1784a46485e780cb385e64a9565c0e94 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Fri, 30 May 2025 12:23:11 +0530 Subject: [PATCH 05/13] syntax correction --- .github/workflows/package.yml | 124 +++++++++++++++++----------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 10601ac3f..c5c9bfb01 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -404,68 +404,68 @@ jobs: updateOnlyUnreleased: true artifacts: "${{ env.PACKAGE_DIR }}.tar.gz" - build-deb: - runs-on: ubuntu-latest - container: seladb/ubuntu2404 - permissions: - contents: write - attestations: write - id-token: write - env: - BUILD_DIR: Dist - steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends cmake make g++ libpcap-dev dpkg-dev + build-deb: + runs-on: ubuntu-latest + container: seladb/ubuntu2404 + permissions: + contents: write + attestations: write + id-token: write + env: + BUILD_DIR: Dist + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Build project - run: | - mkdir -p "${{ env.BUILD_DIR }}" - cd "${{ env.BUILD_DIR }}" - cmake .. - make -j$(nproc) - sudo make install DESTDIR=$PWD/install-root + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends cmake make g++ libpcap-dev dpkg-dev - - name: Create DEB control file - run: | - cd "${{ env.BUILD_DIR }}/install-root" - mkdir -p DEBIAN - cat < - Description: PcapPlusPlus - C++ library for packet parsing and crafting - EOF - - - name: Build DEB package - run: | - cd "${{ env.BUILD_DIR }}" - sudo dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + - name: Build project + run: | + mkdir -p "${{ env.BUILD_DIR }}" + cd "${{ env.BUILD_DIR }}" + cmake .. + make -j$(nproc) + sudo make install DESTDIR=$PWD/install-root - - name: Test DEB install - run: | - sudo apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb - echo '#include - #include - int main() { - auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); - std::cout << "Found " << devList.size() << " devices\n"; - return 0; - }' > test.cpp - g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ - ./test - - - name: Upload DEB to release - if: github.ref_type == 'tag' - 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" + - name: Create DEB control file + run: | + cd "${{ env.BUILD_DIR }}/install-root" + mkdir -p DEBIAN + cat < + Description: PcapPlusPlus - C++ library for packet parsing and crafting + EOF + + - name: Build DEB package + run: | + cd "${{ env.BUILD_DIR }}" + sudo dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + + - name: Test DEB install + run: | + sudo apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb + echo '#include + #include + int main() { + auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); + std::cout << "Found " << devList.size() << " devices\n"; + return 0; + }' > test.cpp + g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ + ./test + + - name: Upload DEB to release + if: github.ref_type == 'tag' + 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" From c2b343086839c4cebf661e8b65ef20ed1203b6ca Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Tue, 3 Jun 2025 22:20:39 +0530 Subject: [PATCH 06/13] Removed_Install_dependencies --- .github/workflows/package.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index c5c9bfb01..d8e5b94e9 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -417,11 +417,6 @@ jobs: - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends cmake make g++ libpcap-dev dpkg-dev - - name: Build project run: | mkdir -p "${{ env.BUILD_DIR }}" From 3114a34386f944c0374ff259979690742aa6a18c Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Fri, 6 Jun 2025 07:20:34 +0530 Subject: [PATCH 07/13] fix/removed_sudo --- .github/workflows/package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index d8e5b94e9..e79cf178d 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -423,13 +423,13 @@ jobs: cd "${{ env.BUILD_DIR }}" cmake .. make -j$(nproc) - sudo make install DESTDIR=$PWD/install-root + make install DESTDIR=$PWD/install-root - name: Create DEB control file run: | cd "${{ env.BUILD_DIR }}/install-root" mkdir -p DEBIAN - cat < #include int main() { From 5a53470958678b34f831ce96eb9b13f2ae6d7827 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Fri, 6 Jun 2025 12:53:47 +0530 Subject: [PATCH 08/13] fix/Added_fallback_version --- .github/workflows/package.yml | 120 +++++++++++++++++----------------- 1 file changed, 61 insertions(+), 59 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index e79cf178d..f2c8a8f6a 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -405,62 +405,64 @@ jobs: artifacts: "${{ env.PACKAGE_DIR }}.tar.gz" build-deb: - runs-on: ubuntu-latest - container: seladb/ubuntu2404 - permissions: - contents: write - attestations: write - id-token: write - env: - BUILD_DIR: Dist - steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Build project - run: | - mkdir -p "${{ env.BUILD_DIR }}" - cd "${{ env.BUILD_DIR }}" - cmake .. - make -j$(nproc) - make install DESTDIR=$PWD/install-root - - - name: Create DEB control file - run: | - cd "${{ env.BUILD_DIR }}/install-root" - mkdir -p DEBIAN - cat < - Description: PcapPlusPlus - C++ library for packet parsing and crafting - EOF - - - name: Build DEB package - run: | - cd "${{ env.BUILD_DIR }}" - dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb - - - name: Test DEB install - run: | - apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb - echo '#include - #include - int main() { - auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); - std::cout << "Found " << devList.size() << " devices\n"; - return 0; - }' > test.cpp - g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ - ./test - - - name: Upload DEB to release - if: github.ref_type == 'tag' - 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" + runs-on: ubuntu-latest + container: seladb/ubuntu2404 + permissions: + contents: write + attestations: write + id-token: write + env: + BUILD_DIR: Dist + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Build project + run: | + mkdir -p "${{ env.BUILD_DIR }}" + cd "${{ env.BUILD_DIR }}" + cmake .. + make -j$(nproc) + make install DESTDIR=$PWD/install-root + + - name: Create DEB control file + run: | + cd "${{ env.BUILD_DIR }}/install-root" + mkdir -p DEBIAN + VERSION="${{ github.event.release.tag_name }}" + if [ -z "$VERSION" ]; then VERSION="${GITHUB_REF_NAME:-0.0.0-dev}"; fi + cat < + Description: PcapPlusPlus - C++ library for packet parsing and crafting + EOF + + - name: Build DEB package + run: | + cd "${{ env.BUILD_DIR }}" + dpkg-deb --build install-root pcapplusplus_${{ github.ref_name }}_amd64.deb + + - name: Test DEB install + run: | + apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb + echo '#include + #include + int main() { + auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); + std::cout << "Found " << devList.size() << " devices\n"; + return 0; + }' > test.cpp + g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ + ./test + + - name: Upload DEB to release + if: github.ref_type == 'tag' + uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 + with: + draft: true + allowUpdates: true + updateOnlyUnreleased: true + artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb" From 0f82bd71b004c1aa771d3282d291938060e48669 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Mon, 9 Jun 2025 11:13:11 +0530 Subject: [PATCH 09/13] fix/indentation --- .github/workflows/package.yml | 122 +++++++++++++++++----------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index f2c8a8f6a..0d1f4db90 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -405,64 +405,64 @@ jobs: artifacts: "${{ env.PACKAGE_DIR }}.tar.gz" build-deb: - runs-on: ubuntu-latest - container: seladb/ubuntu2404 - permissions: - contents: write - attestations: write - id-token: write - env: - BUILD_DIR: Dist - steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Build project - run: | - mkdir -p "${{ env.BUILD_DIR }}" - cd "${{ env.BUILD_DIR }}" - cmake .. - make -j$(nproc) - make install DESTDIR=$PWD/install-root - - - name: Create DEB control file - run: | - cd "${{ env.BUILD_DIR }}/install-root" - mkdir -p DEBIAN - VERSION="${{ github.event.release.tag_name }}" - if [ -z "$VERSION" ]; then VERSION="${GITHUB_REF_NAME:-0.0.0-dev}"; fi - cat < - Description: PcapPlusPlus - C++ library for packet parsing and crafting - EOF - - - name: Build DEB package - run: | - cd "${{ env.BUILD_DIR }}" - dpkg-deb --build install-root pcapplusplus_${{ github.ref_name }}_amd64.deb - - - name: Test DEB install - run: | - apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb - echo '#include - #include - int main() { - auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); - std::cout << "Found " << devList.size() << " devices\n"; - return 0; - }' > test.cpp - g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ - ./test - - - name: Upload DEB to release - if: github.ref_type == 'tag' - uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 - with: - draft: true - allowUpdates: true - updateOnlyUnreleased: true - artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb" + runs-on: ubuntu-latest + container: seladb/ubuntu2404 + permissions: + contents: write + attestations: write + id-token: write + env: + BUILD_DIR: Dist + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Build project + run: | + mkdir -p "${{ env.BUILD_DIR }}" + cd "${{ env.BUILD_DIR }}" + cmake .. + make -j$(nproc) + make install DESTDIR=$PWD/install-root + + - name: Create DEB control file + run: | + cd "${{ env.BUILD_DIR }}/install-root" + mkdir -p DEBIAN + VERSION="${{ github.event.release.tag_name }}" + if [ -z "$VERSION" ]; then VERSION="${GITHUB_REF_NAME:-0.0.0-dev}"; fi + cat < + Description: PcapPlusPlus - C++ library for packet parsing and crafting + EOF + + - name: Build DEB package + run: | + cd "${{ env.BUILD_DIR }}" + dpkg-deb --build install-root pcapplusplus_${{ github.ref_name }}_amd64.deb + + - name: Test DEB install + run: | + apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb + echo '#include + #include + int main() { + auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); + std::cout << "Found " << devList.size() << " devices\n"; + return 0; + }' > test.cpp + g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ + ./test + + - name: Upload DEB to release + if: github.ref_type == 'tag' + uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 + with: + draft: true + allowUpdates: true + updateOnlyUnreleased: true + artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb" From b11297d4c0742a3bbc5748cd248898fb6ce73420 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Mon, 9 Jun 2025 12:43:26 +0530 Subject: [PATCH 10/13] fix_version --- .github/workflows/package.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 0d1f4db90..2517ae634 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -425,15 +425,20 @@ jobs: make -j$(nproc) make install DESTDIR=$PWD/install-root + - name: Set package version + run: | + RAW_VERSION="${{ github.event.release.tag_name }}" + if [ -z "$RAW_VERSION" ]; then RAW_VERSION="${GITHUB_REF_NAME:-0.0.0-dev}"; fi + VERSION="${RAW_VERSION//\//-}" + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Create DEB control file run: | cd "${{ env.BUILD_DIR }}/install-root" mkdir -p DEBIAN - VERSION="${{ github.event.release.tag_name }}" - if [ -z "$VERSION" ]; then VERSION="${GITHUB_REF_NAME:-0.0.0-dev}"; fi - cat < DEBIAN/control Package: pcapplusplus - Version: $VERSION + Version: ${{ env.VERSION }} Section: libs Architecture: amd64 Maintainer: PcapPlusPlus Team @@ -443,17 +448,18 @@ jobs: - name: Build DEB package run: | cd "${{ env.BUILD_DIR }}" - dpkg-deb --build install-root pcapplusplus_${{ github.ref_name }}_amd64.deb + dpkg-deb --build install-root "pcapplusplus_${{ env.VERSION }}_amd64.deb" - name: Test DEB install run: | - apt-get install -y ./${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb + apt-get update + apt-get install -y "./${{ env.BUILD_DIR }}/pcapplusplus_${{ env.VERSION }}_amd64.deb" echo '#include #include int main() { - auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); - std::cout << "Found " << devList.size() << " devices\n"; - return 0; + auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); + std::cout << "Found " << devList.size() << " devices\n"; + return 0; }' > test.cpp g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ ./test @@ -465,4 +471,4 @@ jobs: draft: true allowUpdates: true updateOnlyUnreleased: true - artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ github.ref_name }}_amd64.deb" + artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ env.VERSION }}_amd64.deb" From 75225a4d973660f0ea22c657352eacca4e566f23 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Mon, 9 Jun 2025 22:47:12 +0530 Subject: [PATCH 11/13] removed_test_added_bash --- .github/workflows/package.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2517ae634..60af8d3c0 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -426,6 +426,7 @@ jobs: make install DESTDIR=$PWD/install-root - name: Set package version + shell: bash run: | RAW_VERSION="${{ github.event.release.tag_name }}" if [ -z "$RAW_VERSION" ]; then RAW_VERSION="${GITHUB_REF_NAME:-0.0.0-dev}"; fi @@ -433,6 +434,7 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Create DEB control file + shell: bash run: | cd "${{ env.BUILD_DIR }}/install-root" mkdir -p DEBIAN @@ -446,24 +448,11 @@ jobs: EOF - name: Build DEB package + shell: bash run: | cd "${{ env.BUILD_DIR }}" dpkg-deb --build install-root "pcapplusplus_${{ env.VERSION }}_amd64.deb" - - name: Test DEB install - run: | - apt-get update - apt-get install -y "./${{ env.BUILD_DIR }}/pcapplusplus_${{ env.VERSION }}_amd64.deb" - echo '#include - #include - int main() { - auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); - std::cout << "Found " << devList.size() << " devices\n"; - return 0; - }' > test.cpp - g++ test.cpp -o test -lPcapPlusPlus -lPacket++ -lCommon++ - ./test - - name: Upload DEB to release if: github.ref_type == 'tag' uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 From 3b6c2b32cd8418ad900cf251e2dc23de1a77f7f7 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Sat, 14 Jun 2025 18:51:09 +0530 Subject: [PATCH 12/13] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c59fc5615..c100a10e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -435,7 +435,7 @@ if(PCAPPP_PACKAGE) cmake_host_system_information(RESULT DISTRO_VERSION_ID QUERY DISTRIB_VERSION_ID) set(_PCAPPP_PACKAGE_README_CUSTOM_PATH "${_PCAPPP_PACKAGE_README_PATH}/README.release.linux") if("${DISTRO_ID}" STREQUAL "ubuntu") - # set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB) + set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB) elseif("${DISTRO_ID}" STREQUAL "centos" OR "${DISTRO_ID}" STREQUAL "rhel") # set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM) elseif("${DISTRO_ID}" STREQUAL "freebsd") From 38b3732f607f8d16b5c2954df770daa47981b460 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Sat, 14 Jun 2025 18:52:23 +0530 Subject: [PATCH 13/13] Used CMAKE -G --- .github/workflows/package.yml | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 60af8d3c0..f71d86626 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -417,14 +417,6 @@ jobs: - name: Checkout code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Build project - run: | - mkdir -p "${{ env.BUILD_DIR }}" - cd "${{ env.BUILD_DIR }}" - cmake .. - make -j$(nproc) - make install DESTDIR=$PWD/install-root - - name: Set package version shell: bash run: | @@ -433,25 +425,17 @@ jobs: VERSION="${RAW_VERSION//\//-}" echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Create DEB control file - shell: bash + - name: Configure and build with CMake run: | - cd "${{ env.BUILD_DIR }}/install-root" - mkdir -p DEBIAN - cat < DEBIAN/control - Package: pcapplusplus - Version: ${{ env.VERSION }} - Section: libs - Architecture: amd64 - Maintainer: PcapPlusPlus Team - Description: PcapPlusPlus - C++ library for packet parsing and crafting - EOF - - - name: Build DEB package - shell: bash + mkdir -p "${{ env.BUILD_DIR }}" + cd "${{ env.BUILD_DIR }}" + cmake -DPCAPPP_PACKAGE=ON -DPCAPPP_INSTALL=ON -DPROJECT_VERSION=${{ env.VERSION }} .. + make -j$(nproc) + + - name: Package with CPack (DEB) run: | cd "${{ env.BUILD_DIR }}" - dpkg-deb --build install-root "pcapplusplus_${{ env.VERSION }}_amd64.deb" + cpack -G DEB - name: Upload DEB to release if: github.ref_type == 'tag' @@ -460,4 +444,4 @@ jobs: draft: true allowUpdates: true updateOnlyUnreleased: true - artifacts: "${{ env.BUILD_DIR }}/pcapplusplus_${{ env.VERSION }}_amd64.deb" + artifacts: "${{ env.BUILD_DIR }}/*.deb"