PERFORCE change 165726 for review

David Forsythe dforsyth at FreeBSD.org
Mon Jul 6 23:20:39 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165726

Change 165726 by dforsyth at squirrel on 2009/07/06 23:20:07

	Make changes for new design in pkg.h.  Cannot be built.

Affected files ...

.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#30 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#28 edit

Differences ...

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#30 (text+ko) ====

@@ -264,6 +264,45 @@
 	return (pkg_plist_conflicts(p->plist));
 }
 
+int
+pkg_add_file(struct pkg *p, const char *path, const char *md5, 
+	const char *owner, const char *group, const char *mode)
+{
+	int status;
+	struct pkg_file *pf;
+
+	if (p == NULL)
+		arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT);
+
+	if (path == NULL)
+		arg_rage_quit(__func__, "Not a valid path.", RAGE_AT_CLIENT);
+	if (md5 == NULL)
+		arg_rage_quit(__func__, "Not a valid md5.", RAGE_AT_CLIENT);
+	if (owner == NULL)
+		arg_rage_quit(__func__, "Not a valid owner.", RAGE_AT_CLIENT);
+	if (group == NULL)
+		arg_rage_quit(__func__, "Not a valid group.", RAGE_AT_CLIENT);
+	if (mode == NULL)
+		arg_rage_quit(__func__, "Not a valid mode.", RAGE_AT_CLIENT);
+
+	pf = pkg_file_new();
+	if (pf == NULL) {
+		return (PKG_MEMORY_ERR | PKG_NOT_OK);
+	
+	status = PKG_OK;
+
+	status |= pkg_file_set_path(pf, path);
+	status |= pkg_file_set_md5(pf, md5);
+	status |= pkg_file_set_owner(pf, owner);
+	status |= pkg_file_set_group(pf, group);
+	status |= pkg_file_set_mode(pf, mode);
+
+	if (status != PKG_OK)
+		pkg_file_delete(pf);
+	
+	return (status);	
+}
+
 /* Set the short comment for this package */
 int
 pkg_set_comment(struct pkg *p, const char *comment)

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#28 (text+ko) ====

@@ -58,175 +58,8 @@
 
 #define BAD_OR_UNKNOWN_VALUE "???"
 
-/* TODO: All these explicit functions are great, but the client doesn't
- * need to make a "new" pkg_cfl, when all they really have to insert are a
- * sting and an integer (they dont even have to set the int).  So write
- * some functions that give them ways to make these entities with a single
- * call. */
-
-/* pkg_file */
-
-struct pkg_file;
-
-struct pkg_file *pkg_file_new(void);
-
-const char *pkg_file_path(struct pkg_file *pf);
-
-const char *pkg_file_md5(struct pkg_file *pf);
-
-const char *pkg_file_owner(struct pkg_file *pf);
-
-const char *pkg_file_group(struct pkg_file *pf);
-
-const char *pkg_file_mode(struct pkg_file *pf);
-
-int pkg_file_set_path(struct pkg_file *pf, const char *path);
-
-int pkg_file_set_md5(struct pkg_file *pf, const char *md5);
-
-int pkg_file_set_owner(struct pkg_file *pf, const char *owner);
-
-int pkg_file_set_group(struct pkg_file *pf, const char *group);
-
-int pkg_file_set_mode(struct pkg_file *pf, const char *mode);
-
-/* pkg_dep */
-
-struct pkg_dep;
-
-struct pkg_dep *pkg_dep_new(void);
-
-struct pkg_dep *pkg_dep_set_name(struct pkg_dep *pd, const char *name);
-
-struct pkg_dep *pkg_dep_set_origin(struct pkg_dep *pd, const char *origin);
-
-const char *pkg_dep_name(struct pkg_dep *pd);
-
-const char *pkg_dep_origin(struct pkg_dep *pd);
-
-/* pkg_cfl */
-
-struct pkg_cfl;
-
-struct pkg_cfl *pkg_cfl_new(void);
-
-int pkg_cfl_set_name(struct pkg_cfl *pc, const char *name);
-
-const char *pkg_cfl_name(struct pkg_cfl *pc);
-
 /* pkg */
 
