- removed builder

- added new config files for new builder
This commit is contained in:
DT Netsolution GmbH 2012-01-27 02:26:10 +01:00
parent f726b167c2
commit 3d707d5a59
8 changed files with 6 additions and 387 deletions

View File

@ -17,6 +17,9 @@ DefVar $LicenseRequired$
DefVar $LicenseKey$ DefVar $LicenseKey$
DefVar $LicensePool$ DefVar $LicensePool$
; Token BUILDER_VARIABLES will be replace by builder.sh
@@BUILDER_VARIABLES@@
Set $LogDir$ = "%SystemDrive%\tmp" Set $LogDir$ = "%SystemDrive%\tmp"
; ---------------------------------------------------------------- ; ----------------------------------------------------------------

View File

@ -17,6 +17,9 @@ DefVar $LicensePool$
Set $LogDir$ = "%SystemDrive%\tmp" Set $LogDir$ = "%SystemDrive%\tmp"
; Token BUILDER_VARIABLES will be replace by builder.sh
@@BUILDER_VARIABLES@@
; ---------------------------------------------------------------- ; ----------------------------------------------------------------
; - Please edit the following values - ; - Please edit the following values -
; ---------------------------------------------------------------- ; ----------------------------------------------------------------

View File

@ -1,18 +0,0 @@
############################
# define methods to overwrite library methods here
# refer to the the builder.sh to check the methods
############################
#builder_read_config_pre() {
# echo "** USER: Cal.ling BEFORE builder__read_confi"
#}
#builder_read_config() {
# echo "** USER: Calling INSTEAD-OF builder_read_config"
#}
#builder__read_confif() {
# echo "** USER: Calling AFTER builder__read_config"
#}

View File

@ -1,29 +0,0 @@
##############################
# Prerequirements:
# - Setup your environment variable inside the shell, e.g. ~/.bashrc
# export BUILD_LOCAL_CFG=/home/dschwager/work/build_local.cfg
# check the sample build_local.cfg located inside the itwatch project
##############################
# requirements
yum install plowshare
yum install ImageMagick
yum install git
# Define your local, private, individual, not-project dependent build setup
# in the file ~/.builder.cfg OR by using the environment variable BUILD_LOCAL_CFG
# pointing the the configuration.
# export BUILD_LOCAL_CFG=/home/dschwager/work/itwatch/build_local.cfg
# If no files are availble, the default values will be use.
# Start build
builder.sh <path-to-the-project>
builder.sh /home/dschwager/work/itwatch
# Force downloading vendor files
DIST_FORCE_DOWNLOAD=1 builder.sh /home/dschwager/work/itwatch
# Force upload independent of existing OPSI-Package in repository
OPSI_REPOS_FORCE_UPLOAD=1 builder.sh /home/dschwager/work/itwatch

View File

@ -1,41 +0,0 @@
###################################################
# build-default.cfg
# Default values for OPSI builder system
####################################################
##################################
# Global variables
#################################
TMP_DIR=/tmp
##################################
# OPSI repository settings
#################################
# Basedirectory storing OPSI-packages after building
OPSI_REPOS_BASE_DIR=$HOME/.opsi-repository
# Directory- and filename pattern
OPSI_REPOS_PRODUCT_DIR=${OPSI_REPOS_BASE_DIR}/${STATUS}/${VENDOR}/${PN}/${VERSION}-${RELEASE}
# OPSI-package filepattern
OPSI_REPOS_FILE_PATTERN=${PN}_${VERSION}-${RELEASE}.opsi
# Force alway upload to opsi repos
# OPSI_REPOS_FORCE_UPLOAD=1
###############################
# Distribution / Vendor settings
###############################
# Directory downloading/cacheing the artifacts like MSI package or icons from the vendor webside
DIST_CACHE_DIR=$HOME/.opsi-dist-cache/${PN}-${VERSION}
# private dist repository. You can use all variables from release.cfg insde the URL
# this optinal URL will be the FIRST url to check for downloading vendor stuff.
# To copy a local file, the repos should start with file://
DIST_PRIVATE_REPOS=file://$HOME/opsi-dist.private/$VENDOR/$PN/$VERSION
# Force always downloading dist files
# DIST_FORCE_DOWNLOAD=1

View File

