1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

Restore support for "osc add prj/dir"

This is used to turn "dir" into a package and add it to the version
control (got broken in commit b6f7d1be6c).
Integrated the obscpio code that was introduced in commit
b6f7d1be6c into core.addFiles (XXX: we
should get rid of the run_external(..., shell=True) code).
This commit is contained in:
Marcus Huewe 2016-08-26 17:12:09 +02:00
parent 00c8876791
commit 8e7189b391
2 changed files with 17 additions and 15 deletions

View File

@ -4439,17 +4439,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
addGitSource(arg)
else:
addDownloadUrlService(arg)
continue
if os.path.isdir(arg):
resp = raw_input("%s is a directory, do you want to archive it for submission? (y/n)" % (arg))
if resp not in ('y', 'Y'):
continue
archive = ("%s.obscpio" % arg)
run_external("find %s | cpio -o -H newc > %s" % (arg, archive), shell=True)
addFiles([archive])
continue
addFiles([arg])
else:
addFiles([arg])
def do_mkpac(self, subcmd, opts, *args):

View File

@ -6756,12 +6756,23 @@ def addFiles(filenames, prj_obj = None):
elif os.path.isdir(filename) and is_project_dir(prj_dir):
raise oscerr.WrongArgs('osc: cannot add a directory to a project unless ' \
'\'do_package_tracking\' is enabled in the configuration file')
elif os.path.isdir(filename):
print('skipping directory \'%s\'' % filename)
pacs.remove(filename)
pacs, no_pacs = findpacs(pacs, fatal=False)
for filename in no_pacs:
print('osc: warning: \'%s\' cannot be associated to a package' % filename)
filename = os.path.normpath(filename)
directory = os.path.join(filename, os.pardir)
if not is_package_dir(directory):
print('osc: warning: \'%s\' cannot be associated to a package' % filename)
continue
resp = raw_input("%s is a directory, do you want to archive it for submission? (y/n) " % (filename))
if resp not in ('y', 'Y'):
continue
archive = "%s.obscpio" % filename
# XXX: hmm we should use subprocess.Popen here (to avoid all the
# issues that come with shell=True...)
run_external("find %s | cpio -o -H newc > %s" % (filename, archive), shell=True)
pacs.extend(findpacs([archive]))
for pac in pacs:
if conf.config['do_package_tracking'] and not pac.todo:
prj = prj_obj or Project(os.path.dirname(pac.absdir), False)