Subject: Re: adding upgrade to pkg_add
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Jeremy C. Reed <firstname.lastname@example.org>
Date: 04/11/2003 11:22:29
On Thu, 10 Apr 2003, Hubert Feyrer wrote:
> I have no problem with renaming pkg_add's -u switch to -r (makes sense,
Okay, I have done this. See my new man page parts:
-r Replace currently installed package with a newer version. This
uses pkg_delete(1) to remove the old package. See below for a
more detailed description of the process. Use the -u flag to up-
grade without deleting files first.
-u Upgrade a package to a newer version without deleting the cur-
rently installed files first. This upgrade option overwrites
files. See below for a more detailed description of the process.
Use the -r flag instead to replace a package by cleanly deleting
the files first.
of it is already recorded as installed. If it is, installa-
tion is terminated if the -r or -u option is not given.
If the -r option or the -u option is given, it's assumed the
package should be replaced or upgraded instead. Before doing
so, all packages that depend on the pkg being upgraded are
checked if they also work with the new version. If that test
is successful, the upgrade is prepared by moving an existing
+REQUIRED_BY file aside (if it exists). When the -u option is
not used, then the installed package is removed with
pkg_delete(1). Installation then proceeds as if the package
was not installed. The upgrade option overwrites files. Al-
so, the upgrade option will delete any files from the previous
package that no longer exist in the newly-installed version.
Then, the +REQUIRED_BY file is restored.
(Also, I have other changes to the manpage, but I have questions below.)
On Thu, 10 Apr 2003, Greg A. Woods wrote:
> You should only ever be upgrading critical packages while the system is
> in single user mode! That should go without saying.
Nevertheless, I have updated libc and other essential sh utilities well
over a hundred times on several different BSD and Linux systems while the
systems are actively being used.
I send-pr'd a diff for all this: pkg/21095.
But I do have some man page fixes for that still.
Also, I skip the PRE-INSTALL and POST-INSTALL for the (overwrite) upgrade.
Now, I think that it is okay if it does do the PRE-INSTALL and
POST-INSTALL -- even if package is already installed. Any comments? And
examples where it might be a problem?
The upgrade removes current files from pkgdb. Then after install it looks
at old +CONTENTS and makes sure that any of its files no longer in pkgdb
(Also, my diff fixes a bug in the pkgdb remove function as mentioned in
It works to upgrade and downgrade.
Here is an example of using -u:
Requested space: 782236 bytes, free space: 675176448 bytes in
increasing RLIMIT_NOFILE to max. 1024 open files
Replacing file-3.39 with file-3.41.
Upgrading by overwriting 'file-3.39' with 'file-3.41'.
Removing file /usr/bin/file from pkgdb
Removing file /usr/man/man1/file.1 from pkgdb
Removing file /usr/man/man4/magic.4 from pkgdb
Removing file /usr/share/magic from pkgdb
Removing file /usr/share/magic.mgc from pkgdb
Removing file /usr/share/magic.mime from pkgdb
Removing file /usr/share/magic.mime.mgc from pkgdb
Removed previous package entries from pkgdb.
extract: Package name is file-3.41
extract: CWD to /usr
extract: CWD to .
Running mtree for file-3.41.
/usr/sbin/mtree -U -f +MTREE_DIRS -d -e -p /usr
Attempting to record package into /var/db/pkg/file-3.41.
Package file-3.41 registered in /var/db/pkg/file-3.41
Comparing previous CONTENTS: /var/db/pkg/file-3.39/+CONTENTS
/usr/man/man4/magic.4 is not in pkgdb; deleting.
/usr/share/magic is not in pkgdb; deleting.
/usr/share/magic.mgc is not in pkgdb; deleting.
/usr/share/magic.mime is not in pkgdb; deleting.
/usr/share/magic.mime.mgc is not in pkgdb; deleting.
Removing old package data: /var/db/pkg/file-3.39
Jeremy C. Reed