From d8ba07e484b0c838ce475202f03e041953b183e1 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 3 Jan 2011 21:06:41 +0200 Subject: pkg, db: allow index with unsupported features to be loaded Just disable installation of packages using the new stuff. Also flag lower case package info fields as non-critical and allow installation even if that features is not supported. --- src/package.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/package.c') diff --git a/src/package.c b/src/package.c index 37e4357..ae34f79 100644 --- a/src/package.c +++ b/src/package.c @@ -654,8 +654,17 @@ int apk_pkg_add_info(struct apk_database *db, struct apk_package *pkg, case 'I': pkg->installed_size = apk_blob_pull_uint(&value, 10); break; + case 'F': case 'M': case 'R': case 'Z': + /* installed db entries which are handled in database.c */ + return 1; default: - return -1; + /* lower case index entries are safe to be ignored */ + if (!islower(field)) { + pkg->filename = APK_PKG_UNINSTALLABLE; + db->compat_notinstallable = 1; + } + db->compat_newfeatures = 1; + return 1; } if (APK_BLOB_IS_NULL(value)) return -1; @@ -755,8 +764,9 @@ int apk_pkg_read(struct apk_database *db, const char *file, tar->close(tar); if (r < 0 && r != -ECANCELED) goto err; - if (ctx.pkg->name == NULL) { - r = -ENOMSG; + if (ctx.pkg->name == NULL || + ctx.pkg->filename == APK_PKG_UNINSTALLABLE) { + r = -ENOTSUP; goto err; } if (sctx->action != APK_SIGN_VERIFY) -- cgit v1.2.3-60-g2f50