blob_for_each_attr(cur, pkg->blob.head, rem) {
if (blob_id(cur) == id) {
if (blob_len(cur) < len) {
- fprintf(stderr, "ERROR: truncating field %d <%p> to %d byte",
+ fprintf(stderr, "ERROR: truncating field %d <%p> to %zu byte",
id, val, blob_len(cur));
}
memcpy(blob_data(cur), val, blob_len(cur));
free(ptr);
}
+ pkg_set_ptr(pkg, blob_id(cur), NULL);
+ break;
+ case PKG_ALTERNATIVES:
+ ptr = pkg_get_ptr(pkg, blob_id(cur));
+
+ if (ptr) {
+ struct pkg_alternatives *pkg_alts = ptr;
+
+ while (pkg_alts->nalts)
+ free(pkg_alts->alts[--pkg_alts->nalts]);
+ free(pkg_alts->alts);
+ free(pkg_alts);
+ }
+
pkg_set_ptr(pkg, blob_id(cur), NULL);
break;
}
pkg_set_string(oldpkg, PKG_PRIORITY, pkg_get_string(newpkg, PKG_PRIORITY));
if (!pkg_get_string(oldpkg, PKG_SOURCE))
pkg_set_string(oldpkg, PKG_SOURCE, pkg_get_string(newpkg, PKG_SOURCE));
+ if (!pkg_get_string(oldpkg, PKG_ABIVERSION))
+ pkg_set_string(oldpkg, PKG_ABIVERSION, pkg_get_string(newpkg, PKG_ABIVERSION));
if (!pkg_get_ptr(oldpkg, PKG_CONFFILES)) {
pkg_set_ptr(oldpkg, PKG_CONFFILES, pkg_get_ptr(newpkg, PKG_CONFFILES));
switch (field[0]) {
case 'a':
case 'A':
- if (strcasecmp(field, "Architecture") == 0) {
+ if (strcasecmp(field, "ABIVersion") == 0) {
+ p = pkg_get_string(pkg, PKG_ABIVERSION);
+ if (p) {
+ fprintf(fp, "ABIVersion: %s\n", p);
+ }
+ } else if (strcasecmp(field, "Alternatives") == 0) {
+ struct pkg_alternatives *pkg_alts = pkg_get_ptr(pkg, PKG_ALTERNATIVES);
+
+ if (pkg_alts && pkg_alts->nalts > 0) {
+ int i;
+ struct pkg_alternative *alt;
+
+ alt = pkg_alts->alts[0];
+ fprintf(fp, "Alternatives: %d:%s:%s", alt->prio, alt->path, alt->altpath);
+ for (i = 1; i < pkg_alts->nalts; i++) {
+ alt = pkg_alts->alts[i];
+ fprintf(fp, ", %d:%s:%s", alt->prio, alt->path, alt->altpath);
+ }
+ fputs("\n", fp);
+ }
+ } else if (strcasecmp(field, "Architecture") == 0) {
p = pkg_get_architecture(pkg);
if (p) {
fprintf(fp, "Architecture: %s\n",
case 'R':
if (strcasecmp(field, "Replaces") == 0) {
ab_pkg = pkg_get_ptr(pkg, PKG_REPLACES);
- if (ab_pkg && *ab_pkg) {
+ if (ab_pkg && ab_pkg[0]) {
fprintf(fp, "Replaces:");
- for (i = 0; *ab_pkg; i++, ab_pkg++) {
+ for (i = 0; ab_pkg[i]; i++) {
fprintf(fp, "%s %s", i == 0 ? "" : ",",
- (*ab_pkg)->name);
+ ab_pkg[i]->name);
}
fprintf(fp, "\n");
}
}
pkg_formatted_field(file, pkg, "Package");
+ pkg_formatted_field(file, pkg, "ABIVersion");
pkg_formatted_field(file, pkg, "Version");
pkg_formatted_field(file, pkg, "Depends");
pkg_formatted_field(file, pkg, "Recommends");
pkg_formatted_field(file, pkg, "Conffiles");
pkg_formatted_field(file, pkg, "Installed-Time");
pkg_formatted_field(file, pkg, "Auto-Installed");
+ pkg_formatted_field(file, pkg, "Alternatives");
fputs("\n", file);
}
/* Installed packages have scripts in pkg->dest->info_dir, uninstalled packages
have scripts in tmp_unpack_dir. */
if (pkg->state_status == SS_INSTALLED
- || pkg->state_status == SS_UNPACKED) {
+ || pkg->state_status == SS_UNPACKED
+ || pkg->state_status == SS_HALF_INSTALLED) {
if (pkg->dest == NULL) {
opkg_msg(ERROR, "Internal error: %s has a NULL dest.\n",
pkg->name);