aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2022-10-25 13:10:14 +0800
committerKunoiSayami <[email protected]>2022-10-25 13:10:14 +0800
commit978011b008721d66b12dd00f6fe552d39f7b4b70 (patch)
tree77a3c3ae87d3c83131a21837efe01ef1729fc642
parent8aa2177d248e0a8d35ceb9355cc1d92f90a85aa0 (diff)
feat(script): Optimize hook and build script
Signed-off-by: KunoiSayami <[email protected]>
-rwxr-xr-xrepo/.hook/ffmpeg-cuda1
-rwxr-xr-xrepo/.hook/glib2-static1
-rwxr-xr-xrepo/.hook/liboping1
-rwxr-xr-xrepo/.hook/trustedqsl2
-rwxr-xr-xrepo/.hook/vlc-luajit1
-rwxr-xr-xrepo/.hook/wxgtk2.84
-rwxr-xr-xutils/ng/pkgbuild.py15
7 files changed, 19 insertions, 6 deletions
diff --git a/repo/.hook/ffmpeg-cuda b/repo/.hook/ffmpeg-cuda
index 6871a1d..4c0b6e5 100755
--- a/repo/.hook/ffmpeg-cuda
+++ b/repo/.hook/ffmpeg-cuda
@@ -1,3 +1,4 @@
#!/bin/bash
+grep "make -j" PKGBUILD && exit
sed -i 's/make$/make -j \$\(nproc\)\n/g' PKGBUILD
sed -i 's/make /make -j \$\(nproc\) /g' PKGBUILD \ No newline at end of file
diff --git a/repo/.hook/glib2-static b/repo/.hook/glib2-static
index 2d298de..2eff0cc 100755
--- a/repo/.hook/glib2-static
+++ b/repo/.hook/glib2-static
@@ -1,4 +1,5 @@
#!/bin/bash
[ ! -r /var/lib/dbus/machine-id ] && dbus-uuidgen | sudo tee /var/lib/dbus/machine-id
+grep "Dinternal_pcre" PKGBUILD || exit
sed -i 's/gtk_doc=false \\/gtk_doc=false/g' PKGBUILD
sed -i 's/-Dinternal_pcre=false//g' PKGBUILD
diff --git a/repo/.hook/liboping b/repo/.hook/liboping
index d2db51d..45859b0 100755
--- a/repo/.hook/liboping
+++ b/repo/.hook/liboping
@@ -1,4 +1,5 @@
#!/bin/bash
+grep "ed44510859a300ea49331924db0" PKGBUILD && exit
cat << EOF | base64 -d > 61.patch
ZGlmZiAtLWdpdCBhL3NyYy9vcGluZy5jIGIvc3JjL29waW5nLmMKaW5kZXggODdjYTgxYS4uMjY4
NDA4OCAxMDA2NDQKLS0tIGEvc3JjL29waW5nLmMKKysrIGIvc3JjL29waW5nLmMKQEAgLTExMjgs
diff --git a/repo/.hook/trustedqsl b/repo/.hook/trustedqsl
index 31951e3..b4a47f5 100755
--- a/repo/.hook/trustedqsl
+++ b/repo/.hook/trustedqsl
@@ -1,5 +1,5 @@
#!/bin/bash
-grep 'archlinuxcn' /etc/pacman.conf || exit
+grep 'archlinuxcn' /etc/pacman.conf && exit
echo '' | sudo tee -a /etc/pacman.conf >/dev/null
echo 'W2FyY2hsaW51eGNuXQpTZXJ2ZXIgPSBodHRwczovL3JlcG8uYXJjaGxpbnV4Y24ub3JnLyRhcmNoCgo=' | base64 -d | sudo tee -a /etc/pacman.conf
sudo pacman --needed --noconfirm -Sy archlinuxcn-keyring \ No newline at end of file
diff --git a/repo/.hook/vlc-luajit b/repo/.hook/vlc-luajit
index 51e626c..9b65323 100755
--- a/repo/.hook/vlc-luajit
+++ b/repo/.hook/vlc-luajit
@@ -1,4 +1,5 @@
#!/bin/bash
+grep "make -j" PKGBUILD && exit
sed -i 's/make$/make -j \$\(nproc\)\n/g' PKGBUILD
sed -i 's/make DESTDIR/make -j \$\(nproc\) DESTDIR/g' PKGBUILD
sed -i '/--enable-aribcam \\/d' PKGBUILD
diff --git a/repo/.hook/wxgtk2.8 b/repo/.hook/wxgtk2.8
index 74d1f01..b4a47f5 100755
--- a/repo/.hook/wxgtk2.8
+++ b/repo/.hook/wxgtk2.8
@@ -1,5 +1,5 @@
#!/bin/bash
-grep 'archlinuxcn' /etc/pacman.conf || exit
+grep 'archlinuxcn' /etc/pacman.conf && exit
echo '' | sudo tee -a /etc/pacman.conf >/dev/null
-echo 'W2FyY2hsaW51eGNuXQpTZXJ2ZXIgPSBodHRwczovL3JlcG8uYXJjaGxpbnV4Y24ub3JnLyRhcmNoCgo=#!/bin/bash' | base64 -d | sudo tee -a /etc/pacman.conf
+echo 'W2FyY2hsaW51eGNuXQpTZXJ2ZXIgPSBodHRwczovL3JlcG8uYXJjaGxpbnV4Y24ub3JnLyRhcmNoCgo=' | base64 -d | sudo tee -a /etc/pacman.conf
sudo pacman --needed --noconfirm -Sy archlinuxcn-keyring \ No newline at end of file
diff --git a/utils/ng/pkgbuild.py b/utils/ng/pkgbuild.py
index 507d79c..8be755a 100755
--- a/utils/ng/pkgbuild.py
+++ b/utils/ng/pkgbuild.py
@@ -345,6 +345,7 @@ async def do_build(target: PackageVersionWithPath) -> int:
if build_ret != 0:
if build_ret == 13:
logger.warning("Already build %s, skipped.", base_dir_name)
+ return 0
FAIL_REPOS.append(base_dir_name)
logger.warning("Build %s fail: %d", base_dir_name, build_ret)
@@ -353,7 +354,10 @@ async def do_build(target: PackageVersionWithPath) -> int:
async def clean_installed_packages() -> int:
p = await asyncio.create_subprocess_exec(
- "/bin/bash", "-c", "sudo pacman --noconfirm -Rcns $(pacman -Qdtq)", stdout=None
+ "/bin/bash", "-c",
+ "PKGS=$(pacman -Qdtq | tr '\n' ' '); "
+ "if [ -n \"$PKGS\" ]; then echo $PKGS | xargs sudo pacman --noconfirm -Rcns ; fi",
+ stdout=None
)
await p.wait()
return p.returncode
@@ -408,10 +412,15 @@ async def do_work(
if not target.arch:
logger.info("Skipped %s (Architecture not match)", target.name)
continue
- if (await do_build(target)) != 0 and fail_fast:
- break
+ if (await do_build(target)) != 0:
+ if fail_fast:
+ break
+ else:
+ await asyncio.sleep(5)
if run_auto_remove:
await clean_installed_packages()
+ for _ in range(3):
+ logger.debug("---------------------------------------------------------")
if (src_dst := pathlib.Path(BUILD_ENVS.src_dest).resolve()).is_dir():
shutil.rmtree(str(src_dst), ignore_errors=True)