Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/workflows/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
openssl-devel jansson-devel \
doxygen graphviz plantuml texlive-bibtex \
asciidoctor \
rpm-build rpmlint
tito rpm-build rpmlint
- name: Checkout repository
uses: actions/checkout@v4
with:
Expand All @@ -55,8 +55,6 @@ jobs:
uses: hendrikmuhs/ccache-action@v1.2
with:
create-symlink: true
- name: Prep
run: ./build.sh rpm-prep
- name: Build
run: ./build.sh rpm-build
- name: Check
Expand All @@ -67,15 +65,15 @@ jobs:
echo "## rpmlint results:" >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat build/default/pkg/rpmbuild/rpmlint.txt >> $GITHUB_STEP_SUMMARY
cat build/default/pkg/rpmlint.txt >> $GITHUB_STEP_SUMMARY || true
echo >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Archive
uses: actions/upload-artifact@v4
with:
name: bsl-rpm
path: |
build/default/pkg/rpmbuild/SRPMS
build/default/pkg/rpmbuild/RPMS
build/default/pkg/rpmbuild/rpmlint.txt
build/default/pkg/*.rpm
build/default/pkg/*/*.rpm
build/default/pkg/rpmlint.txt
retention-days: 1
3 changes: 3 additions & 0 deletions .tito/packages/.readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
the .tito/packages directory contains metadata files
named after their packages. Each file has the latest tagged
version and the project's relative directory.
1 change: 1 addition & 0 deletions .tito/packages/bsl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0-2 ./
7 changes: 7 additions & 0 deletions .tito/tito.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[buildconfig]
builder = tito.builder.SubmoduleAwareBuilder
tagger = tito.tagger.VersionTagger
tag_format = v{version}
changelog_do_not_remove_cherrypick = 0
changelog_format = %s (%ae)

65 changes: 24 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,41 @@ option(BUILD_UNITTEST "Enable building unit tests" ON)
option(TEST_MEMCHECK "Enable test runtime memory checking" ON)
option(BUILD_COVERAGE "Enable runtime coverage logging and reporting" OFF)
option(BUILD_FUZZING "Enable building fuzzing executables" OFF)
option(BUILD_PACKAGE "Enable building package outputs" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Ingest the git tag as project version name
find_package(Git)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --long --dirty
RESULT_VARIABLE GIT_TAG_EXIT
OUTPUT_VARIABLE GIT_TAG_REV
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(NOT GIT_TAG_EXIT EQUAL 0)
if(NOT PROJECT_VERSION)
# Ingest the git tag as project version name
find_package(Git)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always --dirty
OUTPUT_VARIABLE GIT_COMMIT
COMMAND ${GIT_EXECUTABLE} describe --tags --long --dirty
RESULT_VARIABLE GIT_TAG_EXIT
OUTPUT_VARIABLE GIT_TAG_REV
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
set(GIT_TAG_REV "v0.0.0-0-g${GIT_COMMIT}")
message(WARNING "No git tag found, marking as ${GIT_TAG_REV}")
endif()
# Make version compatible with CMake and RPM needs
STRING(REGEX REPLACE [[^v([0-9]+\.[0-9]+\.[0-9]+).*]] [[\1]] GIT_TAG_VERS ${GIT_TAG_REV})
STRING(REGEX REPLACE [[^v[0-9\.]*-(.+)]] [[\1]] GIT_TAG_MOD ${GIT_TAG_REV})
STRING(REPLACE "-" "." GIT_TAG_MOD ${GIT_TAG_MOD})
message(STATUS "Using version marking ${GIT_TAG_VERS} - ${GIT_TAG_MOD}")
if(NOT GIT_TAG_EXIT EQUAL 0)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always --dirty
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(GIT_TAG_REV "v0.0.0-0-g${GIT_COMMIT}")
message(WARNING "No git tag found, marking as ${GIT_TAG_REV}")
endif()
# Make version compatible with CMake and RPM needs
STRING(REGEX REPLACE [[^v([0-9]+\.[0-9]+\.[0-9]+).*]] [[\1]] GIT_TAG_VERS ${GIT_TAG_REV})
STRING(REGEX REPLACE [[^v[0-9\.]*-(.+)]] [[\1]] GIT_TAG_MOD ${GIT_TAG_REV})
STRING(REPLACE "-" "." GIT_TAG_MOD ${GIT_TAG_MOD})
message(STATUS "Using version marking ${GIT_TAG_VERS} - ${GIT_TAG_MOD}")
set(PROJECT_VERSION ${GIT_TAG_VERS})
endif(NOT PROJECT_VERSION)

project(bsl
LANGUAGES C CXX
VERSION ${GIT_TAG_VERS}
VERSION ${PROJECT_VERSION}
)

# Language options
Expand Down Expand Up @@ -194,25 +196,6 @@ set(TEST_INSTALL_PREFIX "${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}")
add_subdirectory(test)
add_subdirectory(docs)

if(BUILD_PACKAGE)
# Source packaging as tarball build with target package_source
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
"/\\.git/"
"/\\.github/"
"/\\.ccache/"
"/\\.pytest_cache/"
"/__pycache__/"
build/
testroot/
".*~$"
)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}")
set(CPACK_VERBATIM_VARIABLES YES)
include(CPack)

