~ubuntu-core-dev/ubuntu-release-upgrader/trunk

« back to all changes in this revision

Viewing changes to pre-build.sh

  • Committer: Balint Reczey
  • Date: 2019-12-17 20:29:55 UTC
  • Revision ID: balint.reczey@canonical.com-20191217202955-nqe4xz2c54s60y59
Moved to git at https://git.launchpad.net/ubuntu-release-upgrader

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
set -e
4
 
 
5
 
# The testsuite has a sad if you're in a non-UTF-8 locale:
6
 
export LANG='C.UTF-8'
7
 
 
8
 
dpkg-checkbuilddeps -d 'python3-apt, apt-btrfs-snapshot, parsewiki, python3-feedparser,
9
 
                        python3-mock, xvfb, gir1.2-gtk-3.0, python3-gi, python3-nose, pep8, python3-distutils-extra, python3-update-manager'
10
 
 
11
 
# make sure the DistUpgrade symlink is good LP: #1824430
12
 
SYMLINK=$(readlink -q DistUpgrade/DistUpgrade)
13
 
if [ $SYMLINK != "." ]; then
14
 
   echo "DistUpgrade/DistUpgrade is not a symlink to itself"
15
 
   exit 1
16
 
fi
17
 
 
18
 
# run the test-suite
19
 
# echo "Running integrated tests"
20
 
xvfb-run nosetests3
21
 
 
22
 
# test leftovers
23
 
# echo "Cleaning up after tests"
24
 
rm -f ./tests/data-sources-list-test/apt.log
25
 
rm -f ./tests/data-sources-list-test/Ubuntu.mirrors
26
 
 
27
 
# update demotions
28
 
max_age=$(($(date +%s) - 3600))
29
 
if [ $(stat -c '%Y' utils/demoted.cfg) -lt $max_age ]; then
30
 
    # echo "Running demotions"
31
 
    (cd utils && ./demotions.py eoan focal > demoted.cfg)
32
 
fi
33
 
# when this gets enabled, make sure to add symlink in DistUpgrade
34
 
if [ $(stat -c "%Y" utils/demoted.cfg.bionic) -lt $max_age ]; then
35
 
    # echo "Running lts demotions"
36
 
    (cd utils && ./demotions.py bionic focal > demoted.cfg.bionic)
37
 
fi
38
 
 
39
 
# update apt_btrfs_snapshot.py copy, this needs an installed
40
 
# apt-btrfs-snapshot on the build machine
41
 
if [ ! -e /usr/lib/python3/dist-packages/apt_btrfs_snapshot.py ]; then
42
 
    echo "please sudo apt-get install apt-btrfs-snapshot"
43
 
    exit 1
44
 
fi
45
 
echo "copying apt_btrfs_snapshot.py for the upgrader tarball"
46
 
cp /usr/lib/python3/dist-packages/apt_btrfs_snapshot.py DistUpgrade
47
 
 
48
 
# update invoke-rc.d copy, requires init-system-helpers
49
 
if [ ! -e /usr/sbin/invoke-rc.d ]; then
50
 
    echo "please sudo apt install init-system-helpers"
51
 
    exit 1
52
 
fi
53
 
if [ ! -e /usr/bin/patch ]; then
54
 
    echo "please sudo apt install patch"
55
 
    exit 1
56
 
fi
57
 
echo "copying invoke-rc.d for the upgrader tarball"
58
 
cp /usr/sbin/invoke-rc.d DistUpgrade/imported/
59
 
# now patch the file so the upgrade can continue even if there are errors
60
 
patch --fuzz=0 -p0 DistUpgrade/imported/invoke-rc.d DistUpgrade/imported/invoke-rc.d.diff || { echo "patch didn't apply cleanly" && exit 1; }
61
 
 
62
 
# update the translations
63
 
cd po; make update-po; cd ../
64
 
 
65
 
# (auto) generate the required html
66
 
if [ ! -x /usr/bin/parsewiki ]; then
67
 
    echo "please sudo apt-get install parsewiki"
68
 
    exit 1
69
 
fi
70
 
# confirm we have the release version appearing the right number of times in each Announcement
71
 
DEBRELEASE=$(LC_ALL=C dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p' | sed s/-.\*//)
72
 
(cd DistUpgrade;
73
 
 if [ $(grep -ic $DEBRELEASE DevelReleaseAnnouncement) != 1 ]; then
74
 
    echo "Confirm $DEBRELEASE is correct in DevelReleaseAnnouncement"
75
 
    exit 1
76
 
 fi
77
 
 parsewiki DevelReleaseAnnouncement > DevelReleaseAnnouncement.html;
78
 
 if [ $(grep -ic $DEBRELEASE ReleaseAnnouncement) != 3 ]; then
79
 
    echo "Confirm $DEBRELEASE is correct in ReleaseAnnouncement"
80
 
    exit 1
81
 
 fi
82
 
 parsewiki ReleaseAnnouncement > ReleaseAnnouncement.html;
83
 
 if [ $(grep -ic $DEBRELEASE EOLReleaseAnnouncement) != 1 ]; then
84
 
    echo "Confirm $DEBRELEASE is correct in EOLReleaseAnnouncement"
85
 
    exit 1
86
 
 fi
87
 
 parsewiki EOLReleaseAnnouncement > EOLReleaseAnnouncement.html;
88
 
)
89
 
 
90
 
# cleanup
91
 
rm -rf utils/apt/lists utils/apt/*.bin utils/apt/sources.list
92
 
max_age=$(($(date +%s) - 3600))
93
 
if [ $(stat -c "%Y" data/mirrors.cfg) -lt $max_age ]; then
94
 
    # echo "Running update mirrors"
95
 
    (cd utils && ./update_mirrors.py ../data/mirrors.cfg)
96
 
fi
97
 
 
98
 
# update version
99
 
DEBVER=$(LC_ALL=C dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p' | sed s/.*://)
100
 
echo "VERSION = '$DEBVER'" > DistUpgrade/DistUpgradeVersion.py