All pastes #774125 Raw Edit

Something

public diff v1 · immutable
·published 2007-11-15 00:21 UTC
rendered paste body
diff --git a/backends/Makefile.am b/backends/Makefile.amindex e04d333..63df794 100644--- a/backends/Makefile.am+++ b/backends/Makefile.am@@ -28,6 +28,10 @@ if BACKEND_TYPE_PISI SUBDIRS += pisi endif +if BACKEND_TYPE_ZYPP+SUBDIRS += zypp+endif+ clean-local : 	rm -f *~ diff --git a/backends/zypp/Makefile.am b/backends/zypp/Makefile.amnew file mode 100644index 0000000..c5c3407--- /dev/null+++ b/backends/zypp/Makefile.am@@ -0,0 +1,10 @@+#SUBDIRS = helpers+plugindir = @PK_PLUGIN_DIR@+plugin_LTLIBRARIES = libpk_backend_zypp.la+libpk_backend_zypp_la_SOURCES = pk-backend-zypp.cpp+libpk_backend_zypp_la_LIBADD = @PK_PLUGIN_LIBS@+# FIXME: Do the pkg-config stuff in $top_srcdir/configure.ac+libpk_backend_zypp_la_LDFLAGS = -module -avoid-version `pkg-config --libs libzypp`+libpk_backend_zypp_la_CFLAGS = @PK_PLUGIN_CFLAGS@ `pkg-config --cflags libzypp`+libpk_backend_zypp_la_CPPFLAGS = @PK_PLUGIN_CFLAGS@ `pkg-config --cflags libzypp`+diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cppnew file mode 100644index 0000000..7a123a4--- /dev/null+++ b/backends/zypp/pk-backend-zypp.cpp@@ -0,0 +1,127 @@+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-+ *+ * Copyright (c) 2007 Novell, Inc.+ *+ * Licensed under the GNU General Public License Version 2+ *+ * This program 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.+ *+ * This program 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 <gmodule.h>+#include <glib.h>+#include <string.h>+#include <pk-backend.h>++#include <zypp/ZYppFactory.h>+#include <zypp/ResObject.h>+#include <zypp/ResPoolProxy.h>+#include <zypp/ui/Selectable.h>+#include <zypp/Patch.h>+#include <zypp/Selection.h>+#include <zypp/Package.h>+#include <zypp/Pattern.h>+#include <zypp/Language.h>+#include <zypp/Product.h>+#include <zypp/Repository.h>+#include <zypp/RepoManager.h>++/**+ * backend_get_groups:+ */+/*+static void+backend_get_groups (PkBackend *backend, PkEnumList *elist)+{+	g_return_if_fail (backend != NULL);+	pk_enum_list_append_multiple (elist,+				      PK_GROUP_ENUM_ACCESSORIES,+				      PK_GROUP_ENUM_GAMES,+				      PK_GROUP_ENUM_GRAPHICS,+				      PK_GROUP_ENUM_INTERNET,+				      PK_GROUP_ENUM_OFFICE,+				      PK_GROUP_ENUM_OTHER,+				      PK_GROUP_ENUM_PROGRAMMING,+				      PK_GROUP_ENUM_MULTIMEDIA,+				      PK_GROUP_ENUM_SYSTEM,+				      -1);+}+*/++/**+ * backend_get_filters:+ */+/*+static void+backend_get_filters (PkBackend *backend, PkEnumList *elist)+{+	g_return_if_fail (backend != NULL);+	pk_enum_list_append_multiple (elist,+				      PK_FILTER_ENUM_GUI,+				      PK_FILTER_ENUM_INSTALLED,+				      PK_FILTER_ENUM_DEVELOPMENT,+				      -1);+}+*/++/**+ * backend_get_repo_list:+ */+static void+backend_get_repo_list (PkBackend *backend)+{+	g_return_if_fail (backend != NULL);++	zypp::RepoManager manager;+	std::list <zypp::RepoInfo> repos = manager.knownRepositories();+	for (std::list <zypp::RepoInfo>::iterator it = repos.begin(); it != repos.end(); it++) {+		pk_backend_repo_detail (backend,+					it->name().c_str(),+					it->alias().c_str(),+					it->enabled());+	}++	pk_backend_finished (backend);+}++extern "C" PK_BACKEND_OPTIONS (+	"Zypp",					/* description */+	"Boyd Timothy <btimothy@gmail.com>, Scott Reeves <sreeves@novell.com>",	/* author */+	NULL,					/* initalize */+	NULL,					/* destroy */+	NULL,			/* get_groups */+	NULL,			/* get_filters */+	NULL,					/* cancel */+	NULL,					/* get_depends */+	NULL,		/* get_description */+	NULL,					/* get_files */+	NULL,					/* get_requires */+	NULL,					/* get_update_detail */+	NULL,			/* get_updates */+	NULL,		/* install_package */+	NULL,					/* install_file */+	NULL,			/* refresh_cache */+	NULL,			/* remove_package */+	NULL,					/* resolve */+	NULL,					/* rollback */+	NULL,			/* search_details */+	NULL,					/* search_file */+	NULL,			/* search_group */+	NULL,			/* search_name */+	NULL,			/* update_package */+	NULL,			/* update_system */+	backend_get_repo_list,					/* get_repo_list */+	NULL,					/* repo_enable */+	NULL					/* repo_set_data */+);diff --git a/configure.ac b/configure.acindex 75c2e85..7eb61fb 100755--- a/configure.ac+++ b/configure.ac@@ -262,7 +262,7 @@ dnl - Compile time default choice of backend dnl --------------------------------------------------------------------------- AC_ARG_WITH([default_backend], 	    AS_HELP_STRING([--with-default-backend=<option>],-			   [Default backend to use alpm,apt,box,conary,dummy,smart,yum,pisi (dummy)]))+			   [Default backend to use alpm,apt,box,conary,dummy,smart,yum,pisi,zypp (dummy)])) # default to a sane option for the installed tool if test x$with_default_backend = x; then 	if test -f /usr/bin/yum ; then@@ -279,6 +279,8 @@ if test x$with_default_backend = x; then 		with_default_backend=smart 	elif test -f /usr/bin/pisi ; then 		with_default_backend=pisi+	elif test -f /usr/bin/zypp ; then+		with_default_backend=zypp 	else 		with_default_backend=dummy 	fi@@ -439,6 +441,7 @@ AM_CONDITIONAL(BACKEND_TYPE_BOX, [test x$with_default_backend = xbox], [using BO AM_CONDITIONAL(BACKEND_TYPE_ALPM, [test x$with_default_backend = xalpm], [using ALPM backend]) AM_CONDITIONAL(BACKEND_TYPE_SMART, [test x$with_default_backend = xsmart], [using SMART backend]) AM_CONDITIONAL(BACKEND_TYPE_PISI, [test x$with_default_backend = xpisi], [using PiSi backend])+AM_CONDITIONAL(BACKEND_TYPE_ZYPP, [test x$with_default_backend = xzypp], [using Zypp backend])   dnl ---------------------------------------------------------------------------@@ -469,6 +472,7 @@ backends/yum/Makefile backends/yum/helpers/Makefile backends/pisi/Makefile backends/pisi/helpers/Makefile+backends/zypp/Makefile data/Makefile data/tests/Makefile libselftest/Makefile