Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix files left
Baptiste Daroussin committed 14 years ago
commit 023269b85b77534b6e97371d88aa7657ab01d5d3
parent ec09b50
1 file changed +15 -15
modified libpkg/pkg_ports.c
@@ -43,10 +43,10 @@ ports_parse_plist(struct pkg *pkg, char *plist)
	int64_t flatsize = 0;
	struct hardlinks hardlinks = {NULL, 0, 0};
	bool regular;
-
	bool filestarted = false; /* ugly workaround for easy_install ports */
	struct sbuf *exec_scripts = sbuf_new_auto();
	struct sbuf *unexec_scripts = sbuf_new_auto();
	struct sbuf *pre_unexec_scripts = sbuf_new_auto();
+
	struct sbuf *post_unexec_scripts = sbuf_new_auto();
	void *set = NULL;
	const char *uname = NULL;
	const char *gname = NULL;
@@ -139,15 +139,7 @@ ports_parse_plist(struct pkg *pkg, char *plist)
						/* end remove mkdir -? */
					}

-
					if (filestarted) {
-
						if (sbuf_len(unexec_scripts) == 0)
-
							sbuf_cat(unexec_scripts, "#@unexec\n"); /* to be able to regenerate the @unexec in pkg2legacy */
-
						sbuf_printf(unexec_scripts, "%s%s\n",comment, cmd);
-
					} else {
-
						if (sbuf_len(pre_unexec_scripts) == 0)
-
							sbuf_cat(pre_unexec_scripts, "#@unexec\n"); /* to be able to regenerate the @unexec in pkg2legacy */
-
						sbuf_printf(pre_unexec_scripts, "%s%s\n",comment, cmd);
-
					}
+
					sbuf_printf(unexec_scripts, "%s%s\n",comment, cmd);

					/* workaround to detect the @dirrmtry */
					if (comment[0] == '#') {
@@ -207,8 +199,6 @@ ports_parse_plist(struct pkg *pkg, char *plist)

				snprintf(path, sizeof(path), "%s%s%s/", prefix, slash, buf);

-
				if (sbuf_len(unexec_scripts) == 0)
-
					sbuf_cat(unexec_scripts, "#@unexec\n"); /* to be able to regenerate the @unexec in pkg2legacy */

				if (plist_p[6] == 't') {
					sbuf_printf(unexec_scripts, "#@unexec /bin/rmdir \"%s\" || true\n", path);
@@ -259,7 +249,14 @@ ports_parse_plist(struct pkg *pkg, char *plist)
				pkg_emit_error("%s is deprecated, ignoring", plist_p);
			}
		} else if ((len = strlen(plist_p)) > 0){
-
			filestarted = true;
+
			if (sbuf_len(unexec_scripts) > 0) {
+
				if (sbuf_len(unexec_scripts) == 0)
+
					sbuf_cat(unexec_scripts, "#@unexec\n"); /* to be able to regenerate the @unexec in pkg2legacy */
+

+
				sbuf_finish(unexec_scripts);
+
				sbuf_cat(pre_unexec_scripts, sbuf_data(unexec_scripts));
+
				sbuf_reset(unexec_scripts);
+
			}
			buf = plist_p;
			last_plist_file = buf;
			sha256[0] = '\0';
@@ -321,7 +318,7 @@ ports_parse_plist(struct pkg *pkg, char *plist)
	pkg_set(pkg, PKG_FLATSIZE, flatsize);

	if (sbuf_len(pre_unexec_scripts) > 0) {
-
		sbuf_finish(unexec_scripts);
+
		sbuf_finish(pre_unexec_scripts);
		pkg_appendscript(pkg, sbuf_data(pre_unexec_scripts), PKG_SCRIPT_PRE_DEINSTALL);
	}
	if (sbuf_len(exec_scripts) > 0) {
@@ -329,8 +326,11 @@ ports_parse_plist(struct pkg *pkg, char *plist)
		pkg_appendscript(pkg, sbuf_data(exec_scripts), PKG_SCRIPT_POST_INSTALL);
	}
	if (sbuf_len(unexec_scripts) > 0) {
+
		sbuf_cat(post_unexec_scripts, "#@unexec\n"); /* to be able to regenerate the @unexec in pkg2legacy */
		sbuf_finish(unexec_scripts);
-
		pkg_appendscript(pkg, sbuf_data(unexec_scripts), PKG_SCRIPT_POST_DEINSTALL);
+
		sbuf_cat(post_unexec_scripts, sbuf_data(unexec_scripts));
+
		sbuf_finish(post_unexec_scripts);
+
		pkg_appendscript(pkg, sbuf_data(post_unexec_scripts), PKG_SCRIPT_POST_DEINSTALL);
	}

	regfree(&preg1);