diff --git a/bbootimg/build.gradle.kts b/bbootimg/build.gradle.kts index bc7a469..9e7c3e7 100644 --- a/bbootimg/build.gradle.kts +++ b/bbootimg/build.gradle.kts @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "2.0.0" + kotlin("jvm") version "2.0.20" application } diff --git a/integrationTest.py b/integrationTest.py index adc55e2..7af527d 100755 --- a/integrationTest.py +++ b/integrationTest.py @@ -40,8 +40,8 @@ def deleteIfExists(inFile): # log.warning("Exception in cleaning up %s" % inFile) # time.sleep(3) -def cleanUp(): - log.info("clean up ...") +def cleanUp(msg = None): + log.info("cleanUp(%s) ..." % msg) shutil.rmtree("build/unzip_boot", ignore_errors = True) [deleteIfExists(item) for item in [ "boot.img", "boot.img.clear", "boot.img.google", "boot.img.signed", "boot.img.signed2", @@ -56,7 +56,7 @@ def cleanUp(): "vendor_boot-debug.img", "vendor_boot-debug.img.clear", "vendor_boot-debug.img.google" ]] def verifySingleJson(jsonFile, func = None): - log.info("executing %s ..." % jsonFile) + log.info("verifySingleJson(%s)..." % jsonFile) imgDir = os.path.dirname(jsonFile) verifyItems = json.load(open(jsonFile)) for k, v in verifyItems["copy"].items(): @@ -73,16 +73,21 @@ def verifySingleJson(jsonFile, func = None): gradleWrapper = "gradlew.bat" else: gradleWrapper = "./gradlew" + log.info("verifySingleJson::unpack") subprocess.check_call(gradleWrapper + " unpack", shell = True) if func: + log.info("verifySingleJson::func") func() + log.info("verifySingleJson::pack") subprocess.check_call(gradleWrapper + " pack", shell = True) + log.info("verifySingleJson::pack done") for k, v in verifyItems["hash"].items(): log.info("%s : %s" % (k, v)) unittest.TestCase().assertIn(hashFile(k), v.split()) try: subprocess.check_call(gradleWrapper + " clear", shell = True) except Exception as e: + log.info("verifySingleJson: clear failed, ignore") pass def verifySingleDir(inResourceDir, inImageDir): @@ -91,19 +96,19 @@ def verifySingleDir(inResourceDir, inImageDir): log.info("Enter %s ..." % os.path.join(resDir, imgDir)) jsonFiles = glob.glob(os.path.join(resDir, imgDir) + "/*.json") for jsonFile in jsonFiles: - cleanUp() + cleanUp("json_start") verifySingleJson(jsonFile) - cleanUp() + cleanUp("json_end") pyFiles = glob.glob(os.path.join(resDir, imgDir) + "/*.py") for pyFile in pyFiles: - cleanUp() + cleanUp("py_start") log.warning("calling %s" % pyFile) if sys.platform == "win32": theCmd = "python " + pyFile else: theCmd = pyFile subprocess.check_call(theCmd, shell = True) - cleanUp() + cleanUp("py_end") log.info("Leave %s" % os.path.join(resDir, imgDir)) def decompressXZ(inFile, outFile): diff --git a/lazybox/build.gradle.kts b/lazybox/build.gradle.kts index 48ab0e4..cfab236 100644 --- a/lazybox/build.gradle.kts +++ b/lazybox/build.gradle.kts @@ -8,7 +8,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "2.0.0" + kotlin("jvm") version "2.0.20" application } diff --git a/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt b/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt index d776583..59c5518 100644 --- a/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt +++ b/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt @@ -14,6 +14,7 @@ import java.util.* import kotlin.io.path.Path import kotlin.io.path.deleteIfExists import kotlin.io.path.writeText +import java.io.ByteArrayOutputStream class SysInfo { private fun runAndWrite(cmd: String, outStream: OutputStream, check: Boolean) { @@ -138,7 +139,13 @@ makeTar("%s", "%s") Files.move(Paths.get("$prefix/device-tree"), Paths.get("$prefix/device_tree")) if (theSlot.isNotBlank()) { - "adb pull /dev/block/by-name/vbmeta$theSlot".check_call(prefix) + val uid = ByteArrayOutputStream().use { + runAndWrite("adb shell id -u", it, false) + it + }.toString(Charsets.UTF_8).trim() + if (uid != "2000") { + "adb pull /dev/block/by-name/vbmeta$theSlot".check_call(prefix) + } } makeTar("sysinfo.tar.xz", "sysinfo") File("sysinfo").deleteRecursively() @@ -147,4 +154,4 @@ makeTar("%s", "%s") companion object { private val log = LoggerFactory.getLogger(SysInfo::class.java) } -} \ No newline at end of file +}