Merge pull request #156 from Gottox/atomic-rindex-a
xbps-rindex: check for consistent shlibs
This commit is contained in:
commit
fa635399f0
6
NEWS
6
NEWS
@ -27,6 +27,12 @@ xbps-0.52 (???):
|
|||||||
* xbps-query(1): fix a bug where the output of -o became mixed up
|
* xbps-query(1): fix a bug where the output of -o became mixed up
|
||||||
when running on multiple cores.
|
when running on multiple cores.
|
||||||
|
|
||||||
|
* xbps-rindex: changes introducing inconsistent shlib dependencies will be
|
||||||
|
moved to a stage area and moved to the main repo once all inconsistencies
|
||||||
|
are resolved. Implemented by Enno Boland (@Gottox).
|
||||||
|
|
||||||
|
* libxbps: if a local repository is opened also include the stage area.
|
||||||
|
|
||||||
xbps-0.51 (2015-12-12):
|
xbps-0.51 (2015-12-12):
|
||||||
|
|
||||||
* zsh completion: added -U/--unpack-only support for xbps-install(1).
|
* zsh completion: added -U/--unpack-only support for xbps-install(1).
|
||||||
|
@ -81,7 +81,7 @@ int sign_repo(struct xbps_handle *, const char *, const char *,
|
|||||||
int sign_pkgs(struct xbps_handle *, int, int, char **, const char *, bool);
|
int sign_pkgs(struct xbps_handle *, int, int, char **, const char *, bool);
|
||||||
|
|
||||||
/* From repoflush.c */
|
/* From repoflush.c */
|
||||||
bool repodata_flush(struct xbps_handle *, const char *,
|
bool repodata_flush(struct xbps_handle *, const char *, const char *,
|
||||||
xbps_dictionary_t, xbps_dictionary_t);
|
xbps_dictionary_t, xbps_dictionary_t);
|
||||||
|
|
||||||
#endif /* !_XBPS_RINDEX_DEFS_H_ */
|
#endif /* !_XBPS_RINDEX_DEFS_H_ */
|
||||||
|
@ -54,16 +54,140 @@ set_build_date(const xbps_dictionary_t pkgd, time_t timestamp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
repodata_commit(struct xbps_handle *xhp, const char *repodir,
|
||||||
|
xbps_dictionary_t idx, xbps_dictionary_t meta, xbps_dictionary_t stage) {
|
||||||
|
xbps_object_iterator_t iter;
|
||||||
|
xbps_object_t keysym;
|
||||||
|
int rv;
|
||||||
|
xbps_dictionary_t oldshlibs, usedshlibs;
|
||||||
|
|
||||||
|
if (xbps_dictionary_count(stage) == 0) {
|
||||||
|
// Nothing to do.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find old shlibs-provides
|
||||||
|
*/
|
||||||
|
oldshlibs = xbps_dictionary_create();
|
||||||
|
usedshlibs = xbps_dictionary_create();
|
||||||
|
|
||||||
|
iter = xbps_dictionary_iterator(stage);
|
||||||
|
while ((keysym = xbps_object_iterator_next(iter))) {
|
||||||
|
const char *pkgname = xbps_dictionary_keysym_cstring_nocopy(keysym);
|
||||||
|
xbps_dictionary_t pkg = xbps_dictionary_get(idx, pkgname);
|
||||||
|
xbps_array_t pkgshlibs;
|
||||||
|
|
||||||
|
pkgshlibs = xbps_dictionary_get(pkg, "shlib-provides");
|
||||||
|
for (unsigned int i = 0; i < xbps_array_count(pkgshlibs); i++) {
|
||||||
|
const char *shlib = NULL;
|
||||||
|
xbps_array_get_cstring_nocopy(pkgshlibs, i, &shlib);
|
||||||
|
xbps_dictionary_set_cstring(oldshlibs, shlib, pkgname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xbps_object_iterator_release(iter);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* throw away all unused shlibs
|
||||||
|
*/
|
||||||
|
iter = xbps_dictionary_iterator(idx);
|
||||||
|
while ((keysym = xbps_object_iterator_next(iter))) {
|
||||||
|
const char *pkgname = xbps_dictionary_keysym_cstring_nocopy(keysym);
|
||||||
|
xbps_dictionary_t pkg = xbps_dictionary_get(stage, pkgname);
|
||||||
|
xbps_array_t pkgshlibs;
|
||||||
|
if (!pkg)
|
||||||
|
pkg = xbps_dictionary_get_keysym(idx, keysym);
|
||||||
|
pkgshlibs = xbps_dictionary_get(pkg, "shlib-requires");
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < xbps_array_count(pkgshlibs); i++) {
|
||||||
|
const char *shlib = NULL;
|
||||||
|
xbps_array_t users;
|
||||||
|
xbps_array_get_cstring_nocopy(pkgshlibs, i, &shlib);
|
||||||
|
if (!xbps_dictionary_get(oldshlibs, shlib))
|
||||||
|
continue;
|
||||||
|
users = xbps_dictionary_get(usedshlibs, shlib);
|
||||||
|
if (!users) {
|
||||||
|
users = xbps_array_create();
|
||||||
|
xbps_dictionary_set(usedshlibs, shlib, users);
|
||||||
|
}
|
||||||
|
xbps_array_add_cstring(users, pkgname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xbps_object_iterator_release(iter);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* purge all packages that are fullfilled by the stage
|
||||||
|
*/
|
||||||
|
iter = xbps_dictionary_iterator(stage);
|
||||||
|
while ((keysym = xbps_object_iterator_next(iter))) {
|
||||||
|
xbps_dictionary_t pkg = xbps_dictionary_get_keysym(stage, keysym);
|
||||||
|
xbps_array_t pkgshlibs;
|
||||||
|
|
||||||
|
pkgshlibs = xbps_dictionary_get(pkg, "shlib-provides");
|
||||||
|
for (unsigned int i = 0; i < xbps_array_count(pkgshlibs); i++) {
|
||||||
|
const char *shlib;
|
||||||
|
xbps_array_get_cstring_nocopy(pkgshlibs, i, &shlib);
|
||||||
|
xbps_dictionary_remove(usedshlibs, shlib);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xbps_object_iterator_release(iter);
|
||||||
|
|
||||||
|
if (xbps_dictionary_count(usedshlibs) != 0) {
|
||||||
|
printf("Inconsistent shlibs:\n");
|
||||||
|
iter = xbps_dictionary_iterator(usedshlibs);
|
||||||
|
while ((keysym = xbps_object_iterator_next(iter))) {
|
||||||
|
const char *shlib = xbps_dictionary_keysym_cstring_nocopy(keysym),
|
||||||
|
*provider = NULL, *pre;
|
||||||
|
xbps_array_t users = xbps_dictionary_get(usedshlibs, shlib);
|
||||||
|
xbps_dictionary_get_cstring_nocopy(oldshlibs, shlib, &provider);
|
||||||
|
|
||||||
|
printf(" %s (provided by: %s; used by: ", shlib, provider);
|
||||||
|
pre = "";
|
||||||
|
for (unsigned int i = 0; i < xbps_array_count(users); i++) {
|
||||||
|
const char *user;
|
||||||
|
xbps_array_get_cstring_nocopy(users, i, &user);
|
||||||
|
xbps_dictionary_remove(usedshlibs, shlib);
|
||||||
|
printf("%s%s",pre, user);
|
||||||
|
pre = ", ";
|
||||||
|
}
|
||||||
|
printf(")\n");
|
||||||
|
}
|
||||||
|
printf("Packages are added to stage area.\n");
|
||||||
|
xbps_object_iterator_release(iter);
|
||||||
|
rv = repodata_flush(xhp, repodir, "stagedata", stage, NULL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
char *stagefile;
|
||||||
|
iter = xbps_dictionary_iterator(stage);
|
||||||
|
while ((keysym = xbps_object_iterator_next(iter))) {
|
||||||
|
const char *pkgname = xbps_dictionary_keysym_cstring_nocopy(keysym);
|
||||||
|
xbps_dictionary_t pkg = xbps_dictionary_get_keysym(stage, keysym);
|
||||||
|
const char *pkgver, *arch;
|
||||||
|
xbps_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver);
|
||||||
|
xbps_dictionary_get_cstring_nocopy(pkg, "architecture", &arch);
|
||||||
|
printf("index: added `%s' (%s).\n", pkgver, arch);
|
||||||
|
xbps_dictionary_set(idx, pkgname, pkg);
|
||||||
|
}
|
||||||
|
xbps_object_iterator_release(iter);
|
||||||
|
stagefile = xbps_repo_path_with_name(xhp, repodir, "stagedata");
|
||||||
|
unlink(stagefile);
|
||||||
|
free(stagefile);
|
||||||
|
rv = repodata_flush(xhp, repodir, "repodata", idx, meta);
|
||||||
|
}
|
||||||
|
xbps_object_release(usedshlibs);
|
||||||
|
xbps_object_release(oldshlibs);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force)
|
index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force)
|
||||||
{
|
{
|
||||||
xbps_dictionary_t idx, idxmeta, binpkgd, curpkgd;
|
xbps_dictionary_t idx, idxmeta, idxstage, binpkgd, curpkgd;
|
||||||
struct xbps_repo *repo = NULL;
|
struct xbps_repo *repo = NULL, *stage = NULL;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *tmprepodir = NULL, *repodir = NULL, *rlockfname = NULL;
|
char *tmprepodir = NULL, *repodir = NULL, *rlockfname = NULL;
|
||||||
int rv = 0, ret = 0, rlockfd = -1;
|
int rv = 0, ret = 0, rlockfd = -1;
|
||||||
bool flush = false;
|
|
||||||
|
|
||||||
assert(argv);
|
assert(argv);
|
||||||
/*
|
/*
|
||||||
@ -79,7 +203,7 @@ index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force
|
|||||||
rv = -1;
|
rv = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
repo = xbps_repo_open(xhp, repodir);
|
repo = xbps_repo_public_open(xhp, repodir);
|
||||||
if (repo == NULL && errno != ENOENT) {
|
if (repo == NULL && errno != ENOENT) {
|
||||||
fprintf(stderr, "xbps-rindex: cannot open/lock repository "
|
fprintf(stderr, "xbps-rindex: cannot open/lock repository "
|
||||||
"%s: %s\n", repodir, strerror(errno));
|
"%s: %s\n", repodir, strerror(errno));
|
||||||
@ -93,6 +217,19 @@ index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force
|
|||||||
idx = xbps_dictionary_create();
|
idx = xbps_dictionary_create();
|
||||||
idxmeta = NULL;
|
idxmeta = NULL;
|
||||||
}
|
}
|
||||||
|
stage = xbps_repo_stage_open(xhp, repodir);
|
||||||
|
if (stage == NULL && errno != ENOENT) {
|
||||||
|
fprintf(stderr, "xbps-rindex: cannot open/lock stage repository "
|
||||||
|
"%s: %s\n", repodir, strerror(errno));
|
||||||
|
rv = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
if (stage) {
|
||||||
|
idxstage = xbps_dictionary_copy_mutable(stage->idx);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
idxstage = xbps_dictionary_create();
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Process all packages specified in argv.
|
* Process all packages specified in argv.
|
||||||
*/
|
*/
|
||||||
@ -126,7 +263,9 @@ index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force
|
|||||||
* than current registered package, update the index; otherwise
|
* than current registered package, update the index; otherwise
|
||||||
* pass to the next one.
|
* pass to the next one.
|
||||||
*/
|
*/
|
||||||
curpkgd = xbps_dictionary_get(idx, pkgname);
|
curpkgd = xbps_dictionary_get(idxstage, pkgname);
|
||||||
|
if (curpkgd == NULL)
|
||||||
|
curpkgd = xbps_dictionary_get(idx, pkgname);
|
||||||
if (curpkgd == NULL) {
|
if (curpkgd == NULL) {
|
||||||
if (errno && errno != ENOENT) {
|
if (errno && errno != ENOENT) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
@ -166,12 +305,6 @@ index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force
|
|||||||
free(pkgname);
|
free(pkgname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Current package version is greater than
|
|
||||||
* index version.
|
|
||||||
*/
|
|
||||||
printf("index: removed obsolete entry `%s' (%s).\n", opkgver, oarch);
|
|
||||||
xbps_dictionary_remove(idx, pkgname);
|
|
||||||
free(opkgver);
|
free(opkgver);
|
||||||
free(oarch);
|
free(oarch);
|
||||||
}
|
}
|
||||||
@ -218,16 +351,14 @@ index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force
|
|||||||
xbps_dictionary_remove(binpkgd, "packaged-with");
|
xbps_dictionary_remove(binpkgd, "packaged-with");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add new pkg dictionary into the index.
|
* Add new pkg dictionary into the stage index
|
||||||
*/
|
*/
|
||||||
if (!xbps_dictionary_set(idx, pkgname, binpkgd)) {
|
if (!xbps_dictionary_set(idxstage, pkgname, binpkgd)) {
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
free(pkgver);
|
free(pkgver);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
flush = true;
|
|
||||||
printf("index: added `%s' (%s).\n", pkgver, arch);
|
|
||||||
xbps_object_release(binpkgd);
|
xbps_object_release(binpkgd);
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
free(pkgver);
|
free(pkgver);
|
||||||
@ -235,18 +366,18 @@ index_add(struct xbps_handle *xhp, int args, int argmax, char **argv, bool force
|
|||||||
/*
|
/*
|
||||||
* Generate repository data files.
|
* Generate repository data files.
|
||||||
*/
|
*/
|
||||||
if (flush) {
|
if (!repodata_commit(xhp, repodir, idx, idxmeta, idxstage)) {
|
||||||
if (!repodata_flush(xhp, repodir, idx, idxmeta)) {
|
fprintf(stderr, "%s: failed to write repodata: %s\n",
|
||||||
fprintf(stderr, "%s: failed to write repodata: %s\n",
|
_XBPS_RINDEX, strerror(errno));
|
||||||
_XBPS_RINDEX, strerror(errno));
|
goto out;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printf("index: %u packages registered.\n", xbps_dictionary_count(idx));
|
printf("index: %u packages registered.\n", xbps_dictionary_count(idx));
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (repo)
|
if (repo)
|
||||||
xbps_repo_close(repo);
|
xbps_repo_close(repo);
|
||||||
|
if (stage)
|
||||||
|
xbps_repo_close(stage);
|
||||||
|
|
||||||
xbps_repo_unlock(rlockfd, rlockfname);
|
xbps_repo_unlock(rlockfd, rlockfname);
|
||||||
|
|
||||||
|
@ -88,6 +88,39 @@ out:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cleanup_repo(struct xbps_handle *xhp, const char *repodir, struct xbps_repo *repo,
|
||||||
|
const char *reponame) {
|
||||||
|
int rv = 0;
|
||||||
|
xbps_array_t allkeys;
|
||||||
|
/*
|
||||||
|
* First pass: find out obsolete entries on index and index-files.
|
||||||
|
*/
|
||||||
|
dest = xbps_dictionary_copy_mutable(repo->idx);
|
||||||
|
allkeys = xbps_dictionary_all_keys(dest);
|
||||||
|
(void)xbps_array_foreach_cb_multi(xhp, allkeys, repo->idx, idx_cleaner_cb, __UNCONST(repodir));
|
||||||
|
xbps_object_release(allkeys);
|
||||||
|
|
||||||
|
if(strcmp("stagedata", reponame) == 0 && xbps_dictionary_count(dest) == 0) {
|
||||||
|
char *stagefile = xbps_repo_path_with_name(xhp, repodir, "stagedata");
|
||||||
|
unlink(stagefile);
|
||||||
|
free(stagefile);
|
||||||
|
}
|
||||||
|
if (!xbps_dictionary_equals(dest, repo->idx)) {
|
||||||
|
if (!repodata_flush(xhp, repodir, reponame, dest, repo->idxmeta)) {
|
||||||
|
rv = errno;
|
||||||
|
fprintf(stderr, "failed to write repodata: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(strcmp("stagedata", reponame) == 0)
|
||||||
|
printf("stage: %u packages registered.\n", xbps_dictionary_count(dest));
|
||||||
|
else
|
||||||
|
printf("index: %u packages registered.\n", xbps_dictionary_count(dest));
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Removes stalled pkg entries in repository's XBPS_REPOIDX file, if any
|
* Removes stalled pkg entries in repository's XBPS_REPOIDX file, if any
|
||||||
* binary package cannot be read (unavailable, not enough perms, etc).
|
* binary package cannot be read (unavailable, not enough perms, etc).
|
||||||
@ -95,8 +128,7 @@ out:
|
|||||||
int
|
int
|
||||||
index_clean(struct xbps_handle *xhp, const char *repodir)
|
index_clean(struct xbps_handle *xhp, const char *repodir)
|
||||||
{
|
{
|
||||||
xbps_array_t allkeys;
|
struct xbps_repo *repo, *stage;
|
||||||
struct xbps_repo *repo;
|
|
||||||
char *rlockfname = NULL;
|
char *rlockfname = NULL;
|
||||||
int rv = 0, rlockfd = -1;
|
int rv = 0, rlockfd = -1;
|
||||||
|
|
||||||
@ -106,7 +138,7 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
|
|||||||
_XBPS_RINDEX, strerror(rv));
|
_XBPS_RINDEX, strerror(rv));
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
repo = xbps_repo_open(xhp, repodir);
|
repo = xbps_repo_public_open(xhp, repodir);
|
||||||
if (repo == NULL) {
|
if (repo == NULL) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
if (rv == ENOENT) {
|
if (rv == ENOENT) {
|
||||||
@ -118,33 +150,24 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
|
|||||||
xbps_repo_unlock(rlockfd, rlockfname);
|
xbps_repo_unlock(rlockfd, rlockfname);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
if (repo->idx == NULL) {
|
stage = xbps_repo_stage_open(xhp, repodir);
|
||||||
|
if (repo->idx == NULL || (stage && stage->idx == NULL)) {
|
||||||
fprintf(stderr, "%s: incomplete repository data file!\n", _XBPS_RINDEX);
|
fprintf(stderr, "%s: incomplete repository data file!\n", _XBPS_RINDEX);
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
printf("Cleaning `%s' index, please wait...\n", repodir);
|
printf("Cleaning `%s' index, please wait...\n", repodir);
|
||||||
|
|
||||||
/*
|
if((rv = cleanup_repo(xhp, repodir, repo, "repodata")))
|
||||||
* First pass: find out obsolete entries on index and index-files.
|
goto out;
|
||||||
*/
|
if(stage) {
|
||||||
dest = xbps_dictionary_copy_mutable(repo->idx);
|
cleanup_repo(xhp, repodir, stage, "stagedata");
|
||||||
allkeys = xbps_dictionary_all_keys(dest);
|
|
||||||
(void)xbps_array_foreach_cb_multi(xhp, allkeys, repo->idx, idx_cleaner_cb, __UNCONST(repodir));
|
|
||||||
xbps_object_release(allkeys);
|
|
||||||
|
|
||||||
if (!xbps_dictionary_equals(dest, repo->idx)) {
|
|
||||||
if (!repodata_flush(xhp, repodir, dest, repo->idxmeta)) {
|
|
||||||
rv = errno;
|
|
||||||
fprintf(stderr, "failed to write repodata: %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
printf("index: %u packages registered.\n", xbps_dictionary_count(dest));
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
xbps_repo_close(repo);
|
xbps_repo_close(repo);
|
||||||
|
if(stage)
|
||||||
|
xbps_repo_close(stage);
|
||||||
xbps_repo_unlock(rlockfd, rlockfname);
|
xbps_repo_unlock(rlockfd, rlockfname);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -67,7 +67,7 @@ remove_pkg(const char *repodir, const char *file)
|
|||||||
static int
|
static int
|
||||||
cleaner_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key _unused, void *arg, bool *done _unused)
|
cleaner_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key _unused, void *arg, bool *done _unused)
|
||||||
{
|
{
|
||||||
struct xbps_repo *repo = arg;
|
struct xbps_repo *repo = ((struct xbps_repo **)arg)[0], *stage = ((struct xbps_repo **)arg)[1];
|
||||||
const char *binpkg;
|
const char *binpkg;
|
||||||
char *pkgver, *arch = NULL;
|
char *pkgver, *arch = NULL;
|
||||||
int rv;
|
int rv;
|
||||||
@ -97,7 +97,7 @@ cleaner_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key _unused,
|
|||||||
/*
|
/*
|
||||||
* If binpkg is not registered in index, remove binpkg.
|
* If binpkg is not registered in index, remove binpkg.
|
||||||
*/
|
*/
|
||||||
if (!xbps_repo_get_pkg(repo, pkgver)) {
|
if (!xbps_repo_get_pkg(repo, pkgver) && !(stage && xbps_repo_get_pkg(stage, pkgver))) {
|
||||||
if ((rv = remove_pkg(repo->uri, binpkg)) != 0) {
|
if ((rv = remove_pkg(repo->uri, binpkg)) != 0) {
|
||||||
free(pkgver);
|
free(pkgver);
|
||||||
return 0;
|
return 0;
|
||||||
@ -112,13 +112,13 @@ int
|
|||||||
remove_obsoletes(struct xbps_handle *xhp, const char *repodir)
|
remove_obsoletes(struct xbps_handle *xhp, const char *repodir)
|
||||||
{
|
{
|
||||||
xbps_array_t array = NULL;
|
xbps_array_t array = NULL;
|
||||||
struct xbps_repo *repo;
|
struct xbps_repo *repos[2], *repo, *stage;
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
char *ext;
|
char *ext;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
repo = xbps_repo_open(xhp, repodir);
|
repo = xbps_repo_public_open(xhp, repodir);
|
||||||
if (repo == NULL) {
|
if (repo == NULL) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
fprintf(stderr, "xbps-rindex: cannot read repository data: %s\n",
|
fprintf(stderr, "xbps-rindex: cannot read repository data: %s\n",
|
||||||
@ -127,10 +127,13 @@ remove_obsoletes(struct xbps_handle *xhp, const char *repodir)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
stage = xbps_repo_stage_open(xhp, repodir);
|
||||||
if (chdir(repodir) == -1) {
|
if (chdir(repodir) == -1) {
|
||||||
fprintf(stderr, "xbps-rindex: cannot chdir to %s: %s\n",
|
fprintf(stderr, "xbps-rindex: cannot chdir to %s: %s\n",
|
||||||
repodir, strerror(errno));
|
repodir, strerror(errno));
|
||||||
free(repo);
|
free(repo);
|
||||||
|
if(stage)
|
||||||
|
free(stage);
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
if ((dirp = opendir(repodir)) == NULL) {
|
if ((dirp = opendir(repodir)) == NULL) {
|
||||||
@ -153,8 +156,12 @@ remove_obsoletes(struct xbps_handle *xhp, const char *repodir)
|
|||||||
}
|
}
|
||||||
(void)closedir(dirp);
|
(void)closedir(dirp);
|
||||||
|
|
||||||
rv = xbps_array_foreach_cb_multi(xhp, array, NULL, cleaner_cb, repo);
|
repos[0] = repo;
|
||||||
|
repos[1] = stage;
|
||||||
|
rv = xbps_array_foreach_cb_multi(xhp, array, NULL, cleaner_cb, repos);
|
||||||
xbps_repo_close(repo);
|
xbps_repo_close(repo);
|
||||||
|
if(stage)
|
||||||
|
xbps_repo_close(stage);
|
||||||
xbps_object_release(array);
|
xbps_object_release(array);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
repodata_flush(struct xbps_handle *xhp, const char *repodir,
|
repodata_flush(struct xbps_handle *xhp, const char *repodir,
|
||||||
xbps_dictionary_t idx, xbps_dictionary_t meta)
|
const char *reponame, xbps_dictionary_t idx, xbps_dictionary_t meta)
|
||||||
{
|
{
|
||||||
struct archive *ar;
|
struct archive *ar;
|
||||||
char *repofile, *tname, *buf;
|
char *repofile, *tname, *buf;
|
||||||
@ -47,7 +47,7 @@ repodata_flush(struct xbps_handle *xhp, const char *repodir,
|
|||||||
mode_t mask;
|
mode_t mask;
|
||||||
|
|
||||||
/* Create a tempfile for our repository archive */
|
/* Create a tempfile for our repository archive */
|
||||||
repofile = xbps_repo_path(xhp, repodir);
|
repofile = xbps_repo_path_with_name(xhp, repodir, reponame);
|
||||||
tname = xbps_xasprintf("%s.XXXXXXXXXX", repofile);
|
tname = xbps_xasprintf("%s.XXXXXXXXXX", repofile);
|
||||||
mask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
|
mask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
|
||||||
if ((repofd = mkstemp(tname)) == -1)
|
if ((repofd = mkstemp(tname)) == -1)
|
||||||
|
@ -224,7 +224,7 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
|||||||
_XBPS_RINDEX, strerror(errno));
|
_XBPS_RINDEX, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
flush_failed = repodata_flush(xhp, repodir, repo->idx, meta);
|
flush_failed = repodata_flush(xhp, repodir, "repodata", repo->idx, meta);
|
||||||
xbps_repo_unlock(rlockfd, rlockfname);
|
xbps_repo_unlock(rlockfd, rlockfname);
|
||||||
if (!flush_failed) {
|
if (!flush_failed) {
|
||||||
fprintf(stderr, "failed to write repodata: %s\n", strerror(errno));
|
fprintf(stderr, "failed to write repodata: %s\n", strerror(errno));
|
||||||
|
@ -1499,6 +1499,26 @@ void xbps_repo_unlock(int lockfd, char *lockfname);
|
|||||||
*/
|
*/
|
||||||
struct xbps_repo *xbps_repo_open(struct xbps_handle *xhp, const char *url);
|
struct xbps_repo *xbps_repo_open(struct xbps_handle *xhp, const char *url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens a staging repository and returns a xbps_repo object.
|
||||||
|
*
|
||||||
|
* @param[in] xhp Pointer to the xbps_handle struct.
|
||||||
|
* @param[in] uri Repository URI to match.
|
||||||
|
*
|
||||||
|
* @return The matching repository object, NULL otherwise.
|
||||||
|
*/
|
||||||
|
struct xbps_repo *xbps_repo_stage_open(struct xbps_handle *xhp, const char *url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens a repository and returns a xbps_repo object.
|
||||||
|
*
|
||||||
|
* @param[in] xhp Pointer to the xbps_handle struct.
|
||||||
|
* @param[in] uri Repository URI to match.
|
||||||
|
*
|
||||||
|
* @return The matching repository object, NULL otherwise.
|
||||||
|
*/
|
||||||
|
struct xbps_repo *xbps_repo_public_open(struct xbps_handle *xhp, const char *url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes a repository object and releases resources.
|
* Closes a repository object and releases resources.
|
||||||
*
|
*
|
||||||
@ -1517,6 +1537,18 @@ void xbps_repo_close(struct xbps_repo *repo);
|
|||||||
*/
|
*/
|
||||||
char *xbps_repo_path(struct xbps_handle *xhp, const char *url);
|
char *xbps_repo_path(struct xbps_handle *xhp, const char *url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Returns a heap-allocated string with the repository local path.
|
||||||
|
*
|
||||||
|
* @param[in] xhp The xbps_handle object.
|
||||||
|
* @param[in] url The repository URL to match.
|
||||||
|
* @param[in] name The repository name (stage or repodata)
|
||||||
|
*
|
||||||
|
* @return A heap allocated string that must be free(3)d when it's unneeded.
|
||||||
|
*/
|
||||||
|
char *xbps_repo_path_with_name(struct xbps_handle *xhp, const char *url, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remotely fetch repository data and keep it in memory.
|
* Remotely fetch repository data and keep it in memory.
|
||||||
*
|
*
|
||||||
|
165
lib/repo.c
165
lib/repo.c
@ -46,12 +46,19 @@
|
|||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
xbps_repo_path(struct xbps_handle *xhp, const char *url)
|
xbps_repo_path(struct xbps_handle *xhp, const char *url)
|
||||||
|
{
|
||||||
|
return xbps_repo_path_with_name(xhp, url, "repodata");
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
xbps_repo_path_with_name(struct xbps_handle *xhp, const char *url, const char *name)
|
||||||
{
|
{
|
||||||
assert(xhp);
|
assert(xhp);
|
||||||
assert(url);
|
assert(url);
|
||||||
|
assert(strcmp(name, "repodata") == 0 || strcmp(name, "stagedata") == 0);
|
||||||
|
|
||||||
return xbps_xasprintf("%s/%s-repodata",
|
return xbps_xasprintf("%s/%s-%s",
|
||||||
url, xhp->target_arch ? xhp->target_arch : xhp->native_arch);
|
url, xhp->target_arch ? xhp->target_arch : xhp->native_arch, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static xbps_dictionary_t
|
static xbps_dictionary_t
|
||||||
@ -182,6 +189,72 @@ repo_open_remote(struct xbps_repo *repo)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct xbps_repo *
|
||||||
|
repo_open_with_type(struct xbps_handle *xhp, const char *url, const char *name)
|
||||||
|
{
|
||||||
|
struct xbps_repo *repo;
|
||||||
|
const char *arch;
|
||||||
|
char *repofile;
|
||||||
|
|
||||||
|
assert(xhp);
|
||||||
|
assert(url);
|
||||||
|
|
||||||
|
if (xhp->target_arch)
|
||||||
|
arch = xhp->target_arch;
|
||||||
|
else
|
||||||
|
arch = xhp->native_arch;
|
||||||
|
|
||||||
|
repo = calloc(1, sizeof(struct xbps_repo));
|
||||||
|
assert(repo);
|
||||||
|
repo->fd = -1;
|
||||||
|
repo->xhp = xhp;
|
||||||
|
repo->uri = url;
|
||||||
|
|
||||||
|
if (xbps_repository_is_remote(url)) {
|
||||||
|
/* remote repository */
|
||||||
|
char *rpath;
|
||||||
|
|
||||||
|
if ((rpath = xbps_get_remote_repo_string(url)) == NULL) {
|
||||||
|
free(repo);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
repofile = xbps_xasprintf("%s/%s/%s-%s", xhp->metadir, rpath, arch, name);
|
||||||
|
free(rpath);
|
||||||
|
repo->is_remote = true;
|
||||||
|
} else {
|
||||||
|
/* local repository */
|
||||||
|
repofile = xbps_repo_path_with_name(xhp, url, name);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* In memory repo sync.
|
||||||
|
*/
|
||||||
|
if (repo->is_remote && (xhp->flags & XBPS_FLAG_REPOS_MEMSYNC)) {
|
||||||
|
if (repo_open_remote(repo))
|
||||||
|
return repo;
|
||||||
|
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Open the repository archive.
|
||||||
|
*/
|
||||||
|
repo->fd = open(repofile, O_RDONLY|O_CLOEXEC);
|
||||||
|
if (repo->fd == -1) {
|
||||||
|
int rv = errno;
|
||||||
|
xbps_dbg_printf(xhp, "[repo] `%s' open %s %s\n",
|
||||||
|
repofile, name, strerror(rv));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
if (repo_open_local(repo, repofile)) {
|
||||||
|
free(repofile);
|
||||||
|
return repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
free(repofile);
|
||||||
|
xbps_repo_close(repo);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
xbps_repo_store(struct xbps_handle *xhp, const char *repo)
|
xbps_repo_store(struct xbps_handle *xhp, const char *repo)
|
||||||
{
|
{
|
||||||
@ -221,70 +294,46 @@ xbps_repo_store(struct xbps_handle *xhp, const char *repo)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct xbps_repo *
|
||||||
|
xbps_repo_stage_open(struct xbps_handle *xhp, const char *url)
|
||||||
|
{
|
||||||
|
return repo_open_with_type(xhp, url, "stagedata");
|
||||||
|
}
|
||||||
|
|
||||||
|
struct xbps_repo *
|
||||||
|
xbps_repo_public_open(struct xbps_handle *xhp, const char *url) {
|
||||||
|
return repo_open_with_type(xhp, url, "repodata");
|
||||||
|
}
|
||||||
|
|
||||||
struct xbps_repo *
|
struct xbps_repo *
|
||||||
xbps_repo_open(struct xbps_handle *xhp, const char *url)
|
xbps_repo_open(struct xbps_handle *xhp, const char *url)
|
||||||
{
|
{
|
||||||
struct xbps_repo *repo;
|
struct xbps_repo *repo = xbps_repo_public_open(xhp, url);
|
||||||
const char *arch;
|
struct xbps_repo *stage = NULL;
|
||||||
char *repofile;
|
xbps_dictionary_t idx;
|
||||||
|
const char *pkgname;
|
||||||
assert(xhp);
|
xbps_object_t keysym;
|
||||||
assert(url);
|
xbps_object_iterator_t iter;
|
||||||
|
|
||||||
if (xhp->target_arch)
|
|
||||||
arch = xhp->target_arch;
|
|
||||||
else
|
|
||||||
arch = xhp->native_arch;
|
|
||||||
|
|
||||||
repo = calloc(1, sizeof(struct xbps_repo));
|
|
||||||
assert(repo);
|
|
||||||
repo->fd = -1;
|
|
||||||
repo->xhp = xhp;
|
|
||||||
repo->uri = url;
|
|
||||||
|
|
||||||
if (xbps_repository_is_remote(url)) {
|
|
||||||
/* remote repository */
|
|
||||||
char *rpath;
|
|
||||||
|
|
||||||
if ((rpath = xbps_get_remote_repo_string(url)) == NULL) {
|
|
||||||
free(repo);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
repofile = xbps_xasprintf("%s/%s/%s-repodata", xhp->metadir, rpath, arch);
|
|
||||||
free(rpath);
|
|
||||||
repo->is_remote = true;
|
|
||||||
} else {
|
|
||||||
/* local repository */
|
|
||||||
repofile = xbps_repo_path(xhp, url);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* In memory repo sync.
|
* Load and merge staging repository if the repository is local.
|
||||||
*/
|
*/
|
||||||
if (repo->is_remote && (xhp->flags & XBPS_FLAG_REPOS_MEMSYNC)) {
|
if (!repo->is_remote) {
|
||||||
if (repo_open_remote(repo))
|
stage = xbps_repo_stage_open(xhp, url);
|
||||||
|
if (stage == NULL)
|
||||||
return repo;
|
return repo;
|
||||||
|
idx = xbps_dictionary_copy_mutable(repo->idx);
|
||||||
goto out;
|
iter = xbps_dictionary_iterator(stage->idx);
|
||||||
}
|
while ((keysym = xbps_object_iterator_next(iter))) {
|
||||||
/*
|
pkgname = xbps_dictionary_keysym_cstring_nocopy(keysym);
|
||||||
* Open the repository archive.
|
xbps_dictionary_set(idx, pkgname,
|
||||||
*/
|
xbps_dictionary_get_keysym(stage->idx, keysym));
|
||||||
repo->fd = open(repofile, O_RDONLY|O_CLOEXEC);
|
}
|
||||||
if (repo->fd == -1) {
|
xbps_object_iterator_release(iter);
|
||||||
int rv = errno;
|
xbps_object_release(repo->idx);
|
||||||
xbps_dbg_printf(xhp, "[repo] `%s' open repodata %s\n",
|
repo->idx = idx;
|
||||||
repofile, strerror(rv));
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (repo_open_local(repo, repofile)) {
|
|
||||||
free(repofile);
|
|
||||||
return repo;
|
return repo;
|
||||||
}
|
}
|
||||||
|
return repo;
|
||||||
out:
|
|
||||||
free(repofile);
|
|
||||||
xbps_repo_close(repo);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -3,3 +3,4 @@ syntax("kyuafile", 1)
|
|||||||
test_suite("xbps-rindex")
|
test_suite("xbps-rindex")
|
||||||
atf_test_program{name="add_test"}
|
atf_test_program{name="add_test"}
|
||||||
atf_test_program{name="clean_test"}
|
atf_test_program{name="clean_test"}
|
||||||
|
atf_test_program{name="remove_test"}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
TOPDIR = ../../..
|
TOPDIR = ../../..
|
||||||
-include $(TOPDIR)/config.mk
|
-include $(TOPDIR)/config.mk
|
||||||
|
|
||||||
TESTSHELL = add_test clean_test
|
TESTSHELL = add_test clean_test remove_test
|
||||||
TESTSSUBDIR = xbps/xbps-rindex
|
TESTSSUBDIR = xbps/xbps-rindex
|
||||||
EXTRA_FILES = Kyuafile
|
EXTRA_FILES = Kyuafile
|
||||||
|
|
||||||
|
@ -62,7 +62,55 @@ revert_body() {
|
|||||||
atf_check_equal $rv 0
|
atf_check_equal $rv 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atf_test_case stage
|
||||||
|
|
||||||
|
stage_head() {
|
||||||
|
atf_set "descr" "xbps-rindex(8) -a: commit package to stage test"
|
||||||
|
}
|
||||||
|
|
||||||
|
stage_body() {
|
||||||
|
mkdir -p some_repo pkg_A pkg_B
|
||||||
|
touch pkg_A/file00 pkg_B/file01
|
||||||
|
cd some_repo
|
||||||
|
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" --shlib-provides "libfoo.so.1" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f *-stagedata ]
|
||||||
|
atf_check_equal $? 1
|
||||||
|
|
||||||
|
xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" --shlib-provides "libfoo.so.2" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f *-stagedata ]
|
||||||
|
atf_check_equal $? 1
|
||||||
|
|
||||||
|
xbps-create -A noarch -n bar-1.0_1 -s "foo pkg" --shlib-requires "libfoo.so.2" ../pkg_B
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f *-stagedata ]
|
||||||
|
atf_check_equal $? 1
|
||||||
|
|
||||||
|
xbps-create -A noarch -n foo-1.2_1 -s "foo pkg" --shlib-provides "libfoo.so.3" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f *-stagedata ]
|
||||||
|
atf_check_equal $? 0
|
||||||
|
|
||||||
|
xbps-create -A noarch -n bar-1.1_1 -s "foo pkg" --shlib-requires "libfoo.so.3" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f *-stagedata ]
|
||||||
|
atf_check_equal $? 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
atf_init_test_cases() {
|
atf_init_test_cases() {
|
||||||
atf_add_test_case update
|
atf_add_test_case update
|
||||||
atf_add_test_case revert
|
atf_add_test_case revert
|
||||||
|
atf_add_test_case stage
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,36 @@ issue19_body() {
|
|||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atf_test_case remove_from_stage
|
||||||
|
|
||||||
|
remove_from_stage_head() {
|
||||||
|
atf_set "descr" "xbps-rindex(8) -r: don't removing if there's staging test"
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_from_stage_body() {
|
||||||
|
mkdir -p some_repo pkg_A pkg_B
|
||||||
|
cd some_repo
|
||||||
|
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" --shlib-provides "foo.so.1" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-create -A noarch -n bar-1.0_1 -s "foo pkg" --shlib-requires "foo.so.1" ../pkg_B
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" --shlib-provides "foo.so.2" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f *-stagedata ]
|
||||||
|
atf_check_equal $? 0
|
||||||
|
rm foo-1.1_1*
|
||||||
|
cd ..
|
||||||
|
xbps-rindex -c some_repo
|
||||||
|
[ -f *-stagedata ]
|
||||||
|
atf_check_equal $? 1
|
||||||
|
}
|
||||||
|
|
||||||
atf_init_test_cases() {
|
atf_init_test_cases() {
|
||||||
atf_add_test_case noremove
|
atf_add_test_case noremove
|
||||||
atf_add_test_case issue19
|
atf_add_test_case issue19
|
||||||
|
atf_add_test_case remove_from_stage
|
||||||
}
|
}
|
||||||
|
39
tests/xbps/xbps-rindex/remove_test.sh
Normal file
39
tests/xbps/xbps-rindex/remove_test.sh
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#! /usr/bin/env atf-sh
|
||||||
|
# Test that xbps-rindex(8) -c (clean mode) works as expected.
|
||||||
|
|
||||||
|
# 1st test: make sure that nothing is removed if there are no changes.
|
||||||
|
atf_test_case noremove_stage
|
||||||
|
|
||||||
|
noremove_stage_head() {
|
||||||
|
atf_set "descr" "xbps-rindex(8) -r: don't removing if there's staging test"
|
||||||
|
}
|
||||||
|
|
||||||
|
noremove_stage_body() {
|
||||||
|
mkdir -p some_repo pkg_A pkg_B
|
||||||
|
cd some_repo
|
||||||
|
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" --shlib-provides "foo.so.1" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-create -A noarch -n bar-1.0_1 -s "foo pkg" --shlib-requires "foo.so.1" ../pkg_B
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-create -A noarch -n foo-1.1_1 -s "foo pkg" --shlib-provides "foo.so.2" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f *-stagedata ]
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -r some_repo
|
||||||
|
atf_check_equal $? 0
|
||||||
|
cd some_repo
|
||||||
|
[ -f foo-1.0_1* ]
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f foo-1.1_1* ]
|
||||||
|
atf_check_equal $? 0
|
||||||
|
[ -f bar-1.0_1* ]
|
||||||
|
atf_check_equal $? 0
|
||||||
|
}
|
||||||
|
|
||||||
|
atf_init_test_cases() {
|
||||||
|
atf_add_test_case noremove_stage
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user