summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-01-04 11:45:34 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-01-04 11:45:34 +0200
commit94ce7f01bf62bc30e8b5f44f6fb17eecbd820036 (patch)
treed83d91fe3382d38b8cc854a9ac38a873c6589807 /src/database.c
parent28dcd5d3b341eb16fceb6cd362e5dd6875b4467b (diff)
downloadapk-tools-94ce7f01bf62bc30e8b5f44f6fb17eecbd820036.tar.gz
apk-tools-94ce7f01bf62bc30e8b5f44f6fb17eecbd820036.tar.bz2
apk-tools-94ce7f01bf62bc30e8b5f44f6fb17eecbd820036.tar.xz
apk-tools-94ce7f01bf62bc30e8b5f44f6fb17eecbd820036.zip
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.
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index c1e8a6a..a536fb1 100644
--- a/src/database.c
+++ b/src/database.c
@@ -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;