Author: mlschroe Date: Fri Oct 26 22:42:46 2007 New Revision: 7670 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7670&view=rev Log: - move dep2str buffer into pool so that the memory gets released - directly install translation solvables - some minor code cleanups Modified: trunk/sat-solver/package/libsatsolver.spec.in trunk/sat-solver/src/pool.c trunk/sat-solver/src/pool.h trunk/sat-solver/src/poolid.c trunk/sat-solver/src/solver.c trunk/sat-solver/testsuite/deptestomatic.c trunk/sat-solver/testsuite/gimmick.c Modified: trunk/sat-solver/package/libsatsolver.spec.in URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/package/libsatsolver.spec.in?rev=7670&r1=7669&r2=7670&view=diff ============================================================================== --- trunk/sat-solver/package/libsatsolver.spec.in (original) +++ trunk/sat-solver/package/libsatsolver.spec.in Fri Oct 26 22:42:46 2007 @@ -50,14 +50,14 @@ make install DESTDIR=$RPM_BUILD_ROOT #rm -f %{buildroot}%{_libdir}/libsatsolver.la -%post -p /sbin/ldconfig -%postun -p /sbin/ldconfig +#%post -p /sbin/ldconfig +#%postun -p /sbin/ldconfig %clean rm -rf "$RPM_BUILD_ROOT" -%files -%defattr(-,root,root) +#%files +#%defattr(-,root,root) %files devel %defattr(-,root,root) Modified: trunk/sat-solver/src/pool.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.c?rev=7670&r1=7669&r2=7670&view=diff ============================================================================== --- trunk/sat-solver/src/pool.c (original) +++ trunk/sat-solver/src/pool.c Fri Oct 26 22:42:46 2007 @@ -126,6 +126,8 @@ xfree(pool->stringspace); xfree(pool->strings); xfree(pool->rels); + for (i = 0; i < DEP2STRBUF; i++) + xfree(pool->dep2strbuf[i]); xfree(pool); } Modified: trunk/sat-solver/src/pool.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.h?rev=7670&r1=7669&r2=7670&view=diff ============================================================================== --- trunk/sat-solver/src/pool.h (original) +++ trunk/sat-solver/src/pool.h Fri Oct 26 22:42:46 2007 @@ -52,6 +52,11 @@ /* well known solvable */ #define SYSTEMSOLVABLE 1 + +/* how many strings to maintain (round robin) */ +#define DEP2STRBUF 16 + + //----------------------------------------------- struct _Pool { @@ -92,6 +97,11 @@ Id (*nscallback)(struct _Pool *, void *data, Id name, Id evr); void *nscallbackdata; + + /* our dep2str string space */ + char *dep2strbuf[DEP2STRBUF]; + int dep2strlen[DEP2STRBUF]; + int dep2strn; }; #define TYPE_ID 1 Modified: trunk/sat-solver/src/poolid.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/poolid.c?rev=7670&r1=7669&r2=7670&view=diff ============================================================================== --- trunk/sat-solver/src/poolid.c (original) +++ trunk/sat-solver/src/poolid.c Fri Oct 26 22:42:46 2007 @@ -241,24 +241,20 @@ char *s1, *s2; int n, l, ls1, ls2, lsr; - static char *dep2strbuf[DEP2STRBUF]; - static int dep2strlen[DEP2STRBUF]; - static int dep2strn; - if (!ISRELDEP(id)) return pool->stringspace + pool->strings[id]; rd = GETRELDEP(pool, id); - n = dep2strn; + n = pool->dep2strn; sr = id2rel(pool, id); lsr = strlen(sr); s2 = (char *)dep2str(pool, rd->evr); - dep2strn = n; + pool->dep2strn = n; ls2 = strlen(s2); s1 = (char *)dep2str(pool, rd->name); - dep2strn = n; + pool->dep2strn = n; ls1 = strlen(s1); if (rd->flags == REL_NAMESPACE) @@ -269,34 +265,34 @@ } l = ls1 + ls2 + lsr; - if (l + 1 > dep2strlen[n]) + if (l + 1 > pool->dep2strlen[n]) { - if (s1 != dep2strbuf[n]) - dep2strbuf[n] = xrealloc(dep2strbuf[n], l + 32); + if (s1 != pool->dep2strbuf[n]) + pool->dep2strbuf[n] = xrealloc(pool->dep2strbuf[n], l + 32); else { - dep2strbuf[n] = xrealloc(dep2strbuf[n], l + 32); - s1 = dep2strbuf[n]; + pool->dep2strbuf[n] = xrealloc(pool->dep2strbuf[n], l + 32); + s1 = pool->dep2strbuf[n]; } - dep2strlen[n] = l + 32; + pool->dep2strlen[n] = l + 32; } - if (s1 != dep2strbuf[n]) + if (s1 != pool->dep2strbuf[n]) { - strcpy(dep2strbuf[n], s1); - s1 = dep2strbuf[n]; + strcpy(pool->dep2strbuf[n], s1); + s1 = pool->dep2strbuf[n]; } strcpy(s1 + ls1, sr); - dep2strbuf[n] = s1 + ls1 + lsr; + pool->dep2strbuf[n] = s1 + ls1 + lsr; s2 = (char *)dep2str(pool, rd->evr); - if (s2 != dep2strbuf[n]) - strcpy(dep2strbuf[n], s2); - dep2strbuf[n] = s1; + if (s2 != pool->dep2strbuf[n]) + strcpy(pool->dep2strbuf[n], s2); + pool->dep2strbuf[n] = s1; if (rd->flags == REL_NAMESPACE) { s1[ls1 + ls2 + lsr - 1] = ')'; s1[ls1 + ls2 + lsr] = 0; } - dep2strn = (n + 1) % DEP2STRBUF; + pool->dep2strn = (n + 1) % DEP2STRBUF; return s1; } Modified: trunk/sat-solver/src/solver.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=7670&r1=7669&r2=7670&view=diff ============================================================================== --- trunk/sat-solver/src/solver.c (original) +++ trunk/sat-solver/src/solver.c Fri Oct 26 22:42:46 2007 @@ -508,31 +508,28 @@ solv->rules = (Rule *)xrealloc(solv->rules, ((solv->nrules + RULES_BLOCK) & ~RULES_BLOCK) * sizeof(Rule)); solv->nrules = j; #if 1 - { - int binr = 0; - int dc = 0; - Id *dp; - Rule *r; + if (solv->pool->verbose) + { + int binr = 0; + int lits = 0; + Id *dp; + Rule *r; - for (i = 1; i < solv->nrules; i++) - { - r = solv->rules + i; - if (r->d == 0) /* assertion */ - { + for (i = 1; i < solv->nrules; i++) + { + r = solv->rules + i; + if (r->d == 0) binr++; - continue; - } - dp = solv->pool->whatprovidesdata + r->d; - while (*dp++) - dc++; - } - if (solv->pool->verbose) - { - printf(" binary: %d\n", binr); - printf(" normal: %d\n", solv->nrules - 1 - binr); - printf(" normal lits: %d\n", dc); - } - } + else + { + dp = solv->pool->whatprovidesdata + r->d; + while (*dp++) + lits++; + } + } + printf(" binary: %d\n", binr); + printf(" normal: %d, %d literals\n", solv->nrules - 1 - binr, lits); + } #endif } @@ -627,7 +624,8 @@ if (!solv->jobrules) { /* this is a rpm rule assertion, we do not have to allocate it */ - /* it can be identified by a level of 1 and a zero reason */ + /* it can be identified by a level of 1 and a zero reason */ + /* we must not drop those rules from the decisionq when rewinding! */ if (p > 0) abort(); if (solv->decisionmap[-p] > 0 || solv->decisionmap[-p] < -1) @@ -848,9 +846,12 @@ if (req == SOLVABLE_PREREQMARKER) /* skip the marker */ continue; - dp = GET_PROVIDESP(req, p); /* get providers of req */ + dp = GET_PROVIDESP(req, p); /* get providers of req */ - if (dontfix) /* dont care about breakage */ + if (*dp == SYSTEMSOLVABLE) /* always installed */ + continue; + + if (dontfix) { /* the strategy here is to not insist on dependencies * that are already broken. so if we find one provider @@ -859,9 +860,9 @@ for (i = 0; dp[i]; i++) /* for all providers */ { if (dp[i] >= system->start && dp[i] < system->start + system->nsolvables) - break; /* provider is installed */ + break; /* provider was installed */ } - if (!dp[i]) /* previously broken dependency */ + if (!dp[i]) /* previously broken dependency */ { if (pool->verbose) printf("ignoring broken requires %s of system package %s-%s.%s\n", dep2str(pool, req), id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch)); continue; @@ -880,8 +881,6 @@ continue; } - if (*dp == SYSTEMSOLVABLE) /* always installed */ - continue; #if 0 printf("addrule %s-%s.%s %s %d %d\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch), dep2str(pool, req), -n, dp - pool->whatprovidesdata); for (i = 0; dp[i]; i++) Modified: trunk/sat-solver/testsuite/deptestomatic.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/deptestomatic.c?rev=7670&r1=7669&r2=7670&view=diff ============================================================================== --- trunk/sat-solver/testsuite/deptestomatic.c (original) +++ trunk/sat-solver/testsuite/deptestomatic.c Fri Oct 26 22:42:46 2007 @@ -660,8 +660,8 @@ s->evr = ID_EMPTY; s->provides = repo_addid_dep(pd->locales, s->provides, id, 0); - queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE_PROVIDES ); - queuepush( &(pd->trials), id ); + queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE ); + queuepush( &(pd->trials), s - pool->solvables ); } /*----------------------------------------------------------------*/ Modified: trunk/sat-solver/testsuite/gimmick.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/gimmick.c?rev=7670&r1=7669&r2=7670&view=diff ============================================================================== --- trunk/sat-solver/testsuite/gimmick.c (original) +++ trunk/sat-solver/testsuite/gimmick.c Fri Oct 26 22:42:46 2007 @@ -26,21 +26,21 @@ Id p, *pp; pool = pool_create(); - pool_addrepo_solv( pool, stdin, "" ); + pool_addrepo_solv(pool, stdin, ""); if (argc == 2) - id = str2id( pool, argv[1], 1 ); + id = str2id(pool, argv[1], 1); else - id = rel2id( pool, str2id( pool, argv[1], 1), str2id(pool, argv[2], 1), atoi(argv[3]), 1 ); - pool_freeidhashes( pool ); + id = rel2id(pool, str2id(pool, argv[1], 1), str2id(pool, argv[2], 1), atoi(argv[3]), 1); - pool_prepare( pool ); + pool_prepare(pool); - printf("%s%s%s:\n", id2str( pool, id ), id2rel( pool, id ), id2evr( pool, id ) ); + printf("%s:\n", dep2str(pool, id)); FOR_PROVIDES(p, pp, id) { s = pool->solvables + p; - printf(" %s-%s.%s\n", id2str( pool, s->name ), id2str( pool, s->evr ), id2str( pool, s->arch )); + printf(" %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch)); } + pool_free(pool); return 0; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org