From 24ad54c694ebd93150efb6aab64ea0b63beba452 Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Mon, 9 Nov 2020 16:21:48 +0200 Subject: Repogen: Fix unite metadata when --repository switch used United metadata 7z was missing the component which had no update available. Task-number: QTIFW-2018 Change-Id: I069fd852499f157075bf28e3ccfef3e42e5f30a9 Reviewed-by: Iikka Eklund Reviewed-by: Arttu Tarkiainen --- .../2020-10-13-0958_meta.7z | Bin 217 -> 0 bytes .../2020-11-10-0816_meta.7z | Bin 0 -> 218 bytes .../repository_componentAndUnite/A/2.0.0content.7z | Bin 32 -> 200 bytes .../A/2.0.0content.7z.sha1 | 2 +- .../repository_componentAndUnite/A/2.0.0meta.7z | Bin 210 -> 215 bytes .../repository_componentAndUnite/B/1.0.0content.7z | Bin 32 -> 0 bytes .../B/1.0.0content.7z.sha1 | 1 - .../repository_componentAndUnite/B/1.0.0meta.7z | Bin 106 -> 0 bytes .../repository_componentAndUnite/C/1.0.0content.7z | Bin 0 -> 199 bytes .../C/1.0.0content.7z.sha1 | 1 + .../repository_componentAndUnite/C/1.0.0meta.7z | Bin 0 -> 106 bytes .../repository_componentAndUnite/Updates.xml | 22 +++++----- .../repository_unite/2020-10-13-0958_meta.7z | Bin 217 -> 0 bytes .../repository_unite/2020-11-10-0931_meta.7z | Bin 0 -> 217 bytes .../repotest/repository_unite/A/2.0.0content.7z | Bin 32 -> 200 bytes .../repository_unite/A/2.0.0content.7z.sha1 | 2 +- .../repotest/repository_unite/B/1.0.0content.7z | Bin 32 -> 0 bytes .../repository_unite/B/1.0.0content.7z.sha1 | 1 - .../repotest/repository_unite/C/1.0.0content.7z | Bin 0 -> 199 bytes .../repository_unite/C/1.0.0content.7z.sha1 | 1 + .../tools/repotest/repository_unite/Updates.xml | 18 ++++----- tests/auto/tools/repotest/settings.qrc | 14 +++---- tests/auto/tools/repotest/tst_repotest.cpp | 45 ++++++++++++++++----- 23 files changed, 67 insertions(+), 40 deletions(-) delete mode 100644 tests/auto/tools/repotest/repository_componentAndUnite/2020-10-13-0958_meta.7z create mode 100644 tests/auto/tools/repotest/repository_componentAndUnite/2020-11-10-0816_meta.7z delete mode 100644 tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0content.7z delete mode 100644 tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0content.7z.sha1 delete mode 100644 tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0meta.7z create mode 100644 tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0content.7z create mode 100644 tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0content.7z.sha1 create mode 100644 tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0meta.7z delete mode 100644 tests/auto/tools/repotest/repository_unite/2020-10-13-0958_meta.7z create mode 100644 tests/auto/tools/repotest/repository_unite/2020-11-10-0931_meta.7z delete mode 100644 tests/auto/tools/repotest/repository_unite/B/1.0.0content.7z delete mode 100644 tests/auto/tools/repotest/repository_unite/B/1.0.0content.7z.sha1 create mode 100644 tests/auto/tools/repotest/repository_unite/C/1.0.0content.7z create mode 100644 tests/auto/tools/repotest/repository_unite/C/1.0.0content.7z.sha1 (limited to 'tests') diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/2020-10-13-0958_meta.7z b/tests/auto/tools/repotest/repository_componentAndUnite/2020-10-13-0958_meta.7z deleted file mode 100644 index b8e560fed..000000000 Binary files a/tests/auto/tools/repotest/repository_componentAndUnite/2020-10-13-0958_meta.7z and /dev/null differ diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/2020-11-10-0816_meta.7z b/tests/auto/tools/repotest/repository_componentAndUnite/2020-11-10-0816_meta.7z new file mode 100644 index 000000000..6a17ac028 Binary files /dev/null and b/tests/auto/tools/repotest/repository_componentAndUnite/2020-11-10-0816_meta.7z differ diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0content.7z b/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0content.7z index 46e2c9124..ef8741d32 100644 Binary files a/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0content.7z and b/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0content.7z differ diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0content.7z.sha1 b/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0content.7z.sha1 index 53010cea2..d5e23fd53 100644 --- a/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0content.7z.sha1 +++ b/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0content.7z.sha1 @@ -1 +1 @@ -059e5ed8cd3a1fbca08cccfa4075265192603e3f \ No newline at end of file +c7cca768ebfe60c4295a79762d4e19e63f2c21d2 \ No newline at end of file diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0meta.7z b/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0meta.7z index 3cda3cdc4..c3cf7f7fa 100644 Binary files a/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0meta.7z and b/tests/auto/tools/repotest/repository_componentAndUnite/A/2.0.0meta.7z differ diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0content.7z b/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0content.7z deleted file mode 100644 index 46e2c9124..000000000 Binary files a/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0content.7z and /dev/null differ diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0content.7z.sha1 b/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0content.7z.sha1 deleted file mode 100644 index 53010cea2..000000000 --- a/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0content.7z.sha1 +++ /dev/null @@ -1 +0,0 @@ -059e5ed8cd3a1fbca08cccfa4075265192603e3f \ No newline at end of file diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0meta.7z b/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0meta.7z deleted file mode 100644 index e2867c1ee..000000000 Binary files a/tests/auto/tools/repotest/repository_componentAndUnite/B/1.0.0meta.7z and /dev/null differ diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0content.7z b/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0content.7z new file mode 100644 index 000000000..de70ee790 Binary files /dev/null and b/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0content.7z differ diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0content.7z.sha1 b/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0content.7z.sha1 new file mode 100644 index 000000000..c290ccf6c --- /dev/null +++ b/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0content.7z.sha1 @@ -0,0 +1 @@ +0e995c11dc35bd2b4ac04d408eb7091f8322ea49 \ No newline at end of file diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0meta.7z b/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0meta.7z new file mode 100644 index 000000000..8b389f955 Binary files /dev/null and b/tests/auto/tools/repotest/repository_componentAndUnite/C/1.0.0meta.7z differ diff --git a/tests/auto/tools/repotest/repository_componentAndUnite/Updates.xml b/tests/auto/tools/repotest/repository_componentAndUnite/Updates.xml index 653c0e91e..802f0a53e 100644 --- a/tests/auto/tools/repotest/repository_componentAndUnite/Updates.xml +++ b/tests/auto/tools/repotest/repository_componentAndUnite/Updates.xml @@ -1,9 +1,7 @@ {AnyApplication} 1.0.0 - true - 815dc9afb48774335e468956fa2e1208a239dc06 - 2020-10-13-0958_meta.7z + false A A @@ -12,19 +10,21 @@ 2020-01-01 true - + content.7z - f02d025098d76673f3a848e5d5f0421ffa5ee82d + 11f74e8fbc7d6c155dd6503c460c2c1955340cc1 - B - B - Example component B + C + C + Example component C 1.0.0 - 2020-01-01 + 2015-01-01 true - + content.7z - c520ba1bbde7eb1adf4b274c869a8df0a5efa5b8 + 4558f31428ef88eb23521b4f119465967945e2f7 + d674e6574895c02d3a02fb97a46b159d35f17c68 + 2020-11-10-0816_meta.7z diff --git a/tests/auto/tools/repotest/repository_unite/2020-10-13-0958_meta.7z b/tests/auto/tools/repotest/repository_unite/2020-10-13-0958_meta.7z deleted file mode 100644 index 4ff34ad9f..000000000 Binary files a/tests/auto/tools/repotest/repository_unite/2020-10-13-0958_meta.7z and /dev/null differ diff --git a/tests/auto/tools/repotest/repository_unite/2020-11-10-0931_meta.7z b/tests/auto/tools/repotest/repository_unite/2020-11-10-0931_meta.7z new file mode 100644 index 000000000..4008dc656 Binary files /dev/null and b/tests/auto/tools/repotest/repository_unite/2020-11-10-0931_meta.7z differ diff --git a/tests/auto/tools/repotest/repository_unite/A/2.0.0content.7z b/tests/auto/tools/repotest/repository_unite/A/2.0.0content.7z index 46e2c9124..ef8741d32 100644 Binary files a/tests/auto/tools/repotest/repository_unite/A/2.0.0content.7z and b/tests/auto/tools/repotest/repository_unite/A/2.0.0content.7z differ diff --git a/tests/auto/tools/repotest/repository_unite/A/2.0.0content.7z.sha1 b/tests/auto/tools/repotest/repository_unite/A/2.0.0content.7z.sha1 index 53010cea2..d5e23fd53 100644 --- a/tests/auto/tools/repotest/repository_unite/A/2.0.0content.7z.sha1 +++ b/tests/auto/tools/repotest/repository_unite/A/2.0.0content.7z.sha1 @@ -1 +1 @@ -059e5ed8cd3a1fbca08cccfa4075265192603e3f \ No newline at end of file +c7cca768ebfe60c4295a79762d4e19e63f2c21d2 \ No newline at end of file diff --git a/tests/auto/tools/repotest/repository_unite/B/1.0.0content.7z b/tests/auto/tools/repotest/repository_unite/B/1.0.0content.7z deleted file mode 100644 index 46e2c9124..000000000 Binary files a/tests/auto/tools/repotest/repository_unite/B/1.0.0content.7z and /dev/null differ diff --git a/tests/auto/tools/repotest/repository_unite/B/1.0.0content.7z.sha1 b/tests/auto/tools/repotest/repository_unite/B/1.0.0content.7z.sha1 deleted file mode 100644 index 53010cea2..000000000 --- a/tests/auto/tools/repotest/repository_unite/B/1.0.0content.7z.sha1 +++ /dev/null @@ -1 +0,0 @@ -059e5ed8cd3a1fbca08cccfa4075265192603e3f \ No newline at end of file diff --git a/tests/auto/tools/repotest/repository_unite/C/1.0.0content.7z b/tests/auto/tools/repotest/repository_unite/C/1.0.0content.7z new file mode 100644 index 000000000..de70ee790 Binary files /dev/null and b/tests/auto/tools/repotest/repository_unite/C/1.0.0content.7z differ diff --git a/tests/auto/tools/repotest/repository_unite/C/1.0.0content.7z.sha1 b/tests/auto/tools/repotest/repository_unite/C/1.0.0content.7z.sha1 new file mode 100644 index 000000000..c290ccf6c --- /dev/null +++ b/tests/auto/tools/repotest/repository_unite/C/1.0.0content.7z.sha1 @@ -0,0 +1 @@ +0e995c11dc35bd2b4ac04d408eb7091f8322ea49 \ No newline at end of file diff --git a/tests/auto/tools/repotest/repository_unite/Updates.xml b/tests/auto/tools/repotest/repository_unite/Updates.xml index c9bcc93cd..0b0a8987b 100644 --- a/tests/auto/tools/repotest/repository_unite/Updates.xml +++ b/tests/auto/tools/repotest/repository_unite/Updates.xml @@ -1,9 +1,7 @@ {AnyApplication} 1.0.0 - true - 4a494d033d3092b392ba775b17a7e4776ccf4777 - 2020-10-13-0958_meta.7z + false A A @@ -12,17 +10,19 @@ 2020-01-01 true - + content.7z - B - B - Example component B + C + C + Example component C 1.0.0 - 2020-01-01 + 2015-01-01 true - + content.7z + 3b46ef65a751d9498205412fc22de43ce29e5d8a + 2020-11-10-0931_meta.7z diff --git a/tests/auto/tools/repotest/settings.qrc b/tests/auto/tools/repotest/settings.qrc index 77d250b20..e731af222 100644 --- a/tests/auto/tools/repotest/settings.qrc +++ b/tests/auto/tools/repotest/settings.qrc @@ -20,16 +20,16 @@ repository_componentAndUnite/A/2.0.0content.7z repository_componentAndUnite/A/2.0.0content.7z.sha1 repository_componentAndUnite/A/2.0.0meta.7z - repository_componentAndUnite/B/1.0.0content.7z - repository_componentAndUnite/B/1.0.0content.7z.sha1 - repository_componentAndUnite/B/1.0.0meta.7z - repository_componentAndUnite/2020-10-13-0958_meta.7z + repository_componentAndUnite/C/1.0.0content.7z + repository_componentAndUnite/C/1.0.0content.7z.sha1 + repository_componentAndUnite/C/1.0.0meta.7z + repository_componentAndUnite/2020-11-10-0816_meta.7z repository_componentAndUnite/Updates.xml repository_unite/A/2.0.0content.7z repository_unite/A/2.0.0content.7z.sha1 - repository_unite/B/1.0.0content.7z - repository_unite/B/1.0.0content.7z.sha1 - repository_unite/2020-10-13-0958_meta.7z + repository_unite/C/1.0.0content.7z + repository_unite/C/1.0.0content.7z.sha1 + repository_unite/2020-11-10-0931_meta.7z repository_unite/Updates.xml diff --git a/tests/auto/tools/repotest/tst_repotest.cpp b/tests/auto/tools/repotest/tst_repotest.cpp index 2f5ca2cbb..5aa614454 100644 --- a/tests/auto/tools/repotest/tst_repotest.cpp +++ b/tests/auto/tools/repotest/tst_repotest.cpp @@ -65,8 +65,13 @@ private: } if (updateNewComponents) { //Verify that component B exists as that is not updated - VerifyInstaller::verifyFileExistence(m_repositoryDir + "/B", QStringList() << "1.0.0content.7z" - << "1.0.0content.7z.sha1" << "1.0.0meta.7z"); + if (createSplitMetadata) { + VerifyInstaller::verifyFileExistence(m_repositoryDir + "/B", QStringList() << "1.0.0content.7z" + << "1.0.0content.7z.sha1" << "1.0.0meta.7z"); + } else { + VerifyInstaller::verifyFileExistence(m_repositoryDir + "/B", QStringList() << "1.0.0content.7z" + << "1.0.0content.7z.sha1"); + } } else { QDir dir(m_repositoryDir + "/B"); QVERIFY(!dir.exists()); @@ -88,7 +93,10 @@ private: QInstallerTools::copyComponentData(directories, m_repositoryDir, &m_packages); QInstallerTools::copyMetaData(m_tmpMetaDir, m_repositoryDir, m_packages, QLatin1String("{AnyApplication}"), QLatin1String("1.0.0"), unite7zFiles); - QInstallerTools::compressMetaDirectories(m_tmpMetaDir, m_tmpMetaDir, pathToVersionMapping, + QString existing7z = QInstallerTools::existingUniteMeta7z(m_repositoryDir); + if (!existing7z.isEmpty()) + existing7z = m_repositoryDir + QDir::separator() + existing7z; + QInstallerTools::compressMetaDirectories(m_tmpMetaDir, existing7z, pathToVersionMapping, createSplitMetadata, createUnifiedMetadata); QDirIterator it(m_repositoryDir, QStringList(QLatin1String("Updates*.xml")) << QLatin1String("*_meta.7z"), QDir::Files | QDir::CaseSensitive); @@ -135,7 +143,9 @@ private: + "Updates.xml"); QRegularExpression re("(.*)<.MetadataName>"); QStringList matches = re.match(fileContent).capturedTexts(); + QString existingUniteMeta7z = QInstallerTools::existingUniteMeta7z(m_repositoryDir); QCOMPARE(2, matches.count()); + QCOMPARE(existingUniteMeta7z, matches.at(1)); QFile file(m_repositoryDir + QDir::separator() + matches.at(1)); QVERIFY(file.open(QIODevice::ReadOnly)); @@ -217,7 +227,6 @@ private: QTest::ignoreMessage(QtDebugMsg, qPrintable(message.arg(repository))); QTest::ignoreMessage(QtDebugMsg, "Collecting information about available packages..."); QTest::ignoreMessage(QtDebugMsg, "No available packages found at the specified location."); - QTest::ignoreMessage(QtDebugMsg, "- it provides the package \"B\" - \"1.0.0\""); QTest::ignoreMessage(QtDebugMsg, "- it provides the package \"A\" - \"2.0.0\""); } @@ -291,6 +300,14 @@ private: ignoreMessagesForCopyMetadata("B", false, true); } + void ignoreMessageForUpdateComponent() + { + QString message = "Update component \"A\" in \"%1\" ."; + QTest::ignoreMessage(QtDebugMsg, qPrintable(message.arg(m_repositoryDir))); + message = "Update component \"C\" in \"%1\" ."; + QTest::ignoreMessage(QtDebugMsg, qPrintable(message.arg(m_repositoryDir))); + } + private slots: void init() { @@ -413,6 +430,8 @@ private slots: initRepoUpdateFromRepository(":///repository_component"); ignoreMessageForCollectingRepository("repository_component"); + QTest::ignoreMessage(QtDebugMsg, "- it provides the package \"B\" - \"1.0.0\""); + ignoreMessagesForCopyRepository("B", "1.0.0", "repository_component"); ignoreMessagesForCopyRepository("A", "2.0.0", "repository_component"); ignoreMessagesForComponentSha(QStringList() << "A" << "B", true); @@ -430,12 +449,16 @@ private slots: initRepoUpdateFromRepository(":///repository_componentAndUnite"); ignoreMessageForCollectingRepository("repository_componentAndUnite"); + QTest::ignoreMessage(QtDebugMsg, "- it provides the package \"C\" - \"1.0.0\""); + ignoreMessageForUpdateComponent(); ignoreMessagesForCopyRepository("A", "2.0.0", "repository_componentAndUnite"); - ignoreMessagesForCopyRepository("B", "1.0.0", "repository_componentAndUnite"); + ignoreMessagesForCopyRepository("C", "1.0.0", "repository_componentAndUnite"); ignoreMessagesForUniteMeta(true); - ignoreMessagesForComponentSha(QStringList() << "A" << "B", true); - generateRepo(true, true, false); + ignoreMessagesForComponentSha(QStringList() << "A" << "C", true); + + generateRepo(true, true, true); verifyComponentRepository("2.0.0", true); + VerifyInstaller::verifyFileExistence(m_repositoryDir + "/C", QStringList() << "1.0.0content.7z" << "1.0.0content.7z.sha1" << "1.0.0meta.7z"); verifyUniteMetadata("2.0.0"); } @@ -447,11 +470,15 @@ private slots: initRepoUpdateFromRepository(":///repository_unite"); ignoreMessageForCollectingRepository("repository_unite"); + QTest::ignoreMessage(QtDebugMsg, "- it provides the package \"C\" - \"1.0.0\""); + ignoreMessageForUpdateComponent(); ignoreMessagesForCopyRepository("A", "2.0.0", "repository_unite"); - ignoreMessagesForCopyRepository("B", "1.0.0", "repository_unite"); + ignoreMessagesForCopyRepository("C", "1.0.0", "repository_unite"); ignoreMessagesForUniteMeta(true); - generateRepo(false, true, false); + + generateRepo(false, true, true); verifyComponentRepository("2.0.0", false); + VerifyInstaller::verifyFileExistence(m_repositoryDir + "/C", QStringList() << "1.0.0content.7z" << "1.0.0content.7z.sha1"); verifyUniteMetadata("2.0.0"); } -- cgit v1.2.3