[X2Go-Commits] [x2goclient] 56/217: deduplicate.sh: add duplicates-to-real mapping.

git-admin at x2go.org git-admin at x2go.org
Wed Sep 21 01:08:32 CEST 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 201749b7e56af9f6ae36f5a74e56b488a3670cca
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Aug 26 21:40:13 2015 +0200

    deduplicate.sh: add duplicates-to-real mapping.
---
 debian/changelog |    1 +
 deduplicate.sh   |   28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index a295b7e..73872b1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -101,6 +101,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
       library path. Putting everything into a single place is a stupid idea.
     - deduplicate.sh: add new, more or less Proof of Concept, and Work in
       Progress file deduplication script.
+    - deduplicate.sh: add duplicates-to-real mapping.
 
  -- X2Go Release Manager <git-admin at x2go.org>  Mon, 19 Sep 2016 09:07:07 +0200
 
diff --git a/deduplicate.sh b/deduplicate.sh
index 7c4de14..19dc584 100755
--- a/deduplicate.sh
+++ b/deduplicate.sh
@@ -77,3 +77,31 @@ echo "New value for all_files:"
 for entry in ${all_files[@]}; do
 	echo "${entry}"
 done
+
+echo "Duplicates-to-real map:"
+# Build complementary array to duplicates.
+typeset -a to_files
+for entry in ${duplicates[@]}; do
+	typeset filename="$(basename "${entry}")"
+
+	for all_entry in ${all_files[@]}; do
+		typeset all_entry_filename="$(basename "${all_entry}")"
+
+		if [ -n "${filename}" ] && [ -n "${all_entry_filename}" ]; then
+			if [ "${filename}" = "${all_entry_filename}" ]; then
+				to_files+=( "${all_entry}" )
+
+				echo "${entry} => ${all_entry}"
+
+				# There should be only one entry matching, so we can save a bit of time and break out of the loop.
+				# Even more importantly, we only want one entry for each duplicates entry anyway...
+				break
+			fi
+		else
+			echo "WARNING: empty file name while matching duplicates with non-duplicates." >&2
+			echo "WARNING: duplicate entry: \"${entry}\"" >&2
+			echo "WARNING: real entry: \"${all_entry}\"" >&2
+			exit 1
+		fi
+	done
+done

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list