pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files pkg_install-20201212: handl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2db6c52fb99d
branches:  trunk
changeset: 443401:2db6c52fb99d
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Fri Dec 11 15:55:35 2020 +0000

description:
pkg_install-20201212: handle error case better

When pkg_delete fails, report it and error out.

diffstat:

 pkgtools/pkg_install/files/add/perform.c |  21 ++++++++++++++-------
 pkgtools/pkg_install/files/lib/version.h |   4 ++--
 2 files changed, 16 insertions(+), 9 deletions(-)

diffs (70 lines):

diff -r fd337513d00a -r 2db6c52fb99d pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Fri Dec 11 15:12:56 2020 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Fri Dec 11 15:55:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.115 2020/12/11 10:06:53 jperkin Exp $    */
+/*     $NetBSD: perform.c,v 1.116 2020/12/11 15:55:35 wiz Exp $        */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.115 2020/12/11 10:06:53 jperkin Exp $");
+__RCSID("$NetBSD: perform.c,v 1.116 2020/12/11 15:55:35 wiz Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -1238,7 +1238,9 @@
 static int
 start_replacing(struct pkg_task *pkg)
 {
-       if (preserve_meta_data_file(pkg, REQUIRED_BY_FNAME))
+       int result = -1;
+
+        if (preserve_meta_data_file(pkg, REQUIRED_BY_FNAME))
                return -1;
 
        if (preserve_meta_data_file(pkg, PRESERVE_FNAME))
@@ -1254,14 +1256,19 @@
                        Destdir ? " -P ": "", Destdir ? Destdir : "",
                        pkg->other_version);
        }
-       if (!Fake)
-               fexec_skipempty(BINDIR "/pkg_delete", "-K", pkgdb_get_dir(),
+       if (!Fake) {
+               result = fexec_skipempty(BINDIR "/pkg_delete", "-K", pkgdb_get_dir(),
                    "-p", pkg->prefix,
                    Destdir ? "-P": "", Destdir ? Destdir : "",
                    pkg->other_version, NULL);
+               if (result != 0) {
+                       warnx("command failed: %s/pkg_delete -K %s -p %s %s%s%s",
+                             BINDIR, pkgdb_get_dir(), pkg->prefix, Destdir ? "-P" : " ",
+                             Destdir ? Destdir : "", pkg->other_version);
+               }
+       }
 
-       /* XXX Check return value and do what? */
-       return 0;
+       return result;
 }
 
 static int check_input(const char *line, size_t len)
diff -r fd337513d00a -r 2db6c52fb99d pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Fri Dec 11 15:12:56 2020 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Fri Dec 11 15:55:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.183 2020/12/11 10:06:53 jperkin Exp $    */
+/*     $NetBSD: version.h,v 1.184 2020/12/11 15:55:35 wiz Exp $        */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -27,6 +27,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION 20201211
+#define PKGTOOLS_VERSION 20201212
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index