Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add 'COMPRESSION_FORMAT' pkg.conf option
Rozhuk Ivan committed 3 years ago
commit bd091f58ef62754846606f88433ec08ff03a023c
parent a920014
4 files changed +13 -1
modified docs/pkg.conf.5
@@ -118,6 +118,9 @@ Default: NO.
Location where the libraries are backed up.
Default:
.Pa /usr/local/lib/compat/pkg .
+
.It Cm COMPRESSION_FORMAT: string
+
Set the default compression format: tzst, txz (default), tbz, tar.
+
Default: per pkg developers.
.It Cm COMPRESSION_LEVEL: integer
Set the default compression level, special values are:
.Bl -tag
modified libpkg/pkg_config.c
@@ -76,6 +76,7 @@ struct pkg_ctx ctx = {
	.osversion = 0,
	.backup_libraries = false,
	.triggers = true,
+
	.compression_format = NULL,
	.compression_level = -1,
	.defer_triggers = false,
};
@@ -469,6 +470,12 @@ static struct config_entry c[] = {
		"List of regex to ignore while autiditing for vulnerabilities",
	},
	{
+
		PKG_STRING,
+
		"COMPRESSION_FORMAT",
+
		NULL,
+
		"Set the default compression format for packages creating",
+
	},
+
	{
		PKG_INT,
		"COMPRESSION_LEVEL",
		"-1",
@@ -1331,6 +1338,7 @@ pkg_ini(const char *path, const char *reposdir, pkg_init_flags flags)
	ctx.backup_library_path = pkg_object_string(pkg_config_get("BACKUP_LIBRARY_PATH"));
	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_format = pkg_object_string(pkg_config_get("COMPRESSION_FORMAT"));
	ctx.compression_level = pkg_object_int(pkg_config_get("COMPRESSION_LEVEL"));
	ctx.archive_symlink = pkg_object_bool(pkg_config_get("ARCHIVE_SYMLINK"));
	ctx.repo_accept_legacy_pkg = pkg_object_bool(pkg_config_get("REPO_ACCEPT_LEGACY_PKG"));
modified libpkg/pkg_create.c
@@ -239,7 +239,7 @@ pkg_create_new(void)
	struct pkg_create *pc;

	pc = xcalloc(1, sizeof(*pc));
-
	pc->format = DEFAULT_COMPRESSION;
+
	pc->format = packing_format_from_string(ctx.compression_format);
	pc->compression_level = ctx.compression_level;
	pc->timestamp = (time_t) -1;
	pc->overwrite = true;
modified libpkg/private/pkg.h
@@ -155,6 +155,7 @@ struct pkg_ctx {
	const char *pkg_rootdir;
	const char *dbdir;
	const char *cachedir;
+
	const char *compression_format;
	int compression_level;
	int rootfd;
	int cachedirfd;