summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2013-04-16 11:59:27 +0200
committerMichael Schroeder <mls@suse.de>2013-04-16 12:01:33 +0200
commit05174125a0a2744725c7be881a3790cb69843af5 (patch)
tree49c31bf04b0fa590296f21aec21fd12ddc22d3d1
parent5215d2d872b0e4c201e4eafe6af204b442f3fecc (diff)
downloadlibsolv-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--CREDITS3
-rw-r--r--ext/repo_haiku.cpp8
-rw-r--r--src/evr.c14
-rw-r--r--src/libsolv.ver1
-rw-r--r--src/pool.c40
-rw-r--r--src/pool.h1
-rw-r--r--src/poolid.c15
7 files changed, 58 insertions, 24 deletions
diff --git a/CREDITS b/CREDITS
index 21bad10..049bcae 100644
--- a/CREDITS
+++ b/CREDITS
@@ -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);
diff --git a/src/evr.c b/src/evr.c
index d24b839..30dacfb 100644
--- a/src/evr.c
+++ b/src/evr.c
@@ -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;
diff --git a/src/pool.c b/src/pool.c
index f5dfc40..9eddb2b 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -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
diff --git a/src/pool.h b/src/pool.h
index b40c88d..6545b49 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -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;
}