Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <sat-solver> master : - fetch primary location from repomd.xml
  • From: Michael Schroeder <mls@xxxxxxx>
  • Date: Wed, 24 Jun 2009 14:06:31 +0200
  • Message-id: <E1MJRFg-0001Eh-41@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 9b2d6a3712a05ef3da0ab54ab113b4893fdd89b5
Author: Michael Schroeder <mls@xxxxxxx>
Date: Wed Jun 24 14:06:31 2009 +0200

- fetch primary location from repomd.xml
---
examples/solv.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/examples/solv.c b/examples/solv.c
index d15a22c..26120f5 100644
--- a/examples/solv.c
+++ b/examples/solv.c
@@ -198,7 +198,7 @@ myfopen(const char *fn)
}

FILE *
-curlfopen(char *baseurl, char *file, int uncompress)
+curlfopen(const char *baseurl, const char *file, int uncompress)
{
pid_t pid;
int fd, l;
@@ -269,6 +269,7 @@ setarch(Pool *pool)
pool_setarch(pool, un.machine);
}

+
void
read_repos(Pool *pool, struct repoinfo *repoinfos, int nrepoinfos)
{
@@ -276,6 +277,8 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int
nrepoinfos)
struct repoinfo *cinfo;
int i;
FILE *fp;
+ Dataiterator di;
+ const char *primaryfile;

printf("reading rpm database\n");
repo = repo_create(pool, "@System");
@@ -297,7 +300,18 @@ read_repos(Pool *pool, struct repoinfo *repoinfos, int
nrepoinfos)
repo->appdata = cinfo;
repo_add_repomdxml(repo, fp, 0);
fclose(fp);
- if ((fp = curlfopen(cinfo->baseurl, "repodata/primary.xml.gz", 1)) ==
0)
+ primaryfile = 0;
+ dataiterator_init(&di, pool, repo, SOLVID_META,
REPOSITORY_REPOMD_TYPE, "primary", SEARCH_STRING);
+ dataiterator_prepend_keyname(&di, REPOSITORY_REPOMD);
+ if (dataiterator_step(&di))
+ {
+ dataiterator_setpos_parent(&di);
+ primaryfile = pool_lookup_str(pool, SOLVID_POS,
REPOSITORY_REPOMD_LOCATION);
+ }
+ dataiterator_free(&di);
+ if (!primaryfile)
+ primaryfile = "repodata/primary.xml.gz";
+ if ((fp = curlfopen(cinfo->baseurl, primaryfile, 1)) == 0)
continue;
repo_add_rpmmd(repo, fp, 0, 0);
fclose(fp);
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages