Subversion Repositories HomeAutomation

Rev

Rev 1683 | Rev 1760 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1683 Rev 1690
Line 13... Line 13...
13
PKGMAINT="Anders Runeson <runeson@gmail.com>"
13
PKGMAINT="Anders Runeson <runeson@gmail.com>"
14
 
14
 
15
RUNDIR=`dirname $0`
15
RUNDIR=`dirname $0`
16
CHLOGDATE=`date -R`
16
CHLOGDATE=`date -R`
17
REVFILE=$RUNDIR/AtomSvnRev
17
REVFILE=$RUNDIR/AtomSvnRev
-
 
18
TMPFILE=/tmp/atompparunning
18
 
19
 
19
CURRREV=`svn info $SVNURL |grep '^Revision:' | sed -e 's/^Revision: //'`
20
CURRREV=`svn info $SVNURL |grep '^Last Changed Rev:' | sed -e 's/^Last Changed Rev: //'`
20
VERSION=1.5.$CURRREV
21
VERSION=1.5.$CURRREV
21
NOSVNDIR=atom-$VERSION
22
NOSVNDIR=atom-$VERSION
22
ORIGTAR=atom_$VERSION.orig.tar.gz
23
ORIGTAR=atom_$VERSION.orig.tar.gz
23
SRCCHFILE=atom_$VERSION\_source.changes
24
SRCCHFILE=atom_$VERSION\_source.changes
24
DPUTFLG="auml-atom-daily $SRCCHFILE"
25
DPUTFLG="auml-atom-daily $SRCCHFILE"
25
 
-
 
26
#echo $RUNDIR
-
 
27
#echo $CURRREV
-
 
28
 
26
 
29
# Run script from cron every hour
27
# Run script from cron every hour
30
# script will check revision of Atom in SVN and if there is a new version the script will
28
# script will check revision of Atom in SVN and if there is a new version the script will
31
# download it and create a complete debian source package and upload to launchpad as a ppa
29
# download it and create a complete debian source package and upload to launchpad as a ppa
32
 
30
 
-
 
31
# Newline and date in log
-
 
32
echo ""
-
 
33
date
33
 
34
 
34
#temporary during development of script
35
# Run next line to force, even if no new svn revision
35
rm -rf $ATOMDIR
36
#rm $REVFILE
-
 
37
 
-
 
38
# Check if script is already running
-
 
39
if [ -e $TMPFILE ]; then
-
 
40
  echo "Error: Already running?"
36
rm $REVFILE
41
  exit 1
-
 
42
fi
37
 
43
 
38
# Check that revision variable is set
44
# Check that revision variable is set
39
if [ -z $CURRREV ]; then
45
if [ -z $CURRREV ]; then
40
  echo "Error: Could not find SVN revision"
46
  echo "Error: Could not find SVN revision"
41
  exit 1
47
  exit 1
Line 45... Line 51...
45
if [ ! $CURRREV -gt 0 ]; then
51
if [ ! $CURRREV -gt 0 ]; then
46
  echo "Error: SVN revision is not greater than 0"
52
  echo "Error: SVN revision is not greater than 0"
47
  exit 1
53
  exit 1
48
fi
54
fi
49
 
55
 
50
# Check if script is already running
56
# Set old revision, in case no file is found
51
if [ -d $ATOMDIR ]; then
57
OLDREV=$CURRREV
52
  echo "Error: Already running?"
-
 
53
  exit 1
-
 
54
fi
-
 
55
 
-
 
56
if [ -e $REVFILE ]; then
58
if [ -e $REVFILE ]; then
57
  # If revision file exists, check current revision
59
  # If revision file exists, check current revision
58
  OLDREV=`cat $REVFILE`
60
  OLDREV=`cat $REVFILE`
59
  if [ "$CURRREV" -le "$OLDREV" ]; then
61
  if [ "$CURRREV" -le "$OLDREV" ]; then
60
    echo "Error: No new svn revision."
62
    echo "Error: No new svn revision."
61
    exit 1
63
    exit 1
62
  fi
64
  fi
63
fi
65
fi
64
 
66
 
-
 
67
# Temporary during development of script, this is needed if tmp dir is kept at the end of the script
65
mkdir $ATOMDIR
68
rm -rf $ATOMDIR
-
 
69
 
-
 
70
# Now running script
-
 
71
touch $TMPFILE
66
 
72
 
67
# Checkout atom and configuration, not needed, can export directly instead
-
 
68
#svn co $SVNURL $ATOMDIR/$SVNDIR
73
mkdir $ATOMDIR
69
#svn co $SVNURLCNF $ATOMDIR/$SVNDIRCNF
-
 
70
 
74
 
71
# Export atom to get rid of .svn subfolders
75
# Export atom to get rid of .svn subfolders
72
svn export $SVNURL $ATOMDIR/$NOSVNDIR
76
svn export $SVNURL $ATOMDIR/$NOSVNDIR
73
#svn export $ATOMDIR/$SVNDIR $ATOMDIR/$NOSVNDIR
-
 
74
# Export configuration folder into the exported Atom-folder
77
# Export configuration folder into the exported Atom-folder
75
svn export $SVNURLCNF $ATOMDIR/$NOSVNDIR/$CNFDIR
78
svn export $SVNURLCNF $ATOMDIR/$NOSVNDIR/$CNFDIR
76
#svn export $ATOMDIR/$SVNDIRCNF $ATOMDIR/$NOSVNDIR/$CNFDIR
-
 
