aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author67au <[email protected]>2021-12-11 16:07:41 +0800
committerKunoi Sayami <[email protected]>2021-12-11 18:42:40 +0800
commit8cabf83ceb35cf34c108cf7f878bcd3018a77208 (patch)
treef5bf616c322a7b5c73bb9ded502255dd491b748a
parentdcbf7ce789edce4042c674ab71fa89a25141084b (diff)
feat(script): add parse-pkgbuild.sh and minor changes
Signed-off-by: 67au <[email protected]>
-rwxr-xr-x[-rw-r--r--]utils/aur/check-aur-update.py16
-rw-r--r--utils/parse-pkgbuild.sh8
2 files changed, 16 insertions, 8 deletions
diff --git a/utils/aur/check-aur-update.py b/utils/aur/check-aur-update.py
index 85f02c2..4385eeb 100644..100755
--- a/utils/aur/check-aur-update.py
+++ b/utils/aur/check-aur-update.py
@@ -35,15 +35,15 @@ async def check_aur_update(
f'{str(pkgbuild_file)}',
stdout=asyncio.subprocess.PIPE,
)
- async with aiofiles.open(srcinfo_file, 'w') as f:
- await f.write((await proc.stdout.read()).decode())
- logging.info(f'extract .SRCINFO in {str(item)}')
+ srcinfo = SRCINFO.parse((await proc.stdout.read()).decode())
+ logging.info(f'extract .SRCINFO from {srcinfo.pkgbase}')
else:
logging.warning(f'.SRCINFO not in {str(item)}, no tool to parse')
return
- async with aiofiles.open(srcinfo_file, 'r') as f:
- srcinfo = SRCINFO.parse(await f.read())
- version = srcinfo.get_version()
+ else:
+ async with aiofiles.open(srcinfo_file, 'r') as f:
+ srcinfo = SRCINFO.parse(await f.read())
+ version = srcinfo.get_version()
async with session.get(f'https://aur.archlinux.org/cgit/aur.git/plain/.SRCINFO?h={srcinfo.pkgbase}') as resp:
if resp.status != 200:
logging.info(f'{item.name} not register in AUR')
@@ -53,7 +53,7 @@ async def check_aur_update(
if result == 0:
return
elif result < 0:
- logging.warning(f'Warning: {version} is newer than AUR')
+ logging.warning(f'Warning: {item.name}({version}) is newer than AUR')
else:
if item.joinpath('.git').exists():
if not dry_run:
@@ -70,7 +70,7 @@ async def with_sem(sem: asyncio.Semaphore, coro: Coroutine):
async def main() -> int:
parser = argparse.ArgumentParser(description='aur-check-update.py')
- parser.add_argument('--dry', help='dry run', action='store_true')
+ parser.add_argument('--dry-run', dest='dry', help='dry run', action='store_true')
parser.add_argument('--parse-pkgbuild', dest='script', metavar='SCRIPT',
help='a script to parse pkgbuild',
action='store')
diff --git a/utils/parse-pkgbuild.sh b/utils/parse-pkgbuild.sh
new file mode 100644
index 0000000..c0da48a
--- /dev/null
+++ b/utils/parse-pkgbuild.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# no makepkg version
+# https://github.com/archlinuxcn/repo/blob/master/parse-pkgbuild
+
+pushd $(dirname $@) > /dev/null
+makepkg --printsrcinfo
+popd > /dev/null