Skip to content

Commit

Permalink
cbuild, main, contrib: use black to format the source code
Browse files Browse the repository at this point in the history
Black's formatting style is the closest to ours out of box,
and while it is not 100% ideal (I still don't really like
functions separated by two newlines), it's an easy and well
defined baseline for people to follow.
  • Loading branch information
q66 committed May 24, 2023
1 parent c7c0fbe commit ca04a1c
Show file tree
Hide file tree
Showing 988 changed files with 12,281 additions and 4,647 deletions.
8 changes: 8 additions & 0 deletions Packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ be made for `contrib` (such as when the software is high profile and the
latest stable release is very old and provides worse user experience) but
not for `main`.

<a id="correct_style"></a>
### Correct Style

The `cbuild` system as well as the templates are formatted with
[Black](https://black.readthedocs.io/en/stable/). Therefore, when writing
either template or `cbuild` code, make sure the result remains unchanged
after re-formatting.

<a id="correct_templates"></a>
### Writing Correct Templates

Expand Down
10 changes: 6 additions & 4 deletions contrib/amtk/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
build_style = "meson"
configure_args = ["-Dgtk_doc=false"]
hostmakedepends = [
"meson", "pkgconf", "gobject-introspection", "glib-devel",
"meson",
"pkgconf",
"gobject-introspection",
"glib-devel",
"gettext-tiny",
]
makedepends = [
"glib-devel", "gtk+3-devel"
]
makedepends = ["glib-devel", "gtk+3-devel"]
pkgdesc = "Actions, Menus and Toolbars Kit for GTK+ applications"
maintainer = "q66 <q66@chimera-linux.org>"
license = "LGPL-2.1-or-later"
url = "https://gitlab.gnome.org/World/amtk"
source = f"$(GNOME_SITE)/{pkgname}/{pkgver[:-2]}/{pkgname}-{pkgver}.tar.xz"
sha256 = "d50115b85c872aac296934b5ee726a3fa156c6f5ad96d27e0edd0aa5ad173228"


@subpackage("amtk-devel")
def _devel(self):
return self.default_devel()
24 changes: 19 additions & 5 deletions contrib/atf-rk3399-bl31/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,34 @@
# not relevant
options = ["!strip", "!check", "!lto", "!debug", "execstack"]


def do_build(self):
# we undef all the stuff cbuild automatically sets,
# and always "cross compile" with our bare metal toolchain
self.do(
"env", "-u", "CFLAGS", "-u", "LDFLAGS",
"-u", "CPPFLAGS", "-u", "CXXFLAGS", "--",
"gmake", f"-j{self.make_jobs}", "PLAT=rk3399",
"bl31", "CROSS_COMPILE=aarch64-none-elf-",
"env",
"-u",
"CFLAGS",
"-u",
"LDFLAGS",
"-u",
"CPPFLAGS",
"-u",
"CXXFLAGS",
"--",
"gmake",
f"-j{self.make_jobs}",
"PLAT=rk3399",
"bl31",
"CROSS_COMPILE=aarch64-none-elf-",
"CC=aarch64-none-elf-gcc",
)


def do_install(self):
self.install_file(
"build/rk3399/release/bl31/bl31.elf",
"usr/lib/trusted-firmware-a/rk3399", mode = 0o755
"usr/lib/trusted-firmware-a/rk3399",
mode=0o755,
)
self.install_license("docs/license.rst")
13 changes: 9 additions & 4 deletions contrib/atkmm1.6/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
build_style = "meson"
hostmakedepends = ["meson", "pkgconf"]
makedepends = [
"at-spi2-core-devel", "glibmm2.4-devel", "libsigc++2-devel",
"at-spi2-core-devel",
"glibmm2.4-devel",
"libsigc++2-devel",
]
pkgdesc = "C++ accessibility interface bindings (2.28)"
maintainer = "q66 <q66@chimera-linux.org>"
Expand All @@ -13,8 +15,11 @@
source = f"$(GNOME_SITE)/atkmm/{pkgver[:-2]}/atkmm-{pkgver}.tar.xz"
sha256 = "7c2088b486a909be8da2b18304e56c5f90884d1343c8da7367ea5cd3258b9969"


@subpackage("atkmm1.6-devel")
def _devel(self):
return self.default_devel(extra = [
"usr/lib/atkmm-1.6",
])
return self.default_devel(
extra=[
"usr/lib/atkmm-1.6",
]
)
7 changes: 5 additions & 2 deletions contrib/base-pbp/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
pkgrel = 0
archs = ["aarch64"]
depends = [
"firmware-ap6256", "firmware-linux-rockchip",
"u-boot-pinebook-pro-rk3399", "u-boot-menu",
"firmware-ap6256",
"firmware-linux-rockchip",
"u-boot-pinebook-pro-rk3399",
"u-boot-menu",
]
pkgdesc = "Chimera base package for Pinebook Pro"
maintainer = "q66 <q66@chimera-linux.org>"
license = "custom:none"
url = "https://chimera-linux.org"


def do_install(self):
self.install_file(
self.files_path / "60-pinebookpro.rules", "usr/lib/udev/rules.d"
Expand Down
1 change: 1 addition & 0 deletions contrib/base-reform-imx8mq/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
license = "custom:none"
url = "https://chimera-linux.org"


def do_install(self):
# u-boot-menu
self.install_file(self.files_path / "u-boot-device", "etc/default")
Expand Down
7 changes: 5 additions & 2 deletions contrib/base-rockpro64/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
pkgrel = 0
archs = ["aarch64"]
depends = [
"firmware-ap6256", "firmware-linux-rockchip",
"u-boot-rockpro64-rk3399", "u-boot-menu",
"firmware-ap6256",
"firmware-linux-rockchip",
"u-boot-rockpro64-rk3399",
"u-boot-menu",
]
pkgdesc = "Chimera base package for RockPro64"
maintainer = "q66 <q66@chimera-linux.org>"
license = "custom:none"
url = "https://chimera-linux.org"


def do_install(self):
# u-boot-menu
self.install_file(self.files_path / "u-boot-device", "etc/default")
Expand Down
1 change: 1 addition & 0 deletions contrib/base-unmatched/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
license = "custom:none"
url = "https://chimera-linux.org"


def do_install(self):
# u-boot-menu
self.install_file(self.files_path / "u-boot-device", "etc/default")
Expand Down
4 changes: 3 additions & 1 deletion contrib/binutils-aarch64-none-elf/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
f"--with-build-sysroot={self.profile().sysroot}",
]


def post_install(self):
# fix up hardlinks
for f in (self.destdir / f"usr/{_trip}/bin").iterdir():
Expand All @@ -57,6 +58,7 @@ def post_install(self):
self.rm(self.destdir / f"usr/{_trip}/bin/ld")
self.install_link("ld.bfd", f"usr/{_trip}/bin/ld")
# remove unnecessary dupe
self.rm(self.destdir / "usr/lib", recursive = True)
self.rm(self.destdir / "usr/lib", recursive=True)


configure_gen = []
4 changes: 3 additions & 1 deletion contrib/binutils-arm-none-eabi/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
f"--with-build-sysroot={self.profile().sysroot}",
]


