Date: Wed, 24 Aug 2005 13:07:12 +0800 (KRAST) From: Eugene Grosbein <eugen@grosbein.pp.ru> To: FreeBSD-gnats-submit@FreeBSD.org Cc: krion@FreeBSD.org, phk@FreeBSD.org Subject: bin/85261: [patch] nanobsd build breaks on pkg_add Message-ID: <200508240507.j7O57CcL005046@ws092.svzserv.kemerovo.su> Resent-Message-ID: <200508240610.j7O6ADWi065416@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 85261 >Category: bin >Synopsis: [patch] nanobsd build breaks on pkg_add >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Aug 24 06:10:13 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Eugene Grosbein >Release: FreeBSD 6.0-BETA2 i386 >Organization: Svyaz Service JSC >Environment: System: FreeBSD ws092.svzserv.kemerovo.su 6.0-BETA2 FreeBSD 6.0-BETA2 #0: Tue Aug 23 16:37:04 KRAST 2005 root@ws092.svzserv.kemerovo.su:/usr/obj/usr/src/sys/TEST i386 >Description: Nanobsd may be customized to include a set of packages. Packages should be placed in Pkg/ and nanobsd runs 'pkg_add -v *' there. Assume there are two packages A and B and A depends on B. pkg_add adds A (and B as dependency) then it tries to add B and fails (B is already installed), so nanobsd fails to complete an image. >How-To-Repeat: Try to build nanobsd with gettext-0.14.5.tbz and libiconv-1.9.2_1.tbz. pkg_add will try to install libiconv twice and fail. >Fix: Introduce new command line switch -F for pkg_add to consider described case as nonfatal error and use 'pkg_add -vF' instead of 'pkg_add -v' in src/tools/tools/nanobsd/Customize/pkgs The following patch introduces -F. It is made for RELENG_6's src/usr.sbin/pkg_install/add Index: add.h =================================================================== RCS file: /home/ncvs/src/usr.sbin/pkg_install/add/add.h,v retrieving revision 1.11 diff -u -r1.11 add.h --- add.h 29 Jun 2004 19:06:41 -0000 1.11 +++ add.h 24 Aug 2005 02:59:22 -0000 @@ -28,6 +28,7 @@ extern char *Prefix; extern Boolean NoInstall; extern Boolean NoRecord; +extern Boolean FailOnAlreadyInstalled; extern char *Mode; extern char *Owner; extern char *Group; Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/pkg_install/add/main.c,v retrieving revision 1.61.2.1 diff -u -r1.61.2.1 main.c --- main.c 11 Jul 2005 16:14:21 -0000 1.61.2.1 +++ main.c 24 Aug 2005 02:59:38 -0000 @@ -27,13 +27,14 @@ #include "lib.h" #include "add.h" -static char Options[] = "hvIRfnrp:SMt:C:"; +static char Options[] = "hvIRfFnrp:SMt:C:"; char *Prefix = NULL; char *Chroot = NULL; Boolean NoInstall = FALSE; Boolean NoRecord = FALSE; Boolean Remote = FALSE; +Boolean FailOnAlreadyInstalled = TRUE; char *Mode = NULL; char *Owner = NULL; @@ -120,6 +121,10 @@ case 'f': Force = TRUE; + break; + + case 'F': + FailOnAlreadyInstalled = FALSE; break; case 'n': Index: perform.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/pkg_install/add/perform.c,v retrieving revision 1.77 diff -u -r1.77 perform.c --- perform.c 28 Jul 2004 16:03:13 -0000 1.77 +++ perform.c 24 Aug 2005 02:59:01 -0000 @@ -245,9 +245,12 @@ */ if ((isinstalledpkg(Plist.name) > 0 || matchbyorigin(Plist.origin, NULL) != NULL) && !Force) { - warnx("package '%s' or its older version already installed", - Plist.name); - code = 1; + warnx("package '%s' or its older version already installed%s", + Plist.name, FailOnAlreadyInstalled ? "" : " (ignored)"); + if(FailOnAlreadyInstalled) + code = 1; + else + code = 0; goto success; /* close enough for government work */ } Index: pkg_add.1 =================================================================== RCS file: /home/ncvs/src/usr.sbin/pkg_install/add/pkg_add.1,v retrieving revision 1.66 diff -u -r1.66 pkg_add.1 --- pkg_add.1 13 Feb 2005 22:25:30 -0000 1.66 +++ pkg_add.1 24 Aug 2005 03:50:55 -0000 @@ -23,7 +23,7 @@ .Nd a utility for installing software package distributions .Sh SYNOPSIS .Nm -.Op Fl vInfrRMS +.Op Fl vInfFrRMS .Op Fl t Ar template .Op Fl p Ar prefix .Op Fl C Ar chrootdir @@ -104,6 +104,11 @@ .Nm will still try to find and auto-install missing prerequisite packages, a failure to find one will not be fatal. +.It Fl F +Do not regard installation of already installed package as fatal error. +This option allows +.Cm pkg_add +to complete without error when a package is already installed. .It Fl p Ar prefix Set .Ar prefix Eugene Grosbein >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508240507.j7O57CcL005046>