| |
@@ -22,8 +22,10 @@
|
| |
import xmlrpclib
|
| |
import pwd
|
| |
import koji
|
| |
+ import subprocess
|
| |
|
| |
OSBS_DEFAULT_CONF_FILE = "/etc/osbs/osbs.conf"
|
| |
+ LOOKASIDE_MAX_FILE_SIZE = 100000
|
| |
|
| |
class cliClient(object):
|
| |
"""This is a client class for rpkg clients."""
|
| |
@@ -613,6 +615,11 @@
|
| |
'cache and remove any existing ones. The "sources" '
|
| |
'and .gitignore files will be updated with the new '
|
| |
'uploaded file(s).')
|
| |
+ self.new_sources_parser.add_argument('--force',
|
| |
+ default=False,
|
| |
+ action='store_true',
|
| |
+ help='Force the upload of small '
|
| |
+ 'textual files')
|
| |
self.new_sources_parser.add_argument('files', nargs='+')
|
| |
self.new_sources_parser.set_defaults(
|
| |
command=self.new_sources, replace=True)
|
| |
@@ -1133,6 +1140,13 @@
|
| |
if not os.path.isfile(file):
|
| |
raise Exception('Path does not exist or is '
|
| |
'not a file: %s' % file)
|
| |
+ if not self.args.force \
|
| |
+ and os.stat(file).st_size < LOOKASIDE_MAX_FILE_SIZE \
|
| |
+ and 'text' in subprocess.check_output(['file', file]):
|
| |
+ raise Exception('The file %s is small and textual, '
|
| |
+ 'it should be added '
|
| |
+ 'to the git tree directly' % file)
|
| |
+
|
| |
self.cmd.upload(self.args.files, replace=self.args.replace)
|
| |
self.log.info("Source upload succeeded. Don't forget to commit the "
|
| |
"sources file")
|
| |