xbps-{install,query}: --repository now accepts relative paths in local repos.
This commit is contained in:
parent
283fb4bc06
commit
b09faadebc
4
NEWS
4
NEWS
@ -1,5 +1,9 @@
|
|||||||
xbps-0.44 (???):
|
xbps-0.44 (???):
|
||||||
|
|
||||||
|
* xbps-{install,query}: the --repository argument now works with relative
|
||||||
|
paths for local repositories. The relative path is always converted to
|
||||||
|
absolute.
|
||||||
|
|
||||||
* libxbps: the provides obj (array of strings) now fully expects exact
|
* libxbps: the provides obj (array of strings) now fully expects exact
|
||||||
pkgver strings, such as `foo-1.0_1`. Incomplete components such as
|
pkgver strings, such as `foo-1.0_1`. Incomplete components such as
|
||||||
`pkgname` or `pkgname-9` are not accepted anymore.
|
`pkgname` or `pkgname-9` are not accepted anymore.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008-2014 Juan Romero Pardines.
|
* Copyright (c) 2008-2015 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -159,10 +159,7 @@ main(int argc, char **argv)
|
|||||||
drun = true;
|
drun = true;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
if (xh.repositories == NULL)
|
xbps_repo_store(&xh, optarg);
|
||||||
xh.repositories = xbps_array_create();
|
|
||||||
|
|
||||||
xbps_array_add_cstring_nocopy(xh.repositories, optarg);
|
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
rootdir = optarg;
|
rootdir = optarg;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008-2014 Juan Romero Pardines.
|
* Copyright (c) 2008-2015 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -170,10 +170,7 @@ main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
if (optarg != NULL) {
|
if (optarg != NULL) {
|
||||||
if (xh.repositories == NULL)
|
xbps_repo_store(&xh, optarg);
|
||||||
xh.repositories = xbps_array_create();
|
|
||||||
|
|
||||||
xbps_array_add_cstring_nocopy(xh.repositories, optarg);
|
|
||||||
}
|
}
|
||||||
repo_mode = true;
|
repo_mode = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008-2014 Juan Romero Pardines.
|
* Copyright (c) 2008-2015 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -48,7 +48,7 @@
|
|||||||
*
|
*
|
||||||
* This header documents the full API for the XBPS Library.
|
* This header documents the full API for the XBPS Library.
|
||||||
*/
|
*/
|
||||||
#define XBPS_API_VERSION "20141209"
|
#define XBPS_API_VERSION "20150110"
|
||||||
|
|
||||||
#ifndef XBPS_VERSION
|
#ifndef XBPS_VERSION
|
||||||
#define XBPS_VERSION "UNSET"
|
#define XBPS_VERSION "UNSET"
|
||||||
@ -1389,6 +1389,16 @@ xbps_dictionary_t xbps_rpool_get_pkg_plist(struct xbps_handle *xhp,
|
|||||||
/** @addtogroup repo */
|
/** @addtogroup repo */
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores repository \a url into the repository pool.
|
||||||
|
*
|
||||||
|
* @param[in] xhp Pointer to the xbps_handle struct.
|
||||||
|
* @param[in] uri Repository URI to store.
|
||||||
|
*
|
||||||
|
* @return True on success, false otherwise.
|
||||||
|
*/
|
||||||
|
bool xbps_repo_store(struct xbps_handle *xhp, const char *url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a repository and returns a xbps_repo object.
|
* Opens a repository and returns a xbps_repo object.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2011-2014 Juan Romero Pardines.
|
* Copyright (c) 2011-2015 Juan Romero Pardines.
|
||||||
* Copyright (c) 2014 Enno Boland.
|
* Copyright (c) 2014 Enno Boland.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@ -137,14 +137,7 @@ store_repo(struct xbps_handle *xhp, const char *repo)
|
|||||||
if (xhp->flags & XBPS_FLAG_IGNORE_CONF_REPOS)
|
if (xhp->flags & XBPS_FLAG_IGNORE_CONF_REPOS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (xhp->repositories == NULL)
|
return xbps_repo_store(xhp, repo);
|
||||||
xhp->repositories = xbps_array_create();
|
|
||||||
|
|
||||||
if (xbps_match_string_in_array(xhp->repositories, repo))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
xbps_array_add_cstring(xhp->repositories, repo);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -496,9 +489,10 @@ xbps_init(struct xbps_handle *xhp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Going back to old working directory */
|
/* Going back to old working directory */
|
||||||
if (chdir(cwd) == -1)
|
if (chdir(cwd) == -1) {
|
||||||
xbps_dbg_printf(xhp, "%s: cannot chdir to %s: %s\n", __func__, cwd, strerror(errno));
|
xbps_dbg_printf(xhp, "%s: cannot chdir to %s: %s\n",
|
||||||
|
__func__, cwd, strerror(errno));
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
39
lib/repo.c
39
lib/repo.c
@ -172,6 +172,45 @@ repo_open_remote(struct xbps_repo *repo)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
xbps_repo_store(struct xbps_handle *xhp, const char *repo)
|
||||||
|
{
|
||||||
|
char *url = NULL;
|
||||||
|
|
||||||
|
assert(xhp);
|
||||||
|
assert(repo);
|
||||||
|
|
||||||
|
if (xhp->repositories == NULL) {
|
||||||
|
xhp->repositories = xbps_array_create();
|
||||||
|
assert(xhp->repositories);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* If it's a local repo and path is relative, make it absolute.
|
||||||
|
*/
|
||||||
|
if (!xbps_repository_is_remote(repo)) {
|
||||||
|
if (repo[0] != '/' && repo[0] != '\0') {
|
||||||
|
if ((url = realpath(repo, NULL)) == NULL)
|
||||||
|
xbps_dbg_printf(xhp, "[repo] %s: realpath %s\n", __func__, repo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (xbps_match_string_in_array(xhp->repositories, url ? url : repo)) {
|
||||||
|
xbps_dbg_printf(xhp, "[repo] `%s' already stored\n", url ? url : repo);
|
||||||
|
if (url)
|
||||||
|
free(url);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (xbps_array_add_cstring(xhp->repositories, url ? url : repo)) {
|
||||||
|
xbps_dbg_printf(xhp, "[repo] `%s' stored successfully\n", url ? url : repo);
|
||||||
|
if (url)
|
||||||
|
free(url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (url)
|
||||||
|
free(url);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct xbps_repo *
|
struct xbps_repo *
|
||||||
xbps_repo_open(struct xbps_handle *xhp, const char *url, bool lock)
|
xbps_repo_open(struct xbps_handle *xhp, const char *url, bool lock)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user