Skip to content

Commit

Permalink
Revert "implemented --output-dir command line option"
Browse files Browse the repository at this point in the history
This reverts commit b190f27.

Do not use "pathname" for this. Its sole purpose is to print out the
"correct" pathname to the user.

The code broke the Project's class update mechanism
  • Loading branch information
marcus-h committed Nov 2, 2011
1 parent eac124f commit 17a5242
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
9 changes: 1 addition & 8 deletions osc/commandline.py
Expand Up @@ -3370,9 +3370,6 @@ def do_repourls(self, subcmd, opts, *args):
@cmdln.option('-c', '--current-dir', action='store_true',
help='place PACKAGE folder in the current directory' \
'instead of a PROJECT/PACKAGE directory')
@cmdln.option('-o', '--output-dir', metavar='outdir',
help='place package in the specified directory' \
'instead of a PROJECT/PACKAGE directory')
@cmdln.option('-s', '--source-service-files', action='store_true',
help='Run source services.' )
@cmdln.option('-S', '--server-side-source-service-files', action='store_true',
Expand Down Expand Up @@ -3461,13 +3458,9 @@ def do_checkout(self, subcmd, opts, *args):
get_source_file(apiurl, project, package, filename, revision=rev, progress_obj=self.download_progress)

elif package:
output_dir = None
if opts.current_dir:
project_dir = None
if opts.output_dir:
project_dir = None
output_dir = getTransActPath(os.path.realpath(opts.output_dir))
checkout_package(apiurl, project, package, rev, output_dir, expand_link=expand_link, \
checkout_package(apiurl, project, package, rev, expand_link=expand_link, \
prj_dir=project_dir, service_files = opts.source_service_files, server_service_files=opts.server_side_source_service_files, progress_obj=self.download_progress, size_limit=opts.limit_size, meta=opts.meta)
print_request_list(apiurl, project, package)

Expand Down
42 changes: 22 additions & 20 deletions osc/core.py
Expand Up @@ -3976,30 +3976,29 @@ def make_dir(apiurl, project, package, pathname=None, prj_dir=None, package_trac
# and should rename this path component by appending '.proj'
# and give user a warning message, to discourage such clashes

path = pathname or getTransActPath(os.path.join(prj_dir, package))

if not pathname:
if is_package_dir(prj_dir):
# we want this to become a project directory,
# but it already is a package directory.
raise oscerr.OscIOError(None, 'checkout_package: package/project clash. Moving myself away not implemented')

if not is_project_dir(prj_dir) and not pathname:
# this directory could exist as a parent direory for one of our earlier
# checked out sub-projects. in this case, we still need to initialize it.
print statfrmt('A', path)
Project.init_project(apiurl, prj_dir, project, package_tracking)

if is_project_dir(path):
pathname = pathname or getTransActPath(os.path.join(prj_dir, package))
if is_package_dir(prj_dir):
# we want this to become a project directory,
# but it already is a package directory.
raise oscerr.OscIOError(None, 'checkout_package: package/project clash. Moving myself away not implemented')

if not is_project_dir(prj_dir):
# this directory could exist as a parent direory for one of our earlier
# checked out sub-projects. in this case, we still need to initialize it.
print statfrmt('A', prj_dir)
Project.init_project(apiurl, prj_dir, project, package_tracking)

if is_project_dir(os.path.join(prj_dir, package)):
# the thing exists, but is a project directory and not a package directory
# FIXME: this should be a warning message to discourage package/project clashes
raise oscerr.OscIOError(None, 'checkout_package: package/project clash. Moving project away not implemented')
if not os.path.exists(path):
print statfrmt('A', path)
os.mkdir(path)

if not os.path.exists(os.path.join(prj_dir, package)):
print statfrmt('A', pathname)
os.mkdir(os.path.join(prj_dir, package))
# os.mkdir(os.path.join(prj_dir, package, store))

return path
return os.path.join(prj_dir, package)


def checkout_package(apiurl, project, package,
Expand Down Expand Up @@ -4056,6 +4055,9 @@ def checkout_package(apiurl, project, package,
print "found root of %s at %s" % (oldproj, root_dots)
prj_dir = root_dots + prj_dir

if not pathname:
pathname = getTransActPath(os.path.join(prj_dir, package))

# before we create directories and stuff, check if the package actually
# exists
show_package_meta(apiurl, project, package, meta)
Expand All @@ -4077,7 +4079,7 @@ def checkout_package(apiurl, project, package,
p = Package.init_package(apiurl, project, package, directory, size_limit, meta, progress_obj)
if isfrozen:
p.mark_frozen()
if conf.config['do_package_tracking'] and not pathname:
if conf.config['do_package_tracking']:
# check if we can re-use an existing project object
if prj_obj is None:
prj_obj = Project(prj_dir)
Expand Down

0 comments on commit 17a5242

Please sign in to comment.