fix long lines (E501) in pmb/build (MR 2050)

This commit is contained in:
Caio Fontes 2021-04-26 23:56:42 -03:00
parent 2b620a0fdd
commit 5144195091
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
5 changed files with 24 additions and 14 deletions

View File

@ -104,7 +104,8 @@ def get_depends(args, apkbuild):
ret = sorted(set(ret))
# Don't recurse forever when a package depends on itself (#948)
for pkgname in [apkbuild["pkgname"]] + list(apkbuild["subpackages"].keys()):
for pkgname in ([apkbuild["pkgname"]] +
list(apkbuild["subpackages"].keys())):
if pkgname in ret:
logging.verbose(apkbuild["pkgname"] + ": ignoring dependency on"
" itself: " + pkgname)
@ -137,7 +138,8 @@ def build_depends(args, apkbuild, arch, strict):
" it was started with --no-depends.")
# Check if binary package is outdated
apkbuild_dep = get_apkbuild(args, depend, arch)
if apkbuild_dep and pmb.build.is_necessary(args, arch, apkbuild_dep):
if apkbuild_dep and \
pmb.build.is_necessary(args, arch, apkbuild_dep):
raise RuntimeError(f"Binary package for dependency '{depend}'"
f" of '{pkgname}' is outdated, but"
f" pmbootstrap won't build any depends"
@ -399,7 +401,7 @@ def run_abuild(args, apkbuild, arch, strict=False, force=False, cross=None,
env["CC"] = hostspec + "-gcc"
if cross == "distcc":
env["CCACHE_PREFIX"] = "distcc"
env["CCACHE_PATH"] = "/usr/lib/arch-bin-masquerade/" + arch + ":/usr/bin"
env["CCACHE_PATH"] = f"/usr/lib/arch-bin-masquerade/{arch}:/usr/bin"
env["CCACHE_COMPILERCHECK"] = "string:" + get_gcc_version(args, arch)
env["DISTCC_HOSTS"] = "@127.0.0.1:/home/pmos/.distcc-sshd/distccd"
env["DISTCC_SSH"] = ("ssh -o StrictHostKeyChecking=no -p" +

View File

@ -180,7 +180,8 @@ def package_kernel(args):
suffix = pmb.build.autodetect.suffix(args, apkbuild, arch)
# Install package dependencies
depends, _ = pmb.build._package.build_depends(args, apkbuild, args.arch_native, strict=False)
depends, _ = pmb.build._package.build_depends(
args, apkbuild, args.arch_native, strict=False)
pmb.build.init(args, suffix)
pmb.chroot.apk.install(args, depends, suffix)

View File

@ -45,8 +45,9 @@ def init(args, suffix="native"):
with open(chroot + "/tmp/gzip_wrapper.sh", "w") as handle:
content = """
#!/bin/sh
# Simple wrapper, that converts -9 flag for gzip to -1 for speed
# improvement with abuild. FIXME: upstream to abuild with a flag!
# Simple wrapper, that converts -9 flag for gzip to -1 for
# speed improvement with abuild. FIXME: upstream to abuild
# with a flag!
args=""
for arg in "$@"; do
[ "$arg" == "-9" ] && arg="-1"
@ -58,8 +59,8 @@ def init(args, suffix="native"):
for i in range(len(lines)):
lines[i] = lines[i][16:]
handle.write("\n".join(lines))
pmb.chroot.root(args, ["cp", "/tmp/gzip_wrapper.sh", "/usr/local/bin/gzip"],
suffix)
pmb.chroot.root(args, ["cp", "/tmp/gzip_wrapper.sh",
"/usr/local/bin/gzip"], suffix)
pmb.chroot.root(args, ["chmod", "+x", "/usr/local/bin/gzip"], suffix)
# Add user to group abuild

View File

@ -75,8 +75,8 @@ def is_necessary(args, arch, apkbuild, indexes=None):
# b) Aports folder has a newer version
if version_new != version_old:
logging.debug(msg + "Binary package out of date (binary: " + version_old +
", aport: " + version_new + ")")
logging.debug(f"{msg}Binary package out of date (binary: "
f"{version_old}, aport: {version_new})")
return True
# Aports and binary repo have the same version.
@ -134,11 +134,13 @@ def configure_abuild(args, suffix, verify=False):
continue
if line != (prefix + args.jobs + "\n"):
if verify:
raise RuntimeError("Failed to configure abuild: " + path +
"\nTry to delete the file (or zap the chroot).")
raise RuntimeError(f"Failed to configure abuild: {path}"
"\nTry to delete the file"
"(or zap the chroot).")
pmb.chroot.root(args, ["sed", "-i", "-e",
"s/^" + prefix + ".*/" + prefix + args.jobs + "/",
"/etc/abuild.conf"], suffix)
f"s/^{prefix}.*/{prefix}{args.jobs}/",
"/etc/abuild.conf"],
suffix)
configure_abuild(args, suffix, True)
return
raise RuntimeError("Could not find " + prefix + " line in " + path)

View File

@ -55,10 +55,14 @@ py_files="
.gitlab/check_mr_settings.py
pmb/aportgen/device.py
pmb/build/__init__.py
pmb/build/_package.py
pmb/build/autodetect.py
pmb/build/checksum.py
pmb/build/envkernel.py
pmb/build/init.py
pmb/build/menuconfig.py
pmb/build/newapkbuild.py
pmb/build/other.py
pmb/chroot/__init__.py
pmb/chroot/apk.py
pmb/chroot/apk_static.py