aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2011-10-14 21:11:17 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2011-10-14 23:04:29 +0100
commitb2fe0588bb37e5777575296a209b1a210968392e (patch)
tree72be89ade41d75eefdcf5c85efdc91cf791e472f
parenta40a31f6adc36147e26858afd45a9d12eef93e53 (diff)
downloadpaludis-b2fe0588bb37e5777575296a209b1a210968392e.tar.gz
paludis-b2fe0588bb37e5777575296a209b1a210968392e.tar.xz
Generate Manifests with the same line ordering as Portage
Fixes: ticket:1204
-rw-r--r--NEWS3
-rw-r--r--paludis/repositories/e/e_repository.cc38
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc19
3 files changed, 33 insertions, 27 deletions
diff --git a/NEWS b/NEWS
index 1a127a3..136e8ff 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,9 @@ master:
with '--no-*' can now be negated in short form by using '+' instead
of '-', for example '+x' for '--no-execute'.
+ * Manifest files for E repositories are now generated with the lines in the
+ same order as Portage.
+
0.68.0:
* Licence groups are now supported.
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index c0f72f8..78786a2 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1021,11 +1021,7 @@ ERepository::make_manifest(const QualifiedPackageName & qpn)
{
FSPath package_dir = _imp->layout->package_directory(qpn);
- FSPath(package_dir / "Manifest").unlink();
- SafeOFStream manifest(FSPath(package_dir / "Manifest"), -1, true);
- if (! manifest)
- throw ERepositoryConfigurationError("Couldn't open Manifest for writing.");
-
+ std::vector<std::pair<std::pair<std::string, std::string>, std::string> > lines;
auto files(_imp->layout->manifest_files(qpn, package_dir));
for (auto f(files->begin()) ; f != files->end() ; ++f)
@@ -1043,18 +1039,20 @@ ERepository::make_manifest(const QualifiedPackageName & qpn)
SafeIFStream file_stream(file);
RMD160 rmd160sum(file_stream);
- manifest << file_type << " " << filename << " "
- << file.stat().file_size() << " RMD160 " << rmd160sum.hexsum();
+ std::string line(file_type + " " + filename + " "
+ + stringify(file.stat().file_size()) + " RMD160 " + rmd160sum.hexsum());
file_stream.clear();
file_stream.seekg(0, std::ios::beg);
SHA1 sha1sum(file_stream);
- manifest << " SHA1 " << sha1sum.hexsum();
+ line += " SHA1 " + sha1sum.hexsum();
file_stream.clear();
file_stream.seekg(0, std::ios::beg);
SHA256 sha256sum(file_stream);
- manifest << " SHA256 " << sha256sum.hexsum() << std::endl;
+ line += " SHA256 " + sha256sum.hexsum();
+
+ lines.push_back(std::make_pair(std::make_pair(file_type, filename), line));
}
std::shared_ptr<const PackageIDSequence> versions;
@@ -1089,14 +1087,24 @@ ERepository::make_manifest(const QualifiedPackageName & qpn)
MemoisedHashes * hashes = MemoisedHashes::get_instance();
- manifest << "DIST " << f.basename() << " "
- << f_stat.file_size()
- << " RMD160 " << hashes->get("RMD160", f, file_stream)
- << " SHA1 " << hashes->get("SHA1", f, file_stream)
- << " SHA256 " << hashes->get("SHA256", f, file_stream)
- << std::endl;
+ std::string line("DIST " + f.basename() + " " + stringify(f_stat.file_size())
+ + " RMD160 " + hashes->get("RMD160", f, file_stream)
+ + " SHA1 " + hashes->get("SHA1", f, file_stream)
+ + " SHA256 " + hashes->get("SHA256", f, file_stream));
+
+ lines.push_back(std::make_pair(std::make_pair("DIST", f.basename()), line));
}
}
+
+ std::sort(lines.begin(), lines.end());
+
+ FSPath(package_dir / "Manifest").unlink();
+ SafeOFStream manifest(FSPath(package_dir / "Manifest"), -1, true);
+ if (! manifest)
+ throw ERepositoryConfigurationError("Couldn't open Manifest for writing.");
+
+ for (auto it(lines.begin()), it_end(lines.end()); it_end != it; ++it)
+ manifest << it->second << std::endl;
}
void
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index b1c81d5..c9330f6 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -91,6 +91,12 @@ namespace
{
return wp_yes;
}
+
+ std::string contents(const std::string & filename)
+ {
+ SafeIFStream s(FSPath(filename).realpath());
+ return std::string((std::istreambuf_iterator<char>(s)), std::istreambuf_iterator<char>());
+ }
}
TEST(ERepository, RepoName)
@@ -654,18 +660,7 @@ TEST(ERepository, Manifest)
env.add_repository(1, repo);
repo->make_manifest(QualifiedPackageName("category/package"));
- std::multiset<std::string> made_manifest, reference_manifest;
- SafeIFStream made_manifest_stream(FSPath("e_repository_TEST_dir/repo11/category/package/Manifest")),
- reference_manifest_stream(FSPath("e_repository_TEST_dir/repo11/Manifest_correct"));
-
- std::string line;
-
- while ( getline(made_manifest_stream, line) )
- made_manifest.insert(line);
- while ( getline(reference_manifest_stream, line) )
- reference_manifest.insert(line);
-
- EXPECT_TRUE(made_manifest == reference_manifest);
+ EXPECT_EQ(contents("e_repository_TEST_dir/repo11/Manifest_correct"), contents("e_repository_TEST_dir/repo11/category/package/Manifest"));
EXPECT_THROW(repo->make_manifest(QualifiedPackageName("category/package-b")), MissingDistfileError);
}