aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-01 20:46:04 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-01 20:46:04 +0000
commitddb8cd7212d04e9aee6fd3f87279a16b75328910 (patch)
tree85994d48e031445f70c7ab94370d77526f34bd53
parent4473a7c1c91c8859b30762ac6506e3952afef3c1 (diff)
downloadpaludis-ddb8cd7212d04e9aee6fd3f87279a16b75328910.tar.gz
paludis-ddb8cd7212d04e9aee6fd3f87279a16b75328910.tar.xz
Better nofetch support
-rw-r--r--ebuild/pkg_nofetch.bash36
-rw-r--r--paludis/ebuild.cc5
-rw-r--r--paludis/ebuild.hh4
-rw-r--r--paludis/portage_repository.cc13
4 files changed, 50 insertions, 8 deletions
diff --git a/ebuild/pkg_nofetch.bash b/ebuild/pkg_nofetch.bash
index f364f55..fb509db 100644
--- a/ebuild/pkg_nofetch.bash
+++ b/ebuild/pkg_nofetch.bash
@@ -23,12 +23,40 @@
pkg_nofetch()
{
- [[ -z "${SRC_URI}" ]] && return
+ [[ -z "${A}" ]] && return
- local f
- echo "The following files could not be fetched automatically for ${PN}:"
- for f in ${SRC_URI} ; do
+ local f g=
+ for f in ${A} ; do
+ [[ -f "${DISTDIR}/${A}" ]] && continue
+ if [[ -z "${g}" ]] ; then
+ echo "The following files could not be fetched automatically for ${PN}:"
+ g=no
+ fi
echo "* ${f}"
done
}
+ebuild_f_nofetch()
+{
+ local old_sandbox_write="${SANDBOX_WRITE}"
+ SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${DISTDIR}"
+ if hasq "nofetch" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping pkg_nofetch (SKIP_FUNCTIONS)"
+ else
+ local a f=
+ for a in ${A} ; do
+ [[ -f "${DISTDIR}/${a}" ]] && continue
+ f=yes
+ done
+
+ if [[ -z "${f}" ]] ; then
+ ebuild_section "Skipping pkg_nofetch (fully fetched already)"
+ else
+ ebuild_section "Starting pkg_nofetch"
+ pkg_nofetch
+ ebuild_section "Done pkg_nofetch"
+ die "Manual fetching is required"
+ fi
+ fi
+ SANDBOX_WRITE="${old_sandbox_write}"
+}
diff --git a/paludis/ebuild.cc b/paludis/ebuild.cc
index 3b93aa0..199558e 100644
--- a/paludis/ebuild.cc
+++ b/paludis/ebuild.cc
@@ -170,7 +170,10 @@ EbuildMetadataCommand::do_run_command(const std::string & cmd)
std::string
EbuildFetchCommand::commands() const
{
- return "fetch";
+ if (fetch_params.get<ecfpk_no_fetch>())
+ return "nofetch";
+ else
+ return "fetch";
}
bool
diff --git a/paludis/ebuild.hh b/paludis/ebuild.hh
index 88dae6f..158300f 100644
--- a/paludis/ebuild.hh
+++ b/paludis/ebuild.hh
@@ -211,6 +211,7 @@ namespace paludis
ecfpk_root,
ecfpk_profile,
ecfpk_expand_vars,
+ ecfpk_no_fetch,
last_ecfpk
};
@@ -230,7 +231,8 @@ namespace paludis
SmartRecordKey<ecfpk_flat_src_uri, std::string>,
SmartRecordKey<ecfpk_root, std::string>,
SmartRecordKey<ecfpk_profile, std::string>,
- SmartRecordKey<ecfpk_expand_vars, std::map<std::string, std::string> >
+ SmartRecordKey<ecfpk_expand_vars, std::map<std::string, std::string> >,
+ SmartRecordKey<ecfpk_no_fetch, bool>
{
};
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index f66a91c..7fc5df7 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -1186,6 +1186,8 @@ void
PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec & v,
const InstallOptions & o) const
{
+ static Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
+
if (! _imp->has_profile)
{
_imp->add_profile(_imp->profile.realpath());
@@ -1295,7 +1297,6 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
std::transform(x->data().begin(), x->data().end(), std::back_inserter(lower_x),
&::tolower);
- static Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
std::list<std::string> uses;
tokeniser.tokenise(_imp->profile_env[stringify(*x)], std::back_inserter(uses));
@@ -1328,6 +1329,13 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
expand_vars.insert(std::make_pair(stringify(*u), value));
}
+ bool fetch_restrict(false);
+ {
+ std::list<std::string> restricts;
+ tokeniser.tokenise(metadata->get(vmk_restrict), std::back_inserter(restricts));
+ fetch_restrict = (restricts.end() != std::find(restricts.begin(), restricts.end(), "fetch"));
+ }
+
EbuildFetchCommand fetch_cmd(EbuildCommandParams::create((
param<ecpk_environment>(_imp->env),
param<ecpk_db_entry>(&e),
@@ -1347,7 +1355,8 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
param<ecfpk_expand_vars>(expand_vars),
param<ecfpk_flat_src_uri>(flat_src_uri),
param<ecfpk_root>(stringify(_imp->root) + "/"),
- param<ecfpk_profile>(stringify(_imp->profile))
+ param<ecfpk_profile>(stringify(_imp->profile)),
+ param<ecfpk_no_fetch>(fetch_restrict)
)));
if (metadata->get(vmk_virtual).empty())