Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Do not allow to create old packages anymore
Baptiste Daroussin committed 11 years ago
commit cb4ce5c40ed826c201c1a02eb00cd257eb95da9b
parent fd3b7a10ec3f0795e93b21914f92cf9cf7a04baf
3 files changed +11 -23
modified libpkg/pkg.h.in
@@ -1078,14 +1078,12 @@ int pkg_create_installed(const char *, pkg_formats, struct pkg *);
 * Create package from stage install using just the manifest --
 * no old pkg_tools compatibility stuff
 */
-
int pkg_create_from_manifest(const char *, pkg_formats, const char *,
-
			     const char *, bool);
+
int pkg_create_from_manifest(const char *, pkg_formats, const char *, const char *);

/**
 * Create package from stage install with a metadata directory
 */
-
int pkg_create_staged(const char *, pkg_formats, const char *, const char *,
-
		      char *, bool);
+
int pkg_create_staged(const char *, pkg_formats, const char *, const char *, char *);

/**
 * Download the latest repo db file and checks its signature if any
modified libpkg/pkg_create.c
@@ -204,7 +204,7 @@ static const char * const scripts[] = {
 * from the manifest */
int
pkg_create_from_manifest(const char *outdir, pkg_formats format,
-
			 const char *rootdir, const char *manifest, bool old)
+
    const char *rootdir, const char *manifest)
{
	struct pkg	*pkg = NULL;
	struct packing	*pkg_archive = NULL;
@@ -214,7 +214,7 @@ pkg_create_from_manifest(const char *outdir, pkg_formats format,

	pkg_debug(1, "Creating package from stage directory: '%s'", rootdir);

-
	if(pkg_new(&pkg, old ? PKG_OLD_FILE : PKG_FILE) != EPKG_OK) {
+
	if(pkg_new(&pkg, PKG_FILE) != EPKG_OK) {
		ret = EPKG_FATAL;
		goto cleanup;
	}
@@ -261,7 +261,7 @@ pkg_load_from_file(int fd, struct pkg *pkg, pkg_attr attr, const char *path)

int
pkg_create_staged(const char *outdir, pkg_formats format, const char *rootdir,
-
    const char *md_dir, char *plist, bool old)
+
    const char *md_dir, char *plist)
{
	struct pkg	*pkg = NULL;
	struct pkg_file	*file = NULL;
@@ -285,7 +285,7 @@ pkg_create_staged(const char *outdir, pkg_formats format, const char *rootdir,
		goto cleanup;
	}

-
	if(pkg_new(&pkg, old ? PKG_OLD_FILE : PKG_FILE) != EPKG_OK) {
+
	if(pkg_new(&pkg, PKG_FILE) != EPKG_OK) {
		ret = EPKG_FATAL;
		goto cleanup;
	}
modified src/create.c
@@ -199,7 +199,6 @@ exec_create(int argc, char **argv)
	pkg_formats	 fmt;
	int		 ch;
	bool		 overwrite = true;
-
	bool		 old = false;

	struct option longopts[] = {
		{ "all",	no_argument,		NULL,	'a' },
@@ -212,11 +211,10 @@ exec_create(int argc, char **argv)
		{ "out-dir",	required_argument,	NULL,	'o' },
		{ "no-clobber", no_argument,		NULL,	'n' },
		{ "plist",	required_argument,	NULL,	'p' },
-
		{ "old",	no_argument,		NULL,	'O' },
		{ NULL,		0,			NULL,	0   },
	};

-
	while ((ch = getopt_long(argc, argv, "+agxf:r:m:M:o:np:O", longopts, NULL)) != -1) {
+
	while ((ch = getopt_long(argc, argv, "+agxf:r:m:M:o:np:", longopts, NULL)) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -248,9 +246,6 @@ exec_create(int argc, char **argv)
		case 'p':
			plist = optarg;
			break;
-
		case 'O':
-
			old = true;
-
			break;
		default:
			usage_create();
			return (EX_USAGE);
@@ -275,7 +270,7 @@ exec_create(int argc, char **argv)
		outdir = "./";

	if (format == NULL) {
-
		fmt = old ? TBZ : TXZ;
+
		fmt = TXZ;
	} else {
		if (format[0] == '.')
			++format;
@@ -289,24 +284,19 @@ exec_create(int argc, char **argv)
			fmt = TAR;
		else {
			warnx("unknown format %s, using txz", format);
-
			fmt = old ? TBZ : TXZ;
+
			fmt = TXZ;
		}
	}

	if (metadatadir == NULL && manifest == NULL) {
-
		if (old) {
-
			warnx("Can only create an old package format"
-
			    " out of a staged directory");
-
			return (EX_SOFTWARE);
-
		}
		return (pkg_create_matches(argc, argv, match, fmt, outdir,
		    overwrite) == EPKG_OK ? EX_OK : EX_SOFTWARE);
	} else if (metadatadir != NULL) {
		return (pkg_create_staged(outdir, fmt, rootdir, metadatadir,
-
		    plist, old) == EPKG_OK ? EX_OK : EX_SOFTWARE);
+
		    plist) == EPKG_OK ? EX_OK : EX_SOFTWARE);
	} else  { /* (manifest != NULL) */
		return (pkg_create_from_manifest(outdir, fmt, rootdir,
-
		    manifest, old) == EPKG_OK ? EX_OK : EX_SOFTWARE);
+
		    manifest) == EPKG_OK ? EX_OK : EX_SOFTWARE);
	}
}