@ -1,204 +0,0 @@
#####################
# Call user entry point
####################
call_entry_point() {
# Entry point
type $1 &>/dev/null
if [ $? == 0 ] ; then
$1
fi
}
#####################
# Read config
####################
# read private build configuration
#test -f "$BUILD_LOCAL_CFG" && . $BUILD_LOCAL_CFG
builder_read_config() {
# Check temp dir
test -d ${TMP_DIR}
builder_check_error "temp directory not available: $TMP_DIR"
# Source product release configuration
test -f ${PRODUCT_DIR}/product.cfg
builder_check_error "can't read release configuration: ${PRODUCT_DIR}/product.cfg"
. $PRODUCT_DIR/product.cfg
# set default build configuration and source the user dependent file
. $BASEDIR/build-default.cfg
# Source local build configuration (must be done AFTER sourcing the release.cfg)
test -f $HOME/.builder.cfg && . $HOME/.builder.cfg && echo "Loaded builder configuration: $HOME/.builder.cfg"
test -f "$BUILD_LOCAL_CFG" && . $BUILD_LOCAL_CFG && echo "Loaded builder configuration: $BUILD_LOCAL_CFG"
# Check variables
if [ -z ${OPSI_REPOS_BASE_DIR} ] || [ ! -d ${OPSI_REPOS_BASE_DIR} ] ; then
echo "configuration error: OPSI_REPOS_BASE_DIR directory does not exist: $OPSI_REPOS_BASE_DIR"
exit 2
fi
}
#####################
# Download all dist files from one of the defined URLs.
# and validate the checksum
####################
builder_download_dist_files() {
mkdir -p $DIST_CACHE_DIR
echo "Distribution directory: $DIST_CACHE_DIR"
for f1 in $ICON $FILE1 $FILE2 ; do
basename=`echo $f1 | cut -d ";" -f1`
urls=`echo $f1 | cut -d ";" -f2-`
downloaded=0
# Add private repos to the urls
if [ ! -z ${DIST_PRIVATE_REPOS} ]; then
urls="${DIST_PRIVATE_REPOS}/$basename;$urls"
fi
# check existence of CRC file
if [ ! -e ${PRODUCT_DIR}/${basename}.sha1sum ] ; then
echo "You need to create the checksums with: sha1sum ${DIST_CACHE_DIR}/${basename} > ${PRODUCT_DIR}/${basename}.sha1sum"
exit 1
fi
echo "Downloading $basename"
# check downloading from the defined URLs
for f2 in `echo $urls | sed -e 's/;/\n/g'` ; do
if [ $downloaded == 1 ]; then continue; fi
echo " Info: Downloding from $f2"
# Check, if the URL is a file URL starting with file://
if [ -f ${DIST_CACHE_DIR}/$basename ] && [ -z ${DIST_FORCE_DOWNLOAD} ]; then
echo " Info: File still cached/downloaded. To force a download, set DIST_FORCE_DOWNLOAD=1"
elif [[ $f2 == file://* ]]; then
fileurl=`echo $f2 | sed "s/^file:\/\///"`
cp $fileurl ${DIST_CACHE_DIR}/$basename 2>/dev/null
else
rm -f ${DIST_CACHE_DIR}/$basename
wget --tries=1 -O ${DIST_CACHE_DIR}/$basename --timeout=5 -q --no-verbose $f2
fi
if [ $? == 0 ] ; then
# testing the checksum of the downloaded files
SHA1SUM=`cat ${PRODUCT_DIR}/${basename}.sha1sum | cut -d " " -f1`
CHECKSUM=`sha1sum ${DIST_CACHE_DIR}/$basename | cut -d " " -f1`
if [ "$CHECKSUM" == "$SHA1SUM" ] ; then
downloaded=1
echo " Info: Downloaded successfully"
else
echo " Error: The checksums do not match - try next URL"
fi
else
echo " Warning: Failed to download file - try next URL"
fi
done
echo
# Ups - no URL works
if [ $downloaded != 1 ] ; then
echo " Error: can download the file or checksum wrong (sha1sum ${DIST_CACHE_DIR}/${basename} > ${basename}.sha1sum)"
exit 1;
fi
done
}
#####################
# build opsi package
#####################
builder_package() {
OUT=$(mktemp -d $TMP_DIR/opsi-builder.XXXXXXXXXX) || { echo "Failed to create temp dir"; exit 1; }
# Copy files and convert text files to dos format
mkdir $OUT/$PN
cp -Rv ${PRODUCT_DIR}/OPSI ${PRODUCT_DIR}/CLIENT_DATA $OUT/$PN
find $OUT/$PN/CLIENT_DATA -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep "text/plain" && dos2unix $0' REP
# copy binaries
for f1 in $FILE1 $FILE2 ; do
basename=`echo $f1 | cut -d ";" -f1`
cp ${DIST_CACHE_DIR}/$basename $OUT/$PN/CLIENT_DATA
done
# converting icon file
ICONFILE=`echo $ICON | cut -d ";" -f1`
convert -colorspace rgb ${DIST_CACHE_DIR}/$ICONFILE -transparent white -background transparent -resize 160x160 \
-size 160x160 xc:transparent +swap -gravity center -composite $OUT/$PN/CLIENT_DATA/$PN.png
builder_check_error "converting image"
# replace variables
echo Building OPSI-Package
sed -e "s!VERSION!$VERSION!g" -e "s!RELEASE!$RELEASE!g" -e "s!PRIORITY!$PRIORITY!g" -e "s!ADVICE!$ADVICE!g" -i $OUT/$PN/OPSI/control
sed -e "s!X86FILE!$X86FILE!g" -i $OUT/$PN/CLIENT_DATA/setup32.ins
# Create changelog based on git - if available
if test -d "${PRODUCT_DIR}/.git"; then
git log --date-order --date=short | \
sed -e '/^commit.*$/d' | \
awk '/^Author/ {sub(/\\$/,""); getline t; print $0 t; next}; 1' | \
sed -e 's/^Author: //g' | \
sed -e 's/>Date: \([0-9]*-[0-9]*-[0-9]*\)/>\t\1/g' | \
sed -e 's/^\(.*\) \(\)\t\(.*\)/\3 \1 \2/g' > $OUT/$PN/OPSI/changelog.txt
else
echo "No git repository present."
fi
# building package
pushd ${TMP_DIR}
rm -f ${PN}_${VERSION}-${RELEASE}.opsi
opsi-makeproductfile -v $OUT/$PN
builder_check_error "Building OPSI-package"
popd
# cleanup
rm -rf $OUT
}
#####################
# build opsi package
#####################
builder_upload() {
# Upload file to repository
mkdir -p ${OPSI_REPOS_PRODUCT_DIR}
cp -av $TMP_DIR/${PN}_${VERSION}-${RELEASE}.opsi ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN}
builder_check_error "Can't upload file $TMP_DIR/${PN}_${VERSION}-${RELEASE}.opsi to ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN}"
}
###################
# Commiting changes to repos
###################
builder_commit() {
if test -d ".git"; then
echo
# echo "builder_commit() not implemented yet."
fi
}
###################
# Check error
###################
builder_check_error() {
if [ $? == 1 ] ; then
echo "FATAL: $1"
exit 0
fi
}

View File

@ -1,67 +0,0 @@
#!/bin/bash
#
#
# enabled debug
# set -x
#####################
# Main
####################
builder_main() {
# read config
call_entry_point builder_read_config_pre
builder_read_config
call_entry_point builder_read_config_post
# Check if the package is still build
if [ -z "$OPSI_REPOS_FORCE_UPLOAD" ] && [ -f ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} ] ; then
echo "ERROR: package ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN} already generated"
exit 1
fi
# download and process dist files
call_entry_point builder_download_dist_files_pre
builder_download_dist_files
call_entry_point builder_download_dist_files_post
# Start building
call_entry_point builder_package_pre
builder_package
call_entry_point builder_package_post
# Upload to repos
call_entry_point builder_upload_pre
builder_upload
call_entry_point builder_upload_post
# git commit
call_entry_point builder_commit_pre
builder_commit
call_entry_point builder_commit_post
}
# get the 'real' directory this program stored in (resolve symbolic links)
PRG=$(readlink -f $0)
BASEDIR=`dirname "$PRG"`
BASEDIR=`cd "$BASEDIR" && pwd`
# read libraries
. $BASEDIR/builder-lib.sh
# check product directory
PRODUCT_DIR=$1
test -d $PRODUCT_DIR
builder_check_error "no opsi product directory specified: $PRODUCT_DIR"
# source additional, product dependent methods
if [ -f "$PRODUCT_DIR/build-extension.sh" ] ; then
. "$PRODUCT_DIR/build-extension.sh"
fi
# call main
builder_main
# exit
exit 0

