#ifdef __minix
#include <stdint.h>
+#include <assert.h>
#endif
#include <sys/utsname.h>
free(text);
}
+static void
+normalise_version(char *release, char *version)
+{
+ char actual_version[20];
+
+ assert(release && version);
+
+ if(strlen(release) > 0 && strlen(version) > 0)
+ sprintf(actual_version, "%s.%s", release, version);
+ else if(strlen(release) > 0)
+ strcpy(actual_version, release);
+ else if(strlen(version) > 0)
+ strcpy(actual_version, version);
+ else
+ errx(EXIT_FAILURE, "no version info");
+
+ strcpy(release, actual_version);
+ version[0] = '\0';
+}
+
/*
* Reduce the result from uname(3) to a canonical form.
*/
span = strspn(host_name->release, "0123456789.");
host_name->release[span] = '\0';
#endif
+ normalise_version(host_name->release, host_name->version);
}
/*
strcmp(effective_arch, pkg->buildinfo[BI_MACHINE_ARCH]) != 0)
fatal = 1;
- if (strcmp(host_uname.release, pkg->buildinfo[BI_OS_RELEASE]) != 0)
- fatal = 1;
+ normalise_version(host_uname.release, host_uname.version);
- if (strcmp(host_uname.version, pkg->buildinfo[BI_OS_VERSION]) != 0)
+ if (strcmp(host_uname.release, pkg->buildinfo[BI_OS_RELEASE]) != 0)
fatal = 1;
if (fatal) {
warnx("Warning: package `%s' was built for a platform:",
pkg->pkgname);
- warnx("%s/%s %s %s (pkg) vs. %s/%s %s %s (this host)",
+ warnx("%s/%s %s (pkg) vs. %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.version);
+ host_uname.release);
if (!Force && fatal)
return -1;
}