Example #1
0
static int
do_create_set(const symboldb_options &opt, database &db, char **argv)
{
  if (db.lookup_package_set(opt.set_name.c_str())
      != database::package_set_id()) {
    fprintf(stderr, "error: package set \"%s\" already exists\n",
	    opt.set_name.c_str());
    return 1;
  }

  typedef std::vector<database::package_id> pset;
  pset ids;
  {
    package_set_consolidator<database::package_id> psc;
    if (!load_rpms(opt, db, argv, psc)) {
      return 1;
    }
    ids = psc.values();
  }

  db.txn_begin();
  database::package_set_id set =
    db.create_package_set(opt.set_name.c_str());
  if (db.update_package_set(set, ids)) {
    finalize_package_set(opt, db, set);
  }
  db.txn_commit();
  return 0;
}
Example #2
0
static int
do_update_set(const symboldb_options &opt, database &db, char **argv)
{
  database::package_set_id set = db.lookup_package_set(opt.set_name.c_str());
  if (set == database::package_set_id()) {
    fprintf(stderr, "error: package set \"%s\" does not exist\n",
	    opt.set_name.c_str());
    return 1;
  }

  typedef std::vector<database::package_id> pset;
  pset ids;
  {
    package_set_consolidator<database::package_id> psc;
    if (!load_rpms(opt, db, argv, psc)) {
      return 1;
    }
    ids = psc.values();
  }

  db.txn_begin();
  {
    database::advisory_lock lock
      (db.lock(database::PACKAGE_SET_LOCK_TAG, set.value()));
    if (db.update_package_set(set, ids)) {
      finalize_package_set(opt, db, set);
    }
  }
  db.txn_commit();
  return 0;
}
Example #3
0
static int
do_show_soname_conflicts(const symboldb_options &opt, database &db)
{
  database::package_set_id pset = db.lookup_package_set(opt.set_name.c_str());
  if (pset > database::package_set_id()) {
    db.print_elf_soname_conflicts(pset);
    return 0;
  } else {
    fprintf(stderr, "error: invalid package set: %s\n", opt.set_name.c_str());
    return 1;
  }
}