aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-20 16:57:13 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-02-20 17:10:20 +0000
commit5ffbc8d7c2c91e214417fb3a686584d1bbfa01c5 (patch)
tree59f2c81a42277483b3a99f4b24ff01d1c63363a4
parent519382831287501084a67bc25be2e50fca275d58 (diff)
downloadpaludis-5ffbc8d7c2c91e214417fb3a686584d1bbfa01c5.tar.gz
paludis-5ffbc8d7c2c91e214417fb3a686584d1bbfa01c5.tar.xz
Preserve SCM revision for binaries
-rw-r--r--paludis/repositories/e/ebuild.cc7
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash4
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc18
-rw-r--r--paludis/repositories/e/ebuild_id.cc8
-rw-r--r--paludis/repositories/e/ebuild_id.hh1
5 files changed, 36 insertions, 2 deletions
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index e2863c2..e73b453 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -681,6 +681,13 @@ EbuildMetadataCommand::load(const std::shared_ptr<const EbuildID> & id)
id->load_remote_ids(m.remote_ids(), value);
}
+ if (id->eapi()->supported()->is_pbin() && ! m.scm_revision()->name().empty())
+ {
+ std::string value(get(keys, m.scm_revision()->name()));
+ if (! value.empty())
+ id->load_scm_revision(m.scm_revision()->name(), m.scm_revision()->description(), value);
+ }
+
if (! m.defined_phases()->name().empty())
{
std::set<std::string> defined_phases, raw_values, ebuild_functions;
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index 7eb5871..546b043 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# vim: set sw=4 sts=4 et :
-# Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh
+# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
#
# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
# Gentoo Foundation and distributed under the terms of the GNU General
@@ -86,7 +86,7 @@ EBUILD_METADATA_VARIABLES="DEPEND RDEPEND PDEPEND IUSE SRC_URI DOWNLOADS RESTRIC
GENERATED_USING GENERATED_TIME GENERATED_FROM_REPOSITORY BINARY_PLATFORMS REMOTE_IDS \
SUMMARY BUGS_TO UPSTREAM_DOCUMENTATION UPSTREAM_CHANGELOG \
UPSTREAM_RELEASE_NOTES PROPERTIES PALUDIS_DECLARED_FUNCTIONS SLOT EAPI OPTIONS USE \
- PALUDIS_EBUILD_RDEPEND_WAS_SET PALUDIS_EBUILD_DEPEND REQUIRED_USE"
+ PALUDIS_EBUILD_RDEPEND_WAS_SET PALUDIS_EBUILD_DEPEND REQUIRED_USE SCM_REVISION"
EBUILD_METADATA_VARIABLES_FROM_CPLUSPLUS="SLOT EAPI OPTIONS USE"
if [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] ; then
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index bafd432..538ad6e 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -288,6 +288,13 @@ namespace
if (! value.empty())
id->load_remote_ids(m.remote_ids(), value);
}
+
+ if (id->eapi()->supported()->is_pbin() && -1 != m.scm_revision()->flat_list_index() && ! m.scm_revision()->name().empty())
+ {
+ std::string value(lines.at(m.scm_revision()->flat_list_index()));
+ if (! value.empty())
+ id->load_scm_revision(m.scm_revision()->name(), m.scm_revision()->description(), value);
+ }
}
Log::get_instance()->message("e.cache.success", ll_debug, lc_context) << "Successfully loaded cache file";
@@ -624,6 +631,13 @@ EbuildFlatMetadataCache::load(const std::shared_ptr<const EbuildID> & id, const
if (! value.empty())
id->load_remote_ids(m.remote_ids(), value);
}
+
+ if (id->eapi()->supported()->is_pbin() && ! m.scm_revision()->name().empty())
+ {
+ std::string value(keys[m.scm_revision()->name()]);
+ if (! value.empty())
+ id->load_scm_revision(m.scm_revision()->name(), m.scm_revision()->description(), value);
+ }
}
Log::get_instance()->message("e.cache.success", ll_debug, lc_context) << "Successfully loaded cache file";
@@ -848,6 +862,10 @@ EbuildFlatMetadataCache::save(const std::shared_ptr<const EbuildID> & id)
if (! m.defined_phases()->name().empty() && id->defined_phases_key())
write_kv(cache, m.defined_phases()->name(), join(id->defined_phases_key()->value()->begin(),
id->defined_phases_key()->value()->end(), " "));
+
+ if (! m.scm_revision()->name().empty() && id->scm_revision_key())
+ write_kv(cache, m.scm_revision()->name(), id->scm_revision_key()->value());
+
}
catch (const InternalError &)
{
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index e8c338f..22bcd77 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1185,6 +1185,14 @@ EbuildID::load_generated_using(const std::string & r, const std::string & h, con
add_metadata_key(_imp->generated_using);
}
+void
+EbuildID::load_scm_revision(const std::string & r, const std::string & h, const std::string & v) const
+{
+ Lock l(_imp->mutex);
+ _imp->scm_revision = std::make_shared<LiteralMetadataValueKey<std::string> >(r, h, mkt_normal, v);
+ add_metadata_key(_imp->scm_revision);
+}
+
namespace
{
struct SupportsActionQuery
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index 5f1c7b8..67f34c1 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -153,6 +153,7 @@ namespace paludis
void load_generated_from(const std::shared_ptr<const EAPIMetadataVariable> &, const std::string &) const;
void load_generated_using(const std::string &, const std::string &, const std::string &) const;
void load_generated_time(const std::string &, const std::string &, const std::string &) const;
+ void load_scm_revision(const std::string &, const std::string &, const std::string &) const;
virtual bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual void perform_action(Action &) const;