File gesammelte_werke-aggregate.sh of Package gesammelte_werke
#!/bin/bash
set -e
declare -a pkgs
declare -A repositories
target_prj='Factory'
read prj < .osc/_project
read this_pkg < .osc/_package
#
for pkg in $(pbs ls "${prj}")
do
test "${this_pkg}" = "${pkg}" && continue
pkgs+=(${pkg})
done
#
while read
do
set -- ${REPLY}
test "$1" = "${target_prj}" && continue
repositories["$1"]="$1"
done < <(pbs repositories "${prj}")
#
(
cat <<_EOF_
<!-- automatically generated by $0 -->
<aggregatelist>
_EOF_
for src_repository in ${!repositories[@]}
do
echo " <aggregate project='${prj}'>"
for pkg in ${pkgs[@]}
do
echo " <package>${pkg}</package>"
done
echo " <repository source='${src_repository}' target='${target_prj}' />"
echo " </aggregate>"
done
echo '</aggregatelist>'
) > '_aggregate'