When executing the INSTALL/REMOVE scripts, always pass the UPDATE

value to them.

Bump XBPS_RELVER to 20091209.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091209151435-1yy9f7k2880tswz7
This commit is contained in:
Juan RP 2009-12-09 16:14:35 +01:00
parent 026dc6dbd9
commit eb885bbcc2
5 changed files with 26 additions and 13 deletions

View File

@ -482,14 +482,14 @@ exec_transaction(struct transaction *trans)
prop_object_iterator_t replaces_iter; prop_object_iterator_t replaces_iter;
const char *pkgname, *version, *pkgver, *instver, *filename, *tract; const char *pkgname, *version, *pkgver, *instver, *filename, *tract;
int rv = 0; int rv = 0;
bool essential, autoinst; bool update, essential, autoinst;
pkg_state_t state = 0; pkg_state_t state = 0;
assert(trans != NULL); assert(trans != NULL);
assert(trans->dict != NULL); assert(trans->dict != NULL);
assert(trans->iter != NULL); assert(trans->iter != NULL);
essential = autoinst = false; update = essential = autoinst = false;
/* /*
* Show download/installed size for the transaction. * Show download/installed size for the transaction.
*/ */
@ -646,7 +646,14 @@ exec_transaction(struct transaction *trans)
if (!prop_dictionary_get_cstring_nocopy(obj, if (!prop_dictionary_get_cstring_nocopy(obj,
"version", &version)) "version", &version))
return errno; return errno;
if ((rv = xbps_configure_pkg(pkgname, version, false)) != 0) { if (!prop_dictionary_get_cstring_nocopy(obj,
"trans-action", &tract))
return errno;
update = false;
if (strcmp(tract, "update") == 0)
update = true;
rv = xbps_configure_pkg(pkgname, version, false, update);
if (rv != 0) {
printf("Error configuring package %s (%s)\n", printf("Error configuring package %s (%s)\n",
pkgname, strerror(rv)); pkgname, strerror(rv));
return rv; return rv;

View File

@ -280,7 +280,7 @@ main(int argc, char **argv)
if (strcasecmp(argv[1], "all") == 0) if (strcasecmp(argv[1], "all") == 0)
rv = xbps_configure_all_pkgs(); rv = xbps_configure_all_pkgs();
else else
rv = xbps_configure_pkg(argv[1], NULL, true); rv = xbps_configure_pkg(argv[1], NULL, true, false);
} else if (strcasecmp(argv[0], "show-deps") == 0) { } else if (strcasecmp(argv[0], "show-deps") == 0) {
/* /*

View File

@ -40,7 +40,7 @@
#include <archive_entry.h> #include <archive_entry.h>
/* Current release version */ /* Current release version */
#define XBPS_RELVER "20091207" #define XBPS_RELVER "20091209"
/* Default root PATH for xbps to store metadata info. */ /* Default root PATH for xbps to store metadata info. */
#define XBPS_META_PATH "/var/db/xbps" #define XBPS_META_PATH "/var/db/xbps"
@ -102,7 +102,7 @@ int xbps_config_file_from_archive_entry(prop_dictionary_t,
bool *); bool *);
/* From lib/configure.c */ /* From lib/configure.c */
int SYMEXPORT xbps_configure_pkg(const char *, const char *, bool); int SYMEXPORT xbps_configure_pkg(const char *, const char *, bool, bool);
int SYMEXPORT xbps_configure_all_pkgs(void); int SYMEXPORT xbps_configure_all_pkgs(void);
/* from lib/cmpver.c */ /* from lib/cmpver.c */

View File

@ -67,7 +67,8 @@ xbps_configure_all_pkgs(void)
break; break;
if (state != XBPS_PKG_STATE_UNPACKED) if (state != XBPS_PKG_STATE_UNPACKED)
continue; continue;
if ((rv = xbps_configure_pkg(pkgname, version, false)) != 0) if ((rv = xbps_configure_pkg(pkgname, version,
false, false)) != 0)
break; break;
} }
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
@ -83,7 +84,8 @@ out:
* to installed. * to installed.
*/ */
int SYMEXPORT int SYMEXPORT
xbps_configure_pkg(const char *pkgname, const char *version, bool check_state) xbps_configure_pkg(const char *pkgname, const char *version, bool check_state,
bool update)
{ {
prop_dictionary_t pkgd; prop_dictionary_t pkgd;
const char *rootdir, *lver; const char *rootdir, *lver;
@ -141,7 +143,7 @@ xbps_configure_pkg(const char *pkgname, const char *version, bool check_state)
if (access(buf, X_OK) == 0) { if (access(buf, X_OK) == 0) {
if ((rv = xbps_file_chdir_exec(rootdir, buf, "post", if ((rv = xbps_file_chdir_exec(rootdir, buf, "post",
pkgname, lver, NULL)) != 0) { pkgname, lver, update ? "yes" : "no", NULL)) != 0) {
free(buf); free(buf);
printf("%s: post INSTALL action returned: %s\n", printf("%s: post INSTALL action returned: %s\n",
pkgname, strerror(errno)); pkgname, strerror(errno));

View File

@ -124,13 +124,13 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
const char *pkgname, *version, *rootdir, *entry_str; const char *pkgname, *version, *rootdir, *entry_str;
char *buf, *buf2; char *buf, *buf2;
int rv = 0, flags, lflags; int rv = 0, flags, lflags;
bool essential, preserve, actgt, skip_entry; bool essential, preserve, actgt, skip_entry, update;
bool props_plist_found, files_plist_found; bool props_plist_found, files_plist_found;
assert(ar != NULL); assert(ar != NULL);
assert(pkg != NULL); assert(pkg != NULL);
essential = preserve = actgt = skip_entry = false; essential = preserve = actgt = skip_entry = update = false;
props_plist_found = files_plist_found = false; props_plist_found = files_plist_found = false;
rootdir = xbps_get_rootdir(); rootdir = xbps_get_rootdir();
flags = xbps_get_flags(); flags = xbps_get_flags();
@ -151,6 +151,9 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
prop_dictionary_get_bool(pkg, "essential", &essential); prop_dictionary_get_bool(pkg, "essential", &essential);
prop_dictionary_get_bool(pkg, "preserve", &preserve); prop_dictionary_get_bool(pkg, "preserve", &preserve);
if (xbps_check_is_installed_pkgname(pkgname))
update = true;
while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) { while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) {
if (entry_idx >= 5) { if (entry_idx >= 5) {
/* /*
@ -194,9 +197,10 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
return rv; return rv;
} }
} }
if ((rv = xbps_file_chdir_exec(rootdir, buf, "pre", if ((rv = xbps_file_chdir_exec(rootdir, buf, "pre",
pkgname, version, NULL)) != 0) { pkgname, version, update ? "yes" : "no",
NULL)) != 0) {
free(buf); free(buf);
printf("%s: preinst action target error %s\n", printf("%s: preinst action target error %s\n",
pkgname, strerror(errno)); pkgname, strerror(errno));