~launchpad-pqm/launchpad/devel

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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#! /bin/sh
#
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

set -e
set -u

ARCHIVEROOT=/srv/launchpad.net/ubuntu-archive/ubuntu
MISCROOT=$ARCHIVEROOT/../ubuntu-misc
LOCKROOT=$ARCHIVEROOT/..
GERMINATEROOT=$ARCHIVEROOT/../ubuntu-germinate

LAUNCHPADROOT=/srv/launchpad.net/codelines/current
MAINTAINCE_CHECK=$LAUNCHPADROOT/cronscripts/publishing/maintenance-check.py

## Check to see if another germinate run is in progress

LOCKFILE=$LOCKROOT/cron.germinate.lock
if lockfile -! -l 43200 -r 0 "${LOCKFILE}"; then
  echo Another cron.germinate appears to be running
  exit 1
fi

cleanup () {
  rm -f "$LOCKFILE"
}

trap cleanup EXIT

LAUNCHPADROOT=/srv/launchpad.net/codelines/current
suite=`$LAUNCHPADROOT/scripts/ftpmaster-tools/lp-query-distro.py development`

echo -n "Running germinate... "
cd $GERMINATEROOT

# Clean up temporary files
rm -f germinate.output ALL ALL.sources UBUNTU-* KUBUNTU-* EDUBUNTU-* XUBUNTU-* MYTHBUNTU-* NETBOOK-*
rm -f all_* all.sources_*

# Grab a local copy of Sources files
for component in main universe restricted multiverse; do
  zcat $ARCHIVEROOT/dists/"$suite"/"$component"/source/Sources.gz > archive.ubuntu.com_"$suite"_"$component"_Sources;
done

> "$MISCROOT/more-extra.override.$suite.main.new"

germinate_components=main,universe,restricted,multiverse
for distro in ubuntu kubuntu edubuntu xubuntu mythbuntu netbook; do
  DISTRO="$(echo $distro | tr a-z A-Z)"
  germinate_suite="$distro.$suite"
  for arch in i386 amd64 powerpc sparc ia64 armel; do
    # Grab local copy of Packages and InstallerPackages files
    for component in main universe restricted multiverse; do
      zcat $ARCHIVEROOT/dists/"$suite"/"$component"/binary-$arch/Packages.gz > archive.ubuntu.com_"$suite"_"$component"_Packages
      zcat $ARCHIVEROOT/dists/"$suite"/"$component"/debian-installer/binary-$arch/Packages.gz > archive.ubuntu.com_"$suite"_"$component"_InstallerPackages
    done

    # Run germinate
    echo " **************** $distro/$suite/$arch ********************* " >> germinate.output
    germinate --no-rdepends -s "$germinate_suite" -d "$suite" -c "$germinate_components" -a $arch >> germinate.output 2>&1

    # The structure file is generally useful; keep per distro/suite/arch
    # copies for convenience
    cp structure structure_"$distro"_"$suite"_"$arch"

    # Keep per distro/suite/arch copies of 'all' and 'all.sources' for anastacia
    cp all all_"$distro"_"$suite"_"$arch"
    cp all.sources all.sources_"$distro"_"$suite"_"$arch"

    # Keep per distro/suite/arch copies of 'minimal' and 'standard' for jessica
    cp minimal minimal_"$distro"_"$suite"_"$arch"
    cp standard standard_"$distro"_"$suite"_"$arch"

    # Keep amalgamated copies of 'all' and 'all.sources', just for convenience
    cat all >> ALL; cat all.sources >> ALL.sources

    # We need to fetch a number of seeds so that we can generate Task fields
    # for them. This changes over time and differs from derivative to
    # derivative, so it's best to just fetch them all.
    taskseeds="$(cut -d: -f1 structure | xargs -n1 | sort -u)"

    for seed in $taskseeds; do
      cp "$seed" "$seed"_"$distro"_"$suite"_"$arch"
    done
    echo " ********************************************************************** " >> germinate.output
    echo "" >> germinate.output
    echo -n "."

    ## Generate apt-ftparchive 'extra' overrides for Task: fields
    for seed in $taskseeds; do
      if ! grep -iq '^Task-' "$seed.seedtext"; then
	continue
      fi
      # If the seed contains Task-Name header, override the normal behavior
      if grep -iq '^Task-Name:' "$seed.seedtext"; then
	task=$(grep '^Task-Name:' "$seed.seedtext" | cut -d: -f2)
      elif grep -iq '^Task-Per-Derivative:' "$seed.seedtext"; then
	task="$distro-$seed"
      else
	# If a seed is not per-derivative, then we only honour it for Ubuntu,
	# and its task name is archive-global.
	if [ "$distro" = ubuntu ]; then
	  task="$seed"
	else
	  continue
	fi
      fi
      if grep -iq '^Task-Seeds:' "$seed.seedtext"; then
	scanseeds="$( (grep '^Task-Seeds:' "$seed.seedtext" | cut -d: -f2 | xargs -n1; echo "$seed") | sort -u )"
      else
	scanseeds="$seed"
      fi
      for scanseed in $scanseeds; do
	egrep -v -- "^(-|Package| )" "$scanseed"_"$distro"_"$suite"_"$arch" | awk '{print $1}' | sed -e "s,$,/$arch  Task  $task," | sort -u >> "$MISCROOT/more-extra.override.$suite.main.new"
      done
    done

    # Generate apt-ftparchive 'extra' overrides for Build-Essential: fields
    if [ -e build-essential ] && [ "$distro" = ubuntu ]; then
      # Keep a copy, just for convenience
      cp build-essential build-essential_"$distro"_"$suite"_"$arch"
      egrep -v -- "^(-|Package| )" build-essential_"$distro"_"$suite"_"$arch" | awk '{print $1}' | sed -e "s,$,/$arch  Build-Essential  yes," | sort -u >> "$MISCROOT/more-extra.override.$suite.main.new"
    fi
  done
done
echo " done."

# now generate the Supported extra overrides
$MAINTAINCE_CHECK $suite > "$MISCROOT/more-extra.override.$suite.main.supported" 2> _maintenance-check.stderr
if [ $? -eq 0 ]; then
    cat "$MISCROOT/more-extra.override.$suite.main.supported" >> "$MISCROOT/more-extra.override.$suite.main.new"
fi

mv -f "$MISCROOT/more-extra.override.$suite.main.new" "$MISCROOT/more-extra.override.$suite.main"