2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
17 #include "repo_write.h"
18 #include "common_write.h"
20 static char *verticals[] = {
30 static unsigned char *filter;
34 create_filter(Pool *pool)
38 for (s = verticals; *s; s++)
40 id = str2id(pool, *s, 1);
43 filter = sat_realloc(filter, id + 16);
44 memset(filter + nfilter, 0, id + 16 - nfilter);
51 static int test_separate = 0;
54 keyfilter_solv(Repo *data, Repokey *key, void *kfdata)
56 if (test_separate && key->storage != KEY_STORAGE_SOLVABLE)
57 return KEY_STORAGE_DROPPED;
58 if (key->name < nfilter && filter[key->name])
59 return KEY_STORAGE_VERTICAL_OFFSET;
60 return KEY_STORAGE_INCORE;
64 keyfilter_attr(Repo *data, Repokey *key, void *kfdata)
66 if (key->storage == KEY_STORAGE_SOLVABLE)
67 return KEY_STORAGE_DROPPED;
68 if (key->name < nfilter && filter[key->name])
69 return KEY_STORAGE_VERTICAL_OFFSET;
70 return KEY_STORAGE_INCORE;
74 tool_write(Repo *repo, const char *basename, int separate)
76 Pool *pool = repo->pool;
77 Repodatafile fileinfoa[1];
78 Repodatafile *fileinfo = 0;
82 memset (fileinfoa, 0, sizeof fileinfoa);
87 FILE *fp = fopen ("test.attr", "w");
88 repo_write(repo, fp, keyfilter_attr, 0, fileinfo, 0);
90 fileinfo->location = strdup ("test.attr");
93 nsubfiles = fileinfo - fileinfoa;
96 repo_write(repo, stdout, keyfilter_solv, 0, fileinfo, nsubfiles);