aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-31 04:25:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-31 04:25:48 +0000
commit38c6816c9e3ca2ec4abb0868ab7990a12666ec70 (patch)
tree26a77396de9234c36860f2068976822d81806250
parentc03cd37e4037328c1ba605436d2372ca1402097c (diff)
downloadpaludis-38c6816c9e3ca2ec4abb0868ab7990a12666ec70.tar.gz
paludis-38c6816c9e3ca2ec4abb0868ab7990a12666ec70.tar.xz
Initial support for installing, but not creating, binary packages
-rw-r--r--doc/doc_main.doxygen5
-rw-r--r--ebuild/Makefile.am3
-rw-r--r--ebuild/builtin_fetch_bin.bash82
-rw-r--r--ebuild/builtin_init_bin.bash70
-rw-r--r--ebuild/builtin_unpack_bin.bash50
-rwxr-xr-xebuild/ebuild.bash6
-rwxr-xr-xebuild/utils/dounpack23
-rw-r--r--paludis/ebin.cc212
-rw-r--r--paludis/ebin.hh307
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/repositories/portage/Makefile.am8
-rw-r--r--paludis/repositories/portage/make_ebin_repository.cc102
-rw-r--r--paludis/repositories/portage/make_ebin_repository.hh43
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.cc140
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.hh55
-rw-r--r--paludis/repositories/portage/portage_repository.cc104
-rw-r--r--paludis/repositories/portage/portage_repository.hh17
-rw-r--r--paludis/repositories/portage/portage_repository_TEST.cc33
-rw-r--r--paludis/repositories/portage/portage_repository_ebin_entries.hh81
-rw-r--r--paludis/repositories/portage/portage_repository_params.hh2
-rw-r--r--paludis/version_metadata.cc22
-rw-r--r--paludis/version_metadata.hh97
-rw-r--r--src/paludis/query.cc8
23 files changed, 1322 insertions, 149 deletions
diff --git a/doc/doc_main.doxygen b/doc/doc_main.doxygen
index a23f767..7a4e070 100644
--- a/doc/doc_main.doxygen
+++ b/doc/doc_main.doxygen
@@ -153,6 +153,11 @@
* \ingroup grprepository
*/
+/** \defgroup grpebininterface Ebin interface
+ *
+ * \ingroup grprepository
+ */
+
/** \defgroup grpsyncer Sync protocol handler classes
*
* \ingroup grprepository
diff --git a/ebuild/Makefile.am b/ebuild/Makefile.am
index 746f90f..731f2a8 100644
--- a/ebuild/Makefile.am
+++ b/ebuild/Makefile.am
@@ -7,12 +7,15 @@ libexecprogdir = $(libexecdir)/paludis/
libexecprog_SCRIPTS = \
build_functions.bash \
builtin_fetch.bash \
+ builtin_fetch_bin.bash \
builtin_init.bash \
+ builtin_init_bin.bash \
builtin_merge.bash \
builtin_metadata.bash \
builtin_strip.bash \
builtin_tidyup.bash \
builtin_unmerge.bash \
+ builtin_unpack_bin.bash \
builtin_variable.bash \
ebuild.bash \
echo_functions.bash \
diff --git a/ebuild/builtin_fetch_bin.bash b/ebuild/builtin_fetch_bin.bash
new file mode 100644
index 0000000..4075cfd
--- /dev/null
+++ b/ebuild/builtin_fetch_bin.bash
@@ -0,0 +1,82 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+builtin_fetch_bin()
+{
+ [[ -d "${PKGDIR}" ]] || die "PKGDIR \"${PKGDIR}\" is not a directory"
+
+ local a nofetch unique_aa old_aa
+ for a in ${FLAT_BIN_URI} ; do
+ local aa=${a##*/}
+ hasq "${aa}" ${unique_aa} || unique_aa="${unique_aa} ${aa}"
+
+ if [[ -f "${PKGDIR}/${aa}" ]] && [[ "0" != $(stat -c '%s' "${PKGDIR}/${aa}" ) ]] ; then
+ if [[ "${old_aa}" != "${aa}" ]] ; then
+ ebuild_section "Already have ${aa}"
+ old_aa="${aa}"
+ fi
+ else
+ if [[ -f "${PKGDIR}/${aa}" ]] ; then
+ ebuild_section "Trying to remove existing ${aa}..."
+ rm -f "${PKGDIR}/${aa}"
+ fi
+
+ prg="${PALUDIS_EBUILD_DIR}/fetchers/do$(echo ${a%%://*} )"
+ if [[ -x "${prg}" ]] ; then
+ ${prg} "${a}" "${PKGDIR}/${aa}"
+ else
+ eerror "Don't know how to fetch '${a}'"
+ fi
+ fi
+ done
+
+ for a in ${unique_aa} ; do
+ [[ -f ${PKGDIR}/${a} ]] || nofetch="${nofetch} ${a}"
+ done
+
+ if [[ -n "${nofetch}" ]] ; then
+ local c
+ echo
+ eerror "Couldn't fetch the following components:"
+ for c in ${nofetch} ; do
+ eerror " * ${c}"
+ done
+ echo
+ die "builtin_fetch_bin failed"
+ fi
+}
+
+ebuild_f_fetch_bin()
+{
+ local old_sandbox_write="${SANDBOX_WRITE}"
+ SANDBOX_WRITE="${SANDBOX_WRITE+${SANDBOX_WRITE}:}${PKGDIR}"
+ if hasq "fetch_bin" ${RESTRICT} ; then
+ ebuild_section "Skipping builtin_fetch_bin (RESTRICT)"
+ elif hasq "fetch_bin" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping builtin_fetch_bin (SKIP_FUNCTIONS)"
+ else
+ ebuild_section "Starting builtin_fetch_bin"
+ builtin_fetch_bin
+ ebuild_section "Done builtin_fetch_bin"
+ fi
+ SANDBOX_WRITE="${old_sandbox_write}"
+}
+
+
+
diff --git a/ebuild/builtin_init_bin.bash b/ebuild/builtin_init_bin.bash
new file mode 100644
index 0000000..c8f7af7
--- /dev/null
+++ b/ebuild/builtin_init_bin.bash
@@ -0,0 +1,70 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+builtin_init_bin()
+{
+ export ROOT="${ROOT//+(\/)//}"
+
+ local a
+ for a in P PV PR PN PVR PF CATEGORY PKGDIR \
+ KV PALUDIS_TMPDIR PALUDIS_EBUILD_LOG_LEVEL PALUDIS_EBUILD_DIR \
+ USERLAND KERNEL ARCH CHOST PALUDIS_COMMAND ROOT ; do
+ [[ -z "${!a}" ]] && die "\$${a} unset or empty"
+ declare -r ${a}="${!a}"
+ done
+
+ if [[ -e "${PALUDIS_TMPDIR}/${CATEGORY}/${PF}" ]] ; then
+ rm -fr "${PALUDIS_TMPDIR}/${CATEGORY}/${PF}" || die "Couldn't remove previous work"
+ fi
+
+ export WORKDIR="${PALUDIS_TMPDIR}/${CATEGORY}/${PF}/work"
+ mkdir -p "${WORKDIR}" || die "Couldn't create \$WORKDIR (\"${WORKDIR}\")"
+ declare -r WORKDIR="${WORKDIR}"
+
+ export T="${PALUDIS_TMPDIR}/${CATEGORY}/${PF}/temp/"
+ mkdir -p "${T}" || die "Couldn't create \$T (\"${T}\")"
+ declare -r T="${T}"
+ export PALUDIS_HOME="${HOME}"
+ export HOME="${T}"
+
+ export D="${PALUDIS_TMPDIR}/${CATEGORY}/${PF}/image/"
+ export D="${D//+(\/)//}"
+ mkdir -p "${D}" || die "Couldn't create \$D (\"${D}\")"
+ declare -r D="${D}"
+
+ export IMAGE="${D}"
+ declare -r IMAGE="${IMAGE}"
+
+ export S="${WORKDIR}/${P}"
+}
+
+ebuild_f_init_bin()
+{
+ if hasq "init_bin" ${RESTRICT} ; then
+ ebuild_section "Skipping builtin_init_bin (RESTRICT)"
+ elif hasq "init_bin" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping builtin_init_bin (SKIP_FUNCTIONS)"
+ else
+ ebuild_section "Starting builtin_init_bin"
+ builtin_init_bin
+ ebuild_section "Done builtin_init_bin"
+ fi
+}
+
+
diff --git a/ebuild/builtin_unpack_bin.bash b/ebuild/builtin_unpack_bin.bash
new file mode 100644
index 0000000..6f5e8ff
--- /dev/null
+++ b/ebuild/builtin_unpack_bin.bash
@@ -0,0 +1,50 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
+# Gentoo Foundation and distributed under the terms of the GNU General
+# Public License v2.
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+builtin_unpack_bin()
+{
+ unpack --binary ${B}
+ local ebuild_dir="${IMAGE}/tmp/paludis-ebin/${SRC_REPOSITORY}/${CATEGORY}/${PF}/"
+ [[ -d "${ebuild_dir}" ]] || die "ebuild_dir not a directory. Invalid binary package?"
+ mv "${ebuild_dir}/"* "${WORKDIR}"/
+ rm -fr "${IMAGE}/tmp/paludis-ebin"
+ export PALUDIS_LOAD_ENVIRONMENT="${WORKDIR}/environment.bz2"
+ ebuild_load_ebuild "${WORKDIR}/${PF}.ebuild"
+}
+
+ebuild_f_unpack_bin()
+{
+ cd ${WORKDIR} || die "cd to \${WORKDIR} (\"${WORKDIR}\") failed"
+
+ if hasq "unpack_bin" ${RESTRICT} ; then
+ ebuild_section "Skipping builtin_unpack_bin (RESTRICT)"
+ elif hasq "unpack_bin" ${SKIP_FUNCTIONS} ; then
+ ebuild_section "Skipping builtin_unpack_bin (SKIP_FUNCTIONS)"
+ else
+ ebuild_section "Starting builtin_unpack_bin"
+ builtin_unpack_bin
+ ebuild_section "Done builtin_unpack_bin"
+ fi
+}
+
+
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index e3d3234..494ff08 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -232,7 +232,7 @@ ebuild_main()
for action in $@ ; do
case ${action} in
- metadata|variable|init|fetch|merge|unmerge|tidyup|strip)
+ metadata|variable|init|fetch|merge|unmerge|tidyup|strip|init_bin|unpack_bin|fetch_bin)
ebuild_load_module builtin_${action}
;;
@@ -267,7 +267,9 @@ ebuild_main()
fi
perform_hook ebuild_${action}_post
else
- ebuild_load_ebuild "${ebuild}"
+ if [[ "${ebuild%.ebin}" == "${ebuild}" ]] ; then
+ ebuild_load_ebuild "${ebuild}"
+ fi
for action in $@ ; do
export EBUILD_PHASE="${action}"
perform_hook ebuild_${action}_pre
diff --git a/ebuild/utils/dounpack b/ebuild/utils/dounpack
index 65463d2..5dff515 100755
--- a/ebuild/utils/dounpack
+++ b/ebuild/utils/dounpack
@@ -54,13 +54,13 @@ unpack_one()
;;
*.gz|*.Z|*.z)
- echo gzip -dc "${1}" > ${WORKDIR}/$(basename "${1%.*}" ) 1>&2
- gzip -dc "${1}" > ${WORKDIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}"
+ echo gzip -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) 1>&2
+ gzip -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}"
;;
*.bz2)
- echo bzip2 -dc "${1}" > ${WORKDIR}/$(basename "${1%.*}" ) 1>&2
- bzip2 -dc "${1}" > ${WORKDIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}"
+ echo bzip2 -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) 1>&2
+ bzip2 -dc "${1}" > ${UNPACKTODIR}/$(basename "${1%.*}" ) || die "Couldn't unpack ${1}"
;;
*.rar|*.RAR)
@@ -85,12 +85,23 @@ unpack_one()
}
+export UNPACKFROMDIR="${DISTDIR}"
+export UNPACKTODIR="${PWD}"
+
+if [[ "${1}" == "--binary" ]] ; then
+ export UNPACKFROMDIR="${PKGDIR}"
+ export UNPACKTODIR="${IMAGE}"
+ shift
+fi
+
[[ -z "$@" ]] && die "No arguments given to unpack"
for x in "$@" ; do
x=$(echo $x )
- echo ">>> Unpacking ${x} to ${PWD}"
- [[ "${x:0:2}" == "./" ]] || x="${DISTDIR}/${x}"
+ echo ">>> Unpacking ${x} to ${UNPACKTODIR}"
+ [[ "${x:0:2}" == "./" ]] || x="${UNPACKFROMDIR}/${x}"
+ mkdir -p ${UNPACKTODIR}
+ cd ${UNPACKTODIR}
unpack_one "${x}"
done
diff --git a/paludis/ebin.cc b/paludis/ebin.cc
new file mode 100644
index 0000000..6dbef12
--- /dev/null
+++ b/paludis/ebin.cc
@@ -0,0 +1,212 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/ebin.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/strip.hh>
+#include <paludis/util/pstream.hh>
+#include <paludis/util/log.hh>
+#include <paludis/environment.hh>
+#include <paludis/config_file.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <sys/resource.h>
+#include <sys/time.h>
+
+/** \file
+ * Implementation for ebin.hh things.
+ *
+ * \ingroup grpebininterface
+ */
+
+using namespace paludis;
+
+EbinCommand::EbinCommand(const EbinCommandParams & p) :
+ params(p)
+{
+}
+
+EbinCommand::~EbinCommand()
+{
+}
+
+bool
+EbinCommand::success()
+{
+ return true;
+}
+
+bool
+EbinCommand::use_sandbox() const
+{
+ return true;
+}
+
+bool
+EbinCommand::failure()
+{
+ return false;
+}
+
+bool
+EbinCommand::operator() ()
+{
+ std::string ebin_cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
+ "/ebuild.bash '" +
+ stringify(params.get<ebcpk_ebin_dir>()) + "/" +
+ stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
+ stringify(params.get<ebcpk_db_entry>()->get<pde_version>()) +
+ ".ebin' " + commands());
+
+ if (use_sandbox())
+ ebin_cmd = make_sandbox_command(ebin_cmd);
+
+ MakeEnvCommand cmd(extend_command(make_env_command(ebin_cmd)
+ ("P", stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
+ stringify(params.get<ebcpk_db_entry>()->get<pde_version>().remove_revision()))
+ ("PV", stringify(params.get<ebcpk_db_entry>()->get<pde_version>().remove_revision()))
+ ("PR", stringify(params.get<ebcpk_db_entry>()->get<pde_version>().revision_only()))
+ ("PN", stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()))
+ ("PVR", stringify(params.get<ebcpk_db_entry>()->get<pde_version>()))
+ ("PF", stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
+ stringify(params.get<ebcpk_db_entry>()->get<pde_version>()))
+ ("CATEGORY", stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_category>()))
+ ("REPOSITORY", stringify(params.get<ebcpk_db_entry>()->get<pde_repository>()))
+ ("SRC_REPOSITORY", stringify(params.get<ebcpk_src_repository>()))
+ ("PKGDIR", stringify(params.get<ebcpk_pkgdir>()))
+ ("PALUDIS_TMPDIR", stringify(params.get<ebcpk_buildroot>()))
+ ("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
+ ("PALUDIS_BASHRC_FILES", params.get<ebcpk_environment>()->bashrc_files())
+ ("PALUDIS_HOOK_DIRS", params.get<ebcpk_environment>()->hook_dirs())
+ ("PALUDIS_COMMAND", params.get<ebcpk_environment>()->paludis_command())
+ ("KV", kernel_version())
+ ("PALUDIS_EBUILD_LOG_LEVEL", Log::get_instance()->log_level_string())
+ ("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))));
+
+ if (do_run_command(add_portage_vars(cmd)))
+ return success();
+ else
+ return failure();
+}
+
+MakeEnvCommand
+EbinCommand::add_portage_vars(const MakeEnvCommand & cmd) const
+{
+ return cmd
+ ("PORTAGE_BASHRC", "/dev/null")
+ ("PORTAGE_BUILDDIR", stringify(params.get<ebcpk_buildroot>()) + "/" +
+ stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_category>()) + "/" +
+ stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
+ stringify(params.get<ebcpk_db_entry>()->get<pde_version>()))
+ ("PORTAGE_CALLER", params.get<ebcpk_environment>()->paludis_command())
+ ("PORTAGE_GID", "0")
+ ("PORTAGE_INST_GID", "0")
+ ("PORTAGE_INST_UID", "0")
+ ("PORTAGE_MASTER_PID", stringify(::getpid()))
+ ("PORTAGE_NICENCESS", stringify(::getpriority(PRIO_PROCESS, 0)))
+ ("PORTAGE_TMPDIR", stringify(params.get<ebcpk_buildroot>()))
+ ("PORTAGE_TMPFS", "/dev/shm")
+ ("PORTAGE_WORKDIR_MODE", "0700");
+}
+
+bool
+EbinCommand::do_run_command(const std::string & cmd)
+{
+ return 0 == run_command(cmd);
+}
+
+std::string
+EbinFetchCommand::commands() const
+{
+ return "fetch_bin";
+}
+
+bool
+EbinFetchCommand::failure()
+{
+ throw PackageFetchActionError("Fetch failed for '" + stringify(
+ *params.get<ebcpk_db_entry>()) + "'");
+}
+
+MakeEnvCommand
+EbinFetchCommand::extend_command(const MakeEnvCommand & cmd)
+{
+ MakeEnvCommand result(cmd
+ ("B", fetch_params.get<ebcfpk_b>())
+ ("FLAT_BIN_URI", fetch_params.get<ebcfpk_flat_bin_uri>())
+ ("ROOT", fetch_params.get<ebcfpk_root>())
+ ("PALUDIS_PROFILE_DIR", stringify(*fetch_params.get<ebcfpk_profiles>()->begin()))
+ ("PALUDIS_PROFILE_DIRS", join(fetch_params.get<ebcfpk_profiles>()->begin(),
+ fetch_params.get<ebcfpk_profiles>()->end(), " ")));
+
+ return result;
+}
+
+EbinFetchCommand::EbinFetchCommand(const EbinCommandParams & p,
+ const EbinFetchCommandParams & f) :
+ EbinCommand(p),
+ fetch_params(f)
+{
+}
+
+std::string
+EbinInstallCommand::commands() const
+{
+ if (install_params.get<ebcipk_merge_only>())
+ return "merge";
+ else
+ return "init_bin unpack_bin setup preinst merge postinst tidyup";
+}
+
+bool
+EbinInstallCommand::failure()
+{
+ throw PackageInstallActionError("Install failed for '" + stringify(
+ *params.get<ebcpk_db_entry>()) + "'");
+}
+
+MakeEnvCommand
+EbinInstallCommand::extend_command(const MakeEnvCommand & cmd)
+{
+ MakeEnvCommand result(cmd
+ ("B", install_params.get<ebcipk_b>())
+ ("USE", install_params.get<ebcipk_use>())
+ ("USE_EXPAND", install_params.get<ebcipk_use_expand>())
+ ("ROOT", install_params.get<ebcipk_root>())
+ ("PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK",
+ install_params.get<ebcipk_disable_cfgpro>() ? "/" : "")
+ ("PALUDIS_PROFILE_DIR", stringify(*install_params.get<ebcipk_profiles>()->begin()))
+ ("PALUDIS_PROFILE_DIRS", join(install_params.get<ebcipk_profiles>()->begin(),
+ install_params.get<ebcipk_profiles>()->end(), " "))
+ ("SLOT", stringify(install_params.get<ebcipk_slot>())));
+
+ for (AssociativeCollection<std::string, std::string>::Iterator
+ i(install_params.get<ebcipk_expand_vars>()->begin()),
+ j(install_params.get<ebcipk_expand_vars>()->end()) ; i != j ; ++i)
+ result = result(i->first, i->second);
+
+ return result;
+}
+
+EbinInstallCommand::EbinInstallCommand(const EbinCommandParams & p,
+ const EbinInstallCommandParams & f) :
+ EbinCommand(p),
+ install_params(f)
+{
+}
+
diff --git a/paludis/ebin.hh b/paludis/ebin.hh
new file mode 100644
index 0000000..c5051e2
--- /dev/null
+++ b/paludis/ebin.hh
@@ -0,0 +1,307 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_EBIN_HH
+#define PALUDIS_GUARD_PALUDIS_EBIN_HH 1
+
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/smart_record.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/collection.hh>
+#include <paludis/package_database.hh>
+#include <string>
+
+/** \file
+ * Declarations for the EbinCommand classes.
+ *
+ * \ingroup grpebininterface
+ */
+
+namespace paludis
+{
+ /**
+ * Keys for EbinCommandParams.
+ *
+ * \see EbinCommandParams
+ *
+ * \ingroup grpebininterface
+ */
+ enum EbinCommandParamsKeys
+ {
+ ebcpk_ebin_dir,
+ ebcpk_environment,
+ ebcpk_db_entry,
+ ebcpk_src_repository,
+ ebcpk_pkgdir,
+ ebcpk_buildroot,
+ last_ebcpk
+ };
+
+ class Environment;
+ class MakeEnvCommand;
+
+ /**
+ * Tag for EbinCommandParams.
+ *
+ * \see EbinCommandParams.
+ *
+ * \ingroup grpebininterface
+ */
+ struct EbinCommandParamsTag :
+ SmartRecordTag<comparison_mode::NoComparisonTag, void>,
+ SmartRecordKeys<EbinCommandParamsKeys, last_ebcpk>,
+ SmartRecordKey<ebcpk_ebin_dir, const FSEntry>,
+ SmartRecordKey<ebcpk_environment, const Environment *>,
+ SmartRecordKey<ebcpk_db_entry, const PackageDatabaseEntry *>,
+ SmartRecordKey<ebcpk_src_repository, const RepositoryName>,
+ SmartRecordKey<ebcpk_pkgdir, const FSEntry>,
+ SmartRecordKey<ebcpk_buildroot, const FSEntry>
+ {
+ };
+
+ /**
+ * Parameters for EbinCommand's constructor.
+ *
+ * \ingroup grpebininterface
+ */
+ typedef MakeSmartRecord<EbinCommandParamsTag>::Type EbinCommandParams;
+
+ /**
+ * An EbinCommand is the base class from which specific ebin
+ * command interfaces are descended.
+ *
+ * \ingroup grpebininterface
+ */
+ class EbinCommand :
+ private InstantiationPolicy<EbinCommand, instantiation_method::NonCopyableTag>
+ {
+ protected:
+ /**
+ * Our parameters.
+ */
+ const EbinCommandParams params;
+
+ /**
+ * Constructor.
+ */
+ EbinCommand(const EbinCommandParams &);
+
+ /**
+ * Override in descendents: which commands (for example, 'prerm
+ * unmerge postrm') do we give to ebin.bash?
+ */
+ virtual std::string commands() const = 0;
+
+ /**
+ * Actions to be taken after a successful command.
+ *
+ * The return value of this function is used for the return value
+ * of operator().
+ */
+ virtual bool success();
+
+ /**
+ * Should the sandbox, if available, be used?
+ */
+ virtual bool use_sandbox() const;
+
+ /**
+ * Actions to be taken after a failed command.
+ *
+ * The return value of this function is used for the return value
+ * of operator(). In some descendents, this function throws and
+ * does not return.
+ */
+ virtual bool failure() = 0;
+
+ /**
+ * Run the specified command. Can be overridden if, for example,
+ * the command output needs to be captured.
+ *
+ * \return Whether the command succeeded.
+ */
+ virtual bool do_run_command(const std::string &);
+
+ /**
+ * Add Portage emulation vars.
+ */
+ virtual MakeEnvCommand add_portage_vars(const MakeEnvCommand &) const;
+
+ /**
+ * Extend the command to be run.
+ */
+ virtual MakeEnvCommand extend_command(const MakeEnvCommand &) = 0;
+
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~EbinCommand();
+
+ /**
+ * Run the command.
+ */
+ virtual bool operator() ();
+ };
+
+ /**
+ * Keys for EbinFetchCommandParams.
+ *
+ * \see EbinFetchCommandParams
+ *
+ * \ingroup grpebininterface
+ */
+ enum EbinFetchCommandParamsKeys
+ {
+ ebcfpk_b,
+ ebcfpk_flat_bin_uri,
+ ebcfpk_root,
+ ebcfpk_profiles,
+ last_ebcfpk
+ };
+
+ /**
+ * Tag for EbinFetchCommandParams.
+ *
+ * \see EbinFetchCommandParams
+ *
+ * \ingroup grpebininterface
+ */
+ struct EbinFetchCommandParamsTag :
+ SmartRecordTag<comparison_mode::NoComparisonTag, void>,
+ SmartRecordKeys<EbinFetchCommandParamsKeys, last_ebcfpk>,
+ SmartRecordKey<ebcfpk_b, std::string>,
+ SmartRecordKey<ebcfpk_flat_bin_uri, std::string>,
+ SmartRecordKey<ebcfpk_root, std::string>,
+ SmartRecordKey<ebcfpk_profiles, FSEntryCollection::ConstPointer>
+ {
+ };
+
+ /**
+ * Parameters for EbinFetchCommand's constructor.
+ *
+ * \ingroup grpebininterface
+ */
+ typedef MakeSmartRecord<EbinFetchCommandParamsTag>::Type EbinFetchCommandParams;
+
+ /**
+ * An EbinFetchCommand is used to download and verify the digests for a
+ * particular ebin in a PortageRepository. On failure it throws.
+ *
+ * \ingroup grpebininterface
+ */
+ class EbinFetchCommand :
+ public EbinCommand
+ {
+ protected:
+ /// Parameters for fetch.
+ const EbinFetchCommandParams fetch_params;
+
+ virtual std::string commands() const;
+
+ virtual bool failure() PALUDIS_ATTRIBUTE((noreturn));
+
+ virtual MakeEnvCommand extend_command(const MakeEnvCommand &);
+
+ public:
+ /**
+ * Constructor.
+ */
+ EbinFetchCommand(const EbinCommandParams &, const EbinFetchCommandParams &);
+ };
+
+ /**
+ * Keys for EbinInstallCommandParams.
+ *
+ * \see EbinInstallCommandParams
+ *
+ * \ingroup grpebininterface
+ */
+ enum EbinInstallCommandParamsKeys
+ {
+ ebcipk_b,
+ ebcipk_use,
+ ebcipk_use_expand,
+ ebcipk_root,
+ ebcipk_profiles,
+ ebcipk_expand_vars,
+ ebcipk_disable_cfgpro,
+ ebcipk_merge_only,
+ ebcipk_slot,
+ last_ebcipk
+ };
+
+ /**
+ * Tag for EbinInstallCommandParams.
+ *
+ * \see EbinInstallCommandParams
+ *
+ * \ingroup grpebininterface
+ */
+ struct EbinInstallCommandParamsTag :
+ SmartRecordTag<comparison_mode::NoComparisonTag, void>,
+ SmartRecordKeys<EbinInstallCommandParamsKeys, last_ebcipk>,
+ SmartRecordKey<ebcipk_b, std::string>,
+ SmartRecordKey<ebcipk_use, std::string>,
+ SmartRecordKey<ebcipk_use_expand, std::string>,
+ SmartRecordKey<ebcipk_root, std::string>,
+ SmartRecordKey<ebcipk_profiles, FSEntryCollection::ConstPointer>,
+ SmartRecordKey<ebcipk_expand_vars, AssociativeCollection<std::string, std::string>::ConstPointer>,
+ SmartRecordKey<ebcipk_disable_cfgpro, bool>,
+ SmartRecordKey<ebcipk_merge_only, bool>,
+ SmartRecordKey<ebcipk_slot, SlotName>
+ {
+ };
+
+ /**
+ * Parameters for EbinInstallCommand's constructor.
+ *
+ * \ingroup grpebininterface
+ */
+ typedef MakeSmartRecord<EbinInstallCommandParamsTag>::Type EbinInstallCommandParams;
+
+ /**
+ * An EbinInstallCommand is used to install an ebin from a
+ * PortageRepository. On failure it throws.
+ *
+ * \ingroup grpebininterface
+ */
+ class EbinInstallCommand :
+ public EbinCommand
+ {
+ protected:
+ /// Parameters for install.
+ const EbinInstallCommandParams install_params;
+
+ virtual std::string commands() const;
+
+ virtual bool failure() PALUDIS_ATTRIBUTE((noreturn));
+
+ virtual MakeEnvCommand extend_command(const MakeEnvCommand &);
+
+ public:
+ /**
+ * Constructor.
+ */
+ EbinInstallCommand(const EbinCommandParams &, const EbinInstallCommandParams &);
+ };
+}
+
+#endif
diff --git a/paludis/files.m4 b/paludis/files.m4
index 5e52a9b..21ac375 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -18,6 +18,7 @@ add(`dep_atom_flattener', `hh', `cc')
add(`dep_atom_pretty_printer', `hh', `cc')
add(`dep_list', `hh', `cc', `test')
add(`dep_tag', `hh', `cc')
+add(`ebin', `hh', `cc')
add(`ebuild', `hh', `cc')
add(`environment', `hh', `cc')
add(`hashed_containers', `hhx', `cc', `test')
diff --git a/paludis/repositories/portage/Makefile.am b/paludis/repositories/portage/Makefile.am
index 20aa63c..abed3cc 100644
--- a/paludis/repositories/portage/Makefile.am
+++ b/paludis/repositories/portage/Makefile.am
@@ -21,7 +21,10 @@ paludis_repositories_portage_include_HEADERS = \
portage_repository_params.hh \
portage_repository_sets.hh \
portage_repository_entries.hh \
- portage_repository_ebuild_entries.hh
+ portage_repository_ebuild_entries.hh \
+ portage_repository_ebin_entries.hh \
+ make_ebuild_repository.hh \
+ make_ebin_repository.hh
libpaludisportagerepository_la_SOURCES = \
portage_repository.cc \
@@ -31,6 +34,9 @@ libpaludisportagerepository_la_SOURCES = \
portage_repository_sets.cc \
portage_repository_entries.cc \
portage_repository_ebuild_entries.cc \
+ portage_repository_ebin_entries.cc \
+ make_ebuild_repository.cc \
+ make_ebin_repository.cc \
$(paludis_repositories_portage_include_HEADERS)
TESTS = portage_repository_TEST
diff --git a/paludis/repositories/portage/make_ebin_repository.cc b/paludis/repositories/portage/make_ebin_repository.cc
new file mode 100644
index 0000000..880aaeb
--- /dev/null
+++ b/paludis/repositories/portage/make_ebin_repository.cc
@@ -0,0 +1,102 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "make_ebin_repository.hh"
+#include <paludis/util/log.hh>
+#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/repositories/portage/portage_repository_exceptions.hh>
+
+using namespace paludis;
+
+CountedPtr<Repository>
+paludis::make_ebin_repository(
+ const Environment * const env,
+ const PackageDatabase * const db,
+ AssociativeCollection<std::string, std::string>::ConstPointer m)
+{
+ std::string repo_file(m->end() == m->find("repo_file") ? std::string("?") :
+ m->find("repo_file")->second);
+
+ Context context("When making ebin repository from repo_file '" + repo_file + "':");
+
+ std::string location;
+ if (m->end() == m->find("location") || ((location = m->find("location")->second)).empty())
+ throw PortageRepositoryConfigurationError("Key 'location' not specified or empty");
+
+ FSEntryCollection::Pointer profiles(new FSEntryCollection::Concrete);
+ if (m->end() != m->find("profiles"))
+ WhitespaceTokeniser::get_instance()->tokenise(m->find("profiles")->second,
+ create_inserter<FSEntry>(std::back_inserter(*profiles)));
+ if (profiles->empty())
+ throw PortageRepositoryConfigurationError("No profiles have been specified");
+
+ FSEntryCollection::Pointer eclassdirs(new FSEntryCollection::Concrete);
+
+ std::string pkgdir;
+ if (m->end() == m->find("pkgdir") || ((pkgdir = m->find("pkgdir")->second)).empty())
+ pkgdir = location + "/packages";
+
+ std::string setsdir;
+ if (m->end() == m->find("setsdir") || ((setsdir = m->find("setsdir")->second)).empty())
+ setsdir = location + "/sets";
+
+ std::string securitydir;
+ if (m->end() == m->find("securitydir") || ((securitydir = m->find("securitydir")->second)).empty())
+ securitydir = location + "/metadata/security";
+
+ std::string newsdir;
+ if (m->end() == m->find("newsdir") || ((newsdir = m->find("newsdir")->second)).empty())
+ newsdir = location + "/metadata/news";
+
+ std::string sync;
+ if (m->end() == m->find("sync") || ((sync = m->find("sync")->second)).empty())
+ ; // nothing
+
+ std::string sync_exclude;
+ if (m->end() == m->find("sync_exclude") || ((sync_exclude = m->find("sync_exclude")->second)).empty())
+ ; // nothing
+
+ std::string root;
+ if (m->end() == m->find("root") || ((root = m->find("root")->second)).empty())
+ root = "/";
+
+ std::string buildroot;
+ if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
+ buildroot = "/var/tmp/paludis";
+
+ return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create((
+ param<prpk_entry_format>("ebin"),
+ param<prpk_environment>(env),
+ param<prpk_package_database>(db),
+ param<prpk_location>(location),
+ param<prpk_profiles>(profiles),
+ param<prpk_cache>(FSEntry("/var/empty")),
+ param<prpk_eclassdirs>(eclassdirs),
+ param<prpk_distdir>(FSEntry("/var/empty")),
+ param<prpk_pkgdir>(pkgdir),
+ param<prpk_securitydir>(securitydir),
+ param<prpk_setsdir>(setsdir),
+ param<prpk_newsdir>(newsdir),
+ param<prpk_sync>(sync),
+ param<prpk_sync_exclude>(sync_exclude),
+ param<prpk_root>(root),
+ param<prpk_buildroot>(buildroot)))));
+}
+
diff --git a/paludis/repositories/portage/make_ebin_repository.hh b/paludis/repositories/portage/make_ebin_repository.hh
new file mode 100644
index 0000000..5177cb3
--- /dev/null
+++ b/paludis/repositories/portage/make_ebin_repository.hh
@@ -0,0 +1,43 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_MAKE_EBIN_REPOSITORY_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_MAKE_EBIN_REPOSITORY_HH 1
+
+#include <paludis/repositories/portage/portage_repository.hh>
+
+namespace paludis
+{
+ CountedPtr<Repository>
+ make_ebin_repository(const Environment * const,
+ const PackageDatabase * const,
+ AssociativeCollection<std::string, std::string>::ConstPointer);
+
+ /**
+ * Register PortageRepository for ebins.
+ *
+ * \ingroup grpportagerepository
+ */
+ static const RepositoryMaker::RegisterMaker register_portage_ebin_repository(
+ "ebin", &make_ebin_repository);
+
+}
+
+
+#endif
diff --git a/paludis/repositories/portage/make_ebuild_repository.cc b/paludis/repositories/portage/make_ebuild_repository.cc
new file mode 100644
index 0000000..1916572
--- /dev/null
+++ b/paludis/repositories/portage/make_ebuild_repository.cc
@@ -0,0 +1,140 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "make_ebuild_repository.hh"
+#include <paludis/util/log.hh>
+#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/repositories/portage/portage_repository_exceptions.hh>
+
+using namespace paludis;
+
+CountedPtr<Repository>
+paludis::make_ebuild_repository(
+ const Environment * const env,
+ const PackageDatabase * const db,
+ AssociativeCollection<std::string, std::string>::ConstPointer m)
+{
+ std::string repo_file(m->end() == m->find("repo_file") ? std::string("?") :
+ m->find("repo_file")->second);
+
+ Context context("When making ebuild repository from repo_file '" + repo_file + "':");
+
+ std::string location;
+ if (m->end() == m->find("location") || ((location = m->find("location")->second)).empty())
+ throw PortageRepositoryConfigurationError("Key 'location' not specified or empty");
+
+ FSEntryCollection::Pointer profiles(new FSEntryCollection::Concrete);
+ if (m->end() != m->find("profiles"))
+ WhitespaceTokeniser::get_instance()->tokenise(m->find("profiles")->second,
+ create_inserter<FSEntry>(std::back_inserter(*profiles)));
+ if (m->end() != m->find("profile") && ! m->find("profile")->second.empty())
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context,
+ "Key 'profile' in '" + repo_file + "' is deprecated, "
+ "use 'profiles = " + m->find("profile")->second + "' instead");
+ if (profiles->empty())
+ profiles->append(m->find("profile")->second);
+ else
+ throw PortageRepositoryConfigurationError("Both 'profile' and 'profiles' keys are present");
+ }
+ if (profiles->empty())
+ throw PortageRepositoryConfigurationError("No profiles have been specified");
+
+ FSEntryCollection::Pointer eclassdirs(new FSEntryCollection::Concrete);
+ if (m->end() != m->find("eclassdirs"))
+ WhitespaceTokeniser::get_instance()->tokenise(m->find("eclassdirs")->second,
+ create_inserter<FSEntry>(std::back_inserter(*eclassdirs)));
+ if (m->end() != m->find("eclassdir") && ! m->find("eclassdir")->second.empty())
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context,
+ "Key 'eclassdir' in '" + repo_file + "' is deprecated, "
+ "use 'eclassdirs = " + m->find("eclassdir")->second + "' instead");
+ if (eclassdirs->empty())
+ eclassdirs->append(m->find("eclassdir")->second);
+ else
+ throw PortageRepositoryConfigurationError("Both 'eclassdir' and 'eclassdirs' keys are present");
+ }
+ if (eclassdirs->empty())
+ eclassdirs->append(location + "/eclass");
+
+ std::string distdir;
+ if (m->end() == m->find("distdir") || ((distdir = m->find("distdir")->second)).empty())
+ distdir = location + "/distfiles";
+
+ std::string setsdir;
+ if (m->end() == m->find("setsdir") || ((setsdir = m->find("setsdir")->second)).empty())
+ setsdir = location + "/sets";
+
+ std::string securitydir;
+ if (m->end() == m->find("securitydir") || ((securitydir = m->find("securitydir")->second)).empty())
+ securitydir = location + "/metadata/security";
+
+ std::string newsdir;
+ if (m->end() == m->find("newsdir") || ((newsdir = m->find("newsdir")->second)).empty())
+ newsdir = location + "/metadata/news";
+
+ std::string cache;
+ if (m->end() == m->find("cache") || ((cache = m->find("cache")->second)).empty())
+ cache = location + "/metadata/cache";
+
+ std::string sync;
+ if (m->end() == m->find("sync") || ((sync = m->find("sync")->second)).empty())
+ ; // nothing
+
+ std::string sync_exclude;
+ if (m->end() == m->find("sync_exclude") || ((sync_exclude = m->find("sync_exclude")->second)).empty())
+ ; // nothing
+
+ std::string root;
+ if (m->end() == m->find("root") || ((root = m->find("root")->second)).empty())
+ root = "/";
+
+ std::string buildroot;
+ if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
+ buildroot = "/var/tmp/paludis";
+
+ return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create((
+ param<prpk_entry_format>("ebuild"),
+ param<prpk_environment>(env),
+ param<prpk_package_database>(db),
+ param<prpk_location>(location),
+ param<prpk_profiles>(profiles),
+ param<prpk_cache>(cache),
+ param<prpk_eclassdirs>(eclassdirs),
+ param<prpk_distdir>(distdir),
+ param<prpk_pkgdir>(FSEntry("/var/empty")),
+ param<prpk_securitydir>(securitydir),
+ param<prpk_setsdir>(setsdir),
+ param<prpk_newsdir>(newsdir),
+ param<prpk_sync>(sync),
+ param<prpk_sync_exclude>(sync_exclude),
+ param<prpk_root>(root),
+ param<prpk_buildroot>(buildroot)))));
+}
+
+CountedPtr<Repository>
+paludis::make_portage_repository(
+ const Environment * const env,
+ const PackageDatabase * const db,
+ AssociativeCollection<std::string, std::string>::ConstPointer m)
+{
+ return make_ebuild_repository(env, db, m);
+}
+
diff --git a/paludis/repositories/portage/make_ebuild_repository.hh b/paludis/repositories/portage/make_ebuild_repository.hh
new file mode 100644
index 0000000..1524243
--- /dev/null
+++ b/paludis/repositories/portage/make_ebuild_repository.hh
@@ -0,0 +1,55 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_MAKE_EBUILD_REPOSITORY_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_MAKE_EBUILD_REPOSITORY_HH 1
+
+#include <paludis/repositories/portage/portage_repository.hh>
+
+namespace paludis
+{
+ CountedPtr<Repository>
+ make_ebuild_repository(const Environment * const,
+ const PackageDatabase * const,
+ AssociativeCollection<std::string, std::string>::ConstPointer);
+
+ CountedPtr<Repository>
+ make_portage_repository(const Environment * const,
+ const PackageDatabase * const,
+ AssociativeCollection<std::string, std::string>::ConstPointer);
+
+ /**
+ * Register PortageRepository for ebuilds.
+ *
+ * \ingroup grpportagerepository
+ */
+ static const RepositoryMaker::RegisterMaker register_portage_ebuild_repository(
+ "ebuild", &make_ebuild_repository);
+
+ /**
+ * Register PortageRepository for ebuilds (deprecated format = portage).
+ *
+ * \ingroup grpportagerepository
+ */
+ static const RepositoryMaker::RegisterMaker register_portage_portage_repository(
+ "portage", &make_portage_repository);
+
+}
+
+#endif
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 103ae8c..6a4fa15 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -258,6 +258,7 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
_imp->params.get<prpk_eclassdirs>()->end(), " "));
config_info->add_kv("cache", stringify(_imp->params.get<prpk_cache>()));
config_info->add_kv("distdir", stringify(_imp->params.get<prpk_distdir>()));
+ config_info->add_kv("pkgdir", stringify(_imp->params.get<prpk_pkgdir>()));
config_info->add_kv("securitydir", stringify(_imp->params.get<prpk_securitydir>()));
config_info->add_kv("setsdir", stringify(_imp->params.get<prpk_setsdir>()));
config_info->add_kv("newsdir", stringify(_imp->params.get<prpk_newsdir>()));
@@ -675,109 +676,6 @@ PortageRepository::need_virtual_names() const
}
}
-CountedPtr<Repository>
-PortageRepository::make_portage_repository(
- const Environment * const env,
- const PackageDatabase * const db,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
-{
- std::string repo_file(m->end() == m->find("repo_file") ? std::string("?") :
- m->find("repo_file")->second);
-
- Context context("When making Portage repository from repo_file '" + repo_file + "':");
-
- std::string location;
- if (m->end() == m->find("location") || ((location = m->find("location")->second)).empty())
- throw PortageRepositoryConfigurationError("Key 'location' not specified or empty");
-
- FSEntryCollection::Pointer profiles(new FSEntryCollection::Concrete);
- if (m->end() != m->find("profiles"))
- WhitespaceTokeniser::get_instance()->tokenise(m->find("profiles")->second,
- create_inserter<FSEntry>(std::back_inserter(*profiles)));
- if (m->end() != m->find("profile") && ! m->find("profile")->second.empty())
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Key 'profile' in '" + repo_file + "' is deprecated, "
- "use 'profiles = " + m->find("profile")->second + "' instead");
- if (profiles->empty())
- profiles->append(m->find("profile")->second);
- else
- throw PortageRepositoryConfigurationError("Both 'profile' and 'profiles' keys are present");
- }
- if (profiles->empty())
- throw PortageRepositoryConfigurationError("No profiles have been specified");
-
- FSEntryCollection::Pointer eclassdirs(new FSEntryCollection::Concrete);
- if (m->end() != m->find("eclassdirs"))
- WhitespaceTokeniser::get_instance()->tokenise(m->find("eclassdirs")->second,
- create_inserter<FSEntry>(std::back_inserter(*eclassdirs)));
- if (m->end() != m->find("eclassdir") && ! m->find("eclassdir")->second.empty())
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Key 'eclassdir' in '" + repo_file + "' is deprecated, "
- "use 'eclassdirs = " + m->find("eclassdir")->second + "' instead");
- if (eclassdirs->empty())
- eclassdirs->append(m->find("eclassdir")->second);
- else
- throw PortageRepositoryConfigurationError("Both 'eclassdir' and 'eclassdirs' keys are present");
- }
- if (eclassdirs->empty())
- eclassdirs->append(location + "/eclass");
-
- std::string distdir;
- if (m->end() == m->find("distdir") || ((distdir = m->find("distdir")->second)).empty())
- distdir = location + "/distfiles";
-
- std::string setsdir;
- if (m->end() == m->find("setsdir") || ((setsdir = m->find("setsdir")->second)).empty())
- setsdir = location + "/sets";
-
- std::string securitydir;
- if (m->end() == m->find("securitydir") || ((securitydir = m->find("securitydir")->second)).empty())
- securitydir = location + "/metadata/security";
-
- std::string newsdir;
- if (m->end() == m->find("newsdir") || ((newsdir = m->find("newsdir")->second)).empty())
- newsdir = location + "/metadata/news";
-
- std::string cache;
- if (m->end() == m->find("cache") || ((cache = m->find("cache")->second)).empty())
- cache = location + "/metadata/cache";
-
- std::string sync;
- if (m->end() == m->find("sync") || ((sync = m->find("sync")->second)).empty())
- ; // nothing
-
- std::string sync_exclude;
- if (m->end() == m->find("sync_exclude") || ((sync_exclude = m->find("sync_exclude")->second)).empty())
- ; // nothing
-
- std::string root;
- if (m->end() == m->find("root") || ((root = m->find("root")->second)).empty())
- root = "/";
-
- std::string buildroot;
- if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
- buildroot = "/var/tmp/paludis";
-
- return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create((
- param<prpk_entry_format>("ebuild"),
- param<prpk_environment>(env),
- param<prpk_package_database>(db),
- param<prpk_location>(location),
- param<prpk_profiles>(profiles),
- param<prpk_cache>(cache),
- param<prpk_eclassdirs>(eclassdirs),
- param<prpk_distdir>(distdir),
- param<prpk_securitydir>(securitydir),
- param<prpk_setsdir>(setsdir),
- param<prpk_newsdir>(newsdir),
- param<prpk_sync>(sync),
- param<prpk_sync_exclude>(sync_exclude),
- param<prpk_root>(root),
- param<prpk_buildroot>(buildroot)))));
-}
-
bool
PortageRepository::do_is_arch_flag(const UseFlagName & u) const
{
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index 26e921a..2f1a201 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -127,14 +127,6 @@ namespace paludis
PortageRepository(const PortageRepositoryParams &);
/**
- * Virtual constructor.
- */
- static CountedPtr<Repository> make_portage_repository(
- const Environment * const env,
- const PackageDatabase * const db,
- AssociativeCollection<std::string, std::string>::ConstPointer m);
-
- /**
* Destructor.
*/
~PortageRepository();
@@ -170,15 +162,6 @@ namespace paludis
///\}
};
-
- /**
- * Register PortageRepository.
- *
- * \ingroup grpportagerepository
- */
- static const RepositoryMaker::RegisterMaker register_portage_repository(
- "portage", &PortageRepository::make_portage_repository);
-
}
#endif
diff --git a/paludis/repositories/portage/portage_repository_TEST.cc b/paludis/repositories/portage/portage_repository_TEST.cc
index 3104ab6..285cf82 100644
--- a/paludis/repositories/portage/portage_repository_TEST.cc
+++ b/paludis/repositories/portage/portage_repository_TEST.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/repositories/portage/portage_repository.hh>
+#include <paludis/repositories/portage/make_ebuild_repository.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/test_environment.hh>
#include <paludis/util/system.hh>
@@ -52,7 +53,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo1");
keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "test-repo-1");
}
@@ -75,7 +76,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo2");
keys->insert("profile", "portage_repository_TEST_dir/repo2/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "x-repo2");
}
@@ -98,7 +99,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo3");
keys->insert("profile", "portage_repository_TEST_dir/repo3/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "x-repo3");
}
@@ -121,7 +122,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo1");
keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -153,7 +154,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo1");
keys->insert("profile", "portage_repository_TEST_dir/repo1/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -187,7 +188,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -227,7 +228,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
repo->package_names(CategoryNamePart("cat-one"));
@@ -271,7 +272,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
QualifiedPackageNameCollection::ConstPointer names(0);
@@ -324,7 +325,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo5");
keys->insert("profile", "portage_repository_TEST_dir/repo5/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
QualifiedPackageNameCollection::ConstPointer names(0);
@@ -358,7 +359,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -402,7 +403,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo4");
keys->insert("profile", "portage_repository_TEST_dir/repo4/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -445,7 +446,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo8");
keys->insert("profile", "portage_repository_TEST_dir/repo8/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -488,7 +489,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo6");
keys->insert("profile", "portage_repository_TEST_dir/repo6/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -529,7 +530,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo7");
keys->insert("profile", "portage_repository_TEST_dir/repo7/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -566,7 +567,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo7");
keys->insert("profile", "portage_repository_TEST_dir/repo7/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
@@ -597,7 +598,7 @@ namespace test_cases
keys->insert("format", "portage");
keys->insert("location", "portage_repository_TEST_dir/repo9");
keys->insert("profile", "portage_repository_TEST_dir/repo9/profiles/profile");
- PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ PortageRepository::Pointer repo(make_ebuild_repository(
&env, env.package_database().raw_pointer(), keys));
for (int pass = 1 ; pass <= 2 ; ++pass)
diff --git a/paludis/repositories/portage/portage_repository_ebin_entries.hh b/paludis/repositories/portage/portage_repository_ebin_entries.hh
new file mode 100644
index 0000000..248a0cd
--- /dev/null
+++ b/paludis/repositories/portage/portage_repository_ebin_entries.hh
@@ -0,0 +1,81 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_PORTAGE_REPOSITORY_EBIN_METADATA_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_PORTAGE_REPOSITORY_EBIN_METADATA_HH 1
+
+#include <paludis/repositories/portage/portage_repository_entries.hh>
+#include <paludis/repositories/portage/portage_repository_params.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+
+/** \file
+ * Declaration for the PortageRepositoryEbinEntries class.
+ *
+ * \ingroup grpportagerepository
+ */
+
+namespace paludis
+{
+ class FSEntry;
+ class PortageRepository;
+
+ /**
+ * PortageRepositoryEntries handler for ebins.
+ *
+ * \ingroup grpportagerepository
+ */
+ class PortageRepositoryEbinEntries :
+ public PortageRepositoryEntries,
+ private PrivateImplementationPattern<PortageRepositoryEbinEntries>
+ {
+ public:
+ static PortageRepositoryEbinEntries::Pointer
+ make_portage_repository_ebin_entries(const Environment * const,
+ PortageRepository * const, const PortageRepositoryParams &);
+
+ PortageRepositoryEbinEntries(const Environment * const,
+ PortageRepository * const portage_repository,
+ const PortageRepositoryParams &);
+
+ virtual ~PortageRepositoryEbinEntries();
+
+ virtual VersionMetadata::Pointer generate_version_metadata(const QualifiedPackageName &,
+ const VersionSpec &) const;
+
+ virtual std::string get_environment_variable(const QualifiedPackageName &,
+ const VersionSpec &, const std::string & var,
+ PortageRepositoryProfile::ConstPointer) const;
+
+ virtual void install(const QualifiedPackageName &, const VersionSpec &,
+ const InstallOptions &, PortageRepositoryProfile::ConstPointer) const;
+ };
+
+ /**
+ * Register PortageRepositoryEbinEntries.
+ *
+ * \ingroup grpportagerepository
+ */
+ static const PortageRepositoryEntriesMaker::RegisterMaker register_portage_repository_ebin_entries(
+ "ebin", &PortageRepositoryEbinEntries::make_portage_repository_ebin_entries);
+
+
+}
+
+#endif
+
diff --git a/paludis/repositories/portage/portage_repository_params.hh b/paludis/repositories/portage/portage_repository_params.hh
index 6c8b865..fe3bdf6 100644
--- a/paludis/repositories/portage/portage_repository_params.hh
+++ b/paludis/repositories/portage/portage_repository_params.hh
@@ -49,6 +49,7 @@ namespace paludis
prpk_profiles,
prpk_cache,
prpk_distdir,
+ prpk_pkgdir,
prpk_eclassdirs,
prpk_setsdir,
prpk_securitydir,
@@ -76,6 +77,7 @@ namespace paludis
SmartRecordKey<prpk_profiles, FSEntryCollection::Pointer>,
SmartRecordKey<prpk_cache, const FSEntry>,
SmartRecordKey<prpk_distdir, const FSEntry>,
+ SmartRecordKey<prpk_pkgdir, const FSEntry>,
SmartRecordKey<prpk_eclassdirs, FSEntryCollection::Pointer>,
SmartRecordKey<prpk_setsdir, const FSEntry>,
SmartRecordKey<prpk_securitydir, const FSEntry>,
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index 12e50ae..6126190 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -59,11 +59,18 @@ VersionMetadataDeps::post_depend() const
}
VersionMetadata::Ebuild::Ebuild(ParserFunction f) :
- VersionMetadata(f, &_e),
+ VersionMetadata(f, &_e, 0),
_e()
{
}
+VersionMetadata::Ebin::Ebin(ParserFunction f) :
+ VersionMetadata(f, &_e, &_eb),
+ _e(),
+ _eb()
+{
+}
+
VersionMetadata::~VersionMetadata()
{
}
@@ -82,7 +89,8 @@ VersionMetadata::VersionMetadata(ParserFunction p) :
{
}
-VersionMetadata::VersionMetadata(ParserFunction p, EbuildVersionMetadata * ebuild_if) :
+VersionMetadata::VersionMetadata(ParserFunction p, EbuildVersionMetadata * ebuild_if,
+ EbinVersionMetadata * ebin_if) :
MakeSmartRecord<VersionMetadataTag>::Type(MakeSmartRecord<VersionMetadataTag>::Type::create((
param<vm_slot>(SlotName("unset")),
param<vm_deps>(VersionMetadataDeps(p)),
@@ -92,7 +100,8 @@ VersionMetadata::VersionMetadata(ParserFunction p, EbuildVersionMetadata * ebuil
param<vm_eapi>("UNSET"),
param<vm_license>("")
))),
- _ebuild_if(ebuild_if)
+ _ebuild_if(ebuild_if),
+ _ebin_if(ebin_if)
{
}
@@ -109,6 +118,13 @@ EbuildVersionMetadata::EbuildVersionMetadata() :
{
}
+EbinVersionMetadata::EbinVersionMetadata() :
+ MakeSmartRecord<EbinVersionMetadataTag>::Type((EbinVersionMetadata::create((
+ param<ebvm_bin_uri>(""),
+ param<ebvm_src_repository>(RepositoryName("unset"))))))
+{
+}
+
DepAtom::ConstPointer
EbuildVersionMetadata::provide() const
{
diff --git a/paludis/version_metadata.hh b/paludis/version_metadata.hh
index c5c606b..f8917ba 100644
--- a/paludis/version_metadata.hh
+++ b/paludis/version_metadata.hh
@@ -198,6 +198,49 @@ namespace paludis
};
/**
+ * Key for EbinVersionMetadata.
+ *
+ * \see EbinVersionMetadata
+ * \ingroup grpversions
+ */
+ enum EbinVersionMetadataKey
+ {
+ ebvm_bin_uri, ///< BIN_URI
+ ebvm_src_repository, ///< SRC_REPOSITORY
+ last_ebvm ///< number of items
+ };
+
+ /**
+ * Tag for EbinVersionMetadata.
+ *
+ * \see EbinVersionMetadata
+ * \ingroup grpversions
+ */
+ struct EbinVersionMetadataTag :
+ SmartRecordTag<comparison_mode::NoComparisonTag, void>,
+ SmartRecordKeys<EbinVersionMetadataKey, last_ebvm>,
+ SmartRecordKey<ebvm_bin_uri, std::string>,
+ SmartRecordKey<ebvm_src_repository, RepositoryName>
+ {
+ };
+
+ /**
+ * Version metadata for an ebin.
+ *
+ * \ingroup grpversions
+ * \see VersionMetadata
+ */
+ class EbinVersionMetadata :
+ public MakeSmartRecord<EbinVersionMetadataTag>::Type
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ EbinVersionMetadata();
+ };
+
+ /**
* Version metadata.
*
* \ingroup grpversions
@@ -209,12 +252,14 @@ namespace paludis
{
private:
EbuildVersionMetadata * _ebuild_if;
+ EbinVersionMetadata * _ebin_if;
protected:
/**
* Constructor.
*/
- VersionMetadata(ParserFunction, EbuildVersionMetadata * ebuild_if);
+ VersionMetadata(ParserFunction, EbuildVersionMetadata * ebuild_if,
+ EbinVersionMetadata * ebin_if);
public:
/**
@@ -245,12 +290,32 @@ namespace paludis
return _ebuild_if;
}
+
+ /**
+ * Fetch our ebin interface, or 0.
+ */
+ EbinVersionMetadata *
+ get_ebin_interface()
+ {
+ return _ebin_if;
+ }
+
+ /**
+ * Fetch our ebin interface, or 0.
+ */
+ const EbinVersionMetadata *
+ get_ebin_interface() const
+ {
+ return _ebin_if;
+ }
+
/**
* Fetch our licence, as a dep atom structure.
*/
DepAtom::ConstPointer license() const;
class Ebuild;
+ class Ebin;
};
/**
@@ -281,6 +346,36 @@ namespace paludis
*/
typedef CountedPtr<const VersionMetadata::Ebuild, count_policy::InternalCountTag> ConstPointer;
};
+
+ /**
+ * VersionMetadata subclass, for ebins.
+ *
+ * \ingroup grpversions
+ * \see VersionMetadata
+ */
+ class VersionMetadata::Ebin :
+ public VersionMetadata
+ {
+ private:
+ EbuildVersionMetadata _e;
+ EbinVersionMetadata _eb;
+
+ public:
+ /**
+ * Constructor.
+ */
+ Ebin(ParserFunction);
+
+ /**
+ * Pointer to us.
+ */
+ typedef CountedPtr<VersionMetadata::Ebin, count_policy::InternalCountTag> Pointer;
+
+ /**
+ * Const pointer to us.
+ */
+ typedef CountedPtr<const VersionMetadata::Ebin, count_policy::InternalCountTag> ConstPointer;
+ };
}
#endif
diff --git a/src/paludis/query.cc b/src/paludis/query.cc
index 045bc0a..8a46bad 100644
--- a/src/paludis/query.cc
+++ b/src/paludis/query.cc
@@ -210,6 +210,14 @@ void do_one_query(
cout << " " << std::setw(22) << std::left << "VIRTUAL:" << std::setw(0) <<
" " << metadata->get_ebuild_interface()->get<p::evm_virtual>() << endl;
}
+
+ if (metadata->get_ebin_interface())
+ {
+ cout << " " << std::setw(22) << std::left << "BIN_URI:" << std::setw(0) <<
+ " " << metadata->get_ebin_interface()->get<p::ebvm_bin_uri>() << endl;
+ cout << " " << std::setw(22) << std::left << "SRC_REPOSITORY:" << std::setw(0) <<
+ " " << metadata->get_ebin_interface()->get<p::ebvm_src_repository>() << endl;
+ }
}
else
{