Skip to content

Commit

Permalink
update tool version
Browse files Browse the repository at this point in the history
  • Loading branch information
cfig committed Sep 15, 2024
1 parent bdadd58 commit 545c050
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bbootimg/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
19 changes: 12 additions & 7 deletions integrationTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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():
Expand All @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion lazybox/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
11 changes: 9 additions & 2 deletions lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand All @@ -147,4 +154,4 @@ makeTar("%s", "%s")
companion object {
private val log = LoggerFactory.getLogger(SysInfo::class.java)
}
}
}

0 comments on commit 545c050

Please sign in to comment.