pkgrepo.py revision 2301
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa# CDDL HEADER START
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa# The contents of this file are subject to the terms of the
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa# Common Development and Distribution License (the "License").
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa# You may not use this file except in compliance with the License.
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa# See the License for the specific language governing permissions
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa# and limitations under the License.
1ec6855738a4ea917d91182d1591714dbfcb430cEugen Kuksa# When distributing Covered Code, include this CDDL HEADER in each
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa# If applicable, add the following below this CDDL HEADER, with the
8d3aa811c26916ecb2051e97a249f25fb6feeaf4Eugen Kuksa# fields enclosed by brackets "[]" replaced with your own identifying
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa# information: Portions Copyright [yyyy] [name of copyright owner]
36ec4872a8ea62879182f57759a24eb1bc708365Eugen Kuksa# CDDL HEADER END
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa# Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
36ec4872a8ea62879182f57759a24eb1bc708365Eugen Kuksa# pkgrepo exit codes
214b17ce5309c42f31fa6df96778cc9c85ae927dEugen Kuksa# listing constants
tmpdirs = []
import atexit
import collections
import copy
import errno
import getopt
import gettext
import locale
import logging
import os
import shlex
import shutil
import sys
import tempfile
import traceback
import warnings
import pkg
orig_cwd = None
def cleanup():
for d in tmpdirs:
if cmd:
if quiet:
progtrack = \
progtrack = \
return progtrack
if usage_error:
if not full:
if not pargs:
return EXIT_OOPS
if dry_run:
return EXIT_OK
return EXIT_OK
return nval
elif val is None:
nval = []
for v in val:
nval = None
if multi_value:
if not omit_headers:
(field_data[f], v)
if not path:
if not repo_uri:
version = None
if not repo_uri:
if not pargs:
if abort:
return EXIT_OOPS
new_pubs = [
if make_default:
if new_pubs:
return EXIT_PARTIAL
return EXIT_OOPS
return rval
version = None
except ValueError:
elif pargs:
if not repo_uri:
return EXIT_OK
return EXIT_OOPS
if pubs:
del props
def gen_listing():
field_data = {
return EXIT_PARTIAL
return EXIT_OOPS
return EXIT_OK
return EXIT_OOPS, None, None
pargs):
return rval
pub_idx = {}
if pub_repo:
del props
def gen_listing():
field_data = {
return rval
return EXIT_OOPS
if pargs:
def gen_listing():
if last_update:
field_data = {
return EXIT_PARTIAL
return EXIT_OOPS
return EXIT_OK
if pargs:
return EXIT_OK
elif build_catalog:
elif build_index:
xpub)
return rval
return rval
if pargs:
return EXIT_OK
elif add_content:
elif refresh_index:
xpub)
return rval
return rval
props = {}
if not pargs:
except ValueError:
if bad_args:
if pubs:
if not pubs:
failed = []
if not target:
val = []
if new_pub:
if failed:
return EXIT_PARTIAL
return EXIT_OOPS
return EXIT_OK
return EXIT_OK
if args:
return EXIT_OK
def main_func():
global orig_cwd
except OSError, e:
orig_cwd = None
except KeyError:
orig_cwd = None
conf = {}
subcommand = None
if pargs:
if show_usage:
elif not subcommand:
if not func:
raise __e
return __ret
except IOError: