[projects/pld-ftp-admin] pfa-genindex: ruff cleanup
arekm
arekm at pld-linux.org
Tue Oct 20 13:17:27 CEST 2026
commit 0e823b7af918fae7f654eb4f72e63d95a1af8cdb
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Tue Oct 20 12:47:01 2026 +0200
pfa-genindex: ruff cleanup
No functional change.
bin/pfa-genindex | 51 +++++++++++++++++++++++++--------------------------
1 file changed, 25 insertions(+), 26 deletions(-)
---
diff --git a/bin/pfa-genindex b/bin/pfa-genindex
index ddd1ac0..6561708 100755
--- a/bin/pfa-genindex
+++ b/bin/pfa-genindex
@@ -1,10 +1,9 @@
#!/usr/bin/env python3
-# vi: encoding=utf-8 ts=8 sts=4 sw=4 et
-
-from __future__ import print_function
+# vi: ts=8 sts=4 sw=4 et
import argparse
-import sys, os
+import os
+import sys
INDEXES = ('poldek', 'yum')
@@ -55,13 +54,13 @@ freshen = True
# config reads ~/.ftpadmrc on import; parse options first so --help works without it
sys.path.insert(0, os.environ['HOME']+'/pld-ftp-admin/modules')
-from common import checkdir
-from config import ftp_dir,all_ftp_archs
import config
import ftpio
+from common import checkdir
+from config import all_ftp_archs, ftp_dir
if not quiet:
- print("poldek: %s; yum: %s" % (do_poldek, do_yum))
+ print(f"poldek: {do_poldek}; yum: {do_yum}")
for tree in trees:
checkdir(tree)
@@ -74,7 +73,7 @@ for tree in trees:
if ftpio.lock(tree, True):
locked.append(tree)
else:
- print("ERR: %s tree already locked" % tree, file=sys.stderr)
+ print(f"ERR: {tree} tree already locked", file=sys.stderr)
for i in locked:
ftpio.unlock(i)
sys.exit(1)
@@ -85,42 +84,42 @@ os.umask(0o022)
os.nice(19)
if do_poldek:
- poldek = '%s.stat/bin/poldek-new --cachedir=%s/tmp/poldek --conf %s.stat/etc/poldek.conf --mkidxz' % (ftp_dir, home, ftp_dir)
+ poldek = f'{ftp_dir}.stat/bin/poldek-new --cachedir={home}/tmp/poldek --conf {ftp_dir}.stat/etc/poldek.conf --mkidxz'
for tree in trees:
- print('\n-------------------------- %s --------------------------' % tree)
+ print(f'\n-------------------------- {tree} --------------------------')
for arch in all_ftp_archs:
- print('\ngenerate poldek index for %s' % arch)
- print('%s -s %s%s/%s/RPMS/ --mkidxz --mkidx-type pndir' % (poldek, ftp_dir, tree, arch))
- os.system('%s -s %s%s/%s/RPMS/ --mkidxz --mkidx-type pndir' % (poldek, ftp_dir, tree, arch))
+ print(f'\ngenerate poldek index for {arch}')
+ print(f'{poldek} -s {ftp_dir}{tree}/{arch}/RPMS/ --mkidxz --mkidx-type pndir')
+ os.system(f'{poldek} -s {ftp_dir}{tree}/{arch}/RPMS/ --mkidxz --mkidx-type pndir')
if arch != 'noarch' and config.separate_debuginfo:
- os.system('%s -s %s%s/%s/debuginfo/ --mkidxz --mkidx-type pndir' % (poldek, ftp_dir, tree, arch))
+ os.system(f'{poldek} -s {ftp_dir}{tree}/{arch}/debuginfo/ --mkidxz --mkidx-type pndir')
if do_yum:
- os.system('%s cd %s.stat/repodata && git checkout %s HEAD repodata/comps.xml' % ("" if quiet else "set -x;", ftp_dir, "--quiet" if quiet else ""))
- yum = '%s.stat/bin/createrepo_c --database --update --skip-stat --workers=12 --xz --groupfile=%s.stat/repodata/comps.xml' % (ftp_dir, ftp_dir)
- comps_file = '%s.stat/repodata/comps.xml' % ftp_dir
+ os.system(f'{"" if quiet else "set -x;"} cd {ftp_dir}.stat/repodata && git checkout {"--quiet" if quiet else ""} HEAD repodata/comps.xml')
+ yum = f'{ftp_dir}.stat/bin/createrepo_c --database --update --skip-stat --workers=12 --xz --groupfile={ftp_dir}.stat/repodata/comps.xml'
+ comps_file = f'{ftp_dir}.stat/repodata/comps.xml'
createrepo_cache = f'{home}/tmp/createrepo'
# createrepo_c mkdirs only the last component of --cachedir
os.makedirs(createrepo_cache, mode=0o711, exist_ok=True)
for tree in trees:
- print('\n-------------------------- %s --------------------------' % tree)
+ print(f'\n-------------------------- {tree} --------------------------')
cachedir = f'{createrepo_cache}/{tree}'
- treedir = "%s%s" % (ftp_dir, tree)
+ treedir = f"{ftp_dir}{tree}"
for arch in all_ftp_archs:
- print('\ngenerate repodata for %s using createrepo' % arch)
- archdir = "%s/%s" % (treedir, arch)
- poldek_idx = "%s/RPMS/packages.ndir.md" % archdir
- repodata_idx = "%s/RPMS/repodata/repomd.xml" % archdir
+ print(f'\ngenerate repodata for {arch} using createrepo')
+ archdir = f"{treedir}/{arch}"
+ poldek_idx = f"{archdir}/RPMS/packages.ndir.md"
+ repodata_idx = f"{archdir}/RPMS/repodata/repomd.xml"
if freshen and os.path.exists(poldek_idx) and os.path.exists(repodata_idx) \
and not os.path.getmtime(comps_file) > os.path.getmtime(repodata_idx) \
and not os.path.getmtime(poldek_idx) > os.path.getmtime(repodata_idx):
print("repodata indexes already fresh")
continue
- print('%s %s --cachedir=%s-%s %s/RPMS' % ("" if quiet else "time", yum, cachedir, arch, archdir))
- os.system('%s %s --cachedir=%s-%s %s/RPMS' % ("" if quiet else "time", yum, cachedir, arch, archdir))
+ print(f'{"" if quiet else "time"} {yum} --cachedir={cachedir}-{arch} {archdir}/RPMS')
+ os.system(f'{"" if quiet else "time"} {yum} --cachedir={cachedir}-{arch} {archdir}/RPMS')
if arch != 'noarch' and config.separate_debuginfo:
- os.system('%s %s --cachedir=%s-%s %s/debuginfo' % ("" if quiet else "time", yum, cachedir, arch, archdir))
+ os.system(f'{"" if quiet else "time"} {yum} --cachedir={cachedir}-{arch} {archdir}/debuginfo')
for tree in trees:
ftpio.unlock(tree)
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/0e823b7af918fae7f654eb4f72e63d95a1af8cdb
More information about the pld-cvs-commit
mailing list