I’ve just commited 0.5.2.1. As the version shows, it is a bugfix release; is@ got a very nasty bug that took me a while to figure out. For 3 years, the only pkg_summary(5) format I’ve seen was:
PKGNAME=foo [...]
or, in case of conflicting packages:
CONFLICTS=bar CONFLICTS=baz PKGNAME=foo [...]
Well it turns out that we can also find:
PKGNAME=foo CONFLICTS=bar [...]
which is pretty annoying when it comes to stick to an anchor. Until now, I did the following:
static int
chk_pkgname(char *field)
{
if (strncmp(field, "PKGNAME=", 8) == 0 ||
strncmp(field, "CONFLICTS=", 10) == 0)
return 1;
return 0;
}
[...]
/* browse entries following PKGNAME and build the SQL query */
while (*psum != NULL && !chk_pkgname(*psum)) {
update_col(sum, pkgid, *psum);
psum++;
}
But with that new case, I had to check a little bit further:
static int
chk_pkgname(char *field, char *last_field)
{
if (strncmp(field, "PKGNAME=", 8) == 0)
return 1;
/* in some very rare cases, CONFLICTS appears *after* PKGNAME */
if (strncmp(last_field, "PKGNAME=", 8) != 0 &&
/* never seen many CONFLICTS after PKGNAME, but just in case... */
strncmp(last_field, "CONFLICTS=", 10) != 0 &&
strncmp(field, "CONFLICTS=", 10) == 0)
return 1;
return 0;
}
[...]
/* browse entries following PKGNAME and build the SQL query */
while (*psum != NULL && !chk_pkgname(*psum, *(psum - 1))) {
update_col(sum, pkgid, *psum);
psum++;
}
I really don’t like the way it’s done but I’ve no sexier way in mind at the moment. Maybe after some glasses of wine…


Recent Comments