[libcamera-devel] meson: Use x.y soname versioning
diff mbox series

Message ID 20230501114452.1224167-1-kieran.bingham@ideasonboard.com
State Superseded
Headers show
Series
  • [libcamera-devel] meson: Use x.y soname versioning
Related show

Commit Message

Kieran Bingham May 1, 2023, 11:44 a.m. UTC
Now that we identify ABI breakages, provide incremental releases which
can support backwards compatible linkage across release points that have
a compatible ABI.

Introduction of this commit does not convey that libcamera now has a
stable API, but that patch releases with a common minor number
(0.minor.patch) may potentially be used by applications without
recompilation and linkage against new releases.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 meson.build | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Laurent Pinchart May 1, 2023, 11:55 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Mon, May 01, 2023 at 12:44:52PM +0100, Kieran Bingham via libcamera-devel wrote:
> Now that we identify ABI breakages,

Can you explain how so ? Ideally I'd like a script in the utils/
directory to handle the ABI checks.

> provide incremental releases which
> can support backwards compatible linkage across release points that have
> a compatible ABI.
> 
> Introduction of this commit does not convey that libcamera now has a
> stable API, but that patch releases with a common minor number
> (0.minor.patch) may potentially be used by applications without
> recompilation and linkage against new releases.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  meson.build | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 6e363a906c69..4afe7d1624a7 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -56,15 +56,13 @@ if libcamera_version != project_version
>      libcamera_git_version += '-nvm'
>  endif
>  
> -# Until we make ABI compatible releases, the full libcamera version is used as
> -# the soname. No ABI/API compatibility is guaranteed between releases (x.y.z).
> -#
> -# When automatic ABI based detection is used to increment the version, this
> -# will bump the minor number (x.y).
> +# The major and minor libcamera version components are used as the soname.
> +# No ABI/API compatibility is guaranteed between releases (x.y).
>  #
>  # When we declare a stable ABI/API we will provide a 1.0 release and the
>  # soversion at that point will be the 'major' release value (x).
> -libcamera_soversion = libcamera_version
> +semver = libcamera_version.split('.')
> +libcamera_soversion = semver[0] + '.' + semver[1]
>  
>  summary({ 'Sources': libcamera_git_version, }, section : 'Versions')
>
Kieran Bingham May 1, 2023, 12:25 p.m. UTC | #2
Quoting Laurent Pinchart (2023-05-01 12:55:56)
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Mon, May 01, 2023 at 12:44:52PM +0100, Kieran Bingham via libcamera-devel wrote:
> > Now that we identify ABI breakages,
> 
> Can you explain how so ? Ideally I'd like a script in the utils/
> directory to handle the ABI checks.

I have this snippet in a local Makefile.

"""
VERSION:=$(shell ./utils/gen-version.sh)
abi-dump:
	echo Version : $(VERSION)
	mkdir -p abi/$(VERSION)/
	meson abi/build \
		-Ddocumentation=disabled \
		-Dcam=disabled \
		-Dqcam=disabled \
		-Dgstreamer=disabled \
		-Dlc-compliance=disabled \
		-Dtracing=disabled \
		-Dpipelines=
	ninja -C abi/build
	DESTDIR=$(shell pwd)/abi/$(VERSION)/ ninja -C abi/build install
	cat libcamera-abi-dump.xml.in | sed 's/VERSION/$(VERSION)/g' > libcamera-abi-dump.xml
	abi-compliance-checker \
		-lib libcamera \
		-v1 $(VERSION) \
		-dump libcamera-abi-dump.xml \
		-dump-path ./abi/v$(VERSION).abi.dump

RELEASE_ABI=$(shell ./utils/semver get release $(VERSION))
abi-check:
	abi-compliance-checker -l libcamera \
		-old abi/v$(RELEASE_ABI).abi.dump \
		-new abi/v$(VERSION).abi.dump
"""

Where 'libcamera-abi-dump.xml.in' contains:

"""
<version>VERSION</version>
<headers>abi/VERSION/usr/local/include/</headers>
<libs>abi/VERSION/usr/local/lib/</libs>
"""

The main issue is storing (or regenerating) previous versions of the ABI
dump files to compare against.

The abi-check produces an HTML 'report' which likely needs to be read by
the caller, or have something scrape for the detail, so there's still a
lot of manual steps involved for now.

--
Kieran



> 
> > provide incremental releases which
> > can support backwards compatible linkage across release points that have
> > a compatible ABI.
> > 
> > Introduction of this commit does not convey that libcamera now has a
> > stable API, but that patch releases with a common minor number
> > (0.minor.patch) may potentially be used by applications without
> > recompilation and linkage against new releases.
> > 
> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > ---
> >  meson.build | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 6e363a906c69..4afe7d1624a7 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -56,15 +56,13 @@ if libcamera_version != project_version
> >      libcamera_git_version += '-nvm'
> >  endif
> >  
> > -# Until we make ABI compatible releases, the full libcamera version is used as
> > -# the soname. No ABI/API compatibility is guaranteed between releases (x.y.z).
> > -#
> > -# When automatic ABI based detection is used to increment the version, this
> > -# will bump the minor number (x.y).
> > +# The major and minor libcamera version components are used as the soname.
> > +# No ABI/API compatibility is guaranteed between releases (x.y).
> >  #
> >  # When we declare a stable ABI/API we will provide a 1.0 release and the
> >  # soversion at that point will be the 'major' release value (x).
> > -libcamera_soversion = libcamera_version
> > +semver = libcamera_version.split('.')
> > +libcamera_soversion = semver[0] + '.' + semver[1]
> >  
> >  summary({ 'Sources': libcamera_git_version, }, section : 'Versions')
> >  
> 
> -- 
> Regards,
> 
> Laurent Pinchart
Laurent Pinchart May 1, 2023, 12:46 p.m. UTC | #3
Hi Kieran,

