pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files Don't warn about _ALPHA, _B...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a8b00daad9ea
branches:  trunk
changeset: 583255:a8b00daad9ea
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Sun Dec 12 13:18:38 2010 +0000

description:
Don't warn about _ALPHA, _BETA, _PATCH, _RC, _STABLE mismatches
when pkg_add'ing on NetBSD. Bump version to 20101212.

Ok jym, gdt

diffstat:

 pkgtools/pkg_install/files/add/perform.c |  45 +++++++++++++++++++++++++++++--
 pkgtools/pkg_install/files/lib/version.h |   4 +-
 2 files changed, 44 insertions(+), 5 deletions(-)

diffs (96 lines):

diff -r afbc58b7f802 -r a8b00daad9ea pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Sun Dec 12 13:17:55 2010 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Sun Dec 12 13:18:38 2010 +0000
@@ -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@localhost>
  * Copyright (c) 2005 Dieter Baron <dillo%NetBSD.org@localhost>
  * Copyright (c) 2007 Roland Illig <rillig%NetBSD.org@localhost>
  * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
+ * Copyright (c) 2010 Thomas Klausner <wiz%NetBSD.org@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -128,6 +129,43 @@
 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)
 {
        char *p, *cur_end;
@@ -869,7 +907,8 @@
                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)",
diff -r afbc58b7f802 -r a8b00daad9ea pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Sun Dec 12 13:17:55 2010 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Sun Dec 12 13:18:38 2010 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index