Skip to content

Commit

Permalink
- add solver_private.h, make repo_ functions return an int, make solv…
Browse files Browse the repository at this point in the history
…er_solv return the problem count
  • Loading branch information
mlschroe committed May 25, 2011
1 parent 55f5371 commit 66e7a25
Show file tree
Hide file tree
Showing 37 changed files with 364 additions and 205 deletions.
3 changes: 1 addition & 2 deletions examples/solv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2947,8 +2947,7 @@ main(int argc, char **argv)
if (mainmode == MODE_ERASE || mainmode == MODE_ERASECLEAN)
solv->allowuninstall = 1; /* don't nag */

solver_solve(solv, &job);
if (!solv->problems.count)
if (!solver_solve(solv, &job))
break;
pcnt = solver_problem_count(solv);
printf("Found %d problems:\n", pcnt);
Expand Down
3 changes: 2 additions & 1 deletion ext/repo_content.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ add_multiple_urls(Repodata *data, Id handle, char *value, Id type)
*
*/

void
int
repo_add_content(Repo *repo, FILE *fp, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -545,4 +545,5 @@ repo_add_content(Repo *repo, FILE *fp, int flags)
join_freemem();
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
return 0;
}
2 changes: 1 addition & 1 deletion ext/repo_content.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* for further information
*/

void repo_add_content(Repo *repo, FILE *fp, int flags);
extern int repo_add_content(Repo *repo, FILE *fp, int flags);
9 changes: 6 additions & 3 deletions ext/repo_deb.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ control2solvable(Solvable *s, Repodata *data, char *control)
}
}

void
int
repo_add_debpackages(Repo *repo, FILE *fp, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -409,9 +409,10 @@ repo_add_debpackages(Repo *repo, FILE *fp, int flags)
sat_free(buf);
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
return 0;
}

void
int
repo_add_debdb(Repo *repo, const char *rootdir, int flags)
{
FILE *fp;
Expand All @@ -425,9 +426,10 @@ repo_add_debdb(Repo *repo, const char *rootdir, int flags)
}
repo_add_debpackages(repo, fp, flags);
fclose(fp);
return 0;
}

void
int
repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -597,6 +599,7 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags)
}
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
return 0;
}

Id
Expand Down
6 changes: 3 additions & 3 deletions ext/repo_deb.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* for further information
*/

extern void repo_add_debpackages(Repo *repo, FILE *fp, int flags);
extern void repo_add_debdb(Repo *repo, const char *rootdir, int flags);
extern void repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags);
extern int repo_add_debpackages(Repo *repo, FILE *fp, int flags);
extern int repo_add_debdb(Repo *repo, const char *rootdir, int flags);
extern int repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags);
extern Id repo_add_deb(Repo *repo, const char *deb, int flags);

#define DEBS_ADD_WITH_PKGID (1 << 8)
2 changes: 1 addition & 1 deletion ext/repo_deltainfoxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* for further information
*/

void repo_add_deltainfoxml(Repo *repo, FILE *fp, int flags);
extern int repo_add_deltainfoxml(Repo *repo, FILE *fp, int flags);
3 changes: 2 additions & 1 deletion ext/repo_helix.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ characterData(void *userData, const XML_Char *s, int len)
*
*/

void
int
repo_add_helix(Repo *repo, FILE *fp, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -868,4 +868,5 @@ repo_add_helix(Repo *repo, FILE *fp, int flags)
POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_helix took %d ms\n", sat_timems(now));
POOL_DEBUG(SAT_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables);
POOL_DEBUG(SAT_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id)));
return 0;
}
2 changes: 1 addition & 1 deletion ext/repo_helix.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern "C" {
#include "pool.h"
#include "repo.h"

extern void repo_add_helix(Repo *repo, FILE *fp, int flags);
extern int repo_add_helix(Repo *repo, FILE *fp, int flags);

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions ext/repo_products.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
* for further information
*/

void repo_add_code11_products(Repo *repo, const char *dirpath, int flags);
void repo_add_products(Repo *repo, const char *proddir, const char *root, int flags);
extern int repo_add_code11_products(Repo *repo, const char *dirpath, int flags);
extern int repo_add_products(Repo *repo, const char *proddir, const char *root, int flags);
5 changes: 3 additions & 2 deletions ext/repo_releasefile_products.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ add_releasefile_product(Repo *repo, FILE *fp)
}


