Commit 41909d4d authored by Seblu's avatar Seblu
Browse files

Rsync sources directory

Reserve the logic of syncing. Now it's a whitelist instead of a blacklist.
This allow us to use kitchensink_tier1 from rsync.al.org to fetch
the source tree, in order to complain with GPLv2 sources distribution.
parent 83bf2ff5
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -64,6 +64,22 @@ load_config() {
	fi
}

# generate a temporary file with rsync filter list for repo sync
gen_repo_filter() {
	local tmp_file="$(mktemp)"
	local _dir _dirs=(core extra testing staging
		community community-testing community-staging
		multilib multilib-testing multilib-staging
		kde-unstable gnome-unstable
		pool sources)
	for _dir in "${_dirs[@]}"; do
		echo "+ /$_dir/" >> "$tmp_file"
	done
	echo '- .*' >> "$tmp_file"
	echo '- /*/' >> "$tmp_file"
	echo "$tmp_file"
}

# snapshot a repository
repo_rsync() {
	msg "Snapshoting repositories"
@@ -81,12 +97,14 @@ repo_rsync() {
	msg2 "last path: $LAST"

	[[ -n "$LAST" ]] && local LINKDEST="--link-dest=$LAST/"
	local FILTER_FILE=$(gen_repo_filter)
	trap "rm '$FILTER_FILE'" 0

	msg2 'Rsyncing...'
	# rsync from master using last sync
	# we must use absolute path with --link-dest to avoid errors
	timeout $REPO_RSYNC_TIMEOUT rsync -rltH $LINKDEST \
		--exclude '*/.*' --exclude 'iso/*' "$ARCHIVE_RSYNC" "$SNAP/" ||
		--filter ". $FILTER_FILE" "$ARCHIVE_RSYNC" "$SNAP/" ||
			error "Unable to rsync: $ARCHIVE_RSYNC."

	# only to have a quick check of sync in listdir