-
Notifications
You must be signed in to change notification settings - Fork 17
/
incremental.py
30 lines (30 loc) · 959 Bytes
/
incremental.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (C) 2020 Dhruv Gera
import os
print("Incrementals are made using target zips which are found under out/target/product/device/obj/PACKAGING/target_files_intermediates")
old_zip=input("Enter old target file path: ")
new_zip=input("Enter new target file path: ")
print("Generating incremental package")
try:
filecheck=open("generator.sh")
filecheck.close()
except:
code="./build/make/tools/releasetools/ota_from_target_files --block -i old new incremental.zip"
saveFile2=open("generator.sh",'w')
saveFile2.write(str(code))
saveFile2.close()
fin = open("generator.sh", "rt")
data = fin.read()
data = data.replace('old', old_zip)
fin.close()
fin = open("generator.sh", "wt")
fin.write(data)
fin.close()
fin = open("generator.sh", "rt")
data = fin.read()
data = data.replace('new', new_zip)
fin.close()
fin = open("generator.sh", "wt")
fin.write(data)
fin.close()
os.system("chmod a+x generator.sh")
os.system("bash generator.sh")