int i, err;
pkg_vec_t *depends = pkg_vec_alloc();
pkg_t *dep;
- char **tmp, **unresolved = NULL;
+ char **tmp, **unresolved = NULL, *prev = NULL;
int ndepends;
ndepends = pkg_hash_fetch_unsatisfied_dependencies(pkg, depends,
pkg->name);
tmp = unresolved;
while (*unresolved) {
- opkg_message(ERROR, "\t%s", *unresolved);
+ if (!prev || strcmp(*unresolved, prev))
+ opkg_message(ERROR, "\t%s\n", *unresolved);
+ prev = *unresolved;
+ unresolved++;
+ }
+ unresolved = tmp;
+ while (*unresolved) {
free(*unresolved);
unresolved++;
}
free(tmp);
- opkg_message(ERROR, "\n");
if (!conf->force_depends) {
opkg_msg(INFO,
"This could mean that your package list is out of date or that the packages\n"
tmp_unpack_dir = mkdtemp(tmp_unpack_dir);
if (tmp_unpack_dir == NULL) {
- opkg_perror(ERROR, "Failed to create temporary directory '%s'",
- tmp_unpack_dir);
+ opkg_perror(ERROR, "Failed to create temporary directory");
return -1;
}
str_list_t *files_list;
str_list_elt_t *iter, *niter;
- char *root_filename = NULL;
-
files_list = pkg_get_installed_files(pkg);
if (files_list == NULL)
return -1;
str_list_next(files_list, iter); iter;
iter = niter, niter = str_list_next(files_list, niter)) {
char *filename = (char *)iter->data;
- if (root_filename) {
- free(root_filename);
- root_filename = NULL;
- }
- root_filename = root_filename_alloc(filename);
- if (file_exists(root_filename) && (!file_is_dir(root_filename))) {
+ if (file_exists(filename) && (!file_is_dir(filename))) {
pkg_t *owner;
owner = file_hash_get_file_owner(filename);
}
}
- if (root_filename) {
- free(root_filename);
- root_filename = NULL;
- }
pkg_free_installed_files(pkg);
return 0;
return err;
}
- /* The "Essential" control field may only be present in the control
- * file and not in the Packages list. Ensure we capture it regardless.
- *
- * XXX: This should be fixed outside of opkg, in the Package list.
- */
- set_flags_from_control(pkg);
-
opkg_msg(DEBUG, "Calling pkg_write_filelist.\n");
err = pkg_write_filelist(pkg);
if (err)
char *file_sha256, *pkg_sha256;
sigset_t newset, oldset;
const char *local_filename;
+ long long int pkg_expected_size;
+ struct stat pkg_stat;
time_t now;
if (from_upgrade)
}
#endif
+ /* Check file size */
+ err = lstat(local_filename, &pkg_stat);
+
+ if (err) {
+ opkg_msg(ERROR, "Failed to stat %s: %s\n",
+ local_filename, strerror(errno));
+ return -1;
+ }
+
+ pkg_expected_size = pkg_get_int(pkg, PKG_SIZE);
+
+ if (pkg_expected_size > 0 && pkg_stat.st_size != pkg_expected_size) {
+ if (!conf->force_checksum) {
+ opkg_msg(ERROR,
+ "Package size mismatch: %s is %lld bytes, expecting %lld bytes\n",
+ pkg->name, (long long int)pkg_stat.st_size, pkg_expected_size);
+ return -1;
+ } else {
+ opkg_msg(NOTICE,
+ "Ignored %s size mismatch.\n",
+ pkg->name);
+ }
+ }
+
/* Check for md5 values */
pkg_md5 = pkg_get_md5(pkg);
if (pkg_md5) {