socsvn commit: r254915 - in soc2013/mattbw/backend: . actions
mattbw at FreeBSD.org
mattbw at FreeBSD.org
Thu Jul 18 13:20:10 UTC 2013
Author: mattbw
Date: Thu Jul 18 13:20:09 2013
New Revision: 254915
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=254915
Log:
coded RefreshCache; not sure how to proceed to test it
Modified:
soc2013/mattbw/backend/actions/refresh_cache.c
soc2013/mattbw/backend/pk-backend-pkgng.c
Modified: soc2013/mattbw/backend/actions/refresh_cache.c
==============================================================================
--- soc2013/mattbw/backend/actions/refresh_cache.c Thu Jul 18 12:48:13 2013 (r254914)
+++ soc2013/mattbw/backend/actions/refresh_cache.c Thu Jul 18 13:20:09 2013 (r254915)
@@ -16,6 +16,35 @@
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * This file contains code from the PKGNG source code (pkg/update.c);
+ * its copyright notice is as follows:
+ *
+ * Copyright (c) 2011-2012 Baptiste Daroussin <bapt at FreeBSD.org>
+ * Copyright (c) 2011-2012 Julien Laffaye <jlaffaye at FreeBSD.org>
+ * Copyright (c) 2011-2012 Marin Atanasov Nikolov <dnaeon at gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <glib.h> /* gboolean */
@@ -26,6 +55,7 @@
#include "../actions.h" /* refresh_cache_thread prototype */
#include "../pkgutils.h" /* pkgutils_... */
#include "../query.h" /* query_... */
+#include "../utils.h" /* STATUS */
/*
* The thread that performs a RefreshCache operation. Should be invoked
@@ -34,9 +64,26 @@
gboolean
refresh_cache_thread(PkBackend *backend)
{
- bool success;
+ gboolean force;
+ int err;
+ struct pkg_repo *repo;
+
+ err = EPKG_FATAL;
+
+ STATUS(backend, PK_STATUS_ENUM_QUERY);
+
+ force = pk_backend_get_bool(backend, "force");
+
+ repo = NULL;
+ while (pkg_repos(&repo) == EPKG_OK) {
+ err = pkg_update(repo, force);
+ /* Intentionally silence already-up-to-date errors. */
+ if (err == EPKG_UPTODATE)
+ err = EPKG_OK;
+ else if (err != EPKG_OK)
+ break;
+ }
- success = false;
pk_backend_finished(backend);
- return success ? TRUE : FALSE;
+ return (err == EPKG_OK) ? TRUE : FALSE;
}
Modified: soc2013/mattbw/backend/pk-backend-pkgng.c
==============================================================================
--- soc2013/mattbw/backend/pk-backend-pkgng.c Thu Jul 18 12:48:13 2013 (r254914)
+++ soc2013/mattbw/backend/pk-backend-pkgng.c Thu Jul 18 13:20:09 2013 (r254915)
@@ -169,7 +169,7 @@
pk_backend_refresh_cache(PkBackend *backend, gboolean force)
{
- INTENTIONALLY_IGNORE(force); /* not yet supported */
+ (void)pk_backend_set_bool(backend, "force", force);
THREAD(backend, refresh_cache_thread);
}
More information about the svn-soc-all
mailing list