summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/alpm.h6
-rw-r--r--lib/libalpm/db.c14
-rw-r--r--src/pacman/util.c17
3 files changed, 7 insertions, 30 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 91cf124b..845bd478 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -298,12 +298,6 @@ int alpm_db_unregister_all(pmhandle_t *handle);
*/
const char *alpm_db_get_name(const pmdb_t *db);
-/** Get a download URL for the package database.
- * @param db pointer to the package database
- * @return a fully-specified download URL, NULL on error
- */
-const char *alpm_db_get_url(const pmdb_t *db);
-
/** @name Accessors to the list of servers for a database.
* @{
*/
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 5b272eac..0584a36f 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -231,20 +231,6 @@ const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
return db->treename;
}
-/** Get a download URL for the package database. */
-const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
-{
- char *url;
-
- ASSERT(db != NULL, return NULL);
- ASSERT(db->servers != NULL, return NULL);
-
- url = (char *)db->servers->data;
-
- return url;
-}
-
-
/** Get a package entry from a package database. */
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
{
diff --git a/src/pacman/util.c b/src/pacman/util.c
index a71c3cfd..3b4d0294 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -783,22 +783,19 @@ static off_t pkg_get_size(pmpkg_t *pkg)
static char *pkg_get_location(pmpkg_t *pkg)
{
- pmdb_t *db;
- const char *dburl;
- char *string;
+ alpm_list_t *servers;
+ char *string = NULL;
switch(config->op) {
case PM_OP_SYNC:
- db = alpm_pkg_get_db(pkg);
- dburl = alpm_db_get_url(db);
- if(dburl) {
- char *pkgurl = NULL;
- pm_asprintf(&pkgurl, "%s/%s", dburl, alpm_pkg_get_filename(pkg));
- return pkgurl;
+ servers = alpm_db_get_servers(alpm_pkg_get_db(pkg));
+ if(servers) {
+ pm_asprintf(&string, "%s/%s", alpm_list_getdata(servers),
+ alpm_pkg_get_filename(pkg));
+ return string;
}
case PM_OP_UPGRADE:
return strdup(alpm_pkg_get_filename(pkg));
default:
- string = NULL;
pm_asprintf(&string, "%s-%s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
return string;
}