Subject: Broken PKG_PATH semantics on pkg_add
To: None <tech-pkg@netbsd.org>
From: David Brownlee <abs@formula1.com>
List: tech-pkg
Date: 08/26/2002 19:45:24
In at least the 1.6 version of pkg_add, if you try to pkg_add
a local package it will default PKG_PATH to '.', which loses
if you try to add a package which depends on other packages
which are not in the current directory.
eg: 'pkg_add /.../packages/All/fu.tgz' will fail if fu.tgz
depends on All/bar.tgz, unless you are in that directory.
Quick & dirty patch to handle this below.
Question: For pkg_add and pkg_info should the 'paths' of
packages given be added to the PKG_PATH? If so, should
they be added after anything explicitly given in $PKG_PATH,
and instead of the implicit '.'?
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/pkg_install/add/main.c,v
retrieving revision 1.23.2.3
diff -u -r1.23.2.3 main.c
--- add/main.c 2002/08/06 00:31:37 1.23.2.3
+++ add/main.c 2002/08/26 18:41:46
@@ -129,7 +129,19 @@
argc -= optind;
argv += optind;
- path_create(getenv("PKG_PATH"));
+ if (getenv("PKG_PATH"))
+ path_create(getenv("PKG_PATH"));
+ else {
+ char *ptr;
+ if ((ptr = strrchr(*argv, '/'))) {
+ *ptr = 0;
+ path_create(*argv);
+ *ptr = '/';
+ }
+ else
+ path_create(0);
+ }
+
TAILQ_INIT(&pkgs);
if (AddMode != SLAVE) {
@@ -141,7 +153,6 @@
lpp = alloc_lpkg("-");
else
lpp = alloc_lpkg(*argv);
-
TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
}
} else if (!ch)
--
David Brownlee/absolute abs@formula1.com