Jump to content

Craft/Blueprints

From KDE Community Wiki

Note

This page is work in progress. Please help to make it more useful!


Adding New Blueprints

Blueprints are stored in separate repositories. At the moment there are these repositories:


To navigate to this repository on your local file system:

cs craft-blueprints-kde

If you want to add a new blueprint first of all you have to choose the right location (e.g. kde apps are located in the kde folder.

Warning

The name of the package folder needs to match the blueprint name. An example would be kdegraphics-mobipocket\kdegraphics-mobipocket.py


Structure

import info

class subinfo(info.infoclass):
    # TODO
    def setDependencies( self ):
        # Defines the blueprints this blueprint depends on
    def setTargets(self):
        # TODO

from Package.CMakePackageBase import * # The package base

class Package(CMakePackageBase):
    # TODO
    def __init__(self):
        # TODO

Dependencies

TODO

Package Base

See https://invent.kde.org/packaging/craft/-/tree/master/bin/Package for available package bases

Howto

Apply Patches

Apply a simple patch

# ...
    def setTargets(self):
        # ...
        # "5.81.0" is the version the patch should be applied
        self.patchToApply["5.81.0"] = [("patch-file.diff", 1)]  # patch file, patch depth (= git apply -p<n> option)
        self.patchLevel["5.81.0"] = 1

It is also possible to do fancy stuff like

# ...
    def setTargets(self):
        # ...
        for ver in ["master"] + self.versionInfo.tarballs():
            self.patchToApply[ver] = [("patch-file.diff", 1)]
            self.patchLevel[ver] = 1

Check for Compiler/OS

If you want to run a command based on the current environment you can use CraftCore.compiler

if CraftCore.compiler.isWindows:
    # do something only on windows
if not CraftCore.compiler.isGCC:
    # don't do something with GCC

Take a look at https://invent.kde.org/packaging/craft/-/blob/master/bin/CraftCompiler.py to see all available options