Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Merge branch '465-plist-cwd-exec-ordering'
Bryan Drewery committed 13 years ago
commit 3df10d6417fc20f9e325cf3b8f55ab68c83b2392
parent 5e98a7a
1 file changed +5 -11
modified libpkg/pkg_ports.c
@@ -59,7 +59,6 @@ struct plist {
	char *last_file;
	const char *stage;
	const char *prefix;
-
	struct sbuf *unexec_buf;
	struct sbuf *pre_install_buf;
	struct sbuf *post_install_buf;
	struct sbuf *pre_deinstall_buf;
@@ -165,6 +164,10 @@ setprefix(struct plist *p, char *line, struct file_attr *a)

	p->slash = p->prefix[strlen(p->prefix) -1] == '/' ? "" : "/";

+
	exec_append(p->post_install_buf, "cd %s\n", p->prefix);
+
	pre_unexec_append(p->pre_deinstall_buf, "cd %s\n", p->prefix);
+
	post_unexec_append(p->post_deinstall_buf, "cd %s\n", p->prefix);
+

	free(a);

	return (EPKG_OK);
@@ -490,7 +493,7 @@ meta_exec(struct plist *p, char *line, struct file_attr *a, bool unexec)
				post_unexec_append(p->post_deinstall_buf,
				    "%s%s\n", comment, cmd);
		} else {
-
			sbuf_printf(p->unexec_buf, "%s%s\n",comment, cmd);
+
			pre_unexec_append(p->pre_deinstall_buf, "%s%s\n", comment, cmd);
		}
		if (comment[0] == '#') {
			buf = cmd;
@@ -942,7 +945,6 @@ ports_parse_plist(struct pkg *pkg, char *plist, const char *stage)
	pplist.last_file = NULL;
	pplist.prefix = NULL;
	pplist.stage = stage;
-
	pplist.unexec_buf = sbuf_new_auto();
	pplist.pre_install_buf = sbuf_new_auto();
	pplist.post_install_buf = sbuf_new_auto();
	pplist.pre_deinstall_buf = sbuf_new_auto();
@@ -1006,12 +1008,6 @@ ports_parse_plist(struct pkg *pkg, char *plist, const char *stage)
				break;
			}
		} else {
-
			if (sbuf_len(pplist.unexec_buf) > 0) {
-
				sbuf_finish(pplist.unexec_buf);
-
				pre_unexec_append(pplist.pre_deinstall_buf,
-
				    sbuf_get(pplist.unexec_buf), "");
-
				sbuf_reset(pplist.unexec_buf);
-
			}
			buf = token;
			pplist.last_file = buf;

@@ -1032,8 +1028,6 @@ ports_parse_plist(struct pkg *pkg, char *plist, const char *stage)
	    PKG_SCRIPT_POST_INSTALL);
	flush_script_buffer(pplist.pre_deinstall_buf, pkg,
	    PKG_SCRIPT_PRE_DEINSTALL);
-
	flush_script_buffer(pplist.unexec_buf, pkg,
-
	    PKG_SCRIPT_POST_DEINSTALL);
	flush_script_buffer(pplist.post_deinstall_buf, pkg,
	    PKG_SCRIPT_POST_DEINSTALL);
	flush_script_buffer(pplist.pre_upgrade_buf, pkg,