mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-08 20:15:47 +01:00
New config option 'checkout_rooted'. Default off to retain current
behaviour. Enabled, it prevents checking out projects inside of other projects or packages. That better matches my mental model of a tree.
This commit is contained in:
parent
ce3ee5e614
commit
01fc46cbd3
@ -436,6 +436,9 @@ class Osc(cmdln.Cmdln):
|
|||||||
if p.startswith("_patchinfo:"):
|
if p.startswith("_patchinfo:"):
|
||||||
patchinfo = p
|
patchinfo = p
|
||||||
|
|
||||||
|
# CAUTION:
|
||||||
|
# Both conf.config['checkout_no_colon'] and conf.config['checkout_rooted']
|
||||||
|
# fool this test:
|
||||||
if not os.path.exists(project_dir + "/" + patchinfo):
|
if not os.path.exists(project_dir + "/" + patchinfo):
|
||||||
checkout_package(apiurl, project, patchinfo, prj_dir=project_dir)
|
checkout_package(apiurl, project, patchinfo, prj_dir=project_dir)
|
||||||
|
|
||||||
|
@ -104,7 +104,8 @@ DEFAULTS = { 'apiurl': 'https://api.opensuse.org',
|
|||||||
'getpac_default_project': 'openSUSE:Factory',
|
'getpac_default_project': 'openSUSE:Factory',
|
||||||
# alternate filesystem layout: have multiple subdirs, where colons were.
|
# alternate filesystem layout: have multiple subdirs, where colons were.
|
||||||
'checkout_no_colon': '0',
|
'checkout_no_colon': '0',
|
||||||
# local files to ignore with status, addremove, ....
|
# change filesystem layout: avoid checkout from within a proj or package dir.
|
||||||
|
'checkout_rooted': '0',
|
||||||
# local files to ignore with status, addremove, ....
|
# local files to ignore with status, addremove, ....
|
||||||
'exclude_glob': '.osc CVS .svn .* _linkerror *~ #*# *.orig *.bak *.changes.vctmp.*',
|
'exclude_glob': '.osc CVS .svn .* _linkerror *~ #*# *.orig *.bak *.changes.vctmp.*',
|
||||||
# keep passwords in plaintext. If you see this comment, your osc
|
# keep passwords in plaintext. If you see this comment, your osc
|
||||||
@ -139,7 +140,7 @@ DEFAULTS = { 'apiurl': 'https://api.opensuse.org',
|
|||||||
config = DEFAULTS.copy()
|
config = DEFAULTS.copy()
|
||||||
|
|
||||||
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist', 'plaintext_passwd',
|
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist', 'plaintext_passwd',
|
||||||
'checkout_no_colon', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
|
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
|
||||||
'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check', 'http_full_debug']
|
'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check', 'http_full_debug']
|
||||||
|
|
||||||
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']
|
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']
|
||||||
@ -217,6 +218,9 @@ apiurl = %(apiurl)s
|
|||||||
# alternate filesystem layout: have multiple subdirs, where colons were.
|
# alternate filesystem layout: have multiple subdirs, where colons were.
|
||||||
#checkout_no_colon = %(checkout_no_colon)s
|
#checkout_no_colon = %(checkout_no_colon)s
|
||||||
|
|
||||||
|
# change filesystem layout: avoid checkout within a project or package dir.
|
||||||
|
#checkout_rooted = %(checkout_rooted)s
|
||||||
|
|
||||||
# local files to ignore with status, addremove, ....
|
# local files to ignore with status, addremove, ....
|
||||||
#exclude_glob = %(exclude_glob)s
|
#exclude_glob = %(exclude_glob)s
|
||||||
|
|
||||||
|
35
osc/core.py
35
osc/core.py
@ -3817,6 +3817,41 @@ def checkout_package(apiurl, project, package,
|
|||||||
if conf.config['checkout_no_colon']:
|
if conf.config['checkout_no_colon']:
|
||||||
prj_dir = prj_dir.replace(':', '/')
|
prj_dir = prj_dir.replace(':', '/')
|
||||||
|
|
||||||
|
root_dots = '.'
|
||||||
|
if conf.config['checkout_rooted']:
|
||||||
|
if prj_dir[:1] == '/':
|
||||||
|
if conf.config['verbose'] > 1:
|
||||||
|
print "checkout_rooted ignored for %s" % prj_dir
|
||||||
|
# ?? should we complain if not is_project_dir(prj_dir) ??
|
||||||
|
else:
|
||||||
|
# if we are inside a project or package dir, ascend to parent
|
||||||
|
# directories, so that all projects are checked out relative to
|
||||||
|
# the same root.
|
||||||
|
if is_project_dir(".."):
|
||||||
|
# if we are in a package dir, goto parent.
|
||||||
|
# Hmm, with 'checkout_no_colon' in effect, we have directory levels that
|
||||||
|
# do not easily reveal the fact, that they are part of a project path.
|
||||||
|
# At least this test should find that the parent of 'home/username/branches'
|
||||||
|
# is a project (hack alert). Also goto parent in this case.
|
||||||
|
root_dots = "../"
|
||||||
|
elif is_project_dir("../.."):
|
||||||
|
# testing two levels is better than one.
|
||||||
|
# May happen in case of checkout_no_colon, or
|
||||||
|
# if project roots were previously inconsistent
|
||||||
|
root_dots = "../../"
|
||||||
|
if is_project_dir(root_dots):
|
||||||
|
if conf.config['checkout_no_colon']:
|
||||||
|
oldproj = store_read_project(root_dots)
|
||||||
|
n = len(oldproj.split(':'))
|
||||||
|
else:
|
||||||
|
n = 1
|
||||||
|
root_dots = root_dots + "../" * n
|
||||||
|
|
||||||
|
if root_dots != '.':
|
||||||
|
if conf.config['verbose']:
|
||||||
|
print "found root of %s at %s" % (oldproj, root_dots)
|
||||||
|
prj_dir = root_dots + prj_dir
|
||||||
|
|
||||||
if not pathname:
|
if not pathname:
|
||||||
pathname = getTransActPath(os.path.join(prj_dir, package))
|
pathname = getTransActPath(os.path.join(prj_dir, package))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user