pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install pkg_install-20100122:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a62acbebe39e
branches:  trunk
changeset: 569980:a62acbebe39e
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Fri Jan 22 13:30:41 2010 +0000

description:
pkg_install-20100122:
- Refactor man pages:
  - Move description of environmental variables into pkg_install.conf(5)
  - Remove a bunch of dead references
  - Avoid using hard-coded path names that can easily be overridden by
    the user.
- Refactor pkgdb related logic, so that -K behaves consistently.
- Add some helper functions to isolate more places from the pkgdb
  layout.
- Sync license list.
- Handle PKG_REFCOUNT_DBDIR consistently as option too.
- Utilize connection cache from libfetch.
- Add helper target for cat pages updates.

diffstat:

 pkgtools/pkg_install/Makefile                           |   12 +-
 pkgtools/pkg_install/files/add/Makefile.in              |    4 +-
 pkgtools/pkg_install/files/add/add.h                    |    3 +-
 pkgtools/pkg_install/files/add/main.c                   |   19 +-
 pkgtools/pkg_install/files/add/perform.c                |   18 +-
 pkgtools/pkg_install/files/add/pkg_add.1                |  437 +++++++++++++
 pkgtools/pkg_install/files/add/pkg_add.1.in             |  536 ----------------
 pkgtools/pkg_install/files/admin/Makefile.in            |    4 +-
 pkgtools/pkg_install/files/admin/README                 |    9 -
 pkgtools/pkg_install/files/admin/check.c                |   11 +-
 pkgtools/pkg_install/files/admin/main.c                 |   21 +-
 pkgtools/pkg_install/files/admin/pkg_admin.1            |  317 +++++++++
 pkgtools/pkg_install/files/admin/pkg_admin.1.in         |  356 ----------
 pkgtools/pkg_install/files/bpm/bpm.cat1                 |   61 -
 pkgtools/pkg_install/files/configure                    |    4 +-
 pkgtools/pkg_install/files/configure.ac                 |   15 +-
 pkgtools/pkg_install/files/create/Makefile.in           |    4 +-
 pkgtools/pkg_install/files/create/main.c                |   10 +-
 pkgtools/pkg_install/files/create/pkg_create.1          |  504 +++++++++++++++
 pkgtools/pkg_install/files/create/pkg_create.1.in       |  515 ---------------
 pkgtools/pkg_install/files/delete/Makefile.in           |    4 +-
 pkgtools/pkg_install/files/delete/pkg_delete.1          |  296 ++++++++
 pkgtools/pkg_install/files/delete/pkg_delete.c          |   23 +-
 pkgtools/pkg_install/files/info/Makefile.in             |    4 +-
 pkgtools/pkg_install/files/info/main.c                  |   12 +-
 pkgtools/pkg_install/files/info/perform.c               |   12 +-
 pkgtools/pkg_install/files/info/pkg_info.1              |  315 +++++++++
 pkgtools/pkg_install/files/info/pkg_info.1.in           |  327 ---------
 pkgtools/pkg_install/files/lib/Makefile.in              |    8 +-
 pkgtools/pkg_install/files/lib/conflicts.c              |    9 +-
 pkgtools/pkg_install/files/lib/iterate.c                |    4 +-
 pkgtools/pkg_install/files/lib/lib.h                    |   20 +-
 pkgtools/pkg_install/files/lib/license.c                |    6 +-
 pkgtools/pkg_install/files/lib/parse-config.c           |   55 +-
 pkgtools/pkg_install/files/lib/pkg_install.conf.5.in    |   44 +-
 pkgtools/pkg_install/files/lib/pkg_install.conf.cat5.in |  153 ----
 pkgtools/pkg_install/files/lib/pkg_summary.cat5         |  103 ---
 pkgtools/pkg_install/files/lib/pkgdb.c                  |   72 +-
 pkgtools/pkg_install/files/lib/pkgsrc.cat7              |   19 -
 pkgtools/pkg_install/files/lib/version.h                |    4 +-
 pkgtools/pkg_install/files/view/pkg_view.1              |  276 ++++++++
 pkgtools/pkg_install/files/view/pkg_view.1.in           |  278 --------
 42 files changed, 2377 insertions(+), 2527 deletions(-)