def post_install(self):
# fix up hardlinks
for f in (self.destdir / f"usr/{_trip}/bin").iterdir():
Expand All @@ -57,6 +58,7 @@ def post_install(self):
self.rm(self.destdir / f"usr/{_trip}/bin/ld")
self.install_link("ld.bfd", f"usr/{_trip}/bin/ld")
# remove unnecessary dupe
self.rm(self.destdir / "usr/lib", recursive = True)
self.rm(self.destdir / "usr/lib", recursive=True)


configure_gen = []
4 changes: 3 additions & 1 deletion contrib/binutils-riscv64-unknown-elf/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
f"--with-build-sysroot={self.profile().sysroot}",
]


def post_install(self):
# fix up hardlinks
for f in (self.destdir / f"usr/{_trip}/bin").iterdir():
Expand All @@ -57,6 +58,7 @@ def post_install(self):
self.rm(self.destdir / f"usr/{_trip}/bin/ld")
self.install_link("ld.bfd", f"usr/{_trip}/bin/ld")
# remove unnecessary dupe
self.rm(self.destdir / "usr/lib", recursive = True)
self.rm(self.destdir / "usr/lib", recursive=True)


configure_gen = []
9 changes: 6 additions & 3 deletions contrib/cairomm1.0/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
source = f"http://cairographics.org/releases/cairomm-{pkgver}.tar.xz"
sha256 = "4749d25a2b2ef67cc0c014caaf5c87fa46792fc4b3ede186fb0fc932d2055158"


