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"
25 struct parsedata_common common;
26 int last_found_source;
29 Id (*dirs)[3]; // dirid, size, nfiles
31 Id langcache[ID_NUM_INTERNAL];
35 static char *flagtab[] = {
46 langtag(struct parsedata *pd, Id tag, const char *language)
48 if (language && !language[0])
50 if (!language || tag >= ID_NUM_INTERNAL)
51 return pool_id2langid(pd->repo->pool, tag, language, 1);
52 return pool_id2langid(pd->repo->pool, tag, language, 1);
53 if (!pd->langcache[tag])
54 pd->langcache[tag] = pool_id2langid(pd->repo->pool, tag, language, 1);
55 return pd->langcache[tag];
60 * create and add dependency
64 adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id marker, char *kind)
72 /* A file dependency. Do not try to parse it */
73 id = str2id(pool, line + 6, 1);
77 i = split(line + 6, sp, 4); /* name, <op>, evr, ? */
78 if (i != 1 && i != 3) /* expect either 'name' or 'name' <op> 'evr' */
80 pool_debug(pool, SAT_FATAL, "susetags: bad dependency line: %d: %s\n", pd->lineno, line);
84 id = str2id(pool, join2(kind, ":", sp[0]), 1);
86 id = str2id(pool, sp[0], 1);
89 evrid = makeevr(pool, sp[2]);
90 for (flags = 0; flags < 6; flags++)
91 if (!strcmp(sp[1], flagtab[flags]))
95 pool_debug(pool, SAT_FATAL, "susetags: unknown relation in %d: '%s'\n", pd->lineno, sp[1]);
98 id = rel2id(pool, id, evrid, flags + 1, 1);
101 return repo_addid_dep(pd->repo, olddeps, id, marker);
111 add_source(struct parsedata *pd, char *line, Solvable *s, Id handle)
113 Repo *repo = s->repo;
114 Pool *pool = repo->pool;
117 if (split(line, sp, 5) != 4)
119 pool_debug(pool, SAT_FATAL, "susetags: bad source line: %d: %s\n", pd->lineno, line);
123 Id name = str2id(pool, sp[0], 1);
124 Id evr = makeevr(pool, join2(sp[1], "-", sp[2]));
125 Id arch = str2id(pool, sp[3], 1);
126 /* XXX: could record a dep here, depends on where we want to store the data */
128 repodata_set_void(pd->data, handle, SOLVABLE_SOURCENAME);
130 repodata_set_id(pd->data, handle, SOLVABLE_SOURCENAME, name);
132 repodata_set_void(pd->data, handle, SOLVABLE_SOURCEEVR);
134 repodata_set_id(pd->data, handle, SOLVABLE_SOURCEEVR, evr);
135 repodata_set_constantid(pd->data, handle, SOLVABLE_SOURCEARCH, arch);
140 * add a line with directory information
145 add_dirline(struct parsedata *pd, char *line)
148 if (split(line, sp, 6) != 5)
150 pd->dirs = sat_extend(pd->dirs, pd->ndirs, 1, sizeof(pd->dirs[0]), 31);
151 long filesz = strtol(sp[1], 0, 0);
152 filesz += strtol(sp[2], 0, 0);
153 long filenum = strtol(sp[3], 0, 0);
154 filenum += strtol(sp[4], 0, 0);
155 /* hack: we know that there's room for a / */
158 unsigned dirid = repodata_str2dir(pd->data, sp[0], 1);
160 fprintf(stderr, "%s -> %d\n", sp[0], dirid);
162 pd->dirs[pd->ndirs][0] = dirid;
163 pd->dirs[pd->ndirs][1] = filesz;
164 pd->dirs[pd->ndirs][2] = filenum;
169 set_checksum(struct parsedata *pd, Repodata *data, Id handle, Id keyname, char *line)
174 if (split(line, sp, 3) != 2)
176 pool_debug(pd->repo->pool, SAT_FATAL, "susetags: bad checksum line: %d: %s\n", pd->lineno, line);
179 if (!strcasecmp(sp[0], "sha1"))
180 l = SIZEOF_SHA1 * 2, type = REPOKEY_TYPE_SHA1;
181 else if (!strcasecmp(sp[0], "sha256"))
182 l = SIZEOF_SHA256 * 2, type = REPOKEY_TYPE_SHA256;
183 else if (!strcasecmp(sp[0], "md5"))
184 l = SIZEOF_MD5 * 2, type = REPOKEY_TYPE_MD5;
187 pool_debug(pd->repo->pool, SAT_FATAL, "susetags: unknown checksum type: %d: %s\n", pd->lineno, sp[0]);
190 if (strlen(sp[1]) != l)
192 pool_debug(pd->repo->pool, SAT_FATAL, "susetags: bad checksum length: %d: for %s: %s\n", pd->lineno, sp[0], sp[1]);
195 repodata_set_checksum(data, handle, keyname, type, sp[1]);
205 id3_cmp(const void *v1, const void *v2, void *dp)
209 return i1[0] - i2[0];
219 commit_diskusage(struct parsedata *pd, Id handle)
222 Dirpool *dp = &pd->data->dirpool;
223 /* Now sort in dirid order. This ensures that parents come before
226 sat_sort(pd->dirs, pd->ndirs, sizeof(pd->dirs[0]), id3_cmp, 0);
227 /* Substract leaf numbers from all parents to make the numbers
228 non-cumulative. This must be done post-order (i.e. all leafs
229 adjusted before parents). We ensure this by starting at the end of
230 the array moving to the start, hence seeing leafs before parents. */
231 for (i = pd->ndirs; i--;)
233 unsigned p = dirpool_parent(dp, pd->dirs[i][0]);
235 for (; p; p = dirpool_parent(dp, p))
238 if (pd->dirs[j][0] == p)
242 if (pd->dirs[j][1] < pd->dirs[i][1])
245 pd->dirs[j][1] -= pd->dirs[i][1];
246 if (pd->dirs[j][2] < pd->dirs[i][2])
249 pd->dirs[j][2] -= pd->dirs[i][2];
252 /* Haven't found this parent in the list, look further if
253 we maybe find the parents parent. */
260 unsigned slen = sizeof(sbuf);
261 for (i = 0; i < pd->ndirs; i++)
263 dir2str(attr, pd->dirs[i][0], &buf, &slen);
264 fprintf(stderr, "have dir %d %d %d %s\n", pd->dirs[i][0], pd->dirs[i][1], pd->dirs[i][2], buf);
269 for (i = 0; i < pd->ndirs; i++)
270 if (pd->dirs[i][1] || pd->dirs[i][2])
272 repodata_add_dirnumnum(pd->data, handle, SOLVABLE_DISKUSAGE, pd->dirs[i][0], pd->dirs[i][1], pd->dirs[i][2]);
278 /* Unfortunately "a"[0] is no constant expression in the C languages,
279 so we need to pass the four characters individually :-/ */
280 #define CTAG(a,b,c,d) ((unsigned)(((unsigned char)a) << 24) \
281 | ((unsigned char)b << 16) \
282 | ((unsigned char)c << 8) \
283 | ((unsigned char)d))
290 static inline unsigned
291 tag_from_string(char *cs)
293 unsigned char *s = (unsigned char *)cs;
294 return ((s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]);
300 * Parse susetags file passed in fp, fill solvables into repo
302 * susetags is key,value based
306 * for long (multi-line) values,
313 * See http://en.opensuse.org/Standards/YaST2_Repository_Metadata
314 * and http://en.opensuse.org/Standards/YaST2_Repository_Metadata/packages
315 * and http://en.opensuse.org/Standards/YaST2_Repository_Metadata/pattern
318 * All keys have 3 characters and end in ':'
322 finish_solvable(struct parsedata *pd, Solvable *s, Id handle, Offset freshens)
324 Pool *pool = pd->repo->pool;
327 /* move file provides to filelist */
328 /* relies on the fact that rpm inserts self-provides at the end */
331 Id *p, *lastreal, did;
332 const char *str, *sp;
333 lastreal = pd->repo->idarraydata + s->provides;
334 for (p = lastreal; *p; p++)
337 for (p = lastreal; *p; p++)
339 str = id2str(pool, *p);
345 for (p = lastreal; *p; p++)
349 str = id2str(pool, *p);
350 sp = strrchr(str, '/');
351 /* Need to copy filename now, before we add string that could
352 realloc the stringspace (and hence invalidate str). */
354 if (strlen(fname) >= 128)
355 fname = strdup(fname);
358 memcpy(fname_buf, fname, strlen(fname) + 1);
363 char *sdup = strdup(str);
365 did = repodata_str2dir(pd->data, sdup, 1);
371 strncpy(sdup, str, sp - str);
373 did = repodata_str2dir(pd->data, sdup, 1);
376 did = repodata_str2dir(pd->data, "/", 1);
377 repodata_add_dirstr(pd->data, handle, SOLVABLE_FILELIST, did, fname);
378 if (fname != fname_buf)
385 /* A self provide, except for source packages. This is harmless
386 to do twice (in case we see the same package twice). */
387 if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
388 s->provides = repo_addid_dep(pd->repo, s->provides,
389 rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
390 /* XXX This uses repo_addid_dep internally, so should also be
391 harmless to do twice. */
392 s->supplements = repo_fix_supplements(pd->repo, s->provides, s->supplements, freshens);
393 s->conflicts = repo_fix_conflicts(pd->repo, s->conflicts);
395 commit_diskusage(pd, handle);
399 joinhash_init(Repo *repo, Hashmask *hmp)
401 Hashmask hm = mkmask(repo->nsolvables);
402 Hashtable ht = sat_calloc(hm + 1, sizeof(*ht));
407 FOR_REPO_SOLVABLES(repo, i, s)
409 hh = HASHCHAIN_START;
412 h = HASHCHAIN_NEXT(h, hh, hm);
420 joinhash_lookup(Repo *repo, Hashtable ht, Hashmask hm, Id name, Id evr, Id arch)
424 if (!name || !arch || !evr)
426 hh = HASHCHAIN_START;
430 Solvable *s = repo->pool->solvables + ht[h];
431 if (s->name == name && s->evr == evr && s->arch == arch)
433 h = HASHCHAIN_NEXT(h, hh, hm);
442 * fp: file to read from
443 * defvendor: default vendor (0 if none)
444 * language: current language (0 if none)
449 repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int flags)
451 Pool *pool = repo->pool;
459 int last_found_pack = 0;
464 Hashtable joinhash = 0;
465 Hashmask joinhashm = 0;
467 if ((flags & (SUSETAGS_EXTEND|REPO_EXTEND_SOLVABLES)) != 0 && repo->nrepodata)
469 joinhash = joinhash_init(repo, &joinhashm);
473 data = repo_add_repodata(repo, flags);
475 memset(&pd, 0, sizeof(pd));
479 pd.repo = pd.common.repo = repo;
481 pd.common.pool = pool;
490 * collect values in 'struct parsedata pd'
491 * then build .solv (and .attr) file
497 char *olinep; /* old line pointer */
500 if (linep - line + 16 > aline) /* (re-)alloc buffer */
502 aline = linep - line;
503 line = realloc(line, aline + 512);
504 linep = line + aline;
507 if (!fgets(linep, aline - (linep - line), fp)) /* read line */
510 linep += strlen(linep);
511 if (linep == line || linep[-1] != '\n')
520 /* check for multi-line value tags (+Key:/-Key:) */
522 int is_end = (linep[-intag - keylen + 1] == '-')
523 && (linep[-1] == ':')
524 && (linep == line + 1 + intag + 1 + 1 + 1 + intag + 1 || linep[-intag - keylen] == '\n');
526 && strncmp(linep - 1 - intag, line + 1, intag))
528 pool_debug(pool, SAT_ERROR, "susetags: Nonmatching multi-line tags: %d: '%s' '%s' %d\n", pd.lineno, linep - 1 - intag, line + 1, intag);
530 if (cummulate && !is_end)
535 if (cummulate && is_end)
537 linep[-intag - keylen + 1] = 0;
538 if (linep[-intag - keylen] == '\n')
539 linep[-intag - keylen] = 0;
543 if (!cummulate && is_end)
549 if (!cummulate && !is_end)
550 linep = line + intag + keylen;
555 if (!intag && line[0] == '+' && line[1] && line[1] != ':') /* start of +Key:/-Key: tag */
557 char *tagend = strchr(line, ':');
560 pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
563 intag = tagend - (line + 1);
565 switch (tag_from_string(line)) /* check if accumulation is needed */
567 case CTAG('+', 'P', 'r', 'q'):
568 case CTAG('+', 'P', 'r', 'c'):
569 case CTAG('+', 'P', 's', 'g'):
570 if (!pd.kind || !(flags & SUSETAGS_KINDS_SEPARATELY))
572 case CTAG('+', 'D', 'e', 's'):
573 case CTAG('+', 'E', 'u', 'l'):
574 case CTAG('+', 'I', 'n', 's'):
575 case CTAG('+', 'D', 'e', 'l'):
576 case CTAG('+', 'A', 'u', 't'):
580 line[0] = '='; /* handle lines between +Key:/-Key: as =Key: */
581 line[intag + keylen - 1] = ' ';
582 linep = line + intag + keylen;
585 if (*line == '#' || !*line)
587 if (! (line[0] && line[1] && line[2] && line[3] && (line[4] == ':' || line[4] == '.')))
592 endlang = strchr(line + 5, ':');
595 keylen = endlang - line - 1;
596 strncpy(line_lang, line + 5, 5);
597 line_lang[endlang - line - 5] = 0;
602 tag = tag_from_string(line);
606 * start of (next) package or pattern
608 * =Pkg: <name> <version> <release> <architecture>
612 if ((tag == CTAG('=', 'P', 'k', 'g')
613 || tag == CTAG('=', 'P', 'a', 't')))
615 /* If we have an old solvable, complete it by filling in some
618 finish_solvable(&pd, s, handle, freshens);
632 if (split(line + 5, sp, 5) != 4)
634 pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
642 /* normal operation. create a new solvable. */
643 s = pool_id2solvable(pool, repo_add_solvable(repo));
645 s->name = str2id(pool, join2(pd.kind, ":", sp[0]), 1);
647 s->name = str2id(pool, sp[0], 1);
648 s->evr = makeevr(pool, join2(sp[1], "-", sp[2]));
649 s->arch = str2id(pool, sp[3], 1);
650 s->vendor = defvendor;
654 /* data join operation. find solvable matching name/arch/evr and
657 /* we don't use the create flag here as a simple pre-check for existance */
659 name = str2id(pool, join2(pd.kind, ":", sp[0]), 0);
661 name = str2id(pool, sp[0], 0);
662 evr = makeevr(pool, join2(sp[1], "-", sp[2]));
663 arch = str2id(pool, sp[3], 0);
665 continue; /* ids didn't exist */
666 if (repo->start + last_found_pack + 1 < repo->end)
668 s = pool->solvables + repo->start + last_found_pack + 1;
669 if (s->repo != repo || s->name != name || s->evr != evr || s->arch != arch)
673 s = joinhash_lookup(repo, joinhash, joinhashm, name, evr, arch);
677 last_found_pack = (s - pool->solvables) - repo->start;
679 handle = s - pool->solvables;
682 /* If we have no current solvable to add to, ignore all further lines
683 for it. Probably invalid input data in the second set of
685 if (indesc >= 2 && !s)
688 pool_debug(pool, SAT_ERROR, "susetags: huh %d: %s?\n", pd.lineno, line);
694 case CTAG('=', 'P', 'r', 'v'): /* provides */
695 s->provides = adddep(pool, &pd, s->provides, line, 0, pd.kind);
697 case CTAG('=', 'R', 'e', 'q'): /* requires */
698 s->requires = adddep(pool, &pd, s->requires, line, -SOLVABLE_PREREQMARKER, pd.kind);
700 case CTAG('=', 'P', 'r', 'q'): /* pre-requires / packages required */
703 if (flags & SUSETAGS_KINDS_SEPARATELY)
704 repodata_set_poolstr(data, handle, str2id(pool, "solvable:must", 1), line + 6);
706 s->requires = adddep(pool, &pd, s->requires, line, 0, 0); /* patterns: a required package */
709 s->requires = adddep(pool, &pd, s->requires, line, SOLVABLE_PREREQMARKER, 0); /* package: pre-requires */
711 case CTAG('=', 'O', 'b', 's'): /* obsoletes */
712 s->obsoletes = adddep(pool, &pd, s->obsoletes, line, 0, pd.kind);
714 case CTAG('=', 'C', 'o', 'n'): /* conflicts */
715 s->conflicts = adddep(pool, &pd, s->conflicts, line, 0, pd.kind);
717 case CTAG('=', 'R', 'e', 'c'): /* recommends */
718 s->recommends = adddep(pool, &pd, s->recommends, line, 0, pd.kind);
720 case CTAG('=', 'S', 'u', 'p'): /* supplements */
721 s->supplements = adddep(pool, &pd, s->supplements, line, 0, pd.kind);
723 case CTAG('=', 'E', 'n', 'h'): /* enhances */
724 s->enhances = adddep(pool, &pd, s->enhances, line, 0, pd.kind);
726 case CTAG('=', 'S', 'u', 'g'): /* suggests */
727 s->suggests = adddep(pool, &pd, s->suggests, line, 0, pd.kind);
729 case CTAG('=', 'F', 'r', 'e'): /* freshens */
730 freshens = adddep(pool, &pd, freshens, line, 0, pd.kind);
732 case CTAG('=', 'P', 'r', 'c'): /* packages recommended */
733 if (flags & SUSETAGS_KINDS_SEPARATELY)
734 repodata_set_poolstr(data, handle, str2id(pool, "solvable:should", 1), line + 6);
736 s->recommends = adddep(pool, &pd, s->recommends, line, 0, 0);
738 case CTAG('=', 'P', 's', 'g'): /* packages suggested */
739 if (flags & SUSETAGS_KINDS_SEPARATELY)
740 repodata_set_poolstr(data, handle, str2id(pool, "solvable:may", 1), line + 6);
742 s->suggests = adddep(pool, &pd, s->suggests, line, 0, 0);
744 case CTAG('=', 'P', 'c', 'n'): /* pattern: package conflicts */
745 if (flags & SUSETAGS_KINDS_SEPARATELY)
746 fprintf(stderr, "Unsupported: pattern -> package conflicts\n");
748 s->conflicts = adddep(pool, &pd, s->conflicts, line, 0, 0);
750 case CTAG('=', 'P', 'o', 'b'): /* pattern: package obsoletes */
751 if (flags & SUSETAGS_KINDS_SEPARATELY)
752 fprintf(stderr, "Unsupported: pattern -> package obsoletes\n");
754 s->obsoletes = adddep(pool, &pd, s->obsoletes, line, 0, 0);
756 case CTAG('=', 'P', 'f', 'r'): /* pattern: package freshens */
757 if (flags & SUSETAGS_KINDS_SEPARATELY)
758 fprintf(stderr, "Unsupported: pattern -> package freshens\n");
760 freshens = adddep(pool, &pd, freshens, line, 0, 0);
762 case CTAG('=', 'P', 's', 'p'): /* pattern: package supplements */
763 if (flags & SUSETAGS_KINDS_SEPARATELY)
764 fprintf(stderr, "Unsupported: pattern -> package supplements\n");
766 s->supplements = adddep(pool, &pd, s->supplements, line, 0, 0);
768 case CTAG('=', 'P', 'e', 'n'): /* pattern: package enhances */
769 if (flags & SUSETAGS_KINDS_SEPARATELY)
770 fprintf(stderr, "Unsupported: pattern -> package enhances\n");
772 s->enhances = adddep(pool, &pd, s->enhances, line, 0, 0);
774 case CTAG('=', 'V', 'e', 'r'): /* - version - */
781 repodata_internalize(data);
782 joinhash = joinhash_init(repo, &joinhashm);
785 case CTAG('=', 'V', 'n', 'd'): /* vendor */
786 s->vendor = str2id(pool, line + 6, 1);
789 /* From here it's the attribute tags. */
790 case CTAG('=', 'G', 'r', 'p'):
791 repodata_set_poolstr(data, handle, SOLVABLE_GROUP, line + 6);
793 case CTAG('=', 'L', 'i', 'c'):
794 repodata_set_poolstr(data, handle, SOLVABLE_LICENSE, line + 6);
796 case CTAG('=', 'L', 'o', 'c'):
798 int i = split(line + 6, sp, 3);
799 if (i != 2 && i != 3)
801 pool_debug(pool, SAT_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line);
804 repodata_set_location(data, handle, atoi(sp[0]), i == 3 ? sp[2] : id2str(pool, s->arch), sp[1]);
807 case CTAG('=', 'S', 'r', 'c'):
808 add_source(&pd, line + 6, s, handle);
810 case CTAG('=', 'S', 'i', 'z'):
811 if (split(line + 6, sp, 3) == 2)
813 repodata_set_num(data, handle, SOLVABLE_DOWNLOADSIZE, (unsigned int)(atoi(sp[0]) + 1023) / 1024);
814 repodata_set_num(data, handle, SOLVABLE_INSTALLSIZE, (unsigned int)(atoi(sp[1]) + 1023) / 1024);
817 case CTAG('=', 'T', 'i', 'm'):
819 unsigned int t = atoi(line + 6);
821 repodata_set_num(data, handle, SOLVABLE_BUILDTIME, t);
824 case CTAG('=', 'K', 'w', 'd'):
825 repodata_add_poolstr_array(data, handle, SOLVABLE_KEYWORDS, line + 6);
827 case CTAG('=', 'A', 'u', 't'):
828 repodata_set_str(data, handle, SOLVABLE_AUTHORS, line + 6);
830 case CTAG('=', 'S', 'u', 'm'):
831 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_SUMMARY, language ? language : line_lang), line + 3 + keylen );
833 case CTAG('=', 'D', 'e', 's'):
834 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_DESCRIPTION, language ? language : line_lang), line + 3 + keylen );
836 case CTAG('=', 'E', 'u', 'l'):
837 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_EULA, language), line + 6);
839 case CTAG('=', 'I', 'n', 's'):
840 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEINS, language), line + 6);
842 case CTAG('=', 'D', 'e', 'l'):
843 repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEDEL, language), line + 6);
845 case CTAG('=', 'V', 'i', 's'):
847 /* Accept numbers and textual bools. */
850 if (k || !strcasecmp(line + 6, "true"))
851 repodata_set_void(data, handle, SOLVABLE_ISVISIBLE );
854 case CTAG('=', 'S', 'h', 'r'):
855 if (last_found_pack >= pd.nshare)
857 pd.share_with = sat_realloc2(pd.share_with, last_found_pack + 256, sizeof(*pd.share_with));
858 memset(pd.share_with + pd.nshare, 0, (last_found_pack + 256 - pd.nshare) * sizeof(*pd.share_with));
859 pd.nshare = last_found_pack + 256;
861 pd.share_with[last_found_pack] = strdup(line + 6);
863 case CTAG('=', 'D', 'i', 'r'):
864 add_dirline(&pd, line + 6);
866 case CTAG('=', 'C', 'a', 't'):
867 repodata_set_poolstr(data, handle, langtag(&pd, SOLVABLE_CATEGORY, line_lang), line + 3 + keylen);
869 case CTAG('=', 'O', 'r', 'd'):
870 /* Order is a string not a number, so we can retroactively insert
871 new patterns in the middle, i.e. 1 < 15 < 2. */
872 repodata_set_str(data, handle, SOLVABLE_ORDER, line + 6);
874 case CTAG('=', 'I', 'c', 'o'):
875 repodata_set_str(data, handle, SOLVABLE_ICON, line + 6);
877 case CTAG('=', 'E', 'x', 't'):
878 repodata_add_poolstr_array(data, handle, SOLVABLE_EXTENDS, join2("pattern", ":", line + 6));
880 case CTAG('=', 'I', 'n', 'c'):
881 repodata_add_poolstr_array(data, handle, SOLVABLE_INCLUDES, join2("pattern", ":", line + 6));
883 case CTAG('=', 'C', 'k', 's'):
884 set_checksum(&pd, data, handle, SOLVABLE_CHECKSUM, line + 6);
886 case CTAG('=', 'L', 'a', 'n'):
887 language = strdup(line + 6);
890 case CTAG('=', 'F', 'l', 's'):
892 char *p = strrchr(line + 6, '/');
894 if (p && p != line + 6 && !p[1])
897 p = strrchr(line + 6, '/');
902 did = repodata_str2dir(data, line + 6, 1);
910 did = repodata_str2dir(data, "/", 1);
911 repodata_add_dirstr(data, handle, SOLVABLE_FILELIST, did, p);
914 case CTAG('=', 'H', 'd', 'r'):
915 /* rpm header range */
916 if (split(line + 6, sp, 3) == 2)
918 /* we ignore the start value */
919 unsigned int end = (unsigned int)atoi(sp[1]);
921 repodata_set_num(data, handle, SOLVABLE_HEADEREND, end);
925 case CTAG('=', 'P', 'a', 't'):
926 case CTAG('=', 'P', 'k', 'g'):
930 pool_debug(pool, SAT_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line);
937 finish_solvable(&pd, s, handle, freshens);
940 * (e.g. multiple binaries built from same source)
946 for (i = 0; i < pd.nshare; i++)
947 if (pd.share_with[i])
949 if (split(pd.share_with[i], sp, 5) != 4)
951 pool_debug(pool, SAT_FATAL, "susetags: bad =Shr line: %s\n", pd.share_with[i]);
955 Id name = str2id(pool, sp[0], 1);
956 Id evr = makeevr(pool, join2(sp[1], "-", sp[2]));
957 Id arch = str2id(pool, sp[3], 1);
960 for (n = repo->start, nn = repo->start + last_found;
961 n < repo->end; n++, nn++)
965 found = pool->solvables + nn;
966 if (found->repo == repo
967 && found->name == name
969 && found->arch == arch)
971 last_found = nn - repo->start;
976 repodata_merge_attrs(data, repo->start + i, repo->start + last_found);
977 free(pd.share_with[i]);
983 if (!(flags & REPO_NO_INTERNALIZE))
984 repodata_internalize(data);