diffs (truncated from 5731 to 300 lines):

diff -r 5dc37e907cc8 -r a62acbebe39e pkgtools/pkg_install/Makefile
--- a/pkgtools/pkg_install/Makefile     Fri Jan 22 13:23:46 2010 +0000
+++ b/pkgtools/pkg_install/Makefile     Fri Jan 22 13:30:41 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.169 2010/01/20 23:17:12 joerg Exp $
+# $NetBSD: Makefile,v 1.170 2010/01/22 13:30:41 joerg Exp $
 
 # Notes to package maintainers:
 #
@@ -165,4 +165,14 @@
        ${MAKE} ${UPDATE_TARGET}
        ${MAKE} clean
 
+update-catpages:
+       for f in lib/pkgsrc.7 add/pkg_add.1 admin/pkg_admin.1 \
+           create/pkg_create.1 delete/pkg_delete.1 info/pkg_info.1 \
+           lib/pkg_summary.5 lib/pkgsrc.7; do \
+               nroff -mdoc ${FILESDIR}/$$f > \
+                   ${FILESDIR}/$${f%%.[157]}.cat; \
+       done
+       nroff -mdoc ${FILESDIR}/lib/pkg_install.conf.5.in > \
+           ${FILESDIR}/lib/pkg_install.conf.cat.in
+
 .include "../../mk/bsd.pkg.mk"
diff -r 5dc37e907cc8 -r a62acbebe39e pkgtools/pkg_install/files/add/Makefile.in
--- a/pkgtools/pkg_install/files/add/Makefile.in        Fri Jan 22 13:23:46 2010 +0000
+++ b/pkgtools/pkg_install/files/add/Makefile.in        Fri Jan 22 13:30:41 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.20 2009/02/13 11:21:07 joerg Exp $
+# $NetBSD: Makefile.in,v 1.21 2010/01/22 13:30:41 joerg Exp $
 
 srcdir=                @srcdir@
 
@@ -49,4 +49,4 @@
        $(INSTALL) -m 755 -d ${DESTDIR}$(cat1dir)
        $(INSTALL) $(PROG) ${DESTDIR}$(sbindir)/$(PROG)
        $(INSTALL) -m 444 $(PROG).1 ${DESTDIR}$(man1dir)/$(PROG).1
-       $(INSTALL) -m 444 $(PROG).cat1 ${DESTDIR}$(cat1dir)/$(PROG).0
+       $(INSTALL) -m 444 $(PROG).cat ${DESTDIR}$(cat1dir)/$(PROG).0
diff -r 5dc37e907cc8 -r a62acbebe39e pkgtools/pkg_install/files/add/add.h
--- a/pkgtools/pkg_install/files/add/add.h      Fri Jan 22 13:23:46 2010 +0000
+++ b/pkgtools/pkg_install/files/add/add.h      Fri Jan 22 13:30:41 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: add.h,v 1.16 2009/10/07 12:53:26 joerg Exp $ */
+/* $NetBSD: add.h,v 1.17 2010/01/22 13:30:41 joerg Exp $ */
 
 /* from FreeBSD Id: add.h,v 1.8 1997/02/22 16:09:15 peter Exp  */
 
@@ -25,7 +25,6 @@
 #ifndef _INST_ADD_H_INCLUDE
 #define _INST_ADD_H_INCLUDE
 
-extern const char *PlainPkgdb;
 extern char *Destdir;
 extern char *OverrideMachine;
 extern char *Prefix;
