db: check and initiailize required package fields before addition to db

The atomization change broke virtual packages because they don't
have license or arch set.
cute-signatures
Timo Teräs 2011-01-04 11:45:34 +02:00
parent 28dcd5d3b3
commit 94ce7f01bf
1 changed files with 5 additions and 0 deletions

View File

@ -426,6 +426,11 @@ struct apk_package *apk_db_pkg_add(struct apk_database *db, struct apk_package *
{
struct apk_package *idb;
if (pkg->license == NULL)
pkg->license = apk_blob_atomize(APK_BLOB_NULL);
if (pkg->arch == NULL)
pkg->arch = apk_blob_atomize(APK_BLOB_STR("noarch"));
idb = apk_hash_get(&db->available.packages, APK_BLOB_CSUM(pkg->csum));
if (idb == NULL) {
idb = pkg;