Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
alpine
apk-tools
Commits
f2a7800b
Commit
f2a7800b
authored
Dec 21, 2009
by
Timo Teräs
Browse files
db: use proper instance for overlay file entries
lookup proper directory instance as the tar output might not be linear.
parent
d0909569
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/database.c
View file @
f2a7800b
...
...
@@ -481,6 +481,31 @@ int apk_cache_download(struct apk_database *db, const char *url,
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
)
{
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
);
file_diri_node
=
&
diri
->
owned_files
.
first
;
}
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
);
}
}
...
...
@@ -1587,31 +1620,6 @@ static int apk_db_run_pending_script(struct install_ctx *ctx)
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
)
{
struct
install_ctx
*
ctx
=
(
struct
install_ctx
*
)
_ctx
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment