socsvn commit: r253499 - in soc2013/mattbw/backend: . actions

mattbw at FreeBSD.org mattbw at FreeBSD.org
Tue Jun 25 21:16:01 UTC 2013


Author: mattbw
Date: Tue Jun 25 21:16:01 2013
New Revision: 253499
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=253499

Log:
  random spring cleaning?

Modified:
  soc2013/mattbw/backend/actions/get-details.c
  soc2013/mattbw/backend/iterate.c
  soc2013/mattbw/backend/licenses.c
  soc2013/mattbw/backend/licenses.h

Modified: soc2013/mattbw/backend/actions/get-details.c
==============================================================================
--- soc2013/mattbw/backend/actions/get-details.c	Tue Jun 25 20:23:08 2013	(r253498)
+++ soc2013/mattbw/backend/actions/get-details.c	Tue Jun 25 21:16:01 2013	(r253499)
@@ -46,13 +46,6 @@
 get_details_for(gchar *package_id,
 		PkBackend *backend,
 		struct pkgdb *db);
-gboolean
-get_details_check_matches(struct pkgdb_it *matches,
-			  const gchar *id_name,
-			  const gchar *id_version,
-			  const gchar *id_arch,
-			  const gchar *id_data,
-			  PkBackend *backend);
 
 
 /*

Modified: soc2013/mattbw/backend/iterate.c
==============================================================================
--- soc2013/mattbw/backend/iterate.c	Tue Jun 25 20:23:08 2013	(r253498)
+++ soc2013/mattbw/backend/iterate.c	Tue Jun 25 21:16:01 2013	(r253499)
@@ -74,43 +74,43 @@
 try_id_match(struct pkg *pkg, const gchar *name, const gchar *version, const
 	     gchar *arch, const gchar *data, gchar **match_id)
 {
-	const char     *pkg_arch;
-	const char     *pkg_data;
-	const char     *pkg_name;
-	const char     *pkg_reponame;
-	const char     *pkg_version;
+	const char     *p_arch;
+	const char     *p_data;
+	const char     *p_name;
+	const char     *p_reponame;
+	const char     *p_version;
 
 	pkg_get(pkg,
-		PKG_ARCH, &pkg_arch,
-		PKG_NAME, &pkg_name,
-		PKG_REPONAME, &pkg_reponame,
-		PKG_VERSION, &pkg_version);
+		PKG_ARCH, &p_arch,
+		PKG_NAME, &p_name,
+		PKG_REPONAME, &p_reponame,
+		PKG_VERSION, &p_version);
 
 	switch (pkg_type(pkg)) {
 	case PKG_FILE:
-		pkg_data = "local";
+		p_data = "local";
 		break;
 	case PKG_INSTALLED:
-		pkg_data = "installed";
+		p_data = "installed";
 		break;
 	default:
-		pkg_data = pkg_reponame;
+		p_data = p_reponame;
 		break;
 	}
 
 	if (*match_id != NULL)
 		g_free(*match_id);
-	*match_id = pk_package_id_build(pkg_name, pkg_version, pkg_arch, pkg_data);
+	*match_id = pk_package_id_build(p_name, p_version, p_arch, p_data);
 
 	/*
 	 * Succeed if this package's PackageID fields match the original
 	 * PackageID.  Of course, the original ID might have missing fields
 	 * (NULLs), so we treat a comparison involving one as a success.
 	 */
-	return (string_match(name, pkg_name) &&
-		string_match(version, pkg_version) &&
-		string_match(arch, pkg_arch) &&
-		string_match(data, pkg_data)) ? TRUE : FALSE;
+	return (string_match(name, p_name) &&
+		string_match(version, p_version) &&
+		string_match(arch, p_arch) &&
+		string_match(data, p_data)) ? TRUE : FALSE;
 }
 
 /*

Modified: soc2013/mattbw/backend/licenses.c
==============================================================================
--- soc2013/mattbw/backend/licenses.c	Tue Jun 25 20:23:08 2013	(r253498)
+++ soc2013/mattbw/backend/licenses.c	Tue Jun 25 21:16:01 2013	(r253499)
@@ -22,60 +22,12 @@
 #include "pk-backend.h"		/* PkLicenseEnum, PK_* */
 
 #include "licenses.h"		/* prototypes */
-#include "mappings.h"		/* mapping macros */
-
-struct license_mapping {
-	const char     *key;
-	PkLicenseEnum	license;
-};
-
-/*
- * Mappings between the output of "pkg_license_name" and the closest
- * available PackageKit license.
- * 
- * These should ALWAYS be in ASCIIbetical order of license names.  This is in
- * case anything relies on this property when searching the list (for example
- * binary searching).
- */
-static struct license_mapping license_mappings[] = {
-	{"BSD", PK_LICENSE_ENUM_BSD},
-	{NULL, PK_LICENSE_ENUM_UNKNOWN}
-};
-
-/*
- * Returns the closest approximation packagekit has to this package's
- * license.
- * 
- * PackageKit only has a simple concept of licencing, so this is inherently a
- * very lossy mapping.
- */
-PkLicenseEnum
-license_from_pkg(struct pkg *pkg)
-{
-	const char     *pkg_license_name;
-	struct license_mapping *map;
-	PkLicenseEnum	result;
-
-	pkg_license_name = license_name_from_pkg(pkg);
-
-	/*
-	 * Is it in our manual license mapping? If not, then try interpreting
-	 * it as a PackageKit license name and convert it back (messy, but
-	 * hopefully safe), but only if it isn't NULL.
-	 */
-	MAPPING_FIND(pkg_license_name, &map, license_mappings);
-	if (pkg_license_name != NULL && map->key == NULL)
-		result = pk_license_enum_from_string(pkg_license_name);
-	else
-		result = map->license;
-
-	return result;
-}
 
 /* Retrieves the name of the FIRST license attached to the package. */
 const char     *
 license_name_from_pkg(struct pkg *pkg)
 {
+	/* TODO: handle conjunctions and disjunctions */
 	int		err;
 	const char     *match;
 	struct pkg_license *lic;

Modified: soc2013/mattbw/backend/licenses.h
==============================================================================
--- soc2013/mattbw/backend/licenses.h	Tue Jun 25 20:23:08 2013	(r253498)
+++ soc2013/mattbw/backend/licenses.h	Tue Jun 25 21:16:01 2013	(r253499)
@@ -23,7 +23,6 @@
 
 #include "pk-backend.h"
 
-PkLicenseEnum	license_from_pkg(struct pkg *pkg);
 const char     *license_name_from_pkg(struct pkg *pkg);
 
 #endif				/* _PKGNG_BACKEND_LICENSES_H_ */


More information about the svn-soc-all mailing list