[pacman-dev] CVS update of pacman-lib/lib/libalpm (4 files)
Aaron Griffin
aaron at archlinux.org
Mon Feb 12 20:46:33 EST 2007
Date: Monday, February 12, 2007 @ 20:46:33
Author: aaron
Path: /home/cvs-pacman/pacman-lib/lib/libalpm
Modified: alpm.c (1.117 -> 1.118) be_files.c (1.26 -> 1.27)
package.c (1.66 -> 1.67) package.h (1.28 -> 1.29)
Removed desc_localized for the time being. We don't have localized
descriptions, nor do we actually build them with the newest makepkg. The actual
implementation in here seems like it could be done better, and it soaks a large
amount of CPU time according to profilers.
------------+
alpm.c | 1 +
be_files.c | 51 +++++++++++++++++++++++++++++++--------------------
package.c | 10 +++++++---
package.h | 4 ++--
4 files changed, 41 insertions(+), 25 deletions(-)
Index: pacman-lib/lib/libalpm/alpm.c
diff -u pacman-lib/lib/libalpm/alpm.c:1.117 pacman-lib/lib/libalpm/alpm.c:1.118
--- pacman-lib/lib/libalpm/alpm.c:1.117 Sun Feb 11 23:45:21 2007
+++ pacman-lib/lib/libalpm/alpm.c Mon Feb 12 20:46:33 2007
@@ -613,6 +613,7 @@
/** Searches a database
* @param db pointer to the package database to search in
+ * @param needles the list of strings to search for
* @return the list of packages on success, NULL on error
*/
alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, alpm_list_t* needles)
Index: pacman-lib/lib/libalpm/be_files.c
diff -u pacman-lib/lib/libalpm/be_files.c:1.26 pacman-lib/lib/libalpm/be_files.c:1.27
--- pacman-lib/lib/libalpm/be_files.c:1.26 Wed Feb 7 17:08:37 2007
+++ pacman-lib/lib/libalpm/be_files.c Mon Feb 12 20:46:33 2007
@@ -197,8 +197,10 @@
struct stat buf;
char path[PATH_MAX+1];
char line[513];
+ /*
alpm_list_t *tmplist;
char *locale;
+ */
ALPM_LOG_FUNC;
@@ -254,11 +256,16 @@
}
_alpm_strtrim(info->filename);
} else if(!strcmp(line, "%DESC%")) {
+ if(fgets(info->desc, sizeof(info->desc), fp) == NULL) {
+ goto error;
+ }
+ /*
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
info->desc_localized = alpm_list_add(info->desc_localized, strdup(line));
+ PKG_
}
- if((locale = setlocale(LC_ALL, "")) == NULL) { /* To fix segfault when locale invalid */
+ if((locale = setlocale(LC_ALL, "")) == NULL) { //To fix segfault when locale invalid
setenv("LC_ALL", "C", 1);
locale = setlocale(LC_ALL, "");
}
@@ -277,6 +284,7 @@
}
}
}
+ */
_alpm_strtrim(info->desc);
} else if(!strcmp(line, "%GROUPS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
@@ -485,7 +493,7 @@
if(strcmp(db->treename, "local") == 0) {
local = 1;
}
-
+
/* DESC */
if(inforeq & INFRQ_DESC) {
_alpm_log(PM_LOG_DEBUG, _("writing %s-%s DESC information back to db"), info->name, info->version);
@@ -496,13 +504,16 @@
goto cleanup;
}
fprintf(fp, "%%NAME%%\n%s\n\n"
- "%%VERSION%%\n%s\n\n", info->name, info->version);
+ "%%VERSION%%\n%s\n\n", info->name, info->version);
if(info->desc[0]) {
- fputs("%DESC%\n", fp);
- for(lp = info->desc_localized; lp; lp = lp->next) {
+ /*fputs("%DESC%\n", fp);
+ for(lp = info->desc_localized; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
- }
- fprintf(fp, "\n");
+ }
+ fprintf(fp, "\n");
+ */
+ fprintf(fp, "%%DESC%%\n"
+ "%s\n\n", info->desc);
}
if(info->groups) {
fputs("%GROUPS%\n", fp);
@@ -514,7 +525,7 @@
if(local) {
if(info->url[0]) {
fprintf(fp, "%%URL%%\n"
- "%s\n\n", info->url);
+ "%s\n\n", info->url);
}
if(info->license) {
fputs("%LICENSE%\n", fp);
@@ -525,47 +536,47 @@
}
if(info->arch[0]) {
fprintf(fp, "%%ARCH%%\n"
- "%s\n\n", info->arch);
+ "%s\n\n", info->arch);
}
if(info->builddate[0]) {
fprintf(fp, "%%BUILDDATE%%\n"
- "%s\n\n", info->builddate);
+ "%s\n\n", info->builddate);
}
if(info->buildtype[0]) {
fprintf(fp, "%%BUILDTYPE%%\n"
- "%s\n\n", info->buildtype);
+ "%s\n\n", info->buildtype);
}
if(info->installdate[0]) {
fprintf(fp, "%%INSTALLDATE%%\n"
- "%s\n\n", info->installdate);
+ "%s\n\n", info->installdate);
}
if(info->packager[0]) {
fprintf(fp, "%%PACKAGER%%\n"
- "%s\n\n", info->packager);
+ "%s\n\n", info->packager);
}
if(info->size) {
fprintf(fp, "%%SIZE%%\n"
- "%lu\n\n", info->size);
+ "%lu\n\n", info->size);
}
if(info->reason) {
fprintf(fp, "%%REASON%%\n"
- "%u\n\n", info->reason);
+ "%u\n\n", info->reason);
}
} else {
if(info->size) {
fprintf(fp, "%%CSIZE%%\n"
- "%lu\n\n", info->size);
+ "%lu\n\n", info->size);
}
if(info->isize) {
fprintf(fp, "%%ISIZE%%\n"
- "%lu\n\n", info->isize);
+ "%lu\n\n", info->isize);
}
if(info->sha1sum) {
fprintf(fp, "%%SHA1SUM%%\n"
- "%s\n\n", info->sha1sum);
+ "%s\n\n", info->sha1sum);
} else if(info->md5sum) {
fprintf(fp, "%%MD5SUM%%\n"
- "%s\n\n", info->md5sum);
+ "%s\n\n", info->md5sum);
}
}
fclose(fp);
@@ -646,7 +657,7 @@
}
if(info->force) {
fprintf(fp, "%%FORCE%%\n"
- "\n");
+ "\n");
}
}
fclose(fp);
Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.66 pacman-lib/lib/libalpm/package.c:1.67
--- pacman-lib/lib/libalpm/package.c:1.66 Sat Feb 10 18:44:39 2007
+++ pacman-lib/lib/libalpm/package.c Mon Feb 12 20:46:33 2007
@@ -81,7 +81,7 @@
memcpy(newpkg, pkg, sizeof(pmpkg_t));
newpkg->license = alpm_list_strdup(pkg->license);
- newpkg->desc_localized = alpm_list_strdup(pkg->desc_localized);
+ /*newpkg->desc_localized = alpm_list_strdup(pkg->desc_localized);*/
newpkg->requiredby = alpm_list_strdup(pkg->requiredby);
newpkg->conflicts = alpm_list_strdup(pkg->conflicts);
newpkg->files = alpm_list_strdup(pkg->files);
@@ -108,7 +108,7 @@
}
FREELIST(pkg->license);
- FREELIST(pkg->desc_localized);
+ /*FREELIST(pkg->desc_localized);*/
FREELIST(pkg->files);
FREELIST(pkg->backup);
FREELIST(pkg->depends);
@@ -216,6 +216,7 @@
} else if(!strcmp(key, "PKGVER")) {
STRNCPY(info->version, ptr, sizeof(info->version));
} else if(!strcmp(key, "PKGDESC")) {
+ /*
char *lang_tmp;
info->desc_localized = alpm_list_add(info->desc_localized, strdup(ptr));
if((lang_tmp = (char *)malloc(strlen(setlocale(LC_ALL, "")))) == NULL) {
@@ -223,11 +224,14 @@
}
STRNCPY(lang_tmp, setlocale(LC_ALL, ""), strlen(setlocale(LC_ALL, "")));
if(info->desc_localized && !info->desc_localized->next) {
- STRNCPY(info->desc, ptr, sizeof(info->desc));
+ */
+ STRNCPY(info->desc, ptr, sizeof(info->desc));
+ /*
} else if (ptr && !strncmp(ptr, lang_tmp, strlen(lang_tmp))) {
STRNCPY(info->desc, ptr+strlen(lang_tmp)+1, sizeof(info->desc));
}
FREE(lang_tmp);
+ */
} else if(!strcmp(key, "GROUP")) {
info->groups = alpm_list_add(info->groups, strdup(ptr));
} else if(!strcmp(key, "URL")) {
Index: pacman-lib/lib/libalpm/package.h
diff -u pacman-lib/lib/libalpm/package.h:1.28 pacman-lib/lib/libalpm/package.h:1.29
--- pacman-lib/lib/libalpm/package.h:1.28 Sat Feb 10 18:50:31 2007
+++ pacman-lib/lib/libalpm/package.h Mon Feb 12 20:46:33 2007
@@ -41,7 +41,7 @@
#define PKG_FILENAME_LEN 512
#define PKG_NAME_LEN 256
#define PKG_VERSION_LEN 64
-#define PKG_FULLNAME_LEN (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1
+#define PKG_FULLNAME_LEN (PKG_NAME_LEN + PKG_VERSION_LEN)
#define PKG_DESC_LEN 512
#define PKG_URL_LEN 256
#define PKG_DATE_LEN 32
@@ -70,7 +70,7 @@
unsigned short force;
time_t date;
pmpkgreason_t reason;
- alpm_list_t *desc_localized;
+ /* alpm_list_t *desc_localized;*/
alpm_list_t *license;
alpm_list_t *replaces;
alpm_list_t *groups;
More information about the pacman-dev
mailing list