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 Add new option -m to pkg_ad...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d79ae0755327
branches:  trunk
changeset: 532245:d79ae0755327
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Aug 14 22:47:51 2007 +0000

description:
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.

diffstat:

 pkgtools/pkg_install/files/add/add.h        |   3 +-
 pkgtools/pkg_install/files/add/main.c       |  13 ++++++++---
 pkgtools/pkg_install/files/add/perform.c    |  30 +++++++++++++++-------------
 pkgtools/pkg_install/files/add/pkg_add.1    |   6 ++++-
 pkgtools/pkg_install/files/add/pkg_add.cat1 |   6 +++-
 pkgtools/pkg_install/files/lib/version.h    |   4 +-
 6 files changed, 38 insertions(+), 24 deletions(-)

diffs (195 lines):

diff -r 979c4834603d -r d79ae0755327 pkgtools/pkg_install/files/add/add.h
--- a/pkgtools/pkg_install/files/add/add.h      Tue Aug 14 21:41:06 2007 +0000
+++ b/pkgtools/pkg_install/files/add/add.h      Tue Aug 14 22:47:51 2007 +0000
@@ -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 @@
        NORMAL, MASTER, SLAVE
 }       add_mode_t;
 
+extern char *OverrideMachine;
 extern char *Prefix;
 extern char *View;
 extern char *Viewbase;
diff -r 979c4834603d -r d79ae0755327 pkgtools/pkg_install/files/add/main.c
--- a/pkgtools/pkg_install/files/add/main.c     Tue Aug 14 21:41:06 2007 +0000
+++ b/pkgtools/pkg_install/files/add/main.c     Tue Aug 14 22:47:51 2007 +0000
@@ -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 @@
 #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 @@
 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 @@
                        NoRecord = TRUE;
                        break;
 
+               case 'm':
+                       OverrideMachine = optarg;
+                       break;
+
                case 'n':
                        Fake = TRUE;
                        Verbose = TRUE;
diff -r 979c4834603d -r d79ae0755327 pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Tue Aug 14 21:41:06 2007 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Tue Aug 14 22:47:51 2007 +0000
@@ -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 @@
                }
 
                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 @@
                                    buildinfo[BI_MACHINE_ARCH],
                                    buildinfo[BI_OS_VERSION],
                                    OPSYS_NAME,
-                                   MACHINE_ARCH,
+                                   effective_arch,
                                    host_uname.release);
                        }
                }
diff -r 979c4834603d -r d79ae0755327 pkgtools/pkg_install/files/add/pkg_add.1
--- a/pkgtools/pkg_install/files/add/pkg_add.1  Tue Aug 14 21:41:06 2007 +0000
+++ b/pkgtools/pkg_install/files/add/pkg_add.1  Tue Aug 14 22:47:51 2007 +0000
@@ -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 @@
 .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 -r 979c4834603d -r d79ae0755327 pkgtools/pkg_install/files/add/pkg_add.cat1
--- a/pkgtools/pkg_install/files/add/pkg_add.cat1       Tue Aug 14 21:41:06 2007 +0000
+++ b/pkgtools/pkg_install/files/add/pkg_add.cat1       Tue Aug 14 22:47:51 2007 +0000
@@ -5,8 +5,8 @@
      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 @@
 
      --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 -r 979c4834603d -r d79ae0755327 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Tue Aug 14 21:41:06 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Tue Aug 14 22:47:51 2007 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index