mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-10 13:26:04 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
694dfd7fab | ||
|
|
01906265c1 | ||
|
|
f925974134 | ||
|
|
aafa359a7f | ||
|
|
10e562e5a3 | ||
|
|
efe747704f |
@@ -1,3 +1,8 @@
|
||||
Version: 0.0.7
|
||||
State: Development
|
||||
|
||||
CHANGES:
|
||||
|
||||
Version: 0.0.6
|
||||
State: Stable
|
||||
|
||||
|
||||
+24
-31
@@ -1,10 +1,16 @@
|
||||
#!/bin/bash
|
||||
if [ "$3" == "" ]; then
|
||||
echo "Please specify package name"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cur_dir=`pwd`
|
||||
cur_dirname=`pwd | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
cache_dir=$GVM_ROOT/archive/package/$3
|
||||
source_dir=$GVM_ROOT/tmp/$3/src
|
||||
build_dir=$GVM_ROOT/tmp/$3/build
|
||||
package_name=$3
|
||||
version=$4
|
||||
mode=$5
|
||||
|
||||
function download_package() {
|
||||
if [ ! -d "$cache_dir" ]; then
|
||||
@@ -20,8 +26,8 @@ function download_package() {
|
||||
|
||||
function select_version() {
|
||||
if [ "$version" != "" ]; then
|
||||
cd $source_dir && git pull &> /dev/null &&
|
||||
git checkout $version &> /dev/null
|
||||
cd $source_dir && git pull &&
|
||||
git checkout $version > /dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Invalid version $version"
|
||||
exit 1
|
||||
@@ -38,31 +44,22 @@ function setup_build_env() {
|
||||
|
||||
function check_deps() {
|
||||
export GOPATH=$build_dir
|
||||
echo "build package in ${build_dir}"
|
||||
if [ -f "$source_dir/Package.gvm" ]; then
|
||||
mkdir -p $build_dir/deps
|
||||
echo "loading dependent packages into ${build_dir}/deps"
|
||||
for line in `cat $source_dir/Package.gvm | grep ^pkg | awk '{ print $2 }'`; do
|
||||
CUR_PKG=$GVM_ROOT/pkgs/pkg.gvm/$line/current
|
||||
if [ -e "$CUR_PKG/BUILD_VERSION" ]; then
|
||||
echo "$line: `cat $CUR_PKG/BUILD_VERSION`" >> $build_dir/manifest
|
||||
else
|
||||
if [[ "$mode" == "strict" ]]; then
|
||||
echo "ERROR: Couldnt find package: $line please build it first"
|
||||
exit 1
|
||||
else
|
||||
gvm pkg install $line
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to install dependency $line"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
#gvm pkg install $line
|
||||
#if [ $? -ne 0 ]; then
|
||||
# echo "Failed to install dependency $line"
|
||||
# exit 1
|
||||
#fi
|
||||
echo "ERROR: Couldnt find package: $line"
|
||||
exit 1
|
||||
fi
|
||||
#go linker complains and quits building when GOPATH has more than 14 paths
|
||||
#export GOPATH=$GOPATH:$CUR_PKG
|
||||
cp -rf ${CUR_PKG}/pkg ${build_dir}/deps
|
||||
export GOPATH=$GOPATH:$CUR_PKG
|
||||
done
|
||||
export GOPATH=$GOPATH:${build_dir}/deps
|
||||
fi
|
||||
echo ":complete" >> $build_dir/manifest
|
||||
}
|
||||
@@ -81,20 +78,10 @@ function build_package() {
|
||||
cat "$build_dir/build.log"
|
||||
exit 1
|
||||
fi
|
||||
echo "Running tests..."
|
||||
cd $source_dir && gvmake test >> $build_dir/build.log 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed tests"
|
||||
cat "$build_dir/build.log"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function install_package() {
|
||||
mkdir -p $GVM_ROOT/pkgs/pkg.gvm/$package_name/$BUILD_NUMBER &&
|
||||
if [ -f "$source_dir/Package.gvm" ]; then
|
||||
rm -rf $build_dir/deps
|
||||
fi
|
||||
cp -r $build_dir/* $GVM_ROOT/pkgs/pkg.gvm/$package_name/$BUILD_NUMBER &&
|
||||
rm -f $GVM_ROOT/pkgs/pkg.gvm/$package_name/current &&
|
||||
ln -s $GVM_ROOT/pkgs/pkg.gvm/$package_name/$BUILD_NUMBER $GVM_ROOT/pkgs/pkg.gvm/$package_name/current &&
|
||||
@@ -114,7 +101,13 @@ function cleanup() {
|
||||
rm -rf $source_dir
|
||||
}
|
||||
|
||||
download_package
|
||||
#if [ "$cur_dirname" == "$package_name" ]; then
|
||||
# cache_dir=$cur_dir
|
||||
# BUILD_NUMBER=src
|
||||
# echo "Using local source"
|
||||
#else
|
||||
download_package
|
||||
#fi
|
||||
setup_build_env
|
||||
check_deps
|
||||
build_package
|
||||
|
||||
Reference in New Issue
Block a user