зеркало из https://github.com/mozilla/gecko-dev.git
Bug 925747 - patch file extraction cleanup. r=bbondy
This commit is contained in:
Родитель
99072794bd
Коммит
9b09ebdbf0
|
@ -54,6 +54,18 @@
|
|||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^Updated.app/.*</key><dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^updating/.*</key><dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -774,7 +774,7 @@ function getUpdatedDirPath() {
|
|||
* and modified by the simple.mar update file.
|
||||
*
|
||||
* @return nsIFile for the directory where files are added, removed, and
|
||||
* modified by the simple.mar update file.
|
||||
* modified by the simple.mar update file.
|
||||
*/
|
||||
function getUpdateTestDir() {
|
||||
let updateTestDir = getApplyDirFile(null, true);
|
||||
|
@ -786,6 +786,21 @@ function getUpdateTestDir() {
|
|||
return updateTestDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for getting the updating directory which is used by the
|
||||
* updater to extract the update manifest and patch files.
|
||||
*
|
||||
* @return nsIFile for the directory for the updating directory.
|
||||
*/
|
||||
function getUpdatingDir() {
|
||||
let updatingDir = getApplyDirFile(null, true);
|
||||
|
||||
if (IS_MACOSX) {
|
||||
updatingDir = updatingDir.parent.parent;
|
||||
}
|
||||
updatingDir.append("updating");
|
||||
return updatingDir;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
XPCOMUtils.defineLazyGetter(this, "gInstallDirPathHash",
|
||||
|
@ -1096,6 +1111,9 @@ function runUpdate(aExpectedExitValue, aExpectedStatus, aCallback) {
|
|||
logTestInfo("testing update status against expected status");
|
||||
do_check_eq(status, aExpectedStatus);
|
||||
|
||||
logTestInfo("testing updating directory doesn't exist");
|
||||
do_check_false(getUpdatingDir().exists());
|
||||
|
||||
if (aCallback !== null) {
|
||||
if (typeof(aCallback) == typeof(Function)) {
|
||||
aCallback();
|
||||
|
@ -1613,6 +1631,9 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
|
|||
checkServiceLogs(svcOriginalLog);
|
||||
}
|
||||
|
||||
logTestInfo("testing updating directory doesn't exist");
|
||||
do_check_false(getUpdatingDir().exists());
|
||||
|
||||
checkUpdateFinished();
|
||||
}
|
||||
|
||||
|
|
|
@ -1395,7 +1395,7 @@ PatchFile::Prepare()
|
|||
mPatchIndex = sPatchIndex++;
|
||||
|
||||
NS_tsnprintf(spath, sizeof(spath)/sizeof(spath[0]),
|
||||
NS_T("%s/%d.patch"), gSourcePath, mPatchIndex);
|
||||
NS_T("%s/updating/%d.patch"), gDestinationPath, mPatchIndex);
|
||||
|
||||
NS_tremove(spath);
|
||||
|
||||
|
@ -2232,6 +2232,10 @@ UpdateThreadFunc(void *param)
|
|||
if (rv == OK) {
|
||||
rv = DoUpdate();
|
||||
gArchiveReader.Close();
|
||||
NS_tchar updatingDir[MAXPATHLEN];
|
||||
NS_tsnprintf(updatingDir, sizeof(updatingDir)/sizeof(updatingDir[0]),
|
||||
NS_T("%s/updating"), gDestinationPath);
|
||||
ensure_remove_recursive(updatingDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3650,7 +3654,8 @@ int DoUpdate()
|
|||
{
|
||||
NS_tchar manifest[MAXPATHLEN];
|
||||
NS_tsnprintf(manifest, sizeof(manifest)/sizeof(manifest[0]),
|
||||
NS_T("%s/update.manifest"), gSourcePath);
|
||||
NS_T("%s/updating/update.manifest"), gDestinationPath);
|
||||
ensure_parent_dir(manifest);
|
||||
|
||||
// extract the manifest
|
||||
int rv = gArchiveReader.ExtractFile("updatev2.manifest", manifest);
|
||||
|
@ -3663,6 +3668,7 @@ int DoUpdate()
|
|||
}
|
||||
|
||||
NS_tchar *rb = GetManifestContents(manifest);
|
||||
NS_tremove(manifest);
|
||||
if (rb == nullptr) {
|
||||
LOG(("DoUpdate: error opening manifest file: " LOG_S, manifest));
|
||||
return READ_ERROR;
|
||||
|
|
Загрузка…
Ссылка в новой задаче