mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-23 05:26:16 +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 commitb6f7d1be6c
). Integrated the obscpio code that was introduced in commitb6f7d1be6c
into core.addFiles (XXX: we should get rid of the run_external(..., shell=True) code).
This commit is contained in:
parent
00c8876791
commit
8e7189b391
@ -4439,16 +4439,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
addGitSource(arg)
|
addGitSource(arg)
|
||||||
else:
|
else:
|
||||||
addDownloadUrlService(arg)
|
addDownloadUrlService(arg)
|
||||||
continue
|
else:
|
||||||
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])
|
addFiles([arg])
|
||||||
|
|
||||||
|
|
||||||
|
17
osc/core.py
17
osc/core.py
@ -6756,12 +6756,23 @@ def addFiles(filenames, prj_obj = None):
|
|||||||
elif os.path.isdir(filename) and is_project_dir(prj_dir):
|
elif os.path.isdir(filename) and is_project_dir(prj_dir):
|
||||||
raise oscerr.WrongArgs('osc: cannot add a directory to a project unless ' \
|
raise oscerr.WrongArgs('osc: cannot add a directory to a project unless ' \
|
||||||
'\'do_package_tracking\' is enabled in the configuration file')
|
'\'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)
|
pacs, no_pacs = findpacs(pacs, fatal=False)
|
||||||
for filename in no_pacs:
|
for filename in no_pacs:
|
||||||
|
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)
|
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:
|
for pac in pacs:
|
||||||
if conf.config['do_package_tracking'] and not pac.todo:
|
if conf.config['do_package_tracking'] and not pac.todo:
|
||||||
prj = prj_obj or Project(os.path.dirname(pac.absdir), False)
|
prj = prj_obj or Project(os.path.dirname(pac.absdir), False)
|
||||||
|
Loading…
Reference in New Issue
Block a user