return 1;
}
+int
+repodata_filelistfilter_matches(Repodata *data, const char *str)
+{
+ /* '.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$' */
+ /* for now hardcoded */
+ if (strstr(str, "bin/"))
+ return 1;
+ if (!strncmp(str, "/etc/", 5))
+ return 1;
+ if (!strcmp(str, "/usr/lib/sendmail"))
+ return 1;
+ return 0;
+}
+
+
enum {
di_bye,
return dp;
}
-int
-repodata_filelistfilter_matches(Repodata *data, const char *str)
-{
- /* '.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$' */
- /* for now hardcoded */
- if (strstr(str, "bin/"))
- return 1;
- if (!strncmp(str, "/etc/", 5))
- return 1;
- if (!strcmp(str, "/usr/bin/sendmail"))
- return 1;
- return 0;
-}
-
static int
dataiterator_filelistcheck(Dataiterator *di)
{
}
}
+/* shrink end of repodata */
void
repodata_shrink(Repodata *data, int end)
{
/**********************************************************************/
+
#define REPODATA_ATTRS_BLOCK 63
#define REPODATA_ATTRDATA_BLOCK 1023
#define REPODATA_ATTRIDDATA_BLOCK 63
i = 0;
if (ap)
{
+ /* Determine equality based on the name only, allows us to change
+ type (when overwrite is set), and makes TYPE_CONSTANT work. */
for (pp = ap; *pp; pp += 2)
- /* Determine equality based on the name only, allows us to change
- type (when overwrite is set), and makes TYPE_CONSTANT work. */
if (data->keys[*pp].name == data->keys[keyid].name)
break;
if (*pp)
}
-void
+static void
repodata_set(Repodata *data, Id solvid, Repokey *key, Id val)
{
Id keyid;
int oldsize;
Id *ida, *pp, **ppp;
+ /* check if it is the same as last time, this speeds things up a lot */
if (handle == data->lasthandle && data->keys[data->lastkey].name == keyname && data->keys[data->lastkey].type == keytype && data->attriddatalen == data->lastdatalen)
{
/* great! just append the new data */
data->lastdatalen += entrysize;
return;
}
+
ppp = repodata_get_attrp(data, handle);
pp = *ppp;
if (pp)
data->lastdatalen = data->attriddatalen + entrysize + 1;
}
-static inline int
-checksumtype2len(Id type)
-{
- switch (type)
- {
- case REPOKEY_TYPE_MD5:
- return SIZEOF_MD5;
- case REPOKEY_TYPE_SHA1:
- return SIZEOF_SHA1;
- case REPOKEY_TYPE_SHA256:
- return SIZEOF_SHA256;
- default:
- return 0;
- }
-}
-
void
repodata_set_bin_checksum(Repodata *data, Id solvid, Id keyname, Id type,
const unsigned char *str)
{
Repokey key;
- int l = checksumtype2len(type);
+ int l;
- if (!l)
+ if (!(l = sat_chksum_len(type)))
return;
key.name = keyname;
key.type = type;
const char *str)
{
unsigned char buf[64];
- int l = checksumtype2len(type);
+ int l;
- if (!l)
+ if (!(l = sat_chksum_len(type)))
return;
if (hexstr2bytes(buf, str, l) != l)
return;
int i, l;
char *str, *s;
- l = checksumtype2len(type);
- if (!l)
+ if (!(l = sat_chksum_len(type)))
return "";
s = str = pool_alloctmpspace(data->repo->pool, 2 * l + 1);
for (i = 0; i < l; i++)
/**********************************************************************/
-/* unify with repo_write! */
+/* TODO: unify with repo_write! */
#define EXTDATA_BLOCK 1023