diff options
| author | KunoiSayami <[email protected]> | 2023-09-17 19:17:03 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2023-09-17 19:17:03 +0800 |
| commit | 35b38c50f9a8f0edc786265b6c21d7cf1da18666 (patch) | |
| tree | 723c03144fc5c1ba81df686e1c903179bb61bf2c | |
| parent | a124e7d9b4528571819b87de99d47e274b66d3e2 (diff) | |
feat(script): Support proxy for upload
* fix(pkg): Fix liboping build
Signed-off-by: KunoiSayami <[email protected]>
| -rwxr-xr-x | docker/dockerbuild.sh | 7 | ||||
| -rw-r--r-- | docker/dockerfile | 2 | ||||
| -rwxr-xr-x | repo/.hook/cinny | 6 | ||||
| -rwxr-xr-x | repo/.hook/liboping | 2 | ||||
| -rwxr-xr-x | utils/upload.py | 9 |
5 files changed, 20 insertions, 6 deletions
diff --git a/docker/dockerbuild.sh b/docker/dockerbuild.sh index 650c1db..ffdc875 100755 --- a/docker/dockerbuild.sh +++ b/docker/dockerbuild.sh @@ -4,7 +4,12 @@ set -Eeuo pipefail sudo pacman -Sy cd /home/build -if [ ! -d repos ] || [ "$(ls -A repos)" ]; then + +if [ -f ./hook-run.sh ]; then + . ./hook-run.sh +fi + +if [ ! -d repos ]; then git clone --depth=3 https://github.com/kunoisayami/repos diff --git a/docker/dockerfile b/docker/dockerfile index dcef1bb..5c3e635 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -28,7 +28,7 @@ RUN pacman --noconfirm --needed -Sy archlinux-keyring RUN pacman --noconfirm --needed -Su base-devel gnupg git yay -RUN pacman --noconfirm --needed -S python python-aiohttp python-aiofiles moreutils +RUN pacman --noconfirm --needed -S python python-aiohttp python-aiofiles python-aiohttp-socks moreutils RUN echo 'build ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers diff --git a/repo/.hook/cinny b/repo/.hook/cinny index 9d82b08..46b8c7b 100755 --- a/repo/.hook/cinny +++ b/repo/.hook/cinny @@ -1,5 +1,5 @@ #!/bin/bash -if [ -v http_proxy ]; then - sed -i "/build\(\)/a npm config set proxy socks5:\/\/$http_proxy" PKGBUILD - sed -i "/build\(\)/a npm config set https-proxy socks5:\/\/$http_proxy" PKGBUILD +if [ -v ALL_PROXY ]; then + sed -i "/build\(\)/a npm config set proxy $ALL_PROXY" PKGBUILD + sed -i "/build\(\)/a npm config set https-proxy $ALL_PROXY" PKGBUILD fi
\ No newline at end of file diff --git a/repo/.hook/liboping b/repo/.hook/liboping index 45859b0..cac2010 100755 --- a/repo/.hook/liboping +++ b/repo/.hook/liboping @@ -1,4 +1,6 @@ #!/bin/bash +exit + grep "ed44510859a300ea49331924db0" PKGBUILD && exit cat << EOF | base64 -d > 61.patch ZGlmZiAtLWdpdCBhL3NyYy9vcGluZy5jIGIvc3JjL29waW5nLmMKaW5kZXggODdjYTgxYS4uMjY4 diff --git a/utils/upload.py b/utils/upload.py index d3605cf..2fabd7c 100755 --- a/utils/upload.py +++ b/utils/upload.py @@ -5,6 +5,7 @@ import logging import os import aiohttp +import aiohttp_socks logger = logging.getLogger() logger.setLevel(logging.DEBUG) @@ -47,8 +48,14 @@ async def main(args: argparse.Namespace) -> int: logger.info("Could not find any packaged packages, skip upload") return 0 + if proxy := os.getenv("http_proxy"): + logger.debug("Using proxy %s", proxy) + proxies = aiohttp_socks.ProxyConnector.from_url(proxy, rdns=False) + else: + proxies = None + async with aiohttp.ClientSession( - raise_for_status=True, timeout=aiohttp.ClientTimeout(30) + raise_for_status=True, timeout=aiohttp.ClientTimeout(30), connector=proxies ) as session: async with session.post( args.remote_address, data=build_data(args, "REQUIRE_CLEAN") |