@subpackage("cairomm1.0-devel")
def _devel(self):
return self.default_devel(extra = [
"usr/lib/cairomm-1.0",
])
return self.default_devel(
extra=[
"usr/lib/cairomm-1.0",
]
)
1 change: 1 addition & 0 deletions contrib/clinfo/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# no tests available
options = ["!check"]


def do_install(self):
self.install_bin("clinfo")
self.install_man("man1/clinfo.1")
7 changes: 5 additions & 2 deletions contrib/crispy-doom/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
build_style = "gnu_configure"
hostmakedepends = ["automake", "pkgconf"]
makedepends = [
"sdl-devel", "sdl_mixer-devel", "sdl_net-devel",
"libsamplerate-devel", "libpng-devel"
"sdl-devel",
"sdl_mixer-devel",
"sdl_net-devel",
"libsamplerate-devel",
"libpng-devel",
]
pkgdesc = "Limit-removing enhanced-resolution Doom source port"
maintainer = "q66 <q66@chimera-linux.org>"
Expand Down
9 changes: 7 additions & 2 deletions contrib/dbus-glib/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
pkgrel = 0
build_style = "gnu_configure"
configure_args = [
"--disable-static", "--disable-bash-completion",
"--disable-static",
"--disable-bash-completion",
]
make_cmd = "gmake"
hostmakedepends = ["pkgconf", "gmake"]
Expand All @@ -14,12 +15,16 @@
maintainer = "q66 <q66@chimera-linux.org>"
license = "GPL-2.0-or-later"
url = "https://www.freedesktop.org/wiki/Software/DBusBindings"
source = f"http://dbus.freedesktop.org/releases/{pkgname}/{pkgname}-{pkgver}.tar.gz"
source = (
f"http://dbus.freedesktop.org/releases/{pkgname}/{pkgname}-{pkgver}.tar.gz"
)
sha256 = "7d550dccdfcd286e33895501829ed971eeb65c614e73aadb4a08aeef719b143a"
options = ["!cross"]


@subpackage("dbus-glib-devel")
def _devel(self):
return self.default_devel()


configure_gen = []
34 changes: 19 additions & 15 deletions contrib/deluge/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
pkgver = "2.1.1"
pkgrel = 0
build_style = "python_module"
hostmakedepends = [
"python-setuptools", "python-wheel", "intltool"
]
hostmakedepends = ["python-setuptools", "python-wheel", "intltool"]
depends = [
"python-setuptools", "python-chardet", "python-mako", "python-openssl",
"python-pillow", "python-pyasn1", "python-pyxdg", "python-rencode",
"python-setproctitle", "python-six", "python-twisted",
"python-zope.interface", "libtorrent-rasterbar-python",
"python-setuptools",
"python-chardet",
"python-mako",
"python-openssl",
"python-pillow",
"python-pyasn1",
"python-pyxdg",
"python-rencode",
"python-setproctitle",
"python-six",
"python-twisted",
"python-zope.interface",
"libtorrent-rasterbar-python",
]
pkgdesc = "Portable BitTorrent client"
maintainer = "q66 <q66@chimera-linux.org>"
Expand All @@ -26,21 +33,17 @@
# unpackaged checkdepends
options = ["!check"]

system_users = [
{
"name": "_deluge",
"id": None,
"home": "/var/lib/deluge"
}
]
system_users = [{"name": "_deluge", "id": None, "home": "/var/lib/deluge"}]


def post_install(self):
# homedir structure, pin it in place
self.install_dir("var/lib/deluge/.config/deluge", empty = True)
self.install_dir("var/lib/deluge/.config/deluge", empty=True)
# default services
self.install_service(self.files_path / "deluged")
self.install_service(self.files_path / "deluge-web")


@subpackage("deluge-gtk")
def _gtk(self):
self.pkgdesc = f"{pkgdesc} (Gtk+3 frontend)"
Expand All @@ -58,6 +61,7 @@ def _gtk(self):
"usr/share/man/man1/deluge-gtk.1",
]


@subpackage("deluge-web")
def _web(self):
self.pkgdesc = f"{pkgdesc} (Web frontend)"
Expand Down
2 changes: 2 additions & 0 deletions contrib/double-conversion/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
source = f"{url}/archive/v{pkgver}.tar.gz"
sha256 = "e40d236343cad807e83d192265f139481c51fc83a1c49e406ac6ce0a0ba7cd35"


def post_install(self):
self.install_license("LICENSE")


@subpackage("double-conversion-devel")
def _devel(self):
return self.default_devel()

0 comments on commit ca04a1c

Please sign in to comment.