summaryrefslogtreecommitdiff
path: root/bin/why_dont_you_build
blob: 714816ad8c431de6db73ff01652174d395698c03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash

# investigate, why a certain package is not being built

. "${0%/*}/../conf/default.conf"

for pkg in "$@"; do
  grep "^${pkg//./\\.} " "${work_dir}/build-list" | \
    while read -r package git_revision mod_git_revision repository; do

      if [ -f "${work_dir}/${package}.${git_revision}.${mod_git_revision}.${repository}.done" ] ||
        [ -f "${work_dir}/${package}.${git_revision}.${mod_git_revision}.${repository}.testing" ]; then
        echo 'has been built'
        continue
      fi

      if package_locked_broken_or_blocked "${package}" "${git_revision}" "${mod_git_revision}" "${repository}"; then
        echo 'is locked, broken or blocked'
        continue
      fi

      if [ -n "$(
        (
          cat "${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.needs"
          awk '{print $1 "." $2 "." $3}' "${work_dir}/build-list" | \
            sed "
              s|^|${work_dir}/package-infos/|
              s|\$|\.builds|
            " | \
            xargs -r cat | \
            sort -u
        ) | \
          sort | \
          uniq -d
        )" ]; then
        echo 'has unmet dependencies:'
        (
          cat "${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}.needs"
          awk '{print $1 "." $2 "." $3}' "${work_dir}/build-list" | \
            sed "
              s|^|${work_dir}/package-infos/|
              s|\$|\.builds|
            " | \
            xargs -r cat | \
            sort -u
        ) | \
          sort | \
          uniq -d | \
          while read -r dep; do
            grep -Fx "${dep}" "${work_dir}/package-infos/"*".builds" | \
              cut -d: -f1 | \
              xargs -rn1 basename | \
              cut -d. -f1
          done | \
          sort -u

        continue
      fi

      echo 'would be built'
    done

done