aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-28 14:42:03 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-28 14:42:03 +0000
commitcfa00adfbe94fdef981efa24e1075a8ac197fcad (patch)
treecfa409307b4fd5a1d1d9852843f94fe47460cb43
parente457b286ce0c66b24286547c03dfea2c5d9cab3e (diff)
downloadpaludis-cfa00adfbe94fdef981efa24e1075a8ac197fcad.tar.gz
paludis-cfa00adfbe94fdef981efa24e1075a8ac197fcad.tar.xz
More monolithic fixes
-rw-r--r--paludis/repositories/portage/Makefile.am38
-rw-r--r--paludis/repositories/portage/glsa.cc31
-rw-r--r--paludis/repositories/portage/xml_things.hh30
3 files changed, 92 insertions, 7 deletions
diff --git a/paludis/repositories/portage/Makefile.am b/paludis/repositories/portage/Makefile.am
index 5526853..46f7e12 100644
--- a/paludis/repositories/portage/Makefile.am
+++ b/paludis/repositories/portage/Makefile.am
@@ -97,6 +97,21 @@ endif
portage_repository_TEST_SOURCES = portage_repository_TEST.cc
+if MONOLITHIC
+
+portage_repository_TEST_LDADD = \
+ libpaludisportagerepository.la \
+ libpaludisportagerepositoryxmlthings.la \
+ $(top_builddir)/paludis/libxml/libpaludislibxml.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/environment/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+else
+
portage_repository_TEST_LDADD = \
libpaludisportagerepository.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
@@ -106,6 +121,8 @@ portage_repository_TEST_LDADD = \
$(top_builddir)/test/libtest.a \
$(DYNAMIC_LD_LIBS)
+endif
+
portage_repository_TEST_CXXFLAGS = -I$(top_srcdir)
EXTRA_DIST = \
@@ -161,7 +178,7 @@ glsa-sr.hh : glsa.sr $(top_srcdir)/misc/make_sr.bash
glsa-sr.cc : glsa.sr $(top_srcdir)/misc/make_sr.bash
$(top_srcdir)/misc/make_sr.bash --source $(srcdir)/glsa.sr > $@
-libpaludisportagerepositoryxmlthings_la_SOURCES = xml_things.cc
+libpaludisportagerepositoryxmlthings_la_SOURCES = xml_things.cc xml_things.hh
libpaludisportagerepositoryxmlthings_la_CXXFLAGS = @LIBXML2DEPS_CFLAGS@
if MONOLITHIC
@@ -183,6 +200,23 @@ if ENABLE_GLSA
GLSA_TESTS = xml_things_TEST
xml_things_TEST_SOURCES = xml_things_TEST.cc
+
+if MONOLITHIC
+
+xml_things_TEST_LDADD = \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/test/libtest.a \
+ libpaludisportagerepository.la \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/environment/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a \
+ $(top_builddir)/paludis/repositories/portage/libpaludisportagerepositoryxmlthings.la \
+ $(top_builddir)/paludis/libxml/libpaludislibxml.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(DYNAMIC_LD_LIBS)
+
+else
+
xml_things_TEST_LDADD = \
$(top_builddir)/paludis/util/test_extras.o \
$(top_builddir)/test/libtest.a \
@@ -195,6 +229,8 @@ xml_things_TEST_LDADD = \
endif
+endif
+
TESTS = portage_repository_TEST $(GLSA_TESTS)
check_PROGRAMS = $(TESTS)
diff --git a/paludis/repositories/portage/glsa.cc b/paludis/repositories/portage/glsa.cc
index 4aa53e2..8fe3c71 100644
--- a/paludis/repositories/portage/glsa.cc
+++ b/paludis/repositories/portage/glsa.cc
@@ -31,6 +31,10 @@ using namespace paludis;
#include "glsa-sr.cc"
+#ifdef MONOLITHIC
+# include <paludis/repositories/portage/xml_things.hh>
+#endif
+
namespace paludis
{
template<>
@@ -178,6 +182,8 @@ GLSA::title() const
return _imp->title;
}
+#ifndef MONOLITHIC
+
namespace
{
struct LibXMLHandle
@@ -200,22 +206,21 @@ namespace
} libxmlhandle;
}
+#endif
+
GLSA::Pointer
GLSA::create_from_xml_file(const std::string & filename)
{
#if ENABLE_GLSA
+# ifdef MONOLITHIC
+
+# else
if (0 == libxmlhandle.handle)
libxmlhandle.handle = dlopen("libpaludisportagerepositoryxmlthings.so",
RTLD_NOW | RTLD_GLOBAL);
if (0 == libxmlhandle.handle)
throw NotAvailableError("Cannot create GLSA from XML file '" + filename + "' due to error '"
+ stringify(dlerror()) + "' when dlopen(libpaludisportagerepositoryxmlthings.so)");
-#else
- /* avoid noreturn warning */
- if (0 == libxmlhandle.handle)
- throw NotAvailableError("Cannot create GLSA from XML file '" + filename + "' because Paludis was built "
- "without GLSA support");
-#endif
if (0 == libxmlhandle.create_glsa_from_xml_file_handle)
libxmlhandle.create_glsa_from_xml_file_handle = STUPID_CAST(GLSA::Pointer (*)(const std::string &),
@@ -224,7 +229,21 @@ GLSA::create_from_xml_file(const std::string & filename)
throw NotAvailableError("Cannot create GLSA from XML file '" + filename + "' due to error '"
+ stringify(dlerror()) + "' when dlsym(libpaludisportagerepositoryxmlthings.so, create_glsa_from_xml_file)");
+# endif
+#else
+# ifndef MONOLITHIC
+ /* avoid noreturn warning */
+ if (0 == libxmlhandle.handle)
+ throw NotAvailableError("Cannot create GLSA from XML file '" + filename + "' because Paludis was built "
+ "without GLSA support");
+# endif
+#endif
+
+#ifdef MONOLITHIC
+ return create_glsa_from_xml_file(filename);
+#else
return (*libxmlhandle.create_glsa_from_xml_file_handle)(filename);
+#endif
}
GLSAError::GLSAError(const std::string & msg, const std::string & filename) throw () :
diff --git a/paludis/repositories/portage/xml_things.hh b/paludis/repositories/portage/xml_things.hh
new file mode 100644
index 0000000..772def3
--- /dev/null
+++ b/paludis/repositories/portage/xml_things.hh
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.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_REPOSITORIES_PORTAGE_XML_THINGS_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_XML_THINGS_HH 1
+
+#include <paludis/repositories/portage/glsa.hh>
+
+extern "C"
+{
+ GLSA::Pointer create_glsa_from_xml_file(const std::string &);
+}
+
+#endif