static int
assert_version_support(const char *const *argv,
                       struct dpkg_version *version,
                       const char *feature_name)
{
  struct pkginfo *pkg;

  if (*argv)
    badusage(_("--%s takes no arguments"), cipaction->olong);

  modstatdb_open(msdbrw_readonly);

  pkg = pkg_db_find_singleton("dpkg");
  switch (pkg->status) {
  case PKG_STAT_INSTALLED:
  case PKG_STAT_TRIGGERSPENDING:
    return 0;
  case PKG_STAT_UNPACKED:
  case PKG_STAT_HALFCONFIGURED:
  case PKG_STAT_HALFINSTALLED:
  case PKG_STAT_TRIGGERSAWAITED:
    if (dpkg_version_relate(&pkg->configversion, DPKG_RELATION_GE, version))
      return 0;
    printf(_("Version of dpkg with working %s support not yet configured.\n"
             " Please use 'dpkg --configure dpkg', and then try again.\n"),
           feature_name);
    return 1;
  default:
    printf(_("dpkg not recorded as installed, cannot check for %s support!\n"),
           feature_name);
    return 1;
  }
}
Beispiel #2
0
static int
assert_version_support(const char *const *argv,
                       struct dpkg_version *version,
                       const char *feature_name)
{
  struct pkginfo *pkg;

  if (*argv)
    badusage(_("--%s takes no arguments"), cipaction->olong);

  modstatdb_open(msdbrw_readonly);

  pkg = pkg_db_find_singleton("dpkg");
  switch (pkg->status) {
  case stat_installed:
  case stat_triggerspending:
    return 0;
  case stat_unpacked: case stat_halfconfigured: case stat_halfinstalled:
  case stat_triggersawaited:
    if (dpkg_version_relate(&pkg->configversion, dpkg_relation_ge, version))
      return 0;
    printf(_("Version of dpkg with working %s support not yet configured.\n"
             " Please use 'dpkg --configure dpkg', and then try again.\n"),
           feature_name);
    return 1;
  default:
    printf(_("dpkg not recorded as installed, cannot check for %s support!\n"),
           feature_name);
    return 1;
  }
}
Beispiel #3
0
static struct pkginfo *
pkg_spec_get_pkg(struct pkg_spec *ps)
{
	if (ps->arch->type == DPKG_ARCH_NONE)
		return pkg_db_find_singleton(ps->name);
	else
		return pkg_db_find_pkg(ps->name, ps->arch);
}