Mon Sep 2 10:28:44 2013 UTC ()
pkg_install-20130902: Fix 'pkg_add -f'.

Remove incorrect return value when in force mode, which was causing pkg_add
to exit with failure even though the operation completed successfully.  This
also fixes the case where 'pkg_add -uf' would leave an update in an
inconsistent state.


(jperkin)
diff -r1.197 -r1.198 pkgsrc/pkgtools/pkg_install/Makefile
diff -r1.104 -r1.105 pkgsrc/pkgtools/pkg_install/files/add/perform.c
diff -r1.165 -r1.166 pkgsrc/pkgtools/pkg_install/files/lib/version.h

cvs diff -r1.197 -r1.198 pkgsrc/pkgtools/pkg_install/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg_install/Makefile 2013/06/05 18:20:55 1.197
+++ pkgsrc/pkgtools/pkg_install/Makefile 2013/09/02 10:28:44 1.198
@@ -1,23 +1,22 @@ @@ -1,23 +1,22 @@
1# $NetBSD: Makefile,v 1.197 2013/06/05 18:20:55 riastradh Exp $ 1# $NetBSD: Makefile,v 1.198 2013/09/02 10:28:44 jperkin Exp $
2 2
3# Notes to package maintainers: 3# Notes to package maintainers:
4# 4#
5# Updating this package does not automatically necessitate bumping 5# Updating this package does not automatically necessitate bumping
6# PKGTOOLS_REQD in bsd.pkg.mk. Do so if and only if there is a critical 6# PKGTOOLS_REQD in bsd.pkg.mk. Do so if and only if there is a critical
7# change in the pkg_* tools that pkgsrc relies on for proper operation. 7# change in the pkg_* tools that pkgsrc relies on for proper operation.
8 8
9DISTNAME= pkg_install-${VERSION} 9DISTNAME= pkg_install-${VERSION}
10PKGREVISION= 1 
11CATEGORIES= pkgtools 10CATEGORIES= pkgtools
12MASTER_SITES= # empty 11MASTER_SITES= # empty
13DISTFILES= # empty 12DISTFILES= # empty
14 13
15MAINTAINER= agc@NetBSD.org 14MAINTAINER= agc@NetBSD.org
16HOMEPAGE= http://www.pkgsrc.org/ 15HOMEPAGE= http://www.pkgsrc.org/
17COMMENT= Package management and administration tools for pkgsrc 16COMMENT= Package management and administration tools for pkgsrc
18LICENSE= modified-bsd 17LICENSE= modified-bsd
19 18
20BOOTSTRAP_PKG= yes 19BOOTSTRAP_PKG= yes
21SKIP_LICENSE_CHECK= yes 20SKIP_LICENSE_CHECK= yes
22 21
23CONFLICTS+= audit-packages-[0-9]* 22CONFLICTS+= audit-packages-[0-9]*

