summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-11-15 08:50:37 +0100
committerAaron Griffin <aaron@archlinux.org>2006-11-15 08:50:37 +0100
commit00ce9ea7394e6e21010d3758e5d949e2b449f64d (patch)
tree1e91d8c80cf2e535978b6fa51031765460234c9d /lib/libalpm/package.c
parent74e780f25df5642e19e6b8cc42ff1432fb7fe1b9 (diff)
downloadpacman-00ce9ea7394e6e21010d3758e5d949e2b449f64d.tar.gz
pacman-00ce9ea7394e6e21010d3758e5d949e2b449f64d.tar.xz
* Initial changes to gensync - makepkg changes were not checked in from another
machine - still pending * Addition of _alpm_pkg_makefilename to simplify the with/without -ARCH prefix scheme we're going with for the interim
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 85d76151..1302ebe5 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -435,6 +435,30 @@ pmpkg_t *_alpm_pkg_isin(char *needle, pmlist_t *haystack)
return(NULL);
}
+char *_alpm_pkg_makefilename(pmpkg_t *pkg)
+{
+ char *fname = NULL;
+ int len = 0, arch_valid = 0;
+
+ len = strlen(pkg->name) + strlen(pkg->version) + strlen(PM_EXT_PKG) + 3;
+ if(pkg->arch && strlen(pkg->arch) > 0) {
+ arch_valid = 1;
+ len += strlen(pkg->arch) + 1;
+ }
+
+ if((fname = (char *)calloc(len, sizeof(char))) == NULL) {
+ RET_ERR(PM_ERR_MEMORY, NULL);
+ }
+
+ if(arch_valid) {
+ snprintf(fname, len-1, "%s-%s-%s" PM_EXT_PKG, pkg->name, pkg->version, pkg->arch);
+ } else {
+ snprintf(fname, len-1, "%s-%s" PM_EXT_PKG, pkg->name, pkg->version);
+ }
+
+ return fname;
+}
+
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
{
char tmp[PKG_FULLNAME_LEN+7];
@@ -456,12 +480,9 @@ int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
*p = '\0';
}
- if((p = _alpm_pkgname_has_arch(tmp))) {
- *p = '\0';
- }
if(witharch) {
/* trim architecture */
- if((p = _alpm_pkgname_has_arch(tmp))) {
+ if((p = alpm_pkg_name_hasarch(tmp))) {
*p = 0;
}
}