Commit 48a1a4da authored by Shawn Webb's avatar Shawn Webb
Browse files

Merge remote-tracking branch 'upstream/release-1.17' into hbsd/release/1.17

parents 93ff617e 45f6e305
Changes from 1.17.0 to 1.17.1
- by default only create .txz symlinks for metadata
- only consider the .pkg when creating a repository
add an option REPO_ACCEPT_LEGACY_PKG to keep index old pkg
- Reduce usage of memory stack
Changes from 1.16.99.5 to 1.17.0
- Release 1.17
- fix plenty of typos
......
......@@ -5,7 +5,7 @@ use cc cc-lib cc-shared pkg-config
set maj_ver 1
set med_ver 17
set min_ver 0
set min_ver 1
set dev_ver 0
define PKG_API [expr $maj_ver * 1000000 + $med_ver * 1000 + $min_ver]
define VERSION $maj_ver.$med_ver.$min_ver[expr {$dev_ver ? ".$dev_ver" : ""}]
......
......@@ -52,7 +52,7 @@ struct packing {
int
packing_init(struct packing **pack, const char *path, pkg_formats format, int clevel,
time_t timestamp, bool overwrite)
time_t timestamp, bool overwrite, bool compat_symlink)
{
char archive_path[MAXPATHLEN];
char archive_symlink[MAXPATHLEN];
......@@ -126,7 +126,7 @@ packing_init(struct packing **pack, const char *path, pkg_formats format, int cl
return EPKG_FATAL;
}
if (ctx.archive_symlink) {
if (compat_symlink || ctx.archive_symlink) {
unlink(archive_symlink);
if (symlink(archive_name, archive_symlink) != 0) {
pkg_emit_errno("symlink", archive_symlink);
......
......@@ -1343,10 +1343,15 @@ static int
pkg_parse_archive(struct pkg *pkg, struct pkg_manifest_key *keys,
struct archive *a, size_t len)
{
char buffer[len];
void *buffer;
int rc;
buffer = xmalloc(len);
archive_read_data(a, buffer, len);
return (pkg_parse_manifest(pkg, buffer, len, keys));
rc = pkg_parse_manifest(pkg, buffer, len, keys);
free(buffer);
return (rc);
}
int
......
/*
* Copyright (c) 2011-2020 Baptiste Daroussin <bapt@FreeBSD.org>
* Copyright (c) 2011-2021 Baptiste Daroussin <bapt@FreeBSD.org>
* Copyright (c) 2011-2012 Julien Laffaye <jlaffaye@FreeBSD.org>
* Copyright (c) 2014 Matthew Seaman <matthew@FreeBSD.org>
* Copyright (c) 2016 Vsevolod Stakhov <vsevolod@FreeBSD.org>
......@@ -482,9 +482,15 @@ static struct config_entry c[] = {
{
PKG_BOOL,
"ARCHIVE_SYMLINK",
"TRUE",
"FALSE",
"Create a symlink to legacy extension for backward compatibility",
},
{
PKG_BOOL,
"REPO_ACCEPT_LEGACY_PKG",
"FALSE",
"Accept legacy package extensions when creating the repository",
},
};
static bool parsed = false;
......@@ -1314,6 +1320,7 @@ pkg_ini(const char *path, const char *reposdir, pkg_init_flags flags)
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"));
ctx.repo_accept_legacy_pkg = pkg_object_bool(pkg_config_get("REPO_ACCEPT_LEGACY_PKG"));
it = NULL;
object = ucl_object_find_key(config, "PKG_ENV");
......
......@@ -200,7 +200,7 @@ pkg_create_archive(struct pkg *pkg, struct pkg_create *pc, unsigned required_fla
}
if (packing_init(&pkg_archive, pkg_path, pc->format,
pc->compression_level, pc->timestamp, pc->overwrite) != EPKG_OK) {
pc->compression_level, pc->timestamp, pc->overwrite, false) != EPKG_OK) {
pkg_archive = NULL;
}
......
......@@ -801,7 +801,7 @@ parse_manifest(struct pkg *pkg, struct pkg_manifest_key *keys, ucl_object_t *obj
return (EPKG_OK);
}
static int
int
pkg_parse_manifest_ucl (struct pkg *pkg, ucl_object_t *obj, struct pkg_manifest_key *keys)
{
const ucl_object_t *cur;
......
......@@ -287,6 +287,11 @@ pkg_create_repo_read_fts(struct pkg_fts_item **items, FTS *fts,
if (!packing_is_valid_format(ext + 1))
continue;
/* skip all files which are not .pkg */
if (!ctx.repo_accept_legacy_pkg && strcmp(ext + 1, "pkg") != 0)
continue;
*ext = '\0';
if (pkg_repo_meta_is_old_file(fts_ent->fts_name, meta)) {
......@@ -947,7 +952,7 @@ pkg_repo_pack_db(const char *name, const char *archive, char *path,
sig = NULL;
pub = NULL;
if (packing_init(&pack, archive, meta->packing_format, 0, (time_t)-1, true) != EPKG_OK)
if (packing_init(&pack, archive, meta->packing_format, 0, (time_t)-1, true, true) != EPKG_OK)
return (EPKG_FATAL);
if (keyinfo != NULL) {
......
......@@ -267,6 +267,7 @@ struct pkg_ctx {
const char *triggers_path;
kh_strings_t *touched_dir_hash;
bool defer_triggers;
bool repo_accept_legacy_pkg;
};
extern struct pkg_ctx ctx;
......@@ -781,7 +782,7 @@ int pkg_jobs_resolv(struct pkg_jobs *jobs);
struct packing;
int packing_init(struct packing **pack, const char *path, pkg_formats format, int clevel, time_t timestamp, bool overwrite);
int packing_init(struct packing **pack, const char *path, pkg_formats format, int clevel, time_t timestamp, bool overwrite, bool archive_symlink);
int packing_append_file_attr(struct packing *pack, const char *filepath,
const char *newpath, const char *uname, const char *gname, mode_t perm,
u_long fflags);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment