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/lib Correctly handle orderi...
details: https://anonhg.NetBSD.org/pkgsrc/rev/58e46d0db23a
branches: trunk
changeset: 531725:58e46d0db23a
user: joerg <joerg%pkgsrc.org@localhost>
date: Sun Aug 05 14:58:49 2007 +0000
description:
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:
pkgtools/pkg_install/files/lib/opattern.c | 19 +++++++++++++++----
pkgtools/pkg_install/files/lib/version.h | 4 ++--
2 files changed, 17 insertions(+), 6 deletions(-)
diffs (57 lines):
diff -r 76dd3e3f664c -r 58e46d0db23a pkgtools/pkg_install/files/lib/opattern.c
--- a/pkgtools/pkg_install/files/lib/opattern.c Sun Aug 05 14:15:55 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/opattern.c Sun Aug 05 14:58:49 2007 +0000
@@ -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 @@
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 -r 76dd3e3f664c -r 58e46d0db23a pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h Sun Aug 05 14:15:55 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h Sun Aug 05 14:58:49 2007 +0000
@@ -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_ */
Home |
Main Index |
Thread Index |
Old Index