equal
deleted
inserted
replaced
19 # |
19 # |
20 # CDDL HEADER END |
20 # CDDL HEADER END |
21 # |
21 # |
22 |
22 |
23 # |
23 # |
24 # Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. |
24 # Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. |
25 # |
25 # |
26 |
26 |
27 from __future__ import print_function |
27 from __future__ import print_function |
28 import fnmatch |
28 import fnmatch |
29 import getopt |
29 import getopt |
49 from pkg.misc import msg, emsg, PipeError |
49 from pkg.misc import msg, emsg, PipeError |
50 from pkg.client import global_settings |
50 from pkg.client import global_settings |
51 from pkg.client.debugvalues import DebugValues |
51 from pkg.client.debugvalues import DebugValues |
52 |
52 |
53 nopub_actions = [ "unknown" ] |
53 nopub_actions = [ "unknown" ] |
|
54 |
|
55 # These attributes should always be stripped from input manifests for 'publish'; |
|
56 # they will be re-calculated during publication. |
|
57 strip_attrs = [ |
|
58 "elfarch", |
|
59 "elfbits", |
|
60 "elfhash", |
|
61 "pkg.csize", |
|
62 "pkg.size", |
|
63 ] |
54 |
64 |
55 def error(text, cmd=None): |
65 def error(text, cmd=None): |
56 """Emit an error message prefixed by the command name """ |
66 """Emit an error message prefixed by the command name """ |
57 |
67 |
58 if not isinstance(text, six.string_types): |
68 if not isinstance(text, six.string_types): |
420 a))) |
430 a))) |
421 continue |
431 continue |
422 if a.name == "set" and a.attrs["name"] in ["pkg.fmri", "fmri"]: |
432 if a.name == "set" and a.attrs["name"] in ["pkg.fmri", "fmri"]: |
423 continue |
433 continue |
424 elif a.has_payload: |
434 elif a.has_payload: |
425 # Don't trust values provided; forcibly discard these. |
435 # Forcibly discard content-related attributes to prevent |
426 a.attrs.pop("pkg.size", None) |
436 # errors when reusing manifests with different content. |
427 a.attrs.pop("pkg.csize", None) |
437 for attr in strip_attrs: |
|
438 a.attrs.pop(attr, None) |
428 path = pkg.actions.set_action_data(a.hash, a, |
439 path = pkg.actions.set_action_data(a.hash, a, |
429 basedirs=basedirs, bundles=bundles)[0] |
440 basedirs=basedirs, bundles=bundles)[0] |
430 elif a.name in nopub_actions: |
441 elif a.name in nopub_actions: |
431 error(_("invalid action for publication: {0}").format( |
442 error(_("invalid action for publication: {0}").format( |
432 action), cmd="publish") |
443 action), cmd="publish") |