Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Privatise lots of functions to limit the public API
Baptiste Daroussin committed 11 years ago
commit 3a971ab6aa459989aa3e0b890bcebfe56513ccaf
parent f5726e0
4 files changed +32 -177
modified libpkg/libpkg.ver
@@ -4,30 +4,11 @@ global:
	pkg_add_from_remote;
	pkg_add_port;
	pkg_addannotation;
-
	pkg_addcategory;
-
	pkg_addconflict;
	pkg_adddep;
-
	pkg_adddir;
-
	pkg_adddir_attr;
-
	pkg_addfile;
-
	pkg_addfile_attr;
-
	pkg_addgid;
-
	pkg_addgroup;
-
	pkg_addlicense;
-
	pkg_addoption;
-
	pkg_addoption_default;
-
	pkg_addoption_description;
-
	pkg_addprovide;
	pkg_addrdep;
-
	pkg_addscript;
	pkg_addscript_file;
	pkg_addscript_fileat;
-
	pkg_addshlib_provided;
-
	pkg_addshlib_required;
-
	pkg_adduid;
-
	pkg_adduser;
	pkg_analyse_files;
-
	pkg_appendscript;
	pkg_asprintf;
	pkg_audit_fetch;
	pkg_audit_free;
@@ -50,7 +31,6 @@ global:
	pkg_delannotation;
	pkg_dep_get;
	pkg_dep_is_locked;
-
	pkg_dep_lookup;
	pkg_deps;
	pkg_dirs;
	pkg_dprintf;
@@ -66,6 +46,7 @@ global:
	pkg_from_old;
	pkg_get2;
	pkg_get_myarch;
+
	pkg_get_myarch_legacy;
	pkg_groups;
	pkg_has_dir;
	pkg_has_file;
@@ -198,7 +179,6 @@ global:
	pkgdb_delete_annotation;
	pkgdb_downgrade_lock;
	pkgdb_dump;
-
	pkgdb_file_set_cksum;
	pkgdb_it_count;
	pkgdb_it_free;
	pkgdb_it_next;
modified libpkg/pkg.c
@@ -465,19 +465,6 @@ pkg_deps(const struct pkg *pkg, struct pkg_dep **d)
	HASH_NEXT(pkg->deps, (*d));
}

-
struct pkg_dep *
-
pkg_dep_lookup(const struct pkg *pkg, const char *origin)
-
{
-
	struct pkg_dep *d = NULL;
-

-
	assert(pkg != NULL);
-
	assert(origin != NULL);
-

-
	HASH_FIND_STR(pkg->deps, origin, d);
-

-
	return (d);
-
}
-

