summaryrefslogtreecommitdiff
path: root/localdebpool
blob: 3ca414aface5d86280fb8b8555f430dfb7c626b4 (plain)
  1. #!/bin/sh
  2. set -e
  3. #set -x
  4. SRCBASE=~/public_debian
  5. PUBBASE=~/public_websites/debian.jones.dk
  6. #PUBTOSRC=../../public_debian
  7. pathsfromsuites() {
  8. case "$@" in
  9. all)
  10. suites_re=""
  11. ;;
  12. *)
  13. suites_re="\b\($(echo "$@" | sed 's/[[:space:]]\+/\\|/g')\)\b"
  14. ;;
  15. esac
  16. find $SRCBASE -type f -name HINTS -exec grep -q "^Sections:.*$suites_re" '{}' ';' -printf '%h\n' \
  17. | sed "s,^$SRCBASE/,,"
  18. }
  19. suitesfrompaths() {
  20. case "$@" in
  21. all)
  22. fullpaths="$SRCBASE"
  23. ;;
  24. *)
  25. fullpaths=
  26. for path in "$@"; do
  27. # TODO: rewrite to support spaces in directory names
  28. fullpaths="$fullpaths $SRCBASE/$path"
  29. done
  30. ;;
  31. esac
  32. find $fullpaths -type f -name HINTS -exec cat '{}' ';' \
  33. | grep '^Sections:' \
  34. | sed 's/^Sections://; s/[[:space:]]\+/ /g; s/^ //; s/ $//' \
  35. | tr ' ' '\n' \
  36. | sort -u
  37. }
  38. suites="$@"
  39. paths="$(pathsfromsuites "$suites")"
  40. #echo $paths; exit 0
  41. #suitesfrompaths all; exit 0
  42. for path in $paths; do
  43. package="$(basename "$path")"
  44. pool="$(echo $(dirname "$path") | sed 's,.*/pool-\([^/]\+\)/\?.*,\1,; s,-all$,,')"
  45. buildhost="$(echo $(dirname "$path") | sed 's,^\([^/]\+\)/pool-.*,\1,')"
  46. symlink_dir="$pool/$package"
  47. mkdir -p "$PUBBASE/pools/$symlink_dir"
  48. # ln -sf -T "../../../$PUBTOSRC/$path" "$PUBBASE/pools/$symlink_dir/$buildhost"
  49. ln -sf -T "$SRCBASE/$path" "$PUBBASE/pools/$symlink_dir/$buildhost"
  50. for suite in $(suitesfrompaths "$path"); do
  51. mkdir -p "$SRCBASE/suites/$suite/$symlink_dir"
  52. ln -sf -T "../../../../$path" "$SRCBASE/suites/$suite/$symlink_dir/$buildhost"
  53. done
  54. done
  55. srcdir="$SRCBASE/suites/sugar"
  56. pubdir="$PUBBASE/dists/sid/sugar/binary-amd64"
  57. mkdir -p "$pubdir"
  58. ( cd "$srcdir" && dpkg-scanpackages * /dev/null pools/ ) > "$pubdir/Packages"
  59. gzip -c "$pubdir/Packages" > "$pubdir/Packages.gz"
  60. bzip2 -c "$pubdir/Packages" > "$pubdir/Packages.bz2"
  61. pubdir="$PUBBASE/dists/sid/sugar/source"
  62. mkdir -p "$pubdir"
  63. ( cd "$srcdir" && dpkg-scansources * /dev/null pools/ ) > "$pubdir/Sources"
  64. gzip -c "$pubdir/Sources" > "$pubdir/Sources.gz"
  65. bzip2 -c "$pubdir/Sources" > "$pubdir/Sources.bz2"
  66. exit 0