Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix @config handling
Baptiste Daroussin committed 9 years ago
commit d2f1a7a60986c5d73a8a4634cde563a0ef808b58
parent e30354d
2 files changed +30 -7
modified libpkg/pkg_add.c
@@ -439,7 +439,7 @@ do_extract_regfile(struct pkg *pkg, struct archive *a, struct archive_entry *ae,

	if (pkg->config_files != NULL) {
		k = kh_get_pkg_config_files(pkg->config_files, f->path);
-
		if (k == kh_end(pkg->config_files))
+
		if (k != kh_end(pkg->config_files))
			f->config = kh_value(pkg->config_files, k);
	}

@@ -453,15 +453,12 @@ do_extract_regfile(struct pkg *pkg, struct archive *a, struct archive_entry *ae,
		archive_read_data(a, f->config->content, len);
		f->config->content[len] = '\0';
		cfdata = f->config->content;
-

		attempt_to_merge(pkg->rootfd, f->config, local, merge);
		if (f->config->status == MERGE_SUCCESS)
			cfdata = f->config->newcontent;
		dprintf(fd, "%s", cfdata);
		if (f->config->newcontent != NULL)
			free(f->config->newcontent);
-
		free(f->config->content);
-
		f->config->content = NULL;
	}

	if (!f->config && archive_read_data_into_fd(a, fd) != ARCHIVE_OK) {
modified tests/frontend/configmerge.sh
@@ -12,8 +12,34 @@ config_body()
	echo "entry" > a

	atf_check \
-
		-e empty \
-
		-o empty \
-
		-s exit:0 \
		pkg create -M test.ucl -p plist
+

+
	atf_check \
+
		-o match:"^config" \
+
		pkg info -R --raw-format ucl -F ${TMPDIR}/test-1.txz
+

+
	mkdir ${TMPDIR}/target
+
	unset PKG_DBDIR
+
	atf_check \
+
		pkg -o REPOS_DIR=/dev/null -r ${TMPDIR}/target install -qy ${TMPDIR}/test-1.txz
+
	test -f ${TMPDIR}/target/${TMPDIR}/a || atf_fail "file absent"
+
	echo "addition" >> ${TMPDIR}/target/${TMPDIR}/a
+
	atf_check \
+
		-o inline:"entry\naddition\n" \
+
		cat ${TMPDIR}/target/${TMPDIR}/a
+

+
	new_pkg "test" "test" "2"
+
	echo "entry 2" > a
+

+
	atf_check \
+
		pkg create -M test.ucl -p plist
+

+
	pkg repo .
+
	echo "local: { url: file://${TMPDIR} }" > local.conf
+
	atf_check \
+
		pkg -o REPOS_DIR=${TMPDIR} -r ${TMPDIR}/target upgrade -qy test
+

+
	atf_check \
+
		-o inline:"entry 2\naddition\n" \
+
		cat ${TMPDIR}/target/${TMPDIR}/a
}