View File

@ -1,28 +0,0 @@
############################
# Setup product information
############################
VENDOR="itwatch.de"
PN="itwatch"
VERSION="4.10.19"
RELEASE="2"
PRIORITY="0"
ADVICE=""
# Status integration, testing, release
STATUS="review"
#################
# Setup url for downloading the binaries
################
# all downloads should not have any traling parameters like ?downlaodid=1234 .....(should rewrite in python)
# You can setup many URL's separated by ";"
# Format: basename ; URL1 ; URL2 ; ...
ICON="itWatchLogo.jpg;http://www.itwatch.de/logos/itWatchLogo.jpg"
# Format: basename ; URL1 ; URL2 ; ...
FILE1="itWESS-Client_German.msi;http://ivyrepos.dtnet.de/v-$PN/itwatch/itwatch/4.10.19/itWESS-Client_German.msi;http://internal.graz.disconnected-by-peer.at/Orig/itWatch/itWESS/HB/4.10.19/itWESS-Client_German.msi"
FILE2="itWESS-64bit_German.msi;http://ivyrepos.dtnet.de/itwatch/itwatch/4.10.19/itWESS-64bit_German.msi;http://internal.graz.disconnected-by-peer.at/Orig/itWatch/itWESS/HB/4.10.19/itWESS-64bit_German.msi"