Commit Graph

7 Commits

Author SHA1 Message Date
SzuWei Lin
bdcbc69cb0 gsi_util: output verbose logs in debug mode only
Each Mounter outputs an error log if it cannot prepare a file,
but it could be not really an error sometimes. For example,
some files in sepolicy_checker are optional, and could got
the log:

  Fail to prepare file: vendor/etc/selinux/vendor_sepolicy.cil

The patch changes these logs to be 'INFO' level.

This patch also changes run_command() to output logs with 'ERROR'
level when log_stdout or log_stderr is True.

Also, the patch changes it to only output stack dump in debug mode.

Bug: 74507280
Bug: 70588453
Test: ./run_test.py
Test: './gsi_util.py dump --system system.img'
   and the system.img doesn't exist.
Test: './gsi_util.py check_compat --vendor adb --system adb'
   and vendor/etc/selinux/vendor_sepolicy.cil isn't in the device.

Change-Id: Ibdcb6df459f88ace9159f1a979f280452454a84f
2018-03-19 15:12:29 +08:00
Bowgo Tsai
b43a5c9f48 gsi_util: removing 'gsi_util hello'
The 'gsi_util hello' is used for a demo initially.
It should be removed as it's not a practical command.

Bug: None
Test: `gsi_util --help`, checks hello command is gone
Change-Id: I8578db27c1ddbc16bba0a1357207ba77bf13390d
2018-01-18 17:19:52 +08:00
SzuWei Lin
a30d9ef26b gsi_util: adding check_compat subcommand
'check_compat' command can check the compatibility between
system and vendor image, which can be any source supported by
mounters, ex. image file, folder or adb.

Uses following command for the detail:

    $ ./gsu_util.py check_compat --help

The patch also includes a 'checker' framework. There is only
one checker 'VintfChecker' at this time. VintfChecker uses a
host tool, 'checkvintf', to check the compatibility.

Bug: 70253825
Test: check_compat with different mounters
Change-Id: I459b4cbd38465c0058087b4c68bca66e491c940e
2018-01-15 17:35:58 +08:00
SzuWei Lin
18d5e919fe gsi_util: adding dump subcommand
'dump' command can dump information from given image, which could
be a image file, folder or device by adb.

Use $./gsi_util.py dump --help for the detail.

The patch also includes a "dump" framework, to implement some
dumpers to dump information. This patch also includes PropDumper to
dump information from property files, and XmlDumper to dump
information from XML files.

There is an initial dump info list in dump_info_list.py.
Use subcommand 'list_dump' could output the list.

Usually using Dumper is enough to dump information. dump.py is an
example to use Dumper.

Bug: 70253764
Test: dump from different mounter
Change-Id: I7c05f8f24d44d3c7429f2c428963f64191f49a53
2018-01-15 16:01:14 +08:00
SzuWei Lin
e3658bd0c1 gsi_util: adding pull subcommand
'pull' command can pull a file from an image file, folder or adb.

The patch includes a "mounter" framework to implement different
source of the system/vendor image. And also includes several
"mounter" implementations.

CompositeMounter integrates all possible mounter implementations.
Usually just using CompositeMounter is enough. With
CompositeMounter, you could access files in different target
with an unique interface, such files in an image file, a folder or
a device with an unique interface. pull.py is an basic example to
use CompositeMounter.

Here are some example to use 'pull' command:

$ ./gsi_util.py pull --system adb:AB0123456789 /system/manifest.xml
$ ./gsi_util.py pull --vendor adb /vendor/compatibility_matrix.xml
$ ./gsi_util.py pull --system system.img /system/build.prop
$ ./gsi_util.py pull --system my/out/folder/system /system/build.prop

As current implementation, accessing files in a the image file requires
root permission. gsi_util will need user to input the password for sudo.

For the detail usage, reference:

$ ./gsi_util.py pull --help

Bug: 71029338
Test: pull /system/build.prop from different targets
Change-Id: Iaeb6352c14ebc24860ed79fc30edd314e225aef9
2018-01-12 11:48:50 +08:00
Bowgo Tsai
b510ae3a33 gsi_util: adding flash_gsi subcommand
This change implements the flash_gsi subcommand:
  1. Erase userdata/cache partition
  2. Erase metadata partition (optional)
  3. Flash generic system image
  4. Disable Android Verified Boot (optional)
  5. Reboot the device

Bug: 70253882
Test: make gsi_util
Test: gsi_util flash_gsi
Test: gsi_util --debug flash_gsi --image system.img
Change-Id: I552c04aaf227c6fca2e5c3caab26d713e2f6f5d0
2018-01-03 12:44:10 +08:00
Bowgo Tsai
73fec9375d gsi_util: adding subcommand framework
With this CL, new command can be easily added:
  1. Add a new file: gsi/gsi_util/gsi_util/commands/hello.py
     And implements a function to register parsers into gsi_util's main parser.

     def setup_command_args(subparsers)

  2. In gsi/gsi_util/gsi_util.py, add the new command into GsiUtil():
     _COMMANDS = ['hello']

Bug: 70588453
Test: make gsi_util
Test: gsi_util --help
Test: gsi_util hello --foo
Test: gsi_util --debug hello --bar

Change-Id: I54fa6d1dea5afed724d9ac4a99f88bf78da82732
2017-12-28 17:11:40 +08:00