lint: enforce max line length (MR 2097)

This commit is contained in:
BO41 2021-08-23 08:14:10 +02:00 committed by Oliver Smith
parent 51bfdc9784
commit 77d39ecdf1
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
5 changed files with 17 additions and 23 deletions

View File

@ -27,6 +27,7 @@ def generate(args, pkgname):
channel_cfg = pmb.config.pmaports.read_config_channel(args)
mirrordir = channel_cfg["mirrordir_alpine"]
apkbuild_path = f"{args.work}/chroot_native/{tempdir}/APKBUILD"
apk_name = f"busybox-static-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk"
with open(apkbuild_path, "w", encoding="utf-8") as handle:
apkbuild = f"""\
# Automatically generated aport, do not edit!
@ -58,7 +59,7 @@ def generate(args, pkgname):
package() {{
mkdir -p "$pkgdir/usr/$_target"
cd "$pkgdir/usr/$_target"
tar -xf $srcdir/busybox-static-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk
tar -xf $srcdir/{apk_name}
rm .PKGINFO .SIGN.*
}}
"""

View File

@ -27,6 +27,7 @@ def generate(args, pkgname):
channel_cfg = pmb.config.pmaports.read_config_channel(args)
mirrordir = channel_cfg["mirrordir_alpine"]
apkbuild_path = f"{args.work}/chroot_native/{tempdir}/APKBUILD"
apk_name = f'"$srcdir/grub-efi-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk"'
with open(apkbuild_path, "w", encoding="utf-8") as handle:
apkbuild = f"""\
# Automatically generated aport, do not edit!
@ -48,7 +49,7 @@ def generate(args, pkgname):
package() {{
mkdir -p "$pkgdir"
cd "$pkgdir"
tar -xf "$srcdir/grub-efi-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk"
tar -xf {apk_name}
rm .PKGINFO .SIGN.*
}}
"""

View File

@ -19,7 +19,8 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS\""""
package = """
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir\""""
downstreamkernel_package "$builddir" "$pkgdir" "$_carch\" \\
"$_flavor" "$_outdir\""""
if deviceinfo["bootimg_qcdt"] == "true":
build += """\n
@ -36,9 +37,10 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
elif soc_vendor == "exynos":
codename = "-".join(pkgname.split("-")[2:])
makedepends.append("dtbtool-exynos")
build += f"""
build += """
dtbTool-exynos -o "$_outdir/arch/$_carch/boot"/dt.img \\
$(find "$_outdir/arch/$_carch/boot/dts/" -name *{codename}*.dtb)"""
$(find "$_outdir/arch/$_carch/boot/dts/\""""
build += f" -name *{codename}*.dtb)"
else:
makedepends.append("dtbtool")
build += """

View File

@ -27,6 +27,8 @@ def generate(args, pkgname):
channel_cfg = pmb.config.pmaports.read_config_channel(args)
mirrordir = channel_cfg["mirrordir_alpine"]
apkbuild_path = f"{args.work}/chroot_native/{tempdir}/APKBUILD"
apk_name = f"$srcdir/musl-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk"
apk_dev_name = f"$srcdir/musl-dev-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk"
with open(apkbuild_path, "w", encoding="utf-8") as handle:
apkbuild = f"""\
# Automatically generated aport, do not edit!
@ -63,7 +65,7 @@ def generate(args, pkgname):
cd "$pkgdir/usr/$_target"
# Use 'busybox tar' to avoid 'tar: Child returned status 141'
# on some machines (builds.sr.ht, gitlab-ci). See pmaports#26.
busybox tar -xf $srcdir/musl-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk
busybox tar -xf {apk_name}
rm .PKGINFO .SIGN.*
}}
package_dev() {{
@ -71,11 +73,12 @@ def generate(args, pkgname):
cd "$subpkgdir/usr/$_target"
# Use 'busybox tar' to avoid 'tar: Child returned status 141'
# on some machines (builds.sr.ht, gitlab-ci). See pmaports#26.
busybox tar -xf $srcdir/musl-dev-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk
busybox tar -xf {apk_dev_name}
rm .PKGINFO .SIGN.*
# symlink everything from /usr/$_target/usr/* to /usr/$_target/*
# so the cross-compiler gcc does not fail to build.
# symlink everything from /usr/$_target/usr/*
# to /usr/$_target/* so the cross-compiler gcc does not fail
# to build.
for _dir in include lib; do
mkdir -p "$subpkgdir/usr/$_target/$_dir"
cd "$subpkgdir/usr/$_target/usr/$_dir"

View File

@ -32,7 +32,6 @@ while read -r file; do
done
# Python: flake8
# E501: max line length
# F401: imported, but not used, does not make sense in __init__ files
# E402: module import not on top of file, not possible for testcases
# E722: do not use bare except
@ -40,23 +39,11 @@ cd "$DIR"/..
echo "Test with flake8: *.py"
# Note: omitting a virtualenv if it is here (e.g. gitlab CI)
py_files="$(find . -not -path '*/venv/*' -name '*.py')"
_ignores="E501,E402,E722,W504,W605"
_ignores="E402,E722,W504,W605"
# shellcheck disable=SC2086
$flake8_command --exclude=__init__.py --ignore "$_ignores" $py_files
# shellcheck disable=SC2086
$flake8_command --filename=__init__.py --ignore "F401,$_ignores" $py_files
# Enforce max line length of 79 characters (#1986). We are iteratively fixing
# up the source files to adhere to this rule, so ignore the ones that are not
# yet fixed. Eventually, E501 can be removed from _ignores above, and this
# whole block can be removed.
echo "Test with flake8: *.py (E501)"
exc_files="./pmb/aportgen/busybox_static.py"
exc_files="$exc_files,./pmb/aportgen/grub_efi.py"
exc_files="$exc_files,./pmb/aportgen/linux.py"
exc_files="$exc_files,./pmb/aportgen/musl.py"
# shellcheck disable=SC2086
$flake8_command --select="E501" --exclude=$exc_files $py_files
# Done
echo "Success!"