Re: RFE: CMake AutoRequires?

2022-01-31 Thread Kevin Kofler via devel
Fabio Valentini wrote:
> Sure, but is this doable? CMakeLists.txt files are very complex and
> border on a Turing-complete language.

Technically, CMake *is* a Turing-complete language – if and only if you use 
recursive functions.

> Does cmake support passing in "-D foo" options and returning a list of
> dependencies it wants for those options?
> Because otherwise you'd be back to reimplementing a CMake file format
> parser / interpreter just to get the list dependencies you need.

I would suggest just doing a regex grep for find_package(Foo … REQUIRED), 
similar to how the Python autoRequires generator works. Python is also a 
Turing-complete language, and (as I understand it) also allows imports in 
the middle of the code, yet nobody would expect the autoRequires generator 
to do the right thing for:

if some_library_function():
  import foo
  foo.bar()

depending on whether some_library_function() is always true, always false, 
or sometimes either. The semantics would be similar for the CMake 
autoRequires generator. It can always be turned off, filtered, and/or 
missing dependencies manually added. It would still be better than nothing.

Kevin Kofler
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure


Re: RFE: CMake AutoRequires?

2022-01-30 Thread Fabio Valentini
On Sat, Jan 29, 2022 at 12:23 PM Miro Hrončok  wrote:
>
> On 27. 01. 22 4:59, Kevin Kofler via devel wrote:
> > Hi,
> >
> > when working on finally fixing Trojitá to build (it had been FTBFS since
> > F34, so removal was impending), I have noticed that the Akonadi contacts
> > plugin was not getting built because of missing transitive build
> > dependencies:
> > https://bugzilla.redhat.com/show_bug.cgi?id=2046299
> > https://bugzilla.redhat.com/show_bug.cgi?id=2046310
> > https://bugzilla.redhat.com/show_bug.cgi?id=2046574
> >
> > They all have in common that FooConfig.cmake wants the CMake package Bar,
> > but foo-devel does not Require bar-devel. So building against Foo does not
> > work out of the box, only when manually BRing also bar-devel.
> >
> > The thing is, we have had for a while AutoProvides scripts for CMake that
> > automatically let bar-devel Provide cmake(Bar). This is already used in many
> > places. What is missing, though, is corresponding AutoRequires, so that foo-
> > devel automatically Requires: cmake(Bar) if FooConfig.cmake requires Bar.
> >
> > Would it not make sense to add such an AutoRequires script?
>
> Yes!

Sure, but is this doable? CMakeLists.txt files are very complex and
border on a Turing-complete language.
Does cmake support passing in "-D foo" options and returning a list of
dependencies it wants for those options?
Because otherwise you'd be back to reimplementing a CMake file format
parser / interpreter just to get the list dependencies you need.

Fabio
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure


Re: RFE: CMake AutoRequires?

2022-01-29 Thread Miro Hrončok

On 27. 01. 22 4:59, Kevin Kofler via devel wrote:

Hi,

when working on finally fixing Trojitá to build (it had been FTBFS since
F34, so removal was impending), I have noticed that the Akonadi contacts
plugin was not getting built because of missing transitive build
dependencies:
https://bugzilla.redhat.com/show_bug.cgi?id=2046299
https://bugzilla.redhat.com/show_bug.cgi?id=2046310
https://bugzilla.redhat.com/show_bug.cgi?id=2046574

They all have in common that FooConfig.cmake wants the CMake package Bar,
but foo-devel does not Require bar-devel. So building against Foo does not
work out of the box, only when manually BRing also bar-devel.

The thing is, we have had for a while AutoProvides scripts for CMake that
automatically let bar-devel Provide cmake(Bar). This is already used in many
places. What is missing, though, is corresponding AutoRequires, so that foo-
devel automatically Requires: cmake(Bar) if FooConfig.cmake requires Bar.

Would it not make sense to add such an AutoRequires script?


Yes!

--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure


Re: RFE: CMake AutoRequires?

2022-01-28 Thread Kevin Kofler via devel
Dan Čermák wrote:
> There is something like that already in place:
> https://src.fedoraproject.org/rpms/cmake/blob/rawhide/f/cmake.req
> 
> But I guess it does not produce the requires that you expect it should?

That cmake.req script produces only dependencies on cmake-filesystem and 
nothing else. That is entirely unrelated to what I am talking about (though 
I guess the functionality I am asking for would be merged into the existing 
cmake.req for practical reasons).

> Maybe an automatic buildrequires generator would solve your use case
> better?

No. These are transitive dependencies, i.e., they are not listed anywhere in 
the project's CMake file. There are even 2 layers of indirection, i.e.,
Trojitá's CMakeLists.txt requires Foo whose FooConfig.cmake requires Bar 
whose BarConfig.cmake requires Baz,
i.e.,
trojita BuildRequires foo-devel which Requires bar-devel which (should) 
Require(s) baz-devel,
and bar-devel is actually missing the Requires: baz-devel (a runtime 
Requires, not a BuildRequires).

The only BuildRequires involved is the top-level one, and you actually need 
to run cmake with most build dependencies already present to see that it 
indirectly BuildRequires baz-devel. (There is no way a file content scan or 
even a cmake invocation in a minimal chroot will tell you.) So I do not see 
how a BuildRequires generator would help, at all. This is a missing runtime 
Requires from one -devel package to another, hence my request for a runtime 
Requires autogenerator, not a BuildRequires one.

Kevin Kofler
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure


Re: RFE: CMake AutoRequires?

2022-01-27 Thread Dan Čermák
Hi Kevin,

On January 27, 2022 3:59:04 AM UTC, Kevin Kofler via devel 
 wrote:
>Hi,
>
>when working on finally fixing Trojitá to build (it had been FTBFS since 
>F34, so removal was impending), I have noticed that the Akonadi contacts 
>plugin was not getting built because of missing transitive build 
>dependencies:
>https://bugzilla.redhat.com/show_bug.cgi?id=2046299
>https://bugzilla.redhat.com/show_bug.cgi?id=2046310
>https://bugzilla.redhat.com/show_bug.cgi?id=2046574
>
>They all have in common that FooConfig.cmake wants the CMake package Bar, 
>but foo-devel does not Require bar-devel. So building against Foo does not 
>work out of the box, only when manually BRing also bar-devel.
>
>The thing is, we have had for a while AutoProvides scripts for CMake that 
>automatically let bar-devel Provide cmake(Bar). This is already used in many 
>places. What is missing, though, is corresponding AutoRequires, so that foo-
>devel automatically Requires: cmake(Bar) if FooConfig.cmake requires Bar.

There is something like that already in place:
https://src.fedoraproject.org/rpms/cmake/blob/rawhide/f/cmake.req

But I guess it does not produce the requires that you expect it should?

Maybe an automatic buildrequires generator would solve your use case better?


Cheers,

Dan
___
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure