1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

added a NOSCRIPLET flag to transactions (patch from VMiklos <vmiklos@frugalware.org>)

This commit is contained in:
Aurelien Foret 2006-03-07 18:17:03 +00:00
parent 1bd8f57a18
commit 27be34c09b
4 changed files with 9 additions and 6 deletions

View File

@ -319,7 +319,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
}
/* pre_upgrade scriptlet */
if(info->scriptlet) {
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
_alpm_runscriptlet(handle->root, info->data, "pre_upgrade", info->version, oldpkg ? oldpkg->version : NULL);
}
@ -359,7 +359,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
_alpm_log(PM_LOG_FLOW1, "adding package %s-%s", info->name, info->version);
/* pre_install scriptlet */
if(info->scriptlet) {
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
_alpm_runscriptlet(handle->root, info->data, "pre_install", info->version, NULL);
}
} else {
@ -668,7 +668,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
}
/* run the post-install script if it exists */
if(info->scriptlet) {
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
snprintf(pm_install, PATH_MAX, "%s%s/%s/%s-%s/install", handle->root, handle->dbpath, db->treename, info->name, info->version);
if(pmo_upgrade) {
_alpm_runscriptlet(handle->root, pm_install, "post_upgrade", info->version, oldpkg ? oldpkg->version : NULL);

View File

@ -218,7 +218,7 @@ enum {
#define PM_TRANS_FLAG_NODEPS 0x040
#define PM_TRANS_FLAG_ALLDEPS 0x080
#define PM_TRANS_FLAG_NOCONFLICTS 0x100
#define PM_TRANS_FLAG_NOSCRIPLET 0x200
#define PM_TRANS_FLAG_NOSCRIPTLET 0x200
/* Transaction Events */
enum {

View File

@ -153,7 +153,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
_alpm_log(PM_LOG_FLOW1, "removing package %s-%s", info->name, info->version);
/* run the pre-remove scriptlet if it exists */
if(info->scriptlet) {
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
snprintf(pm_install, PATH_MAX, "%s/%s-%s/install", db->path, info->name, info->version);
_alpm_runscriptlet(handle->root, pm_install, "pre_remove", info->version, NULL);
}
@ -235,7 +235,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
/* run the post-remove script if it exists */
if(info->scriptlet) {
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
char pm_install[PATH_MAX];
snprintf(pm_install, PATH_MAX, "%s/%s-%s/install", db->path, info->name, info->version);
_alpm_runscriptlet(handle->root, pm_install, "post_remove", info->version, NULL);

View File

@ -309,6 +309,7 @@ int parseargs(int argc, char *argv[])
{"ignore", required_argument, 0, 1002},
{"debug", required_argument, 0, 1003},
{"noprogressbar", no_argument, 0, 1004},
{"noscriptlet", no_argument, 0, 1005},
{0, 0, 0, 0}
};
char root[PATH_MAX];
@ -329,6 +330,7 @@ int parseargs(int argc, char *argv[])
case 1002: config->op_s_ignore = list_add(config->op_s_ignore, strdup(optarg)); break;
case 1003: config->debug = atoi(optarg); break;
case 1004: config->noprogressbar = 1; break;
case 1005: config->flags |= PM_TRANS_FLAG_NOSCRIPTLET; break;
case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break;
case 'D':
config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_DEPTEST);
@ -496,6 +498,7 @@ void usage(int op, char *myname)
printf(" --config <path> set an alternate configuration file\n");
printf(" --noconfirm do not ask for anything confirmation\n");
printf(" --noprogressbar do not show a progress bar when downloading files\n");
printf(" --noscriptlet do not execute the install scriptlet if there is any\n");
printf(" -v, --verbose be verbose\n");
printf(" -r, --root <path> set an alternate installation root\n");
printf(" -b, --dbpath <path> set an alternate database location\n");