cvs diff -r1.104 -r1.105 pkgsrc/pkgtools/pkg_install/files/add/perform.c (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg_install/files/add/perform.c 2013/08/21 11:46:02 1.104
+++ pkgsrc/pkgtools/pkg_install/files/add/perform.c 2013/09/02 10:28:44 1.105
@@ -1,22 +1,22 @@ @@ -1,22 +1,22 @@
1/* $NetBSD: perform.c,v 1.104 2013/08/21 11:46:02 jperkin Exp $ */ 1/* $NetBSD: perform.c,v 1.105 2013/09/02 10:28:44 jperkin Exp $ */
2#if HAVE_CONFIG_H 2#if HAVE_CONFIG_H
3#include "config.h" 3#include "config.h"
4#endif 4#endif
5#include <nbcompat.h> 5#include <nbcompat.h>
6#if HAVE_SYS_CDEFS_H 6#if HAVE_SYS_CDEFS_H
7#include <sys/cdefs.h> 7#include <sys/cdefs.h>
8#endif 8#endif
9__RCSID("$NetBSD: perform.c,v 1.104 2013/08/21 11:46:02 jperkin Exp $"); 9__RCSID("$NetBSD: perform.c,v 1.105 2013/09/02 10:28:44 jperkin Exp $");
10 10
11/*- 11/*-
12 * Copyright (c) 2003 Grant Beattie <grant@NetBSD.org> 12 * Copyright (c) 2003 Grant Beattie <grant@NetBSD.org>
13 * Copyright (c) 2005 Dieter Baron <dillo@NetBSD.org> 13 * Copyright (c) 2005 Dieter Baron <dillo@NetBSD.org>
14 * Copyright (c) 2007 Roland Illig <rillig@NetBSD.org> 14 * Copyright (c) 2007 Roland Illig <rillig@NetBSD.org>
15 * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org> 15 * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org>
16 * Copyright (c) 2010 Thomas Klausner <wiz@NetBSD.org> 16 * Copyright (c) 2010 Thomas Klausner <wiz@NetBSD.org>
17 * All rights reserved. 17 * All rights reserved.
18 * 18 *
19 * Redistribution and use in source and binary forms, with or without 19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions 20 * modification, are permitted provided that the following conditions
21 * are met: 21 * are met:
22 * 22 *
@@ -403,29 +403,26 @@ check_already_installed(struct pkg_task  @@ -403,29 +403,26 @@ check_already_installed(struct pkg_task
403 struct stat sb; 403 struct stat sb;
404 404
405 pkg->install_logdir_real = pkg->install_logdir; 405 pkg->install_logdir_real = pkg->install_logdir;
406 pkg->install_logdir = xasprintf("%s.xxxxxx", pkg->install_logdir); 406 pkg->install_logdir = xasprintf("%s.xxxxxx", pkg->install_logdir);
407 if (stat(pkg->install_logdir, &sb) == 0) { 407 if (stat(pkg->install_logdir, &sb) == 0) {
408 warnx("package `%s' already has a temporary update " 408 warnx("package `%s' already has a temporary update "
409 "directory `%s', remove it manually", 409 "directory `%s', remove it manually",
410 pkg->pkgname, pkg->install_logdir); 410 pkg->pkgname, pkg->install_logdir);
411 return -1; 411 return -1;
412 } 412 }
413 return 1; 413 return 1;
414 } 414 }
415 415
416 if (Force) 
417 return 1; 
418 
419 /* We can only arrive here for explicitly requested packages. */ 416 /* We can only arrive here for explicitly requested packages. */
420 if (!Automatic && is_automatic_installed(pkg->pkgname)) { 417 if (!Automatic && is_automatic_installed(pkg->pkgname)) {
421 if (Fake || 418 if (Fake ||
422 mark_as_automatic_installed(pkg->pkgname, 0) == 0) 419 mark_as_automatic_installed(pkg->pkgname, 0) == 0)
423 warnx("package `%s' was already installed as " 420 warnx("package `%s' was already installed as "
424 "dependency, now marked as installed " 421 "dependency, now marked as installed "
425 "manually", pkg->pkgname); 422 "manually", pkg->pkgname);
426 } else { 423 } else {
427 warnx("package `%s' already recorded as installed", 424 warnx("package `%s' already recorded as installed",
428 pkg->pkgname); 425 pkg->pkgname);
429 } 426 }
430 return 0; 427 return 0;
431 428

cvs diff -r1.165 -r1.166 pkgsrc/pkgtools/pkg_install/files/lib/version.h (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg_install/files/lib/version.h 2013/01/31 10:25:30 1.165
+++ pkgsrc/pkgtools/pkg_install/files/lib/version.h 2013/09/02 10:28:44 1.166
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: version.h,v 1.165 2013/01/31 10:25:30 wiz Exp $ */ 1/* $NetBSD: version.h,v 1.166 2013/09/02 10:28:44 jperkin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Thomas Klausner. All rights reserved. 4 * Copyright (c) 2001 Thomas Klausner. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -17,16 +17,16 @@ @@ -17,16 +17,16 @@
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27#ifndef _INST_LIB_VERSION_H_ 27#ifndef _INST_LIB_VERSION_H_
28#define _INST_LIB_VERSION_H_ 28#define _INST_LIB_VERSION_H_
29 29
30#define PKGTOOLS_VERSION 20130131 30#define PKGTOOLS_VERSION 20130902
31 31
32#endif /* _INST_LIB_VERSION_H_ */ 32#endif /* _INST_LIB_VERSION_H_ */