diff options
author | joerg <joerg> | 2007-08-05 14:58:49 +0000 |
---|---|---|
committer | joerg <joerg> | 2007-08-05 14:58:49 +0000 |
commit | 3f177b60f0601d0d2d95f6b7ec9792e177298c20 (patch) | |
tree | ed1b4d5057478d8b695171f6ebe825961bd82374 | |
parent | 317b8b1ba24432319b25839a77fbfb9983dd0f25 (diff) | |
download | pkgsrc-3f177b60f0601d0d2d95f6b7ec9792e177298c20.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.
-rw-r--r-- | pkgtools/pkg_install/files/lib/opattern.c | 19 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
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_ */ |