pmb/aportgen/busybox_static.py: use f-string (MR 1949)

This commit is contained in:
Oliver Smith 2020-05-12 21:23:39 +02:00 committed by Alexey Min
parent 143b35408e
commit 9639da22c9
No known key found for this signature in database
GPG Key ID: EBF5ECFFFEE34DED
1 changed files with 14 additions and 16 deletions

View File

@ -44,19 +44,17 @@ def generate(args, pkgname):
# Write the APKBUILD # Write the APKBUILD
pmb.helpers.run.user(args, ["mkdir", "-p", args.work + "/aportgen"]) pmb.helpers.run.user(args, ["mkdir", "-p", args.work + "/aportgen"])
with open(args.work + "/aportgen/APKBUILD", "w", encoding="utf-8") as handle: with open(args.work + "/aportgen/APKBUILD", "w", encoding="utf-8") as handle:
# Variables apkbuild = f"""\
handle.write("# Automatically generated aport, do not edit!\n" # Automatically generated aport, do not edit!
"# Generator: pmbootstrap aportgen " + pkgname + "\n" # Generator: pmbootstrap aportgen {pkgname}
"\n"
"pkgname=" + pkgname + "\n" pkgname={pkgname}
"pkgver=" + pkgver + "\n" pkgver={pkgver}
"pkgrel=" + pkgrel + "\n" pkgrel={pkgrel}
"\n"
"_arch=\"" + arch + "\"\n" _arch="{arch}"
"_mirror=\"" + args.mirror_alpine + "\"\n" _mirror="{args.mirror_alpine}"
)
# Static part
static = """
url="http://busybox.net" url="http://busybox.net"
license="GPL2" license="GPL2"
arch="all" arch="all"
@ -68,14 +66,14 @@ def generate(args, pkgname):
busybox-static-$pkgver-r$pkgrel-$_arch.apk::$_mirror/edge/main/$_arch/busybox-static-$pkgver-r$pkgrel.apk busybox-static-$pkgver-r$pkgrel-$_arch.apk::$_mirror/edge/main/$_arch/busybox-static-$pkgver-r$pkgrel.apk
" "
package() { package() {{
mkdir -p "$pkgdir/usr/$_target" mkdir -p "$pkgdir/usr/$_target"
cd "$pkgdir/usr/$_target" cd "$pkgdir/usr/$_target"
tar -xf $srcdir/busybox-static-$pkgver-r$pkgrel-$_arch.apk tar -xf $srcdir/busybox-static-$pkgver-r$pkgrel-$_arch.apk
rm .PKGINFO .SIGN.* rm .PKGINFO .SIGN.*
} }}
""" """
for line in static.split("\n"): for line in apkbuild.split("\n"):
handle.write(line[12:] + "\n") handle.write(line[12:] + "\n")
# Hashes # Hashes