diff -r 5dc37e907cc8 -r a62acbebe39e pkgtools/pkg_install/files/add/main.c
--- a/pkgtools/pkg_install/files/add/main.c     Fri Jan 22 13:23:46 2010 +0000
+++ b/pkgtools/pkg_install/files/add/main.c     Fri Jan 22 13:30:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.22 2009/10/07 12:53:26 joerg Exp $  */
+/*     $NetBSD: main.c,v 1.23 2010/01/22 13:30:41 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.22 2009/10/07 12:53:26 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.23 2010/01/22 13:30:41 joerg Exp $");
 
 /*
  *
@@ -41,7 +41,6 @@
 
 static char Options[] = "AIK:LP:RVW:fhm:np:t:uvw:";
 
-const char *PlainPkgdb = NULL;
 char   *Destdir = NULL;
 char   *OverrideMachine = NULL;
 char   *Prefix = NULL;
@@ -72,7 +71,6 @@
 {
        int     ch, error=0;
        lpkg_head_t pkgs;
-       const char *pkgdb = NULL;
 
        setprogname(argv[0]);
        while ((ch = getopt(argc, argv, Options)) != -1) {
@@ -98,7 +96,7 @@
                        break;
 
                case 'K':
-                       pkgdb = optarg;
+                       pkgdb_set_dir(optarg, 3);
                        break;
 
                case 'L':
@@ -154,18 +152,13 @@
 
        pkg_install_config();
 
-       if (pkgdb == NULL)
-               pkgdb = _pkgdb_getPKGDB_DIR();
-       PlainPkgdb = xstrdup(pkgdb);
-
        if (Destdir != NULL) {
                char *pkgdbdir;
 
-               pkgdbdir = xasprintf("%s/%s", Destdir, pkgdb);
-               _pkgdb_setPKGDB_DIR(pkgdbdir);
+               pkgdbdir = xasprintf("%s/%s", Destdir, config_pkg_dbdir);
+               pkgdb_set_dir(pkgdbdir, 4);
                free(pkgdbdir);
-       } else
-               _pkgdb_setPKGDB_DIR(pkgdb);
+       }
 
        process_pkg_path();
        TAILQ_INIT(&pkgs);
diff -r 5dc37e907cc8 -r a62acbebe39e pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Fri Jan 22 13:23:46 2010 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Fri Jan 22 13:30:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.91 2009/10/07 12:53:26 joerg Exp $       */
+/*     $NetBSD: perform.c,v 1.92 2010/01/22 13:30:41 joerg Exp $       */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.91 2009/10/07 12:53:26 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.92 2010/01/22 13:30:41 joerg Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -875,7 +875,7 @@
                setenv(PKG_DESTDIR_VNAME, Destdir, 1);
        setenv(PKG_PREFIX_VNAME, pkg->prefix, 1);
        setenv(PKG_METADATA_DIR_VNAME, pkg->logdir, 1);
-       setenv(PKG_REFCOUNT_DBDIR_VNAME, pkgdb_refcount_dir(), 1);
+       setenv(PKG_REFCOUNT_DBDIR_VNAME, config_pkg_refcount_dbdir, 1);
 
        if (Verbose)
                printf("Running install with PRE-INSTALL for %s.\n", pkg->pkgname);
@@ -1087,13 +1087,13 @@
 
        if (Verbose) {
                printf("%s/pkg_view -d %s %s%s %s%s %sadd %s\n",
-                       BINDIR, _pkgdb_getPKGDB_DIR(),
+                       BINDIR, pkgdb_get_dir(),
                        View ? "-w " : "", View ? View : "",
                        Viewbase ? "-W " : "", Viewbase ? Viewbase : "",
                        Verbose ? "-v " : "", pkg->pkgname);
        }
 
