Skip to content

Commit

Permalink
Publish debian packages (#769)
Browse files Browse the repository at this point in the history
* fix: add workflow to release debian packages

* fix: align with zenoh-c

- update package names
- set version string in the same way
- set DEBARCH/RPMARCH
- set CPACK_PACKAGE_FILE_NAME
- add -j to zip archive to not include parent folder

* fix: use CPACK_PACKAGE_NAME

* fix: pass package name to all build targets
  • Loading branch information
diogomatsubara authored Oct 31, 2024
1 parent 9cc5d70 commit 35f60d6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@ jobs:
name: ${{ steps.build-linux.outputs.archive-deb }}
path: ${{ steps.build-linux.outputs.archive-deb }}

debian:
name: Publish Debian packages
needs: [tag, build-linux]
uses: eclipse-zenoh/ci/.github/workflows/release-crates-debian.yml@main
with:
no-build: true
live-run: ${{ inputs.live-run || false }}
version: ${{ needs.tag.outputs.version }}
repo: ${{ github.repository }}
branch: ${{ needs.tag.outputs.branch }}
installation-test: false
secrets: inherit

eclipse:
needs: [tag, build-macos, build-linux]
runs-on: ubuntu-latest
Expand Down
18 changes: 7 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,8 @@ if(PACKAGING)
set(CPACK_PACKAGE_CHECKSUM MD5)
set(CPACK_PACKAGE_VENDOR "The Eclipse Foundation")
if(NOT CPACK_PACKAGE_VERSION)
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(SEM_VER "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
if(NOT DEFINED PROJECT_VERSION_TWEAK)
if(PROJECT_VERSION_TWEAK STREQUAL "")
set(CPACK_PACKAGE_VERSION ${SEM_VER})
elseif(PROJECT_VERSION_TWEAK EQUAL 0)
set(CPACK_PACKAGE_VERSION "${SEM_VER}~dev-1")
Expand All @@ -586,13 +585,13 @@ if(PACKAGING)
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-src-${project_version}")

set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")

if(PACKAGING MATCHES "DEB")
if(NOT DEBARCH)
set(DEBARCH ${CMAKE_SYSTEM_PROCESSOR})
set(DEBARCH ${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME})
endif()

message(STATUS "Configure DEB packaging for Linux ${DEBARCH}")

if(CPACK_GENERATOR)
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
else()
Expand All @@ -604,10 +603,9 @@ if(PACKAGING)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DEBARCH})
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_VERSION ${debian_version})
set(CPACK_DEBIAN_LIB_PACKAGE_NAME "lib${PROJECT_NAME}")
set(CPACK_DEBIAN_LIB_PACKAGE_NAME "lib${CPACK_PACKAGE_NAME}")
set(CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "libc6 (>=2.12)")
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "lib${PROJECT_NAME}-dev")
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "lib${CPACK_PACKAGE_NAME}-dev")
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "${CPACK_DEBIAN_LIB_PACKAGE_NAME} (=${CPACK_PACKAGE_VERSION})")
endif()

Expand All @@ -616,8 +614,6 @@ if(PACKAGING)
set(RPMARCH ${CMAKE_SYSTEM_PROCESSOR})
endif()

message(STATUS "Configure RPM packaging for Linux ${RPMARCH}")

if(CPACK_GENERATOR)
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
else()
Expand All @@ -628,7 +624,7 @@ if(PACKAGING)
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${RPMARCH})
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set(CPACK_RPM_LIB_PACKAGE_NAME ${PROJECT_NAME}) # avoid "-lib" suffix for "lib" package
set(CPACK_RPM_LIB_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) # avoid "-lib" suffix for "lib" package
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "${CPACK_RPM_LIB_PACKAGE_NAME} = ${CPACK_PACKAGE_VERSION}")
endif()

