Fri Feb 27 19:34:12 2009 UTC ()
When checking for explicit conflicts, skip the old version checkif no
old version exists (e.g. because this is not an update).
Reported by Thomas Klausner.


(joerg)
diff -r1.79 -r1.80 pkgsrc/pkgtools/pkg_install/files/add/perform.c

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

--- pkgsrc/pkgtools/pkg_install/files/add/perform.c 2009/02/26 12:52:43 1.79
+++ pkgsrc/pkgtools/pkg_install/files/add/perform.c 2009/02/27 19:34:12 1.80
@@ -1,22 +1,22 @@ @@ -1,22 +1,22 @@
1/* $NetBSD: perform.c,v 1.79 2009/02/26 12:52:43 joerg Exp $ */ 1/* $NetBSD: perform.c,v 1.80 2009/02/27 19:34:12 joerg 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.79 2009/02/26 12:52:43 joerg Exp $"); 9__RCSID("$NetBSD: perform.c,v 1.80 2009/02/27 19:34:12 joerg 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 * All rights reserved. 16 * All rights reserved.
17 * 17 *
18 * Redistribution and use in source and binary forms, with or without 18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions 19 * modification, are permitted provided that the following conditions
20 * are met: 20 * are met:
21 * 21 *
22 * 1. Redistributions of source code must retain the above copyright 22 * 1. Redistributions of source code must retain the above copyright
@@ -891,27 +891,27 @@ run_install_script(struct pkg_task *pkg, @@ -891,27 +891,27 @@ run_install_script(struct pkg_task *pkg,
891} 891}
892 892
893struct find_conflict_data { 893struct find_conflict_data {
894 const char *pkg; 894 const char *pkg;
895 const char *old_pkg; 895 const char *old_pkg;
896 const char *pattern; 896 const char *pattern;
897}; 897};
898 898
899static int 899static int
900check_explicit_conflict_iter(const char *cur_pkg, void *cookie) 900check_explicit_conflict_iter(const char *cur_pkg, void *cookie)
901{ 901{
902 struct find_conflict_data *data = cookie; 902 struct find_conflict_data *data = cookie;
903 903
904 if (strcmp(data->old_pkg, cur_pkg) == 0) 904 if (data->old_pkg && strcmp(data->old_pkg, cur_pkg) == 0)
905 return 0; 905 return 0;
906 906
907 warnx("Package `%s' conflicts with `%s', and `%s' is installed.", 907 warnx("Package `%s' conflicts with `%s', and `%s' is installed.",
908 data->pkg, data->pattern, cur_pkg); 908 data->pkg, data->pattern, cur_pkg);
909 909
910 return 1; 910 return 1;
911} 911}
912 912
913static int 913static int
914check_explicit_conflict(struct pkg_task *pkg) 914check_explicit_conflict(struct pkg_task *pkg)
915{ 915{
916 struct find_conflict_data data; 916 struct find_conflict_data data;
917 char *installed, *installed_pattern; 917 char *installed, *installed_pattern;