2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
18 #include "tools_util.h"
19 #include "repo_susetags.h"
26 struct parsedata_common common;
27 int last_found_source;
30 Id (*dirs)[3]; // dirid, size, nfiles
32 Id langcache[ID_NUM_INTERNAL];
36 static char *flagtab[] = {
47 langtag(struct parsedata *pd, Id tag, const char *language)
49 if (language && !language[0])
51 if (!language || tag >= ID_NUM_INTERNAL)
52 return pool_id2langid(pd->repo->pool, tag, language, 1);
53 return pool_id2langid(pd->repo->pool, tag, language, 1);
54 if (!pd->langcache[tag])
55 pd->langcache[tag] = pool_id2langid(pd->repo->pool, tag, language, 1);
56 return pd->langcache[tag];
61 * create and add dependency
65 adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id marker, char *kind)
73 /* A file dependency. Do not try to parse it */
74 id = str2id(pool, line + 6, 1);
78 i = split(line + 6, sp, 4); /* name, <op>, evr, ? */
79 if (i != 1 && i != 3) /* expect either 'name' or 'name' <op> 'evr' */
81 pool_debug(pool, SAT_FATAL, "susetags: bad dependency line: %d: %s\n", pd->lineno, line);
85 id = str2id(pool, join2(kind, ":", sp[0]), 1);
87 id = str2id(pool, sp[0], 1);
90 evrid = makeevr(pool, sp[2]);
91 for (flags = 0; flags < 6; flags++)
92 if (!strcmp(sp[1], flagtab[flags]))
96 pool_debug(pool, SAT_FATAL, "susetags: unknown relation in %d: '%s'\n", pd->lineno, sp[1]);
99 id = rel2id(pool, id, evrid, flags + 1, 1);
102 return repo_addid_dep(pd->repo, olddeps, id, marker);
112 add_source(struct parsedata *pd, char *line, Solvable *s, Id handle)
114 Repo *repo = s->repo;
115 Pool *pool = repo->pool;
118 if (split(line, sp, 5) != 4)
120 pool_debug(pool, SAT_FATAL, "susetags: bad source line: %d: %s\n", pd->lineno, line);
124 Id name = str2id(pool, sp[0], 1);
125 Id evr = makeevr(pool, join2(sp[1], "-", sp[2]));
126 Id arch = str2id(pool, sp[3], 1);
127 /* XXX: could record a dep here, depends on where we want to store the data */
129 repodata_set_void(pd->data, handle, SOLVABLE_SOURCENAME);
131 repodata_set_id(pd->data, handle, SOLVABLE_SOURCENAME, name);
133 repodata_set_void(pd->data, handle, SOLVABLE_SOURCEEVR);
135 repodata_set_id(pd->data, handle, SOLVABLE_SOURCEEVR, evr);
136 repodata_set_constantid(pd->data, handle, SOLVABLE_SOURCEARCH, arch);
141 * add a line with directory information
146 add_dirline(struct parsedata *pd, char *line)
149 if (split(line, sp, 6) != 5)
151 pd->dirs = sat_extend(pd->dirs, pd->ndirs, 1, sizeof(pd->dirs[0]), 31);
152 long filesz = strtol(sp[1], 0, 0);
153 filesz += strtol(sp[2], 0, 0);
154 long filenum = strtol(sp[3], 0, 0);
155 filenum += strtol(sp[4], 0, 0);
156 /* hack: we know that there's room for a / */
159 unsigned dirid = repodata_str2dir(pd->data, sp[0], 1);
161 fprintf(stderr, "%s -> %d\n", sp[0], dirid);
163 pd->dirs[pd->ndirs][0] = dirid;
164 pd->dirs[pd->ndirs][1] = filesz;
165 pd->dirs[pd->ndirs][2] = filenum;
170 set_checksum(struct parsedata *pd, Repodata *data, Id handle, Id keyname, char *line)
175 if (split(line, sp, 3) != 2)
177 pool_debug(pd->repo->pool, SAT_FATAL, "susetags: bad checksum line: %d: %s\n", pd->lineno, line);
180 if (!strcasecmp(sp[0], "sha1"))
181 l = SIZEOF_SHA1 * 2, type = REPOKEY_TYPE_SHA1;
182 else if (!strcasecmp(sp[0], "sha256"))
183 l = SIZEOF_SHA256 * 2, type = REPOKEY_TYPE_SHA256;
184 else if (!strcasecmp(sp[0], "md5"))
185 l = SIZEOF_MD5 * 2, type = REPOKEY_TYPE_MD5;
188 pool_debug(pd->repo->pool, SAT_FATAL, "susetags: unknown checksum type: %d: %s\n", pd->lineno, sp[0]);
191 if (strlen(sp[1]) != l)
193 pool_debug(pd->repo->pool, SAT_FATAL, "susetags: bad checksum length: %d: for %s: %s\n", pd->lineno, sp[0], sp[1]);
196 repodata_set_checksum(data, handle, keyname, type, sp[1]);
206 id3_cmp(const void *v1, const void *v2, void *dp)
210 return i1[0] - i2[0];
220 commit_diskusage(struct parsedata *pd, Id handle)
223 Dirpool *dp = &pd->data->dirpool;
224 /* Now sort in dirid order. This ensures that parents come before
227 sat_sort(pd->dirs, pd->ndirs, sizeof(pd->dirs[0]), id3_cmp, 0);
228 /* Substract leaf numbers from all parents to make the numbers
229 non-cumulative. This must be done post-order (i.e. all leafs
230 adjusted before parents). We ensure this by starting at the end of
231 the array moving to the start, hence seeing leafs before parents. */
232 for (i = pd->ndirs; i--;)
234 unsigned p = dirpool_parent(dp, pd->dirs[i][0]);
236 for (; p; p = dirpool_parent(dp, p))
239 if (pd->dirs[j][0] == p)
243 if (pd->dirs[j][1] < pd->dirs[i][1])
246 pd->dirs[j][1] -= pd->dirs[i][1];
247 if (pd->dirs[j][2] < pd->dirs[i][2])
250 pd->dirs[j][2] -= pd->dirs[i][2];
253 /* Haven't found this parent in the list, look further if
254 we maybe find the parents parent. */
261 unsigned slen = sizeof(sbuf);
262 for (i = 0; i < pd->ndirs; i++)
264 dir2str(attr, pd->dirs[i][0], &buf, &slen);
265 fprintf(stderr, "have dir %d %d %d %s\n", pd->dirs[i][0], pd->dirs[i][1], pd->dirs[i][2], buf);
270 for (i = 0; i < pd->ndirs; i++)
271 if (pd->dirs[i][1] || pd->dirs[i][2])
273 repodata_add_dirnumnum(pd->data, handle, SOLVABLE_DISKUSAGE, pd->dirs[i][0], pd->dirs[i][1], pd->dirs[i][2]);
279 /* Unfortunately "a"[0] is no constant expression in the C languages,
280 so we need to pass the four characters individually :-/ */
281 #define CTAG(a,b,c,d) ((unsigned)(((unsigned char)a) << 24) \
282 | ((unsigned char)b << 16) \
283 | ((unsigned char)c << 8) \
284 | ((unsigned char)d))
291 static inline unsigned
292 tag_from_string(char *cs)
294 unsigned char *s = (unsigned char *)cs;
295 return ((s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]);
301 * Parse susetags file passed in fp, fill solvables into repo
303 * susetags is key,value based
307 * for long (multi-line) values,
314 * See http://en.opensuse.org/Standards/YaST2_Repository_Metadata
315 * and http://en.opensuse.org/Standards/YaST2_Repository_Metadata/packages
316 * and http://en.opensuse.org/Standards/YaST2_Repository_Metadata/pattern
319 * All keys have 3 characters and end in ':'
323 finish_solvable(struct parsedata *pd, Solvable *s, Id handle, Offset freshens)
325 Pool *pool = pd->repo->pool;
328 /* move file provides to filelist */
329 /* relies on the fact that rpm inserts self-provides at the end */
330 if (s->provides && (pd->flags & REPO_EXTEND_SOLVABLES) == 0)
332 Id *p, *lastreal, did;
333 const char *str, *sp;
334 lastreal = pd->repo->idarraydata + s->provides;
335 for (p = lastreal; *p; p++)
338 for (p = lastreal; *p; p++)
340 str = id2str(pool, *p);
346 for (p = lastreal; *p; p++)
350 str = id2str(pool, *p);
351 sp = strrchr(str, '/');
352 /* Need to copy filename now, before we add string that could
353 realloc the stringspace (and hence invalidate str). */
355 if (strlen(fname) >= 128)
356 fname = strdup(fname);
359 memcpy(fname_buf, fname, strlen(fname) + 1);
364 char *sdup = strdup(str);
366 did = repodata_str2dir(pd->data, sdup, 1);
372 strncpy(sdup, str, sp - str);
374 did = repodata_str2dir(pd->data, sdup, 1);
377 did = repodata_str2dir(pd->data, "/", 1);
378 repodata_add_dirstr(pd->data, handle, SOLVABLE_FILELIST, did, fname);
379 if (fname != fname_buf)
386 /* A self provide, except for source packages. This is harmless
387 to do twice (in case we see the same package twice). */
388 if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
389 s->provides = repo_addid_dep(pd->repo, s->provides,
390 rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
391 /* XXX This uses repo_addid_dep internally, so should also be
392 harmless to do twice. */
393 s->supplements = repo_fix_supplements(pd->repo, s->provides, s->supplements, freshens);
394 s->conflicts = repo_fix_conflicts(pd->repo, s->conflicts);
396 commit_diskusage(pd, handle);
400 joinhash_init(Repo *repo, Hashmask *hmp)
402 Hashmask hm = mkmask(repo->nsolvables);
403 Hashtable ht = sat_calloc(hm + 1, sizeof(*ht));
408 FOR_REPO_SOLVABLES(repo, i, s)
410 hh = HASHCHAIN_START;
413 h = HASHCHAIN_NEXT(h, hh, hm);
421 joinhash_lookup(Repo *repo, Hashtable ht, Hashmask hm, Id name, Id evr, Id arch)
425 if (!name || !arch || !evr)
427 hh = HASHCHAIN_START;
431 Solvable *s = repo->pool->solvables + ht[h];
432 if (s->name == name && s->evr == evr && s->arch == arch)
434 h = HASHCHAIN_NEXT(h, hh, hm);
443 * fp: file to read from
444 * defvendor: default vendor (0 if none)
445 * language: current language (0 if none)
450 repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int flags)
452 Pool *pool = repo->pool;
460 int last_found_pack = 0;
465 Hashtable joinhash = 0;
466 Hashmask joinhashm = 0;
469 if ((flags & (SUSETAGS_EXTEND|REPO_EXTEND_SOLVABLES)) != 0 && repo->nrepodata)
471 joinhash = joinhash_init(repo, &joinhashm);
475 data = repo_add_repodata(repo, flags);
477 memset(&pd, 0, sizeof(pd));
481 pd.repo = pd.common.repo = repo;
483 pd.common.pool = pool;
493 * collect values in 'struct parsedata pd'
494 * then build .solv (and .attr) file
500 char *olinep; /* old line pointer */
503 if (linep - line + 16 > aline) /* (re-)alloc buffer */
505 aline = linep - line;
506 line = realloc(line, aline + 512);
507 linep = line + aline;
510 if (!fgets(linep, aline - (linep - line), fp)) /* read line */
513 linep += strlen(linep);
514 if (linep == line || linep[-1] != '\n')
523 /* check for multi-line value tags (+Key:/-Key:) */
525 int is_end = (linep[-intag - keylen + 1] == '-')
526 && (linep[-1] == ':')
527 && (linep == line + 1 + intag + 1 + 1 + 1 + intag + 1 || linep[-intag - keylen] == '\n');
529 && strncmp(linep - 1 - intag, line + 1, intag))
531 pool_debug(pool, SAT_ERROR, "susetags: Nonmatching multi-line tags: %d: '%s' '%s' %d\n", pd.lineno, linep - 1 - intag, line + 1, intag);
533 if (cummulate && !is_end)
538 if (cummulate && is_end)
540 linep[-intag - keylen + 1] = 0;
541 if (linep[-intag - keylen] == '\n')
542 linep[-intag - keylen] = 0;
546 if (!cummulate && is_end)
552 if (!cummulate && !is_end)
553 linep = line + intag + keylen;
558 if (!intag && line[0] == '+' && line[1] && line[1] != ':') /* start of +Key:/-Key: tag */
560 char *tagend = strchr(line, ':');
563 pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
566 intag = tagend - (line + 1);
568 switch (tag_from_string(line)) /* check if accumulation is needed */
570 case CTAG('+', 'P', 'r', 'q'):
571 case CTAG('+', 'P', 'r', 'c'):
572 case CTAG('+', 'P', 's', 'g'):
573 if (!pd.kind || !(flags & SUSETAGS_KINDS_SEPARATELY))
575 case CTAG('+', 'D', 'e', 's'):
576 case CTAG('+', 'E', 'u', 'l'):
577 case CTAG('+', 'I', 'n', 's'):
578 case CTAG('+', 'D', 'e', 'l'):
579 case CTAG('+', 'A', 'u', 't'):
583 line[0] = '='; /* handle lines between +Key:/-Key: as =Key: */
584 line[intag + keylen - 1] = ' ';
585 linep = line + intag + keylen;
588 if (*line == '#' || !*line)
590 if (! (line[0] && line[1] && line[2] && line[3] && (line[4] == ':' || line[4] == '.')))
595 endlang = strchr(line + 5, ':');
598 keylen = endlang - line - 1;
599 strncpy(line_lang, line + 5, 5);
600 line_lang[endlang - line - 5] = 0;
605 tag = tag_from_string(line);
609 * start of (next) package or pattern
611 * =Pkg: <name> <version> <release> <architecture>
615 if ((tag == CTAG('=', 'P', 'k', 'g')
616 || tag == CTAG('=', 'P', 'a', 't')))
618 /* If we have an old solvable, complete it by filling in some
621 finish_solvable(&pd, s, handle, freshens);
635 if (split(line + 5, sp, 5) != 4)
637 pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
645 /* data join operation. find solvable matching name/arch/evr and
648 /* we don't use the create flag here as a simple pre-check for existance */
650 name = str2id(pool, join2(pd.kind, ":", sp[0]), 0);
652 name = str2id(pool, sp[0], 0);
653 evr = makeevr(pool, join2(sp[1], "-", sp[2]));
654 arch = str2id(pool, sp[3], 0);
657 if (repo->start + last_found_pack + 1 < repo->end)
659 s = pool->solvables + repo->start + last_found_pack + 1;
660 if (s->repo != repo || s->name != name || s->evr != evr || s->arch != arch)
664 s = joinhash_lookup(repo, joinhash, joinhashm, name, evr, arch);
666 if (!s && (flags & REPO_EXTEND_SOLVABLES) != 0)
668 /* fallthrough to package creation */
672 /* normal operation. create a new solvable. */
673 s = pool_id2solvable(pool, repo_add_solvable(repo));
675 s->name = str2id(pool, join2(pd.kind, ":", sp[0]), 1);
677 s->name = str2id(pool, sp[0], 1);
678 s->evr = makeevr(pool, join2(sp[1], "-", sp[2]));
679 s->arch = str2id(pool, sp[3], 1);
680 s->vendor = defvendor;
683 last_found_pack = (s - pool->solvables) - repo->start;
685 handle = s - pool->solvables;
688 /* If we have no current solvable to add to, ignore all further lines
689 for it. Probably invalid input data in the second set of
691 if (indesc >= 2 && !s)
694 pool_debug(pool, SAT_ERROR, "susetags: huh %d: %s?\n", pd.lineno, line);
700 case CTAG('=', 'P', 'r', 'v'): /* provides */
701 s->provides = adddep(pool, &pd, s->provides, line, 0, pd.kind);
703 case CTAG('=', 'R', 'e', 'q'): /* requires */
704 s->requires = adddep(pool, &pd, s->requires, line, -SOLVABLE_PREREQMARKER, pd.kind);
706 case CTAG('=', 'P', 'r', 'q'): /* pre-requires / packages required */
709 if (flags & SUSETAGS_KINDS_SEPARATELY)
710 repodata_set_poolstr(data, handle, str2id(pool, "solvable:must", 1), line + 6);
712 s->requires = adddep(pool, &pd, s->requires, line, 0, 0); /* patterns: a required package */
715 s->requires = adddep(pool, &pd, s->requires, line, SOLVABLE_PREREQMARKER, 0); /* package: pre-requires */
717 case CTAG('=', 'O', 'b', 's'): /* obsoletes */
718 s->obsoletes = adddep(pool, &pd, s->obsoletes, line, 0, pd.kind);
720 case CTAG('=', 'C', 'o', 'n'): /* conflicts */
721 s->conflicts = adddep(pool, &pd, s->conflicts, line, 0, pd.kind);
723 case CTAG('=', 'R', 'e', 'c'): /* recommends */
724 s->recommends = adddep(pool, &pd, s->recommends, line, 0, pd.kind);
726 case CTAG('=', 'S', 'u', 'p'): /* supplements */
727 s->supplements = adddep(pool, &pd, s->supplements, line, 0, pd.kind);
729 case CTAG('=', 'E', 'n', 'h'): /* enhances */
730 s->enhances = adddep(pool, &pd, s->enhances, line, 0, pd.kind);
732 case CTAG('=', 'S', 'u', 'g'): /* suggests */
733 s->suggests = adddep(pool, &pd, s->suggests, line, 0, pd.kind);
735 case CTAG('=', 'F', 'r', 'e'): /* freshens */
736 freshens = adddep(pool, &pd, freshens, line, 0, pd.kind);
738 case CTAG('=', 'P', 'r', 'c'): /* packages recommended */
739 if (flags & SUSETAGS_KINDS_SEPARATELY)
740 repodata_set_poolstr(data, handle, str2id(pool, "solvable:should", 1), line + 6);
742 s->recommends = adddep(pool, &pd, s->recommends, line, 0, 0);
744 case CTAG('=', 'P', 's', 'g'): /* packages suggested */
745 if (flags & SUSETAGS_KINDS_SEPARATELY)
746 repodata_set_poolstr(data, handle, str2id(pool, "solvable:may", 1), line + 6);
748 s->suggests = adddep(pool, &pd, s->suggests, line, 0, 0);
750 case CTAG('=', 'P', 'c', 'n'): /* pattern: package conflicts */
751 if (flags & SUSETAGS_KINDS_SEPARATELY)
752 fprintf(stderr, "Unsupported: pattern -> package conflicts\n");
754 s->conflicts = adddep(pool, &pd, s->conflicts, line, 0, 0);
756 case CTAG('=', 'P', 'o', 'b'): /* pattern: package obsoletes */
757 if (flags & SUSETAGS_KINDS_SEPARATELY)
758 fprintf(stderr, "Unsupported: pattern -> package obsoletes\n");
760 s->obsoletes = adddep(pool, &pd, s->obsoletes, line, 0, 0);
762 case CTAG('=', 'P', 'f', 'r'): /* pattern: package freshens */
763 if (flags & SUSETAGS_KINDS_SEPARATELY)
764 fprintf(stderr, "Unsupported: pattern -> package freshens\n");
766 freshens = adddep(pool, &pd, freshens, line, 0, 0);
768 case CTAG('=', 'P', 's', 'p'): /* pattern: package supplements */
769 if (flags & SUSETAGS_KINDS_SEPARATELY)
770 fprintf(stderr, "Unsupported: pattern -> package supplements\n");
772 s->supplements = adddep(pool, &pd, s->supplements, line, 0, 0);
774 case CTAG('=', 'P', 'e', 'n'): /* pattern: package enhances */
775 if (flags & SUSETAGS_KINDS_SEPARATELY)
776 fprintf(stderr, "Unsupported: pattern -> package enhances\n");
778 s->enhances = adddep(pool, &pd, s->enhances, line, 0, 0);
780 case CTAG('=', 'V', 'e', 'r'): /* - version - */
787 joinhash = joinhash_init(repo, &joinhashm);
791 case CTAG('=', 'V', 'n', 'd'): /* vendor */
792 s->vendor = str2id(pool, line + 6, 1);
795 /* From here it's the attribute tags. */
796 case CTAG('=', 'G', 'r', 'p'):
797 repodata_set_poolstr(data, handle, SOLVABLE_GROUP, line + 6);
799 case CTAG('=', 'L', 'i', 'c'):
800 repodata_set_poolstr(data, handle, SOLVABLE_LICENSE, line + 6);
802 case CTAG('=', 'L', 'o', 'c'):
804 int i = split(line + 6, sp, 3);
805 if (i != 2 && i != 3)
807 pool_debug(pool, SAT_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line);
810 repodata_set_location(data, handle, atoi(sp[0]), i == 3 ? sp[2] : id2str(pool, s->arch), sp[1]);
813 case CTAG('=', 'S', 'r', 'c'):
814 add_source(&pd, line + 6, s, handle);
816 case CTAG('=', 'S', 'i', 'z'):
817 if (split(line + 6, sp, 3) == 2)
819 repodata_set_num(data, handle, SOLVABLE_DOWNLOADSIZE, (unsigned int)(atoi(sp[0]) + 1023) / 1024);
820 repodata_set_num(data, handle, SOLVABLE_INSTALLSIZE, (unsigned int)(atoi(sp[1]) + 1023) / 1024);
823 case CTAG('=', 'T', 'i', 'm'):
825 unsigned int t = atoi(line + 6);
827 repodata_set_num(data, handle, SOLVABLE_BUILDTIME, t);
830 case CTAG('=', 'K', 'w', 'd'):
831 repodata_add_poolstr_array(data, handle, SOLVABLE_KEYWORDS, line + 6);
833 case CTAG('=', 'A', 'u', 't'):
834 repodata_set_str(data, handle, SOLVABLE_AUTHORS, line + 6);
836 case CTAG('=', 'S', 'u', 'm'):
837 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_SUMMARY, language ? language : line_lang), line + 3 + keylen );
839 case CTAG('=', 'D', 'e', 's'):
840 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_DESCRIPTION, language ? language : line_lang), line + 3 + keylen );
842 case CTAG('=', 'E', 'u', 'l'):
843 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_EULA, language), line + 6);
845 case CTAG('=', 'I', 'n', 's'):
846 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEINS, language), line + 6);
848 case CTAG('=', 'D', 'e', 'l'):
849 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEDEL, language), line + 6);
851 case CTAG('=', 'V', 'i', 's'):
853 /* Accept numbers and textual bools. */
856 if (k || !strcasecmp(line + 6, "true"))
857 repodata_set_void(data, handle, SOLVABLE_ISVISIBLE );
860 case CTAG('=', 'S', 'h', 'r'):
861 if (last_found_pack >= pd.nshare)
863 pd.share_with = sat_realloc2(pd.share_with, last_found_pack + 256, sizeof(*pd.share_with));
864 memset(pd.share_with + pd.nshare, 0, (last_found_pack + 256 - pd.nshare) * sizeof(*pd.share_with));
865 pd.nshare = last_found_pack + 256;
867 pd.share_with[last_found_pack] = strdup(line + 6);
869 case CTAG('=', 'D', 'i', 'r'):
870 add_dirline(&pd, line + 6);
872 case CTAG('=', 'C', 'a', 't'):
873 repodata_set_poolstr(data, handle, langtag(&pd, SOLVABLE_CATEGORY, line_lang), line + 3 + keylen);
875 case CTAG('=', 'O', 'r', 'd'):
876 /* Order is a string not a number, so we can retroactively insert
877 new patterns in the middle, i.e. 1 < 15 < 2. */
878 repodata_set_str(data, handle, SOLVABLE_ORDER, line + 6);
880 case CTAG('=', 'I', 'c', 'o'):
881 repodata_set_str(data, handle, SOLVABLE_ICON, line + 6);
883 case CTAG('=', 'E', 'x', 't'):
884 repodata_add_poolstr_array(data, handle, SOLVABLE_EXTENDS, join2("pattern", ":", line + 6));
886 case CTAG('=', 'I', 'n', 'c'):
887 repodata_add_poolstr_array(data, handle, SOLVABLE_INCLUDES, join2("pattern", ":", line + 6));
889 case CTAG('=', 'C', 'k', 's'):
890 set_checksum(&pd, data, handle, SOLVABLE_CHECKSUM, line + 6);
892 case CTAG('=', 'L', 'a', 'n'):
893 language = strdup(line + 6);
896 case CTAG('=', 'F', 'l', 's'):
898 char *p = strrchr(line + 6, '/');
900 if (p && p != line + 6 && !p[1])
903 p = strrchr(line + 6, '/');
908 did = repodata_str2dir(data, line + 6, 1);
916 did = repodata_str2dir(data, "/", 1);
917 repodata_add_dirstr(data, handle, SOLVABLE_FILELIST, did, p);
920 case CTAG('=', 'H', 'd', 'r'):
921 /* rpm header range */
922 if (split(line + 6, sp, 3) == 2)
924 /* we ignore the start value */
925 unsigned int end = (unsigned int)atoi(sp[1]);
927 repodata_set_num(data, handle, SOLVABLE_HEADEREND, end);
931 case CTAG('=', 'P', 'a', 't'):
932 case CTAG('=', 'P', 'k', 'g'):
936 pool_debug(pool, SAT_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line);
943 finish_solvable(&pd, s, handle, freshens);
946 * (e.g. multiple binaries built from same source)
954 map_init(&keyidmap, data->nkeys);
955 for (i = 1; i < data->nkeys; i++)
957 Id keyname = data->keys[i].name;
958 if (keyname == SOLVABLE_INSTALLSIZE || keyname == SOLVABLE_DISKUSAGE || keyname == SOLVABLE_FILELIST)
960 if (keyname == SOLVABLE_MEDIADIR || keyname == SOLVABLE_MEDIAFILE || keyname == SOLVABLE_MEDIANR)
962 if (keyname == SOLVABLE_DOWNLOADSIZE || keyname == SOLVABLE_CHECKSUM)
964 if (keyname == SOLVABLE_SOURCENAME || keyname == SOLVABLE_SOURCEARCH || keyname == SOLVABLE_SOURCEEVR)
966 if (keyname == SOLVABLE_PKGID || keyname == SOLVABLE_HDRID || keyname == SOLVABLE_LEADSIGID)
968 MAPSET(&keyidmap, i);
970 for (i = 0; i < pd.nshare; i++)
971 if (pd.share_with[i])
973 if (split(pd.share_with[i], sp, 5) != 4)
975 pool_debug(pool, SAT_FATAL, "susetags: bad =Shr line: %s\n", pd.share_with[i]);
979 Id name = str2id(pool, sp[0], 1);
980 Id evr = makeevr(pool, join2(sp[1], "-", sp[2]));
981 Id arch = str2id(pool, sp[3], 1);
984 for (n = repo->start, nn = repo->start + last_found;
985 n < repo->end; n++, nn++)
989 found = pool->solvables + nn;
990 if (found->repo == repo
991 && found->name == name
993 && found->arch == arch)
995 last_found = nn - repo->start;
1000 repodata_merge_some_attrs(data, repo->start + i, repo->start + last_found, &keyidmap, 0);
1001 free(pd.share_with[i]);
1003 free(pd.share_with);
1004 map_free(&keyidmap);
1008 if (!(flags & REPO_NO_INTERNALIZE))
1009 repodata_internalize(data);
1012 free(pd.common.tmp);