while (fgets(buf + bufl, bufa - bufl, fp) > 0)
{
bufl += strlen(buf + bufl);
- if (bufl && buf[bufl - 1] != '\n')
+ if (!bufl)
+ continue;
+ if (buf[bufl - 1] != '\n')
{
if (bufa - bufl < 256)
{
}
continue;
}
- buf[--bufl] = 0;
+ buf[bufl - 1] = 0;
bufl = 0;
if (buf[0] != '@')
{
if (s)
{
pool_debug(pool, SOLV_ERROR, "unclosed package at EOF\n");
- repo_free_solvable_block(s->repo, s - pool->solvables, 1, 1);
+ repo_free_solvable(s->repo, s - pool->solvables, 1);
}
solv_free(buf);
if (!(flags & REPO_NO_INTERNALIZE))
STATE_START,
STATE_MEDIA_INFO,
STATE_INFO,
+ STATE_FILES,
NUMSTATES
};
static struct stateswitch stateswitches[] = {
{ STATE_START, "media_info", STATE_MEDIA_INFO, 0 },
{ STATE_MEDIA_INFO, "info", STATE_INFO, 1 },
+ { STATE_MEDIA_INFO, "files", STATE_FILES, 1 },
{ NUMSTATES }
};
enum state sbtab[NUMSTATES];
Solvable *solvable;
Hashtable joinhash;
- Hashmask joinhashmask;
+ Hashval joinhashmask;
};
static inline const char *
}
static Hashtable
-joinhash_init(Repo *repo, Hashmask *hmp)
+joinhash_init(Repo *repo, Hashval *hmp)
{
- Hashmask hm = mkmask(repo->nsolvables);
+ Hashval hm = mkmask(repo->nsolvables);
Hashtable ht = solv_calloc(hm + 1, sizeof(*ht));
Hashval h, hh;
Solvable *s;
}
static Solvable *
-joinhash_lookup(Repo *repo, Hashtable ht, Hashmask hm, const char *fn, const char *distepoch)
+joinhash_lookup(Repo *repo, Hashtable ht, Hashval hm, const char *fn, const char *distepoch)
{
Hashval h, hh;
const char *p, *vrstart, *vrend;
return 0;
}
-static void
-set_sourcerpm(Repodata *data, Solvable *s, Id handle, const char *sourcerpm)
-{
- const char *p, *sevr, *sarch, *name, *evr;
- Pool *pool;
-
- p = strrchr(sourcerpm, '.');
- if (!p || strcmp(p, ".rpm") != 0)
- return;
- p--;
- while (p > sourcerpm && *p != '.')
- p--;
- if (*p != '.' || p == sourcerpm)
- return;
- sarch = p-- + 1;
- while (p > sourcerpm && *p != '-')
- p--;
- if (*p != '-' || p == sourcerpm)
- return;
- p--;
- while (p > sourcerpm && *p != '-')
- p--;
- if (*p != '-' || p == sourcerpm)
- return;
- sevr = p + 1;
- pool = s->repo->pool;
- if (!strcmp(sarch, "src.rpm"))
- repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, ARCH_SRC);
- else if (!strcmp(sarch, "nosrc.rpm"))
- repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, ARCH_NOSRC);
- else
- repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, pool_strn2id(pool, sarch, strlen(sarch) - 4, 1));
- evr = pool_id2str(pool, s->evr);
- if (evr && !strncmp(sevr, evr, sarch - sevr - 1) && evr[sarch - sevr - 1] == 0)
- repodata_set_void(data, handle, SOLVABLE_SOURCEEVR);
- else
- repodata_set_id(data, handle, SOLVABLE_SOURCEEVR, pool_strn2id(pool, sevr, sarch - sevr - 1, 1));
- name = pool_id2str(pool, s->name);
- if (name && !strncmp(sourcerpm, name, sevr - sourcerpm - 1) && name[sevr - sourcerpm - 1] == 0)
- repodata_set_void(data, handle, SOLVABLE_SOURCENAME);
- else
- repodata_set_id(data, handle, SOLVABLE_SOURCENAME, pool_strn2id(pool, sourcerpm, sevr - sourcerpm - 1, 1));
-}
-
-
static void XMLCALL
startElement(void *userData, const char *name, const char **atts)
{
repodata_set_poolstr(pd->data, pd->solvable - pool->solvables, SOLVABLE_LICENSE, str);
str = find_attr("sourcerpm", atts);
if (str && *str)
- set_sourcerpm(pd->data, pd->solvable, pd->solvable - pool->solvables, str);
+ repodata_set_sourcepkg(pd->data, pd->solvable - pool->solvables, str);
+ break;
+ }
+ case STATE_FILES:
+ {
+ const char *fn = find_attr("fn", atts);
+ const char *distepoch = find_attr("distepoch", atts);
+ pd->solvable = joinhash_lookup(pd->repo, pd->joinhash, pd->joinhashmask, fn, distepoch);
break;
}
default:
if (s && *pd->content)
repodata_set_str(pd->data, s - pd->pool->solvables, SOLVABLE_DESCRIPTION, pd->content);
break;
+ case STATE_FILES:
+ if (s && *pd->content)
+ {
+ char *np, *p, *sl;
+ for (p = pd->content; p && *p; p = np)
+ {
+ Id id;
+ np = strchr(p, '\n');
+ if (np)
+ *np++ = 0;
+ if (!*p)
+ continue;
+ sl = strrchr(p, '/');
+ if (sl)
+ {
+ *sl++ = 0;
+ id = repodata_str2dir(pd->data, p, 1);
+ }
+ else
+ {
+ sl = p;
+ id = 0;
+ }
+ if (!id)
+ id = repodata_str2dir(pd->data, "/", 1);
+ repodata_add_dirstr(pd->data, s - pd->pool->solvables, SOLVABLE_FILELIST, id, sl);
+ }
+ }
+ break;
default:
break;
}