Loading package data from a file was ALWAYS generating the filelist, instead of
using the in-package one. This is now fixed, and an autogenerated one is used as a last resort. This fixes the bug where /.CHANGELOG showed up in -Ql.
This commit is contained in:
parent
16e01cfe73
commit
21e19a7bcf
1 changed files with 22 additions and 17 deletions
|
@ -241,11 +241,12 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
|
|||
int config = 0;
|
||||
int filelist = 0;
|
||||
int scriptcheck = 0;
|
||||
register struct archive *archive;
|
||||
struct archive *archive;
|
||||
struct archive_entry *entry;
|
||||
pmpkg_t *info = NULL;
|
||||
char *descfile = NULL;
|
||||
int fd = -1;
|
||||
alpm_list_t *all_files = NULL;
|
||||
|
||||
ALPM_LOG_FUNC;
|
||||
|
||||
|
@ -272,11 +273,14 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
|
|||
* from a libarchive archive, it can be done by reading
|
||||
* directly from the archive */
|
||||
for(i = 0; archive_read_next_header (archive, &entry) == ARCHIVE_OK; i++) {
|
||||
const char *entry_name = archive_entry_pathname(entry);
|
||||
|
||||
if(config && filelist && scriptcheck) {
|
||||
/* we have everything we need */
|
||||
break;
|
||||
}
|
||||
if(strcmp(archive_entry_pathname (entry), ".PKGINFO") == 0) {
|
||||
|
||||
if(strcmp(entry_name, ".PKGINFO") == 0) {
|
||||
/* extract this file into /tmp. it has info for us */
|
||||
descfile = strdup("/tmp/alpm_XXXXXX");
|
||||
fd = mkstemp(descfile);
|
||||
|
@ -299,10 +303,10 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
|
|||
FREE(descfile);
|
||||
close(fd);
|
||||
continue;
|
||||
} else if(strcmp(archive_entry_pathname (entry), ".INSTALL") == 0) {
|
||||
} else if(strcmp(entry_name, ".INSTALL") == 0) {
|
||||
info->scriptlet = 1;
|
||||
scriptcheck = 1;
|
||||
} else if(strcmp(archive_entry_pathname (entry), ".FILELIST") == 0) {
|
||||
} else if(strcmp(entry_name, ".FILELIST") == 0) {
|
||||
/* Build info->files from the filelist */
|
||||
FILE *fp;
|
||||
char *fn;
|
||||
|
@ -334,12 +338,8 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
|
|||
continue;
|
||||
} else {
|
||||
scriptcheck = 1;
|
||||
if(!filelist) {
|
||||
/* no .FILELIST present in this package.. build the filelist the */
|
||||
/* old-fashioned way, one at a time */
|
||||
expath = strdup(archive_entry_pathname (entry));
|
||||
info->files = alpm_list_add(info->files, expath);
|
||||
}
|
||||
/* Keep track of all files so we can generate a filelist later if missing */
|
||||
all_files = alpm_list_add(all_files, strdup(entry_name));
|
||||
}
|
||||
|
||||
if(archive_read_data_skip(archive)) {
|
||||
|
@ -353,9 +353,14 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
|
|||
if(!config) {
|
||||
_alpm_log(PM_LOG_ERROR, _("missing package info file in %s"), pkgfile);
|
||||
goto error;
|
||||
} else if(!filelist) {
|
||||
_alpm_log(PM_LOG_ERROR, _("missing package filelist in %s"), pkgfile);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if(!filelist) {
|
||||
_alpm_log(PM_LOG_ERROR, _("missing package filelist in %s, generating one"), pkgfile);
|
||||
info->files = all_files;
|
||||
} else {
|
||||
alpm_list_free_inner(all_files, free);
|
||||
alpm_list_free(all_files);
|
||||
}
|
||||
|
||||
/* internal */
|
||||
|
|
Loading…
Add table
Reference in a new issue