projects
/
oweals
/
opkg-lede.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libopkg/opkg_cmd.c: more robust PATH handling
[oweals/opkg-lede.git]
/
libopkg
/
pkg_parse.c
diff --git
a/libopkg/pkg_parse.c
b/libopkg/pkg_parse.c
index 31e7309c0f43325767e7fa3938257317ecc8ee56..7017a06b6f10af45d562fcae68225f0bc21bb3c9 100644
(file)
--- a/
libopkg/pkg_parse.c
+++ b/
libopkg/pkg_parse.c
@@
-63,7
+63,7
@@
static void parse_conffiles(pkg_t * pkg, const char *cstr)
int parse_version(pkg_t * pkg, const char *vstr)
{
int parse_version(pkg_t * pkg, const char *vstr)
{
- char *colon, *rev;
+ char *colon, *
dup, *
rev;
if (strncmp(vstr, "Version:", 8) == 0)
vstr += 8;
if (strncmp(vstr, "Version:", 8) == 0)
vstr += 8;
@@
-81,15
+81,18
@@
int parse_version(pkg_t * pkg, const char *vstr)
vstr = ++colon;
}
vstr = ++colon;
}
- rev = strrchr(vstr, '-');
+
+ dup = xstrdup(vstr);
+ rev = strrchr(dup, '-');
if (rev) {
if (rev) {
- pkg_set_string(pkg, PKG_REVISION, rev + 1);
- pkg_set_raw(pkg, PKG_VERSION, vstr, rev - vstr - 1);
- } else {
- pkg_set_string(pkg, PKG_VERSION, vstr);
+ *rev++ = '\0';
+ pkg_set_string(pkg, PKG_REVISION, rev);
}
}
+ pkg_set_string(pkg, PKG_VERSION, dup);
+ free(dup);
+
return 0;
}
return 0;
}
@@
-113,6
+116,7
@@
int pkg_parse_line(void *ptr, const char *line, uint mask)
{
pkg_t *pkg = (pkg_t *) ptr;
abstract_pkg_t *ab_pkg = NULL;
{
pkg_t *pkg = (pkg_t *) ptr;
abstract_pkg_t *ab_pkg = NULL;
+ conffile_list_t *cl;
/* these flags are a bit hackish... */
static int reading_conffiles = 0, reading_description = 0;
/* these flags are a bit hackish... */
static int reading_conffiles = 0, reading_description = 0;
@@
-143,6
+147,11
@@
int pkg_parse_line(void *ptr, const char *line, uint mask)
if ((mask & PFM_CONFFILES) && is_field("Conffiles", line)) {
reading_conffiles = 1;
reading_description = 0;
if ((mask & PFM_CONFFILES) && is_field("Conffiles", line)) {
reading_conffiles = 1;
reading_description = 0;
+
+ cl = xcalloc(1, sizeof(*cl));
+ conffile_list_init(cl);
+ pkg_set_ptr(pkg, PKG_CONFFILES, cl);
+
goto dont_reset_flags;
} else if ((mask & PFM_CONFLICTS)
&& is_field("Conflicts", line))
goto dont_reset_flags;
} else if ((mask & PFM_CONFLICTS)
&& is_field("Conflicts", line))
@@
-222,10
+231,8
@@
int pkg_parse_line(void *ptr, const char *line, uint mask)
case 'S':
if ((mask & PFM_SECTION) && is_field("Section", line))
pkg_set_string(pkg, PKG_SECTION, line + strlen("Section") + 1);
case 'S':
if ((mask & PFM_SECTION) && is_field("Section", line))
pkg_set_string(pkg, PKG_SECTION, line + strlen("Section") + 1);
-#ifdef HAVE_SHA256
else if ((mask & PFM_SHA256SUM) && is_field("SHA256sum", line))
pkg_set_sha256(pkg, line + strlen("SHA256sum") + 1);
else if ((mask & PFM_SHA256SUM) && is_field("SHA256sum", line))
pkg_set_sha256(pkg, line + strlen("SHA256sum") + 1);
-#endif
else if ((mask & PFM_SIZE) && is_field("Size", line)) {
pkg_set_int(pkg, PKG_SIZE, strtoul(line + strlen("Size") + 1, NULL, 0));
} else if ((mask & PFM_SOURCE) && is_field("Source", line))
else if ((mask & PFM_SIZE) && is_field("Size", line)) {
pkg_set_int(pkg, PKG_SIZE, strtoul(line + strlen("Size") + 1, NULL, 0));
} else if ((mask & PFM_SOURCE) && is_field("Source", line))