[libhif] Port to new hif_error_set_from_hawkey()
And drop our internal copy.
This commit is contained in:
parent
53f0c191ac
commit
172ff5712b
@ -34,8 +34,6 @@ librpmostree_la_SOURCES = \
|
||||
src/rpmostree-libcontainer.h \
|
||||
src/rpmostree-console-progress.c \
|
||||
src/rpmostree-console-progress.h \
|
||||
src/hif-utils.c \
|
||||
src/hif-utils.h \
|
||||
src/rpmostree-cleanup.h \
|
||||
src/rpmostree-treepkgdiff.c \
|
||||
src/rpmostree-treepkgdiff.h \
|
||||
|
110
src/hif-utils.c
110
src/hif-utils.c
@ -1,110 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2013 Richard Hughes <richard@hughsie.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <hawkey/errno.h>
|
||||
#include <hawkey/packagelist.h>
|
||||
|
||||
#include "hif-utils.h"
|
||||
|
||||
/**
|
||||
* hif_rc_to_gerror:
|
||||
*/
|
||||
gboolean
|
||||
hif_rc_to_gerror (gint rc, GError **error)
|
||||
{
|
||||
if (rc == 0)
|
||||
return TRUE;
|
||||
switch (rc) {
|
||||
case HY_E_FAILED:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"general runtime error");
|
||||
break;
|
||||
case HY_E_OP:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"client programming error");
|
||||
break;
|
||||
case HY_E_LIBSOLV:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"error propagated from libsolv");
|
||||
break;
|
||||
case HY_E_IO:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"I/O error");
|
||||
break;
|
||||
case HY_E_CACHE_WRITE:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"cache write error");
|
||||
break;
|
||||
case HY_E_QUERY:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"ill-formed query");
|
||||
break;
|
||||
case HY_E_ARCH:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"unknown arch");
|
||||
break;
|
||||
case HY_E_VALIDATION:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"validation check failed");
|
||||
break;
|
||||
case HY_E_SELECTOR:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"ill-specified selector");
|
||||
break;
|
||||
case HY_E_NO_SOLUTION:
|
||||
g_set_error_literal (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"goal found no solutions");
|
||||
break;
|
||||
default:
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"no matching error enum %i", rc);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||
*
|
||||
* Copyright (C) 2013 Richard Hughes <richard@hughsie.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __HIF_UTILS_H
|
||||
#define __HIF_UTILS_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <hawkey/package.h>
|
||||
#include <hawkey/packagelist.h>
|
||||
|
||||
gboolean hif_rc_to_gerror (gint rc,
|
||||
GError **error);
|
||||
|
||||
#endif /* __HIF_UTILS_H */
|
@ -29,7 +29,7 @@
|
||||
#include <hawkey/goal.h>
|
||||
#include <hawkey/version.h>
|
||||
#include <hawkey/util.h>
|
||||
#include "hif-utils.h"
|
||||
#include "libhif.h"
|
||||
|
||||
#include "rpmostree-util.h"
|
||||
|
||||
|
@ -47,7 +47,7 @@ rpmostree_get_pkglist_for_root (GFile *root,
|
||||
}
|
||||
|
||||
rc = hy_sack_load_system_repo (sack, NULL, 0);
|
||||
if (!hif_rc_to_gerror (rc, error))
|
||||
if (!hif_error_set_from_hawkey (rc, error))
|
||||
{
|
||||
g_prefix_error (error, "Failed to load system repo: ");
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user