Ejemplo n.º 1
0
    def __init__(self):
        super(BootstrapArgParser, self).__init__(
            description="Bootstrap a variant config, based on an existing base "
            "config, or based on another variant config")
        requiredOpts = self.add_argument_group("Required args")
        requiredOpts.add_argument(
            '-b',
            '--base',
            required=True,
            action="store",
            help="base config code to use, in the format A.B")
        requiredOpts.add_argument(
            '-v',
            '--variant',
            required=True,
            action="store",
            help="variant config code to use, in the format A.B.C")
        #requiredOpts.add_argument('-v', '--vendor', required = True, action = "store")
        #requiredOpts.add_argument('-m', '--model', required = True, action = "store")

        optionalOpts = self.add_argument_group("Optional args")
        optionalOpts.add_argument(
            '--learn-settings',
            action="store_true",
            help=
            "Learn settings from a connected device, and set in the bootstrapped config file"
        )

        optionalOpts.add_argument(
            "--learn-props",
            action="store_true",
            help=
            "Learn update.property from a connected device, and set in the bootstrapped config file"
        )

        optionalOpts.add_argument(
            "--learn-partitions",
            action="store_true",
            help=
            "Learn information about partitions on device, and set in the bootstrapped config file"
        )

        optionalOpts.add_argument(
            "--learn-imgs",
            action="store_true",
            help=
            "Pull recovery and boot img from the device, and set in the bootstrapped config file"
        )

        optionalOpts.add_argument(
            "-f",
            "--force",
            required=False,
            action="store_true",
            help="Overwrite an existing variant bootstrap directory if exists")

        self.deviceDir = InceptionConstants.VARIANTS_DIR
        self.baseDir = InceptionConstants.BASE_DIR
        self.configTreeParser = ConfigTreeParser(
            DotIdentifierResolver([self.deviceDir, self.baseDir]))
Ejemplo n.º 2
0
    def __init__(self, description="Make mode cmd"):
        super(MakeArgParser, self).__init__(description=description)

        targetOpts = self.add_mutually_exclusive_group(required=True)
        targetOpts.add_argument(
            '-v',
            '--variant',
            action="store",
            help="variant config code to use, in the format A.B.C")
        targetOpts.add_argument(
            '-c',
            '--config',
            action='store',
            help=
            "Explicit path to config to use instead of passing variant code, requires --output"
        )

        optionalOpts = self.add_argument_group("Optional opts")
        optionalOpts.add_argument("-o",
                                  "--output",
                                  action="store",
                                  help="Override default output path")
        optionalOpts.add_argument("-k",
                                  "--keep-work",
                                  action="store_true",
                                  help="Don't delete work dir when finished")
        optionalOpts.add_argument(
            '--learn-settings',
            action="store_true",
            help=
            "Learn settings from a connected device, and use in generated update package"
        )

        self.deviceDir = InceptionConstants.VARIANTS_DIR
        self.baseDir = InceptionConstants.BASE_DIR
        identifierResolver = DotIdentifierResolver(
            [self.deviceDir, self.baseDir])
        self.configTreeParser = ConfigTreeParser(identifierResolver)
