added files to build all deb packages and create/update ubuntu repository.

The build-ubunturepo call build-debs-all when running.
Deleted deprecated files for deb generation


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10765 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
adalbas 2011-10-13 17:37:21 +00:00
parent b6bd706c50
commit 8880a0fe1e
5 changed files with 304 additions and 147 deletions

View File

@ -1,27 +0,0 @@
#!/bin/bash
# Accepts directories to build packages from on the commandline, but defaults
# to building: perl-xCAT and xCAT-client
major=`cat Version`
lintian="" # TODO: lintian fails currently
#lintian="--svn-lintian"
if [ "$1" = "-s" ]; then
shift
snap=true
date="$( date +'%F' )"
version="$major-snapshot-$( date +'%Y%m%d' )"
fi
packages="${@:-perl-xCAT xCAT-client}"
for pkg in $packages; do
mkdir -p debs/$pkg
echo "*** Building Debian package for $pkg."
cd $pkg
if $snap; then
debchange --distribution unstable --newversion $version "snapshot of $pkg from $date"
fi
svn-buildpackage --svn-ignore $lintian --svn-move-to=../debs/$pkg
cd -
done

89
build-debs-all Executable file
View File

@ -0,0 +1,89 @@
#!/bin/bash
###########
#
# This script call make<package>deb and create the deb packages
# for xCAT
#
# Author: Leonardo Tonetto <tonetto@linux.vnet.ibm.com>
# Revisor: Adalberto Medeiros <adalbas@linux.vnet.ibm.com>
#
# Input:
#
# $1 is the build type/location
# $2 is the string added to the debian/changelog of each package
#
############
##############
# Get input
##############
PKG_LOCATION=$1 # local | snap | alpha
if [ -z $PKG_LOCATION ]; then
PKG_LOCATION="local"
fi
BUILD_STRING=$2
if [ -z $BUILD_STRING ]; then
BUILD_STRING="Personal Build"
fi
XCAT_VERSION=`cat Version`
TRUNK_REVISION=`svnversion | cut -d ":" -f1`
CUR_DATE=`date +%Y%m%d`
VERSION="$XCAT_VERSION$PKG_LOCATION-rev$TRUNK_REVISION-$CUR_DATE"
function makedeb {
SRC_ROOT=$1
PKG_LOCATION=$2
BUILD_STRING=$3
VERSION=$4
#
# Make DEBs
#
# build perl-xCAT - deps are libsoap-lite-perl, libdigest-sha1-perl, libdbi-perl
#
find $SRC_ROOT -maxdepth 2 -name debian -type d | while read DEBIAN_DIR
do
DIR=`echo ${DEBIAN_DIR} | sed -e 's/[/]debian$//'`
cd ${DIR}
dch -v $VERSION -c debian/changelog "$BUILD_STRING"
dpkg-buildpackage
cd -
RC=$?
if [ ${RC} -gt 0 ]
then
echo "Warning: ${DEBIAN_DIR} failed exit code ${RC}"
fi
done
#
# Clean up
#
# Eliminate unnecessary directories and debian/files made by dpgk-buildpakcage
find $SRC_ROOT -maxdepth 3 -type d -name "xcat-*" | grep debian | xargs rm -rf
find $SRC_ROOT -maxdepth 3 -type f -name "files" | grep debian | xargs rm -f
}
# build all debian packages
makedeb xCAT-client $PKG_LOCATION "$BUILD_STRING" $VERSION
makedeb xCAT-nbroot $PKG_LOCATION "$BUILD_STRING" $VERSION
makedeb perl-xCAT $PKG_LOCATION "$BUILD_STRING" $VERSION
makedeb xCAT-server $PKG_LOCATION "$BUILD_STRING" $VERSION
makedeb xCAT-UI $PKG_LOCATION "$BUILD_STRING" $VERSION
makedeb xCAT $PKG_LOCATION "$BUILD_STRING" $VERSION
makedeb xCATsn $PKG_LOCATION "$BUILD_STRING" $VERSION
makedeb xCAT-test $PKG_LOCATION "$BUILD_STRING" $VERSION
if [ -d debs ]; then
rm -rf debs
fi
mkdir debs
mv xcat* debs/
mv perl-xcat* debs/
echo $VERSION > latest_version
exit 0

