use ${MACHINE_ARCH} instead of what uname() puts into utsname.machine.
the former represents the CPU architecture, which is what is recorded in binary packages. also allow the OS name to be overridden, as pkgsrc doesn't always use the value of utsname.sysname. bump version to 20030113.
This commit is contained in:
parent
593d5bc615
commit
99871d087e
|
@ -1,7 +1,9 @@
|
|||
# $NetBSD: Makefile,v 1.5 2001/09/25 10:28:16 agc Exp $
|
||||
# $NetBSD: Makefile,v 1.6 2004/01/13 08:30:34 grant Exp $
|
||||
# Original from FreeBSD, no rcs id.
|
||||
|
||||
PROG= pkg_add
|
||||
SRCS= main.c perform.c futil.c extract.c verify.c
|
||||
|
||||
CPPFLAGS+= -DMACHINE_ARCH=\"${MACHINE_ARCH}\"
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: perform.c,v 1.92 2004/01/04 01:47:35 hubertf Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.93 2004/01/13 08:30:34 grant Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: perform.c,v 1.92 2004/01/04 01:47:35 hubertf Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.93 2004/01/13 08:30:34 grant Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -272,23 +272,23 @@ pkg_do(const char *pkg)
|
|||
goto bomb;
|
||||
}
|
||||
|
||||
if (uname(&host_uname) == 0) {
|
||||
if (uname(&host_uname) < 0) {
|
||||
warnx("uname() failed.");
|
||||
if (!Force) {
|
||||
warnx("aborting.");
|
||||
goto bomb;
|
||||
}
|
||||
} else {
|
||||
int osbad = 0;
|
||||
|
||||
/* handle Darwin's uname(3) on powerpc writing
|
||||
* "Power Macintosh" in struct uname.machine.
|
||||
*/
|
||||
if (strcmp(host_uname.machine, "Power Macintosh") == 0)
|
||||
strcpy(host_uname.machine, "powerpc"); /* it fits */
|
||||
|
||||
/* If either the OS or arch are different, bomb */
|
||||
if (strcmp(host_uname.sysname, buildinfo[BI_OPSYS]) != 0 ||
|
||||
strcmp(host_uname.machine, buildinfo[BI_MACHINE_ARCH]) != 0)
|
||||
if (strcmp(OPSYS_NAME, buildinfo[BI_OPSYS]) != 0 ||
|
||||
strcmp(MACHINE_ARCH, buildinfo[BI_MACHINE_ARCH]) != 0)
|
||||
osbad = 2;
|
||||
|
||||
/* If OS and arch are the same, warn if version differs */
|
||||
if (strcmp(host_uname.sysname, buildinfo[BI_OPSYS]) == 0 &&
|
||||
strcmp(host_uname.machine, buildinfo[BI_MACHINE_ARCH]) == 0) {
|
||||
if (strcmp(OPSYS_NAME, buildinfo[BI_OPSYS]) == 0 &&
|
||||
strcmp(MACHINE_ARCH, buildinfo[BI_MACHINE_ARCH]) == 0) {
|
||||
if (strcmp(host_uname.release, buildinfo[BI_OS_VERSION]) != 0)
|
||||
osbad = 1;
|
||||
} else
|
||||
|
@ -300,20 +300,14 @@ pkg_do(const char *pkg)
|
|||
buildinfo[BI_OPSYS],
|
||||
buildinfo[BI_MACHINE_ARCH],
|
||||
buildinfo[BI_OS_VERSION],
|
||||
host_uname.sysname,
|
||||
host_uname.machine,
|
||||
OPSYS_NAME,
|
||||
MACHINE_ARCH,
|
||||
host_uname.release);
|
||||
}
|
||||
if (!Force && (osbad >= 2)) {
|
||||
warnx("aborting.");
|
||||
goto bomb;
|
||||
}
|
||||
} else {
|
||||
warnx("uname() failed.");
|
||||
if (!Force) {
|
||||
warnx("aborting.");
|
||||
goto bomb;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lib.h,v 1.65 2003/12/20 03:31:56 grant Exp $ */
|
||||
/* $NetBSD: lib.h,v 1.66 2004/01/13 08:30:34 grant Exp $ */
|
||||
|
||||
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
|
||||
|
||||
|
@ -52,6 +52,10 @@
|
|||
#define FALSE (0)
|
||||
#endif
|
||||
|
||||
#ifndef OPSYS_NAME
|
||||
#define OPSYS_NAME "NetBSD"
|
||||
#endif
|
||||
|
||||
/* Usually "rm", but often "echo" during debugging! */
|
||||
#define REMOVE_CMD "rm"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: version.h,v 1.41 2004/01/06 15:51:44 hubertf Exp $ */
|
||||
/* $NetBSD: version.h,v 1.42 2004/01/13 08:30:34 grant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
|
||||
|
@ -33,6 +33,6 @@
|
|||
#ifndef _INST_LIB_VERSION_H_
|
||||
#define _INST_LIB_VERSION_H_
|
||||
|
||||
#define PKGTOOLS_VERSION "20040106"
|
||||
#define PKGTOOLS_VERSION "20040113"
|
||||
|
||||
#endif /* _INST_LIB_VERSION_H_ */
|
||||
|
|
Loading…
Reference in New Issue