From: Ben Gras Date: Tue, 20 Jul 2010 17:10:21 +0000 (+0000) Subject: pkg_install: record OS version for created packages. X-Git-Tag: v3.1.8~180 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch08.html?a=commitdiff_plain;h=eb1627049f1e7636bbe7afa6a72e97edf02d348e;p=minix.git pkg_install: record OS version for created packages. --- diff --git a/commands/pkg_install/add/perform.c b/commands/pkg_install/add/perform.c index b6e01bd12..93921a5f3 100644 --- a/commands/pkg_install/add/perform.c +++ b/commands/pkg_install/add/perform.c @@ -503,6 +503,8 @@ read_buildinfo(struct pkg_task *pkg) if (strncmp(data, "OPSYS=", 6) == 0) pkg->buildinfo[BI_OPSYS] = dup_value(data, eol); + else if (strncmp(data, "OS_RELEASE=", 11) == 0) + pkg->buildinfo[BI_OS_RELEASE] = dup_value(data, eol); else if (strncmp(data, "OS_VERSION=", 11) == 0) pkg->buildinfo[BI_OS_VERSION] = dup_value(data, eol); else if (strncmp(data, "MACHINE_ARCH=", 13) == 0) @@ -856,7 +858,7 @@ check_platform(struct pkg_task *pkg) { struct utsname host_uname; const char *effective_arch; - int fatal; + int fatal = 0; if (uname(&host_uname) < 0) { if (Force) { @@ -879,20 +881,25 @@ check_platform(struct pkg_task *pkg) if (strcmp(OPSYS_NAME, pkg->buildinfo[BI_OPSYS]) || strcmp(effective_arch, pkg->buildinfo[BI_MACHINE_ARCH]) != 0) fatal = 1; - else - fatal = 0; - if (fatal || - strcmp(host_uname.release, pkg->buildinfo[BI_OS_VERSION]) != 0) { + if (strcmp(host_uname.release, pkg->buildinfo[BI_OS_RELEASE]) != 0) + fatal = 1; + + if (strcmp(host_uname.version, pkg->buildinfo[BI_OS_VERSION]) != 0) + fatal = 1; + + if (fatal) { warnx("Warning: package `%s' was built for a platform:", pkg->pkgname); - warnx("%s/%s %s (pkg) vs. %s/%s %s (this host)", + warnx("%s/%s %s %s (pkg) vs. %s/%s %s %s (this host)", pkg->buildinfo[BI_OPSYS], pkg->buildinfo[BI_MACHINE_ARCH], + pkg->buildinfo[BI_OS_RELEASE], pkg->buildinfo[BI_OS_VERSION], OPSYS_NAME, effective_arch, - host_uname.release); + host_uname.release, + host_uname.version); if (!Force && fatal) return -1; } diff --git a/commands/pkg_install/info/show.c b/commands/pkg_install/info/show.c index 99056739a..c18248616 100644 --- a/commands/pkg_install/info/show.c +++ b/commands/pkg_install/info/show.c @@ -332,6 +332,7 @@ show_summary(struct pkg_meta *meta, package_t *plist, const char *binpkgfile) "REQUIRES", "PKG_OPTIONS", "OPSYS", + "OS_RELEASE", "OS_VERSION", "MACHINE_ARCH", "LICENSE", diff --git a/commands/pkg_install/lib/lib.h b/commands/pkg_install/lib/lib.h index 13e0386be..7d0f23122 100644 --- a/commands/pkg_install/lib/lib.h +++ b/commands/pkg_install/lib/lib.h @@ -187,7 +187,8 @@ typedef enum bi_ent_t { BI_USE_ABI_DEPENDS, /* 4 */ BI_LICENSE, /* 5 */ BI_PKGTOOLS_VERSION, /* 6 */ - BI_ENUM_COUNT /* 7 */ + BI_OS_RELEASE, /* 7 */ + BI_ENUM_COUNT /* 8 */ } bi_ent_t; /* Types */