#!/bin/bash

set -e

pushd $(dirname $0) >/dev/null

dists=$(find dists -mindepth 1 -maxdepth 1 -type d -printf %P\\n | grep -v upstream-sources | grep -v testing)

for dist in $dists; do
    reprepro build-needing $dist any | sed s/^/$dist\ /
done | while read dist package version dscpath architecture; do
    echo ${dist} ${architecture} $PWD/$dscpath
done

popd >/dev/null
