summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-02-13 02:46:33 +0100
committerAaron Griffin <aaron@archlinux.org>2007-02-13 02:46:33 +0100
commitaf48c695eb154410cf6f69c7aa9baf92a33a752c (patch)
treeab1e4f271b6ffaa2035804dda3ecf9424e315de4
parent89099871a4c5404eba9915bf1dda7976e54d0e8b (diff)
downloadpacman-af48c695eb154410cf6f69c7aa9baf92a33a752c.tar.gz
pacman-af48c695eb154410cf6f69c7aa9baf92a33a752c.tar.xz
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.
-rw-r--r--lib/libalpm/alpm.c1
-rw-r--r--lib/libalpm/be_files.c51
-rw-r--r--lib/libalpm/package.c10
-rw-r--r--lib/libalpm/package.h4
4 files changed, 41 insertions, 25 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 83acef85..b55d4d27 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -613,6 +613,7 @@ char SYMEXPORT *alpm_pkg_name_hasarch(char *pkgname)
/** 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)
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index d162da09..39b7c724 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -197,8 +197,10 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
struct stat buf;
char path[PATH_MAX+1];
char line[513];
+ /*
alpm_list_t *tmplist;
char *locale;
+ */
ALPM_LOG_FUNC;
@@ -254,11 +256,16 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
}
_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 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
}
}
}
+ */
_alpm_strtrim(info->desc);
} else if(!strcmp(line, "%GROUPS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
@@ -485,7 +493,7 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
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 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
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 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
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 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
}
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 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
}
if(info->force) {
fprintf(fp, "%%FORCE%%\n"
- "\n");
+ "\n");
}
}
fclose(fp);
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 7ac2ca8e..fa9f0f6b 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -81,7 +81,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
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 @@ void _alpm_pkg_free(void *data)
}
FREELIST(pkg->license);
- FREELIST(pkg->desc_localized);
+ /*FREELIST(pkg->desc_localized);*/
FREELIST(pkg->files);
FREELIST(pkg->backup);
FREELIST(pkg->depends);
@@ -216,6 +216,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info)
} 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 @@ static int parse_descfile(char *descfile, pmpkg_t *info)
}
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")) {
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 636512bb..7de82375 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -41,7 +41,7 @@ typedef enum _pmpkgfrom_t {
#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 @@ struct __pmpkg_t {
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;