Skip to content
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

Eliminate git sha from version in case of release #1188

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions CI/azure/ci-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -x
uname -a
echo "$PWD"
git config --global --add safe.directory /ci
mkdir build && cd build
cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DWITH_SERIAL_BACKEND=ON -DWITH_EXAMPLES=ON -DPYTHON_BINDINGS=ON -DCPP_BINDINGS=ON -DENABLE_PACKAGING=ON -DCPACK_SYSTEM_NAME="${ARTIFACTNAME}"
make
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ endif()

set(LIBIIO_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(LIBIIO_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(LIBIIO_VERSION_PATCH 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be using ${PROJECT_VERSION_PATCH} per normal/standard cmake semantics.

set(VERSION "${PROJECT_VERSION}")
if (WIN32)
string(TIMESTAMP BUILD_YEAR "%Y")
Expand Down Expand Up @@ -370,7 +371,11 @@ if (NOT LIBIIO_VERSION_GIT)
set(LIBIIO_VERSION_GIT v${VERSION})
endif()

set(LIBIIO_VERSION ${VERSION}.g${LIBIIO_VERSION_GIT})
set(IS_RELEASE_ENV $ENV{IS_RELEASE})
if (NOT IS_RELEASE_ENV)
set(LIBIIO_VERSION_PATCH g${LIBIIO_VERSION_GIT})
endif()
set(LIBIIO_VERSION ${VERSION}.${LIBIIO_VERSION_PATCH})
file(WRITE ${CMAKE_BINARY_DIR}/.version ${LIBIIO_VERSION})

if(WITH_LOCAL_BACKEND)
Expand Down
64 changes: 32 additions & 32 deletions artifact_manifest.txt.cmakein
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
Libiio-Setup-Exe/libiio-setup.exe

Linux-Fedora-34/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-34.rpm
Linux-Fedora-34/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-34.tar.gz
Linux-Fedora-34/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Fedora-34.rpm
Linux-Fedora-34/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Fedora-34.tar.gz

Linux-Fedora-28/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-28.rpm
Linux-Fedora-28/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Fedora-28.tar.gz
Linux-Fedora-28/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Fedora-28.rpm
Linux-Fedora-28/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Fedora-28.tar.gz

Linux-CentOS-7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-CentOS-7.rpm
Linux-CentOS-7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-CentOS-7.tar.gz
Linux-CentOS-7/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-CentOS-7.rpm
Linux-CentOS-7/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-CentOS-7.tar.gz

Linux-Debian-11/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Debian-11.deb
Linux-Debian-11/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Debian-11.tar.gz
Linux-Debian-11/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Debian-11.deb
Linux-Debian-11/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Debian-11.tar.gz

Linux-Debian-12/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Debian-12.deb
Linux-Debian-12/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Debian-12.tar.gz
Linux-Debian-12/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Debian-12.deb
Linux-Debian-12/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Debian-12.tar.gz

Linux-Ubuntu-20.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-20.04.deb
Linux-Ubuntu-20.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-20.04.tar.gz
Linux-Ubuntu-20.04/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Ubuntu-20.04.deb
Linux-Ubuntu-20.04/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Ubuntu-20.04.tar.gz

Linux-Ubuntu-22.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-22.04.deb
Linux-Ubuntu-22.04/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-Ubuntu-22.04.tar.gz
Linux-Ubuntu-22.04/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Ubuntu-22.04.deb
Linux-Ubuntu-22.04/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-Ubuntu-22.04.tar.gz

Linux-openSUSE-15.4/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-openSUSE-15.4.rpm
Linux-openSUSE-15.4/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Linux-openSUSE-15.4.tar.gz
Linux-openSUSE-15.4/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-openSUSE-15.4.rpm
Linux-openSUSE-15.4/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Linux-openSUSE-15.4.tar.gz

macOS-12/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-macOS-12.tar.gz
macOS-12/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@.pkg
macOS-12/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-macOS-12.tar.gz
macOS-12/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@.pkg

macOS-13-x64/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-macOS-13-x64.tar.gz
macOS-13-x64/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@.pkg
macOS-13-x64/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-macOS-13-x64.tar.gz
macOS-13-x64/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@.pkg

macOS-13-arm64/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-macOS-13-arm64.tar.gz
macOS-13-arm64/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@.pkg
macOS-13-arm64/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-macOS-13-arm64.tar.gz
macOS-13-arm64/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@.pkg

Ubuntu-arm32v7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-arm32v7.deb
Ubuntu-arm32v7/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-arm32v7.tar.gz
Ubuntu-arm32v7/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Ubuntu-arm32v7.deb
Ubuntu-arm32v7/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Ubuntu-arm32v7.tar.gz

Ubuntu-arm64v8/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-arm64v8.deb
Ubuntu-arm64v8/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-arm64v8.tar.gz
Ubuntu-arm64v8/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Ubuntu-arm64v8.deb
Ubuntu-arm64v8/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Ubuntu-arm64v8.tar.gz

Ubuntu-ppc64le/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-ppc64le.deb
Ubuntu-ppc64le/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-ppc64le.tar.gz
Ubuntu-ppc64le/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Ubuntu-ppc64le.deb
Ubuntu-ppc64le/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Ubuntu-ppc64le.tar.gz

Ubuntu-x390x/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-x390x.deb
Ubuntu-x390x/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Ubuntu-x390x.tar.gz
Ubuntu-x390x/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Ubuntu-x390x.deb
Ubuntu-x390x/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Ubuntu-x390x.tar.gz

Debian12-arm/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Debian12-arm.deb
Debian12-arm/libiio-@VERSION@.g@LIBIIO_VERSION_GIT@-Debian12-arm.tar.gz
Debian12-arm/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Debian12-arm.deb
Debian12-arm/libiio-@VERSION@.@LIBIIO_VERSION_PATCH@-Debian12-arm.tar.gz

Windows-VS-2019-x64/iio.h
Windows-VS-2019-x64/iio_attr.exe
Expand Down
11 changes: 10 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
variables:
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]

${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/v') }}:
IS_RELEASE: 1

trigger:
branches:
include:
Expand Down Expand Up @@ -401,6 +404,9 @@ stages:
build_script: ci-ubuntu.sh
artifactName: 'Debian12-arm'
steps:
- checkout: self
fetchDepth: 1
clean: true
- script: |
set -e
sudo apt-get update
Expand All @@ -413,7 +419,7 @@ stages:
displayName: 'Setup'
- script: |
set -e
sudo docker run --platform "linux/$(arch)" --rm -t --privileged -e ARTIFACTNAME=$(artifactName) -v "$(Agent.BuildDirectory)/s":"/ci" -v "/usr/bin/qemu-$(arch)-static":"/usr/bin/qemu-$(arch)-static" "$(image)" /bin/bash -c "cd /ci/ && chmod +x ./CI/azure/$(build_script) && ./CI/azure/$(build_script)"
sudo docker run --platform "linux/$(arch)" --rm -t --privileged -e IS_RELEASE=$IS_RELEASE -e ARTIFACTNAME=$(artifactName) -v "$(Agent.BuildDirectory)/s":"/ci" -v "/usr/bin/qemu-$(arch)-static":"/usr/bin/qemu-$(arch)-static" "$(image)" /bin/bash -c "cd /ci/ && chmod +x ./CI/azure/$(build_script) && ./CI/azure/$(build_script)"
displayName: 'Build'
- task: CopyFiles@2
inputs:
Expand Down Expand Up @@ -445,6 +451,9 @@ stages:
artifactName: 'Check artifacts'
container: $[ variables['image'] ]
steps:
- checkout: self
fetchDepth: 1
clean: true
- script: |
set -e
mkdir build && cd build
Expand Down
2 changes: 1 addition & 1 deletion cmake/DarwinPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(CPACK_GENERATOR TGZ)

set(CPACK_PACKAGE_VERSION_MAJOR ${LIBIIO_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${LIBIIO_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH g${LIBIIO_VERSION_GIT})
set(CPACK_PACKAGE_VERSION_PATCH g${LIBIIO_VERSION_PATCH})
set(CPACK_BUNDLE_NAME libiio)
set(CPACK_PACKAGE_VERSION ${LIBIIO_VERSION})

Expand Down
2 changes: 1 addition & 1 deletion cmake/LinuxPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(CPACK_GENERATOR TGZ)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_PACKAGE_VERSION_MAJOR ${LIBIIO_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${LIBIIO_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH g${LIBIIO_VERSION_GIT})
set(CPACK_PACKAGE_VERSION_PATCH ${LIBIIO_VERSION_PATCH})
set(CPACK_BUNDLE_NAME libiio)
set(CPACK_PACKAGE_VERSION ${LIBIIO_VERSION})

Expand Down
1 change: 1 addition & 0 deletions iio-config.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#define LIBIIO_VERSION_MAJOR @LIBIIO_VERSION_MAJOR@
#define LIBIIO_VERSION_MINOR @LIBIIO_VERSION_MINOR@
#define LIBIIO_VERSION_PATCH "@LIBIIO_VERSION_PATCH@"
#define LIBIIO_VERSION_GIT "@LIBIIO_VERSION_GIT@"

#define LOG_LEVEL @LOG_LEVEL@_L
Expand Down
2 changes: 1 addition & 1 deletion iiod/iiod.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static int start_iiod(const char *uri, const char *ffs_mountpoint,

IIO_INFO("Starting IIO Daemon version %u.%u.%s\n",
LIBIIO_VERSION_MAJOR, LIBIIO_VERSION_MINOR,
LIBIIO_VERSION_GIT);
LIBIIO_VERSION_PATCH);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is a great idea - since it will not be set to "0" all the time - and users reporting errors will no longer know what version of iiod they are using - something from main, or a release. with the git version - everyone knew.

Copy link
Contributor

Choose a reason for hiding this comment

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

For development propose and using it in other CI pipelines (like libad9361/9166, iio-osc etc), it's ok to keep using git_sha as patch version. Those daily-created packages are not used so often by customers.
For released versions, we are not allowed to use it anymore - released packages are added now in ADI Linux Package Repository and they need to have a number as patch version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure this is a great idea - since it will not be set to "0" all the time - and users reporting errors will no longer know what version of iiod they are using - something from main, or a release. with the git version - everyone knew.

If the build will be from main the git sha will appear as expected.
version

Copy link
Contributor

Choose a reason for hiding this comment

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

Then this is even worse - since sometimes a variable called "patch" is a githash, and sometimes it's not.


if (!WITH_IIOD_NETWORK
&& (!WITH_IIOD_USBD || !ffs_mountpoint)
Expand Down
Loading