Expand Down
18 changes: 9 additions & 9 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,33 +115,33 @@ endif
crossbuild: check-docker
@echo "FROM dockcross/$(CROSSIMG)\nRUN apt-get update && apt-get -y install rpm" | docker build -t $(CROSSIMG_PREFIX)$(CROSSIMG) -
docker run --rm -v $(ROOT_DIR):/workdir -w /workdir $(CROSSIMG_PREFIX)$(CROSSIMG) bash -c "\
cmake $(CMAKE_OPT) -DPACKAGING=DEB,RPM -DDEBARCH=$(DEBARCH) -DRPMARCH=$(RPMARCH) -B$(CROSSBUILD_DIR)/$(CROSSIMG) && \
cmake $(CMAKE_OPT) -DCPACK_PACKAGE_NAME=$(PACKAGE_NAME) -DPACKAGING=DEB,RPM -DDEBARCH=$(DEBARCH) -DRPMARCH=$(RPMARCH) -B$(CROSSBUILD_DIR)/$(CROSSIMG) && \
make VERBOSE=1 -C$(CROSSBUILD_DIR)/$(CROSSIMG) all package"
docker rmi $(CROSSIMG_PREFIX)$(CROSSIMG)

linux-armv5:
CROSSIMG=$@ DEBARCH=arm RPMARCH=arm make crossbuild
PACKAGE_NAME="zenohpico" CROSSIMG=$@ DEBARCH=arm RPMARCH=arm make crossbuild

linux-armv6:
CROSSIMG=$@ DEBARCH=arm RPMARCH=arm make crossbuild
PACKAGE_NAME="zenohpico-armv6" CROSSIMG=$@ DEBARCH=arm RPMARCH=arm make crossbuild

linux-armv7:
CROSSIMG=$@ DEBARCH=armhf RPMARCH=armhf make crossbuild
PACKAGE_NAME="zenohpico" CROSSIMG=$@ DEBARCH=armhf RPMARCH=armhf make crossbuild

linux-armv7a:
CROSSIMG=$@ DEBARCH=armhf RPMARCH=armhf make crossbuild
PACKAGE_NAME="zenohpico-armv7a" CROSSIMG=$@ DEBARCH=armhf RPMARCH=armhf make crossbuild

linux-arm64:
CROSSIMG=$@ DEBARCH=arm64 RPMARCH=aarch64 make crossbuild
PACKAGE_NAME="zenohpico" CROSSIMG=$@ DEBARCH=arm64 RPMARCH=aarch64 make crossbuild

linux-mips:
CROSSIMG=$@ DEBARCH=mips RPMARCH=mips make crossbuild
PACKAGE_NAME="zenohpico" CROSSIMG=$@ DEBARCH=mips RPMARCH=mips make crossbuild

linux-x86:
CROSSIMG=$@ DEBARCH=i386 RPMARCH=x86 make crossbuild
PACKAGE_NAME="zenohpico" CROSSIMG=$@ DEBARCH=i386 RPMARCH=x86 make crossbuild

linux-x64:
CROSSIMG=$@ DEBARCH=amd64 RPMARCH=x86_64 make crossbuild
PACKAGE_NAME="zenohpico" CROSSIMG=$@ DEBARCH=amd64 RPMARCH=x86_64 make crossbuild

clean:
rm -fr $(BUILD_DIR)
Expand Down
10 changes: 5 additions & 5 deletions ci/scripts/build-linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ BUILD_SHARED_LIBS=ON BUILD_TYPE=RELEASE make "$target"

readonly out=$GITHUB_WORKSPACE
readonly repo_name=${repo#*/}
readonly archive_lib=$out/$repo_name-$version-$target.zip
readonly archive_deb=$out/$repo_name-$version-$target-deb-pkgs.zip
readonly archive_rpm=$out/$repo_name-$version-$target-rpm-pkgs.zip
readonly archive_lib=$out/$repo_name-$version-$target-standalone.zip
readonly archive_deb=$out/$repo_name-$version-$target-debian.zip
readonly archive_rpm=$out/$repo_name-$version-$target-rpm.zip
readonly archive_examples=$out/$repo_name-$version-$target-examples.zip

cd crossbuilds/"$target"
Expand All @@ -24,8 +24,8 @@ cd -
zip -r "$archive_lib" include

cd crossbuilds/"$target"/packages
zip "$archive_deb" ./*.deb
zip "$archive_rpm" ./*.rpm
zip -9 -j "$archive_deb" ./*.deb
zip -9 -j "$archive_rpm" ./*.rpm
cd -

cd crossbuilds/"$target"/examples
Expand Down

0 comments on commit 35f60d6

Please sign in to comment.