Commit Graph

298 Commits

Author SHA1 Message Date
hubertf 55a4568c92 Make usage message match that of other pkg_* programs:
* user lowercase "usage"
 * do not use __progname/getprogname() to make this build on old systems
   (the pkg_install pkg is intended to run on 1.4 and maybe 1.3 too...)
2001-02-21 13:12:47 +00:00
cgd 25bdbb661e convert to use getprogname() 2001-02-19 23:22:40 +00:00
jdolecek c7121de1da use getcwd() instead of getwd() - mainly to avoid link warning, this
particular usage is safe
2001-01-10 22:53:22 +00:00
lukem 443a19e035 convert to using .WAIT 2001-01-09 03:13:39 +00:00
enami 270db080e9 Use PRINTOBJDIR. 2001-01-07 08:00:54 +00:00
hubertf f4f6931307 Alphabetize options. 2001-01-07 01:39:20 +00:00
lukem c2aa46e7c2 use %ll_ instead of the less standard %q_ 2001-01-05 03:27:26 +00:00
hubertf 6e6337b43d * findmatchingname():
When the bzip-pkg handling was introduced, a dewey pattern (foo>1) may get
   a character-class-pattern attached (.t[bg]z), and the code was not prepared
   to match that. I've special-cased handling of character-class pkg suffixes
   for ".t[bg]z", and when scanning a dir in findmatchingname() now both the
   'first' part of the pattern (e.g. "foo>1") and the suffix (e.g. ".t[bg]z")
   must match the file, hence the two pmatch() calls.

 * findbestmatchingname_fn():
   Caught a case where ".t[bg]z" was not properly handled. Must do the same
   suffix-processing again here!

Fixes PR 11856 by Dan McMahill <mcmahill@mit.edu>
2001-01-01 22:07:35 +00:00
hubertf 3d76df0ee0 Strip not only .tgz but also .tbz etc. (missed from last commit) 2000-12-13 03:49:56 +00:00
hubertf 5382dffae7 * Accept ".tbz" as an alternative pkg suffix to ".tbz" for pkg_add and
pkg_info
 * In pkg_create, compress with bzip2 if a .tbz suffix is given
 * Fix pkg_info to work via ftp, either via URL specified on command line
   or via one made up from PKG_PATH (if set)

XXX ALWAYS tacks on ".t[bg]z", NOT ".t[gb]z" !!!
2000-12-13 03:17:53 +00:00
hubertf 4b8a7a0e49 Fix pkg_info w/ URLs (*sigh*) 2000-11-30 10:09:15 +00:00
mycroft 9ff73e166a Oops; the increment needs to be in check1pkg() for the case where the user
specifies a list.
2000-11-28 05:23:35 +00:00
mycroft 23451da968 pkgcnt was incremented twice during a `check'... 2000-11-28 05:21:57 +00:00
hubertf fc8a285aa2 Fix timeout in expect():
The FTP coprocess formerly wrote the output of the "get | tar vxf -" pipe
to stderr, which resulted in no output to the feedback pipe (stdout), and
thus the timeout was not updated for any line printed by the "tar" process.
This was now changed to also feed back the chars to the expect() routine,
updating the timeout handler. The "also" part is implemented by passing
the output through "tee /dev/stderr".

At least NetBSD and Solaris have this, so no problem there.

Thanks to Frank van der Linden for helping me to debug this.
2000-11-28 01:16:01 +00:00
hubertf ec58d85250 Don't mkdir("/usr/tmp") in a desperate try to get some space.
If it's there, use it. If it's not there - bad luck.

Pointed out by Simon Burge <simonb@wasabisystems.com>.
2000-11-26 03:12:01 +00:00
wiz 18c121ba47 ispell 2000-11-12 15:32:57 +00:00
lukem 279552d3db fix up various .Nm abuses:
- keep the case consistent between the actual name and what's referenced.
  e.g, if it's `foo', don't use '.Nm Foo' at the start of a sentence.
- remove unnecessary `.Nm foo' after the first occurrence (except for
  using `.Nm ""' if there's stuff following, or for the 2nd and so on
  occurrences in a SYNOPSIS
