xbps-bin: it's possible to reinstall any pkg with '-f' option.

This commit is contained in:
Juan RP 2011-12-20 16:08:23 +01:00
parent 6ad7289d68
commit a5d9eb9853
6 changed files with 24 additions and 15 deletions

4
NEWS
View File

@ -1,5 +1,9 @@
xbps-0.11.0 (???): xbps-0.11.0 (???):
* xbps-bin(8): it is possible now to reinstall a package even if it's
installed with the '-f' option. If reinstalling the same package version,
only unexistent files or files not matching its hash will be extracted.
* While unpacking a binary package, always check that file to be extracted * While unpacking a binary package, always check that file to be extracted
exists on filesystem, if true and its hash is matched, skip extraction. exists on filesystem, if true and its hash is matched, skip extraction.

6
TODO
View File

@ -3,12 +3,6 @@ libxbps:
- properties: (hold) still unimplemented. - properties: (hold) still unimplemented.
- properties: (update-first) still unimplemented. - properties: (update-first) still unimplemented.
xbps-bin:
- Add a flag (or use -f install) to force reinstallation of any
installed package (if same version is available) and preserve
requiredby entries, but overwritting those files that weren't
matched by the hash.
xbps-repo: xbps-repo:
- New target to clean binpkgs in cachedir that aren't available on - New target to clean binpkgs in cachedir that aren't available on
any registered repository or its hash doesn't match. any registered repository or its hash doesn't match.

View File

@ -45,7 +45,7 @@ struct list_pkgver_cb {
}; };
/* from transaction.c */ /* from transaction.c */
int install_new_pkg(const char *); int install_new_pkg(const char *, bool);
int update_pkg(const char *); int update_pkg(const char *);
int remove_pkg(const char *, bool, bool); int remove_pkg(const char *, bool, bool);
int autoupdate_pkgs(bool, bool); int autoupdate_pkgs(bool, bool);

View File

@ -70,11 +70,12 @@ main(int argc, char **argv)
int i, c, flags, rv; int i, c, flags, rv;
bool yes, purge, debug, reqby_force, force_rm_with_deps, recursive_rm; bool yes, purge, debug, reqby_force, force_rm_with_deps, recursive_rm;
bool install_auto, install_manual, show_download_pkglist_url; bool install_auto, install_manual, show_download_pkglist_url;
bool reinstall;
rootdir = cachedir = conffile = option = NULL; rootdir = cachedir = conffile = option = NULL;
flags = rv = 0; flags = rv = 0;
reqby_force = yes = purge = force_rm_with_deps = false; reqby_force = yes = purge = force_rm_with_deps = false;
recursive_rm = debug = false; recursive_rm = debug = reinstall = false;
install_auto = install_manual = show_download_pkglist_url = false; install_auto = install_manual = show_download_pkglist_url = false;
while ((c = getopt(argc, argv, "AC:c:dDFfMo:pRr:Vvy")) != -1) { while ((c = getopt(argc, argv, "AC:c:dDFfMo:pRr:Vvy")) != -1) {
@ -98,6 +99,7 @@ main(int argc, char **argv)
force_rm_with_deps = true; force_rm_with_deps = true;
break; break;
case 'f': case 'f':
reinstall = true;
flags |= XBPS_FLAG_FORCE_CONFIGURE; flags |= XBPS_FLAG_FORCE_CONFIGURE;
flags |= XBPS_FLAG_FORCE_REMOVE_FILES; flags |= XBPS_FLAG_FORCE_REMOVE_FILES;
break; break;
@ -227,7 +229,7 @@ main(int argc, char **argv)
usage(xhp); usage(xhp);
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
if ((rv = install_new_pkg(argv[i])) != 0) if ((rv = install_new_pkg(argv[i], reinstall)) != 0)
goto out; goto out;
rv = exec_transaction(yes, show_download_pkglist_url); rv = exec_transaction(yes, show_download_pkglist_url);

View File

@ -240,7 +240,7 @@ autoremove_pkgs(bool yes, bool purge)
} }
int int
install_new_pkg(const char *pkg) install_new_pkg(const char *pkg, bool reinstall)
{ {
prop_dictionary_t pkgd; prop_dictionary_t pkgd;
char *pkgname = NULL, *pkgpatt = NULL; char *pkgname = NULL, *pkgpatt = NULL;
@ -273,10 +273,14 @@ install_new_pkg(const char *pkg)
} }
prop_object_release(pkgd); prop_object_release(pkgd);
if (state == XBPS_PKG_STATE_INSTALLED) { if (state == XBPS_PKG_STATE_INSTALLED) {
printf("Package '%s' is already installed.\n", pkgname); if (!reinstall) {
goto out; printf("Package '%s' is already installed.\n",
pkgname);
goto out;
}
} else {
printf("Package `%s' needs to be configured.\n", pkgname);
} }
printf("Package `%s' needs to be configured.\n", pkgname);
} }
if ((rv = xbps_transaction_install_pkg(pkgpatt)) != 0) { if ((rv = xbps_transaction_install_pkg(pkgpatt)) != 0) {
if (rv == ENOENT) { if (rv == ENOENT) {

View File

@ -1,4 +1,4 @@
.Dd December 15, 2011 .Dd December 20, 2011
.Os Void GNU/Linux .Os Void GNU/Linux
.Dt xbps-bin 8 .Dt xbps-bin 8
.Sh NAME .Sh NAME
@ -59,6 +59,7 @@ target. If set, package will be removed even if other packages are currently
depending on it, i.e package is a dependency of any other installed package. depending on it, i.e package is a dependency of any other installed package.
.It Fl f .It Fl f
Used currently in the Used currently in the
.Em install ,
.Em purge , .Em purge ,
.Em reconfigure .Em reconfigure
and and
@ -71,7 +72,11 @@ removal of package files even if its hash does not match in the
.Em purge .Em purge
and and
.Em remove .Em remove
targets. targets. If set, package(s) will be reinstalled even if its state is
.Em installed
when used with the
.Em install
target.
.It Fl M .It Fl M
Sets the Sets the
.Em automatic-install .Em automatic-install