diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-11-03 01:07:08 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-11-03 01:07:08 -0400 |
commit | b804d7de01b7428423392d4ec233a50dc862ac93 (patch) | |
tree | 1873025c6b5e93c1f6d0fd7d94171d64375b9ab6 /pbs-absrepo-convert--filterarch | |
parent | ec48dd455397e1653ac7ba6810435c9d1a7cf2f9 (diff) |
mv absrepo-convert--filter{package,arch}
Diffstat (limited to 'pbs-absrepo-convert--filterarch')
-rwxr-xr-x | pbs-absrepo-convert--filterarch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/pbs-absrepo-convert--filterarch b/pbs-absrepo-convert--filterarch new file mode 100755 index 0000000..3118909 --- /dev/null +++ b/pbs-absrepo-convert--filterarch @@ -0,0 +1,37 @@ +#!/bin/bash -e +arch=$1 + +# generate map of all packages to their treehash +tree="$(mktemp)" +if [[ $arch = master ]]; then + git ls-tree -d "$GIT_COMMIT" */trunk > "$tree" +else + git ls-tree -d "$GIT_COMMIT" */repos/*-"$arch" */repos/*-any > "$tree" +fi + +# generate map of all packages to their repo +repos="$(mktemp)" +find */repos/* -type d -printf '%h/%h\n' | sed -r 's@^([^/]*)/repos/(.*)-[^-]*$@\1 \2@'|sort -u > "$repos" + +# clean the working directory +rm -rf * + +# add the packages back in as remotes +cat "$tree" | while read mode type treehash path; do + package="${path%%/*}" + repo="$(sed -n "s/^${package} //p" "$repos")" + commithash="$(sed -n "s/^${treehash} //p" "${TMPDIR}/packages-${package}.commits")" + if [[ -n "$commithash" ]]; then + mkdir -p "$repo" + git submodule add ./ "${repo}/${package}" + ( + cd "${repo}/${package}" + git checkout "${commithash}" + ) + else + printf '%s\n' "$package" >> "${TMPDIR}/missing-packages.${arch}.tmp" + fi +done + +# clean up +rm -f "$repos" "$tree" |