- use Sx, Ic, Li, Em, Sq, and Xr as appropriate
2000-11-07 06:43:24 +00:00
hubertf efeb1d1e82 Don't swallow '%' in file/directory names.
Patch submitted in PR 11352 by Brook Milligan <brook@biology.nmsu.edu>
2000-10-31 23:47:05 +00:00
hubertf 4f394222d2 Pull in /etc/mk.conf unconditionally, not only on SunOS.
Discussed with Alistair Crooks.
2000-10-27 11:49:23 +00:00
hubertf 931aadfd80 s/bsd/BSD/ 2000-10-25 15:55:44 +00:00
mycroft f5abf3cd7a Introduce some caching. 2000-10-21 00:55:23 +00:00
is d8302e2d73 More format string cleanups by sommerfeld. 2000-10-11 20:23:46 +00:00
hubertf bf24eb4e3f Check if $PKG_PATH is set AND contains something useful. Stops
pkg_info from spewing.
2000-10-11 11:09:20 +00:00
hubertf 5f69d95c26 Check right variable to see if it's a URL (pkg -> cp) 2000-10-11 11:08:04 +00:00
hubertf b31af88872 fix indentation 2000-10-11 11:01:41 +00:00
hubertf 589e705b57 Remove unneeded header <db.h>. 2000-10-09 19:11:58 +00:00
hubertf 6cc0c78181 Remove unneeded header <sys/syslimits.h> 2000-10-09 19:06:08 +00:00
hubertf f5b925151e Allow SRCS, LDADD to be set on the command line, and still add the files. 2000-10-09 17:03:20 +00:00
hubertf 32166d4f75 Only pull in <vis.h> when debugging expect(), i.e. EXPECT_DEBUG is set. 2000-10-09 14:35:27 +00:00
ad 5b09090e8e insure -> ensure 2000-10-05 12:35:33 +00:00
hubertf 037fd8a74e Make even more silent, only spit out stuff if -v is given.
Found during a post-install of a fresh machine:
1. setenv PKG_PATH ftp://smaug.fh-regensburg.de/pub/NetBSD/arch/i386ELF/All
2. pkg_add tcsh ssh XF86Config
3. Run XF86Config
4. pkg_add kde
5. Be done.

We should do this from /etc/rc.local on first boot... :-)
2000-10-04 16:01:50 +00:00
hubertf 0a2663ad0b Not every FTP server says nicely "Goodbye".
If they used some other string, pkg_add would hang forever.
The result of testing things only against one FTP server...
2000-10-01 20:34:30 +00:00
hubertf 197ee08b13 Don't replace the pkg version with -[0-9] on pkg alternates ("{foo-x,bar-y}")
as this will remove things like trailing '}' etc. and doesn't work in general.

As mentioned in the already-existing comment, doing TRT here would mean to
partly expand the pattern, then replace the versions on alternatives.
Unless our pkg pattern parser gets these hooks, cowardly step back.
2000-10-01 12:23:21 +00:00
jwise f9c3dbedef Silly as it may be, update the #! line in this script to match the pkgsrc
wish install.

After the freeze, I'll pkgsrc this script -- it's kind of cute.
2000-09-14 18:00:44 +00:00
hubertf b09f22f48f When downloading and extracting a file (in ftp:
'get pkg.tgz "| cd /var/tmp/inst ; gunzip | tar -x -f -"'), handle
two cases better:

1. Timing out ftp connections: Make sure the hanging pipeline gets a ^C
   (SIGINT), and wait until the ftp prompt is available again. Else we
   may nuke away tar's working dir, and it may be displeased.
2. One of the commands from the pipeline exiting: caught via SIGCHLD;
   for this signal to be delivered, a empty handler is needed)

Adresses PR 10925 by Greg A. Woods <woods@planix.com>
2000-09-01 04:42:57 +00:00
hubertf 80c46f750e * Code cleanup
* Add a comment in one appropriate place
 * Indent properly