Ejemplo n.º 3
0
    def __init__(self, description="Make mode cmd"):
        super(MakeArgParser, self).__init__(description=description)
        self.makeables = [
            "package", "boot", "cache", "recovery", "dnx", "update",
            "installer", "odin", "extras"
        ]

        targetOpts = self.add_mutually_exclusive_group(required=True)
        targetOpts.add_argument(
            '-v',
            '--variant',
            action="store",
            help="variant config code to use, in the format A.B.C")
        targetOpts.add_argument(
            '-c',
            '--config',
            action='store',
            help=
            "Explicit path to config to use instead of passing variant code, requires --output"
        )

        optionalOpts = self.add_argument_group("Optional opts")
        optionalOpts.add_argument("-o",
                                  "--output",
                                  action="store",
                                  help="Override default output path")
        optionalOpts.add_argument(
            "-d",
            "--keep-dirs",
            action="store_true",
            help=
            "Keep output hierarchy when default output path is overriden. Default is True, requires -o"
        )
        optionalOpts.add_argument("-w",
                                  "--keep-work",
                                  action="store_true",
                                  help="Don't delete work dir when finished")
        optionalOpts.add_argument(
            "-O",
            "--keep-output",
            action="store_true",
            help=
            "Don't clear output dir before make, will replace files with existing names."
        )
        optionalOpts.add_argument(
            '--learn-settings',
            action="store_true",
            help=
            "Learn settings from a connected device, and use in generated update package"
        )

        configQueryOpts = self.add_argument_group("Config query options")
        configQueryOpts.add_argument("--config-list-keys",
                                     action="store_true",
                                     help="List available signing keys")

        makeOpts = self.add_argument_group("General Make opts")

        for makeable in self.makeables:
            formattedMakeableName = makeable[0].upper() + makeable[1:]
            makeOpts.add_argument("--only-%s" % makeable,
                                  action="store_true",
                                  help="Make only %s " % formattedMakeableName)

            makeableGp = self.add_argument_group("%s Maker Opts" %
                                                 formattedMakeableName)
            flagGp = makeableGp.add_mutually_exclusive_group(required=False)
            flagGp.add_argument("--%s" % makeable,
                                dest=makeable,
                                action="store_true",
                                help="Make %s, overrides config" % makeable,
                                default=None)
            flagGp.add_argument("--no-%s" % makeable,
                                dest=makeable,
                                action="store_false",
                                help="Don't make %s, overrides config " %
                                makeable,
                                default=None)

            if makeable == "recovery":
                makeableGp.add_argument("--recovery-sign",
                                        action="store",
                                        metavar="keys_name",
                                        help="Recovery signing keys name")
                makeableGp.add_argument("--recovery-no-sign",
                                        action="store_true")
                makeableGp.add_argument("--recovery-img", action="store")
            elif makeable == "update":
                makeableGp.add_argument(
                    "--update-no-reboot",
                    action="store_true",
                    help="Don't reboot after update script executes")
                makeableGp.add_argument("--update-sign",
                                        action="store",
                                        metavar="keys_name",
                                        help="Update signing keys name")

                makeableGp.add_argument("--update-apps",
                                        action="store_true",
                                        help="Make apps")
                makeableGp.add_argument("--update-no-apps",
                                        action="store_true",
                                        help="Don't make apps")

                makeableGp.add_argument("--update-settings",
                                        action="store_true",
                                        help="Make settings")
                makeableGp.add_argument("--update-no-settings",
                                        action="store_true",
                                        help="Don't make Settings")

                makeableGp.add_argument("--update-network",
                                        action="store_true",
                                        help="Make network")
                makeableGp.add_argument("--update-no-network",
                                        action="store_true",
                                        help="Don't make network")

                makeableGp.add_argument("--update-databases",
                                        action="store_true",
                                        help="Make databases")
                makeableGp.add_argument("--update-no-databases",
                                        action="store_true",
                                        help="Don't make databases")

                makeableGp.add_argument("--update-adb",
                                        action="store_true",
                                        help="Make adb")
                makeableGp.add_argument("--update-no-adb",
                                        action="store_true",
                                        help="Don't make adb")

                makeableGp.add_argument("--update-property",
                                        action="store_true",
                                        help="Make property")
                makeableGp.add_argument("--update-no-property",
                                        action="store_true",
                                        help="Don't make property")

                makeableGp.add_argument("--update-busybox",
                                        action="store_true",
                                        help="Make busybox")
                makeableGp.add_argument("--update-no-busybox",
                                        action="store_true",
                                        help="Don't make busybox")

                makeableGp.add_argument("--update-restore_stock_recovery",
                                        action="store_true",
                                        help="Restore stock recovery")
                makeableGp.add_argument("--update-no-restore_stock_recovery",
                                        action="store_true",
                                        help="Don't restore stock recovery")

                makeableGp.add_argument(
                    "--update-root",
                    metavar="method_name",
                    action="store",
                    help="Root the device with the specified root method")
                makeableGp.add_argument("--update-no-root",
                                        action="store_true",
                                        help="Don't root the device")

                makeableGp.add_argument("--update-no-sign",
                                        action="store_true")
                makeableGp.add_argument("--update-no-wipe",
                                        action="store_true")
                makeableGp.add_argument("--update-wipe", action="store_true")
                makeableGp.add_argument("--update-verbose",
                                        action="store_true")
                makeableGp.add_argument("--update-no-verbose",
                                        action="store_true")

        self.deviceDir = InceptionConstants.VARIANTS_DIR
        self.baseDir = InceptionConstants.BASE_DIR
        identifierResolver = DotIdentifierResolver(
            [self.deviceDir, self.baseDir])
        self.configTreeParser = ConfigTreeParser(identifierResolver)