215
build-ubunturepo Executable file
View File

@ -0,0 +1,215 @@
#!/bin/sh
# Update GSA Ubuntu Repositories or create a local repository
#
# Author: Leonardo Tonetto (tonetto@linux.vnet.ibm.com)
#
# After running this script, add the following line to
# /etc/apt/sources.list for local repository
# deb file://<core_repo_path>/xcat-core/ maverick main
#
a_flag= # automatic flag - only update if repo was updated
c_flag= # xcat-core (trunk-delvel) path
d_flag= # xcat-dep (trunk) path
u_flag= # gsa user-id
p_flag= # gsa passwd
local_flag= # build the repository localy
while getopts 'c:d:u:p:l:a' OPTION
do
case $OPTION in
c) c_flag=1
xcat_core_path="$OPTARG"
;;
d) d_flag=1
xcat_dep_path="$OPTARG"
;;
u) u_flag=1
gsa_id="$OPTARG"
;;
p) p_flag=1
gsa_passwd="$OPTARG"
;;
l) local_flag=1
local_repo_path="$OPTARG"
;;
a) a_flag=1
;;
?) printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] { -l <local-repo_path> | [-u <gsa_id> -p <gsa_passwd>] } [-a]\n" $(basename $0) >&2
echo "-a Automatic: update only if there's any update on repo"
exit 2
;;
esac
done
shift $(($OPTIND - 1))
if [ -z "$c_flag" ]
then
printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] { -l <local-repo_path> | [-u <gsa_id> -p <gsa_passwd>] } [-a]\n" $(basename $0) >&2
echo "-a Automatic: update only if there's any update on repo"
exit 2
fi
if [ ! -d $xcat_core_path ]
then
printf "%s: No such directory\n" "$xcat_core_path" >&2
exit 2
fi
if [ "$d_flag" ]
then
if [ ! -d $xcat_dep_path ]
then
printf "%s: No such directory\n" "$xcat_dep_path" >&2
exit 2
fi
fi
if [ "$local_flag" ]
then
repo_xcat_core_path=$local_repo_path"/xcat-core"
repo_xcat_dep_path=$local_repo_path"/xcat-dep"
else
if [ -z "$u_flag" ]
then
if [ "$p_flag" ]
then
printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] { -l <local-repo_path> | [-u <gsa_id> -p <gsa_passwd>] } [-a]\n" $(basename $0) >&2
echo "-a Automatic: update only if there's any update on repo"
exit 2
fi
echo -n "GSA id: "
read gsa_id
echo -n "GSA password: "
stty -echo; read gsa_passwd; stty echo;
echo ""; echo "";
fi
repo_xcat_core_path="`pwd`/gsa-repo_temp/xcat-core"
repo_xcat_dep_path="`pwd`/gsa-repo_temp/xcat-dep"
fi
if [ "$a_flag" ]
then
touch svcupdate.trace
SVCUP='svcupdate.trace'
svn update $xcat_core_path 1> $SVCUP 2>&1
if ! grep 'Tree is up to date' $SVCUP
then
update_core=1
else
update_core=
fi
rm -f $SVCUP
else
update_core=1
fi
if [ "$update_core" ]
then
echo "###############################"
echo "# Building xcat-core packages #"
echo "###############################"
CMD_PATH=`pwd`
cd $xcat_core_path
./build-debs-all "snap" "Nightly_Builds"
echo "#################################"
echo "# Creating xcat-core repository #"
echo "#################################"
if [ -d $repo_xcat_core_path ]; then
rm -rdf $repo_xcat_core_path
fi
mkdir -p $repo_xcat_core_path/conf
find . -iname '*.deb' -exec mv {} $repo_xcat_core_path \;
rm -rdf debs/
cd $CMD_PATH
cat << __EOF__ > $repo_xcat_core_path/conf/distributions
Origin: xCAT internal repository
Label: xcat-core bazaar repository
Codename: maverick
Architectures: i386 amd64
Components: main
Description: Repository automatically genereted conf
__EOF__
cat << __EOF__ > $repo_xcat_core_path/conf/options
verbose
basedir .
__EOF__
for file in `ls $repo_xcat_core_path/*.deb`; do
reprepro -b $repo_xcat_core_path includedeb maverick $file;
done
mv $xcat_core_path/latest_version $repo_xcat_core_path/xcat-core_latest-build
if [ -z "$local_flag" ]
then
echo "###############################"
echo "# Updating GSA xcat-core repo #"
echo "###############################"
lftp -e "mirror -R --delete-first $repo_xcat_core_path /projects/i/ipl-xcat/ubuntu/; exit;" -u $gsa_id,$gsa_passwd -p 22 sftp://ausgsa.ibm.com
fi ### if [ -z "$local_flag" ]
fi ### if [ "$a_flag" ]
if [ "$a_flag" -a "$d_flag" ]
then
touch svcupdate.trace
SVCUP='svcupdate.trace'
svn update $xcat_dep_path 1> $SVCUP 2>&1
if ! grep 'Tree is up to date' $SVCUP
then
update_dep=1
else
update_dep=
fi
rm -f $SVCUP
else
update_dep=1
fi
if [ "$d_flag" -a "$update_dep" ]
then
echo "################################"
echo "# Creating xcat-dep repository #"
echo "################################"
rm -rdf $repo_xcat_dep_path
mkdir -p $repo_xcat_dep_path/conf
find $xcat_dep_path -iname '*.deb' -exec cp {} $repo_xcat_dep_path \;
cat << __EOF__ > $repo_xcat_dep_path/conf/distributions
Origin: xCAT internal repository
Label: xcat-dep bazaar repository
Codename: maverick
Architectures: i386 amd64
Components: main
Description: Repository automatically genereted conf
__EOF__
cat << __EOF__ > $repo_xcat_dep_path/conf/options
verbose
basedir .
__EOF__
for file in `ls $repo_xcat_dep_path/*.deb`; do
reprepro -b $repo_xcat_dep_path includedeb maverick $file;
done
if [ -z "$local_flag" ]
then
echo "##############################"
echo "# Updating GSA xcat-dep repo #"
echo "##############################"
lftp -e "mirror -R --delete-first $repo_xcat_dep_path /projects/i/ipl-xcat/ubuntu/; exit;" -u $gsa_id,$gsa_passwd -p 22 sftp://ausgsa.ibm.com
fi ### if [ -z "$local_flag" ]
fi ### if [ "$d_flag" -a "$a_flag"]
if [ -z "$local_flag" ] # delete the temp repo after upload is done
then
rm -rdf ./gsa-repo_temp
fi
exit 0