void
int
repo_add_releasefile_products(Repo *repo, const char *dirpath, int flags)
{
DIR *dir;
Expand All @@ -120,7 +120,7 @@ repo_add_releasefile_products(Repo *repo, const char *dirpath, int flags)

dir = opendir(dirpath);
if (!dir)
return;
return 0;

while ((entry = readdir(dir)))
{
Expand All @@ -145,5 +145,6 @@ repo_add_releasefile_products(Repo *repo, const char *dirpath, int flags)

if (!(flags & REPO_NO_INTERNALIZE) && (flags & REPO_REUSE_REPODATA) != 0)
repodata_internalize(repo_last_repodata(repo));
return 0;
}

2 changes: 1 addition & 1 deletion ext/repo_releasefile_products.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* for further information
*/

void repo_add_releasefile_products(Repo *repo, const char *dirpath, int flags);
extern int repo_add_releasefile_products(Repo *repo, const char *dirpath, int flags);
2 changes: 1 addition & 1 deletion ext/repo_repomdxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* for further information
*/

void repo_add_repomdxml(Repo *repo, FILE *fp, int flags);
extern int repo_add_repomdxml(Repo *repo, FILE *fp, int flags);
14 changes: 9 additions & 5 deletions ext/repo_rpmdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ count_headers(const char *rootdir, DB_ENV *dbenv)
*
*/

void
int
repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -1738,6 +1738,7 @@ repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags)
POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_rpmdb took %d ms\n", sat_timems(now));
POOL_DEBUG(SAT_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables);
POOL_DEBUG(SAT_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id)));
return 0;
}


Expand All @@ -1748,7 +1749,7 @@ getu32(const unsigned char *dp)
}


void
int
repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags)
{
int i, sigdsize, sigcnt, l;
Expand Down Expand Up @@ -1944,6 +1945,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags)
sat_free(rpmhead);
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
return 0;
}

Id
Expand Down Expand Up @@ -3054,7 +3056,7 @@ pubkey2solvable(Solvable *s, Repodata *data, char *pubkey)
return 1;
}

void
int
repo_add_rpmdb_pubkeys(Repo *repo, const char *rootdir, int flags)
{
Pool *pool = repo->pool;
Expand All @@ -3070,7 +3072,7 @@ repo_add_rpmdb_pubkeys(Repo *repo, const char *rootdir, int flags)

memset(&state, 0, sizeof(state));
if (!(state.dbenv = opendbenv(rootdir)))
return;
return 0;
entries = getinstalledrpmdbids(&state, "Name", "gpg-pubkey", &nentries, &namedata);
for (i = 0 ; i < nentries; i++)
{
Expand All @@ -3095,9 +3097,10 @@ repo_add_rpmdb_pubkeys(Repo *repo, const char *rootdir, int flags)
freestate(&state);
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
return 0;
}

void
int
repo_add_pubkeys(Repo *repo, const char **keys, int nkeys, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -3137,4 +3140,5 @@ repo_add_pubkeys(Repo *repo, const char **keys, int nkeys, int flags)
sat_free(buf);
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
return 0;
}
20 changes: 10 additions & 10 deletions ext/repo_rpmdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

struct headerToken_s;

extern void repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags);
extern void repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags);
extern int repo_add_rpmdb(Repo *repo, Repo *ref, const char *rootdir, int flags);
extern int repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags);
extern Id repo_add_rpm(Repo *repo, const char *rpm, int flags);
void repo_add_rpmdb_pubkeys(Repo *repo, const char *rootdir, int flags);
void repo_add_pubkeys(Repo *repo, const char **keys, int nkeys, int flags);
extern int repo_add_rpmdb_pubkeys(Repo *repo, const char *rootdir, int flags);
extern int repo_add_pubkeys(Repo *repo, const char **keys, int nkeys, int flags);

#define RPMDB_REPORT_PROGRESS (1 << 8)
#define RPM_ADD_WITH_PKGID (1 << 9)
Expand All @@ -29,11 +29,11 @@ void repo_add_pubkeys(Repo *repo, const char **keys, int nkeys, int flags);
#define RPM_ITERATE_FILELIST_WITHCOL (1 << 2)
#define RPM_ITERATE_FILELIST_NOGHOSTS (1 << 3)

void *rpm_byrpmdbid(Id rpmdbid, const char *rootdir, void **statep);
void *rpm_byfp(FILE *fp, const char *name, void **statep);
void *rpm_byrpmh(struct headerToken_s *h, void **statep);
extern void *rpm_byrpmdbid(Id rpmdbid, const char *rootdir, void **statep);
extern void *rpm_byfp(FILE *fp, const char *name, void **statep);
extern void *rpm_byrpmh(struct headerToken_s *h, void **statep);


char *rpm_query(void *rpmhandle, Id what);
void rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char *, int, const char *), void *cbdata);
int rpm_installedrpmdbids(const char *rootdir, const char *index, const char *match, Queue *rpmdbidq);
extern char *rpm_query(void *rpmhandle, Id what);
extern void rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char *, int, const char *), void *cbdata);
extern int rpm_installedrpmdbids(const char *rootdir, const char *index, const char *match, Queue *rpmdbidq);
3 changes: 2 additions & 1 deletion ext/repo_rpmmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ characterData(void *userData, const XML_Char *s, int len)
*
*/

