- char *ptr = linep;
- char *key, *value, *lang;
-
- lang = 0;
-
- /* split line into '<key>[<lang>] = <value>' */
- while (*ptr && (*ptr == ' ' || *ptr == '\t'))
- ++ptr;
- key = ptr;
- while (*ptr && !(*ptr == ' ' || *ptr == '\t' || *ptr == '=' || *ptr == '['))
- ++ptr;
- if (*ptr == '[')
- {
- *ptr++ = 0;
- lang = ptr;
- while (*ptr && !(*ptr == ']'))
- ++ptr;
- *ptr++ = 0;
- }
- if (*ptr != '=')
- *ptr++ = 0;
- while (*ptr && !(*ptr == '='))
- ++ptr;
- if (*ptr == '=')
- *ptr++ = 0;
- while (*ptr && (*ptr == ' ' || *ptr == '\t'))
- ++ptr;
- value = ptr;
-
- /*
- * [product]
- */
-
- if (current_section == SECTION_PRODUCT)
- {
- if (!s)
- {
- struct stat st;
-
- s = pool_id2solvable(pool, repo_add_solvable(repo));
- repodata_extend(data, s - pool->solvables);
- handle = repodata_get_handle(data, s - pool->solvables - repo->start);
- if (!fstat(fileno(fp), &st))
- {
- repodata_set_num(data, handle, SOLVABLE_INSTALLTIME, st.st_ctime);
- /* this is where <productsdir>/baseproduct points to */
- if (st.st_ino == baseproduct)
- repodata_set_str(data, handle, PRODUCT_TYPE, "base");
- }
- else
- {
- perror("Can't stat()");
- }
- }
- if (!strcmp(key, "name"))
- s->name = str2id(pool, join2("product", ":", value), 1);
- else if (!strcmp(key, "version"))
- s->evr = makeevr(pool, value);
- else if (!strcmp(key, "vendor"))
- s->vendor = str2id(pool, value, 1);
- else if (!strcmp(key, "distribution"))
- repo_set_str(repo, s - pool->solvables, SOLVABLE_DISTRIBUTION, value);
- else if (!strcmp (key, "flavor"))
- repo_set_str(repo, s - pool->solvables, PRODUCT_FLAVOR, value);
- }
- /*
- * [translated]
- */
- else if (current_section == SECTION_TRANSLATED)
- {
- if (!strcmp(key, "summary"))
- {
- repodata_set_str(data, handle, langtag(pd, SOLVABLE_SUMMARY, lang), value );
- }
- else if (!strcmp(key, "description"))
- repodata_set_str(data, handle, langtag(pd, SOLVABLE_DESCRIPTION, lang), value );
- }
- /*
- * [update]
- */
- else if (current_section == SECTION_UPDATE)
- {
- }