Kaydet (Commit) a2636093 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

updater: add a way to manually test updater command line

Without this hack it is not possible to debug the updater invocation easily.
Each time this code will be called the updater would be executed and an update
directory already present.

Change-Id: I1159ee504b8f4ebf211e2a719369a48ae2e32345
Reviewed-on: https://gerrit.libreoffice.org/39080Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 78437148
......@@ -1465,7 +1465,8 @@ int Desktop::Main()
return EXIT_FAILURE;
#if HAVE_FEATURE_UPDATE_MAR
if (officecfg::Office::Update::Update::Enabled::get())
const char* pUpdaterTestReplace = std::getenv("LIBO_UPDATER_TEST_REPLACE");
if (pUpdaterTestReplace || officecfg::Office::Update::Update::Enabled::get())
{
// check if we just updated
bool bUpdateRunning = officecfg::Office::Update::Update::UpdateRunning::get();
......@@ -1507,7 +1508,7 @@ int Desktop::Main()
osl::DirectoryItem aDirectoryItem;
osl::DirectoryItem::get(Updater::getUpdateDirURL(), aDirectoryItem);
if (aPatchInfo.is() && aDirectoryItem.is())
if (pUpdaterTestReplace || (aPatchInfo.is() && aDirectoryItem.is()))
{
OUString aBuildID("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ":buildid}");
rtl::Bootstrap::expandMacros(aBuildID);
......
......@@ -86,8 +86,6 @@ OUString normalizePath(const OUString& rPath)
aPath = aTempPath.copy(0, i) + aPath.copy(nIndex + 3);
}
SAL_DEBUG(aPath);
return aPath;
}
......@@ -267,13 +265,24 @@ void update()
#if UNX
const char* pUpdaterTestReplace = std::getenv("LIBO_UPDATER_TEST_REPLACE");
if (!pUpdaterTestReplace)
{
if (execv(aPath.getStr(), pArgs))
{
printf("execv failed with error %d %s\n",errno,strerror(errno));
}
}
else
{
for (size_t i = 0; i < 8 + rtl_getAppCommandArgCount(); ++i)
{
SAL_WARN("desktop.updater", pArgs[i]);
}
}
#endif
for (size_t i = 0; i < 8; ++i)
for (size_t i = 0; i < 8 + rtl_getAppCommandArgCount(); ++i)
{
delete[] pArgs[i];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment