Don't warn about _ALPHA, _BETA, _PATCH, _RC, _STABLE mismatches

when pkg_add'ing on NetBSD. Bump version to 20101212.

Ok jym, gdt
This commit is contained in:
wiz 2010-12-12 13:18:38 +00:00
parent 37a2c2dbcd
commit 7eaf427383
2 changed files with 44 additions and 5 deletions

View file

@ -1,4 +1,4 @@
/* $NetBSD: perform.c,v 1.98 2010/09/14 22:26:18 gdt Exp $ */
/* $NetBSD: perform.c,v 1.99 2010/12/12 13:18:38 wiz Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
#endif
@ -6,13 +6,14 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: perform.c,v 1.98 2010/09/14 22:26:18 gdt Exp $");
__RCSID("$NetBSD: perform.c,v 1.99 2010/12/12 13:18:38 wiz Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant@NetBSD.org>
* Copyright (c) 2005 Dieter Baron <dillo@NetBSD.org>
* Copyright (c) 2007 Roland Illig <rillig@NetBSD.org>
* Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org>
* Copyright (c) 2010 Thomas Klausner <wiz@NetBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -127,6 +128,43 @@ static const struct pkg_meta_desc {
static int pkg_do(const char *, int, int);
static int
end_of_version(const char *opsys, const char *version_end)
{
if (*version_end == '\0')
return 1;
if (strcmp(opsys, "NetBSD") == 0) {
if (strncmp(version_end, "_ALPHA", 6) == 0
|| strncmp(version_end, "_BETA", 5) == 0
|| strncmp(version_end, "_RC", 3) == 0
|| strncmp(version_end, "_STABLE", 7) == 0
|| strncmp(version_end, "_PATCH", 6) == 0)
return 1;
}
return 0;
}
static int
compatible_platform(const char *opsys, const char *host, const char *package)
{
int i = 0;
/* returns 1 if host and package operating system match */
if (strcmp(host, package) == 0)
return 1;
/* find offset of first difference */
for (i=0; (host[i] != '\0') && (host[i] == package[i]);)
i++;
if (end_of_version(opsys, host+i) && end_of_version(opsys, package+i))
return 1;
return 0;
}
static int
mkdir_p(const char *path)
{
@ -869,7 +907,8 @@ check_platform(struct pkg_task *pkg)
fatal = 0;
if (fatal ||
strcmp(host_uname.release, pkg->buildinfo[BI_OS_VERSION]) != 0) {
compatible_platform(OPSYS_NAME, host_uname.release,
pkg->buildinfo[BI_OS_VERSION]) != 1) {
warnx("Warning: package `%s' was built for a platform:",
pkg->pkgname);
warnx("%s/%s %s (pkg) vs. %s/%s %s (this host)",

View file

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.159 2010/11/22 09:00:13 joerg Exp $ */
/* $NetBSD: version.h,v 1.160 2010/12/12 13:18:38 wiz Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@ -27,6 +27,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
#define PKGTOOLS_VERSION 20101122
#define PKGTOOLS_VERSION 20101212
#endif /* _INST_LIB_VERSION_H_ */