class RunpathUtilOptionsBase(PackagerOptionsBase):  # pylint: disable=W0223
    chrpath_path: Optional[str] = RunArgOption(
        '--chrpath-path',
        metavar='TOOLPATH',
        group=PackagerOptionsBase.tool_args,
        action='store',
        opt_type=str,
        default=None,
        help='Path to chrpath tool to use')
    cmake_path: Optional[str] = RunArgOption(
        '--cmake-path',
        metavar='TOOLPATH',
        group=PackagerOptionsBase.tool_args,
        action='store',
        opt_type=str,
        default=None,
        help='Path to cmake tool to use')

    set_origin_flag: Optional[bool] = RunArgOption(
        '--set-origin-flag',
        metavar='BOOL',
        action='store',
        opt_type=bool,
        default=None,
        help='Whether or not to set DF_ORIGIN flag')
Example #2
0
class StripUtilOptionsBase(ElfInfoUtilOptionsBase):  # pylint: disable=W0223
    strip_path: Optional[str] = RunArgOption(
        '--strip-path',
        metavar='TOOLPATH',
        group=PackagerOptionsBase.tool_args,
        action='store',
        opt_type=str,
        default=None,
        help='Path to strip tool to use')

    preserve_libs: bool = RunArgOption(
        '--preserve-unneeded-librefs',
        action='store_true',
        default=False,
        help='Do not remove DT_NEEDED entries for unneeded libraries')
class TarUtilOptionsBase(PackagerOptionsBase):  # pylint: disable=W0223
    tar_path: Optional[str] = RunArgOption('--tar-path',
                                           metavar='TOOLPATH',
                                           group=PackagerOptionsBase.tool_args,
                                           action='store',
                                           opt_type=str,
                                           default=None,
                                           help='Path to tar tool to use')
class LibDirectiveOptionsBase(PackagerOptionsBase):  # pylint: disable=W0223
    target_platform: Optional[str] = RunArgOption('--target-platform',
                                                  metavar='PLATFORM',
                                                  action='store',
                                                  opt_type=str,
                                                  default=None)
    target_platform_variant: Optional[str] = RunArgOption(
        '--target-platform-variant',
        metavar='VARIANT',
        action='store',
        opt_type=str,
        default=None)

    permissive_liballowlist: MutableSequence[str] = RunArgOption(
        '--permissive-lib-directives',
        action='store_true',
        default=False,
        help='Package libraries for which no directive is specified')
Example #5
0
class StripUtilOptions(StripUtilOptionsBase):
    output_path: Optional[str] = RunArgOption(
        '-o',
        '--output',
        metavar='PATH',
        action='store',
        default=None,
        help='Place stripped output into PATH')

    libraries: MutableSequence[str] = RunArgOption(
        metavar='FILE',
        nargs='+',
        action='store',
        opt_type=str,
        default=None,
        help='ELF binaries to strip')

    def create_empty_argparser(self) -> argparse.ArgumentParser:
        return argparse.ArgumentParser(
            description='Strip unneeded symbols and library imports',
            allow_abbrev=False)
class RunpathUtilOptions(RunpathUtilOptionsBase):
	output_path: Optional[str] = RunArgOption(
		'-o', '--output', metavar='PATH',
		action='store', default=None,
		help='Place stripped output into PATH'
	)

	runpath: str = RunArgOption(
		metavar='RUNPATH',
		action='store', default=None
	)
	libraries: MutableSequence[str] = RunArgOption(
		metavar='FILE', nargs='+',
		action='store', opt_type=str, default=None
	)

	def create_empty_argparser(self) -> argparse.ArgumentParser:
		return argparse.ArgumentParser(
			description='Set RUNPATH and set DF_ORIGIN if needed',
			allow_abbrev=False
		)
class ElfInfoUtilOptionsBase(PackagerOptionsBase):  # pylint: disable=W0223
    ldd_path: Optional[str] = RunArgOption('--ldd-path',
                                           metavar='TOOLPATH',
                                           group=PackagerOptionsBase.tool_args,
                                           action='store',
                                           opt_type=str,
                                           default=None,
                                           help='Path to ldd tool to use')
    readelf_path: Optional[str] = RunArgOption(
        '--readelf-path',
        metavar='TOOLPATH',
        group=PackagerOptionsBase.tool_args,
        action='store',
        opt_type=str,
        default=None,
        help='Path to readelf tool to use')
    objdump_path: Optional[str] = RunArgOption(
        '--objdump-path',
        metavar='TOOLPATH',
        group=PackagerOptionsBase.tool_args,
        action='store',
        opt_type=str,
        default=None,
        help='Path to objdump tool to use')
