aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-30 18:29:11 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-30 18:29:11 +0000
commit439193d50d82cbb41ebb1fdb7c34a1b8055fc79e (patch)
tree0e29666a876e93e25d80693fc9f78348366cec60
parent52bf7e5fde9d27590d5c8a7e2485fbe39da53db8 (diff)
downloadpaludis-439193d50d82cbb41ebb1fdb7c34a1b8055fc79e.tar.gz
paludis-439193d50d82cbb41ebb1fdb7c34a1b8055fc79e.tar.xz
Add revision_only to version_spec. Use it.
-rw-r--r--paludis/portage_repository.cc16
-rw-r--r--paludis/version_spec.cc6
-rw-r--r--paludis/version_spec.hh5
-rw-r--r--paludis/version_spec_TEST.cc17
4 files changed, 41 insertions, 3 deletions
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 9bc99e0..c9c7781 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -668,13 +668,23 @@ PortageRepository::do_version_metadata(
else
{
std::string cmd(
- "env PV='" + stringify(p) + "-" + stringify(v.remove_revision()) + "' " +
- "PN='" + stringify(p) + "' "
- "PVR='" + stringify(p) + "-" + stringify(v) + "' " +
+ "env P='" + stringify(p) + "-" + stringify(v.remove_revision()) + "' " +
+ "PV='" + stringify(v.remove_revision()) + "' " +
+ "PR='" + v.revision_only() + "' " +
+ "PN='" + stringify(p) + "' " +
+ "PVR='" + stringify(v.remove_revision()) + "-" + v.revision_only() + "' " +
+ "PF='" + stringify(p) + "-" + stringify(v) + "' " +
+ "A='' " +
"CATEGORY='" + stringify(c) + "' " +
+ "FILESDIR='" + stringify(_implementation->location) + "/" + stringify(c) + "/" +
+ stringify(p) + "/files/' " +
"ECLASSDIR='" + stringify(_implementation->location) + "/eclass/' " +
"PORTDIR='" + stringify(_implementation->location) + "/' " +
"DISTDIR='" + stringify(_implementation->location) + "/distfiles/' " +
+ "WORKDIR='/dev/null' " +
+ "T='/dev/null' " +
+ "D='/dev/null' " +
+ "S='/dev/null' " +
"ebuild/ebuild.bash metadata '" +
stringify(_implementation->location) + "/" + stringify(c) + "/" + stringify(p) + "/" +
stringify(p) + "-" + stringify(v) + ".ebuild'");
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 16cfe61..678f520 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -321,6 +321,12 @@ VersionSpec::remove_revision() const
return result;
}
+std::string
+VersionSpec::revision_only() const
+{
+ return "r" + stringify(_implementation->revision_part);
+}
+
std::ostream &
paludis::operator<< (std::ostream & s, const VersionSpec & v)
{
diff --git a/paludis/version_spec.hh b/paludis/version_spec.hh
index 02876ad..eacac33 100644
--- a/paludis/version_spec.hh
+++ b/paludis/version_spec.hh
@@ -107,6 +107,11 @@ namespace paludis
*/
VersionSpec remove_revision() const;
+ /**
+ * Revision part only (or "r0").
+ */
+ std::string revision_only() const;
+
};
/**
diff --git a/paludis/version_spec_TEST.cc b/paludis/version_spec_TEST.cc
index 02dd0c9..e313e33 100644
--- a/paludis/version_spec_TEST.cc
+++ b/paludis/version_spec_TEST.cc
@@ -183,5 +183,22 @@ namespace test_cases
TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99").remove_revision(), "1.2");
}
} test_version_remove_revision;
+
+ /**
+ * \test VersionSpec revision only
+ *
+ * \ingroup Test
+ */
+ struct VersionRevisionOnlyTest : TestCase
+ {
+ VersionRevisionOnlyTest() : TestCase("version spec revision only") {}
+
+ void run()
+ {
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2").revision_only(), "r0");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r").revision_only(), "r0");
+ TEST_CHECK_STRINGIFY_EQUAL(VersionSpec("1.2-r99").revision_only(), "r99");
+ }
+ } test_version_revision_only;
}