/** * Perform some sanity checks on the to-be-built package control area. * * @param dir The directory from where to build the binary package. * @return The pkginfo struct from the parsed control file. */ static struct pkginfo * check_control_area(const char *ctrldir, const char *rootdir) { struct pkginfo *pkg; int warns; /* Start by reading in the control file so we can check its contents. */ pkg = check_control_file(ctrldir); check_file_perms(ctrldir); check_conffiles(ctrldir, rootdir); warns = warning_get_count(); if (warns) warning(P_("ignoring %d warning about the control file(s)", "ignoring %d warnings about the control file(s)", warns), warns); return pkg; }
/** * Perform some sanity checks on the to-be-built package. * * @return The pkginfo struct from the parsed control file. */ static struct pkginfo * check_new_pkg(const char *dir) { struct pkginfo *pkg; struct arbitraryfield *field; char *controlfile; int warns; /* Start by reading in the control file so we can check its contents. */ m_asprintf(&controlfile, "%s/%s/%s", dir, BUILDCONTROLDIR, CONTROLFILE); parsedb(controlfile, pdb_parse_binary, &pkg); if (strspn(pkg->set->name, "abcdefghijklmnopqrstuvwxyz0123456789+-.") != strlen(pkg->set->name)) ohshit(_("package name has characters that aren't lowercase alphanums or `-+.'")); if (pkg->priority == pri_other) warning(_("'%s' contains user-defined Priority value '%s'"), controlfile, pkg->otherpriority); for (field = pkg->available.arbs; field; field = field->next) { if (known_arbitrary_field(field)) continue; warning(_("'%s' contains user-defined field '%s'"), controlfile, field->name); } free(controlfile); check_file_perms(dir); check_conffiles(dir); warns = warning_get_count(); if (warns) warning(P_("ignoring %d warning about the control file(s)\n", "ignoring %d warnings about the control file(s)\n", warns), warns); return pkg; }