[pacman-dev] [PATCH] repo-add.sh.in: avoid being clever with repo repacking

Dave Reisner d at falconindy.com
Wed Jun 29 23:24:55 EDT 2011


Revert to the old behavior that 6f5a90 attempted to simplify and go with
the original proposed solution of using "ugly" bash to detect empty
directories.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
And here's such a patch...

 scripts/repo-add.sh.in |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 17b32aa..37466ea 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -629,8 +629,13 @@ if (( success )); then
 	filename=${REPO_DB_FILE##*/}
 
 	pushd "$tmpdir" >/dev/null
-	# strip the './' off filenames; this also allows us to tar an empty dir
-	bsdtar -s %^./%% -c${TAR_OPT}f "$REPO_DB_FILE" ./
+	if ( shopt -s nullglob; files=(*); (( ${#files[*]} )) ); then
+		bsdtar -c${TAR_OPT}f "$filename" *
+	else
+		# we have no packages remaining? zip up some emptyness
+		warning "$(gettext "No packages remain, creating empty database.")"
+		bsdtar -c${TAR_OPT}f "$filename" -T /dev/null
+	fi
 	create_signature "$filename"
 	popd >/dev/null
 
-- 
1.7.6



More information about the pacman-dev mailing list