--- a/src/publish.py Sun Jun 06 16:13:24 2010 -0400
+++ b/src/publish.py Mon Jun 07 19:51:38 2010 -0400
@@ -21,8 +21,7 @@
#
#
-# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
#
# pkgsend - publish package transactions
@@ -92,7 +91,7 @@
pkgsend import [-T file_pattern] bundlefile ...
pkgsend include [-d basedir] .. [manifest] ...
pkgsend close [-A | [--no-index] [--no-catalog]]
- pkgsend publish [ -d basedir] ... [--no-index]
+ pkgsend publish [ -d basedir] ... [--no-index]
[--fmri-in-manifest | pkg_fmri] [--no-catalog] [manifest] ...
pkgsend generate [-T file_pattern] bundlefile ....
pkgsend refresh-index
@@ -187,7 +186,7 @@
usage(_("No transaction ID specified using -t or in "
"$PKG_TRANS_ID."), cmd="close")
- t = trans.Transaction(repo_uri, trans_id=trans_id,
+ t = trans.Transaction(repo_uri, trans_id=trans_id,
add_to_catalog=add_to_catalog)
pkg_state, pkg_fmri = t.close(abandon, refresh_index)
for val in (pkg_state, pkg_fmri):
@@ -204,7 +203,7 @@
if not args:
usage(_("No arguments specified for subcommand."), cmd="add")
-
+
action, lp = pkg.actions.internalizelist(args[0], args[1:])
if action.name in nopub_actions:
@@ -216,7 +215,7 @@
return 0
def trans_publish(repo_uri, fargs):
- opts, pargs = getopt.getopt(fargs, "d:", ["no-index",
+ opts, pargs = getopt.getopt(fargs, "d:", ["no-index",
"no-catalog", "fmri-in-manifest"])
basedirs = []
@@ -260,7 +259,7 @@
data = f.read()
except IOError, e:
error(e, cmd="publish")
- return 1
+ return 1
lines += data
linecnt = len(data.splitlines())
linecnts.append((linecounter, linecounter + linecnt))
@@ -286,7 +285,7 @@
if embedded_fmri:
if "pkg.fmri" not in m:
- error(_("Manifest does not set fmri and " +
+ error(_("Manifest does not set fmri and " +
"--fmri-in-manifest specified"))
return 1
pkg_name = pkg.fmri.PkgFmri(m["pkg.fmri"]).get_short_fmri()
@@ -311,7 +310,7 @@
t.close(abandon=True)
raise
- pkg_state, pkg_fmri = t.close(abandon=False,
+ pkg_state, pkg_fmri = t.close(abandon=False,
refresh_index=refresh_index, add_to_catalog=add_to_catalog)
for val in (pkg_state, pkg_fmri):
if val is not None:
@@ -355,7 +354,7 @@
data = f.read()
except IOError, e:
error(e, cmd="include")
- return 1
+ return 1
lines.append(data)
linecnt = len(data.splitlines())
linecnts.append((linecounter, linecounter + linecnt))
@@ -506,9 +505,7 @@
return 0
def main_func():
-
- # XXX /usr/lib/locale is OpenSolaris-specific.
- gettext.install("pkgsend", "/usr/lib/locale")
+ gettext.install("pkg", "/usr/share/locale")
try:
repo_uri = os.environ["PKG_REPO"]
@@ -569,7 +566,7 @@
# so that we can more easily detect these in testing of the CLI commands.
#
if __name__ == "__main__":
-
+
# Make all warnings be errors.
warnings.simplefilter('error')
--- a/src/pull.py Sun Jun 06 16:13:24 2010 -0400
+++ b/src/pull.py Mon Jun 07 19:51:38 2010 -0400
@@ -21,8 +21,7 @@
#
#
-# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
import calendar
@@ -564,8 +563,7 @@
src_uri = None
target = None
- # XXX /usr/lib/locale is OpenSolaris-specific.
- gettext.install("pkgrecv", "/usr/lib/locale")
+ gettext.install("pkg", "/usr/share/locale")
global_settings.client_name = "pkgrecv"
target = os.environ.get("PKG_DEST", None)
--- a/src/tests/pkg5unittest.py Sun Jun 06 16:13:24 2010 -0400
+++ b/src/tests/pkg5unittest.py Mon Jun 07 19:51:38 2010 -0400
@@ -60,7 +60,7 @@
#
# XXX?
#
-gettext.install("pkg", "/usr/lib/locale")
+gettext.install("pkg", "/usr/share/locale")
OUTPUT_DOTS=0 # Dots ...
OUTPUT_VERBOSE=1 # Verbose
@@ -494,7 +494,7 @@
def reduceSpaces(self, string):
"""Reduce runs of spaces down to a single space."""
return re.sub(" +", " ", string)
-
+
def assertEqualDiff(self, expected, actual):
"""Compare two strings."""
@@ -508,7 +508,7 @@
"\n".join(difflib.unified_diff(
expected.splitlines(), actual.splitlines(),
"Expected output", "Actual output", lineterm="")))
-
+
class _Pkg5TestResult(unittest._TextTestResult):
baseline = None
--- a/src/util/publish/merge.py Sun Jun 06 16:13:24 2010 -0400
+++ b/src/util/publish/merge.py Mon Jun 07 19:51:38 2010 -0400
@@ -19,8 +19,9 @@
#
# CDDL HEADER END
#
-# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+
+#
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
#
import sys
@@ -246,8 +247,7 @@
basedir = None
newfmri = False
- # XXX /usr/lib/locale is OpenSolaris-specific.
- gettext.install("pkgmerge", "/usr/lib/locale")
+ gettext.install("pkg", "/usr/share/locale")
global_settings.client_name = "pkgmerge"
--- a/src/util/publish/pkgdiff.py Sun Jun 06 16:13:24 2010 -0400
+++ b/src/util/publish/pkgdiff.py Mon Jun 07 19:51:38 2010 -0400
@@ -19,8 +19,9 @@
#
# CDDL HEADER END
#
-# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+
+#
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
#
import getopt
@@ -42,7 +43,7 @@
if errmsg:
print >> sys.stderr, "pkgdiff: %s" % errmsg
-
+
print _(
"/usr/bin/pkgdiff [-i attribute] [-o attribute] file1 file2")
sys.exit(exitcode)
@@ -56,8 +57,7 @@
sys.exit(exitcode)
def main_func():
- # /usr/lib/locale is OpenSolaris-specific.
- gettext.install("pkgdiff", "/usr/lib/locale")
+ gettext.install("pkg", "/usr/share/locale")
ignoreattrs = []
onlyattrs = []
@@ -71,7 +71,7 @@
onlyattrs.append(arg)
if opt in ("--help", "-?"):
usage(exitcode=0)
-
+
except getopt.GetoptError, e:
usage(_("illegal global option -- %s") % e.opt)
@@ -100,7 +100,7 @@
manifest2 = manifest.Manifest()
manifest2.set_content(file2)
except pkg.actions.ActionError, e:
- error(_("Action error in file %s: %s") % (pargs[1], e))
+ error(_("Action error in file %s: %s") % (pargs[1], e))
# we need to be a little clever about variants, since
# we can have multiple actions w/ the same key attributes
@@ -129,7 +129,7 @@
diffs = []
for tup in product(*v_values.values()):
- # build excludes closure to examine only actions exactly
+ # build excludes closure to examine only actions exactly
# matching current variant values... this is needed to
# avoid confusing manifest difference code w/ multiple
# actions w/ same key attribute values or getting dups
@@ -148,8 +148,8 @@
diffs += c
diffs += r
# License action still causes spurious diffs... check again for now.
-
- real_diffs = [
+
+ real_diffs = [
(a,b)
for a, b in diffs
if a is None or b is None or a.different(b)
@@ -161,7 +161,7 @@
# define some ordering functions so that output is easily readable
# First, a human version of action comparison that works across
# variants and action changes...
- def compare(a, b):
+ def compare(a, b):
if hasattr(a, "key_attr") and hasattr(b, "key_attr") and \
a.key_attr == b.key_attr:
res = cmp(a.attrs[a.key_attr], b.attrs[b.key_attr])
@@ -188,7 +188,7 @@
diffs = sorted(diffs, key=tuple_key, cmp=compare)
# handle list attributes
- def attrval(attrs, k, elide_iter=tuple()):
+ def attrval(attrs, k, elide_iter=tuple()):
def q(s):
if " " in s or s == "":
return '"%s"' % s
@@ -197,7 +197,7 @@
v = attrs[k]
if isinstance(v, list) or isinstance(v, set):
- out = " ".join(["%s=%s" %
+ out = " ".join(["%s=%s" %
(k, q(lmt)) for lmt in sorted(v) if lmt not in elide_iter])
elif " " in v or v == "":
out = k + "=\"" + v + "\""
@@ -213,7 +213,7 @@
elif ignoreattrs:
if not set(a.attrs.keys()) - ignoreattrs:
return False
- print "%s %s" % (s, a)
+ print "%s %s" % (s, a)
return True
different = False
@@ -232,7 +232,7 @@
s.append(" - %s" % new.hash)
s.append(" + %s" % old.hash)
attrdiffs = set(new.differences(old)) - ignoreattrs
- attrsames = sorted(list(set(old.attrs.keys() + new.attrs.keys()) -
+ attrsames = sorted(list(set(old.attrs.keys() + new.attrs.keys()) -
set(new.differences(old))))
else:
if hasattr(old, "hash") and "hash" in onlyattrs:
@@ -240,14 +240,14 @@
s.append(" - %s" % new.hash)
s.append(" + %s" % old.hash)
attrdiffs = set(new.differences(old)) & onlyattrs
- attrsames = sorted(list(set(old.attrs.keys() + new.attrs.keys()) -
- set(new.differences(old))))
+ attrsames = sorted(list(set(old.attrs.keys() + new.attrs.keys()) -
+ set(new.differences(old))))
for a in sorted(attrdiffs):
if a in old.attrs and a in new.attrs and \
isinstance(old.attrs[a], list) and \
isinstance(new.attrs[a], list):
- elide_set = set(old.attrs[a]) & set(new.attrs[a])
+ elide_set = set(old.attrs[a]) & set(new.attrs[a])
else:
elide_set = set()
if a in old.attrs:
@@ -261,9 +261,9 @@
# print out part of action that is the same
if s:
different = True
- print "%s %s %s" % (old.name,
- attrval(old.attrs, old.key_attr),
- " ".join(("%s" % attrval(old.attrs,v)
+ print "%s %s %s" % (old.name,
+ attrval(old.attrs, old.key_attr),
+ " ".join(("%s" % attrval(old.attrs,v)
for v in attrsames if v != old.key_attr)))
for l in s:
print l
@@ -280,15 +280,15 @@
result = [x+[y] for x in result for y in pool]
for prod in result:
yield tuple(prod)
-
+
if __name__ == "__main__":
try:
- exit_code = main_func()
+ exit_code = main_func()
except (PipeError, KeyboardInterrupt):
exit_code = 1
except SystemExit, __e:
exit_code = __e
- except Exception, __e:
+ except Exception, __e:
traceback.print_exc()
print >> sys.stderr, "pkgdiff: caught %s, %s" % (Exception, __e)
exit_code = 99
--- a/src/util/publish/pkgfmt.py Sun Jun 06 16:13:24 2010 -0400
+++ b/src/util/publish/pkgfmt.py Mon Jun 07 19:51:38 2010 -0400
@@ -57,7 +57,7 @@
if errmsg:
error(errmsg)
-
+
print >> sys.stderr, _("""\
Usage:
pkgfmt [-cu] [file1] ... """)
@@ -84,7 +84,7 @@
sys.exit(exitcode)
def read_line(f):
- """Generates the lines in the file as tuples containing
+ """Generates the lines in the file as tuples containing
(action, prepended macro, list of prepended comment lines);
handles continuation lines, transforms, etc."""
@@ -240,8 +240,7 @@
def main_func():
- # /usr/lib/locale is OpenSolaris-specific.
- gettext.install("pkgdiff", "/usr/lib/locale")
+ gettext.install("pkg", "/usr/share/locale")
global opt_unwrap
global opt_check
--- a/src/util/publish/pkgmogrify.py Sun Jun 06 16:13:24 2010 -0400
+++ b/src/util/publish/pkgmogrify.py Mon Jun 07 19:51:38 2010 -0400
@@ -385,8 +385,7 @@
sys.exit(exitcode)
def main_func():
- # /usr/lib/locale is OpenSolaris-specific.
- gettext.install("pkgmogrify", "/usr/lib/locale")
+ gettext.install("pkg", "/usr/share/locale")
outfilename = None
printfilename = None