Don't continue installing a binpkg if newest version in repos is already installed.
--HG-- extra : convert_revision : b73376d091fd95f4cfd92cbdba21f4bc93781504
This commit is contained in:
parent
40b62ee70d
commit
0ed055c4eb
3 changed files with 26 additions and 5 deletions
|
@ -214,7 +214,6 @@ main(int argc, char **argv)
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
/* Install into root directory by default. */
|
|
||||||
rv = xbps_install_binary_pkg(argv[1]);
|
rv = xbps_install_binary_pkg(argv[1]);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
if (rv == EAGAIN) {
|
if (rv == EAGAIN) {
|
||||||
|
@ -224,6 +223,10 @@ main(int argc, char **argv)
|
||||||
dict = xbps_get_pkg_deps_dictionary();
|
dict = xbps_get_pkg_deps_dictionary();
|
||||||
if (dict)
|
if (dict)
|
||||||
show_missing_deps(dict, argv[1]);
|
show_missing_deps(dict, argv[1]);
|
||||||
|
} else if (rv == EEXIST) {
|
||||||
|
printf("Package '%s' is already up to date.\n",
|
||||||
|
argv[1]);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
2
doc/TODO
2
doc/TODO
|
@ -19,8 +19,6 @@ xbps-bin:
|
||||||
* Show binpkg size and installed size for all packages that are going
|
* Show binpkg size and installed size for all packages that are going
|
||||||
to be installed before installation happens.
|
to be installed before installation happens.
|
||||||
* Add support to update packages. [IN PROGRESS]
|
* Add support to update packages. [IN PROGRESS]
|
||||||
* While installing a package, check if version that is going to be
|
|
||||||
installed is already installed. [IN PROGRESS]
|
|
||||||
* Add a flag to reinstall a package version that is already installed,
|
* Add a flag to reinstall a package version that is already installed,
|
||||||
overwritting files on disk and updating required_by if required.
|
overwritting files on disk and updating required_by if required.
|
||||||
Perhaps change the automatic-install object to false, like pkg_install
|
Perhaps change the automatic-install object to false, like pkg_install
|
||||||
|
|
|
@ -90,8 +90,9 @@ static int
|
||||||
install_binpkg_repo_cb(prop_object_t obj, void *arg, bool *cbloop_done)
|
install_binpkg_repo_cb(prop_object_t obj, void *arg, bool *cbloop_done)
|
||||||
{
|
{
|
||||||
prop_dictionary_t repod, pkgrd;
|
prop_dictionary_t repod, pkgrd;
|
||||||
const char *repoloc, *pkgname = arg;
|
size_t len = 0;
|
||||||
char *plist;
|
const char *repoloc, *instver, *pkgname = arg;
|
||||||
|
char *plist, *pkg;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
plist = xbps_get_pkg_index_plist(prop_string_cstring_nocopy(obj));
|
plist = xbps_get_pkg_index_plist(prop_string_cstring_nocopy(obj));
|
||||||
|
@ -116,6 +117,25 @@ install_binpkg_repo_cb(prop_object_t obj, void *arg, bool *cbloop_done)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if available version in repository is already installed,
|
||||||
|
* and return immediately in that case.
|
||||||
|
*/
|
||||||
|
prop_dictionary_get_cstring_nocopy(pkgrd, "version", &instver);
|
||||||
|
len = strlen(pkgname) + strlen(instver) + 2;
|
||||||
|
pkg = malloc(len);
|
||||||
|
if (pkg == NULL) {
|
||||||
|
rv = EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
(void)snprintf(pkg, len, "%s-%s", pkgname, instver);
|
||||||
|
if (xbps_check_is_installed_pkg(pkg) == 0) {
|
||||||
|
free(pkg);
|
||||||
|
rv = EEXIST;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
free(pkg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check SHA256 hash for binary package before anything else.
|
* Check SHA256 hash for binary package before anything else.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue