Set persistdir to a temporary location

We don't want to even touch any system directory.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-12-15 14:02:06 +01:00
parent 9b2f0349de
commit a155674269

View File

@ -4,6 +4,8 @@
import os import os
import argparse import argparse
import tempfile
import shutil
import pungi.ks import pungi.ks
from pungi.dnf_wrapper import DnfWrapper, Conf from pungi.dnf_wrapper import DnfWrapper, Conf
@ -71,6 +73,7 @@ def main():
ns = parser.parse_args() ns = parser.parse_args()
dnf_conf = Conf(ns.arch) dnf_conf = Conf(ns.arch)
dnf_conf.persistdir = tempfile.mkdtemp()
dnf_obj = DnfWrapper(dnf_conf) dnf_obj = DnfWrapper(dnf_conf)
gather_opts = GatherOptions() gather_opts = GatherOptions()
@ -126,6 +129,7 @@ def main():
packages.add("-%s" % i) packages.add("-%s" % i)
g.gather(packages, conditional_packages) g.gather(packages, conditional_packages)
shutil.rmtree(dnf_conf.persistdir)
print_rpms(g) print_rpms(g)
if ns.profiler: if ns.profiler: