The following commit has been merged in the master branch:
commit ab95f0bb2f53452994f3d48a0802ab34622c8d67
Author: Guillem Jover <[email protected]>
Date: Sat Aug 22 01:43:57 2009 +0200
Pass ‘struct pkginfoperfile’ from maint script functions to do_script
This allows us to retrieve package information from either the installed
package or the one being installed from the maintainer script invoking
functions.
diff --git a/src/help.c b/src/help.c
index 089d91d..c824175 100644
--- a/src/help.c
+++ b/src/help.c
@@ -247,7 +247,7 @@ static void setexecute(const char *path, struct stat *stab)
{
}
static int
-do_script(struct pkginfo *pkg,
+do_script(struct pkginfo *pkg, struct pkginfoperfile *pif,
const char *scriptname, const char *scriptpath, struct stat *stab,
char *const arglist[], const char *desc, const char *name, int warn)
{
@@ -302,7 +302,8 @@ vmaintainer_script_installed(struct pkginfo *pkg, const
char *scriptname,
}
ohshite(_("unable to stat %s `%.250s'"), buf, scriptpath);
}
- do_script(pkg, scriptname, scriptpath, &stab, arglist, _("unable to execute
%s"), buf, 0);
+ do_script(pkg, &pkg->installed, scriptname, scriptpath, &stab,
+ arglist, _("unable to execute %s"), buf, 0);
return 1;
}
@@ -362,8 +363,8 @@ maintainer_script_new(struct pkginfo *pkg,
}
ohshite(_("unable to stat %s `%.250s'"), buf, cidir);
}
- do_script(pkg, scriptname, cidir, &stab, arglist,
- _("unable to execute %s"), buf, 0);
+ do_script(pkg, &pkg->available, scriptname, cidir, &stab,
+ arglist, _("unable to execute %s"), buf, 0);
post_script_tasks();
return 1;
@@ -393,8 +394,8 @@ int maintainer_script_alternative(struct pkginfo *pkg,
warning(_("unable to stat %s '%.250s': %s"),
buf,oldscriptpath,strerror(errno));
} else {
- if (!do_script(pkg, scriptname, oldscriptpath, &stab, arglist,
- _("unable to execute %s"), buf, PROCWARN)) {
+ if (!do_script(pkg, &pkg->installed, scriptname, oldscriptpath, &stab,
+ arglist, _("unable to execute %s"), buf, PROCWARN)) {
post_script_tasks();
return 1;
}
@@ -415,7 +416,8 @@ int maintainer_script_alternative(struct pkginfo *pkg,
ohshite(_("unable to stat %s `%.250s'"),buf,cidir);
}
- do_script(pkg, scriptname, cidir, &stab, arglist, _("unable to execute %s"),
buf, 0);
+ do_script(pkg, &pkg->available, scriptname, cidir, &stab,
+ arglist, _("unable to execute %s"), buf, 0);
fprintf(stderr, _("dpkg: ... it looks like that went OK.\n"));
post_script_tasks();
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]