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 pkg_install-20090228:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f873a4707735
branches:  trunk
changeset: 555357:f873a4707735
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sat Feb 28 16:03:56 2009 +0000

description:
pkg_install-20090228:
Integrate the PKG_PATH logic for tightly with the find_archive logic:
- remember initial current working directory from the time PKG_PATH is
  processed, it will be used as reference for all relative entries
- remove now redundant fchdir dance in pkg_add
- pass down to find_archive if this is a top-level package (e.g.
  requested on the command line) or not; the location of top-level
  packages is searched for packages first and for URLs or path names the
  PKG_PATH itself is not processed (e.g. pkg_add foo/bar not look into
  PKG_PATH for bar). This addresses PR 33884 in a different way.
- document the rules for finding packages more explicitly
- allow specifying PKG_PATH in pkg_install.conf as well; environment
  takes precendence.
- remove PKG_PATH related logic in pkg_info(1), it doesn't deal with
  PKG_PATH anyway
- remove PKG_PATH, PKG_TMPDIR and TMPDIR description in pkg_info(1),
  they are no longer used

diffstat:

 pkgtools/pkg_install/files/add/main.c                   |    6 +-
 pkgtools/pkg_install/files/add/perform.c                |   27 +-
 pkgtools/pkg_install/files/add/pkg_add.1                |   31 +-
 pkgtools/pkg_install/files/add/pkg_add.cat1             |   30 +-
 pkgtools/pkg_install/files/info/main.c                  |   12 +-
 pkgtools/pkg_install/files/info/pkg_info.1              |   43 +---
 pkgtools/pkg_install/files/info/pkg_info.cat1           |   21 +-
 pkgtools/pkg_install/files/lib/Makefile.in              |    4 +-
 pkgtools/pkg_install/files/lib/lib.h                    |    8 +-
 pkgtools/pkg_install/files/lib/parse-config.c           |    9 +-
 pkgtools/pkg_install/files/lib/path.c                   |  193 ----------------
 pkgtools/pkg_install/files/lib/path.h                   |   40 ---
 pkgtools/pkg_install/files/lib/pkg_install.conf.5.in    |    9 +-
 pkgtools/pkg_install/files/lib/pkg_install.conf.cat5.in |    6 +-
 pkgtools/pkg_install/files/lib/pkg_io.c                 |  129 +++++++--
 pkgtools/pkg_install/files/lib/version.h                |    4 +-
 16 files changed, 169 insertions(+), 403 deletions(-)

diffs (truncated from 933 to 300 lines):

diff -r 71b5286bed98 -r f873a4707735 pkgtools/pkg_install/files/add/main.c
--- a/pkgtools/pkg_install/files/add/main.c     Sat Feb 28 15:54:29 2009 +0000
+++ b/pkgtools/pkg_install/files/add/main.c     Sat Feb 28 16:03:56 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.17 2009/02/02 12:35:00 joerg Exp $  */
+/*     $NetBSD: main.c,v 1.18 2009/02/28 16:03:56 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.17 2009/02/02 12:35:00 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.18 2009/02/28 16:03:56 joerg Exp $");
 
 /*
  *
@@ -152,7 +152,7 @@
 
        pkg_install_config();
 
-       path_create(getenv("PKG_PATH"));
+       process_pkg_path();
        TAILQ_INIT(&pkgs);
 
        if (argc == 0) {
diff -r 71b5286bed98 -r f873a4707735 pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Sat Feb 28 15:54:29 2009 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Sat Feb 28 16:03:56 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.80 2009/02/27 19:34:12 joerg Exp $       */
+/*     $NetBSD: perform.c,v 1.81 2009/02/28 16:03:56 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.80 2009/02/27 19:34:12 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.81 2009/02/28 16:03:56 joerg Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -123,7 +123,7 @@
        { 0, NULL, 0 },
 };
 
-static int pkg_do(const char *, int);
+static int pkg_do(const char *, int, int);
 
 static int
 mkdir_p(const char *path)
@@ -1024,7 +1024,7 @@
                                    p->name);
                                continue;
                        }
-                       if (pkg_do(p->name, 1)) {
+                       if (pkg_do(p->name, 1, 0)) {
                                warnx("Can't install dependency %s", p->name);
                                status = -1;
                                break;
@@ -1238,7 +1238,7 @@
  * Install a single package.
  */
 static int