class PackagerOptionsBase(RunOptsContainer):  # pylint: disable=W0223
    ipath_args = RunArgGroup('iRODS paths')

    irods_install_prefix: str = RunArgOption('--irods-install-prefix',
                                             metavar='PATH',
                                             group=ipath_args,
                                             action='store',
                                             opt_type=str,
                                             default='/usr')
    irods_package_prefix: str = RunArgOption('--irods-package-prefix',
                                             metavar='PATH',
                                             group=ipath_args,
                                             action='store',
                                             opt_type=str,
                                             default='/usr')
    irods_home_dir: str = RunArgOption('--irods-home-dir',
                                       metavar='PATH',
                                       group=ipath_args,
                                       action='store',
                                       opt_type=str,
                                       default='/var/lib/irods',
                                       help='iRODS home directory')
    irods_scripts_dir: Optional[str] = RunArgOption(
        '--irods-scripts-dir',
        metavar='PATH',
        group=ipath_args,
        action='store',
        opt_type=str,
        default=None,
        help='iRODS scripts directory')

    LD_LIBRARY_PATH: MutableSequence[str] = RunArgOption(
        '--ld_library_path',
        metavar='PATH',
        action='append',
        opt_type=str,
        default=[],
        help='Directory to prepend to LD_LIBRARY_PATH')

    sharedlib_suffixes: MutableSequence[str] = RunArgOption(
        '--sharedlib-suffix',
        metavar='EXT',
        action='append',
        opt_type=str,
        default=['.so'])

    cmake_tmpdir: str = RunArgOption('--cmake-tmpdir',
                                     metavar='PATH',
                                     action='store',
                                     opt_type=str,
                                     default=tempfile.gettempdir())

    gnuinstalldirs_args = RunArgGroup('GNUInstallDirs')

    tool_args = RunArgGroup('Tool paths')

    verbosity_args = RunArgGroup('Output verbosity')
    verbosity: int = RunOption(opt_type=int, default=0)

    _quiet_arg = RunWhininessArg('-q',
                                 '--quiet',
                                 group=verbosity_args,
                                 action=DecrementAction,
                                 dest=verbosity,
                                 help='Decrease verbosity')
    _verbose_arg = RunWhininessArg('-v',
                                   '--verbose',
                                   group=verbosity_args,
                                   action=IncrementAction,
                                   dest=verbosity,
                                   help='Increase verbosity')
Example #9
0
class PackagerOptions(StripUtilOptionsBase, LibDirectiveOptionsBase,
                      RunpathUtilOptionsBase, TarUtilOptionsBase):
    output_path: Optional[str] = RunArgOption('-o',
                                              '--output',
                                              metavar='PATH',
                                              action='store',
                                              default=None,
                                              help='Create tarball at PATH')

    cmake_install_prefix: str = RunArgOption(
        '--cmake-install-prefix',
        metavar='PATH',
        group=PackagerOptionsBase.gnuinstalldirs_args,
        action='store',
        opt_type=str,
        default='/usr',
        help='CMAKE_INSTALL_PREFIX')
    install_bindir: str = RunArgOption(
        '--cmake-install-bindir',
        metavar='PATH',
        group=PackagerOptionsBase.gnuinstalldirs_args,
        action='store',
        opt_type=str,
        default='bin',
        help='CMAKE_INSTALL_BINDIR')
    install_sbindir: str = RunArgOption(
        '--cmake-install-sbindir',
        metavar='PATH',
        group=PackagerOptionsBase.gnuinstalldirs_args,
        action='store',
        opt_type=str,
        default='sbin',
        help='CMAKE_INSTALL_SBINDIR')
    install_libdir: str = RunArgOption(
        '--cmake-install-libdir',
        metavar='PATH',
        group=PackagerOptionsBase.gnuinstalldirs_args,
        action='store',
        opt_type=str,
        default='lib',
        help='CMAKE_INSTALL_LIBDIR')

    irods_bindir: str = RunArgOption('--irods-install-bindir',
                                     metavar='PATH',
                                     group=PackagerOptionsBase.ipath_args,
                                     action='store',
                                     opt_type=str,
                                     default='bin')
    irods_sbindir: str = RunArgOption('--irods-install-sbindir',
                                      metavar='PATH',
                                      group=PackagerOptionsBase.ipath_args,
                                      action='store',
                                      opt_type=str,
                                      default='sbin')
    irods_libdir: str = RunArgOption('--irods-install-libdir',
                                     metavar='PATH',
                                     group=PackagerOptionsBase.ipath_args,
                                     action='store',
                                     opt_type=str,
                                     default='lib')
    irods_plugsdir: str = RunArgOption('--irods-pluginsdir',
                                       metavar='PATH',
                                       group=PackagerOptionsBase.ipath_args,
                                       action='store',
                                       opt_type=str,
                                       default='lib/irods/plugins')

    irods_runtime_libs: Sequence[str] = RunArgOption('--irods-runtime-lib',
                                                     metavar='FILE',
                                                     action='append',
                                                     opt_type=str,
                                                     default=[])
    libcxx_libpaths: Sequence[str] = RunArgOption('--libcxx-libpath',
                                                  metavar='FILE',
                                                  action='append',
                                                  opt_type=str,
                                                  default=[])

    build_dir: str = RunArgOption('--build-dir',
                                  metavar='PATH',
                                  action='store',
                                  opt_type=str,
                                  default=os.getcwd())
    work_dir: Optional[str] = RunArgOption('--work-dir',
                                           metavar='PATH',
                                           action='store',
                                           opt_type=str,
                                           default=None)

    tarball_root_dir_name: Optional[str] = RunArgOption(
        '--tarball-root-dir-name',
        metavar='DIRNAME',
        action='store',
        opt_type=str,
        default=None)

    install_components: Sequence[str] = RunArgOption('--install-component',
                                                     metavar='COMPONENT',
                                                     action='append',
                                                     opt_type=str,
                                                     default=[])
    script_icommands: Sequence[str] = RunArgOption('--script-icommand',
                                                   metavar='NAME',
                                                   action='append',
                                                   opt_type=str,
                                                   default=[])

    def create_empty_argparser(self) -> argparse.ArgumentParser:
        return argparse.ArgumentParser(
            description='Package icommands userspace tarball',
            allow_abbrev=False)