On Mon, May 01, 2023 at 01:25:14PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2023-05-01 12:55:56)
> > Hi Kieran,
> > 
> > Thank you for the patch.
> > 
> > On Mon, May 01, 2023 at 12:44:52PM +0100, Kieran Bingham via libcamera-devel wrote:
> > > Now that we identify ABI breakages,
> > 
> > Can you explain how so ? Ideally I'd like a script in the utils/
> > directory to handle the ABI checks.
> 
> I have this snippet in a local Makefile.
> 
> """
> VERSION:=$(shell ./utils/gen-version.sh)
> abi-dump:
> 	echo Version : $(VERSION)
> 	mkdir -p abi/$(VERSION)/
> 	meson abi/build \
> 		-Ddocumentation=disabled \
> 		-Dcam=disabled \
> 		-Dqcam=disabled \
> 		-Dgstreamer=disabled \
> 		-Dlc-compliance=disabled \
> 		-Dtracing=disabled \
> 		-Dpipelines=
> 	ninja -C abi/build
> 	DESTDIR=$(shell pwd)/abi/$(VERSION)/ ninja -C abi/build install
> 	cat libcamera-abi-dump.xml.in | sed 's/VERSION/$(VERSION)/g' > libcamera-abi-dump.xml
> 	abi-compliance-checker \
> 		-lib libcamera \
> 		-v1 $(VERSION) \
> 		-dump libcamera-abi-dump.xml \
> 		-dump-path ./abi/v$(VERSION).abi.dump
> 
> RELEASE_ABI=$(shell ./utils/semver get release $(VERSION))
> abi-check:
> 	abi-compliance-checker -l libcamera \
> 		-old abi/v$(RELEASE_ABI).abi.dump \
> 		-new abi/v$(VERSION).abi.dump
> """
> 
> Where 'libcamera-abi-dump.xml.in' contains:
> 
> """
> <version>VERSION</version>
> <headers>abi/VERSION/usr/local/include/</headers>
> <libs>abi/VERSION/usr/local/lib/</libs>
> """
> 
> The main issue is storing (or regenerating) previous versions of the ABI
> dump files to compare against.
> 
> The abi-check produces an HTML 'report' which likely needs to be read by
> the caller, or have something scrape for the detail, so there's still a
> lot of manual steps involved for now.

I'm not concerned about the storage of ABI dump files at the moment.
What I'd like to see is the method to test for ABI breakage to be
documented in the source tree, scripted, and automated. The current
meson.build states

# When automatic ABI based detection is used to increment the version, this
# will bump the minor number (x.y).

I'm fine having a semi-manual process to start with, if it is documented
and can be replicated.

> > > provide incremental releases which
> > > can support backwards compatible linkage across release points that have
> > > a compatible ABI.
> > > 
> > > Introduction of this commit does not convey that libcamera now has a
> > > stable API, but that patch releases with a common minor number
> > > (0.minor.patch) may potentially be used by applications without
> > > recompilation and linkage against new releases.
> > > 
> > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > > ---
> > >  meson.build | 10 ++++------
> > >  1 file changed, 4 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 6e363a906c69..4afe7d1624a7 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -56,15 +56,13 @@ if libcamera_version != project_version
> > >      libcamera_git_version += '-nvm'
> > >  endif
> > >  
> > > -# Until we make ABI compatible releases, the full libcamera version is used as
> > > -# the soname. No ABI/API compatibility is guaranteed between releases (x.y.z).
> > > -#
> > > -# When automatic ABI based detection is used to increment the version, this
> > > -# will bump the minor number (x.y).
> > > +# The major and minor libcamera version components are used as the soname.
> > > +# No ABI/API compatibility is guaranteed between releases (x.y).
> > >  #
> > >  # When we declare a stable ABI/API we will provide a 1.0 release and the
> > >  # soversion at that point will be the 'major' release value (x).
> > > -libcamera_soversion = libcamera_version
> > > +semver = libcamera_version.split('.')
> > > +libcamera_soversion = semver[0] + '.' + semver[1]
> > >  
> > >  summary({ 'Sources': libcamera_git_version, }, section : 'Versions')
> > >

Patch
diff mbox series

diff --git a/meson.build b/meson.build
index 6e363a906c69..4afe7d1624a7 100644
--- a/meson.build
+++ b/meson.build
@@ -56,15 +56,13 @@  if libcamera_version != project_version
     libcamera_git_version += '-nvm'
 endif
 
-# Until we make ABI compatible releases, the full libcamera version is used as
-# the soname. No ABI/API compatibility is guaranteed between releases (x.y.z).
-#
-# When automatic ABI based detection is used to increment the version, this
-# will bump the minor number (x.y).
+# The major and minor libcamera version components are used as the soname.
+# No ABI/API compatibility is guaranteed between releases (x.y).
 #
 # When we declare a stable ABI/API we will provide a 1.0 release and the
 # soversion at that point will be the 'major' release value (x).
-libcamera_soversion = libcamera_version
+semver = libcamera_version.split('.')
+libcamera_soversion = semver[0] + '.' + semver[1]
 
 summary({ 'Sources': libcamera_git_version, }, section : 'Versions')