[Pkg-libvirt-commits] [libguestfs] 17/146: inspection: deb: Seperate epoch field from version
Hilko Bengen
bengen at moszumanska.debian.org
Sun Mar 29 17:00:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch master
in repository libguestfs.
commit fdbb96ecaeea73804fb42699985089d107dfa860
Author: Nikos Skalkotos <skalkoto at gmail.com>
Date: Mon Nov 17 22:48:01 2014 +0000
inspection: deb: Seperate epoch field from version
Return it in the app2_epoch field of the guestfs_application2 struct
Signed-off-by: Nikos Skalkotos <skalkoto at gmail.com>
(cherry picked from commit 6aaff1fffaa7d62bf75d55cd99ed291d7a143ed3)
---
src/inspect-apps.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/inspect-apps.c b/src/inspect-apps.c
index 6fb9665..8d05b9c 100644
--- a/src/inspect-apps.c
+++ b/src/inspect-apps.c
@@ -433,6 +433,7 @@ list_applications_deb (guestfs_h *g, struct inspect_fs *fs)
FILE *fp;
char line[1024];
size_t len;
+ int32_t epoch = 0;
CLEANUP_FREE char *name = NULL, *version = NULL, *release = NULL, *arch = NULL;
int installed_flag = 0;
@@ -476,23 +477,31 @@ list_applications_deb (guestfs_h *g, struct inspect_fs *fs)
else if (STRPREFIX (line, "Version: ")) {
free (version);
free (release);
- char *p = strchr (&line[9], '-');
- if (p) {
- *p = '\0';
- version = safe_strdup (g, &line[9]);
- release = safe_strdup (g, p+1);
+ char *p1, *p2;
+ p1 = strchr (&line[9], ':');
+ if (p1) {
+ *p1++ = '\0';
+ epoch = guestfs___parse_unsigned_int (g, &line[9]); /* -1 on error */
+ } else {
+ p1 = &line[9];
+ epoch = 0;
+ }
+ p2 = strchr (p1, '-');
+ if (p2) {
+ *p2++ = '\0';
+ release = safe_strdup (g, p2);
} else {
- version = safe_strdup (g, &line[9]);
release = NULL;
}
+ version = safe_strdup (g, p1);
}
else if (STRPREFIX (line, "Architecture: ")) {
free (arch);
arch = safe_strdup (g, &line[14]);
}
else if (STREQ (line, "")) {
- if (installed_flag && name && version)
- add_application (g, apps, name, "", 0, version, release ? : "",
+ if (installed_flag && name && version && (epoch >= 0))
+ add_application (g, apps, name, "", epoch, version, release ? : "",
arch ? : "", "", "", "", "");
free (name);
free (version);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list