Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Do not extract anymore mtrees
Baptiste Daroussin committed 11 years ago
commit 7254325650e7278427655c635c726a6192c54f48
parent bffb229
4 files changed +0 -74
modified libpkg/pkg.c
@@ -1611,12 +1611,6 @@ pkg_copy_tree(struct pkg *pkg, const char *src, const char *dest)
	char *mtree;
	const pkg_object *o;

-
	o = pkg_config_get("DISABLE_MTREE");
-
	if (o && !pkg_object_bool(o)) {
-
		pkg_get(pkg, PKG_PREFIX, &prefix, PKG_MTREE, &mtree);
-
		do_extract_mtree(mtree, prefix);
-
	}
-

	/* Execute pre-install scripts */
	pkg_script_run(pkg, PKG_SCRIPT_PRE_INSTALL);

modified libpkg/pkg_add.c
@@ -181,54 +181,6 @@ cleanup:
	return (retcode);
}

-
int
-
do_extract_mtree(char *mtree, const char *prefix)
-
{
-
	struct archive *a = NULL;
-
	struct archive_entry *ae;
-
	char path[MAXPATHLEN];
-
	const char *fpath;
-
	int retcode = EPKG_OK;
-
	int ret;
-

-
	if (mtree == NULL || *mtree == '\0')
-
		return EPKG_OK;
-

-
	a = archive_read_new();
-
	archive_read_support_filter_none(a);
-
	archive_read_support_format_mtree(a);
-

-
	if (archive_read_open_memory(a, mtree, strlen(mtree)) != ARCHIVE_OK) {
-
		pkg_emit_error("Fail to extract the mtree: %s",
-
		    archive_error_string(a));
-
		retcode = EPKG_FATAL;
-
		goto cleanup;
-
	}
-

-
	while ((ret = archive_read_next_header(a, &ae)) != ARCHIVE_EOF) {
-
		if (ret != ARCHIVE_OK) {
-
			pkg_emit_error("Skipping unsupported mtree line: %s",
-
			    archive_error_string(a));
-
			continue;
-
		}
-
		fpath = archive_entry_pathname(ae);
-

-
		if (*fpath != '/') {
-
			snprintf(path, sizeof(path), "%s/%s", prefix, fpath);
-
			archive_entry_set_pathname(ae, path);
-
		}
-

-
		/* Ignored failed extraction on purpose */
-
		archive_read_extract(a, ae, EXTRACT_ARCHIVE_FLAGS);
-
	}
-

-
cleanup:
-
	if (a != NULL)
-
		archive_read_free(a);
-

-
	return (retcode);
-
}
-

static int
pkg_add_check_pkg_archive(struct pkgdb *db, struct pkg *pkg,
	const char *path, int flags,
@@ -389,10 +341,7 @@ pkg_add_common(struct pkgdb *db, const char *path, unsigned flags,
	struct pkg	*pkg = NULL;
	bool		 extract = true;
	bool		 handle_rc = false;
-
	bool		 disable_mtree;
	bool		 automatic;
-
	char		*mtree;
-
	char		*prefix;
	int		 retcode = EPKG_OK;
	int		 ret;
	int nfiles;
@@ -464,20 +413,6 @@ pkg_add_common(struct pkgdb *db, const char *path, unsigned flags,
	if (retcode != EPKG_OK)
		goto cleanup;

-
	/* MTREE replicates much of the standard functionality
-
	 * inplicit in the way pkg works.  It has to remain available
-
	 * in the ports for compatibility with the old pkg_tools, but
-
	 * ultimately, MTREE should be made redundant.  Use this for
-
	 * experimantal purposes and to develop MTREE-free versions of
-
	 * packages. */
-

-
	disable_mtree = pkg_object_bool(pkg_config_get("DISABLE_MTREE"));
-
	if (!disable_mtree) {
-
		pkg_get(pkg, PKG_PREFIX, &prefix, PKG_MTREE, &mtree);
-
		if ((retcode = do_extract_mtree(mtree, prefix)) != EPKG_OK)
-
			goto cleanup_reg;
-
	}
-

	if (local != NULL) {
		if (pkg_add_cleanup_old(local, remote, flags) != EPKG_OK) {
			retcode = EPKG_FATAL;
modified libpkg/pkg_create.c
@@ -52,7 +52,6 @@ pkg_create_from_dir(struct pkg *pkg, const char *root,
	struct pkg_dir	*dir = NULL;
	char		*m;
	int		 ret;
-
	const char	*mtree;
	bool		 developer;
	struct stat	 st;
	char		 sha256[SHA256_DIGEST_LENGTH * 2 + 1];
modified libpkg/private/pkg.h
@@ -510,8 +510,6 @@ int pkgdb_is_dir_used(struct pkgdb *db, const char *dir, int64_t *res);
int pkg_emit_manifest_sbuf(struct pkg*, struct sbuf *, short, char **);
int pkg_emit_filelist(struct pkg *, FILE *);

-
int do_extract_mtree(char *mtree, const char *prefix);
-

int pkg_repo_binary_update(struct pkg_repo *repo, bool force);

bool ucl_object_emit_sbuf(const ucl_object_t *obj, enum ucl_emitter emit_type,