From d5edf7686f79de49a34549bcb54c2dfc4b9a66b9 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Apr 15 2019 03:17:23 +0000 Subject: Reuse koji_cli.lib.unique_path Call this method instead of constructing the path by rpkg itself. Signed-off-by: Chenxiong Qi --- diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py index 63e60b4..3ac92b4 100644 --- a/pyrpkg/cli.py +++ b/pyrpkg/cli.py @@ -18,12 +18,9 @@ import argparse import getpass import logging import os -import random import re import rpm -import string import sys -import time from gettext import gettext as _ # For `_ArgumentParser' import requests @@ -1592,11 +1589,9 @@ see API KEY section of copr-cli(1) man page. callback = None if not self.args.q: callback = koji_cli.lib._progress_callback - # define a unique path for this upload. Stolen from /usr/bin/koji - uniquepath = 'cli-build/%r.%s' % ( - time.time(), - ''.join([random.choice(string.ascii_letters) for i in range(8)]) - ) + # Define a unique path for this upload. Learned from koji to use prefix + # cli-build. + uniquepath = koji_cli.lib.unique_path('cli-build') if not name: name = os.path.basename(file) # Should have a try here, not sure what errors we'll get yet though