Blob Blame History Raw
From 0ee52cf747e218008984d604c468f9e1515f1ef9 Mon Sep 17 00:00:00 2001
From: Chenxiong Qi <cqi@redhat.com>
Date: Mon, 15 Apr 2019 11:17:21 +0800
Subject: [PATCH 1/5] Reuse koji_cli.lib.unique_path

Call this method instead of constructing the path by rpkg itself.

Merges: https://pagure.io/rpkg/pull-request/336

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
---
 pyrpkg/cli.py | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
index 6b584ae..7ab146d 100644
--- a/pyrpkg/cli.py
+++ b/pyrpkg/cli.py
@@ -18,11 +18,8 @@ import argparse
 import getpass
 import logging
 import os
-import random
 import re
-import string
 import sys
-import time
 from gettext import gettext as _  # For `_ArgumentParser'
 
 import requests
@@ -1646,11 +1643,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
-- 
2.21.0