The parse_version() function might be parsing the version string of another
pkg_t instance so we must not modify it inplace to truncate the revision
part, otherwise we will clobber the original version, leading to failing
comparisations later on.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
rev = strrchr(vstr, '-');
if (rev) {
- *rev++ = '\0';
- pkg_set_string(pkg, PKG_REVISION, 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);
}
- pkg_set_string(pkg, PKG_VERSION, vstr);
-
return 0;
}