summaryrefslogtreecommitdiffstats
path: root/src/package.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-02-27 11:32:37 +0200
committerTimo Teras <timo.teras@iki.fi>2009-02-27 11:32:37 +0200
commitb75ae58b78367ac095d43ab4391c903d0d6b5644 (patch)
tree4f7161d0056e9a67ab32b3e30c8c364e021086c4 /src/package.c
parent7027a7d844633a986f76c6401638acc8d277f0cb (diff)
downloadapk-tools-b75ae58b78367ac095d43ab4391c903d0d6b5644.tar.bz2
apk-tools-b75ae58b78367ac095d43ab4391c903d0d6b5644.tar.xz
pkg: show warning if deprecated .INSTALL is present in package
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/package.c b/src/package.c
index 25f09d6..a5e988b 100644
--- a/src/package.c
+++ b/src/package.c
@@ -182,6 +182,7 @@ int apk_script_type(const char *name)
struct read_info_ctx {
struct apk_database *db;
struct apk_package *pkg;
+ int version;
int has_install;
};
@@ -278,15 +279,21 @@ static int read_info_entry(void *ctx, const struct apk_file_info *ae,
/* Meta info and scripts */
if (ae->name[0] == '.') {
/* APK 2.0 format */
+ ri->version = 2;
if (strcmp(ae->name, ".PKGINFO") == 0) {
apk_blob_t blob = apk_blob_from_istream(is, ae->size);
apk_blob_for_each_segment(blob, "\n", read_info_line, ctx);
free(blob.ptr);
+ return 0;
+ }
+ if (strcmp(ae->name, ".INSTALL") == 0) {
+ apk_warning("Package '%s-%s' contains deprecated .INSTALL",
+ pkg->name->name, pkg->version);
return 1;
}
- /* FIXME: Check for .INSTALL */
} else if (strncmp(ae->name, "var/db/apk/", 11) == 0) {
/* APK 1.0 format */
+ ri->version = 1;
if (!S_ISREG(ae->mode))
return 0;
@@ -315,7 +322,12 @@ static int read_info_entry(void *ctx, const struct apk_file_info *ae,
if (apk_script_type(slash+1) == APK_SCRIPT_POST_INSTALL ||
apk_script_type(slash+1) == APK_SCRIPT_PRE_INSTALL)
ri->has_install = 1;
+ } else if (ri->version == 2) {
+ /* All metdata of version 2.x package handled */
+ return 1;
} else {
+ /* Version 1.x packages do not contain installed size
+ * in metadata, so we calculate it here */
pkg->installed_size += apk_calc_installed_size(ae->size);
}
@@ -513,6 +525,7 @@ struct apk_package *apk_pkg_parse_index_entry(struct apk_database *db, apk_blob_
return NULL;
ctx.db = db;
+ ctx.version = 0;
ctx.has_install = 0;
apk_blob_for_each_segment(blob, "\n", parse_index_line, &ctx);