summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-08-05 14:58:49 +0000
committerjoerg <joerg@pkgsrc.org>2007-08-05 14:58:49 +0000
commita40dec8f12a66413b3a880ae7e9882873ec9afd4 (patch)
treeed1b4d5057478d8b695171f6ebe825961bd82374 /pkgtools/pkg_install
parente2a9c6ca6371e2dc94ddff99861f20ae8e968812 (diff)
downloadpkgsrc-a40dec8f12a66413b3a880ae7e9882873ec9afd4.tar.gz
Correctly handle ordering NULL -- this greatly simplifies using it
in iteration functions. Fix a major thinko that prevented the actual order rules from being used. Bump to 20070804.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/lib/opattern.c19
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
2 files changed, 17 insertions, 6 deletions
diff --git a/pkgtools/pkg_install/files/lib/opattern.c b/pkgtools/pkg_install/files/lib/opattern.c
index bcbb46c5eb9..0fb8f2f584d 100644
--- a/pkgtools/pkg_install/files/lib/opattern.c
+++ b/pkgtools/pkg_install/files/lib/opattern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: opattern.c,v 1.1 2007/07/20 22:22:53 joerg Exp $ */
+/* $NetBSD: opattern.c,v 1.2 2007/08/05 14:58:49 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
#else
-__RCSID("$NetBSD: opattern.c,v 1.1 2007/07/20 22:22:53 joerg Exp $");
+__RCSID("$NetBSD: opattern.c,v 1.2 2007/08/05 14:58:49 joerg Exp $");
#endif
#endif
@@ -149,8 +149,19 @@ pkg_match(const char *pattern, const char *pkg)
int
pkg_order(const char *pattern, const char *first_pkg, const char *second_pkg)
{
- const char *first_version = strrchr(first_pkg, '/');
- const char *second_version = strrchr(second_pkg, '/');
+ const char *first_version;
+ const char *second_version;
+
+ if (first_pkg == NULL && second_pkg == NULL)
+ return 0;
+
+ if (first_pkg == NULL)
+ return pkg_match(pattern, second_pkg) ? 2 : 0;
+ if (second_pkg == NULL)
+ return pkg_match(pattern, first_pkg) ? 1 : 0;
+
+ first_version = strrchr(second_pkg, '-');
+ second_version = strrchr(first_pkg, '-');
if (first_version == NULL || !pkg_match(pattern, first_pkg))
return pkg_match(pattern, second_pkg) ? 2 : 0;
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index f6b0874fc81..90fdd02acfd 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.71 2007/08/03 13:16:00 joerg Exp $ */
+/* $NetBSD: version.h,v 1.72 2007/08/05 14:58:49 joerg Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@@ -33,6 +33,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
-#define PKGTOOLS_VERSION "20070802"
+#define PKGTOOLS_VERSION "20070804"
#endif /* _INST_LIB_VERSION_H_ */