Changeset 2273 for scripts/autobuild.bash
- Timestamp:
- 10/22/07 07:27:10 (6 years ago)
- File:
-
- 1 edited
-
scripts/autobuild.bash (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
scripts/autobuild.bash
r2271 r2273 5 5 # 6 6 # Created: 2007-10-20 15:10 +330 GMT 7 # Updated: 2007-10-2 1 14:39+330 GMT7 # Updated: 2007-10-22 08:55 +330 GMT 8 8 # 9 9 # TODO: … … 14 14 LOCAL_REPO_PATH="/home/parsix/public_html/packages/pool" 15 15 LOCAL_REPO_ROOT="/home/parsix/public_html/packages/" 16 APT_MIRROR="ftp://ftp.de.debian.org/debian" 16 17 SRC_PKG_NAME="$1" 17 18 DIST_NAME="$2" 18 19 UNDERLINE=$'\137' # 137 is octal ASCII code for '_' 19 20 20 # Define some colors first:21 # Define some colors 21 22 GREEN="[1;32m" 22 23 YELLOW="[1;33m" … … 28 29 NORMAL="[0;39m" 29 30 31 # Define core functions 32 33 # Reverts /etc/pbuilderrc base.tgz changes 34 revert_pbrc() 35 { 36 sed -i s/base-$PXBUILDARCH.tgz/base.tgz/g /etc/pbuilderrc 37 } 38 39 # Fixes /etc/pbuilderrc base.tgz 40 fix_pbrc() 41 { 42 sed -i s/base.tgz/base-$PXBUILDARCH.tgz/g /etc/pbuilderrc 43 } 44 45 # Builds or updates needed chroots 46 handle_chroot() 47 { 48 if [ ! -f /var/cache/pbuilder/base-$PXBUILDARCH.tgz ]; then 49 echo "${GREEN}Creating ${YELLOW}$PXBUILDARCH${NORMAL} ${GREEN}chroot...${NORMAL}" 50 pbuilder --create --distribution lenny --override-config --debootstrap debootstrap --debootstrapopts --arch --debootstrapopts $PXBUILDARCH --logfile $LOG_FILE --mirror $APT_MIRROR --othermirror "deb http://parsix.org/packages ramon main contrib non-free" &> /dev/null || echo "Build failed" >> $LOG_FILE && revert_pbrc && exit 51 else 52 echo "${GREEN}Updating ${YELLOW}$PXBUILDARCH${NORMAL} ${GREEN}chroot...${NORMAL}" 53 pbuilder --update --distribution lenny --override-config --debootstrap debootstrap --debootstrapopts --arch --debootstrapopts $PXBUILDARCH --logfile $LOG_FILE --mirror $APT_MIRROR --othermirror "deb http://parsix.org/packages ramon main contrib non-free" &> /dev/null || echo "Build failed" >> $LOG_FILE && revert_pbrc && exit 54 fi 55 } 56 30 57 # Checking required inputs 31 58 if [ -z "$1" ]; then … … 52 79 fi 53 80 81 # Check if package exists on the SVN repo 54 82 if [ -d $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME ]; then 55 83 cd $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME 56 84 else 57 echo "${GREEN}SVN directory does not exists, exiting...${NORMAL}" 58 exit 85 # Local working copy is out dated? 86 svn up &> /dev/null 87 if [ -d $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME ]; then 88 cd $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME 89 else 90 echo "${GREEN}SVN directory does not exists, exiting...${NORMAL}" 91 exit 92 fi 59 93 fi 60 94 … … 83 117 # Log filename 84 118 LOG_FILE="$LOCAL_REPO_ROOT../buildlogs/$SRC_PKG_NAME$UNDERLINE$UPSTREAM_VERSION-$PKG_REVISION.log" 85 86 # Clean up log 87 rm $LOG_FILE &> /dev/null 119 LOG_PATH="$LOCAL_REPO_ROOT../buildlogs" 120 121 # Clean up old logs 122 rm $LOG_PATH/$SRC_PKG_NAME* &> /dev/null 88 123 89 124 # clean up untarred packages … … 116 151 # Check if both tarballs exist 117 152 if [ ! -f tarballs/$SRC_PKG_NAME$UNDERLINE$UPSTREAM_VERSION.orig.tar.gz ]; then 118 echo "${RED}Source tarball not found${NORMAL}" && e xit 3153 echo "${RED}Source tarball not found${NORMAL}" && echo "Build failed" >> $LOG_FILE && exit 119 154 fi 120 155 121 156 if [ ! -f $LOCAL_REPO_PATH/$COMPONENT/$POOL/$SRC_PKG_NAME/$SRC_PKG_NAME$UNDERLINE$UPSTREAM_VERSION.orig.tar.gz ]; then 122 echo "${RED}Source tarball not found on repo${NORMAL}" && e xit 4157 echo "${RED}Source tarball not found on repo${NORMAL}" && echo "Build failed" >> $LOG_FILE && exit 123 158 fi 124 159 … … 126 161 cd trunk/ 127 162 128 # Fixing /etc/pbuilderrc 163 # Fixing /etc/pbuilderrc base.tgz 129 164 PXBUILDARCH="amd64" 130 sed -i s/base.tgz/base-$PXBUILDARCH.tgz/g /etc/pbuilderrc165 fix_pbrc 131 166 132 167 # Build amd64 chroot if needed 133 if [ ! -f /var/cache/pbuilder/base-$PXBUILDARCH.tgz ]; then 134 echo "${GREEN}Creating ${YELLOW}amd64${NORMAL} ${GREEN}chroot...${NORMAL}" 135 pbuilder --create --distribution lenny --override-config --debootstrap debootstrap --debootstrapopts --arch --debootstrapopts amd64 --logfile $LOG_FILE --mirror ftp://ftp.de.debian.org/debian --othermirror "deb http://parsix.org/packages ramon main contrib non-free" &> /dev/null || exit 5 136 else 137 echo "${GREEN}Updating ${YELLOW}amd64${NORMAL} ${GREEN}chroot...${NORMAL}" 138 pbuilder --update --distribution lenny --override-config --debootstrap debootstrap --debootstrapopts --arch --debootstrapopts amd64 --logfile $LOG_FILE --mirror ftp://ftp.de.debian.org/debian --othermirror "deb http://parsix.org/packages ramon main contrib non-free" &> /dev/null || exit 5 139 fi 168 handle_chroot 140 169 141 170 # Build amd64 packages 142 171 echo "${GREEN}Building ${YELLOW}amd64${NORMAL} ${GREEN}specific packages...${NORMAL}" 143 svn-buildpackage --svn-builder="pdebuild --use-pdebuild-internal -- --logfile $LOG_FILE" || exit 6 144 145 # Revert /etc/pbuilderrc changes 146 sed -i s/base-$PXBUILDARCH.tgz/base.tgz/g /etc/pbuilderrc 147 148 # Fixing /etc/pbuilderrc 149 PXBUILDARCH="i386" 150 sed -i s/base.tgz/base-$PXBUILDARCH.tgz/g /etc/pbuilderrc 151 152 # Build i386 chroot if needed 153 if [ ! -f /var/cache/pbuilder/base-$PXBUILDARCH.tgz ]; then 154 echo "${GREEN}Creating ${YELLOW}i386${NORMAL} ${GREEN}chroot...${NORMAL}" 155 pbuilder --create --distribution lenny --override-config --debootstrap debootstrap --debootstrapopts --arch --debootstrapopts i386 --logfile $LOG_FILE --mirror ftp://ftp.de.debian.org/debian --othermirror "deb http://parsix.org/packages ramon main contrib non-free" &> /dev/null || exit 7 156 else 157 echo "${GREEN}Updating ${YELLOW}i386${NORMAL} ${GREEN}chroot...${NORMAL}" 158 pbuilder --update --distribution lenny --override-config --debootstrap debootstrap --debootstrapopts --arch --debootstrapopts i386 --logfile $LOG_FILE --mirror ftp://ftp.de.debian.org/debian --othermirror "deb http://parsix.org/packages ramon main contrib non-free" &> /dev/null || exit 7 159 fi 160 161 # Restore default controls 162 rm debian/control* &> /dev/null 163 svn up &> /dev/null 164 165 # Build i386 packages 166 echo "${GREEN}Building ${YELLOW}i386${NORMAL} ${GREEN}specific packages...${NORMAL}" 167 svn-buildpackage --svn-builder="pdebuild --use-pdebuild-internal --debbuildopts -B -- --logfile $LOG_FILE" || exit 7 168 169 # Revert /etc/pbuilderrc changes 170 sed -i s/base-$PXBUILDARCH.tgz/base.tgz/g /etc/pbuilderrc 172 svn-buildpackage --svn-builder="pdebuild --use-pdebuild-internal -- --logfile $LOG_FILE" || echo "Build failed" >> $LOG_FILE && revert_pbrc && exit 173 174 # Revert /etc/pbuilderrc base.tgz changes 175 revert_pbrc 176 177 # Check if the result is platform independent and skip i386 build if needed 178 ARCH_ALL_COUNT="$(ls ../build-area/ | grep -c _all.deb)" 179 ARCH_I386_COUNT="$(ls ../build-area/ | grep -c _i386.deb)" 180 ARCH_AMD64_COUNT="$(ls ../build-area/ | grep -c _amd64.deb)" 181 182 if [ $ARCH_ALL_COUNT -gt 1 -a $ARCH_I386_COUNT -lt 1 -a $ARCH_AMD64_COUNT -lt 1 ]; then 183 echo "${GREEN}Build is platform independent, skipping ${YELLOW}i386${NORMAL} build...${NORMAL}" 184 ARCH_INDEP=1 185 else 186 ARCH_INDEP=0 187 # Fixing /etc/pbuilderrc base.tgz 188 PXBUILDARCH="i386" 189 fix_pbrc 190 191 # Build i386 chroot if needed 192 handle_chroot 193 194 # Restore default controls 195 rm debian/control* &> /dev/null 196 svn up &> /dev/null 197 198 # Build i386 packages 199 echo "${GREEN}Building ${YELLOW}i386${NORMAL} ${GREEN}specific packages...${NORMAL}" 200 svn-buildpackage --svn-builder="pdebuild --use-pdebuild-internal --debbuildopts -B -- --logfile $LOG_FILE" || echo "Build failed" >> $LOG_FILE && revert_pbrc && exit 201 202 # Revert /etc/pbuilderrc base.tgz changes 203 revert_pbrc 204 fi 171 205 172 206 cd ../build-area/ 173 207 174 echo "${GREEN}Generating ${YELLOW}multi_arch${NORMAL} ${GREEN}changes file and centralizing packages...${NORMAL}" 175 176 # Merging changes file for multiarch upload 177 AMD64_CHANGES=`ls | grep _amd64.changes` 178 I386_CHANGES=`ls | grep _i386.changes` 179 mergechanges -f $AMD64_CHANGES $I386_CHANGES >> $LOG_FILE 180 181 # Add package to the repo 182 cd $LOCAL_REPO_ROOT 183 reprepro -Vb . include $DIST_NAME $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME/build-area/`ls $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME/build-area/ | grep _multi.changes` >> $LOG_FILE 208 if [ $ARCH_INDEP -eq 1 ]; then 209 echo "${GREEN}Generating ${YELLOW}multi_arch${NORMAL} ${GREEN}changes file and centralizing packages...${NORMAL}" 210 211 # Merging changes file for multiarch upload 212 AMD64_CHANGES=`ls | grep _amd64.changes` 213 I386_CHANGES=`ls | grep _i386.changes` 214 mergechanges -f $AMD64_CHANGES $I386_CHANGES >> $LOG_FILE 215 216 # Add package to the repo 217 cd $LOCAL_REPO_ROOT 218 reprepro -Vb . include $DIST_NAME $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME/build-area/`ls $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME/build-area/ | grep _multi.changes` >> $LOG_FILE 219 else 220 # Add package to the repo 221 cd $LOCAL_REPO_ROOT 222 reprepro -Vb . include $DIST_NAME $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME/build-area/`ls $SVN_REPO_PATH/$COMPONENT/$SRC_PKG_NAME/build-area/ | grep _amd64.changes` >> $LOG_FILE 223 fi 224 184 225 sh ../../sign >> $LOG_FILE && cd 185 226 186 227 echo "${GREEN}Finished.${NORMAL}" 187 228 echo "Build OK" >> $LOG_FILE 229 230
Note: See TracChangeset
for help on using the changeset viewer.


