2 # Build FusionForge packages and create a local repo
4 # Copyright (C) 2011 Roland Mas
5 # Copyright (C) 2011 Olivier Berger - Institut Telecom
6 # Copyright (C) 2014 Inria (Sylvain Beucler)
8 # This file is part of FusionForge. FusionForge is free software;
9 # you can redistribute it and/or modify it under the terms of the
10 # GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the Licence, or (at your option)
14 # FusionForge is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 # Debian and Fedora/CentOS/RHEL *package building* are so different
26 # that there's nothing to factour out, so they are in separate functions.
29 export DEBIAN_FRONTEND=noninteractive
31 # Install build dependencies
32 apt-get -y install mini-dinstall dput devscripts fakeroot
33 apt-get -y install build-essential \
34 $(grep Build-Depends /usr/src/fusionforge/src/debian/control.in | sed -e 's/Build-Depends: //' -e 's/(.*)//')
35 apt-get -y install php5-cli # debian/gen_control.sh
38 # Populate a local Debian packages repository for APT managed with mini-dinstall
39 #rm -rf /usr/src/debian-repository
40 mkdir -p /usr/src/debian-repository
42 cat >/root/.mini-dinstall.conf <<-EOF
44 archivedir = /usr/src/debian-repository
50 release_signscript = /usr/src/fusionforge/autoinstall/mini-dinstall-sign.sh
53 mail_on_success = false
58 export GNUPGHOME=/usr/src/gnupg
59 if [ ! -e $GNUPGHOME ]; then
60 mkdir -m 700 $GNUPGHOME
61 # Quick 'n Dirty hack to get entropy on VMs
62 # https://bugs.launchpad.net/ubuntu/+source/gnupg/+bug/706011
63 # (don't do this for a public repo!)
64 apt-get install -y rng-tools
65 echo HRNGDEVICE=/dev/urandom >> /etc/default/rng-tools
66 service rng-tools restart
67 gpg --batch --gen-key <<-EOF
72 Name-Real: FusionForge
77 gpg --export FusionForge -a > /usr/src/debian-repository/key.asc
78 apt-key add /usr/src/debian-repository/key.asc
82 # Configure debian package building tools so as to use the local repo
83 if [ ! -f /root/.dput.cf ]; then
84 cat > /root/.dput.cf <<-EOF
87 incoming = /usr/src/debian-repository/mini-dinstall/incoming
90 allow_unsigned_uploads = yes
91 post_upload_command = mini-dinstall -b
92 allowed_distributions = local
96 if [ ! -f /root/.devscripts ]; then
97 cat > /root/.devscripts <<-EOF
98 DEBRELEASE_UPLOADER=dput
99 DEBUILD_DPKG_BUILDPACKAGE_OPTS=-i
103 # Finally, build the FusionForge packages
105 cd $(dirname $0)/../src/
106 cp -a debian/changelog $f
108 version=$(dpkg-parsechangelog | sed -n 's/^Version: \([0-9.]\+\(\~rc[0-9]\)\?\).*/\1/p')+$(date +%Y%m%d%H%M)
109 debian/rules debian/control # re-gen debian/control
110 dch --newversion $version-1 --distribution local --force-distribution "Autobuilt."
111 make dist VERSION=$version
112 mv fusionforge-$version.tar.bz2 ../fusionforge_$version.orig.tar.bz2
115 tar xf fusionforge_$version.orig.tar.bz2
116 cd fusionforge-$version/
117 debuild -us -uc -tc # using -tc so 'git status' is readable
118 # Install built packages into the local repo
122 mv $f src/debian/changelog
124 # Declare the repo so that packages become installable
125 echo 'deb file:///usr/src/debian-repository local/' > /etc/apt/sources.list.d/local.list
131 # Install build dependencies
133 yum install -y make gettext tar bzip2 rpm-build createrepo
134 yum install -y php-cli # rpm/gen_spec.sh
137 cd /usr/src/fusionforge/src/
138 base_version=$(make version)
139 snapshot=$(date +%Y%m%d%H%M)
140 version=$base_version+$snapshot
141 rpm/gen_spec.sh $base_version $snapshot
142 make dist VERSION=$version
143 mkdir -p ../build/SOURCES/ ../build/SPECS/
144 mv fusionforge-$version.tar.bz2 ../build/SOURCES/fusionforge-$version.tar.bz2
145 chown -h root: ../build/SOURCES/fusionforge-$version.tar.bz2
146 cp fusionforge.spec ../build/SPECS/
147 rpmbuild ../build/SPECS/fusionforge.spec --define "_topdir $(pwd)/../build" -ba
149 (cd ../build/RPMS/ && createrepo .)
150 cat <<-EOF > /etc/yum.repos.d/local.repo
153 baseurl=file:///usr/src/fusionforge/build/RPMS/
159 if [ -e /etc/debian_version ]; then
161 elif [ -e /etc/redhat-release ]; then
164 echo "Automated package building is not supported for this distribution."
165 echo "See https://fusionforge.org/plugins/mediawiki/wiki/fusionforge/index.php/Installing/FromSource"
166 echo "for instructions"