diff options
author | pixdamix@gmail.com <pixdamix@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2012-11-22 04:17:30 (EST) |
---|---|---|
committer | pixdamix@gmail.com <pixdamix@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2012-11-22 04:17:30 (EST) |
commit | 6cd1da1daaefc240ed9267cc7f294758f74b9342 (patch) | |
tree | e844b394a8c581b1ed714566a730b8755c9794e2 /libopkg | |
parent | 319d02609992273e887242ed9788db68d3310b6c (diff) |
add opkg_compare_versions function
* not used in opkg but can be usefull, e.g. instead of
opkg-utils/opkg-compare-versions.c
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
git-svn-id: http://opkg.googlecode.com/svn/trunk@636 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r-- | libopkg/opkg.c | 14 | ||||
-rw-r--r-- | libopkg/opkg.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c index 92f61f4..8aa3268 100644 --- a/libopkg/opkg.c +++ b/libopkg/opkg.c @@ -870,3 +870,17 @@ opkg_repository_accessibility_check(void) return ret; } + +int +opkg_compare_versions (const char *ver1, const char *ver2) +{ + pkg_t *pkg1, *pkg2; + + pkg1 = pkg_new(); + pkg2 = pkg_new(); + + parse_version(pkg1, ver1); + parse_version(pkg2, ver2); + + return pkg_compare_versions(pkg1, pkg2); +} diff --git a/libopkg/opkg.h b/libopkg/opkg.h index 4fbd404..7aa86eb 100644 --- a/libopkg/opkg.h +++ b/libopkg/opkg.h @@ -58,4 +58,6 @@ pkg_t* opkg_find_package (const char *name, const char *version, const char *arc int opkg_repository_accessibility_check(void); +int opkg_compare_versions (const char *ver1, const char *ver2); + #endif /* OPKG_H */ |