Do not warn about missing files in NoExtract
When checking a packages files, ignore any missing files in NoExtract Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
96e9cf35f1
commit
eda65967ec
1 changed files with 21 additions and 9 deletions
|
@ -26,18 +26,23 @@
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static int check_file_exists(const char *pkgname, char *filepath,
|
static int check_file_exists(const char *pkgname, char *filepath, size_t rootlen,
|
||||||
struct stat *st)
|
struct stat *st)
|
||||||
{
|
{
|
||||||
/* use lstat to prevent errors from symlinks */
|
/* use lstat to prevent errors from symlinks */
|
||||||
if(llstat(filepath, st) != 0) {
|
if(llstat(filepath, st) != 0) {
|
||||||
if(config->quiet) {
|
if(alpm_option_match_noextract(config->handle, filepath + rootlen) == 0) {
|
||||||
printf("%s %s\n", pkgname, filepath);
|
/* NoExtract */
|
||||||
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
pm_printf(ALPM_LOG_WARNING, "%s: %s (%s)\n",
|
if(config->quiet) {
|
||||||
pkgname, filepath, strerror(errno));
|
printf("%s %s\n", pkgname, filepath);
|
||||||
|
} else {
|
||||||
|
pm_printf(ALPM_LOG_WARNING, "%s: %s (%s)\n",
|
||||||
|
pkgname, filepath, strerror(errno));
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -209,6 +214,7 @@ int check_pkg_fast(alpm_pkg_t *pkg)
|
||||||
for(i = 0; i < filelist->count; i++) {
|
for(i = 0; i < filelist->count; i++) {
|
||||||
const alpm_file_t *file = filelist->files + i;
|
const alpm_file_t *file = filelist->files + i;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
int exists;
|
||||||
const char *path = file->name;
|
const char *path = file->name;
|
||||||
size_t plen = strlen(path);
|
size_t plen = strlen(path);
|
||||||
|
|
||||||
|
@ -218,7 +224,8 @@ int check_pkg_fast(alpm_pkg_t *pkg)
|
||||||
}
|
}
|
||||||
strcpy(filepath + rootlen, path);
|
strcpy(filepath + rootlen, path);
|
||||||
|
|
||||||
if(check_file_exists(pkgname, filepath, &st) == 0) {
|
exists = check_file_exists(pkgname, filepath, rootlen, &st);
|
||||||
|
if(exists == 0) {
|
||||||
int expect_dir = path[plen - 1] == '/' ? 1 : 0;
|
int expect_dir = path[plen - 1] == '/' ? 1 : 0;
|
||||||
int is_dir = S_ISDIR(st.st_mode) ? 1 : 0;
|
int is_dir = S_ISDIR(st.st_mode) ? 1 : 0;
|
||||||
if(expect_dir != is_dir) {
|
if(expect_dir != is_dir) {
|
||||||
|
@ -226,7 +233,7 @@ int check_pkg_fast(alpm_pkg_t *pkg)
|
||||||
pkgname, filepath);
|
pkgname, filepath);
|
||||||
++errors;
|
++errors;
|
||||||
}
|
}
|
||||||
} else {
|
} else if(exists == 1) {
|
||||||
++errors;
|
++errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,6 +285,7 @@ int check_pkg_full(alpm_pkg_t *pkg)
|
||||||
mode_t type;
|
mode_t type;
|
||||||
size_t file_errors = 0;
|
size_t file_errors = 0;
|
||||||
int backup = 0;
|
int backup = 0;
|
||||||
|
int exists;
|
||||||
|
|
||||||
/* strip leading "./" from path entries */
|
/* strip leading "./" from path entries */
|
||||||
if(path[0] == '.' && path[1] == '/') {
|
if(path[0] == '.' && path[1] == '/') {
|
||||||
|
@ -310,9 +318,13 @@ int check_pkg_full(alpm_pkg_t *pkg)
|
||||||
}
|
}
|
||||||
strcpy(filepath + rootlen, path);
|
strcpy(filepath + rootlen, path);
|
||||||
|
|
||||||
if(check_file_exists(pkgname, filepath, &st) == 1) {
|
exists = check_file_exists(pkgname, filepath, rootlen, &st);
|
||||||
|
if(exists == 1) {
|
||||||
errors++;
|
errors++;
|
||||||
continue;
|
continue;
|
||||||
|
} else if(exists == -1) {
|
||||||
|
/* NoExtract */
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = archive_entry_filetype(entry);
|
type = archive_entry_filetype(entry);
|
||||||
|
|
Loading…
Add table
Reference in a new issue