View File

@ -1,70 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DH_COMPAT=5
build:
pwd
./xpod2man
clean:
dh_testdir
dh_testroot
dh_clean -d
install:
pwd
dh_testdir
dh_testroot
dh_installdirs
dh_install
dh_link
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch:
pwd
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
# dh_installexamples
dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
# dh_link
# dh_strip
dh_compress
# dh_fixperms
dh_perl
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

View File

@ -1,50 +0,0 @@
#!/bin/bash
#
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#
# Author: Isaac Freeman
#
# Make some wild guesses about what debian perl modules a package requires.
# Seems to work so far for xCAT.
#
# Scans the current directory.
#
found=""
# Warning: voodoo ahead
find . -name .svn -prune -o -type f \
| xargs grep -l '^#!.*perl' \
| xargs grep -hE '^\s*(use|require) ' \
| while read mod; do
pkg=$( awk '{ sub(";", "", $2);
gsub("::", "-", $2);
print $2 }' <<<"$mod" \
| tr '[:upper:]' '[:lower:]' )
pkgname="lib${pkg}-perl"
if apt-cache show $pkgname >/dev/null 2>&1; then
case "$found" in
*$pkgname*) continue ;;
*)
[ -n "$found" ] && echo -n ", "
echo -n "$pkgname"
found="$found $pkgname"
;;
esac
elif perl <<<"$mod" >/dev/null 2>&1; then
# Blindly assume that if perl doesn't complain about this, that its
# built-in to or ships with perl.
continue
elif [ "$1" == "-w" ]; then
echo
echo "warning: $pkg not found and perl doesn't like \"$mod\"" >&2
fi
done
echo
# vim: set sts=2 sw=2 et: