From 4bf2ceb8a301530bb8f9d98fed2b98afcb39eda4 Mon Sep 17 00:00:00 2001 From: ewt Date: Sun, 21 Feb 1999 03:32:56 +0000 Subject: [PATCH] dded FA_ to enum fileActions stuff CVS patchset: 2818 CVS date: 1999/02/21 03:32:56 --- lib/install.c | 57 +++++++++++++++++---------------------------------------- lib/install.h | 4 ++-- lib/uninstall.c | 16 ++++++++-------- 3 files changed, 27 insertions(+), 50 deletions(-) diff --git a/lib/install.c b/lib/install.c index 17178f7..fa5385c 100644 --- a/lib/install.c +++ b/lib/install.c @@ -115,9 +115,7 @@ static int assembleFileList(Header h, struct fileMemory * mem, struct fileInfo * file; int fileCount; int i; - char ** fileLangs; char * chptr; - char ** languages, ** lang; if (!headerGetEntry(h, RPMTAG_FILENAMES, NULL, (void **) &mem->names, fileCountPtr)) @@ -138,20 +136,13 @@ static int assembleFileList(Header h, struct fileMemory * mem, headerGetEntry(h, RPMTAG_FILEMODES, NULL, (void **) &fileModes, NULL); headerGetEntry(h, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, NULL); headerGetEntry(h, RPMTAG_FILELINKTOS, NULL, (void **) &mem->links, NULL); - if (!headerGetEntry(h, RPMTAG_FILELANGS, NULL, (void **) &fileLangs, NULL)) - fileLangs = NULL; - - if ((chptr = getenv("LINGUAS"))) { - languages = splitString(chptr, strlen(chptr), ':'); - } else - languages = NULL; for (i = 0, file = files; i < fileCount; i++, file++) { file->state = RPMFILE_STATE_NORMAL; if (actions) file->action = actions[i]; else - file->action = UNKNOWN; + file->action = FA_UNKNOWN; file->install = 1; file->relativePath = mem->names[i]; @@ -162,24 +153,10 @@ static int assembleFileList(Header h, struct fileMemory * mem, file->size = fileSizes[i]; file->flags = fileFlags[i]; - /* FIXME: move this logic someplace else */ - if (fileLangs && languages && *fileLangs[i]) { - for (lang = languages; *lang; lang++) - if (!strcmp(*lang, fileLangs[i])) break; - if (!*lang) { - file->install = 0; - rpmMessage(RPMMESS_DEBUG, _("not installing %s -- linguas\n"), - file->relativePath); - } - } - rpmMessage(RPMMESS_DEBUG, _(" file: %s action: %s\n"), file->relativePath, fileActionString(file->action)); } - if (fileLangs) free(fileLangs); - if (languages) freeSplitString(languages); - return 0; } @@ -371,12 +348,12 @@ int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h, for (i = 0; i < fileCount; i++) { switch (files[i].action) { - case BACKUP: + case FA_BACKUP: ext = ".rpmorig"; installFile = 1; break; - case ALTNAME: + case FA_ALTNAME: ext = NULL; installFile = 1; @@ -389,29 +366,29 @@ int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h, break; - case SAVE: + case FA_SAVE: ext = ".rpmsave"; installFile = 1; break; - case CREATE: + case FA_CREATE: installFile = 1; ext = NULL; break; - case SKIP: + case FA_SKIP: installFile = 0; ext = NULL; break; - case SKIPNSTATE: + case FA_SKIPNSTATE: installFile = 0; ext = NULL; files[i].state = RPMFILE_STATE_NOTINSTALLED; break; - case UNKNOWN: - case REMOVE: + case FA_UNKNOWN: + case FA_REMOVE: break; } @@ -865,14 +842,14 @@ int rpmVersionCompare(Header first, Header second) { const char * fileActionString(enum fileActions a) { switch (a) { - case UNKNOWN: return "unknown"; - case CREATE: return "create"; - case BACKUP: return "backup"; - case SAVE: return "save"; - case SKIP: return "skip"; - case SKIPNSTATE: return "skipnstate"; - case ALTNAME: return "altname"; - case REMOVE: return "remove"; + case FA_UNKNOWN: return "unknown"; + case FA_CREATE: return "create"; + case FA_BACKUP: return "backup"; + case FA_SAVE: return "save"; + case FA_SKIP: return "skip"; + case FA_SKIPNSTATE: return "skipnstate"; + case FA_ALTNAME: return "altname"; + case FA_REMOVE: return "remove"; } return "???"; diff --git a/lib/install.h b/lib/install.h index 8896fa1..6e85099 100644 --- a/lib/install.h +++ b/lib/install.h @@ -16,8 +16,8 @@ struct sharedFileInfo { int otherPkg; }; -enum fileActions { UNKNOWN = 0, CREATE, BACKUP, SAVE, SKIP, ALTNAME, REMOVE, - SKIPNSTATE }; +enum fileActions { FA_UNKNOWN = 0, FA_CREATE, FA_BACKUP, FA_SAVE, FA_SKIP, + FA_ALTNAME, FA_REMOVE, FA_SKIPNSTATE }; enum fileTypes { XDIR, BDEV, CDEV, SOCK, PIPE, REG, LINK } ; int removeBinaryPackage(char * root, rpmdb db, unsigned int offset, int flags, diff --git a/lib/uninstall.c b/lib/uninstall.c index 35fbc8e..53518d4 100644 --- a/lib/uninstall.c +++ b/lib/uninstall.c @@ -329,7 +329,7 @@ static int removeFile(char * file, unsigned int flags, short mode, switch (action) { - case BACKUP: + case FA_BACKUP: newfile = alloca(strlen(file) + 20); strcpy(newfile, file); strcat(newfile, ".rpmsave"); @@ -340,7 +340,7 @@ static int removeFile(char * file, unsigned int flags, short mode, } break; - case REMOVE: + case FA_REMOVE: if (S_ISDIR(mode)) { if (rmdir(file)) { if (errno == ENOTEMPTY) @@ -363,12 +363,12 @@ static int removeFile(char * file, unsigned int flags, short mode, } } break; - case UNKNOWN: - case CREATE: - case SAVE: - case SKIP: - case SKIPNSTATE: - case ALTNAME: + case FA_UNKNOWN: + case FA_CREATE: + case FA_SAVE: + case FA_SKIP: + case FA_SKIPNSTATE: + case FA_ALTNAME: break; } -- 2.7.4