-pkg_do(const char *pkgpath, int mark_automatic)
+pkg_do(const char *pkgpath, int mark_automatic, int top_level)
 {
        int status, invalid_sig;
        void *archive_cookie;
@@ -1249,7 +1249,8 @@
 
        status = -1;
 
-       if ((pkg->archive = find_archive(pkgpath, &archive_cookie)) == NULL) {
+       pkg->archive = find_archive(pkgpath, &archive_cookie, top_level);
+       if (pkg->archive == NULL) {
                warnx("no pkg found for '%s', sorry.", pkgpath);
                goto clean_find_archive;
        }
@@ -1426,25 +1427,15 @@
 int
 pkg_perform(lpkg_head_t *pkgs)
 {
-       int     oldcwd, errors = 0;
+       int     errors = 0;
        lpkg_t *lpp;
 
-       if ((oldcwd = open(".", O_RDONLY, 0)) == -1)
-               err(EXIT_FAILURE, "unable to open cwd");
-
        while ((lpp = TAILQ_FIRST(pkgs)) != NULL) {
-               path_prepend_from_pkgname(lpp->lp_name);
-               if (pkg_do(lpp->lp_name, Automatic))
+               if (pkg_do(lpp->lp_name, Automatic, 1))
                        ++errors;
-               path_prepend_clear();
                TAILQ_REMOVE(pkgs, lpp, lp_link);
                free_lpkg(lpp);
-
-               if (fchdir(oldcwd) == -1)
-                       err(EXIT_FAILURE, "unable to restore cwd");
        }
 
-       close(oldcwd);
-
        return errors;
 }
diff -r 71b5286bed98 -r f873a4707735 pkgtools/pkg_install/files/add/pkg_add.1
--- a/pkgtools/pkg_install/files/add/pkg_add.1  Sat Feb 28 15:54:29 2009 +0000
+++ b/pkgtools/pkg_install/files/add/pkg_add.1  Sat Feb 28 16:03:56 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.32 2009/02/08 23:12:10 wiz Exp $
+.\" $NetBSD: pkg_add.1,v 1.33 2009/02/28 16:03:56 joerg Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -17,7 +17,7 @@
 .\"
 .\"     @(#)pkg_add.1
 .\"
-.Dd October 10, 2008
+.Dd February 27, 2009
 .Dt PKG_ADD 1
 .Os
 .Sh NAME
@@ -87,19 +87,18 @@
 .Bl -tag -width indent
 .It Ar pkg-name [ ... ]
 The named packages are installed.
+.Nm
+will first try to use
 .Ar pkg-name
-may be either a URL or a local pathname,
-a package name of "-" will cause
+as full URL or path name without any wildcard processing.
+If that fails,
 .Nm
-to read from stdin.
-If the packages are not found in the current
-working directory,
-.Nm
-will search them in each directory named by the
-.Ev PKG_PATH
-environment variable.
-Any dependencies required by the installed package will be searched
-in the same location that the original package was installed from.
+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
 Mark package as installed automatically, as dependency of another
 package.
@@ -414,14 +413,16 @@
 .It Ev PKG_PATH
 The value of the
 .Ev PKG_PATH
-is used if a given package can't be found, it's usually set to
+variable overrides the
+.Xr pkg_install.conf 5 
+variable of the same name.
+It is used if a given package can't be found, it's usually set to
 .Pa /usr/pkgsrc/packages/All .
 The environment variable
 should be a series of entries separated by semicolons.
 Each entry consists of a directory name or URL.
 The current directory may be indicated implicitly by an empty directory
 name, or explicitly by a single period.
-FTP URLs may not end with a slash.
 .It Ev PKG_REFCOUNT_DBDIR
 Location of the package reference counts database directory.
 The default location is the path to the package database directory with
diff -r 71b5286bed98 -r f873a4707735 pkgtools/pkg_install/files/add/pkg_add.cat1
--- a/pkgtools/pkg_install/files/add/pkg_add.cat1       Sat Feb 28 15:54:29 2009 +0000
+++ b/pkgtools/pkg_install/files/add/pkg_add.cat1       Sat Feb 28 16:03:56 2009 +0000
@@ -37,13 +37,12 @@
      The following command line arguments are supported:
 
      _p_k_g_-_n_a_m_e [_._._.]
-             The named packages are installed.  _p_k_g_-_n_a_m_e may be either a URL
-             or a local pathname, a package name of "-" will cause ppkkgg__aadddd to
-             read from stdin.  If the packages are not found in the current
-             working directory, ppkkgg__aadddd will search them in each directory
-             named by the PKG_PATH environment variable.  Any dependencies
-             required by the installed package will be searched in the same
-             location that the original package was installed from.
+             The named packages are installed.  ppkkgg__aadddd will first try to use
+             _p_k_g_-_n_a_m_e as full URL or path name without any wildcard process-
+             ing.  If that fails, ppkkgg__aadddd will try to match packages using
+             wildcard processing.  If that fails as well and _p_k_g_-_n_a_m_e does not
+             contain any /, the entries of the PKG_PATH variable are searched
+             using the wildcard processing rules.
 
      --AA      Mark package as installed automatically, as dependency of another
              package.  You can use
@@ -237,13 +236,14 @@
                  the package database directory.  The default package database
                  directory is _/_v_a_r_/_d_b_/_p_k_g.
 
-     PKG_PATH    The value of the PKG_PATH is used if a given package can't be
-                 found, it's usually set to _/_u_s_r_/_p_k_g_s_r_c_/_p_a_c_k_a_g_e_s_/_A_l_l.  The
-                 environment variable should be a series of entries separated
-                 by semicolons.  Each entry consists of a directory name or
-                 URL.  The current directory may be indicated implicitly by an
-                 empty directory name, or explicitly by a single period.  FTP
-                 URLs may not end with a slash.
+     PKG_PATH    The value of the PKG_PATH variable is used if a given package
+                 can't be found, it's usually set to _/_u_s_r_/_p_k_g_s_r_c_/_p_a_c_k_a_g_e_s_/_A_l_l.
+                 The environment variable should be a series of entries sepa-
+                 rated by semicolons.  Each entry consists of a directory name
+                 or URL.  The current directory may be indicated implicitly by
+                 an empty directory name, or explicitly by a single period.
+                 It overrides the pkg_install.conf(5) variable of the same
+                 name.
 
      PKG_REFCOUNT_DBDIR
                  Location of the package reference counts database directory.
@@ -317,4 +317,4 @@
 
      Sure to be others.
 
-NetBSD 5.0                     October 10, 2008                     NetBSD 5.0
+NetBSD 5.0                     February 27, 2009                    NetBSD 5.0
diff -r 71b5286bed98 -r f873a4707735 pkgtools/pkg_install/files/info/main.c
--- a/pkgtools/pkg_install/files/info/main.c    Sat Feb 28 15:54:29 2009 +0000
+++ b/pkgtools/pkg_install/files/info/main.c    Sat Feb 28 16:03:56 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.23 2009/02/02 12:35:01 joerg Exp $  */
+/*     $NetBSD: main.c,v 1.24 2009/02/28 16:03:56 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.23 2009/02/02 12:35:01 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.24 2009/02/28 16:03:56 joerg Exp $");
 
 /*
  *
@@ -242,14 +242,6 @@
                usage();
        }
 
-       /* Don't do FTP stuff when operating on all pkgs */
-       if (Which != WHICH_LIST && getenv("PKG_PATH") != 0) {
-               warnx("disabling PKG_PATH when operating on all packages.");
-               unsetenv("PKG_PATH");
-       }
-
-       path_create(getenv("PKG_PATH"));
-
        /* Set some reasonable defaults */
        if (!Flags)
                Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY 
diff -r 71b5286bed98 -r f873a4707735 pkgtools/pkg_install/files/info/pkg_info.1
--- a/pkgtools/pkg_install/files/info/pkg_info.1        Sat Feb 28 15:54:29 2009 +0000
+++ b/pkgtools/pkg_install/files/info/pkg_info.1        Sat Feb 28 16:03:56 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_info.1,v 1.22 2007/11/02 16:03:37 joerg Exp $
+.\" $NetBSD: pkg_info.1,v 1.23 2009/02/28 16:03:56 joerg Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -17,7 +17,7 @@
 .\"
 .\"     @(#)pkg_info.1
 .\"
-.Dd March 2, 2007
+.Dd February 27, 2009
 .Dt PKG_INFO 1
 .Os
 .Sh NAME
@@ -301,45 +301,6 @@
 is the location of the package database directory.
 The default package database directory is
 .Pa /var/db/pkg .
-.It Ev PKG_PATH
-This can be used to specify a semicolon-separated list of paths and URLs to search for
-package files.
-If
-.Ev PKG_PATH
-is used, the suffix
-.Pa .tgz
-is automatically appended to the
-.Ar pkg-name ,
-whereas searching in the current directory uses
-.Ar pkg-name
-literally.
-.It Ev PKG_TMPDIR , Ev TMPDIR
-These are tried in turn (if set) as candidate directories in which
-to create a
-.Dq staging area
-for any files extracted by



Home | Main Index | Thread Index | Old Index