| |
@@ -26,9 +26,11 @@
|
| |
import os
|
| |
import os.path
|
| |
import re
|
| |
+ import subprocess
|
| |
import sys
|
| |
|
| |
import ansi
|
| |
+ from packaging import version
|
| |
from review_error import ReviewError
|
| |
from xdg_dirs import XdgDirs
|
| |
|
| |
@@ -53,6 +55,21 @@
|
| |
raise ReviewError(mock_msg)
|
| |
|
| |
|
| |
+ def _check_mock_ver():
|
| |
+ try:
|
| |
+ mock_ver = subprocess.check_output(['mock', '--version'])
|
| |
+ except subprocess.CalledProcessError:
|
| |
+ mock_ver = '0'
|
| |
+ return mock_ver
|
| |
+
|
| |
+
|
| |
+ def _mock_options_default():
|
| |
+ mock_opts = '--no-cleanup-after --no-clean'
|
| |
+ if(version.parse(_check_mock_ver()) >= version.parse('1.4.1')):
|
| |
+ mock_opts = '--no-bootstrap-chroot %s' % mock_opts
|
| |
+ return mock_opts
|
| |
+
|
| |
+
|
| |
def _add_modes(modes):
|
| |
''' Add all mode arguments to the option parser group modes. '''
|
| |
modes.add_argument('-b', '--bug', metavar='<bug>',
|
| |
@@ -111,10 +128,10 @@
|
| |
help='Do not rebuild or install the srpm, use last'
|
| |
' built one in mock. Implies --cache')
|
| |
optional.add_argument('-o', '--mock-options', metavar='<mock options>',
|
| |
- default='--no-cleanup-after --no-clean',
|
| |
+ default=_mock_options_default(),
|
| |
dest='mock_options',
|
| |
- help='Options to specify to mock for the build,'
|
| |
- ' defaults to --no-cleanup-after --no-clean')
|
| |
+ help=('Options to specify to mock for the build,'
|
| |
+ ' defaults to %s' % _mock_options_default()))
|
| |
optional.add_argument('--other-bz', default=None,
|
| |
metavar='<bugzilla url>', dest='other_bz',
|
| |
help='Alternative bugzilla URL')
|
| |
This is a temporary fix for mock >= 1.4.1