diff options
author | Michael Schroeder <mls@suse.de> | 2013-04-16 11:59:27 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2013-04-16 12:01:33 +0200 |
commit | 05174125a0a2744725c7be881a3790cb69843af5 (patch) | |
tree | 49c31bf04b0fa590296f21aec21fd12ddc22d3d1 | |
parent | 5215d2d872b0e4c201e4eafe6af204b442f3fecc (diff) | |
download | libsolv-05174125a0a2744725c7be881a3790cb69843af5.tar.gz libsolv-05174125a0a2744725c7be881a3790cb69843af5.tar.bz2 libsolv-05174125a0a2744725c7be881a3790cb69843af5.zip |
add DISTTYPE_HAIKU, some small fixes
- ARCH_NOARCH -> ARCH_ANY
- use - as prerelease separator
- correct usage of solv_vercmp
- stringify REL_COMPAT, use != instead of <>
-rw-r--r-- | CREDITS | 3 | ||||
-rw-r--r-- | ext/repo_haiku.cpp | 8 | ||||
-rw-r--r-- | src/evr.c | 14 | ||||
-rw-r--r-- | src/libsolv.ver | 1 | ||||
-rw-r--r-- | src/pool.c | 40 | ||||
-rw-r--r-- | src/pool.h | 1 | ||||
-rw-r--r-- | src/poolid.c | 15 |
7 files changed, 58 insertions, 24 deletions
@@ -20,3 +20,6 @@ Michael Schroeder - mandriva/mageia support - archlinux support +Ingo Weinhold + - haiku support + diff --git a/ext/repo_haiku.cpp b/ext/repo_haiku.cpp index 139bf50..e5b448f 100644 --- a/ext/repo_haiku.cpp +++ b/ext/repo_haiku.cpp @@ -32,10 +32,9 @@ static BString haiku_version_to_string(const BPackageVersion &version) string << '.' << version.Micro(); } - // append pre-release -- separate it with '/' to keep pool_evrcmp_str() happy - // (it expects only the release to be separated by '-') + // append pre-release if (!version.PreRelease().IsEmpty()) - string << '/' << version.PreRelease(); + string << '-' << version.PreRelease(); // append revision if (version.Revision() != 0) @@ -59,7 +58,6 @@ static void add_dependency(Repo *repo, Offset &dependencies, const char *name, { versionId = pool_rel2id(pool, pool_str2id(pool, compatVersion, 1), versionId, REL_COMPAT, 1); - versionId = MAKERELDEP(versionId); } dependency = pool_rel2id(pool, dependency, versionId, flags, 1); @@ -152,7 +150,7 @@ static Id add_package_info_to_repo(Repo *repo, Repodata *repoData, name << packageInfo.Name(); solvable->name = pool_str2id(pool, name, 1); if (packageInfo.Architecture() == B_PACKAGE_ARCHITECTURE_ANY) - solvable->arch = ARCH_NOARCH; + solvable->arch = ARCH_ANY; else solvable->arch = pool_str2id(pool, BPackageInfo::kArchitectureNames[packageInfo.Architecture()], 1); @@ -198,7 +198,7 @@ solv_vercmp_rpm_notilde(const char *s1, const char *q1, const char *s2, const ch #endif -#if defined(HAIKU) +#if defined(HAIKU) || defined(MULTI_SEMANTICS) static int solv_cmp_version_part_haiku(const char *s1, const char *q1, const char *s2, @@ -268,9 +268,9 @@ solv_vercmp_haiku(const char *s1, const char *q1, const char *s2, const char *q2 int cmp; /* find pre-release separator */ - while (pre1 != q1 && *pre1 != '/') + while (pre1 != q1 && *pre1 != '-') pre1++; - while (pre2 != q2 && *pre2 != '/') + while (pre2 != q2 && *pre2 != '-') pre2++; /* compare main versions */ @@ -285,8 +285,6 @@ solv_vercmp_haiku(const char *s1, const char *q1, const char *s2, const char *q2 return -1; return solv_cmp_version_part_haiku(pre1 + 1, q1, pre2 + 1, q2); - cmp = solv_cmp_version_part_haiku(pre1 + 1, q1, pre2 + 1, q2); - return cmp == 0 ? 0 : cmp < 0 ? -1 : 1; /* must return -1, 0, or 1 */ } #endif /* HAIKU */ @@ -310,11 +308,15 @@ solv_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) } #if defined(MULTI_SEMANTICS) -# define solv_vercmp (*(pool->disttype == DISTTYPE_DEB ? &solv_vercmp_deb : &solv_ver##cmp_rpm)) +# define solv_vercmp (*(pool->disttype == DISTTYPE_DEB ? &solv_vercmp_deb : \ + pool->disttype == DISTTYPE_HAIKU ? solv_vercmp_haiku : \ + &solv_ver##cmp_rpm)) #elif defined(DEBIAN) # define solv_vercmp solv_vercmp_deb #elif defined(ARCHLINUX) # define solv_vercmp solv_vercmp_rpm_notilde +#elif defined(HAIKU) +# define solv_vercmp solv_vercmp_haiku #else # define solv_vercmp solv_vercmp_rpm #endif diff --git a/src/libsolv.ver b/src/libsolv.ver index 3a7bda3..a0115df 100644 --- a/src/libsolv.ver +++ b/src/libsolv.ver @@ -259,6 +259,7 @@ SOLV_1.0 { solv_timems; solv_vercmp; solv_vercmp_deb; + solv_vercmp_haiku; solv_vercmp_rpm; solv_vercmp_rpm_notilde; solv_version; @@ -62,6 +62,10 @@ pool_create(void) #elif defined(ARCHLINUX) pool->disttype = DISTTYPE_ARCH; pool->noarchid = ARCH_ANY; +#elif defined(HAIKU) + pool->disttype = DISTTYPE_HAIKU; + pool->noarchid = ARCH_ANY; + pool->obsoleteusesprovides = 1; #else pool->disttype = DISTTYPE_RPM; pool->noarchid = ARCH_NOARCH; @@ -142,6 +146,8 @@ pool_setdisttype(Pool *pool, int disttype) pool->noarchid = ARCH_ALL; if (disttype == DISTTYPE_ARCH) pool->noarchid = ARCH_ANY; + if (disttype == DISTTYPE_HAIKU) + pool->noarchid = ARCH_ANY; pool->solvables[SYSTEMSOLVABLE].arch = pool->noarchid; } #endif @@ -599,6 +605,11 @@ pool_match_nevr_rel(Pool *pool, Solvable *s, Id d) return 0; } +#if defined(HAIKU) || defined(MULTI_SEMANTICS) +/* forward declaration */ +static int pool_match_flags_evr_rel_compat(Pool *pool, Reldep *range, int flags, int evr); +#endif + /* match (flags, evr) against provider (pflags, pevr) */ static inline int pool_match_flags_evr(Pool *pool, int pflags, Id pevr, int flags, int evr) @@ -611,19 +622,14 @@ pool_match_flags_evr(Pool *pool, int pflags, Id pevr, int flags, int evr) return 1; /* both rels show in the same direction */ if (pevr == evr) return (flags & pflags & REL_EQ) ? 1 : 0; +#if defined(HAIKU) || defined(MULTI_SEMANTICS) if (ISRELDEP(pevr)) { - Reldep *range = GETRELDEP(pool, pevr); - if (range->flags != REL_COMPAT) - return 0; /* unsupported */ - /* range->name is the backwards compatibility version, range->evr the - actual version. If flags are '>=' or '>', we match the compatibility - version as well, otherwise only the actual version. */ - if (!(flags & REL_GT) || (flags & REL_LT)) - return pool_match_flags_evr(pool, REL_EQ, range->evr, flags, evr); - return pool_match_flags_evr(pool, REL_LT | REL_EQ, range->evr, flags, evr) && - pool_match_flags_evr(pool, REL_GT | REL_EQ, range->name, REL_EQ, evr); + Reldep *rd = GETRELDEP(pool, pevr); + if (rd->flags == REL_COMPAT) + return pool_match_flags_evr_rel_compat(pool, rd, flags, evr); } +#endif switch (pool_evrcmp(pool, pevr, evr, EVRCMP_DEPCMP)) { case -2: @@ -642,6 +648,20 @@ pool_match_flags_evr(Pool *pool, int pflags, Id pevr, int flags, int evr) return 0; } +#if defined(HAIKU) || defined(MULTI_SEMANTICS) +static int +pool_match_flags_evr_rel_compat(Pool *pool, Reldep *range, int flags, int evr) +{ + /* range->name is the backwards compatibility version, range->evr the + actual version. If flags are '>=' or '>', we match the compatibility + version as well, otherwise only the actual version. */ + if (!(flags & REL_GT) || (flags & REL_LT)) + return pool_match_flags_evr(pool, REL_EQ, range->evr, flags, evr); + return pool_match_flags_evr(pool, REL_LT | REL_EQ, range->evr, flags, evr) && + pool_match_flags_evr(pool, REL_GT | REL_EQ, range->name, REL_EQ, evr); +} +#endif + /* match two dependencies (d1 = provider) */ int @@ -155,6 +155,7 @@ struct _Pool { #define DISTTYPE_RPM 0 #define DISTTYPE_DEB 1 #define DISTTYPE_ARCH 2 +#define DISTTYPE_HAIKU 3 #define SOLV_FATAL (1<<0) #define SOLV_ERROR (1<<1) diff --git a/src/poolid.c b/src/poolid.c index 6dc2c1b..bd24e35 100644 --- a/src/poolid.c +++ b/src/poolid.c @@ -154,17 +154,24 @@ pool_id2rel(const Pool *pool, Id id) switch (rd->flags) { case 0: case 2: case 3: - case 5: case 6: case 7: - return rels[rd->flags]; + case 6: case 7: #if !defined(DEBIAN) && !defined(MULTI_SEMANTICS) case 1: case 4: +#endif +#if !defined(HAIKU) && !defined(MULTI_SEMANTICS) + case 5: +#endif return rels[rd->flags]; -#else +#if defined(DEBIAN) || defined(MULTI_SEMANTICS) case 1: return pool->disttype == DISTTYPE_DEB ? " >> " : rels[rd->flags]; case 4: return pool->disttype == DISTTYPE_DEB ? " << " : rels[rd->flags]; #endif +#if defined(HAIKU) || defined(MULTI_SEMANTICS) + case 5: + return pool->disttype == DISTTYPE_HAIKU ? " != " : rels[rd->flags]; +#endif case REL_AND: return " & "; case REL_OR: @@ -179,6 +186,8 @@ pool_id2rel(const Pool *pool, Id id) return " FILECONFLICT "; case REL_COND: return " IF "; + case REL_COMPAT: + return " compat >= "; default: break; } |