aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-03-18 21:25:33 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-03-18 21:25:33 +0000
commitd818cd29755e19cdb5ba22477e09fdaae9707300 (patch)
tree6df129eb05a5ffff530cddb00e63d53a1ecf9cf8
parentd5b92c5698bec611cfec7b397b17ea2a2203afec (diff)
downloadpaludis-d818cd29755e19cdb5ba22477e09fdaae9707300.tar.gz
paludis-d818cd29755e19cdb5ba22477e09fdaae9707300.tar.xz
Clean up
-rw-r--r--ebuild/builtin_merge.bash13
-rw-r--r--paludis/name.hh3
-rw-r--r--paludis/package_database.hh2
-rw-r--r--paludis/portage_repository.cc47
-rw-r--r--paludis/util/collection.hh (renamed from paludis/util/sorted_collection.hh)94
-rw-r--r--paludis/util/files.m415
-rw-r--r--paludis/util/sequential_collection.cc23
-rw-r--r--paludis/util/sequential_collection.hh116
-rw-r--r--paludis/util/smart_record.cc21
-rw-r--r--paludis/util/sorted_collection.cc23
-rw-r--r--paludis/util/stringify.cc21
-rw-r--r--paludis/util/tokeniser.cc21
-rw-r--r--paludis/util/validated.cc21
-rw-r--r--paludis/util/virtual_constructor.cc27
-rw-r--r--paludis/util/visitor.cc26
-rw-r--r--paludis/version_spec.hh2
16 files changed, 138 insertions, 337 deletions
diff --git a/ebuild/builtin_merge.bash b/ebuild/builtin_merge.bash
index c4f2f09..2f75238 100644
--- a/ebuild/builtin_merge.bash
+++ b/ebuild/builtin_merge.bash
@@ -19,6 +19,19 @@
builtin_merge()
{
+ if [[ -n "${CONFIG_PROTECT}" ]] ; then
+ local d f
+ for d in ${CONFIG_PROTECT} ; do
+
+ find "${D}${d}" -type f | \
+ while read f ; do
+ if [[ -e "${ROOT}${f#${D}}" ]] ; then
+ echo "CONFIG_PROTECT ${f#${D}}"
+ fi
+ done
+ done
+ fi
+
install -d "${ROOT}/" || die "couldn't make \${ROOT} (\"${ROOT}\")"
if [[ -d "${D}" ]] ; then
cp -vdfpR "${D}/"* "${ROOT}/" || die "builtin_merge failed"
diff --git a/paludis/name.hh b/paludis/name.hh
index 07a84da..1bd9374 100644
--- a/paludis/name.hh
+++ b/paludis/name.hh
@@ -25,8 +25,7 @@
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/smart_record.hh>
-#include <paludis/util/sequential_collection.hh>
-#include <paludis/util/sorted_collection.hh>
+#include <paludis/util/collection.hh>
#include <paludis/util/validated.hh>
namespace paludis
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index 21415f9..91dd8e2 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -29,7 +29,7 @@
#include <paludis/util/join.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/smart_record.hh>
-#include <paludis/util/sorted_collection.hh>
+#include <paludis/util/collection.hh>
#include <paludis/version_metadata.hh>
#include <paludis/version_spec.hh>
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index dbef676..69dbb50 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -638,28 +638,31 @@ PortageRepository::do_version_metadata(
Log::get_instance()->message(ll_warning, "No cache entry for '" + stringify(c) + "/" +
stringify(p) + "-" + stringify(v) + "' in '" + stringify(name()) + "'");
- std::string cmd(
- "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(_imp->location) + "/" + stringify(c) + "/" +
- stringify(p) + "/files/' " +
- "ECLASSDIR='" + stringify(_imp->location) + "/eclass/' " +
- "PORTDIR='" + stringify(_imp->location) + "/' " +
- "DISTDIR='" + stringify(_imp->location) + "/distfiles/' " +
- "WORKDIR='/dev/null' " +
- "PALUDIS_TMPDIR='/dev/null' " +
- "KV='" + kernel_version() + "' " +
- "PALUDIS_EBUILD_LOG_LEVEL='" + log_level_string() + "' " +
- getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
- "/ebuild.bash '" +
- stringify(_imp->location) + "/" + stringify(c) + "/" + stringify(p) + "/" +
- stringify(p) + "-" + stringify(v) + ".ebuild' metadata");
+ std::string actions("metadata");
+ std::string cmd(make_env_command(
+ getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
+ "/ebuild.bash '" +
+ stringify(_imp->location) + "/" +
+ stringify(c) + "/" +
+ stringify(p) + "/" +
+ stringify(p) + "-" + stringify(v) + ".ebuild' " + actions)
+ ("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))
+ ("CATEGORY", stringify(c))
+ ("FILESDIR", stringify(_imp->location) + "/" + stringify(c) + "/" +
+ stringify(p) + "/files/")
+ ("ECLASSDIR", stringify(_imp->location) + "/eclass/")
+ ("PORTDIR", stringify(_imp->location) + "/")
+ ("DISTDIR", stringify(_imp->location) + "/distfiles/")
+ ("PALUDIS_TMPDIR", BIGTEMPDIR "/paludis/")
+ ("KV", kernel_version())
+ ("PALUDIS_EBUILD_LOG_LEVEL", log_level_string())
+ ("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")));
+
PStream prog(cmd);
KeyValueConfigFile f(&prog);
diff --git a/paludis/util/sorted_collection.hh b/paludis/util/collection.hh
index 0b20ad5..d5113a1 100644
--- a/paludis/util/sorted_collection.hh
+++ b/paludis/util/collection.hh
@@ -17,17 +17,103 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PALUDIS_GUARD_PALUDIS_SORTED_COLLECTION_HH
-#define PALUDIS_GUARD_PALUDIS_SORTED_COLLECTION_HH 1
+#ifndef PALUDIS_GUARD_PALUDIS_SEQUENTIAL_COLLECTION_HH
+#define PALUDIS_GUARD_PALUDIS_SEQUENTIAL_COLLECTION_HH 1
-#include <iterator>
+#include <algorithm>
+#include <list>
+#include <set>
#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <set>
namespace paludis
{
/**
+ * Wrapper around a std::list of a particular item. Multiple items
+ * with the same value are disallowed.
+ */
+ template <typename T_>
+ class SequentialCollection :
+ private InstantiationPolicy<SequentialCollection<T_>, instantiation_method::NonCopyableTag>,
+ public InternalCounted<SequentialCollection<T_> >
+ {
+ private:
+ std::list<T_> _items;
+
+ public:
+ /**
+ * Constructor.
+ */
+ SequentialCollection()
+ {
+ }
+
+ /**
+ * Destructor.
+ */
+ virtual ~SequentialCollection()
+ {
+ }
+
+ /**
+ * Our iterator type.
+ */
+ typedef typename std::list<T_>::const_iterator Iterator;
+
+ /**
+ * Iterator to the start of our items.
+ */
+ Iterator begin() const
+ {
+ return _items.begin();
+ }
+
+ /**
+ * Iterator to one past our last item.
+ */
+ Iterator end() const
+ {
+ return _items.end();
+ }
+
+ /**
+ * Iterator to our last item.
+ */
+ Iterator last() const
+ {
+ return _items.begin() == _items.end() ? _items.end() : --(_items.end());
+ }
+
+ /**
+ * Return an Iterator to an item, or end() if there's no match.
+ */
+ Iterator find(const T_ & v) const
+ {
+ return std::find(_items.begin(), _items.end(), v);
+ }
+
+ /**
+ * Append an item, return whether we succeeded.
+ */
+ bool append(T_ v)
+ {
+ if (end() != find(v))
+ return false;
+
+ _items.push_back(v);
+ return true;
+ }
+
+ /**
+ * Are we empty?
+ */
+ bool empty() const
+ {
+ return _items.empty();
+ }
+ };
+
+ /**
* Wrapper around a std::set of a particular item. May be changed at some
* point to support template find.
*/
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 4521b9c..3e1e277 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -9,6 +9,7 @@ dnl `test', `impl', `testscript'. Note that there isn't much error checking done
dnl on this file at present...
add(`attributes', `hh')
+add(`collection', `hh')
add(`compare', `hh')
add(`comparison_policy', `hh', `test')
add(`composite_pattern', `hh')
@@ -29,15 +30,13 @@ add(`match_sequence', `hh', `cc', `test')
add(`private_implementation_pattern', `hh', `cc')
add(`pstream', `hh', `cc', `test')
add(`save', `hh', `cc', `test')
-add(`sequential_collection', `hh', `cc')
-add(`smart_record', `hh', `cc', `test')
-add(`sorted_collection', `hh', `cc')
-add(`stringify', `hh', `cc', `test')
+add(`smart_record', `hh', `test')
+add(`stringify', `hh', `test')
add(`strip', `hh', `cc', `test')
add(`system', `hh', `cc', `test')
-add(`tokeniser', `hh', `cc', `test')
+add(`tokeniser', `hh', `test')
add(`util', `hh')
-add(`validated', `hh', `cc', `test')
-add(`virtual_constructor', `hh', `cc', `test')
-add(`visitor', `hh', `cc', `test')
+add(`validated', `hh', `test')
+add(`virtual_constructor', `hh', `test')
+add(`visitor', `hh', `test')
diff --git a/paludis/util/sequential_collection.cc b/paludis/util/sequential_collection.cc
deleted file mode 100644
index d802b8f..0000000
--- a/paludis/util/sequential_collection.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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/util/sequential_collection.hh>
-
-using namespace paludis;
-
diff --git a/paludis/util/sequential_collection.hh b/paludis/util/sequential_collection.hh
deleted file mode 100644
index 7f1db09..0000000
--- a/paludis/util/sequential_collection.hh
+++ /dev/null
@@ -1,116 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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_SEQUENTIAL_COLLECTION_HH
-#define PALUDIS_GUARD_PALUDIS_SEQUENTIAL_COLLECTION_HH 1
-
-#include <algorithm>
-#include <list>
-#include <paludis/util/counted_ptr.hh>
-#include <paludis/util/instantiation_policy.hh>
-
-namespace paludis
-{
- /**
- * Wrapper around a std::list of a particular item. Multiple items
- * with the same value are disallowed.
- */
- template <typename T_>
- class SequentialCollection :
- private InstantiationPolicy<SequentialCollection<T_>, instantiation_method::NonCopyableTag>,
- public InternalCounted<SequentialCollection<T_> >
- {
- private:
- std::list<T_> _items;
-
- public:
- /**
- * Constructor.
- */
- SequentialCollection()
- {
- }
-
- /**
- * Destructor.
- */
- virtual ~SequentialCollection()
- {
- }
-
- /**
- * Our iterator type.
- */
- typedef typename std::list<T_>::const_iterator Iterator;
-
- /**
- * Iterator to the start of our items.
- */
- Iterator begin() const
- {
- return _items.begin();
- }
-
- /**
- * Iterator to one past our last item.
- */
- Iterator end() const
- {
- return _items.end();
- }
-
- /**
- * Iterator to our last item.
- */
- Iterator last() const
- {
- return _items.begin() == _items.end() ? _items.end() : --(_items.end());
- }
-
- /**
- * Return an Iterator to an item, or end() if there's no match.
- */
- Iterator find(const T_ & v) const
- {
- return std::find(_items.begin(), _items.end(), v);
- }
-
- /**
- * Append an item, return whether we succeeded.
- */
- bool append(T_ v)
- {
- if (end() != find(v))
- return false;
-
- _items.push_back(v);
- return true;
- }
-
- /**
- * Are we empty?
- */
- bool empty() const
- {
- return _items.empty();
- }
- };
-}
-
-#endif
diff --git a/paludis/util/smart_record.cc b/paludis/util/smart_record.cc
deleted file mode 100644
index 6dc097d..0000000
--- a/paludis/util/smart_record.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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/util/smart_record.hh>
-
diff --git a/paludis/util/sorted_collection.cc b/paludis/util/sorted_collection.cc
deleted file mode 100644
index 1bf4b0d..0000000
--- a/paludis/util/sorted_collection.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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/util/sorted_collection.hh>
-
-using namespace paludis;
-
diff --git a/paludis/util/stringify.cc b/paludis/util/stringify.cc
deleted file mode 100644
index 100adfb..0000000
--- a/paludis/util/stringify.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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/util/stringify.hh>
-
diff --git a/paludis/util/tokeniser.cc b/paludis/util/tokeniser.cc
deleted file mode 100644
index 706edb6..0000000
--- a/paludis/util/tokeniser.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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/util/tokeniser.hh>
-
diff --git a/paludis/util/validated.cc b/paludis/util/validated.cc
deleted file mode 100644
index 7b7fc64..0000000
--- a/paludis/util/validated.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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/util/validated.hh>
-
diff --git a/paludis/util/virtual_constructor.cc b/paludis/util/virtual_constructor.cc
deleted file mode 100644
index 1fe055a..0000000
--- a/paludis/util/virtual_constructor.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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/util/virtual_constructor.hh>
-
-/** \file
- * Implementation of paludis::VirtualConstructor.
- *
- * \ingroup VirtualConstructor
- */
-
diff --git a/paludis/util/visitor.cc b/paludis/util/visitor.cc
deleted file mode 100644
index 95bf28d..0000000
--- a/paludis/util/visitor.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * 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/util/visitor.hh>
-
-/** \file
- * Definitions for paludis::Visitor and related classes.
- *
- * \ingroup Visitor
- */
diff --git a/paludis/version_spec.hh b/paludis/version_spec.hh
index e4a9325..eef3a21 100644
--- a/paludis/version_spec.hh
+++ b/paludis/version_spec.hh
@@ -24,7 +24,7 @@
#include <paludis/util/comparison_policy.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/sorted_collection.hh>
+#include <paludis/util/collection.hh>
#include <string>
namespace paludis