diff options
author | joerg <joerg@pkgsrc.org> | 2007-08-14 22:47:51 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2007-08-14 22:47:51 +0000 |
commit | 7a762a7879f05561765b7a1c6e684235303453a1 (patch) | |
tree | 802823f546cbb3881083ece22d937b31dca2f3d6 | |
parent | 5dc1a744e1b663209f726ae51dfdef876c617c96 (diff) | |
download | pkgsrc-7a762a7879f05561765b7a1c6e684235303453a1.tar.gz |
Add new option -m to pkg_add. This allows to override MACHINE_ARCH
for the purpose of installing a package and enables cross-compiled
pkgsrc to not use -f all the time.
Bump version to 20070815.
-rw-r--r-- | pkgtools/pkg_install/files/add/add.h | 3 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/add/main.c | 13 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/add/perform.c | 30 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/add/pkg_add.1 | 6 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/add/pkg_add.cat1 | 6 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
6 files changed, 38 insertions, 24 deletions
diff --git a/pkgtools/pkg_install/files/add/add.h b/pkgtools/pkg_install/files/add/add.h index db115715d68..144e87721f7 100644 --- a/pkgtools/pkg_install/files/add/add.h +++ b/pkgtools/pkg_install/files/add/add.h @@ -1,4 +1,4 @@ -/* $NetBSD: add.h,v 1.8 2007/07/30 10:33:07 joerg Exp $ */ +/* $NetBSD: add.h,v 1.9 2007/08/14 22:47:51 joerg Exp $ */ /* from FreeBSD Id: add.h,v 1.8 1997/02/22 16:09:15 peter Exp */ @@ -29,6 +29,7 @@ typedef enum { NORMAL, MASTER, SLAVE } add_mode_t; +extern char *OverrideMachine; extern char *Prefix; extern char *View; extern char *Viewbase; diff --git a/pkgtools/pkg_install/files/add/main.c b/pkgtools/pkg_install/files/add/main.c index d775f8b40c8..304af92b9ba 100644 --- a/pkgtools/pkg_install/files/add/main.c +++ b/pkgtools/pkg_install/files/add/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.12 2007/08/13 19:13:13 joerg Exp $ */ +/* $NetBSD: main.c,v 1.13 2007/08/14 22:47:52 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp"; #else -__RCSID("$NetBSD: main.c,v 1.12 2007/08/13 19:13:13 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.13 2007/08/14 22:47:52 joerg Exp $"); #endif #endif @@ -49,8 +49,9 @@ __RCSID("$NetBSD: main.c,v 1.12 2007/08/13 19:13:13 joerg Exp $"); #include "add.h" #include "verify.h" -static char Options[] = "AIK:LRVW:fhnp:s:t:uvw:"; +static char Options[] = "AIK:LRVW:fhm:np:s:t:uvw:"; +char *OverrideMachine = NULL; char *Prefix = NULL; char *View = NULL; char *Viewbase = NULL; @@ -71,7 +72,7 @@ static void usage(void) { (void) fprintf(stderr, "%s\n%s\n%s\n", - "usage: pkg_add [-AfhILnRuVv] [-K pkg_dbdir] [-p prefix]", + "usage: pkg_add [-AfhILnRuVv] [-K pkg_dbdir] [-m machine] [-p prefix]", " [-s verification-type] [-t template] [-W viewbase] [-w view]", " [[ftp|http]://[user[:password]@]host[:port]][/path/]pkg-name ..."); exit(1); @@ -112,6 +113,10 @@ main(int argc, char **argv) NoRecord = TRUE; break; + case 'm': + OverrideMachine = optarg; + break; + case 'n': Fake = TRUE; Verbose = TRUE; diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c index a67f60e6b51..00ae68d5a00 100644 --- a/pkgtools/pkg_install/files/add/perform.c +++ b/pkgtools/pkg_install/files/add/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.56 2007/08/13 19:15:37 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.57 2007/08/14 22:47:52 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -14,7 +14,7 @@ #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.56 2007/08/13 19:15:37 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.57 2007/08/14 22:47:52 joerg Exp $"); #endif #endif @@ -366,21 +366,23 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs) } if (status == Good) { + const char *effective_arch; + + if (OverrideMachine != NULL) + effective_arch = OverrideMachine; + else + effective_arch = MACHINE_ARCH; + /* If either the OS or arch are different, bomb */ - if (strcmp(OPSYS_NAME, buildinfo[BI_OPSYS]) != 0 || - strcmp(MACHINE_ARCH, buildinfo[BI_MACHINE_ARCH]) != 0) { + if (strcmp(OPSYS_NAME, buildinfo[BI_OPSYS]) != 0) + status = Fatal; + if (strcmp(effective_arch, buildinfo[BI_MACHINE_ARCH]) != 0) status = Fatal; - } /* If OS and arch are the same, warn if version differs */ - 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) { - status = Warning; - } - } else { - status = Fatal; - } + if (status == Good && + strcmp(host_uname.release, buildinfo[BI_OS_VERSION]) != 0) + status = Warning; if (status != Good) { warnx("Warning: package `%s' was built for a different version of the OS:", pkg); @@ -389,7 +391,7 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs) buildinfo[BI_MACHINE_ARCH], buildinfo[BI_OS_VERSION], OPSYS_NAME, - MACHINE_ARCH, + effective_arch, host_uname.release); } } diff --git a/pkgtools/pkg_install/files/add/pkg_add.1 b/pkgtools/pkg_install/files/add/pkg_add.1 index 4bd9dbe7ce4..24ecea122a2 100644 --- a/pkgtools/pkg_install/files/add/pkg_add.1 +++ b/pkgtools/pkg_install/files/add/pkg_add.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_add.1,v 1.25 2007/08/09 23:32:59 joerg Exp $ +.\" $NetBSD: pkg_add.1,v 1.26 2007/08/14 22:47:52 joerg Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -27,6 +27,7 @@ .Nm .Op Fl AfILnRuVv .Op Fl K Ar pkg_dbdir +.Op Fl m Ar machine .Op Fl p Ar prefix .Op Fl s Ar verification-type .Op Fl t Ar template @@ -136,6 +137,9 @@ if it's set, otherwise it defaults to .Pa /var/db/pkg . .It Fl L Don't add the package to any views after installation. +.It Fl m +Override the machine architecture returned by uname with +.Ar machine . .It Fl n Don't actually install a package, just report the steps that would be taken if it was. diff --git a/pkgtools/pkg_install/files/add/pkg_add.cat1 b/pkgtools/pkg_install/files/add/pkg_add.cat1 index 962d645681b..117aa15605e 100644 --- a/pkgtools/pkg_install/files/add/pkg_add.cat1 +++ b/pkgtools/pkg_install/files/add/pkg_add.cat1 @@ -5,8 +5,8 @@ NNAAMMEE tributions SSYYNNOOPPSSIISS - ppkkgg__aadddd [--AAffIILLnnRRuuVVvv] [--KK _p_k_g___d_b_d_i_r] [--pp _p_r_e_f_i_x] [--ss _v_e_r_i_f_i_c_a_t_i_o_n_-_t_y_p_e] - [--tt _t_e_m_p_l_a_t_e] [--WW _v_i_e_w_b_a_s_e] [--ww _v_i_e_w] + ppkkgg__aadddd [--AAffIILLnnRRuuVVvv] [--KK _p_k_g___d_b_d_i_r] [--mm _m_a_c_h_i_n_e] [--pp _p_r_e_f_i_x] + [--ss _v_e_r_i_f_i_c_a_t_i_o_n_-_t_y_p_e] [--tt _t_e_m_p_l_a_t_e] [--WW _v_i_e_w_b_a_s_e] [--ww _v_i_e_w] [[ftp|http]://[_u_s_e_r[:_p_a_s_s_w_o_r_d_]@]_h_o_s_t[:_p_o_r_t]][/_p_a_t_h_/]pkg-name ... DDEESSCCRRIIPPTTIIOONN @@ -72,6 +72,8 @@ OOPPTTIIOONNSS --LL Don't add the package to any views after installation. + --mm Override the machine architecture returned by uname with _m_a_c_h_i_n_e. + --nn Don't actually install a package, just report the steps that would be taken if it was. diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 08be3404bc4..7ab27593196 100644 --- a/pkgtools/pkg_install/files/lib/version.h +++ b/pkgtools/pkg_install/files/lib/version.h @@ -1,4 +1,4 @@ -/* $NetBSD: version.h,v 1.77 2007/08/12 22:09:02 joerg Exp $ */ +/* $NetBSD: version.h,v 1.78 2007/08/14 22:47:52 joerg 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 "20070813" +#define PKGTOOLS_VERSION "20070814" #endif /* _INST_LIB_VERSION_H_ */ |