int
pkg_rdeps(const struct pkg *pkg, struct pkg_dep **d)
{
modified libpkg/pkg.h.in
@@ -564,8 +564,6 @@ int pkg_list_count(const struct pkg *, pkg_list);
 */
int pkg_deps(const struct pkg *, struct pkg_dep **dep);

-
struct pkg_dep *pkg_dep_lookup(const struct pkg *, const char *origin);
-

/**
 * Iterates over the reverse dependencies of the package.
 * That is, the packages which require this package.
@@ -669,17 +667,6 @@ int pkgdb_set2(struct pkgdb *db, struct pkg *pkg, ...);
#define pkgdb_set(db, pkg, ...) pkgdb_set2(db, pkg, __VA_ARGS__, -1)

/**
-
 * update the checksum of a file in the database (and the object)
-
 * XXX I don't think this function should be part of a public API.
-
 * @param db A pointer to a struct pkgdb object
-
 * @param file A pointer to a struct pkg_file object
-
 * @param sha256 The new checksum
-
 * @return An error code
-
 */
-
int pkgdb_file_set_cksum(struct pkgdb *db, struct pkg_file *file,
-
			 const char *sha256);
-

-
/**
 * Read the content of a file into a buffer, then call pkg_set().
 */
int pkg_set_from_file(struct pkg *pkg, pkg_attr attr, const char *file, bool trimcr);
@@ -694,91 +681,6 @@ int pkg_adddep(struct pkg *pkg, const char *name, const char *origin, const
int pkg_addrdep(struct pkg *pkg, const char *name, const char *origin, const
			   char *version, bool locked);

-
//int pkg_addfile(struct pkg *, const char *fmt);
-
/**
-
 * Allocate a new struct pkg_file and add it to the files of pkg.
-
 * @param sha256 The ascii representation of the sha256 or a NULL pointer.
-
 * @param check_duplicates ensure no duplicate files are added to the pkg?
-
 * @return An error code.
-
 */
-
int pkg_addfile(struct pkg *pkg, const char *path, const char *sha256,
-
		bool check_duplicates);
-

-
/**
-
 * Allocate a new struct pkg_file and add it to the files of pkg;
-
 * @param path path of the file
-
 * @param sha256 The ascii representation of the sha256 or a NULL pointer.
-
 * @param uname the user name of the file
-
 * @param gname the group name of the file
-
 * @param perm the permission
-
 * @param check_duplicates ensure no duplicate files are added to the pkg?
-
 * @return An error code.
-
 */
-
int pkg_addfile_attr(struct pkg *pkg, const char *path, const char *sha256,
-
		     const char *uname, const char *gname, mode_t perm,
-
		     bool check_duplicates);
-

-
/**
-
 * Add a path
-
 * @return An error code.
-
 */
-
int pkg_adddir(struct pkg *pkg, const char *path, bool try,
-
		    bool check_duplicates);
-

-
/**
-
 * Allocate a new struct pkg_file and add it to the files of pkg;
-
 * @param path path of the file
-
 * @param uname the user name of the file
-
 * @param gname the group name of the file
-
 * @param perm the permission
-
 * @return An error code.
-
 */
-
int pkg_adddir_attr(struct pkg *pkg, const char *path, const char *uname,
-
		    const char *gname, mode_t perm, bool try,
-
		    bool check_duplicates);
-

-
/**
-
 * Add a category
-
 * @return An error code.
-
 */
-
int pkg_addcategory(struct pkg *pkg, const char *name);
-

-
/**
-
 * Add a license
-
 * @return An error code.
-
 */
-
int pkg_addlicense(struct pkg *pkg, const char *name);
-

-
/**
-
 * Add a user
-
 * @return An error code.
-
 */
-
int pkg_adduser(struct pkg *pkg, const char *name);
-

-
/**
-
 * Add a group
-
 * @return An error code.
-
 */
-
int pkg_addgroup(struct pkg *pkg, const char *group);
-

-
/**
-
 * Add a user
-
 * @return An error code.
-
 */
-
int pkg_adduid(struct pkg *pkg, const char *name, const char *uidstr);
-

-
/**
-
 * Add a gid
-
 * @return an error code
-
 */
-
int pkg_addgid(struct pkg *pkg, const char *group, const char *gidstr);
-

-
/**
-
 * Allocate a new struct pkg_script and add it to the scripts of pkg.
-
 * @param path The path to the script on disk.
-
 @ @return An error code.
-
 */
-
int pkg_addscript(struct pkg *pkg, const char *data, pkg_script type);

/**
 * Helper which call pkg_addscript() with the content of the file and
@@ -786,51 +688,6 @@ int pkg_addscript(struct pkg *pkg, const char *data, pkg_script type);
 */
int pkg_addscript_file(struct pkg *pkg, const char *path);
int pkg_addscript_fileat(int fd, struct pkg *pkg, const char *path);
-
int pkg_appendscript(struct pkg *pkg, const char *cmd, pkg_script type);
-

-
/**
-
 * Allocate a new struct pkg_option and add it to the options of pkg.
-
 * @return An error code.
-
 */
-
int pkg_addoption(struct pkg *pkg, const char *name, const char *value);
-

-
/**
-
 * Add a default value to an already existing struct pkg_option
-
 * @return An error code
-
 */
-
int pkg_addoption_default(struct pkg *pkg, const char *key,
-
                          const char *default_value);
-

-
/**
-
 * Add a description to an already exsting struct pkg_option
-
 * @return An error code.
-
 */
-
int pkg_addoption_description(struct pkg *pkg, const char *key,
-
                              const char *description);
-

-
/**
-
 * Add a shared library used by this package
-
 * @return An error code.
-
 */
-
int pkg_addshlib_required(struct pkg *pkg, const char *name);
-

-
/**
-
 * Add a shared library provided by this package
-
 * @return An error code.
-
 */
-
int pkg_addshlib_provided(struct pkg *pkg, const char *name);
-

-
/**
-
 * Add a conflict registered with this package
-
 * @return An error code.
-
 */
-
int pkg_addconflict(struct pkg *pkg, const char *name);
-

-
/**
-
 * Add a provide registered with this package
-
 * @return An error code.
-
 */
-
int pkg_addprovide(struct pkg *pkg, const char *name);

/**
 * Add annotation key+value pair
modified libpkg/private/pkg.h
@@ -540,6 +540,8 @@ int pkgdb_insert_annotations(struct pkg *pkg, int64_t package_id, sqlite3 *s);
int pkgdb_register_finale(struct pkgdb *db, int retcode);
int pkgdb_set_pkg_digest(struct pkgdb *db, struct pkg *pkg);
int pkgdb_is_dir_used(struct pkgdb *db, struct pkg *p, const char *dir, int64_t *res);
+
int pkgdb_file_set_cksum(struct pkgdb *db, struct pkg_file *file, const char *sha256);
+


int pkg_emit_manifest_sbuf(struct pkg*, struct sbuf *, short, char **);
int pkg_emit_filelist(struct pkg *, FILE *);
@@ -578,5 +580,34 @@ struct plist *plist_new(struct pkg *p, const char *stage);
int plist_parse_line(struct pkg *pkg, struct plist *p, char *line);
void plist_free(struct plist *);
const char *pkg_getannotation(const struct pkg *, const char *);
+
int pkg_appendscript(struct pkg *pkg, const char *cmd, pkg_script type);
+

+
int pkg_addscript(struct pkg *pkg, const char *data, pkg_script type);
+
int pkg_addfile(struct pkg *pkg, const char *path, const char *sha256, bool check_duplicates);
+
int pkg_addfile_attr(struct pkg *pkg, const char *path, const char *sha256,
+
		     const char *uname, const char *gname, mode_t perm,
+
		     bool check_duplicates);
+

+

+
int pkg_adddir(struct pkg *pkg, const char *path, bool try,
+
		    bool check_duplicates);
+
int pkg_adddir_attr(struct pkg *pkg, const char *path, const char *uname,
+
		    const char *gname, mode_t perm, bool try,
+
		    bool check_duplicates);
+

+
int pkg_addcategory(struct pkg *pkg, const char *name);
+
int pkg_addlicense(struct pkg *pkg, const char *name);
+
int pkg_adduser(struct pkg *pkg, const char *name);
+
int pkg_addgroup(struct pkg *pkg, const char *group);
+
int pkg_adduid(struct pkg *pkg, const char *name, const char *uidstr);
+
int pkg_addgid(struct pkg *pkg, const char *group, const char *gidstr);
+
int pkg_addshlib_required(struct pkg *pkg, const char *name);
+
int pkg_addshlib_provided(struct pkg *pkg, const char *name);
+
int pkg_addconflict(struct pkg *pkg, const char *name);
+
int pkg_addprovide(struct pkg *pkg, const char *name);
+

+
int pkg_addoption(struct pkg *pkg, const char *name, const char *value);
+
int pkg_addoption_default(struct pkg *pkg, const char *key, const char *default_value);
+
int pkg_addoption_description(struct pkg *pkg, const char *key, const char *description);

#endif