77
 
79
 
78
# Add a svn revision file, atom need the svn revision when building
80
# Add a svn revision file, atom need the svn revision when building
79
echo -n $CURRREV > $ATOMDIR/$NOSVNDIR/AtomSvnRev
81
echo -n $CURRREV > $ATOMDIR/$NOSVNDIR/AtomSvnRev
80
 
82
 
81
# Change install-target for data.xml file in CMakeList.txt, not needed, done in CMakeList.txt
83
# Change install-target for data.xml file in CMakeList.txt, not needed, done in CMakeList.txt
82
#cat $ATOMDIR/$NOSVNDIR/CMakeLists.txt | sed -e 's/\/..\/..\/Configuration\/data.xml/\/Configuration\/data.xml/' > $ATOMDIR/$NOSVNDIR/CMakeLists.txt
84
#cat $ATOMDIR/$NOSVNDIR/CMakeLists.txt | sed -e 's/\/..\/..\/Configuration\/data.xml/\/Configuration\/data.xml/' > $ATOMDIR/$NOSVNDIR/CMakeLists.txt
83
 
85
 
84
# Create change log file by reading log from svn
86
# Create the debian changelog file from svn log
85
SVNLOG=`svn log -r $CURRREV $SVNURL`
-
 
86
 
-
 
87
echo "$PKGNAME ($VERSION) $DIST; urgency=low" > $ATOMDIR/$NOSVNDIR/debian/changelog
87
echo "$PKGNAME ($VERSION) $DIST; urgency=low" > $ATOMDIR/$NOSVNDIR/debian/changelog
88
echo "" >> $ATOMDIR/$NOSVNDIR/debian/changelog
88
echo "" >> $ATOMDIR/$NOSVNDIR/debian/changelog
89
OLDIFS="$IFS"
89
OLDIFS="$IFS"
90
IFS=$'\n'
90
IFS=$'\n'
-
 
91
REVCNT=$CURRREV
-
 
92
# Loop through the revisions
-
 
93
while [ $REVCNT -gt $OLDREV ]; do
-
 
94
  # Add change entries by reading log from svn
-
 
95
  SVNLOG=`svn log -r $REVCNT $SVNURL`
91
for LOGENTRY in $SVNLOG; do
96
  for LOGENTRY in $SVNLOG; do
92
  if [[ ! $LOGENTRY == *--------------* ]]; then
97
    if [[ ! $LOGENTRY == *--------------* ]]; then
93
    echo "  * $LOGENTRY" >> $ATOMDIR/$NOSVNDIR/debian/changelog
98
      echo "  * $LOGENTRY" >> $ATOMDIR/$NOSVNDIR/debian/changelog
94
  fi
99
    fi
-
 
100
  done
-
 
101
  let REVCNT=REVCNT-1
95
done
102
done
96
IFS="$OLDIFS"
103
IFS="$OLDIFS"
97
echo "" >> $ATOMDIR/$NOSVNDIR/debian/changelog
104
echo "" >> $ATOMDIR/$NOSVNDIR/debian/changelog
98
echo " -- $PKGMAINT  $CHLOGDATE" >> $ATOMDIR/$NOSVNDIR/debian/changelog
105
echo " -- $PKGMAINT  $CHLOGDATE" >> $ATOMDIR/$NOSVNDIR/debian/changelog
99
 
106
 
100
# Create orig tar gz
107
# Create orig tar gz
101
cd $ATOMDIR
108
cd $ATOMDIR
102
tar -zcf $ORIGTAR $NOSVNDIR
109
tar -zcf $ORIGTAR $NOSVNDIR
103
 
110
 
104
# Create source package with debuild
111
# Create source package with debuild
105
#cd $ATOMDIR/$NOSVNDIR
112
cd $ATOMDIR/$NOSVNDIR
106
#debuild $DEBUILDFLG
113
debuild $DEBUILDFLG
107
#echo cd $ATOMDIR/$NOSVNDIR
-
 
108
#echo debuild $DEBUILDFLG
-
 
109
 
114
 
110
# Upload to launchpad with dput
115
# Upload to launchpad with dput
111
#cd $ATOMDIR
116
cd $ATOMDIR
112
#dput $DPUTFLG
117
dput $DPUTFLG
113
#echo cd $ATOMDIR
-
 
114
#echo dput $DPUTFLG
-
 
115
# Requires ubuntu 9.10 or newer
118
# Requires ubuntu 9.10 or newer
116
#dput $PPA $SRCCHFILE
119
#dput $PPA $SRCCHFILE
117
 
-
 
118
#echo "the end $RUNDIR"
-
 
119
 
120
 
120
# Remove all temporary files
121
# Remove all temporary files
121
#rm -rf $ATOMDIR
122
#rm -rf $ATOMDIR
122
 
123
 
123
# Write the current svn revision to file
124
# Write the current svn revision to file
124
echo -n $CURRREV > $REVFILE
125
echo -n $CURRREV > $REVFILE
125
 
126
 
126
cd $RUNDIR
127
cd $RUNDIR
-
 
128
 
-
 
129
# Remove temprary running-file
-
 
130
rm $TMPFILE