Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
format: Make the backward compatibility symlink a config option
Baptiste Daroussin committed 5 years ago
commit 6772f60391b83153b83e85ff545302241aa3da41
parent f986163
4 files changed +16 -3
modified docs/pkg.conf.5
@@ -76,6 +76,9 @@ a syntactically correct
command line when substituted in and followed by any remaining tokens from
the original command line.
Default: not set.
+
.It Cm ARCHIVE_SYMLINK: boolean
+
When creating a package, create a symlink to it using the legacy extension,
+
this is a backward compatibility option, default: true
.It Cm AUTOCLEAN: boolean
Automatically cleanout the content of
.Em PKG_CACHEDIR
modified libpkg/packing.c
@@ -126,9 +126,11 @@ packing_init(struct packing **pack, const char *path, pkg_formats format, int cl
		return EPKG_FATAL;
	}

-
	unlink(archive_symlink);
-
	if (symlink(archive_name, archive_symlink) != 0) {
-
		pkg_emit_errno("symlink", archive_symlink);
+
	if (ctx.archive_symlink) {
+
		unlink(archive_symlink);
+
		if (symlink(archive_name, archive_symlink) != 0) {
+
			pkg_emit_errno("symlink", archive_symlink);
+
		}
	}

	(*pack)->resolver = archive_entry_linkresolver_new();
modified libpkg/pkg_config.c
@@ -478,6 +478,12 @@ static struct config_entry c[] = {
		"-1",
		"Set the default compression level",
	},
+
	{
+
		PKG_BOOL,
+
		"ARCHIVE_SYMLINK",
+
		"TRUE",
+
		"Create a symlink to legacy extension for backward compatibility",
+
	},
};

static bool parsed = false;
@@ -1301,6 +1307,7 @@ pkg_ini(const char *path, const char *reposdir, pkg_init_flags flags)
	ctx.triggers = pkg_object_bool(pkg_config_get("PKG_TRIGGERS_ENABLE"));
	ctx.triggers_path = pkg_object_string(pkg_config_get("PKG_TRIGGERS_DIR"));
	ctx.compression_level = pkg_object_int(pkg_config_get("COMPRESSION_LEVEL"));
+
	ctx.archive_symlink = pkg_object_bool(pkg_config_get("ARCHIVE_SYMLINK"));

	it = NULL;
	object = ucl_object_find_key(config, "PKG_ENV");
modified libpkg/private/pkg.h
@@ -260,6 +260,7 @@ struct pkg_ctx {
	int dbdirfd;
	int pkg_dbdirfd;
	int osversion;
+
	bool archive_symlink;
	bool backup_libraries;
	const char *backup_library_path;
	bool triggers;