Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 1084041 - Remove files after applying FOTA r=gsvelto #409

Merged
merged 1 commit into from Jan 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions tools/update-tools/build-flash-fota.py
Expand Up @@ -46,6 +46,8 @@ def build_flash_fota(args):
builder.fota_dirs = args.fota_dirs.split(' ')
builder.fota_files = [line.rstrip() for line in open(args.fota_files, 'r')]

builder.fota_sdcard = args.fota_sdcard or "/sdcard"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Do you really need this? You're already setting /sdcard as the default path in the add_argument() call below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've seen some devices where the device tree configuration may be wrong, so this is not 100% required, but it makes sure we won't generate improper paths.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's leave it in then.


builder.fota_check_device_name = args.fota_check_device_name
builder.fota_check_gonk_version = args.fota_check_gonk_version
builder.system_dir = args.system_dir
Expand Down Expand Up @@ -84,6 +86,9 @@ def main():
fota_group.add_argument("--fota-files", dest="fota_files",
required=False, default="",
help="file containing list of files in /system to include")
fota_group.add_argument("--fota-sdcard", dest="fota_sdcard",
required=False, default="/sdcard",
help="sdcard mountpoint in recovery mode (RECOVERY_EXTERNAL_STORAGE)")

fota_checks_group = parser.add_argument_group("fota_checks_group")
fota_checks_group.add_argument("--fota-check-device-name", dest="fota_check_device_name",
Expand Down
20 changes: 20 additions & 0 deletions tools/update-tools/update_tools.py
Expand Up @@ -937,6 +937,21 @@ def AssertDeviceOrModel(self, device):
self.generator.script.append(cmd)
self.generator.Print("Device is compatible")

def CleanUpdateFiles(self):
"""
Cleaning all the temporary files used for update
"""

# delete_recursive() function in edify can handle files and
# directories.
staleUpdateFiles = [
os.path.join("/data", "local", "b2g-updates"),
os.path.join(self.fota_sdcard, "updates", "fota")
]
self.generator.Print("Cleaning FOTA files")
self.generator.DeleteFilesRecursive(staleUpdateFiles)
self.generator.Print("FOTA files removed")

def Umount(self, mount_point):
"""
Unmounting a mount point. We cannot do it against a device directly.
Expand Down Expand Up @@ -1087,6 +1102,11 @@ def deprecated_DeleteFilesRecursive(objects):
self.generator.Print("Setting file permissions")
self.build_permissions()

cmd = ('set_progress(0.9);')
self.generator.script.append(self.generator._WordWrap(cmd))
self.generator.Print("Cleaning update files")
self.CleanUpdateFiles()

if self.fota_type == 'partial':
cmd = ('else ui_print("Restoring previous stale update."); endif;')
self.generator.script.append(self.generator._WordWrap(cmd))
Expand Down