Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-23 17:18:31 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-23 17:18:31 +0000
commite2b474b1309594c610a2cf25f35b349575d88223 (patch)
tree47e19d9745c290cca2b5a8fb3bee1d6150a41b59 /lib/libalpm/package.c
parente56980597b90b5107f577c25b25c1a0818d61d7a (diff)
rework the cache handling to avoid as much as possible calls to db_scan()
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 0d106893..b5e5bf36 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -71,6 +71,45 @@ pmpkg_t *pkg_new()
return(pkg);
}
+pmpkg_t *pkg_dup(pmpkg_t *pkg)
+{
+ pmpkg_t* newpkg = NULL;
+
+ newpkg = (pmpkg_t *)malloc(sizeof(pmpkg_t));
+ if(newpkg == NULL) {
+ return(NULL);
+ }
+
+ STRNCPY(newpkg->name, pkg->name, PKG_NAME_LEN);
+ STRNCPY(newpkg->version, pkg->version, PKG_VERSION_LEN);
+ STRNCPY(newpkg->desc, pkg->desc, PKG_DESC_LEN);
+ STRNCPY(newpkg->url, pkg->url, PKG_URL_LEN);
+ STRNCPY(newpkg->license, pkg->license, PKG_LICENSE_LEN);
+ STRNCPY(newpkg->builddate, pkg->builddate, PKG_DATE_LEN);
+ STRNCPY(newpkg->installdate, pkg->installdate, PKG_DATE_LEN);
+ STRNCPY(newpkg->packager, pkg->packager, PKG_PACKAGER_LEN);
+ STRNCPY(newpkg->md5sum, pkg->md5sum, PKG_MD5SUM_LEN);
+ STRNCPY(newpkg->arch, pkg->arch, PKG_ARCH_LEN);
+ newpkg->size = pkg->size;
+ newpkg->force = pkg->force;
+ newpkg->scriptlet = pkg->scriptlet;
+ newpkg->reason = pkg->reason;
+ newpkg->requiredby = _alpm_list_strdup(pkg->requiredby);
+ newpkg->conflicts = _alpm_list_strdup(pkg->conflicts);
+ newpkg->files = _alpm_list_strdup(pkg->files);
+ newpkg->backup = _alpm_list_strdup(pkg->backup);
+ newpkg->depends = _alpm_list_strdup(pkg->depends);
+ newpkg->groups = _alpm_list_strdup(pkg->groups);
+ newpkg->provides = _alpm_list_strdup(pkg->provides);
+ newpkg->replaces = _alpm_list_strdup(pkg->replaces);
+ /* internal */
+ newpkg->origin = pkg->origin;
+ newpkg->data = (newpkg->origin == PKG_FROM_FILE) ? strdup(pkg->data) : pkg->data;
+ newpkg->infolevel = pkg->infolevel;
+
+ return(newpkg);
+}
+
void pkg_free(pmpkg_t *pkg)
{
if(pkg == NULL) {