pkg_install: record OS version for created packages.

This commit is contained in:
Ben Gras 2010-07-20 17:10:21 +00:00
parent c0074d3aa9
commit eb1627049f
3 changed files with 17 additions and 8 deletions

View 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;
}

View 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",

View 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 */