/** * Test if a version is not empty. * * @param version The version to test. * * @retval true If the version is informative (i.e. not an empty version). * @retval false If the version is empty. */ bool dpkg_version_is_informative(const struct dpkg_version *version) { return (version->epoch || str_is_set(version->version) || str_is_set(version->revision)); }
void varbufversion (struct varbuf *vb, const struct dpkg_version *version, enum versiondisplayepochwhen vdew) { switch (vdew) { case vdew_never: break; case vdew_nonambig: if (!version->epoch && (!version->version || !strchr(version->version,':')) && (!version->revision || !strchr(version->revision,':'))) break; /* Fall through. */ case vdew_always: varbuf_printf(vb, "%u:", version->epoch); break; default: internerr("unknown versiondisplayepochwhen '%d'", vdew); } if (version->version) varbuf_add_str(vb, version->version); if (str_is_set(version->revision)) { varbuf_add_char(vb, '-'); varbuf_add_str(vb, version->revision); } }
static bool yettobeunpacked(struct pkginfo *pkg, const char **thissect) { if (pkg->want != PKG_WANT_INSTALL) return false; switch (pkg->status) { case PKG_STAT_UNPACKED: case PKG_STAT_INSTALLED: case PKG_STAT_HALFCONFIGURED: case PKG_STAT_TRIGGERSPENDING: case PKG_STAT_TRIGGERSAWAITED: return false; case PKG_STAT_NOTINSTALLED: case PKG_STAT_HALFINSTALLED: case PKG_STAT_CONFIGFILES: if (thissect) *thissect = str_is_set(pkg->section) ? pkg->section : C_("section", "<unknown>"); return true; default: internerr("unknown package status '%d'", pkg->status); } return false; }
/** * Check if a pkg is informative. * * Used by dselect and dpkg query options as an aid to decide whether to * display things, and by dump to decide whether to write them out. */ bool pkg_is_informative(struct pkginfo *pkg, struct pkgbin *pkgbin) { /* We ignore Section and Priority, as these tend to hang around. */ if (pkgbin == &pkg->installed && (pkg->want != want_unknown || pkg->eflag != eflag_ok || pkg->status != stat_notinstalled || dpkg_version_is_informative(&pkg->configversion))) return true; if (pkgbin->depends || str_is_set(pkgbin->description) || str_is_set(pkgbin->maintainer) || str_is_set(pkgbin->origin) || str_is_set(pkgbin->bugs) || str_is_set(pkgbin->installedsize) || str_is_set(pkgbin->source) || dpkg_version_is_informative(&pkgbin->version) || pkgbin->conffiles || pkgbin->arbs) return true; return false; }
static bool yettobeunpacked(struct pkginfo *pkg, const char **thissect) { if (pkg->want != want_install) return false; switch (pkg->status) { case stat_unpacked: case stat_installed: case stat_halfconfigured: case stat_triggerspending: case stat_triggersawaited: return false; case stat_notinstalled: case stat_halfinstalled: case stat_configfiles: if (thissect) *thissect = str_is_set(pkg->section) ? pkg->section : C_("section", "<unknown>"); return true; default: internerr("unknown package status '%d'", pkg->status); } return false; }