Add new flags -c and -d for overriding cachedir and database filenames

This commit is contained in:
Eric Torres 2019-03-10 21:04:31 -07:00
parent 86f2f83e4e
commit bc54dd803a
6 changed files with 44 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# Maintainer: Eric Torres <erictorres4@protonmail.com>
pkgname=packaging-scripts
pkgver=1.0.3
pkgver=1.1
pkgrel=1
pkgdesc="A set of helper scripts for handling Arch Linux packages"
arch=('any')

View File

@ -58,6 +58,16 @@ def add_pkgfile(pkgfile, cachedir):
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-c",
"--cachedir",
help="alternative directory to use for moving package"
)
parser.add_argument(
"-d",
"--db-filename",
help="alternative filename for database without extension"
)
parser.add_argument(
"-s",
"--sign",
@ -86,10 +96,15 @@ if __name__ == "__main__":
else:
opts = args.opts
cachedir = os.path.join("/var", "cache", "pacman", repo)
# this assumes that the db file for the repo
# has the same name as that repo
db = os.path.join(cachedir, f"{repo}.{DB_EXT}")
if args.cachedir is not None:
cachedir = args.cachedir
else:
cachedir = os.path.join("/var", "cache", "pacman", repo)
if args.db-filename is not None:
db = os.path.join(cachedir, f"{args.db-filename}.{DB_EXT}")
else:
db = os.path.join(cachedir, f"{repo}.{DB_EXT}")
if args.verbose:
stdout_handler.setLevel(logging.DEBUG)

View File

@ -53,6 +53,16 @@ def del_pkgfile(pkg):
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-c",
"--cachedir",
help="alternative directory to use for moving package"
)
parser.add_argument(
"-d",
"--db-filename",
help="alternative filename for database without extension"
)
parser.add_argument(
"-s",
"--sign",
@ -81,10 +91,15 @@ if __name__ == "__main__":
else:
opts = args.opts
cachedir = os.path.join("/var", "cache", "pacman", repo)
# this assumes that the db file for the repo
# has the same name as that repo
db = os.path.join(cachedir, f"{repo}.{DB_EXT}")
if args.cachedir is not None:
cachedir = args.cachedir
else:
cachedir = os.path.join("/var", "cache", "pacman", repo)
if args.db-filename is not None:
db = os.path.join(cachedir, f"{args.db-filename}.{DB_EXT}")
else:
db = os.path.join(cachedir, f"{repo}.{DB_EXT}")
if args.verbose:
stdout_handler.setLevel(logging.DEBUG)

View File

@ -5,6 +5,8 @@ local arguments
arguments=(
{-h,--help}'[show this help message and exit]'
{-c,--cachedir}'[alternative directory to use for moving package]'
{-d,--db-filename}'[alternative filename for database without extension]'
{-s,--sign}'[sign repository file]'
{-v,--verbose}'[increase script verbosity]'
'*:filename:_files'

View File

@ -6,6 +6,8 @@ local arguments
arguments=(
{-h,--help}'[show this help message and exit]'
{-c,--cachedir}'[alternative directory to use for deleting package]'
{-d,--db-filename}'[alternative filename for database without extension]'
{-s,--sign}'[sign repository file]'
{-v,--verbose}'[increase script verbosity]'
'*:filename:_files'

View File

@ -5,7 +5,7 @@ with open("README.rst", "r") as fh:
setuptools.setup(
name="packaging_scripts",
version="1.0.3",
version="1.1",
author="Eric Russel Torres",
author_email="erictorres4@protonmail.com",
description="A set of helpers for automating borg interaction",