Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/brand/bhyve/bootlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def parse_ram(v):
m = re.search(rf"^(\d+)(.?)$", v)
if not m:
fatal(f'Could not parse ram value "{v}"')
(mem, suffix) = m.groups()
mem, suffix = m.groups()
mem = int(mem)

if not suffix:
Expand Down
6 changes: 2 additions & 4 deletions src/brand/emu/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@


def usage(msg=None):
print(
"""
print("""
boot [-t] [-x xml] <[-z] zone>
-t Test mode - just show what would be done
-j Output the computed zone data in JSON format
-x Path to zone's XML file
-z Name of zone
"""
)
""")

if msg:
print(msg)
Expand Down
6 changes: 2 additions & 4 deletions src/cffi_src/build_arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
extra_compile_args=["-O3"],
)

ffi.cdef(
"""
ffi.cdef("""
/* Macros */
#define SI_RELEASE 3 /* return release of operating system */
#define SI_ARCHITECTURE_32 516 /* basic 32-bit SI_ARCHITECTURE */
Expand All @@ -51,8 +50,7 @@
void *realloc(void *, size_t);
void free(void *);
int sysinfo(int, char *, long);
"""
)
""")

if __name__ == "__main__":
ffi.compile(verbose=False)
Expand Down
6 changes: 2 additions & 4 deletions src/cffi_src/build_sha512_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
libraries=["md"],
)

ffi.cdef(
"""
ffi.cdef("""
#define SHA512_224 9
#define SHA512_256 10

Expand All @@ -68,8 +67,7 @@
void SHA2Update(SHA2_CTX *ctx, const void *buf, size_t bufsz);
void SHA2Final(void *digest, SHA2_CTX *ctx);
void *memcpy(void *restrict s1, const void *restrict s2, size_t n);
"""
)
""")

if __name__ == "__main__":
ffi.compile(verbose=False)
Expand Down
6 changes: 2 additions & 4 deletions src/cffi_src/build_sysattr.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
libraries=["nvpair"],
)

ffi.cdef(
"""
ffi.cdef("""
/* Macros */
#define NV_UNIQUE_NAME 0x1

Expand Down Expand Up @@ -148,8 +147,7 @@
char *nvpair_name(nvpair_t *);
data_type_t nvpair_type(nvpair_t *);
int nvpair_value_boolean_value(nvpair_t *, boolean_t *);
"""
)
""")

if __name__ == "__main__":
ffi.compile(verbose=False)
Expand Down
6 changes: 2 additions & 4 deletions src/cffi_src/build_syscallat.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
extra_compile_args=["-O3"],
)

ffi.cdef(
"""
ffi.cdef("""
/* Types */
typedef int... mode_t; /* file attribute type */

Expand All @@ -50,8 +49,7 @@
int openat(int, const char *, int, mode_t);
int renameat(int, const char *, int, const char *);
int unlinkat(int, const char *, int);
"""
)
""")

if __name__ == "__main__":
ffi.compile(verbose=False)
Expand Down
122 changes: 39 additions & 83 deletions src/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@
import sys

if sys.platform == "sunos5":
print(
"""
print("""
The Python environment on this system is damaged and missing a critical core
component (pkg.site_paths) and can not be repaired with pkg(1).

To recover this system reboot and select an alternate Boot Environment (BE)
from the boot menu. From the alternate BE mount and run 'pkg fix' on this BE.
"""
)
""")
sys.exit(1)

pkg.site_paths.init()
Expand Down Expand Up @@ -600,45 +598,31 @@ def print_cmds(cmd_list, cmd_dic):

if verbose:
# Display a verbose usage message of subcommands.
logger.error(
_(
"""\
logger.error(_("""\
Usage:
pkg [options] command [cmd_options] [operands]
"""
)
)
"""))
logger.error(_("Basic subcommands:"))
print_cmds(basic_cmds, basic_usage)

logger.error(_("\nAdvanced subcommands:"))
print_cmds(advanced_cmds, adv_usage)

logger.error(
_(
"""
logger.error(_("""
Options:
-R dir
--no-network-cache
--help or -?

Environment:
PKG_IMAGE
PKG_SUCCESS_ON_NOP"""
)
)
PKG_SUCCESS_ON_NOP"""))
else:
# Display the full list of subcommands.
logger.error(
_(
"""\
Usage: pkg [options] command [cmd_options] [operands]"""
)
)
logger.error(_("""\
Usage: pkg [options] command [cmd_options] [operands]"""))
logger.error(_("The following commands are supported:"))
logger.error(
_(
"""
logger.error(_("""
Package Information : list search info contents
Package Transitions : update install uninstall
history exact-install apply-hot-fix
Expand All @@ -653,9 +637,7 @@ def print_cmds(cmd_list, cmd_dic):
property set-property add-property-value
unset-property remove-property-value
Miscellaneous : image-create dehydrate rehydrate clean
For more info, run: pkg help <command>"""
)
)
For more info, run: pkg help <command>"""))
sys.exit(retcode)


