[libcamera-devel] [PATCH] clang-format: Bump minimum version requirements

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Aug 12 14:13:40 CEST 2021


Hello,

On Thu, Aug 12, 2021 at 07:07:24PM +0900, paul.elder at ideasonboard.com wrote:
> On Thu, Aug 12, 2021 at 10:01:26AM +0100, David Plowman wrote:
> > On Thu, 12 Aug 2021 at 09:45, Kieran Bingham wrote:
> > >
> > > The .clang-format file uses CaseSensitive on Regex rules for Include Categories.
> > > Without this, it would not be possible to distinguish between QT headers which
> > > commence with a 'Q' verses system headers including <queue>.
> > >
> > > While we have more wider support for libcamera to run and build on older
> > > platforms, it should be safe to assume that developers who need to run
> > > checkstyle can update their clang-format to a modern version.
> > 
> > Do you know the magic runes to do this? The Pi repositories are stuck
> > on version 9 currently, I believe.
> 
> iirc the raspberry pi repos are compatible with regular debian repos? So
> you add sid to the apt repos:
> 
> /etc/apt/sources.list:
> +deb https://deb.debian.org/debian/ sid main
> +deb-src https://deb.debian.org/debian/ sid main
> 
> And make sure that sid doesn't get used by default (I have it set to
> bullseye) (make sure it doesn't conflict with other preferences settings
> in /etc/apt/preferences.d/) (I think preferences.d is recommended but I
> like all my preferences in one place):
> 
> /etc/apt/preferences:
> Package: *
> Pin: release n=bullseye
> Pin-Priority: 1100
> 
> And then apt update, and apt install clang-format-12.
> update-alternatives doesn't seem to pick it up so you might have to
> relink it manually.
> 
> Not sure if this is best practice for raspberry pi though :/ I'm also
> not sure if this works alongside buster as I'm on bullseye, but it
> doesn't look like clang-format-12 has any conflicting dependencies with
> bullseye, so maybe it's fine on buster too.
> 
> 
> This is why I'm pushing against this patch tbh... it's like saying "it's
> okay because Ubuntu 22.04 has it". But it is a good change... idk what's
> best.

A hard dependency on clang-format >= 12 seems to harsh to me. Can we
make it optional ? One option would be to have multiple configuration
files, or to pass additional options to clang-format on the command line
from checkstyle.py.

> > > clang-format-12 is supported in Ubuntu 20.04 in the updates category,
> > > and in Debian sid. More recent versions of Ubuntu ship with
> > > clang-format-12 or later by default, and other distributions may of
> > > course vary further.
> > >
> > > Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > > ---
> > >  .clang-format | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/.clang-format b/.clang-format
> > > index ff60b928affc..df1421fe94a8 100644
> > > --- a/.clang-format
> > > +++ b/.clang-format
> > > @@ -1,6 +1,6 @@
> > >  # SPDX-License-Identifier: GPL-2.0-only
> > >  #
> > > -# clang-format configuration file. Intended for clang-format >= 7.
> > > +# clang-format configuration file. Intended for clang-format >= 12.
> > >  #
> > >  # For more information, see:
> > >  #

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list