From 7e66205846fe72e731a01a03a8574854233783cb Mon Sep 17 00:00:00 2001 From: Damian Pietruchowski Date: Thu, 21 Sep 2017 17:07:46 +0200 Subject: [PATCH] Fix for backup package directories The problem was that content of the entries was copied to backup path. This content should be copied to the same entry in backup path. Change-Id: I915d53d3c99c534a047b7073aa570d6d2db88dd3 Signed-off-by: Damian Pietruchowski --- src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc b/src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc index 5f137a4..55bd00b 100644 --- a/src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc +++ b/src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc @@ -23,8 +23,10 @@ ci::Step::Status StepTpkPreparePackageDirectory::BackupDirectory( const std::string& entry, const bf::path& backup_path) { if (!bf::exists(context_->pkg_path.get() / entry)) return Status::OK; - if (!ci::MoveDir(context_->pkg_path.get() / entry, backup_path, - ci::FSFlag::FS_MERGE_OVERWRITE | ci::FSFlag::FS_COMMIT_COPY_FILE)) { + if (!ci::MoveDir(context_->pkg_path.get() / entry, backup_path / entry, + ci::FSFlag::FS_MERGE_OVERWRITE | + ci::FSFlag::FS_COMMIT_COPY_FILE | + ci::FSFlag::FS_PRESERVE_OWNERSHIP_AND_PERMISSIONS)) { LOG(ERROR) << "Failed to backup file"; return Status::APP_DIR_ERROR; } @@ -141,7 +143,9 @@ ci::Step::Status StepTpkPreparePackageDirectory::undo() { if (!bf::exists(backupPath_ / entry)) continue; ci::MoveDir(backupPath_ / entry, context_->pkg_path.get() / entry, - ci::FSFlag::FS_MERGE_OVERWRITE | ci::FSFlag::FS_COMMIT_COPY_FILE); + ci::FSFlag::FS_MERGE_OVERWRITE | + ci::FSFlag::FS_COMMIT_COPY_FILE | + ci::FSFlag::FS_PRESERVE_OWNERSHIP_AND_PERMISSIONS); } ci::RemoveAll(backupPath_); return Status::OK; -- 2.7.4