[pacman-dev] [PATCH] repo-add: add checkdepends information

Allan McRae allan at archlinux.org
Thu Jun 7 02:22:17 EDT 2012


Similar to the case for makedepends, it is useful to be able to
access this information without parsing a PKGBUILD.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/be_sync.c  |    6 ++++++
 scripts/makepkg.sh.in  |   19 ++++++++++---------
 scripts/repo-add.sh.in |    4 +++-
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 4033be6..4028916 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -597,6 +597,12 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
 					READ_NEXT();
 					if(strlen(line) == 0) break;
 				}
+			} else if(strcmp(line, "%CHECKDEPENDS%") == 0) {
+				/* currently unused */
+				while(1) {
+					READ_NEXT();
+					if(strlen(line) == 0) break;
+				}
 			} else if(strcmp(line, "%CONFLICTS%") == 0) {
 				READ_AND_SPLITDEP(pkg->conflicts);
 			} else if(strcmp(line, "%PROVIDES%") == 0) {
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 63cdd4d..abfabdf 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1282,15 +1282,16 @@ write_pkginfo() {
 	mapfile -t provides < <(find_libprovides)
 	mapfile -t depends < <(find_libdepends)
 
-	[[ $license ]]     && printf "license = %s\n"    "${license[@]}"
-	[[ $replaces ]]    && printf "replaces = %s\n"   "${replaces[@]}"
-	[[ $groups ]]      && printf "group = %s\n"      "${groups[@]}"
-	[[ $conflicts ]]   && printf "conflict = %s\n"   "${conflicts[@]}"
-	[[ $provides ]]    && printf "provides = %s\n"   "${provides[@]}"
-	[[ $backup ]]      && printf "backup = %s\n"     "${backup[@]}"
-	[[ $depends ]]     && printf "depend = %s\n"     "${depends[@]}"
-	[[ $optdepends ]]  && printf "optdepend = %s\n"  "${optdepends[@]//+([[:space:]])/ }"
-	[[ $makedepends ]] && printf "makedepend = %s\n" "${makedepends[@]}"
+	[[ $license ]]      && printf "license = %s\n"     "${license[@]}"
+	[[ $replaces ]]     && printf "replaces = %s\n"    "${replaces[@]}"
+	[[ $groups ]]       && printf "group = %s\n"       "${groups[@]}"
+	[[ $conflicts ]]    && printf "conflict = %s\n"    "${conflicts[@]}"
+	[[ $provides ]]     && printf "provides = %s\n"    "${provides[@]}"
+	[[ $backup ]]       && printf "backup = %s\n"      "${backup[@]}"
+	[[ $depends ]]      && printf "depend = %s\n"      "${depends[@]}"
+	[[ $optdepends ]]   && printf "optdepend = %s\n"   "${optdepends[@]//+([[:space:]])/ }"
+	[[ $makedepends ]]  && printf "makedepend = %s\n"  "${makedepends[@]}"
+	[[ $checkdepends ]] && printf "checkdepend = %s\n" "${checkdepends[@]}"
 
 	local it
 	for it in "${packaging_options[@]}"; do
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index e43f096..504cae9 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -257,7 +257,7 @@ db_write_entry() {
 	# blank out all variables
 	local pkgfile=$1
 	local -a _groups _licenses _replaces _depends _conflicts _provides \
-		_optdepends _makedepends
+		_optdepends _makedepends _checkdepends
 	local pkgname pkgver pkgdesc csize size url arch builddate packager \
 		md5sum sha256sum pgpsig pgpsigsize
 
@@ -278,6 +278,7 @@ db_write_entry() {
 			provides) _provides+=("$provides") ;;
 			optdepend) _optdepends+=("$optdepend") ;;
 			makedepend) _makedepends+=("$makedepend") ;;
+			checkdepend) _checkdepends+=("$checkdepend") ;;
 		esac
 	done< <(bsdtar -xOqf "$pkgfile" .PKGINFO)
 
@@ -365,6 +366,7 @@ db_write_entry() {
 		format_entry "PROVIDES" "${_provides[@]}"
 		format_entry "OPTDEPENDS" "${_optdepends[@]}"
 		format_entry "MAKEDEPENDS" "${_makedepends[@]}"
+		format_entry "CHECKDEPENDS" "${_checkdepends[@]}"
 	} >'depends'
 
 	popd >/dev/null
-- 
1.7.10.3



More information about the pacman-dev mailing list