pm

barely a pack manager
git clone git://z3bra.org/pm
Log | Files | Refs | README | LICENSE

commit 1cf858aeacc51eb954f89638e7c08791f6e78846
parent 1122cb5b5c7dc42336705a96f9948cd36b9891a7
Author: z3bra <contactatz3bradotorg>
Date:   Sat Nov 25 21:52:02 +0100

Reword log/error messages for consistency

Diffstat:
pm.c | 25++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/pm.c b/pm.c @@ -169,7 +169,7 @@ re_match(const char *re, const char *str) regmatch_t sub[1]; if (regcomp(&preg, re, 0)) { - fprintf(stderr, "%s: Invalid regular expression\n", re); + fprintf(stderr, "%s: Not a valid expression\n", re); return -1; } @@ -239,7 +239,7 @@ pack_load_metadata(const char *datadir, char *name) snprintf(tmp, PATH_MAX, "%s/%s", datadir, name); if (inspect_installed(datadir, name)) { - fprintf(stderr, "%s: No such pack installed\n", name); + fprintf(stderr, "%s: Not installed\n", name); return NULL; } @@ -409,7 +409,7 @@ pack_install(const char *rootfs, const char *datadir, struct pack *p) snprintf(tmp, PATH_MAX, "%s/%s", datadir, p->name); log(LOG_VERBOSE, "checking installation status\n"); if (inspect_installed(datadir, p->name) == 0) { - fprintf(stderr, "%s: Pack already installed\n", p->name); + fprintf(stderr, "%s: Already installed\n", p->name); return -1; } log(LOG_VERBOSE, "checking for collisions\n"); @@ -426,7 +426,7 @@ pack_install(const char *rootfs, const char *datadir, struct pack *p) r = pack_extract(rootfs, datadir, p); if (r != 0) { - fprintf(stderr, "%s: Installation failed. Deleting pack\n", p->name); + fprintf(stderr, "%s: Extraction failed\n", p->path); pack_delete(rootfs, datadir, p); } @@ -465,10 +465,9 @@ pack_delete(const char *rootfs, const char *datadir, struct pack *p) return ERR_DELETE; } - log(LOG_VERBOSE, "deleting installed files\n"); + log(LOG_VERBOSE, "cleaning installed files\n"); /* ignore errors so everything gets deleted */ if (delete_content(rootfs, addr, st.st_size) < 0) { - fprintf(stderr, "%s: Pack removal failed\n", p->name); close(fd); r = ERR_DELETE; } @@ -478,7 +477,7 @@ pack_delete(const char *rootfs, const char *datadir, struct pack *p) log(LOG_VERBOSE, "cleaning metadata\n"); if (delete_metadata(datadir, p->name) < 0) { - fprintf(stderr, "%s: Metadata removal failed\n", p->name); + fprintf(stderr, "%s/%s: %s\n", datadir, p->name, strerror(errno)); r = ERR_DELETE; } @@ -554,7 +553,7 @@ inspect_collision(const char *rootfs, struct pack *p) chdir(rootfs); while (archive_read_next_header(a, &e) == ARCHIVE_OK) { if (stat(archive_entry_pathname(e), &st) == 0 && !S_ISDIR(st.st_mode)) { - fprintf(stderr, "%s: File exists\n", archive_entry_pathname(e)); + fprintf(stderr, "%s: file exists\n", archive_entry_pathname(e)); r++; break; } @@ -858,14 +857,14 @@ update(const char *rootfs, const char *datadir, char *name) return ERR_PACK_LOAD; if (inspect_installed(datadir, p->name)) { - fprintf(stderr, "%s: No such pack installed\n", p->name); + fprintf(stderr, "%s: not installed\n", p->name); pack_free(p); return ERR_DELETE; } inspect_version(datadir, p->name, ver); if (!overwrite && !strncmp(p->version, ver, LINE_MAX)) { - fprintf(stderr, "%s: Already at version %s\n", p->name, p->version); + fprintf(stderr, "%s: already at version %s\n", p->name, p->version); pack_free(p); return ERR_DELETE; } @@ -880,7 +879,7 @@ update(const char *rootfs, const char *datadir, char *name) overwrite = tmp; if (r == 0) - log(LOG_INFO, "updated %s to %s\n", p->name, p->version); + log(LOG_INFO, "updated %s (%s -> %s)\n", p->name, ver, p->version); pack_free(p); @@ -898,7 +897,7 @@ delete(const char *rootfs, const char *datadir, char *name) struct pack *p = NULL; if (inspect_installed(datadir, name)) { - fprintf(stderr, "%s: No such pack installed\n", name); + fprintf(stderr, "%s: not installed\n", name); return ERR_DELETE; } @@ -908,7 +907,7 @@ delete(const char *rootfs, const char *datadir, char *name) r += pack_delete(rootfs, datadir, p); if (r == 0) - log(LOG_INFO, "deleted %s\n", p->name); + log(LOG_INFO, "deleted %s (%s)\n", p->name, p->version); pack_free(p);