add_subdirectory(pkg)
endif(BUILD_PACKAGE)

add_custom_command(
DEPENDS CMakeGraphVizOptions.cmake
Expand Down
21 changes: 16 additions & 5 deletions pkg/bsl.spec.in → bsl.spec
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
%bcond_with apidoc

Name: bsl
Version: @PROJECT_VERSION@
Release: @GIT_TAG_MOD@%{?dist}
Version: 1.0.0
Release: 2%{?dist}
Summary: The Bundle Protocol Security Library (BSL)
URL: https://github.com/NASA-AMMOS/BSL
# License "Apache-2.0" is not accepted by rpmlint
License: ASL 2.0
Source0: @CPACK_SOURCE_PACKAGE_FILE_NAME@.tar.gz
Source0: %{name}-%{version}.tar.gz

BuildRequires: rsync
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
Expand Down Expand Up @@ -59,16 +60,19 @@ from the API with Doxygen.
./build.sh deps

%cmake -DCMAKE_PREFIX_PATH=${PWD}/testroot/usr \
-DBUILD_UNITTEST=YES -DTEST_MEMCHECK=NO -DTEST_COVERAGE=NO \
-DPROJECT_VERSION=%{version} \
-DBUILD_UNITTEST=YES -DTEST_MEMCHECK=NO -DBUILD_COVERAGE=NO \
-DBUILD_DOCS_MAN=YES %{?with_apidoc:-DBUILD_DOCS_API=YES}


%build
%cmake_build
%cmake_build --target docs-man
%if %{with apidoc}
%cmake_build --target docs-api-html
%endif


%install
# Only during this stage can the {buildroot} be written to

Expand All @@ -94,6 +98,10 @@ popd
%cmake_install


%check
%cmake_build --target test


%files
%license LICENSE
%doc README.md
Expand Down Expand Up @@ -143,7 +151,10 @@ popd


%changelog
* Wed Sep 17 2025 Brian Sipos - 1.0.0-0
* Thu Sep 18 2025 Brian Sipos <brian.sipos@jhuapl.edu> 1.0.0-2
- New package built with tito

* Wed Sep 17 2025 Brian Sipos - 1.0.0-1
- Initial release version.

* Mon Oct 07 2024 Brian Sipos - 0.0.0-0
Expand Down
27 changes: 7 additions & 20 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function usage {
echo " install - Install"
echo " lint - Run clang-tidy code linter"
echo " prep [args...] - Generate makefiles with config options"
echo " rpm-prep - Prepare for RPM package building"
echo " rpm-build - Build RPM package after rpm-prep"
echo " rpm-check - Check RPM packages after rpm-build"
echo " rpm-container - Build and check RPM packages inside container"
Expand Down Expand Up @@ -112,31 +111,22 @@ function cmd_prep {
./resources/prep.sh "$@"
}

function cmd_rpm_prep {
function cmd_rpm_build {
if ! git describe 2>/dev/null >/dev/null
then
git config --global --add safe.directory ${PWD}
fi
./resources/prep.sh -DBUILD_LIB=OFF -DBUILD_UNITTEST=OFF -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DBUILD_PACKAGE=ON
}

function cmd_rpm_build {
cmake --build build/default --target package_srpm
cmake --build build/default --target package_rpm
tito build -o build/default/pkg --test --srpm
tito build -o build/default/pkg --test --rpm
}

function cmd_rpm_check {
# Package scanning
cd build/default/pkg/rpmbuild
for PKG in RPMS/x86_64/*.rpm
do
echo
rpm -qilp ${PKG}
done
pushd build/default/pkg
rpmlint --file=${SELFDIR}/pkg/rpmlintrc . | tee rpmlint.txt

# Trial install
dnf install -y RPMS/x86_64/*.rpm
dnf install -y x86_64/*.rpm
dnf repoquery -l 'bsl*'
}

Expand All @@ -158,8 +148,8 @@ function cmd_rpm_container {
echo "Executing in container..."
${DOCKER} container start -a ${CID}

mkdir -p build/default/pkg/rpmbuild
${DOCKER} container cp ${CID}:/usr/local/src/bsl/build/default/pkg/rpmbuild/. ${SELFDIR}/build/default/pkg/rpmbuild
mkdir -p build/default/pkg
${DOCKER} container cp ${CID}:/usr/local/src/bsl/build/default/pkg/. ${SELFDIR}/build/default/pkg

echo "Removing container..."
${DOCKER} container rm ${CID}
Expand Down Expand Up @@ -229,9 +219,6 @@ case "$1" in
prep)
cmd_prep "$@"
;;
rpm-prep)
cmd_rpm_prep
;;
rpm-build)
cmd_rpm_build
;;
Expand Down
71 changes: 0 additions & 71 deletions pkg/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion resources/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ then
cmake --build ${BUILDDIR}/QCBOR
cmake --install ${BUILDDIR}/QCBOR
rm -rf ${BUILDDIR}/QCBOR
! git status || git restore .
popd
fi

Expand Down
Loading