char *description = pkg_get_string(pkg, PKG_DESCRIPTION);
printf("%s - %s", pkg->name, version);
if (conf->size)
- printf(" - %lu", pkg->size);
+ printf(" - %lu", (unsigned long) pkg_get_int(pkg, PKG_SIZE));
if (description)
printf(" - %s", description);
printf("\n");
static int verify_pkg_installable(pkg_t * pkg)
{
unsigned long kbs_available, pkg_size_kbs;
+ unsigned long installed_size;
char *root_dir = NULL;
struct stat s;
- if (conf->force_space || pkg->installed_size == 0)
+ installed_size = (unsigned long) pkg_get_int(pkg, PKG_INSTALLED_SIZE);
+
+ if (conf->force_space || installed_size == 0)
return 0;
if (pkg->dest) {
kbs_available = get_available_kbytes(root_dir);
- pkg_size_kbs = (pkg->installed_size + 1023) / 1024;
+ pkg_size_kbs = (installed_size + 1023) / 1024;
if (pkg_size_kbs >= kbs_available) {
opkg_msg(ERROR, "Only have %ldkb available on filesystem %s, "
#endif
sigset_t newset, oldset;
const char *local_filename;
+ time_t now;
if (from_upgrade)
message = 1; /* Coming from an upgrade, and should change the output message */
if (old_pkg)
old_pkg->state_status = SS_NOT_INSTALLED;
- time(&pkg->installed_time);
+ now = time(NULL);
+ pkg_set_int(pkg, PKG_INSTALLED_TIME, now);
ab_pkg = pkg->parent;
if (ab_pkg)
pkg->provides_count = 0;
pkg->provides = NULL;
pkg->tmp_unpack_dir = NULL;
- pkg->size = 0;
- pkg->installed_size = 0;
conffile_list_init(&pkg->conffiles);
pkg->installed_files = NULL;
pkg->installed_files_ref_cnt = 0;
pkg_set_string(oldpkg, PKG_MD5SUM, pkg_get_string(newpkg, PKG_MD5SUM));
if (!pkg_get_string(oldpkg, PKG_SHA256SUM))
pkg_set_string(oldpkg, PKG_SHA256SUM, pkg_get_string(newpkg, PKG_SHA256SUM));
- if (!oldpkg->size)
- oldpkg->size = newpkg->size;
- if (!oldpkg->installed_size)
- oldpkg->installed_size = newpkg->installed_size;
+ if (!pkg_get_int(oldpkg, PKG_SIZE))
+ pkg_set_int(oldpkg, PKG_SIZE, pkg_get_int(newpkg, PKG_SIZE));
+ if (!pkg_get_int(oldpkg, PKG_INSTALLED_SIZE))
+ pkg_set_int(oldpkg, PKG_INSTALLED_SIZE, pkg_get_int(newpkg, PKG_INSTALLED_SIZE));
if (!pkg_get_string(oldpkg, PKG_PRIORITY))
pkg_set_string(oldpkg, PKG_PRIORITY, pkg_get_string(newpkg, PKG_PRIORITY));
if (!pkg_get_string(oldpkg, PKG_SOURCE))
case 'i':
case 'I':
if (strcasecmp(field, "Installed-Size") == 0) {
- fprintf(fp, "Installed-Size: %ld\n",
- pkg->installed_size);
- } else if (strcasecmp(field, "Installed-Time") == 0
- && pkg->installed_time) {
- fprintf(fp, "Installed-Time: %lu\n",
- pkg->installed_time);
+ fprintf(fp, "Installed-Size: %lu\n",
+ (unsigned long) pkg_get_int(pkg, PKG_INSTALLED_SIZE));
+ } else if (strcasecmp(field, "Installed-Time") == 0) {
+ i = pkg_get_int(pkg, PKG_INSTALLED_TIME);
+ if (i) {
+ fprintf(fp, "Installed-Time: %lu\n",
+ (unsigned long) i);
+ }
}
break;
case 'm':
}
#endif
} else if (strcasecmp(field, "Size") == 0) {
- if (pkg->size) {
- fprintf(fp, "Size: %ld\n", pkg->size);
+ i = pkg_get_int(pkg, PKG_SIZE);
+ if (i) {
+ fprintf(fp, "Size: %lu\n", (unsigned long) i);
}
} else if (strcasecmp(field, "Source") == 0) {
p = pkg_get_string(pkg, PKG_SOURCE);
PKG_DESCRIPTION,
PKG_MD5SUM,
PKG_SHA256SUM,
+ PKG_SIZE,
+ PKG_INSTALLED_SIZE,
+ PKG_INSTALLED_TIME,
};
struct abstract_pkg {
abstract_pkg_t *parent;
char *tmp_unpack_dir;
- unsigned long size; /* in bytes */
- unsigned long installed_size; /* in bytes */
conffile_list_t conffiles;
- time_t installed_time;
/* As pointer for lazy evaluation */
str_list_t *installed_files;
/* XXX: CLEANUP: I'd like to perhaps come up with a better
case 'I':
if ((mask & PFM_INSTALLED_SIZE)
&& is_field("Installed-Size", line)) {
- char *tmp = parse_simple("Installed-Size", line);
- pkg->installed_size = strtoul(tmp, NULL, 0);
- free(tmp);
+ pkg_set_int(pkg, PKG_INSTALLED_SIZE, strtoul(line + strlen("Installed-Size") + 1, NULL, 0));
} else if ((mask & PFM_INSTALLED_TIME)
&& is_field("Installed-Time", line)) {
- char *tmp = parse_simple("Installed-Time", line);
- pkg->installed_time = strtoul(tmp, NULL, 0);
- free(tmp);
+ pkg_set_int(pkg, PKG_INSTALLED_TIME, strtoul(line + strlen("Installed-Time") + 1, NULL, 0));
}
break;
pkg_set_string(pkg, PKG_SHA256SUM, line + strlen("SHA256sum") + 1);
#endif
else if ((mask & PFM_SIZE) && is_field("Size", line)) {
- char *tmp = parse_simple("Size", line);
- pkg->size = strtoul(tmp, NULL, 0);
- free(tmp);
+ pkg_set_int(pkg, PKG_SIZE, strtoul(line + strlen("Size") + 1, NULL, 0));
} else if ((mask & PFM_SOURCE) && is_field("Source", line))
pkg_set_string(pkg, PKG_SOURCE, line + strlen("Source") + 1);
else if ((mask & PFM_STATUS) && is_field("Status", line))
"Architecture: %s\n"
"Description: %s\n"
"Tags: %s\n"
- "Size: %ld\n"
+ "Size: %lu\n"
"Status: %d\n",
pkg->name,
v,
pkg->src->name,
pkg_get_string(pkg, PKG_ARCHITECTURE),
pkg_get_string(pkg, PKG_DESCRIPTION),
- tags ? tags : "", pkg->size, pkg->state_status);
+ tags ? tags : "",
+ (unsigned long) pkg_get_int(pkg, PKG_SIZE), pkg->state_status);
free(v);
}