File: exclude.sh

package info (click to toggle)
android-platform-frameworks-base 1%3A14~beta1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 326,092 kB
  • sloc: java: 2,032,373; xml: 343,016; cpp: 304,181; python: 3,683; ansic: 2,090; sh: 1,871; makefile: 117; sed: 19
file content (74 lines) | stat: -rwxr-xr-x 2,217 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -e
# Make sure that entries are not added for packages that are already fully handled using
# annotations.
LOCAL_DIR="$( dirname ${BASH_SOURCE} )"
# Each team should add a <team>_PACKAGES and <team>_EMAIL with the list of packages and
# the team email to use in the event of this detecting an entry in a <team> package. Also
# add <team> to the TEAMS list. 
LIBCORE_PACKAGES="\
  android.system \
  android.test \
  com.android.bouncycastle \
  com.android.okhttp \
  com.sun \
  dalvik \
  java \
  javax \
  junit \
  libcore \
  org.apache.harmony \
  org.json \
  org.w3c.dom \
  org.xml.sax \
  org.xmlpull.v1 \
  sun \
  "
LIBCORE_EMAIL=libcore-team@android.com

I18N_PACKAGES="\
  android.icu \
  "

I18N_EMAIL=$LIBCORE_EMAIL

CONSCRYPT_PACKAGES="\
  com.android.org.conscrypt \
  "

CONSCRYPT_EMAIL=$LIBCORE_EMAIL

# List of teams.
TEAMS="LIBCORE I18N CONSCRYPT"

SHA=$1

# Generate the list of packages and convert to a regular expression.
PACKAGES=$(for t in $TEAMS; do echo $(eval echo \${${t}_PACKAGES}); done)
RE=$(echo ${PACKAGES} | sed "s/ /|/g")
EXIT_CODE=0
for file in $(git show --name-only --pretty=format: $SHA | grep "boot/hiddenapi/hiddenapi-.*txt"); do
    ENTRIES=$(grep -E "^\+L(${RE})/" <(git diff ${SHA}~1 ${SHA} $file) | sed "s|^\+||" || echo)
    if [[ -n "${ENTRIES}" ]]; then
      echo -e "\e[1m\e[31m$file $SHA contains the following entries\e[0m"
      echo -e "\e[1m\e[31mfor packages that are handled using UnsupportedAppUsage. Please remove\e[0m"
      echo -e "\e[1m\e[31mthese entries and add annotations instead.\e[0m"
      # Partition the entries by team and provide contact details to aid in fixing the issue.
      for t in ${TEAMS}
      do
        PACKAGES=$(eval echo \${${t}_PACKAGES})
        TEAM_RE=$(echo ${PACKAGES} | sed "s/ /|/g")
        TEAM_ENTRIES=$(grep -E "^L(${TEAM_RE})/" <(echo "${ENTRIES}") || echo)
        if [[ -n "${TEAM_ENTRIES}" ]]; then
          EMAIL=$(eval echo \${${t}_EMAIL})
          echo -e "\e[33mContact ${EMAIL} for help with the following:\e[0m"
          for i in ${TEAM_ENTRIES}
          do
            echo -e "\e[33m  ${i}\e[0m"
          done
        fi
      done
      EXIT_CODE=1
    fi
done
exit $EXIT_CODE