Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ext/repo_deb.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,24 @@ control2solvable(Solvable *s, Repodata *data, char *control)
case 'C' << 8 | 'O':
if (!strcasecmp(tag, "conflicts"))
s->conflicts = makedeps(repo, q, s->conflicts, 0);
else if (!strcasecmp(tag, "conffiles")) {
char *line, *curLine, *filename, *md5;
line = curLine = solv_strdup(q);
while (curLine && strlen(curLine)) {
char *nextLine = strchr(curLine, '\n');
if (nextLine)
*nextLine++ = '\0';
md5 = strchr(curLine, ' ');
if (md5) {
*md5++ = '\0';
filename = curLine;
repodata_add_file_checksum(data, s - pool->solvables, SOLVABLE_DEB_CONFFILES,
filename, md5);
}
curLine = nextLine;
}
solv_free(line);
}
break;
case 'D' << 8 | 'E':
if (!strcasecmp(tag, "depends"))
Expand Down
2 changes: 2 additions & 0 deletions src/knownid.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ KNOWNID(SIGNATURE_DATA, "signature:data"),
KNOWNID(PRODUCT_REGISTER_FLAVOR, "product:regflavor"), /* installed and available product */

KNOWNID(SOLVABLE_INSTALLSTATUS, "solvable:installstatus"), /* debian install status */
KNOWNID(SOLVABLE_DEB_CONFFILES, "solvable:deb:conffiles"),
KNOWNID(REPOKEY_TYPE_CONFFILES_ARRAY, "repokey:type:conffiles_array"),

KNOWNID(SOLVABLE_PREREQ_IGNOREINST, "solvable:prereq_ignoreinst"), /* ignore these pre-requires for installed packages */

Expand Down
2 changes: 2 additions & 0 deletions src/libsolv.ver
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ SOLV_1.0 {
repo_write_stdkeyfilter;
repodata_add_dirnumnum;
repodata_add_dirstr;
repodata_add_file_bin_checksum;
repodata_add_file_checksum;
repodata_add_fixarray;
repodata_add_flexarray;
repodata_add_idarray;
Expand Down
39 changes: 39 additions & 0 deletions src/repodata.c
Original file line number Diff line number Diff line change
Expand Up @@ -2484,6 +2484,38 @@ repodata_set_checksum(Repodata *data, Id solvid, Id keyname, Id type,
repodata_set_bin_checksum(data, solvid, keyname, type, buf);
}

void
repodata_add_file_bin_checksum(Repodata *data, Id solvid, Id keyname, const char* filename,
const unsigned char *chksum)
{
int l;
Id filename_p, chksum_p;

filename_p = pool_str2id(data->repo->pool, filename, 1);

l = solv_chksum_len(REPOKEY_TYPE_MD5);
data->attrdata = solv_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK);
memcpy(data->attrdata + data->attrdatalen, chksum, l);
chksum_p = data->attrdatalen;
data->attrdatalen += l;

repodata_add_array(data, solvid, keyname, REPOKEY_TYPE_CONFFILES_ARRAY, 2);
data->attriddata[data->attriddatalen++] = filename_p;
data->attriddata[data->attriddatalen++] = chksum_p;
data->attriddata[data->attriddatalen++] = 0;
}

void
repodata_add_file_checksum(Repodata *data, Id solvid, Id keyname, const char* filename,
const char *chksum)
{
unsigned char buf[64];
int l;
l = solv_chksum_len(REPOKEY_TYPE_MD5);
solv_hex2bin(&chksum, buf, l);
repodata_add_file_bin_checksum(data, solvid, keyname, filename, buf);
}

const char *
repodata_chk2str(Repodata *data, Id type, const unsigned char *buf)
{
Expand Down Expand Up @@ -3184,6 +3216,13 @@ repodata_serialize_key(Repodata *data, struct extdata *newincore,
data_addblob(xd, data->attrdata + ida[1], strlen((char *)(data->attrdata + ida[1])) + 1);
}
break;
case REPOKEY_TYPE_CONFFILES_ARRAY:
for (ida = data->attriddata + val; *ida; ida += 2)
{
data_addideof(xd, ida[0], ida[2] ? 0 : 1);
data_addblob(xd, data->attrdata + ida[1], SIZEOF_MD5);
}
break;
case REPOKEY_TYPE_FIXARRAY:
{
int num = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/repodata.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ void repodata_set_bin_checksum(Repodata *data, Id solvid, Id keyname, Id type,
const unsigned char *buf);
void repodata_set_checksum(Repodata *data, Id solvid, Id keyname, Id type,
const char *str);
void repodata_add_file_bin_checksum(Repodata *data, Id solvid, Id keyname, const char* filename,
const unsigned char *chksum);
void repodata_add_file_checksum(Repodata *data, Id solvid, Id keyname, const char* filename,
const char *chksum);
void repodata_set_idarray(Repodata *data, Id solvid, Id keyname, Queue *q);

/* directory (for package file list) */
Expand Down
14 changes: 14 additions & 0 deletions src/repopack.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ data_fetch(unsigned char *dp, KeyValue *kv, Repokey *key)
kv->num = 0; /* not stringified yet */
kv->str = (const char *)dp;
return dp + strlen(kv->str) + 1;
case REPOKEY_TYPE_CONFFILES_ARRAY:
dp = data_read_ideof(dp, &kv->id, &kv->eof);
kv->str = (const char *)dp;
return dp + SIZEOF_MD5;
case REPOKEY_TYPE_DIRNUMNUMARRAY:
dp = data_read_id(dp, &kv->id);
dp = data_read_id(dp, (Id *)&kv->num);
Expand Down Expand Up @@ -270,6 +274,16 @@ data_skip(unsigned char *dp, int type)
if (!(x & 0x40))
return dp;
}
case REPOKEY_TYPE_CONFFILES_ARRAY:
for (;;)
{
while ((*dp & 0x80) != 0)
dp++;
x = *dp++;
dp += SIZEOF_MD5 + 1;
if (!(x & 0x40))
return dp;
}
case REPOKEY_TYPE_DIRNUMNUMARRAY:
for (;;)
{
Expand Down