diff --git a/src/solver.c b/src/solver.c index 2c507cb..8f9e724 100644 --- a/src/solver.c +++ b/src/solver.c @@ -897,6 +897,12 @@ static int free_package(apk_hash_item item, void *ctx) return 0; } +static int cmp_pkgname(const void *p1, const void *p2) +{ + const struct apk_dependency *d1 = p1, *d2 = p2; + return strcmp(d1->name->name, d2->name->name); +} + int apk_solver_solve(struct apk_database *db, unsigned short solver_flags, struct apk_dependency_array *world, @@ -907,6 +913,8 @@ int apk_solver_solve(struct apk_database *db, struct apk_solver_state ss_data, *ss = &ss_data; struct apk_dependency *d; + qsort(world->item, world->num, sizeof(world->item[0]), cmp_pkgname); + restart: memset(ss, 0, sizeof(*ss)); ss->db = db; diff --git a/test/installif1.test b/test/installif1.test index ca3aeeb..117e397 100644 --- a/test/installif1.test +++ b/test/installif1.test @@ -2,8 +2,8 @@ --test-repo installif1.repo add foo app @EXPECT -(1/4) Installing foo (1) -(2/4) Installing lib (1) -(3/4) Installing app (1) +(1/4) Installing lib (1) +(2/4) Installing app (1) +(3/4) Installing foo (1) (4/4) Installing appiif1 (1) OK: 0 MiB in 0 packages diff --git a/test/installif2.test b/test/installif2.test index 85f66dc..c5c10e9 100644 --- a/test/installif2.test +++ b/test/installif2.test @@ -2,10 +2,10 @@ --test-repo installif1.repo add foo app bar @EXPECT -(1/6) Installing foo (1) -(2/6) Installing lib (1) -(3/6) Installing app (1) -(4/6) Installing appiif1 (1) -(5/6) Installing bar (1) -(6/6) Installing appiif2 (1) +(1/6) Installing lib (1) +(2/6) Installing app (1) +(3/6) Installing bar (1) +(4/6) Installing appiif2 (1) +(5/6) Installing foo (1) +(6/6) Installing appiif1 (1) OK: 0 MiB in 0 packages diff --git a/test/installif3.test b/test/installif3.test index f5ac259..1141577 100644 --- a/test/installif3.test +++ b/test/installif3.test @@ -3,8 +3,8 @@ --test-repo installif2.repo add foo app @EXPECT -(1/4) Installing foo (1) -(2/4) Installing lib (1) -(3/4) Installing app (1) +(1/4) Installing lib (1) +(2/4) Installing app (1) +(3/4) Installing foo (1) (4/4) Installing appiif1 (1) OK: 0 MiB in 0 packages diff --git a/test/provides4.test b/test/provides4.test index 6588926..e118ade 100644 --- a/test/provides4.test +++ b/test/provides4.test @@ -2,6 +2,6 @@ --test-repo provides.repo add mymailreader mailreadplus @EXPECT -(1/2) Installing mymailreader (1) -(2/2) Installing mailreadplus (1) +(1/2) Installing mailreadplus (1) +(2/2) Installing mymailreader (1) OK: 0 MiB in 0 packages