Tomas Kopecek
9e4de57c81
don't fail on missing directory
...
Related: https://pagure.io/koji/issue/2481
2020-10-05 13:15:51 +02:00
Yu Ming Zhu
52a63f732d
util: [rmtree] try best to catch errors for race condition
...
fixes : #2481
This approach is ugly, but just working.
ENOENT and ESTALE errors are catched in `chdir`, `listdir` calls to stomach the deletion by other process/thread
ENOTEMPTY is catched when calling `os.rmdir(path)` in `rmtree()` too. It happens when `path` is on an NFS like where ESTALE happens.
2020-10-05 10:14:34 +02:00
Ken Dreyer
e35b571196
util: handle ENOENT in _stripcwd() listdir loop
...
After we call listdir(), another thread or process might delete files
from the current directory. We cannot always expect lstat() to succeed
in a loop over the initial listdir entries.
If lstat() raises ENOENT, consider this file deleted and move on.
2020-08-27 13:36:27 +02:00
Tomas Kopecek
50bcb6f3bc
replace md5 with sha256
2020-06-24 14:42:01 +02:00
Yu Ming Zhu
a893e8bf2b
a wrapper ignoring FIPS for hashlib.md5
2020-06-24 14:42:00 +02:00
Tomas Kopecek
64a0033150
fix additional flake8 problems
2020-05-13 09:56:36 +02:00
Tomas Kopecek
0132313f92
replace logging.warn with warning
...
call is deprected in python 3.7
Fixes: https://pagure.io/koji/issue/2135
2020-04-22 13:47:15 +02:00
Yuming Zhu
c5db34a8e1
flake8: apply E501 with max-line-length=99
2020-03-03 21:38:22 +08:00
Yuming Zhu
0f727a2ab4
flake8: apply E3 rules
2020-03-03 21:38:22 +08:00
Yuming Zhu
05340b146b
flake8: apply E2 rules except E266
2020-03-03 21:38:21 +08:00
Yuming Zhu
ce1f9928af
flake8: apply E1 rules
2020-03-03 21:38:21 +08:00
Yuming Zhu
97cfaa4fcf
flake8: follow E265 rule
2020-03-03 21:35:08 +08:00
Tomas Kopecek
4df680f504
Remove deprecated md5/sha1 constructors
...
Fixes: https://pagure.io/koji/issue/1491
2020-02-04 09:23:47 +01:00
Yu Ming Zhu
4d29a87e9b
sort imports in koji
2019-12-12 11:00:57 +00:00
Ken Dreyer
ff93556f3e
util: rename "dict" arg
...
dict is a built-in Python type. Don't use it as a variable name.
2019-11-19 12:37:13 +01:00
Mike McLean
3354da7024
joinpath function
2019-10-09 08:41:15 -04:00
Tomas Kopecek
8cc8b12a9a
remove deprecated koji.util.relpath
...
Fixes: https://pagure.io/koji/issue/834
2019-08-12 17:59:26 -04:00
Tomas Kopecek
dfbe322222
deprecate sha1/md5_constructor from koji.util
...
These functions are now fully provided by hashlib. Commit removes their
usage from koji's codebase and leaves deprecation message in lib.
Final removal from lib is scheduled to 1.21.
Fixes: https://pagure.io/koji/issue/1487
2019-08-12 16:07:55 -04:00
Mike McLean
71bc4106b4
new base64 helper functions
2019-03-04 09:28:39 -05:00
Yu Ming Zhu
dc208d0555
fix invokings and unittests
2019-02-17 21:26:13 -05:00
Yu Ming Zhu
9ddae41877
using ConfigParser.read_file for PY3
2019-02-17 21:26:13 -05:00
Yu Ming Zhu
200951c9d6
fix zip for python3
2019-01-28 08:46:11 -05:00
Mike McLean
4fa2901720
cleanup
...
unused var
whitespace
missing import
2019-01-15 10:51:19 -05:00
Tomas Kopecek
4191840bd7
check_sigmd5 for kojivmd
2019-01-15 10:51:19 -05:00
Tomas Kopecek
9963877545
move move_and_symlink to koji.util
2018-11-28 16:27:30 -05:00
Tomas Kopecek
3cc443df97
Fix isinstance with lists
...
Fixes: https://pagure.io/koji/issue/1011
2018-08-08 11:34:39 -04:00
Tomas Kopecek
caae1a0a8b
workaround unnecessary list conversions
2018-07-11 17:37:40 -04:00
Tomas Kopecek
8e61dc7c56
python-modernize -f libmodernize.fixes.fix_classic_division
2018-07-11 17:37:40 -04:00
Tomas Kopecek
2eff45f763
Drop pre-2.6 compat function koji.util._relpath
...
Fixes: https://pagure.io/koji/issue/818
2018-03-08 10:23:44 -05:00
Mike McLean
8a4c75ee7f
rename fixPrint->_fix_print and add a docstring
2017-12-06 13:32:51 +08:00
Yuming Zhu
3464adae2e
cli: fix changelog encode for PY3
...
relates [issue#577](https://pagure.io/koji/issue/577 )
2017-12-06 13:32:29 +08:00
Mike McLean
af71756fa7
fix exception syntax in apply_argspec
2017-11-09 17:40:52 -05:00
Mike McLean
d8132543c5
move apply_argspec to koji.util
2017-11-09 17:40:52 -05:00
Franz Chih-Ping Hsieh
efe68e54df
- add unit test for koji/util: (coverage 58%->100%)
...
- minor fix: check if input string time is valid
2017-11-07 09:58:21 -05:00
Mike McLean
6bb32b699e
handle DateTime objects in encode_datetime
2017-11-02 15:59:18 -04:00
Mike McLean
80ca9ff294
handle callbacks depth-first in DataWalker
2017-10-11 16:36:40 -04:00
Mike McLean
842754c2d3
datetime compatibility option for callbacks
2017-08-07 12:41:40 -04:00
Tomas Kopecek
709cf93b75
fix adler32 iterations
2017-06-01 09:39:24 +02:00
Tomas Kopecek
7ff24d717d
fix session
2017-06-01 09:39:23 +02:00
Tomas Kopecek
a4a1536a03
python-modernize -f libmodernize.fixes.fix_file
2017-06-01 09:39:22 +02:00
Tomas Kopecek
68bf19c739
python-modernize -f libmodernize.fixes.fix_dict_six
2017-06-01 09:39:22 +02:00
Tomas Kopecek
6a0a5a232b
python-modernize -f libmodernize.fixes.fix_basestring
2017-06-01 09:39:22 +02:00
Tomas Kopecek
f6e5bd11f3
python-modernize -f lib2to3.fixes.fix_numliterals
2017-06-01 09:39:22 +02:00
Tomas Kopecek
1220008f8f
python-modernize -f lib2to3.fixes.fix_except
2017-06-01 09:39:22 +02:00
Tomas Kopecek
b1da150c01
python-modernize -f libmodernize.fixes.fix_imports_six
2017-06-01 09:39:21 +02:00
Tomas Kopecek
7f946b37be
python-modernize -f libmodernize.fixes.fix_xrange_six
2017-06-01 09:39:21 +02:00
Tomas Kopecek
cc9fff9840
remove has_key (not working in python3)
2017-03-07 08:15:20 -05:00
Tomas Kopecek
1494301465
use new exception syntax
2017-03-02 10:52:30 -05:00
Mike McLean
ab99443414
Update exception syntax in rmtree()
2016-12-19 12:31:01 -05:00
Mike McLean
d4590637a1
replace old rmtree with the new one
2016-12-19 12:28:10 -05:00