-       fexec_skipempty(BINDIR "/pkg_view", "-d", _pkgdb_getPKGDB_DIR(),
+       fexec_skipempty(BINDIR "/pkg_view", "-d", pkgdb_get_dir(),
                        View ? "-w " : "", View ? View : "",
                        Viewbase ? "-W " : "", Viewbase ? Viewbase : "",
                        Verbose ? "-v " : "", "add", pkg->pkgname,
@@ -1136,12 +1136,12 @@
 
        if (Verbose || Fake) {
                printf("%s/pkg_delete -K %s -p %s%s%s '%s'\n",
-                       BINDIR, _pkgdb_getPKGDB_DIR(), pkg->prefix,
+                       BINDIR, pkgdb_get_dir(), pkg->prefix,
                        Destdir ? " -P ": "", Destdir ? Destdir : "",
                        pkg->other_version);
        }
        if (!Fake)
-               fexec_skipempty(BINDIR "/pkg_delete", "-K", _pkgdb_getPKGDB_DIR(),
+               fexec_skipempty(BINDIR "/pkg_delete", "-K", pkgdb_get_dir(),
                    "-p", pkg->prefix,
                    Destdir ? "-P": "", Destdir ? Destdir : "",
                    pkg->other_version, NULL);
@@ -1327,9 +1327,9 @@
 
        if (pkg->meta_data.meta_views != NULL) {
                pkg->logdir = xstrdup(pkg->prefix);
-               _pkgdb_setPKGDB_DIR(dirname_of(pkg->logdir));
+               pkgdb_set_dir(dirname_of(pkg->logdir), 4);
        } else {
-               pkg->logdir = xasprintf("%s/%s", PlainPkgdb, pkg->pkgname);
+               pkg->logdir = xasprintf("%s/%s", config_pkg_dbdir, pkg->pkgname);
        }
 
        if (Destdir != NULL)
diff -r 5dc37e907cc8 -r a62acbebe39e pkgtools/pkg_install/files/add/pkg_add.1
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/pkg_install/files/add/pkg_add.1  Fri Jan 22 13:30:41 2010 +0000
@@ -0,0 +1,437 @@
+.\" $NetBSD: pkg_add.1,v 1.41 2010/01/22 13:30:41 joerg Exp $
+.\"
+.\" FreeBSD install - a package for the installation and maintenance
+.\" of non-core utilities.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" Jordan K. Hubbard
+.\"
+.\"
+.\"     @(#)pkg_add.1
+.\"
+.Dd January 22, 2010
+.Dt PKG_ADD 1
+.Os
+.Sh NAME
+.Nm pkg_add
+.Nd a utility for installing and upgrading software package distributions
+.Sh SYNOPSIS
+.Nm
+.Op Fl AfILnRuVv
+.Op Fl K Ar pkg_dbdir
+.Op Fl m Ar machine
+.Op Fl P Ar destdir
+.Op Fl p Ar prefix
+.Op Fl W Ar viewbase
+.Op Fl w Ar view
+.Ar Oo Oo Li ftp|http Oc Ns Li :// Ns Oo Ar user Oc Ns \
+Oo Li \&: Ns Ar password Oc \
+Ns Li @ Oc Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns \
+Oo Li / Ns Ar path/ Oc Ns Ar pkg-name ...
+.Sh DESCRIPTION
+The
+.Nm
+command is used to extract and upgrade packages that have been
+previously created with the
+.Xr pkg_create 1
+command.
+Packages are prepared collections of pre-built binaries, documentation,
+configurations, installation instructions and/or other files.
+.Nm
+can recursively install other packages that the current package
+depends on or requires from both local disk and via FTP or HTTP.
+.Sh WARNING
+.Bf -emphasis
+Since the
+.Nm
+command may execute scripts or programs contained within a package file,
+your system may be susceptible to
+.Dq Trojan horses
+or other subtle
+attacks from miscreants who create dangerous package files.
+.Pp
+You are advised to verify the competence and identity of those who
+provide installable package files.
+For extra protection, use the digital signatures provided where possible
+(see the
+.Xr pkg_install.conf 5 ) ,
+or, failing that, use
+.Xr tar 1
+to extract the package file, and inspect its contents and scripts
+to ensure it poses no danger to your system's integrity.
+Pay particular attention to any
+.Pa +INSTALL
+or
+.Pa +DEINSTALL
+files, and inspect the
+.Pa +CONTENTS
+file for
+.Cm @cwd ,
+.Cm @mode
+(check for setuid),
+.Cm @dirrm ,
+.Cm @exec ,
+and
+.Cm @unexec
+directives, and/or use the
+.Xr pkg_info 1
+command to examine the package file.
+.Ef
+.Sh OPTIONS
+The following command line arguments are supported:
+.Bl -tag -width indent
+.It Ar pkg-name [ ... ]
+The named packages are installed.
+.Nm
+will first try to use
+.Ar pkg-name
+as full URL or path name without any wildcard processing.
+If that fails,
+.Nm
+will try to match packages using wildcard processing.
+If that fails as well and
+.Ar pkg-name
+does not contain any /, the entries of the
+.Dv PKG_PATH
+variable are searched using the wildcard processing rules.
+.It Fl A



Home | Main Index | Thread Index | Old Index