socsvn commit: r254387 - in soc2013/mattbw/backend/bin: . getcat

mattbw at FreeBSD.org mattbw at FreeBSD.org
Sun Jul 7 23:59:19 UTC 2013


Author: mattbw
Date: Sun Jul  7 23:59:19 2013
New Revision: 254387
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=254387

Log:
  move getcat out of tests, make the test Warning: Object directory not changed from original /usr/home/mattbw/GSoC/backend it if necessary

Added:
  soc2013/mattbw/backend/bin/
  soc2013/mattbw/backend/bin/getcat/
  soc2013/mattbw/backend/bin/getcat/Makefile
  soc2013/mattbw/backend/bin/getcat/pkgpk-getcat.1
  soc2013/mattbw/backend/bin/getcat/pkgpk-getcat.c

Added: soc2013/mattbw/backend/bin/getcat/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2013/mattbw/backend/bin/getcat/Makefile	Sun Jul  7 23:59:19 2013	(r254387)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+PROG=		pkgpk-getcat
+SRCS=		pkgpk-getcat.c ../../groups.c
+
+DESTDIR?=	/usr/local
+BINDIR?=	/bin
+MANDIR?=	/man/man
+
+CFLAGS+=	`pkgconf --cflags pkg glib-2.0`
+CFLAGS+=        -I/usr/local/include/PackageKit -I/usr/local/include/PackageKit/backend
+CFLAGS+=        -I../../
+CFLAGS+=        -DPK_COMPILATION
+LDFLAGS+=	`pkgconf --libs pkg glib-2.0` -lpackagekit-glib2
+
+.include <bsd.prog.mk>

Added: soc2013/mattbw/backend/bin/getcat/pkgpk-getcat.1
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2013/mattbw/backend/bin/getcat/pkgpk-getcat.1	Sun Jul  7 23:59:19 2013	(r254387)
@@ -0,0 +1,53 @@
+.\" Copyright (C) 2013 Matt Windsor <mattbw at FreeBSD.org>
+.\"
+.\" 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 files.
+.\"
+.\" 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.
+.\"-----------------------------------------------------------------------------
+.Dd July 7, 2013
+.Dt pkgpk-getcat 1
+.Os
+.\"-----------------------------------------------------------------------------
+.Sh NAME
+.Nm pkgpk-getcat
+.Nd return PackageKit category for a pkgng port origin
+.\"-----------------------------------------------------------------------------
+.Sh SYNOPSIS
+.Nm
+.Ar origin
+.\"-----------------------------------------------------------------------------
+.Sh DESCRIPTION
+.Nm
+is a debug utility for investigating the mapping between ports directories and 
+PackageKit categories as part of the PackageKit pkgng backend.
+It returns the descriptive name of the category that matches the directory of
+the port origin given on the command line.
+.Pp
+.Ar origin
+is expected to be a package origin, that is a port category directory followed
+by a slash and then a port name.  For the purposes of
+.Nm
+the actual port/package name may be empty, but the slash must always exist.
+.Pp
+The result is always written on one line to standard output.
+.\"-----------------------------------------------------------------------------
+.Sh AUTHORS
+.An Matt Windsor Aq mattbw at FreeBSD.org
+.\"-----------------------------------------------------------------------------
+.Sh BUGS
+If the backend cannot find a match for a port directory, it will return
+.Ql unknown
+instead.  This includes the case in which a directory has been supplied without
+a trailing slash.

Added: soc2013/mattbw/backend/bin/getcat/pkgpk-getcat.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2013/mattbw/backend/bin/getcat/pkgpk-getcat.c	Sun Jul  7 23:59:19 2013	(r254387)
@@ -0,0 +1,51 @@
+/*-
+ *
+ * Copyright (C) 2013 Matt Windsor <mattbw at FreeBSD.org>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Gets the group name of a pkgng origin, eg 'ports-mgmt/pkg' -> 'admin-tools'.
+ */
+const char *USAGE = "usage: %s origin\n";
+
+#include <stdio.h>
+
+#include <glib.h>
+#include "pkg.h"
+#include "pk-backend.h"
+
+#include "groups.h"
+
+
+int
+main(int argc, char **argv)
+{
+	int		ret;
+
+	ret = 0;
+	if (argc != 2) {
+		ret = 1;
+		fprintf(stderr, USAGE, argv[0]);
+	} else {
+		printf("%s\n",
+		       pk_group_enum_to_string(group_from_origin(argv[1])));
+	}
+
+	return ret;
+}


More information about the svn-soc-all mailing list