Bug 426724 - Missing support for adding dependencies to a specific package version
Summary: Missing support for adding dependencies to a specific package version
Status: REPORTED
Alias: None
Product: Craft
Classification: Developer tools
Component: Core (show other bugs)
Version: stable
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Hannah von Reth
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-19 12:36 UTC by Ralf Habacker
Modified: 2024-03-27 19:06 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2020-09-19 12:36:22 UTC
alkimia (https://invent.kde.org/packaging/craft-blueprints-kde/-/blob/master/extragear/libalkimia/libalkimia.py) version 8.x depends on QtWebKit.

I tried to add this dependency (build or runtime or both ?) to the package script specific for version 8.0.3, which seems not to be possible yet, because it would be a dependency for all provided versions. 

Scanning all provided blue prints did not gave me any hint how to do that.
 
Please provide related information or add associated support to craft super build system.
Comment 2 Ralf Habacker 2020-09-22 09:14:09 UTC
(In reply to Hannah von Reth from comment #1)
> The best solution currently is
> https://github.com/owncloud/craft-blueprints-owncloud/blob/master/owncloud/
> owncloud-client/owncloud-client.py#L44

Thanks for pointer. 

A remaining question is in which case 'RuntimeDependencies' or 'BuildDependencies' should be used ?
0
For obs, I usually specify build time dependencies (usually the development package) and runtime dependencies only when needed, as runtime dependencies are resolved at the shared library level by default during installation (use rpm -q --provides and rpm -q --requires).

I assume that craft has no such support and I have to use 'RuntimeDependencies' to install the library package for qt5webkit and 'BuildDependencies' to install the development package ?

Since in the blueprint (own cloud client) mentioned above 'RuntimeDependencies' are used, I assume that this will install the development package when building the package, which have this dependency and the runtime package when installing - is that correct?
Comment 3 Hannah von Reth 2020-09-22 11:09:17 UTC
Hi craft at the moment deploys every runtime dependency, a blacklist can be used to slim down the deployment.

Magically resolving the dependencies is not that easy in a cross platform setup and in the end there are always data files and plugins for which it is hard to decide on what to deploy.

So everything that is needed during runtime should be a runtime dependency.
Cmake and msys are build time dependencies as you never want to deploy them to a users system.

Cheers,
Hannah
Comment 4 Ralf Habacker 2024-03-27 14:01:32 UTC
Hi,
i have a real world example for this: 

Building package kmymoney from master branch depends on using likalkimia from git master branch, so I added  in the craft blueprint for kmymoney 

        if self.buildTarget != "master":
            self.runtimeDependencies["extragear/libalkimia"] = None
        else:
            self.runtimeDependencies["extragear/libalkimia"] = 'master'


After that running 

 craft --target master kmymoney 

still fetches libalkimia from the standard branch and not from the master branch and fails to configure with 

CMake Error at CMakeLists.txt:151 (find_package):
  Could not find a configuration file for package "LibAlkimia5" that is
  compatible with requested version "8.1.72".

  The following configuration files were considered but not accepted:

    /home/user/CraftRoot/lib/cmake/LibAlkimia5-8.1/LibAlkimia5Config.cmake, version: 8.1.2

I need to change the defaultTarget to 'master' in libalkimia.py  as workaround.
Comment 5 Ingo Klöcker 2024-03-27 16:04:28 UTC
Setting
  self.runtimeDependencies["extragear/libalkimia"]
to anything other than None makes no sense. The only thing that's relevant is the keys of the dependencies dict. The values are ignored.

In KDE's GitLab you can request a specific version by setting this version in the .craft.ini file, e.g. add the following to the .craft.ini file in KMyMoney's master branch to request the master version of libalkimia:

```
[BlueprintSettings]
extragear/libalkimia.version=master
```

When you run craft manually you can achieve the same with the command line option `--options extragear/libalkimia.version=master`.
Comment 6 Ralf Habacker 2024-03-27 18:25:46 UTC
(In reply to Ingo Klöcker from comment #5)
> Setting
>   self.runtimeDependencies["extragear/libalkimia"]
> to anything other than None makes no sense. The only thing that's relevant
> is the keys of the dependencies dict. The values are ignored.

Thanks for the clarification. Since some blueprints use such a version

> :~/CraftRoot>find etc/blueprints/locations/ -name '*.py' | xargs grep -Hn runtimeDep | grep -v None
> etc/blueprints/locations/craft-blueprints-kde/libs/qt5/qtbase/qtbase.py:104:            self.runtimeDependencies["libs/openssl"] = "1.1"
> etc/blueprints/locations/craft-blueprints-kde/libs/qt5/qtconnectivity/qtconnectivity.py:27:            self.runtimeDependencies["libs/qt5/qtandroidextras"] = "default"
> etc/blueprints/locations/craft-blueprints-kde/extragear/digikam/digikam.py:56:            self.runtimeDependencies["libs/ffmpeg"] = "4.4"

I thought that should work.
Comment 7 Ingo Klöcker 2024-03-27 19:06:05 UTC
Re-reading the code that evaluates the dependencies, I saw that one can specify a version number to ensure a minimum version of some dependency, but one cannot specify what version of a dependency is used. The selection of the dependency version that's used for a build happens before and independently of the specified version number.
https://invent.kde.org/packaging/craft/-/blob/master/bin/Blueprints/CraftDependencyPackage.py?ref_type=heads#L101