]> Zhao Yanbai Git Server - minix.git/commitdiff
pkg_install: record OS version for created packages.
authorBen Gras <ben@minix3.org>
Tue, 20 Jul 2010 17:10:21 +0000 (17:10 +0000)
committerBen Gras <ben@minix3.org>
Tue, 20 Jul 2010 17:10:21 +0000 (17:10 +0000)
commands/pkg_install/add/perform.c
commands/pkg_install/info/show.c
commands/pkg_install/lib/lib.h

index b6e01bd123950d40d1ae0b7cc27c400de766efb9..93921a5f35a245f4e2f337f4230dd8955b5c6245 100644 (file)
@@ -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;
        }
index 99056739a28e6e2132945d604da0219d5493fba1..c18248616fd194770dbbdbe8a8dd3fc422ea8a0a 100644 (file)
@@ -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",
index 13e0386be8b4b693a71d122d11d0e6408cee4ad1..7d0f2312259329090b17b54a02a799fed4f4a593 100644 (file)
@@ -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 */