Fix update failure of rpk package 07/260107/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Fri, 18 Jun 2021 11:11:12 +0000 (20:11 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Fri, 18 Jun 2021 11:11:12 +0000 (20:11 +0900)
The rpk package doesn't contain shared directory, we don't need to check
free space for backup this directory.

Change-Id: Ie9cd4b1743487b4ac240891bb6a56645f3941903
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/step/backup/step_copy_backup.cc

index 8a7c11d..73f8f8c 100644 (file)
@@ -70,7 +70,13 @@ Step::Status StepCopyBackup::precheck() {
   install_path_ = context_->GetPkgPath();
   backup_path_ = GetBackupPathForPackagePath(context_->GetPkgPath());
 
-  if (!CheckFreeSpace(backup_path_, install_path_ / "shared")) {
+  // We only "copy" shared dir for backup.
+  // So if there is no shared dir, we don't need to check free space.
+  bf::path shared_dir = install_path_ / "shared";
+  if (!bf::exists(shared_dir))
+    return Status::OK;
+
+  if (!CheckFreeSpace(backup_path_, shared_dir)) {
     LOG(ERROR) << "not enough space for backup";
     return Step::Status::OUT_OF_SPACE;
   }