mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-11-22 04:49:46 +01:00
pack: If source path is omitted, interpret as relative path
If no source file path is given for the file statement in a package source listing, take the actual file name and interpret it as relative to the source listing file. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
parent
a32a4cb149
commit
effe7bf69a
1 changed files with 15 additions and 1 deletions
|
@ -160,12 +160,26 @@ int filelist_mkfile(input_file_t *f, void *obj)
|
||||||
{
|
{
|
||||||
image_entry_t *ent = filelist_mkentry(f, S_IFREG);
|
image_entry_t *ent = filelist_mkentry(f, S_IFREG);
|
||||||
image_entry_t **listptr = obj;
|
image_entry_t **listptr = obj;
|
||||||
|
const char *ptr;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (ent == NULL)
|
if (ent == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ent->data.file.location = strdup(f->line);
|
if (f->line[0] == '\0') {
|
||||||
|
ptr = strrchr(f->filename, '/');
|
||||||
|
|
||||||
|
if (ptr == NULL) {
|
||||||
|
ent->data.file.location = strdup(ent->name);
|
||||||
|
} else {
|
||||||
|
asprintf(&ent->data.file.location, "%.*s/%s",
|
||||||
|
(int)(ptr - f->filename), f->filename,
|
||||||
|
ent->name);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ent->data.file.location = strdup(f->line);
|
||||||
|
}
|
||||||
|
|
||||||
if (ent->data.file.location == NULL) {
|
if (ent->data.file.location == NULL) {
|
||||||
oom(f);
|
oom(f);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in a new issue