2000-09-01 04:36:20 +00:00
hubertf c06c5a0348 Add some (commented out) debug flags 2000-09-01 04:34:03 +00:00
hubertf d332db18be Make pkg_add & friends print the files they push through tar(1) to
stderr, thus making them visible. (tar's stdout goes somewhere else)
2000-08-29 03:56:56 +00:00
hubertf 14dbdb5745 * Make a few functions public so this code can be used by other programs
* Comment a workaround for a certain lukem ftp behaviour
 * Fix a bug where a invalid initial dir was not caught early enough
2000-08-28 21:35:14 +00:00
hubertf 0186d67219 Hide "trying PKG_PATH ..." message, only print on -v 2000-08-28 15:39:35 +00:00
hubertf 8102826629 Keep *roff from eating things.
Noted in PR 10687 by NAKAJIMA Yoshihiro <nakayosh@kcn.ne.jp>
2000-07-26 15:18:09 +00:00
dmcmahill 43301f1fee Fix a buffer overrun bug. The TOOBIG macro had some hard coded constants
which needed to be set at compile time but weren't (to handle the case where
TAR_CMD was set to something other than "tar", eg "gtar".  In addition to
the constants being wrong, the wrong directory name was being examined for
its string length.

Add a few comments to hopefully avoid having this problem come back.
2000-07-24 20:09:15 +00:00
hubertf c0f021878e handle NULL pen variable more gracefully in find_play_pen() 2000-07-24 02:54:22 +00:00
hubertf 0379a1727a remove/hide some debugging code 2000-07-06 16:06:36 +00:00
hubertf 7ca7a7f658 Only calculate MD5 checksum for plain files.
As a side effect, fixes handlink of links to dirs.
2000-07-05 20:18:16 +00:00
hubertf 2b35b3d322 * Move comment around a bit
* Document some return code
2000-07-05 20:17:04 +00:00
msaitoh f6f00e2615 remove extra period in SEE ALL section 2000-07-05 15:45:28 +00:00
hubertf 65162fd077 be sure to set pkgdbp to NULL after closing the db. 2000-06-19 13:28:06 +00:00
hubertf f9aaf0a4e5 Allocate space & copy a string returned by a function that'll clobber it on
next call.
2000-06-19 00:55:11 +00:00
hubertf 74056630be remove stale debugging code 2000-06-18 01:31:23 +00:00
hubertf e5b91ee82e * shuffle variable names in findbestmatchingname_fn() around
a bit, to make them more descriptive
 * in findbestmatchingname_fn, fix a bug where a null pointer wasn't
   caught (I wonder why we didn't actually hit that case...)
 * Bugfix in findbestmatchingname_fn: when comparing, strip off any
   trailing ".tgz", as this will give wrong results. "1.9.8.tgz" was
   found to be greater than "1.9.8.1".
2000-06-18 01:29:30 +00:00
hubertf 7aed2e5cfb use /var/tmp consistently. (XXX need to re-visit if we ever
put pkg_add on a install floppy)
2000-06-18 01:29:17 +00:00
tron 1b5dabcf75 Update prototype for "extract_plist()". 2000-06-17 11:30:49 +00:00
sjg 7bd1e30c61 extract_plist() should inform caller when it aborts extract 2000-06-16 23:49:17 +00:00
sjg cc95d19ae1 avoid possible overflow of exit status 2000-06-16 23:48:23 +00:00
hubertf 2b57637552 ftp(1)'s "ls" now lists files/dirs plus attributes (much like "dir" did
before). Use "nlist" to still get filenames only.
Needed to expand wildcards.
2000-06-08 00:26:48 +00:00
hubertf 29efdd4919 save another call to allocate space on the stack for something that's
definitely going to end up there.
2000-06-07 03:17:10 +00:00
hubertf 6fa913c454 Don't use asprintf() which isn't available on NetBSD 1.3.2. 2000-06-07 02:10:28 +00:00
hubertf 0948b6f2cb pkg_delete -r was done by Chris Hopps (I used the same code do implement
pkg_delete -R on that later on).
2000-05-16 16:38:15 +00:00
hubertf 7f040da3cd Don't remove any INSTALL scripts. Just in case someone needs them later
(e.g. to tar up the pkg again, and install it elsewhere).
2000-05-16 15:59:16 +00:00
hubertf 5cb5e5143c Don't read +CONTENTS files if not needed. 2000-05-15 23:14:42 +00:00
hubertf 8b8a982165 When expanding wildcards given on the command line, don't include
files (from /var/db/pkg). Only directories can contain pkgs.

Fixed PR 10083 by Dan McMahill <mcmahill@mtl.mit.edu>
2000-05-11 14:13:13 +00:00
hubertf d06e2d8e2e Add "lsall" and "lsbest" commands to pkg_admin, to find all/best
package matching a certain pattern. Examples:

            yui# cd /usr/pkgsrc/packages/i386ELF/All/
            yui# ls unzip*
            unzip-5.40.tgz  unzip-5.41.tgz
            yui# pkg_admin lsall 'unzip*'
            unzip-5.40.tgz
            unzip-5.41.tgz
            yui# pkg_admin lsall 'unzip>=5.40'
            unzip-5.40.tgz
            unzip-5.41.tgz
            yui# pkg_admin lsall 'unzip>=5.41'
            unzip-5.41.tgz
            yui# pkg_admin lsbest 'unzip>=5.40'
            unzip-5.41.tgz
            yui# pkg_admin lsall /usr/pkgsrc/packages/i386ELF/All/'{mit,unproven}-pthread*'
            /usr/pkgsrc/packages/i386ELF/All/mit-pthreads-1.60b6.tgz

This adds a shell/user-interface to pkg-patterns, which are a superset
of sh/csh patterns and can't be expanded by any shell.
2000-05-08 22:48:42 +00:00
hubertf b471b566f8 In require_delete(), actually use the expanded wildcard passed in via
@pkgdep.

Fixes PR 10056 by Dan McMahill <mcmahill@mtl.mit.edu>
2000-05-07 00:33:28 +00:00
mycroft 411fdd599d Fix obvious typo in previous commit. This could not possibly compile. 2000-04-30 07:57:45 +00:00
hubertf c669928eeb Print appropriate warning if the directory of a @dirrm is not present
at all.

Pointed out & fix reviewed by Thomas Klausner.
2000-04-29 22:39:58 +00:00
hubertf d071991a9a Don't abort during quick depends pre-scan when -f is used 2000-04-01 23:31:39 +00:00
hubertf f996345ebf Improve the last change.
Handling all kinds of wildcards properly would be hard, though it should
handle some cases better now. Esp. ones with '-' in the pkg(!) name, and/or
ones with dewer relational versions. I.e. the teTeX-share>1.97 case should
work now.
2000-04-01 22:12:45 +00:00
augustss 93336646e4 Make this compile again. 2000-04-01 14:54:51 +00:00
hubertf 404096ac77 In the "quick depends pre-check" don't only try to replace anything
after a "-" with the "more liberal pattern", but also anything after
any pkg wildcard.

That way if someone has teTeX-share-1.0 installed and pkg_adds
teTeX-1.0.7 (which wants teTeX-share>1.0.2), it will be caught.

XXX This "quick depends pre-check" would be nice to be done in
    bsd.pkg.mk as well
2000-03-31 22:12:56 +00:00
hubertf 0c2cdb98d9 * in pkg_add, before the "install dependencies" loop, check ALL
dependencies if they _can_ be installed. I.e. if a package wants
   version X installed, but version Y is already installed, pkg_adding
   that required pkg will blow up later (probably some pkg_add recursions
   down, given what we keep in the depends list). Now, it stopps right
   away:

        noon# pkg_add /usr/pkgsrc/packages/i386ELF/All/xdaemon-1.0.tgz
        pkg_add: pkg `xteddy-1.*' required, but `xteddy-2.0.1' found installed.
        Please resolve this conflict!

   The idea of this is from Thomas Klausner, further inputs from Alistair
   Crooks.

 * allow pkg names without versions given to "pkg_admin check"
 * Use sizeof() instead of hardcoding the buffers' size in some places
2000-03-19 17:24:27 +00:00
soren 89c5a767f8 Fix doubled 'the's. 2000-03-13 22:55:05 +00:00
hubertf 495734ff62 - Bump timeout in select() to 10 minutes
- Make sure ftp_cmd() properly passes down an error value (-1) when
   appropriate.
2000-02-27 02:35:28 +00:00
hubertf 93b37b7f07 adjust copyright 2000-02-22 01:24:26 +00:00
abs ce9e985266 Special case 'nb<X>' suffix in deweycmp() - this allows NetBSD specific
changes to packages to have a unique version, and still work with deweycmp().
2000-02-07 11:26:26 +00:00
hubertf 422fde1de4 init buffer differently 2000-02-04 03:45:48 +00:00
hubertf b932078a68 remove clutter left after switching to mkstemp 2000-02-02 14:54:50 +00:00
hubertf 4b164aae49 Use mkstemp instead of mkstemp. 2000-02-02 14:42:53 +00:00
hubertf 45d0c80c1d add copyright and (more important!) _RCS_ID() 2000-02-02 14:09:40 +00:00
agc cf6ad33088 Set the environment variables to have zero-length strings on Solaris. 2000-02-01 10:46:55 +00:00
agc 2a29f83468 Fix a typo.
Make a start at linting this.
2000-01-31 13:39:08 +00:00
agc 69acf6de93 Fix for Solaris: don't try to call unsetenv(). 2000-01-31 13:33:19 +00:00
hubertf 938c6a8b17 be a bit more liberal WRT slow servers 2000-01-26 02:12:14 +00:00
hubertf 549295852e -current's gcc seems to be a bit picky about using pointer-differences as
args to the "*" of a printf "%*.*s" pattern. Add some casts to int.
(At least on NetBSD, ptrdiff_t is typedef'ed to int anyways)
2000-01-25 17:21:07 +00:00
hubertf 4a961a7fc3 some code cleanup 2000-01-25 12:09:19 +00:00
hubertf 9d0c5bb4ee FTP wildcard depends code, initial commit.
Modulo some code cleanup, this gives NetBSD full wildcard support not
only in pkgsrc, but esp. for binary packages installed from local disk
and via FTP. For more information, see:

	http://www.feyrer.de/NetBSD/wildcards.html
2000-01-19 23:28:28 +00:00
hubertf d46e75859c Reverse wording for -R. Per PR 9141 by Jim Bernard <jbernard@ox.mines.edu> 2000-01-17 00:48:52 +00:00
hubertf bbb733f849 mention -Ss in usage 2000-01-10 14:53:56 +00:00
hubertf be120f8f41 Also move the +SIZE files into place, if a pkg comes with some. 2000-01-09 17:21:53 +00:00
hubertf 873c34bf5e Some changes from David Maxwell <david@fundy.ca>:
- make it clear that a URL or full path can be given on the command line
 - explain where depending pkgs are expected to live
2000-01-04 22:39:28 +00:00
hubertf be1f1ece47 Set things to a sane state for db(3) routines. 1999-12-20 18:23:03 +00:00
hubertf 78254bd723 Put back former -s switch to pkg_create as -L now.
Fixes PR 8982 by Eric Schnoebelen <eric@cirr.com>
1999-12-20 03:25:57 +00:00
hubertf d11f27480e Not without my handbag. (Forgot this in last commit) 1999-12-01 15:15:29 +00:00
hubertf 402f80b9da - Comment code
- Minor re-indenting
 - Fix printing of @ignore in pkg_info (did this ever work?)
 - Fix installing of local wildcard dependencies (unused in main system)
 - Fix deleting of packages that depend on wildcard dependencies
   (fexist() is not enough there :-)
1999-12-01 14:51:50 +00:00
hubertf 28f1032831 Document the current round of the game. :-) 1999-12-01 05:08:34 +00:00
hubertf 2b494f847d Don't be verbose unnecessarily. (Instead, just remove this stale debug
code)
1999-12-01 05:08:10 +00:00
hubertf ecf89794f5 Put support for @src back in.
For users who use private packages that use it. (Hi Bill!)
1999-11-29 20:09:54 +00:00
hubertf 406791739c Add code to include the size of a package into both the
installed version and binary packages. The size can be queried then
via pkg_info:

        xfeyrer @ noon% pkg_info -s xv
        Information for xv-3.10apl1:

        Size of this package in bytes: 4670692


        xfeyrer @ noon% pkg_info -S xv
        Information for xv-3.10apl1:

        Size in bytes including required pkgs: 14610165

While doing work on the size code, support for the @src directive was
removed (formerly enabled with the pkg_create -s switch, but unused in
our pkg system).  The new pkg_info -s and -S switches were tested on
installed, local (file) and remote (ftp) packages.

In bsd.pkg.mk, take special care for pkg_* versions that do not have
the pkg_create -s and -S switches and do not record size information
there.
1999-11-29 19:48:44 +00:00
kristerw 2220c68654 Typos (from OpenBSD) 1999-11-18 19:02:31 +00:00
fredb 60fae50bc1 Don't preserve uids or permissions of checked out files (MTREE, DEINSTALL,
INSTALL) into package tarballs. Files installed by the package itself are
not affected.
1999-11-18 02:05:16 +00:00