Rev 1965 | Rev 2015 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1965 | Rev 2000 | ||
|---|---|---|---|
| 1 | #!/bin/bash |
1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | if [ $# -lt 1 ] |
3 | if [ $# -lt 1 ] |
| 4 | then |
4 | then |
| 5 | echo "Error: need to run script with ubuntu releasename as argument" |
5 | echo "Error: need to run script with ubuntu releasename as argument" |
| 6 | exit 1 |
6 | exit 1 |
| 7 | fi |
7 | fi |
| 8 | 8 | ||
| 9 | #exit 1 |
9 | #exit 1 |
| 10 | 10 | ||
| 11 | ATOMDIR=/tmp/atomppa |
11 | ATOMDIR=/tmp/atomppa |
| 12 | SVNURL=http://svn.arune.se/svn/HomeAutomation/trunk/PcSoftware/Atom1.5 |
12 | SVNURL=http://svn.arune.se/svn/HomeAutomation/trunk/PcSoftware/Atom1.5 |
| 13 | SVNURLCNF=http://svn.arune.se/svn/HomeAutomation/trunk/Configuration |
13 | SVNURLCNF=http://svn.arune.se/svn/HomeAutomation/trunk/Configuration |
| 14 | SVNDIR=AtomSvn |
14 | SVNDIR=AtomSvn |
| 15 | SVNDIRCNF=ConfigSvn |
15 | SVNDIRCNF=ConfigSvn |
| 16 | CNFDIR=Configuration |
16 | CNFDIR=Configuration |
| 17 | PPA=ppa:arune/auml-atom-daily |
17 | PPA=ppa:arune/auml-atom-daily |
| 18 | DEBUILDFLG="-S -sa -k7EA270B4" |
18 | DEBUILDFLG="-S -sa -k7EA270B4" |
| 19 | PKGNAME=atom |
19 | PKGNAME=atom |
| 20 | PKGMAINT="Anders Runeson <runeson@gmail.com>" |
20 | PKGMAINT="Anders Runeson <runeson@gmail.com>" |
| 21 | 21 | ||
| 22 | # Dist name from command line argument |
22 | # Dist name from command line argument |
| 23 | DIST=$1 |
23 | DIST=$1 |
| 24 | RUNDIR=`dirname $0` |
24 | RUNDIR=`dirname $0` |
| 25 | CHLOGDATE=`date -R` |
25 | CHLOGDATE=`date -R` |
| 26 | REVFILE=$RUNDIR/AtomSvnRev-$DIST |
26 | REVFILE=$RUNDIR/AtomSvnRev-$DIST |
| 27 | TMPFILE=/tmp/atompparunning |
27 | TMPFILE=/tmp/atompparunning |
| 28 | 28 | ||
| 29 | CURRREV=`svn info $SVNURL |grep '^Last Changed Rev:' | sed -e 's/^Last Changed Rev: //'` |
29 | CURRREV=`svn info $SVNURL |grep '^Last Changed Rev:' | sed -e 's/^Last Changed Rev: //'` |
| 30 | VERSION=1.5.${CURRREV}ppa1~${DIST} |
30 | VERSION=1.5.${CURRREV}ppa1~${DIST} |
| 31 | # Dir name of atom svn export (no svn folders) |
31 | # Dir name of atom svn export (no svn folders) |
| 32 | NOSVNDIR=atom-$VERSION |
32 | NOSVNDIR=atom-$VERSION |
| 33 | # File name to use for tarball with original source, NOSVNDIR will be compressed to this file |
33 | # File name to use for tarball with original source, NOSVNDIR will be compressed to this file |
| 34 | ORIGTAR=atom_$VERSION.orig.tar.gz |
34 | ORIGTAR=atom_$VERSION.orig.tar.gz |
| 35 | # File with source changes (?) |
35 | # File with source changes (?) |
| 36 | SRCCHFILE=atom_$VERSION\_source.changes |
36 | SRCCHFILE=atom_$VERSION\_source.changes |
| 37 | # Dput is called with these flags |
37 | # Dput is called with these flags |
| 38 | DPUTFLG="auml-atom-daily $SRCCHFILE" |
38 | DPUTFLG="auml-atom-daily $SRCCHFILE" |
| 39 | 39 | ||
| 40 | case $DIST in |
40 | case $DIST in |
| 41 | oneiric) |
41 | oneiric) |
| 42 | DEPS="libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libboost-thread1.46.1, libboost-system1.46.1, libboost-signals1.46.1, libboost-filesystem1.46.1, libboost-date-time1.46.1, libboost-program-options1.46.1, libv8-3.1.8. |
42 | DEPS="libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libboost-thread1.46.1, libboost-system1.46.1, libboost-signals1.46.1, libboost-filesystem1.46.1, libboost-date-time1.46.1, libboost-program-options1.46.1, libv8-3.1.8.22, libmysqlclient16" |
| 43 | BDEPS="debhelper (>= 7.0.50~), cmake, libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libv8-dev (>= 2.2.18), libboost-date-time1.46-dev, libboost-filesystem1.46-dev, libboost-program-options1.46-dev, libboost-signals1.46-dev, libboost-thread1.46-dev, libreadline-dev, libx11-dev (>= 2:1.3), libmysqlclient-dev" |
43 | BDEPS="debhelper (>= 7.0.50~), cmake, libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libv8-dev (>= 2.2.18), libboost-date-time1.46-dev, libboost-filesystem1.46-dev, libboost-program-options1.46-dev, libboost-signals1.46-dev, libboost-thread1.46-dev, libreadline-dev, libx11-dev (>= 2:1.3), libmysqlclient-dev" |
| 44 | ;; |
44 | ;; |
| 45 | precise) |
45 | precise) |
| 46 | DEPS="libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libboost-thread1.48.0, libboost-system1.48.0, libboost-signals1.48.0, libboost-filesystem1.48.0, libboost-date-time1.48.0, libboost-program-options1.48.0, libv8-3.7.12. |
46 | DEPS="libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libboost-thread1.48.0, libboost-system1.48.0, libboost-signals1.48.0, libboost-filesystem1.48.0, libboost-date-time1.48.0, libboost-program-options1.48.0, libv8-3.7.12.22, libmysqlclient18" |
| 47 | BDEPS="debhelper (>= 7.0.50~), cmake, libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libv8-dev (>= 2.2.18), libboost-date-time1.48-dev, libboost-filesystem1.48-dev, libboost-program-options1.48-dev, libboost-signals1.48-dev, libboost-thread1.48-dev, libreadline-dev, libx11-dev (>= 2:1.3), libmysqlclient-dev" |
47 | BDEPS="debhelper (>= 7.0.50~), cmake, libc6 (>= 2.3.6), libgcc1 (>= 1:4.1), libv8-dev (>= 2.2.18), libboost-date-time1.48-dev, libboost-filesystem1.48-dev, libboost-program-options1.48-dev, libboost-signals1.48-dev, libboost-thread1.48-dev, libreadline-dev, libx11-dev (>= 2:1.3), libmysqlclient-dev" |
| 48 | ;; |
48 | ;; |
| 49 | esac |
49 | esac |
| 50 | 50 | ||
| 51 | # Run script from cron every hour |
51 | # Run script from cron every hour |
| 52 | # script will check revision of Atom in SVN and if there is a new version the script will |
52 | # script will check revision of Atom in SVN and if there is a new version the script will |
| 53 | # download it and create a complete debian source package and upload to launchpad as a ppa |
53 | # download it and create a complete debian source package and upload to launchpad as a ppa |
| 54 | 54 | ||
| 55 | # Newline and date in log |
55 | # Newline and date in log |
| 56 | echo "" |
56 | echo "" |
| 57 | date |
57 | date |
| 58 | 58 | ||
| 59 | # Run next line to force, even if no new svn revision |
59 | # Run next line to force, even if no new svn revision |
| 60 | #rm $REVFILE |
60 | #rm $REVFILE |
| 61 | 61 | ||
| 62 | # Check if script is already running |
62 | # Check if script is already running |
| 63 | if [ -e $TMPFILE ]; then |
63 | if [ -e $TMPFILE ]; then |
| 64 | echo "Error: Already running?" |
64 | echo "Error: Already running?" |
| 65 | exit 1 |
65 | exit 1 |
| 66 | fi |
66 | fi |
| 67 | 67 | ||
| 68 | # Check that revision variable is set |
68 | # Check that revision variable is set |
| 69 | if [ -z $CURRREV ]; then |
69 | if [ -z $CURRREV ]; then |
| 70 | echo "Error: Could not find SVN revision" |
70 | echo "Error: Could not find SVN revision" |
| 71 | exit 1 |
71 | exit 1 |
| 72 | fi |
72 | fi |
| 73 | 73 | ||
| 74 | # Check that revision is sane |
74 | # Check that revision is sane |
| 75 | if [ ! $CURRREV -gt 0 ]; then |
75 | if [ ! $CURRREV -gt 0 ]; then |
| 76 | echo "Error: SVN revision is not greater than 0" |
76 | echo "Error: SVN revision is not greater than 0" |
| 77 | exit 1 |
77 | exit 1 |
| 78 | fi |
78 | fi |
| 79 | 79 | ||
| 80 | # Set old revision, in case no file is found |
80 | # Set old revision, in case no file is found |
| 81 | OLDREV=$CURRREV |
81 | OLDREV=$CURRREV |
| 82 | if [ -e $REVFILE ]; then |
82 | if [ -e $REVFILE ]; then |
| 83 | # If revision file exists, check current revision |
83 | # If revision file exists, check current revision |
| 84 | OLDREV=`cat $REVFILE` |
84 | OLDREV=`cat $REVFILE` |
| 85 | if [ "$CURRREV" -le "$OLDREV" ]; then |
85 | if [ "$CURRREV" -le "$OLDREV" ]; then |
| 86 | echo "Error: No new svn revision." |
86 | echo "Error: No new svn revision." |
| 87 | exit 1 |
87 | exit 1 |
| 88 | fi |
88 | fi |
| 89 | fi |
89 | fi |
| 90 | 90 | ||
| 91 | # Temporary during development of script, this is needed if tmp dir is kept at the end of the script |
91 | # Temporary during development of script, this is needed if tmp dir is kept at the end of the script |
| 92 | rm -rf $ATOMDIR |
92 | rm -rf $ATOMDIR |
| 93 | 93 | ||
| 94 | # Now running script |
94 | # Now running script |
| 95 | touch $TMPFILE |
95 | touch $TMPFILE |
| 96 | 96 | ||
| 97 | mkdir $ATOMDIR |
97 | mkdir $ATOMDIR |
| 98 | 98 | ||
| 99 | # Export atom to get rid of .svn subfolders |
99 | # Export atom to get rid of .svn subfolders |
| 100 | svn export $SVNURL $ATOMDIR/$NOSVNDIR |
100 | svn export $SVNURL $ATOMDIR/$NOSVNDIR |
| 101 | # Export configuration folder into the exported Atom-folder |
101 | # Export configuration folder into the exported Atom-folder |
| 102 | svn export $SVNURLCNF $ATOMDIR/$NOSVNDIR/$CNFDIR |
102 | svn export $SVNURLCNF $ATOMDIR/$NOSVNDIR/$CNFDIR |
| 103 | 103 | ||
| 104 | mkdir -p $ATOMDIR/$NOSVNDIR/debian |
104 | mkdir -p $ATOMDIR/$NOSVNDIR/debian |
| 105 | 105 | ||
| 106 | # Add a svn revision file, atom need the svn revision when building |
106 | # Add a svn revision file, atom need the svn revision when building |
| 107 | echo -n $CURRREV > $ATOMDIR/$NOSVNDIR/AtomSvnRev |
107 | echo -n $CURRREV > $ATOMDIR/$NOSVNDIR/AtomSvnRev |
| 108 | 108 | ||
| 109 | # Change install-target for data.xml file in CMakeList.txt, not needed, done in CMakeList.txt |
109 | # Change install-target for data.xml file in CMakeList.txt, not needed, done in CMakeList.txt |
| 110 | #cat $ATOMDIR/$NOSVNDIR/CMakeLists.txt | sed -e 's/\/..\/..\/Configuration\/data.xml/\/Configuration\/data.xml/' > $ATOMDIR/$NOSVNDIR/CMakeLists.txt |
110 | #cat $ATOMDIR/$NOSVNDIR/CMakeLists.txt | sed -e 's/\/..\/..\/Configuration\/data.xml/\/Configuration\/data.xml/' > $ATOMDIR/$NOSVNDIR/CMakeLists.txt |
| 111 | 111 | ||
| 112 | 112 | ||
| 113 | cp $RUNDIR/files/atom.conf $ATOMDIR/$NOSVNDIR/debian/ |
113 | cp $RUNDIR/files/atom.conf $ATOMDIR/$NOSVNDIR/debian/ |
| 114 | cp $RUNDIR/files/compat $ATOMDIR/$NOSVNDIR/debian/ |
114 | cp $RUNDIR/files/compat $ATOMDIR/$NOSVNDIR/debian/ |
| 115 | cp $RUNDIR/files/copyright $ATOMDIR/$NOSVNDIR/debian/ |
115 | cp $RUNDIR/files/copyright $ATOMDIR/$NOSVNDIR/debian/ |
| 116 | cp $RUNDIR/files/rules $ATOMDIR/$NOSVNDIR/debian/ |
116 | cp $RUNDIR/files/rules $ATOMDIR/$NOSVNDIR/debian/ |
| 117 | cp $RUNDIR/files/control $ATOMDIR/$NOSVNDIR/debian/ |
117 | cp $RUNDIR/files/control $ATOMDIR/$NOSVNDIR/debian/ |
| 118 | 118 | ||
| 119 | # Set the correct depends and build depends, different for different distributions |
119 | # Set the correct depends and build depends, different for different distributions |
| 120 | sed -i "s/^Build-Depends/Build-Depends: ${BDEPS}/g" $ATOMDIR/$NOSVNDIR/debian/control |
120 | sed -i "s/^Build-Depends/Build-Depends: ${BDEPS}/g" $ATOMDIR/$NOSVNDIR/debian/control |
| 121 | sed -i "s/^Depends/Depends: ${DEPS}/g" $ATOMDIR/$NOSVNDIR/debian/control |
121 | sed -i "s/^Depends/Depends: ${DEPS}/g" $ATOMDIR/$NOSVNDIR/debian/control |
| 122 | 122 | ||
| 123 | # Create the debian changelog file from svn log |
123 | # Create the debian changelog file from svn log |
| 124 | echo "$PKGNAME ($VERSION) $DIST; urgency=low" > $ATOMDIR/$NOSVNDIR/debian/changelog |
124 | echo "$PKGNAME ($VERSION) $DIST; urgency=low" > $ATOMDIR/$NOSVNDIR/debian/changelog |
| 125 | echo "" >> $ATOMDIR/$NOSVNDIR/debian/changelog |
125 | echo "" >> $ATOMDIR/$NOSVNDIR/debian/changelog |
| 126 | OLDIFS="$IFS" |
126 | OLDIFS="$IFS" |
| 127 | IFS=$'\n' |
127 | IFS=$'\n' |
| 128 | REVCNT=$CURRREV |
128 | REVCNT=$CURRREV |
| 129 | # Loop through the revisions |
129 | # Loop through the revisions |
| 130 | while [ $REVCNT -gt $OLDREV ]; do |
130 | while [ $REVCNT -gt $OLDREV ]; do |
| 131 | # Add change entries by reading log from svn |
131 | # Add change entries by reading log from svn |
| 132 | SVNLOG=`svn log -r $REVCNT $SVNURL` |
132 | SVNLOG=`svn log -r $REVCNT $SVNURL` |
| 133 | for LOGENTRY in $SVNLOG; do |
133 | for LOGENTRY in $SVNLOG; do |
| 134 | if [[ ! $LOGENTRY == *--------------* ]]; then |
134 | if [[ ! $LOGENTRY == *--------------* ]]; then |
| 135 | echo " * $LOGENTRY" >> $ATOMDIR/$NOSVNDIR/debian/changelog |
135 | echo " * $LOGENTRY" >> $ATOMDIR/$NOSVNDIR/debian/changelog |
| 136 | fi |
136 | fi |
| 137 | done |
137 | done |
| 138 | let REVCNT=REVCNT-1 |
138 | let REVCNT=REVCNT-1 |
| 139 | done |
139 | done |
| 140 | IFS="$OLDIFS" |
140 | IFS="$OLDIFS" |
| 141 | echo "" >> $ATOMDIR/$NOSVNDIR/debian/changelog |
141 | echo "" >> $ATOMDIR/$NOSVNDIR/debian/changelog |
| 142 | echo " -- $PKGMAINT $CHLOGDATE" >> $ATOMDIR/$NOSVNDIR/debian/changelog |
142 | echo " -- $PKGMAINT $CHLOGDATE" >> $ATOMDIR/$NOSVNDIR/debian/changelog |
| 143 | 143 | ||
| 144 | 144 | ||
| 145 | # Create orig tar gz |
145 | # Create orig tar gz |
| 146 | cd $ATOMDIR |
146 | cd $ATOMDIR |
| 147 | tar -zcf $ORIGTAR $NOSVNDIR |
147 | tar -zcf $ORIGTAR $NOSVNDIR |
| 148 | 148 | ||
| 149 | # Create source package with debuild |
149 | # Create source package with debuild |
| 150 | cd $ATOMDIR/$NOSVNDIR |
150 | cd $ATOMDIR/$NOSVNDIR |
| 151 | debuild $DEBUILDFLG |
151 | debuild $DEBUILDFLG |
| 152 | 152 | ||
| 153 | # Upload to launchpad with dput |
153 | # Upload to launchpad with dput |
| 154 | cd $ATOMDIR |
154 | cd $ATOMDIR |
| 155 | dput $DPUTFLG |
155 | dput $DPUTFLG |
| 156 | # Requires ubuntu 9.10 or newer |
156 | # Requires ubuntu 9.10 or newer |
| 157 | #dput $PPA $SRCCHFILE |
157 | #dput $PPA $SRCCHFILE |
| 158 | 158 | ||
| 159 | # Remove all temporary files |
159 | # Remove all temporary files |
| 160 | #rm -rf $ATOMDIR |
160 | #rm -rf $ATOMDIR |
| 161 | 161 | ||
| 162 | # Write the current svn revision to file |
162 | # Write the current svn revision to file |
| 163 | echo -n $CURRREV > $REVFILE |
163 | echo -n $CURRREV > $REVFILE |
| 164 | 164 | ||
| 165 | cd $RUNDIR |
165 | cd $RUNDIR |
| 166 | 166 | ||
| 167 | # Remove temprary running-file |
167 | # Remove temprary running-file |
| 168 | rm $TMPFILE |
168 | rm $TMPFILE |
| 169 | 169 | ||