-/* Add mtree stuff later. */
-
-struct pkg;
-
-struct pkg *pkg_new(void);
-
-void pkg_reset(struct pkg *p);
-
-char *pkg_ident(struct pkg *p);
-
-char *pkg_name(struct pkg *p);
-
-char *pkg_cwd(struct pkg *p);
-
-char *pkg_origin(struct pkg *p);
-
-char *pkg_comment(struct pkg *p);
-
-char *pkg_description(struct pkg *p);
-
-char *pkg_display(struct pkg *p);
-
-char *pkg_mtree_file(struct pkg *p);
-
-int pkg_extract_in_place(struct pkg *p);
-
-int pkg_preserve(struct pkg *p);
-
-int pkg_complete(struct pkg *p);
-
-int pkg_set_ident(struct pkg *p, const char *ident);
-
-int pkg_set_name(struct pkg *p, const char *name);
-
-int pkg_set_cwd(struct pkg *p, const char *cwd);
-
-int pkg_set_orgin(struct pkg *p, const char *orgin);
-
-int pkg_set_comment(struct pkg *p, const char *comment);
-
-int pkg_set_contents(struct pkg *p, const char *contents);
-
-int pkg_set_description(struct pkg *p, const char *description);
-
-int pkg_set_mtree_dirs(struct pkg *p, const char *mtree_dirs);
-
-int pkg_set_required_by(struct pkg *p, const char *required_by);
-
-int pkg_set_display(struct pkg *p, const char *display);
-
-#if 0
-int pkg_set_mtree_file(struct pkg *p, const char *mtree_file);
-#endif 
-
-int pkg_parse_plist(struct pkg *p);
-
-void pkg_pkg_file_list_init(struct pkg *p);
-
-struct pkg_file *pkg_pkg_file_list_next(struct pkg *p);
-
-int pkg_pkg_file_list_reset(struct pkg *p);
-
-int pkg_pkg_file_add(struct pkg *p, struct pkg_file *pf);
-
-int pkg_pkg_file_remove(struct pkg *p, struct pkg_file *pf);
-
-void pkg_pkg_dep_list_init(struct pkg *p);
-
-struct pkg_dep *pkg_pkg_dep_list_next(struct pkg *p);
-
-void pkg_pkg_cfl_list_init(struct pkg *p);
-
-struct pkg_cfl *pkg_pkg_cfl_list_next(struct pkg *p);
-
-void pkg_delete(struct pkg *p);
-
-/* pkgdb */
-
-struct pkgdb;
-
-struct pkgdb *pkgdb_new(int type);
-
-int pkgdb_db_open(struct pkgdb *db, const char *db_root);
-
-int pkgdb_db_init(struct pkgdb *db);
-
-char *pkgdb_db_root(struct pkgdb *db);
-
-int pkgdb_db_close(struct pkgdb *db);
-
-int pkgdb_pkg_next(struct pkgdb *db, struct pkg *p);
-
-int pkgdb_pkg_get(struct pkgdb *db, struct pkg *p, const char *ident);
-
-#if 0
-int pkgdb_pkg_put(struct pkgdb *db, struct pkg *p);
-
-int pkgdb_db_sync(struct pkgdb *db);
-#endif
-
-void pkgdb_db_delete(struct pkgdb *db);
-
-/* Util (will probably dissapear). */
-
-void pkg_dump(struct pkg *p, FILE *stream);
-
-
-#if 0
-
-/* pkg */
-
 struct pkg *pkg_new();
 void pkg_delete(struct pkg *p);
 int pkg_reset(struct pkg *p);
@@ -275,7 +108,7 @@
 int pkgdb_init(struct pkgdb *db);
 
 /* Return a list of packages by _ident_. */
-const char *pkgdb_all_pkgs(struct pkgdb *db);
+const char *pkgdb_all_pkgs(struct pkgdb *db); /* rename.  this is lulz. */
 int pkgdb_select_pkg(struct pkgdb *db, struct pkg *p, const char *pkgident);
 
 int pkgdb_insert_pkg(struct pkgdb *db, struct pkg *p);
@@ -293,5 +126,3 @@
 void pkgarcv_delete(struct pkgarcv *pa;
 
 #endif
-
-#endif


More information about the p4-projects mailing list