summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-17 23:25:07 -0400
committerDan McGee <dan@archlinux.org>2007-09-28 00:16:43 -0500
commitf7bbfe4052ca1060d2d1021dacd77923d8ab6786 (patch)
treec1013c79b1148874ff30effe4c84c99eb69b5a86 /lib/libalpm/package.c
parent0758012b6617fd25f3af84853611b9adaf65f674 (diff)
downloadpacman-f7bbfe4052ca1060d2d1021dacd77923d8ab6786.tar.xz
Remove package name dependency from libalpm
Previously, package names must match a specified scheme or they will cause pacman add operations to fail. This is not a very intelligent or necessary way to act, so remove the dependency on the name of the package to be installed and read all relevant information from the metadata instead. This does have one causality to be addressed later- pacman cache cleaning functionality, which has never been phenomenal, just lost most capability. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c101
1 files changed, 2 insertions, 99 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 4a6e62b9..30d77a74 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -65,7 +65,8 @@ int SYMEXPORT alpm_pkg_load(const char *filename, pmpkg_t **pkg)
_alpm_log(PM_LOG_FUNCTION, "enter alpm_pkg_load\n");
/* Sanity checks */
- ASSERT(filename != NULL && strlen(filename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
+ ASSERT(filename != NULL && strlen(filename) != 0,
+ RET_ERR(PM_ERR_WRONG_ARGS, -1));
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
*pkg = _alpm_pkg_load(filename);
@@ -151,51 +152,6 @@ int SYMEXPORT alpm_pkg_vercmp(const char *ver1, const char *ver2)
return(_alpm_versioncmp(ver1, ver2));
}
-/* internal */
-static char *_supported_archs[] = {
- "i586",
- "i686",
- "ppc",
- "x86_64",
-};
-
-/**
- * @brief Determine if a package name has -ARCH tacked on.
- * @param pkgname name of the package to parse
- * @return pointer to start of -ARCH text if it exists, else NULL
- */
-char SYMEXPORT *alpm_pkg_name_hasarch(const char *pkgname)
-{
- /* TODO remove this when we transfer everything over to -ARCH
- *
- * this parsing sucks... it's done to support
- * two package formats for the time being:
- * package-name-foo-1.0.0-1-i686
- * and
- * package-name-bar-1.2.3-1
- */
- size_t i = 0;
- char *arch, *cmp, *p;
-
- ALPM_LOG_FUNC;
-
- if((p = strrchr(pkgname, '-'))) {
- for(i=0; i < sizeof(_supported_archs)/sizeof(char*); ++i) {
- cmp = p+1;
- arch = _supported_archs[i];
-
- /* whee, case insensitive compare */
- while(*arch && *cmp && tolower(*arch++) == tolower(*cmp++)) ;
- if(*arch || *cmp) {
- continue;
- }
-
- return(p);
- }
- }
- return(NULL);
-}
-
const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -1113,59 +1069,6 @@ pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack)
return(NULL);
}
-int _alpm_pkg_splitname(const char *target, char *name, char *version, int witharch)
-{
- char tmp[PKG_FULLNAME_LEN+7];
- const char *t;
- char *p, *q;
-
- ALPM_LOG_FUNC;
-
- if(target == NULL) {
- return(-1);
- }
-
- /* trim path name (if any) */
- if((t = strrchr(target, '/')) == NULL) {
- t = target;
- } else {
- t++;
- }
- strncpy(tmp, t, PKG_FULLNAME_LEN+7);
- /* trim file extension (if any) */
- if((p = strstr(tmp, PKGEXT))) {
- *p = '\0';
- }
-
- if(witharch) {
- /* trim architecture */
- if((p = alpm_pkg_name_hasarch(tmp))) {
- *p = '\0';
- }
- }
-
- p = tmp + strlen(tmp);
-
- for(q = --p; *q && *q != '-'; q--);
- if(*q != '-' || q == tmp) {
- return(-1);
- }
- for(p = --q; *p && *p != '-'; p--);
- if(*p != '-' || p == tmp) {
- return(-1);
- }
- if(version) {
- strncpy(version, p+1, PKG_VERSION_LEN);
- }
- *p = '\0';
-
- if(name) {
- strncpy(name, tmp, PKG_NAME_LEN);
- }
-
- return(0);
-}
-
/* fill in requiredby field of package,
* used when we want to install or add a package */
void _alpm_pkg_update_requiredby(pmpkg_t *pkg)