void
int
repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -1226,4 +1226,5 @@ repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags)
POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_rpmmd took %d ms\n", sat_timems(now));
POOL_DEBUG(SAT_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables);
POOL_DEBUG(SAT_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data->incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id)));
return 0;
}
2 changes: 1 addition & 1 deletion ext/repo_rpmmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* for further information
*/

extern void repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags);
extern int repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags);
3 changes: 2 additions & 1 deletion ext/repo_susetags.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ lookup_shared_id(Repodata *data, Id p, Id keyname, Id voidid, int uninternalized
* flags: flags
*/

void
int
repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -1206,4 +1206,5 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
free(pd.common.tmp);
free(line);
join_freemem();
return 0;
}
2 changes: 1 addition & 1 deletion ext/repo_susetags.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
#define SUSETAGS_EXTEND (1 << 9)
#define SUSETAGS_RECORD_SHARES (1 << 10)

extern void repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int flags);
extern int repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int flags);
4 changes: 2 additions & 2 deletions ext/repo_updateinfoxml.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ characterData(void *userData, const XML_Char *s, int len)

#define BUFF_SIZE 8192

void
int
repo_add_updateinfoxml(Repo *repo, FILE *fp, int flags)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -624,6 +624,6 @@ repo_add_updateinfoxml(Repo *repo, FILE *fp, int flags)

if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
return 0;
}

/* EOF */
2 changes: 1 addition & 1 deletion ext/repo_updateinfoxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* for further information
*/

void repo_add_updateinfoxml(Repo *repo, FILE *fp, int flags);
extern int repo_add_updateinfoxml(Repo *repo, FILE *fp, int flags);
7 changes: 4 additions & 3 deletions ext/repo_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ repo_write_stdkeyfilter(Repo *repo, Repokey *key, void *kfdata)
* 4) encode data into buffers using the mapping tables
* 5) write everything to disk
*/
void
int
repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void *kfdata), void *kfdata, Id **keyarrayp)
{
Pool *pool = repo->pool;
Expand Down Expand Up @@ -1908,6 +1908,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1);
sat_free(cbdata.keymapstart);
sat_free(cbdata.dirused);
sat_free(repodataused);
return 0;
}

struct repodata_write_data {
Expand All @@ -1931,13 +1932,13 @@ repodata_write_keyfilter(Repo *repo, Repokey *key, void *kfdata)
return key->storage;
}

void
int
repodata_write(Repodata *data, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void *kfdata), void *kfdata)
{
struct repodata_write_data wd;

wd.keyfilter = keyfilter;
wd.kfdata = kfdata;
wd.repodataid = data - data->repo->repodata;
repo_write(data->repo, fp, repodata_write_keyfilter, &wd, 0);
return repo_write(data->repo, fp, repodata_write_keyfilter, &wd, 0);
}
6 changes: 3 additions & 3 deletions ext/repo_write.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#include "repo.h"

void repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void *kfdata), void *kfdata, Id **keyarrayp);
int repo_write_stdkeyfilter(Repo *repo, Repokey *key, void *kfdata);
extern int repo_write(Repo *repo, FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void *kfdata), void *kfdata, Id **keyarrayp);
extern int repo_write_stdkeyfilter(Repo *repo, Repokey *key, void *kfdata);

void repodata_write(Repodata *data , FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void *kfdata), void *kfdata);
extern int repodata_write(Repodata *data , FILE *fp, int (*keyfilter)(Repo *repo, Repokey *key, void *kfdata), void *kfdata);

#endif
2 changes: 1 addition & 1 deletion ext/repo_zyppdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* for further information
*/

void repo_add_zyppdb_products(Repo *repo, const char *dirpath, int flags);
extern int repo_add_zyppdb_products(Repo *repo, const char *dirpath, int flags);
2 changes: 1 addition & 1 deletion src/libsolv.ver
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ SOLV_1.0 {
map_grow;
map_init;
map_init_clone;
policy_create_obsolete_index;
policy_filter_unwanted;
policy_findupdatepackages;
policy_illegal2str;
Expand Down Expand Up @@ -253,6 +252,7 @@ SOLV_1.0 {
solver_calculate_noobsmap;
solver_create;
solver_create_decisions_obsoletesmap;
solver_create_state_maps;
solver_dep_installed;
solver_disablechoicerules;
solver_disablepolicyrules;
Expand Down
Loading

0 comments on commit 66e7a25

Please sign in to comment.