diff --git a/osc/commandline.py b/osc/commandline.py index 01d20af9..8b9a3841 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -3370,9 +3370,6 @@ Please submit there instead, or use --nodevelproject to force direct submission. @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', @@ -3461,13 +3458,9 @@ Please submit there instead, or use --nodevelproject to force direct submission. 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) diff --git a/osc/core.py b/osc/core.py index 9ff1c84a..bbcec50b 100644 --- a/osc/core.py +++ b/osc/core.py @@ -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)) + 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 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): + # 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 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): + 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, @@ -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) @@ -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)