summaryrefslogtreecommitdiffstats
path: root/build-stage3.sh
blob: ffd332f11355fe62a6c9132592d68516ce334c13 (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
#!/bin/bash

emerge -u catalyst pixz
version_stamp="$(date +%Y%m%d).graphite"

if [[ ! -f .catalyst-accept-keywords ]]; then
  echo -e '\nexport ACCEPT_KEYWORDS="~amd64"' >> /etc/catalyst/catalystrc
  touch .catalyst-accept-keywords
fi

if [[ ! -f .catalyst-prep-done ]]; then
  builddate=$(wget --quiet -O - http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/ | sed -nr "s/.*href=\"stage3-amd64-openrc-([0-9].*).tar.xz\">.*/\1/p")
  if [[ ! -f "stage3-amd64-openrc-$builddate.tar.xz" ]]; then
    wget http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/stage3-amd64-openrc-$builddate.tar.xz
  fi

  (git clone https://github.com/gentoo/releng.git; cd releng; patch -p1 < ../0001-releng-gcc-add-graphite-support.patch)

  mkdir -p /var/tmp/catalyst/builds/default
  mkdir -p /var/tmp/catalyst/snapshot_cache/latest
  cp -v "stage3-amd64-openrc-$builddate.tar.xz" /var/tmp/catalyst/builds/default/stage3-amd64-openrc-latest.tar.xz
  emerge --sync
  catalyst -s latest
  touch .catalyst-prep-done
fi

cp -v releng/releases/specs/amd64/stage{1,2,3}-openrc.spec .

sed -i "s/version_stamp: openrc-@TIMESTAMP@/version_stamp: $version_stamp/" stage1-openrc.spec
sed -i "s/snapshot: @TIMESTAMP@/snapshot: latest/" stage1-openrc.spec
sed -i "s#@REPO_DIR@#$(pwd)/releng#g" stage1-openrc.spec
sed -i "s/version_stamp: openrc-@TIMESTAMP@/version_stamp: $version_stamp/" stage2-openrc.spec
sed -i "s/snapshot: @TIMESTAMP@/snapshot: latest/" stage2-openrc.spec
sed -i "s/source_subpath: default\/stage1-amd64-openrc-@TIMESTAMP@/source_subpath: default\/stage1-amd64-$version_stamp/" stage2-openrc.spec
sed -i "s#@REPO_DIR@#$(pwd)/releng#g" stage2-openrc.spec
sed -i "s/version_stamp: openrc-@TIMESTAMP@/version_stamp: $version_stamp/" stage3-openrc.spec
sed -i "s/snapshot: @TIMESTAMP@/snapshot: latest/" stage3-openrc.spec
sed -i "s/source_subpath: default\/stage2-amd64-openrc-@TIMESTAMP@/source_subpath: default\/stage2-amd64-$version_stamp/" stage3-openrc.spec
sed -i "s#@REPO_DIR@#$(pwd)/releng#g" stage3-openrc.spec

catalyst -f stage1-openrc.spec
catalyst -f stage2-openrc.spec
catalyst -f stage3-openrc.spec

cp -v /var/tmp/catalyst/builds/default/stage3-amd64-$version_stamp.tar.xz .