This file is indexed.

/usr/share/debci/bin/debci-setup-chdist is in debci 1.7.1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh
set -eu

usage() {
  cat <<EOF
usage: $0 [OPTIONS]

$@
EOF
}

# skip when running tests
if [ -n "${DEBCI_RUNNING_TESTS:-}" ]; then exit; fi

base=$(readlink -f $(dirname $(readlink -f $0))/..)
. $base/lib/environment.sh
. $base/lib/functions.sh

root="$debci_data_basedir/chdist"
name="${debci_suite}-${debci_arch}"

# create new chdist if it doesn't exist already
if [ ! -e "$root/$name" ]; then
  log "I: Creating new chdist $root/$name"
  call_chdist create >/dev/null

  # figure out default mirror from debootstrap scripts
  DEF_MIRROR="${MIRROR:-http://http.debian.net/debian}"
  SUITE=$debci_suite
  TARGET="$root/$name"
  ARCH=$debci_arch
  set +u
  . /usr/share/debootstrap/functions
  exec 4>&1
  # this updates $DEF_MIRROR (Ubuntu, ports, ..)
  . /usr/share/debootstrap/scripts/$debci_suite
  set -u

  # enable all components
  if [ "${DEF_MIRROR%ubuntu*}" = "$DEF_MIRROR" ]; then
    COMPONENTS="main"  # Debian
  else
    COMPONENTS="main restricted universe multiverse"  # Ubuntu
  fi

  mirror=${debci_mirror:-$DEF_MIRROR}

  # write apt sources.list
  mkdir -p $TARGET/etc/apt/
  echo "deb [arch=${debci_arch}] $mirror $SUITE $COMPONENTS
deb-src $mirror $SUITE $COMPONENTS" > "$TARGET/etc/apt/sources.list"

  # add buildd sources
  #FIXME duplicates logic in backends/schroot/create-testbed
  if grep -q debian "$TARGET/etc/apt/sources.list"; then
    if [ "$SUITE" = unstable ]; then
      buildd_suite=buildd-$SUITE
    else
      buildd_suite=buildd-$SUITE-proposed-updates
    fi
    cat >> "$TARGET/etc/apt/sources.list" <<EOF
deb [arch=${debci_arch}] http://incoming.debian.org/debian-buildd $buildd_suite main
deb-src http://incoming.debian.org/debian-buildd $buildd_suite main
EOF
  fi

  # use a local proxy if available
  http_proxy="${http_proxy:-}"
  if [ -z "$http_proxy" ]; then
    # detect a local apt-cacher-ng cache running.  10.0.2.2 = default IP
    # assigned to host system as seen from a kvm/virtualbox virtual machine
    for ip in 127.0.0.1 10.0.2.2; do
      if nc -z -w 1 $ip 3142; then
        export http_proxy=http://$ip:3142
      fi
    done
  fi
  if [ -n "$http_proxy" ]; then
    echo "Acquire::http::Proxy \"$http_proxy\";" > "$TARGET/etc/apt/apt.conf.d/01proxy"
  fi

  # disable multi-arch
  echo "Apt::Architectures {\"$ARCH\";};" > "$TARGET/etc/apt/apt.conf.d/97_no_multiarch"

  # disable unnecessary srcpkgcache
  echo 'Dir::Cache::srcpkgcache "";' > "$TARGET/etc/apt/apt.conf.d/98disable_cache"

  # do not download translations
  echo 'Acquire::Languages "none";' > "$TARGET/etc/apt/apt.conf.d/99translations"
fi

update_chdist() {
  call_chdist apt-get update

  base_system="$root/$name/base-system.txt"
  # dpgk-dev is added to all clean test beds by debci itself
  base_packages="dpkg-dev $(call_chdist grep-dctrl-packages -n -s Package -F Priority required --or important)"
  chdist \
    --data-dir "$root" \
    apt-get "$name" --simulate --quiet --no-install-recommends install $base_packages \
    | awk '{ if ($1 == "Inst") {print($2)}}' | sort > "$base_system"

  awk '{print("/^"$1"\\s/d")}' $base_system > "${root}/${name}/exclude-base-system.sed"
}

if [ "$debci_quiet" = 'true' ]; then
  update_chdist >/dev/null 2>&1
else
  update_chdist
fi