Expand Down Expand Up @@ -997,31 +979,23 @@ def __display_plan(api_inst, verbose, noexecute, op=None):
if api_inst.is_liveroot and not api_inst.is_active_liveroot_be:
# Warn the user since this isn't likely what they wanted.
if plan.new_be:
logger.warning(
_(
"""\
logger.warning(_("""\

******************************************************************************
WARNING: The boot environment being modified is not the active one.
Changes made in the active BE will not be reflected on the next boot.
******************************************************************************

"""
)
)
"""))
else:
logger.warning(
_(
"""\
logger.warning(_("""\

******************************************************************************
WARNING: The boot environment being modified is not the active one.
Changes made will not be reflected on the next boot.
******************************************************************************

"""
)
)
"""))

# a = change(!!!) (due to fix or mediator/variant/facet)
# c = update
Expand Down Expand Up @@ -2109,12 +2083,12 @@ def __api_plan_exception(op, noexecute, verbose, api_inst):
return e.lix_exitrv
if e_type == api_errors.IpkgOutOfDateException:
msg(
_(
"""\
_("""\
WARNING: pkg(7) appears to be out of date, and should be updated before
running {op}. Please update pkg(7) by executing 'pkg install
pkg:/package/pkg' as a privileged user and then retry the {op}."""
).format(**locals())
pkg:/package/pkg' as a privileged user and then retry the {op}.""").format(
**locals()
)
)
return EXIT_OOPS
if e_type == api_errors.NonLeafPackageException:
Expand Down Expand Up @@ -2249,6 +2223,10 @@ def __api_plan(
if _stage != API_STAGE_DEFAULT:
kwargs["pubcheck"] = False

# display full solver rejection trees in error messages
if _verbose > 0:
DebugValues["plan-errors"] = "True"

# display plan debugging information
if _verbose > 2:
DebugValues["plan"] = "True"
Expand Down Expand Up @@ -2904,16 +2882,12 @@ def _emit_error_general_cb(
if selected_type and err["errtype"] not in selected_type:
return False

emsg(
_(
"""
emsg(_("""
To add a publisher using this repository, execute the following command as a
privileged user:

pkg set-publisher -g {0} <publisher>
"""
).format(add_info["repo_uri"])
)
""").format(add_info["repo_uri"]))
elif "info" in err:
msg(err["info"])
elif "reason" in err:
Expand Down Expand Up @@ -3894,6 +3868,8 @@ def set_mediator(
cmd=op,
)

if verbose > 0:
DebugValues["plan-errors"] = "True"
if verbose > 2:
DebugValues["plan"] = "True"

Expand Down Expand Up @@ -4004,6 +3980,8 @@ def unset_mediator(

if not pargs:
usage(_("at least one mediator must be specified"), cmd=op)
if verbose > 0:
DebugValues["plan-errors"] = "True"
if verbose > 2:
DebugValues["plan"] = "True"

Expand Down Expand Up @@ -4968,15 +4946,9 @@ def list_contents(api_inst, args):
if invalid_atype == action_types:
usage(_("no valid action types specified"), cmd=subcommand)
elif invalid_atype:
emsg(
_(
"""\
emsg(_("""\
WARNING: invalid action types specified: {0}
""".format(
",".join(invalid_atype)
)
)
)
""".format(",".join(invalid_atype))))

check_attrs(attrs, subcommand)

Expand Down Expand Up @@ -5108,12 +5080,8 @@ def list_contents(api_inst, args):
rval = EXIT_OK
if attr_match and manifests and not found:
rval = EXIT_OOPS
logger.error(
_(
"""\
pkg: contents: no matching actions found in the listed packages"""
)
)
logger.error(_("""\
pkg: contents: no matching actions found in the listed packages"""))

if manifests and rval == EXIT_OK:
displayed_results = display_contents_results(
Expand Down Expand Up @@ -5169,22 +5137,14 @@ def list_contents(api_inst, args):
if manifests:
logger.error("")
if local:
logger.error(
_(
"""\
logger.error(_("""\
pkg: contents: no packages matching the following patterns you specified are
installed on the system. Try specifying -r to query remotely:"""
)
)
installed on the system. Try specifying -r to query remotely:"""))
elif remote:
logger.error(
_(
"""\
logger.error(_("""\
pkg: contents: no packages matching the following patterns you specified were
found in the catalog. Try relaxing the patterns, refreshing, and/or
examining the catalogs:"""
)
)
examining the catalogs:"""))
logger.error("")
for p in notfound:
logger.error(" {0}".format(p))
Expand Down Expand Up @@ -6524,7 +6484,7 @@ def attach_linked(
api_inst.progresstracker.set_major_phase(
api_inst.progresstracker.PHASE_UTILITY
)
(rv, err, p_dict) = api_inst.attach_linked_child(
rv, err, p_dict = api_inst.attach_linked_child(
lin,
li_path,
li_props,
Expand Down Expand Up @@ -7914,13 +7874,9 @@ def handle_errors(func, non_wrap_print=True, *args, **kwargs):
except api_errors.InvalidCatalogFile as __e:
if _api_inst:
_api_inst.abort(result=RESULT_FAILED_STORAGE)
logger.error(
_(
"""
logger.error(_("""
An error was encountered while attempting to read image state information
to perform the requested operation. Details follow:\n\n{0}"""
).format(__e)
)
to perform the requested operation. Details follow:\n\n{0}""").format(__e))
__ret = EXIT_OOPS
except api_errors.InvalidDepotResponseException as __e:
if _api_inst:
Expand Down
Loading
Loading