Allow specifying temp dir in pungi-gather

That fix invalid cross-device link when hardlinking when /tmp is a
separate filesystem

Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
This commit is contained in:
Frédéric Pierret (fepitre) 2019-12-03 09:48:54 +01:00 committed by Lubomír Sedlář
parent ea2cd448a0
commit fa8b2094da

View File

@ -71,13 +71,16 @@ def get_parser():
metavar="[METHOD]", metavar="[METHOD]",
action="append", action="append",
) )
group.add_argument(
"--tempdir",
metavar="PATH",
help="path to temp dir (default: /tmp)",
default="/tmp",
)
return parser return parser
def main(persistdir, cachedir): def main(ns, persistdir, cachedir):
parser = get_parser()
ns = parser.parse_args()
dnf_conf = Conf(ns.arch) dnf_conf = Conf(ns.arch)
dnf_conf.persistdir = persistdir dnf_conf.persistdir = persistdir
dnf_conf.cachedir = cachedir dnf_conf.cachedir = cachedir
@ -174,6 +177,9 @@ def print_rpms(gather_obj):
if __name__ == "__main__": if __name__ == "__main__":
with temp_dir(prefix='pungi_dnf_') as persistdir: parser = get_parser()
with temp_dir(prefix='pungi_dnf_cache_') as cachedir: ns = parser.parse_args()
main(persistdir, cachedir)
with temp_dir(dir=ns.tempdir, prefix="pungi_dnf_") as persistdir:
with temp_dir(dir=ns.tempdir, prefix="pungi_dnf_cache_") as cachedir:
main(ns, persistdir, cachedir)