db: use proper instance for overlay file entries
lookup proper directory instance as the tar output might not be linear.cute-signatures
parent
d0909569c6
commit
f2a7800b22
|
@ -481,6 +481,31 @@ int apk_cache_download(struct apk_database *db, const char *url,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct apk_db_dir_instance *find_diri(struct apk_installed_package *ipkg,
|
||||||
|
apk_blob_t dirname,
|
||||||
|
struct apk_db_dir_instance *curdiri,
|
||||||
|
struct hlist_node ***tail)
|
||||||
|
{
|
||||||
|
struct hlist_node *n;
|
||||||
|
struct apk_db_dir_instance *diri;
|
||||||
|
|
||||||
|
if (curdiri != NULL &&
|
||||||
|
apk_blob_compare(APK_BLOB_PTR_LEN(curdiri->dir->name,
|
||||||
|
curdiri->dir->namelen),
|
||||||
|
dirname) == 0)
|
||||||
|
return curdiri;
|
||||||
|
|
||||||
|
hlist_for_each_entry(diri, n, &ipkg->owned_dirs, pkg_dirs_list) {
|
||||||
|
if (apk_blob_compare(APK_BLOB_PTR_LEN(diri->dir->name,
|
||||||
|
diri->dir->namelen), dirname) == 0) {
|
||||||
|
if (tail != NULL)
|
||||||
|
*tail = hlist_tail_ptr(&diri->owned_files);
|
||||||
|
return diri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int apk_db_read_overlay(struct apk_database *db, struct apk_bstream *bs)
|
int apk_db_read_overlay(struct apk_database *db, struct apk_bstream *bs)
|
||||||
{
|
{
|
||||||
struct apk_db_dir_instance *diri = NULL;
|
struct apk_db_dir_instance *diri = NULL;
|
||||||
|
@ -508,6 +533,14 @@ int apk_db_read_overlay(struct apk_database *db, struct apk_bstream *bs)
|
||||||
diri = apk_db_diri_new(db, pkg, bdir, &diri_node);
|
diri = apk_db_diri_new(db, pkg, bdir, &diri_node);
|
||||||
file_diri_node = &diri->owned_files.first;
|
file_diri_node = &diri->owned_files.first;
|
||||||
} else {
|
} else {
|
||||||
|
diri = find_diri(ipkg, bdir, diri, &file_diri_node);
|
||||||
|
if (diri == NULL) {
|
||||||
|
apk_error("overlay: File '%*s' entry without "
|
||||||
|
"directory entry.\n",
|
||||||
|
line.len, line.ptr);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
file = apk_db_file_get(db, diri, bfile, &file_diri_node);
|
file = apk_db_file_get(db, diri, bfile, &file_diri_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1587,31 +1620,6 @@ static int apk_db_run_pending_script(struct install_ctx *ctx)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct apk_db_dir_instance *find_diri(struct apk_installed_package *ipkg,
|
|
||||||
apk_blob_t dirname,
|
|
||||||
struct apk_db_dir_instance *curdiri,
|
|
||||||
struct hlist_node ***tail)
|
|
||||||
{
|
|
||||||
struct hlist_node *n;
|
|
||||||
struct apk_db_dir_instance *diri;
|
|
||||||
|
|
||||||
if (curdiri != NULL &&
|
|
||||||
apk_blob_compare(APK_BLOB_PTR_LEN(curdiri->dir->name,
|
|
||||||
curdiri->dir->namelen),
|
|
||||||
dirname) == 0)
|
|
||||||
return curdiri;
|
|
||||||
|
|
||||||
hlist_for_each_entry(diri, n, &ipkg->owned_dirs, pkg_dirs_list) {
|
|
||||||
if (apk_blob_compare(APK_BLOB_PTR_LEN(diri->dir->name,
|
|
||||||
diri->dir->namelen), dirname) == 0) {
|
|
||||||
if (tail != NULL)
|
|
||||||
*tail = hlist_tail_ptr(&diri->owned_files);
|
|
||||||
return diri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int parse_replaces(void *_ctx, apk_blob_t blob)
|
static int parse_replaces(void *_ctx, apk_blob_t blob)
|
||||||
{
|
{
|
||||||
struct install_ctx *ctx = (struct install_ctx *) _ctx;
|
struct install_ctx *ctx = (struct install_ctx *) _ctx;
|
||||||
|
|
Loading…
Reference in New Issue