+++ /dev/null
-# Rootstrap configraution
-export PLATFORM_VERSION="3.0"
-export PLATFORM_PROFILE="mobile"
-
-#export BASE_PKG_SVR_TARGET="http://10.113.63.117/snapshots/base/latest/repos/arm/packages/"
-#export BASE_PKG_SVR_EMULATOR="http://10.113.63.117/snapshots/base/latest/repos/emulator32/packages/"
-
-#export SNAPSHOT_URL_PREFIX="http://10.113.63.117/snapshots/mobile/latest"
-export SNAPSHOT_URL_POSTFIX_EMULATOR="/repos/emulator32-wayland/packages/"
-export SNAPSHOT_URL_POSTFIX_TARGET="/repos/arm-wayland/packages/"
-
-#export RPM_PKG_SVR_EMULATOR="${SNAPSHOT_URL_PREFIX}${SNAPSHOT_URL_POSTFIX_EMULATOR}"
-#export RPM_PKG_SVR_TARGET="${SNAPSHOT_URL_PREFIX}${SNAPSHOT_URL_POSTFIX_TARGET}"
-
-# Build Packaging
-export DIBS_PKG_SVR_ADDR="http://10.113.63.84/packages"
-export DIBS_PKG_SVR_DIST="tizen_3.0"
-
+++ /dev/null
-#!/usr/bin/bash
-
-COPY_DEST=$1
-POSTLINKER="${PWD}/script/postlinker"
-
-pushd rs_resource > /dev/null 2>&1
-XML_DIRECTORIES=( "NativeAPI" "OSS" "HAL" )
-INDEX=0
-
-while [[ ${INDEX} -lt ${#XML_DIRECTORIES[@]} ]]; do
- DIR=${XML_DIRECTORIES[${INDEX}]}
- ENTITIES=($(ls -a1 ${DIR}))
- for ENTITY in ${ENTITIES[@]}; do
- if [[ ${ENTITY} == '.' ]] || [[ ${ENTITY} == '..' ]]; then
- continue
- fi
-
- ENTITY_PATH="${DIR}/${ENTITY}"
- if [[ -d ${ENTITY_PATH} ]]; then
- XML_DIRECTORIES+=(${ENTITY_PATH})
- continue
- fi
-
- IS_REQUIRE_ALL=$(xmlstarlet sel -t -m "//necessary[count(file)=1]" -v "./file/text()" ${ENTITY_PATH})
- if [[ ${IS_REQUIRE_ALL} == '*' ]]; then
- # TODO: Copy all files of this package(ENTITY)
- continue;
- else
- NECESSARY_FILES=($(xmlstarlet sel -t -m "//necessary/file" -v "text()" -o " " -n ${ENTITY_PATH}))
- for NECESSARY_FILE in ${NECESSARY_FILES[@]}; do
- THIS_COPY_DEST="${COPY_DEST}/opt/data/hal-rootstrap${NECESSARY_FILE}"
- THIS_COPY_DEST_PARENT=$(dirname ${THIS_COPY_DEST})
- if [[ ! -d ${THIS_COPY_DEST_PARENT} ]]; then
- mkdir -p ${THIS_COPY_DEST_PARENT}
- fi
- cp "${NECESSARY_FILE}" "${THIS_COPY_DEST}"
- echo "cp \"${NECESSARY_FILE}\" \"${THIS_COPY_DEST}\""
- done
- fi
- done
- INDEX=$((INDEX+1))
-done
+++ /dev/null
-Source : core-app-rootstrap
-Version : 0.0.180
-Maintainer : Seunghwan Lee <sh.cat.lee@samsung.com>
-
-package : mobile-4.0-rs-device.core
-OS : ubuntu-32
-build-host-os : ubuntu-32
-attribute : binary
-install-dependency : efl-tools
-description : arm rootstrap for native app development
-
-package : mobile-4.0-rs-device.core
-OS : ubuntu-64
-build-host-os : ubuntu-32
-attribute : binary
-install-dependency : efl-tools
-description : arm rootstrap for native app development
-
-package : mobile-4.0-rs-device.core
-OS : macos-64
-build-host-os : ubuntu-32
-attribute : binary
-install-dependency : efl-tools
-description : arm rootstrap for native app development
-
-Package : mobile-4.0-rs-device.core
-OS : windows-32
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : ARM rootstrap for native app development
-
-Package : mobile-4.0-rs-device.core
-OS : windows-64
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : ARM rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : ubuntu-32
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : ubuntu-64
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : macos-64
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : windows-32
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : windows-64
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
+++ /dev/null
-Source : core-app-rootstrap
-Version : 0.0.141
-Maintainer : Seunghwan Lee <sh.cat.lee@samsung.com>
-
-package : mobile-4.0-rs-device.core
-OS : ubuntu-32
-build-host-os : ubuntu-32
-attribute : binary
-install-dependency : efl-tools
-description : arm rootstrap for native app development
-
-package : mobile-4.0-rs-device.core
-OS : ubuntu-64
-build-host-os : ubuntu-32
-attribute : binary
-install-dependency : efl-tools
-description : arm rootstrap for native app development
-
-package : mobile-4.0-rs-device.core
-OS : macos-64
-build-host-os : ubuntu-32
-attribute : binary
-install-dependency : efl-tools
-description : arm rootstrap for native app development
-
-Package : mobile-4.0-rs-device.core
-OS : windows-32
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : ARM rootstrap for native app development
-
-Package : mobile-4.0-rs-device.core
-OS : windows-64
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : ARM rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : ubuntu-32
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : ubuntu-64
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : macos-64
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : windows-32
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
-
-Package : mobile-4.0-rs-emulator.core
-OS : windows-64
-Build-host-os : ubuntu-32
-Attribute : binary
-Install-dependency : efl-tools
-Description : I386 rootstrap for native app development
+++ /dev/null
-Version : 0.0.17
-Maintainer : Seunghwan Lee <sh.cat.lee@samsung.com>
+++ /dev/null
-Version : 0.0.17
-Maintainer : Seunghwan Lee <sh.cat.lee@samsung.com>
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# Init
-###############################################################################
-SCRIPT_NAME="$(basename ${BASH_SOURCE[0]})"
-SCRIPT_FULLPATH="$(readlink -f ${BASH_SOURCE[0]})"
-SCRIPT_BASE="$(dirname ${SCRIPT_FULLPATH})"
-SCRIPT_VER="0.0.3"
-
-DIR_TMP_PKG=".temp_pkg"
-DIR_TMP_SDK_PKG=$(pwd)/".temp_sdk_pkg"
-DIR_OUTPUT=".pkg"
-
-OS_LIST="ubuntu-64 windows-64 macos-64"
-
-DIR_INFO=".info"
-DIR_RPM=".rpm"
-DIR_PLUGIN=".plugin"
-DIR_TMP=".tmp"
-DIR_EMULATOR=".emulator"
-DIR_TARGET=".target"
-
-PATH_PACKAGE_RES=""
-
-OPT_CONF=""
-
-PRIVATE=""
-TMP_PKG_VERSION="0.0.1"
-
-INTERNAL=false
-SDKPKG=false
-SNAPSHOT=""
-
-DEVICE="device"
-EMULATOR="emulator"
-###############################################################################
-echo ""
-echo " $SCRIPT_NAME ($SCRIPT_VER) is packaging tool of rootstrap"
-echo ""
-
-###############################################################################
-# function log
-###############################################################################
-function log()
-{
- #printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}] ${@}\n"
- printf "${@}\n\n"
-}
-
-function log_info()
-{
- printf "[INFO] ${@}\n\n"
-}
-
-function log_warn()
-{
- printf "[WARN] ${@}\n\n"
-}
-
-function log_error()
-{
- printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}][ERROR] ${@}\n"
-}
-###############################################################################
-# function check_error
-# $1 : Error code(integer)
-# $2 : Error Message
-# $3 : Error Xml File)
-# Example : check_error $? "Fail to function"
-###############################################################################
-function check_error()
-{
- if [ "$1" -ne "0" ]; then
- printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}] ERROR : $2 - exit code ($1) \n" 1>&2
- exit $1
- fi
-}
-
-###############################################################################
-# function pkg_build_internal
-# $1 : Type (emulator/device/emulator64/device64)
-# $2 : resource Path (.emulator/.target)
-###############################################################################
-function pkg_build_internal()
-{
-
- TYPE=${1}
-
- if [[ ${TYPE} == *"device"* ]]; then
- PLUGIN_FILE="${DIR_PLUGIN}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-device.core.xml"
- INFO_FILE="${DIR_INFO}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-device.core.dev.xml"
- else
- PLUGIN_FILE="${DIR_PLUGIN}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-emulator.core.xml"
- INFO_FILE="${DIR_INFO}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-emulator.core.dev.xml"
- fi
-
- log_info "Clean up Resource Directory ${PATH_PACKAGE_RES}"
- if [[ -n ${PATH_PACKAGE_RES} ]] && [[ -e "${PATH_PACKAGE_RES}/data" ]] ; then
- rm -rf "${PATH_PACKAGE_RES}/data"
- fi
-
- log_info "mkdir -p ${DIR_PLUGIN_DEST}"
- mkdir -p ${DIR_PLUGIN_DEST}
-
- log_info "mkdir -p ${DIR_INFO_DEST}"
- mkdir -p ${DIR_INFO_DEST}
-
- log_info "mkdir -p ${DIR_ROOTSTRAP_DEST}"
- mkdir -p ${DIR_ROOTSTRAP_DEST}
-
-
- # Get Current Info
- log_info "Get Current RS_ID, RS_PATH, DEV_PACKAGE_CONFIG_PATH"
-
- RS_ID=$(xmlstarlet sel -t -m "//rootstrap/@id" -v "." $PLUGIN_FILE)
- RS_PATH=$(xmlstarlet sel -t -m "//rootstrap/@path" -v "." $PLUGIN_FILE)
- DEV_PACKAGE_CONFIG_PATH=$(xmlstarlet sel -t -m "//property[@key='DEV_PACKAGE_CONFIG_PATH']/@value" -v "." $PLUGIN_FILE)
-
- log_info "TYPE=$TYPE"
- log_info "RS_ID=$RS_ID"
- log_info "RS_PATH=$RS_PATH"
- log_info "DEV_PACKAGE_CONFIG_PATH=$DEV_PACKAGE_CONFIG_PATH"
-
-
- # Replace Info
- log_info "Convert RS_ID, RS_PATH, DEV_PACKAGE_CONFIG_PATH"
-
- if [ "$INTERNAL" = true ]; then
- RS_ID=${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}.core${PRIVATE}${SNAPSHOT}
- else
- RS_ID=${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}.core${SNAPSHOT}
- fi
-
- RS_PATH=$(dirname $RS_PATH)"/${RS_ID}"
- DEV_PACKAGE_CONFIG_PATH=$(dirname $DEV_PACKAGE_CONFIG_PATH)"/${RS_ID}.dev.xml"
-
- log_info "NEW RS_ID=$RS_ID"
- log_info "NEW RS_PATH=$RS_PATH"
- log_info "NEW DEV_PACKAGE_CONFIG_PATH=$DEV_PACKAGE_CONFIG_PATH"
-
-
- # Copy
- log_info "cp ${PLUGIN_FILE} ${DIR_PLUGIN_DEST}/${RS_ID}.xml"
- cp ${PLUGIN_FILE} ${DIR_PLUGIN_DEST}/${RS_ID}.xml >/dev/null
-
- log_info "cp ${INFO_FILE} ${DIR_INFO_DEST}/${RS_ID}.dev.xml"
- cp ${INFO_FILE} ${DIR_INFO_DEST}/${RS_ID}.dev.xml >/dev/null
-
-
-
- # Change Plugin XML
- xmlstarlet ed -L -u "//rootstrap/@id" -v "${RS_ID}" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- xmlstarlet ed -L -u "//rootstrap/@path" -v "${RS_PATH}" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
-
- if [ "$INTERNAL" = true ]; then
- if [ -n "${SNAPSHOT}" ]; then
- log_info "SNAPSHOT = [$SNAPSHOT]"
- xmlstarlet ed -L -u "//rootstrap/@name" -v "Tizen ${TYPE[*]^} $PLATFORM_VERSION ${PRIVATE:1} (${SNAPSHOT:1})" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- else
- xmlstarlet ed -L -u "//rootstrap/@name" -v "Tizen ${TYPE[*]^} $PLATFORM_VERSION ${PRIVATE:1}" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- fi
- else
- xmlstarlet ed -L -u "//rootstrap/@name" -v "Tizen ${TYPE[*]^} $PLATFORM_VERSION" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- fi
-
- xmlstarlet ed -L -u "//property[@key='DEV_PACKAGE_CONFIG_PATH']/@value" -v "${DEV_PACKAGE_CONFIG_PATH}" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
-
- if [[ ${TYPE} == *"device64"* ]]; then
- xmlstarlet ed -L -u "//rootstrap/@architecture" -v "aarch64" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- elif [[ ${TYPE} == *"emulator64"* ]]; then
- xmlstarlet ed -L -u "//rootstrap/@architecture" -v "x86_64" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- fi
-
- # Rename Plugin XML
- #log_info "mv ${DIR_PLUGIN}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}*.xml ${DIR_PLUGIN}/${RS_ID}.xml"
- #mv ${DIR_PLUGIN}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}*.xml ${DIR_PLUGIN}/${RS_ID}.xml >/dev/null
-
- #log_info "mv ${DIR_INFO}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}*.dev.xml ${DIR_INFO}/${RS_ID}.dev.xml"
- #mv ${DIR_INFO}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}*.dev.xml ${DIR_INFO}/${RS_ID}.dev.xml >/dev/null
-
- # Copy Resource
- #DIR_PLUGIN_DEST="${PATH_PACKAGE_RES}/data/tools/smart-build-interface/plugins/"
- #DIR_INFO_DEST="${PATH_PACKAGE_RES}/data/platforms/tizen-${PLATFORM_VERSION}/${PLATFORM_PROFILE}/rootstraps/info/"
- #DIR_ROOTSTRAP_DEST="${PATH_PACKAGE_RES}/data/platforms/tizen-${PLATFORM_VERSION}/${PLATFORM_PROFILE}/rootstraps/"
-
- #mkdir -p ${DIR_PLUGIN_DEST}
- #mkdir -p ${DIR_INFO_DEST}
- #mkdir -p ${DIR_ROOTSTRAP_DEST}
-
- if [[ ${TYPE} == *"device64"* ]]; then
- (
- log_info "Copy RS Resource [${DIR_TARGET}] to [${DIR_ROOTSTRAP_DEST}/${RS_ID}] ... "
- cd ${DIR_TARGET}
- rm ./usr/lib/*
- zip -r --symlinks ${RS_ID}.zip lib64 lib usr >/dev/null
- unzip ${RS_ID}.zip -d ${DIR_ROOTSTRAP_DEST}/${RS_ID} >/dev/null
- rm *.zip
- )
-elif [[ ${TYPE} == *"emulator64"* ]]; then
- (
- log_info "Copy RS Resource [${DIR_EMULATOR}] to [${DIR_ROOTSTRAP_DEST}/${RS_ID}] ... "
- cd ${DIR_EMULATOR}
- rm ./usr/lib/*
- zip -r --symlinks ${RS_ID}.zip lib64 lib usr >/dev/null
- unzip ${RS_ID}.zip -d ${DIR_ROOTSTRAP_DEST}/${RS_ID} >/dev/null
- rm *.zip
-)
-elif [[ ${TYPE} == *"device"* ]]; then
- (
- log_info "Copy RS Resource [${DIR_TARGET}] to [${DIR_ROOTSTRAP_DEST}/${RS_ID}] ... "
- cd ${DIR_TARGET}
- zip -r --symlinks ${RS_ID}.zip lib usr >/dev/null
- unzip ${RS_ID}.zip -d ${DIR_ROOTSTRAP_DEST}/${RS_ID} >/dev/null
- rm *.zip
-)
-elif [[ ${TYPE} == *"emulator"* ]]; then
- (
- log_info "Copy RS Resource [${DIR_EMULATOR}] to [${DIR_ROOTSTRAP_DEST}/${RS_ID}] ... "
- cd ${DIR_EMULATOR}
- zip -r --symlinks ${RS_ID}.zip lib usr >/dev/null
- unzip ${RS_ID}.zip -d ${DIR_ROOTSTRAP_DEST}/${RS_ID} >/dev/null
- rm *.zip
-)
- fi
-}
-
-function pkg_build()
-{
-
- pkg_build_internal ${DEVICE}
-
- (
- cd ${PATH_PACKAGE_RES}
- zip -r ${NAME_DEVICE_PKG_ZIP} data >/dev/null
- mv ${PATH_PACKAGE_RES}/*.zip ${pkg_dir}
- log_info "Genarated Basic RS resource [${pkg_dir}] ... "
-)
-
-pkg_build_internal ${EMULATOR}
-(
-cd ${PATH_PACKAGE_RES}
-zip -r ${NAME_EMULATOR_PKG_ZIP} data >/dev/null
-mv ${PATH_PACKAGE_RES}/*.zip ${pkg_dir}
-log_info "Genarated Basic RS resource [${pkg_dir}] ... "
-)
-
-}
-
-###############################################################################
-# function create_pkginfo
-# VAL_PKG="$1"
-# VAL_VERSION="$2"
-# VAL_OS="$3"
-###############################################################################
-function create_pkginfo()
-{
-
- #pkginfo.manifest
- #Package : mobile-3.0-rs-device.core
- #Version : 3.0.8
- #OS : ubuntu-32
- #Maintainer : Seunghwan Lee <sh.cat.lee@samsung.com>
- #Attribute : binary
- #Description : ARM rootstrap for native app development
-
- FILE_PKGINFO="pkginfo.manifest"
- ATTR_PKG="Package"
- ATTR_VERSION="Version"
- ATTR_OS="OS"
- ATTR_MAIN="Maintainer : Seunghwan Lee <sh.cat.lee@samsung.com>"
- ATTR_ATTR="Attribute : binary"
- ATTR_DESC="Description : rootstrap for native app development"
-
-
- if [[ -e $FILE_PKGINFO ]]; then
- rm $FILE_PKGINFO
- fi
-
- VAL_PKG="$1"
- VAL_VERSION="$2"
- VAL_OS="$3"
-
- echo "$ATTR_PKG : $VAL_PKG" | tee -a $FILE_PKGINFO
- echo "$ATTR_VERSION : $VAL_VERSION" | tee -a $FILE_PKGINFO
-
- if [[ ${VAL_OS} == "all" ]]; then
- echo "$ATTR_OS : ubuntu-64, windows-64, macos-64" | tee -a $FILE_PKGINFO
- else
- echo "$ATTR_OS : $VAL_OS" | tee -a $FILE_PKGINFO
- fi
-
- echo "$ATTR_MAIN" | tee -a $FILE_PKGINFO
- echo "$ATTR_ATTR" | tee -a $FILE_PKGINFO
- echo "$ATTR_DESC" | tee -a $FILE_PKGINFO
-
-
-}
-
-###############################################################################
-# function usage
-###############################################################################
-function usage () {
- echo "$SCRIPT_NAME ($SCRIPT_VER) is script to package rootstrap for SDK"
- echo "Usage: $SCRIPT_NAME -C [<config_file>] [<OPTION>]"
- echo " -C, --conf : Configuration File"
- echo " -o, --os : Package OS (ubuntu-64 windows-64 macos-64)"
- echo " -h, --help"
- echo " -v, --version : Display script version information"
- echo " --internal : "
- echo " --snapshot : "
- echo " --sdkpkg : "
- echo " --pkgver : "
- echo ""
- echo "Example:"
- echo " >$SCRIPT_NAME -C rs-config"
- echo " > mobile-3.0-device.core, mobile-3.0-emulator.core"
- echo " >$SCRIPT_NAME -C rs-config -os ubuntu-64"
- echo ""
- echo "Example:"
- echo " >$SCRIPT_NAME -C rs-config"
- echo " > mobile-3.0-device.core, mobile-3.0-emulator.core"
-
- echo ""
- echo "Output Diretory:"
- echo ".temp_pkg"
- echo ".pkg"
-
- return
-}
-
-###############################################################################
-## Get Parameter
-###############################################################################
-OPTS=`getopt -o -d:o:C: --long dir:,os:,conf:,internal,public,snapshot:,sdkpkg,pkgver:,64bit -- "$@"`
-if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
-
-echo ""
-echo " #EXEC_CMD : $SCRIPT_NAME $OPTS"
-eval set -- "$OPTS"
-
-while true; do
- case "$1" in
- -C | --conf ) OPT_CONF=$2;shift;shift;;
- -o | --os ) OS_LIST="${2}"; shift;shift;;
- -h | --help ) usage; exit 0;;
- -v | --version ) echo "${SCRIPT_NAME}" "version : $SCRIPT_VER"; exit 0 ;;
- --internal ) INTERNAL=true; shift;;
- --public ) PUBLIC=true; shift;;
- --snapshot ) SNAPSHOT=$2; shift;shift;;
- --sdkpkg ) SDKPKG=true; shift;;
- --pkgver ) TMP_PKG_VERSION=$2; shift;shift;;
- --64bit )
- echo "64bit!!";
- DEVICE="device64"
- EMULATOR="emulator64"
- shift;;
- -- ) shift; break ;;
- *)
- echo "param error";
- exit 1; shift;;
- esac
-done
-
-###############################################################################
-## Check Environment
-###############################################################################
-if [[ -e ${OPT_CONF} ]]; then
- log_info "source ${OPT_CONF}"
- source "${OPT_CONF}"
-else
- log_error "[Error] Configuration File Does not Exist"
- usage
- exit 1
-fi
-
-log_info "OS_LIST = $OS_LIST"
-
-#CHECK CMD available
-printf "check command ... "
-if [ -z $(which xmlstarlet) ]
-then
- log_error "[Error] Check xmlstarlet command" 1>&2
- exit -1
-fi
-printf "Done\n\n"
-
-
-#CHECK Resource from make_rootstrap.sh
-printf "check Resource Directory ... "
-if [ ! -e ${DIR_INFO} ] || [ ! -e ${DIR_PLUGIN} ] || [ ! -e ${DIR_EMULATOR} ] || [ ! -e ${DIR_TARGET} ]
-then
- echo "Check resource dirs are exist !" 1>&2
- echo "${DIR_INFO}" 1>&2
- echo "${DIR_EMULATOR}" 1>&2
- echo "${DIR_TARGET}" 1>&2
- echo "${DIR_PLUGIN}" 1>&2
- exit -1
-fi
-printf "Done\n\n"
-
-#CHECK configuration
-if [[ -z $PLATFORM_VERSION ]]; then
- echo "[Error] Configure PLATFORM_VERSION is NULL" 1>&2
- exit -1
-fi
-
-if [[ -z $PLATFORM_PROFILE ]]; then
- echo "[Error] Configure PLATFORM_PROFILE is NULL" 1>&2
- exit -1
-fi
-
-if [[ -n $SNAPSHOT ]]; then
- SNAPSHOT=".$SNAPSHOT"
-fi
-
-if [ "$INTERNAL" = true ]; then
- PRIVATE=".private"
-fi
-
-if [ "$PUBLIC" = true ]; then
- PRIVATE=".public"
- INTERNAL=true;
-fi
-
-if [ -z $SNAPSHOT ] && [ "$INTERNAL" = false ]; then
- log_info "SET SDKPKG = true (Snapshot = NULL, INTERNAL = false)"
- SDKPKG=true
-fi
-
-
-###############################################################################
-## Clean Up
-###############################################################################
-
-PATH_PACKAGE_RES=$PWD/$DIR_TMP_PKG
-printf "Clean up Directory ${PATH_PACKAGE_RES} ... "
-
-if [[ -e "$PATH_PACKAGE_RES" ]]; then
- rm -rf $PATH_PACKAGE_RES
-fi
-mkdir $PATH_PACKAGE_RES
-
-printf "Done\n\n"
-
-pkg_dir=$PWD"/$DIR_OUTPUT"
-
-printf "Clean up Directory ${pkg_dir} ... "
-
-if [[ -e ${pkg_dir} ]]; then
- rm -rf ${pkg_dir};
-fi
-mkdir ${pkg_dir};
-printf "Done\n\n"
-
-
-###############################################################################
-## Build rootstarp SDK package
-###############################################################################
-
-printf "make rootstrap Package\n\n"
-
-NAME_DEVICE_PKG_ZIP=${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}${SNAPSHOT}.zip
-NAME_EMULATOR_PKG_ZIP=${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}${SNAPSHOT}.zip
-
-DIR_PLUGIN_DEST="${PATH_PACKAGE_RES}/data/tools/smart-build-interface/plugins/"
-DIR_INFO_DEST="${PATH_PACKAGE_RES}/data/platforms/tizen-${PLATFORM_VERSION}/${PLATFORM_PROFILE}/rootstraps/info/"
-DIR_ROOTSTRAP_DEST="${PATH_PACKAGE_RES}/data/platforms/tizen-${PLATFORM_VERSION}/${PLATFORM_PROFILE}/rootstraps/"
-
-###############################################################################
-#Create Rootstrap Basic Resource to .pkg
-###############################################################################
-pkg_build_internal ${DEVICE}
-(
-cd ${PATH_PACKAGE_RES}
-zip -r ${NAME_DEVICE_PKG_ZIP} data >/dev/null
-mv ${PATH_PACKAGE_RES}/*.zip ${pkg_dir}
-log_info "Genarated Basic RS resource [${pkg_dir}] ... \n\n"
-)
-
-pkg_build_internal ${EMULATOR}
-(
-cd ${PATH_PACKAGE_RES}
-zip -r ${NAME_EMULATOR_PKG_ZIP} data >/dev/null
-mv ${PATH_PACKAGE_RES}/*.zip ${pkg_dir}
-log_info "Genarated Basic RS resource [${pkg_dir}] ... \n\n"
-)
-
-log "Done... [$SECONDS]Sec\n\n"
-
-###############################################################################
-#Create Rootstrap Package for SDK to .pkg
-###############################################################################
-if [[ "$SDKPKG" == true ]] && [[ -z "$SNAPSHOT" ]] ; then
- echo "Start SDK package .. from temp"
-
- if [[ -e ${DIR_TMP_SDK_PKG} ]]; then
- rm -rf ${DIR_TMP_SDK_PKG};
- fi
- mkdir ${DIR_TMP_SDK_PKG};
-
- for OS in $OS_LIST
- do
- mkdir -p ${DIR_TMP_SDK_PKG}/${OS};
-
- cp $DIR_OUTPUT/*.zip $DIR_TMP_SDK_PKG/$OS
-
- mv ${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core*.zip ${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}_${TMP_PKG_VERSION}_${OS}.zip
-
- #device
- create_pkginfo "${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}" "$TMP_PKG_VERSION" "all"
- zip "${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}_${TMP_PKG_VERSION}_${OS}.zip" pkginfo.manifest
-
- #emulator
- mv ${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core*.zip ${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}_${TMP_PKG_VERSION}_${OS}.zip
- create_pkginfo "${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}" "$TMP_PKG_VERSION" "all"
- zip "${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}_${TMP_PKG_VERSION}_${OS}.zip" pkginfo.manifest
-done
-
-rm $DIR_OUTPUT/*.zip
-find ${DIR_TMP_SDK_PKG} -name "*.zip" -exec mv {} $DIR_OUTPUT \;
-
-fi
-
-if [[ -n "$SNAPSHOT" ]] ; then
- log_info "Add PkgInfo for ABS [$SNAPSHOT] \n\n"
- #device
- create_pkginfo "${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}" "0.0.1" "all"
- find $DIR_OUTPUT -name "*device*.zip" -exec zip {} pkginfo.manifest \;
-
-
- #emulator
- create_pkginfo "${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}" "0.0.1" "all"
- find $DIR_OUTPUT -name "*emulator*.zip" -exec zip {} pkginfo.manifest \;
-fi
-
-###############################################################################
-# Show PKG
-###############################################################################
-echo "$(ls ${pkg_dir}/*.zip | wc -l) files Genereated ... "
-for i in $(ls ${pkg_dir}/*.zip)
-do
- echo "$(du -h $i | awk '{print $2,"["$1"]"}')"
-done
-
-echo "Done... [$SECONDS]Sec"
-exit 0
+++ /dev/null
-#!/bin/bash
-###############################################################################
-# Init
-###############################################################################
-SCRIPT_NAME="$(basename ${BASH_SOURCE[0]})"
-SCRIPT_FULLPATH="$(readlink -f ${BASH_SOURCE[0]})"
-SCRIPT_BASE="$(dirname ${SCRIPT_FULLPATH})"
-SCRIPT_VER="0.0.3"
-
-DIR_TMP_PKG=".temp_pkg"
-DIR_TMP_SDK_PKG=$(pwd)/".temp_sdk_pkg"
-DIR_OUTPUT=".pkg"
-
-OS_LIST="ubuntu-64 windows-64 macos-64"
-
-DIR_INFO=".info"
-DIR_RPM=".rpm"
-DIR_PLUGIN=".plugin"
-DIR_TMP=".tmp"
-DIR_EMULATOR=".emulator"
-DIR_TARGET=".target"
-
-PATH_PACKAGE_RES=""
-
-OPT_CONF=""
-
-PRIVATE=""
-TMP_PKG_VERSION="0.0.1"
-
-INTERNAL=false
-SDKPKG=false
-SNAPSHOT=""
-
-DEVICE="device64"
-EMULATOR="emulator64"
-###############################################################################
-echo ""
-echo " $SCRIPT_NAME ($SCRIPT_VER) is packaging tool of rootstrap"
-echo ""
-
-###############################################################################
-# function log
-###############################################################################
-function log()
-{
- #printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}] ${@}\n"
- printf "${@}\n\n"
-}
-
-function log_info()
-{
- printf "[INFO] ${@}\n\n"
-}
-
-function log_warn()
-{
- printf "[WARN] ${@}\n\n"
-}
-
-function log_error()
-{
- printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}][ERROR] ${@}\n"
-}
-###############################################################################
-# function check_error
-# $1 : Error code(integer)
-# $2 : Error Message
-# $3 : Error Xml File)
-# Example : check_error $? "Fail to function"
-###############################################################################
-function check_error()
-{
- if [ "$1" -ne "0" ]; then
- printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}] ERROR : $2 - exit code ($1) \n" 1>&2
- exit $1
- fi
-}
-
-###############################################################################
-# function pkg_build_internal
-# $1 : Type (emulator/device/emulator64/device64)
-# $2 : resource Path (.emulator/.target)
-###############################################################################
-function pkg_build_internal()
-{
-
- TYPE=${1}
-
- if [[ ${TYPE} == *"device64"* ]]; then
- PLUGIN_FILE="${DIR_PLUGIN}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-device64.core.xml"
- INFO_FILE="${DIR_INFO}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-device64.core.dev.xml"
- else
- PLUGIN_FILE="${DIR_PLUGIN}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-emulator64.core.xml"
- INFO_FILE="${DIR_INFO}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-emulator64.core.dev.xml"
- fi
-
- log_info "Clean up Resource Directory ${PATH_PACKAGE_RES}"
- if [[ -n ${PATH_PACKAGE_RES} ]] && [[ -e "${PATH_PACKAGE_RES}/data" ]] ; then
- rm -rf "${PATH_PACKAGE_RES}/data"
- fi
-
- log_info "mkdir -p ${DIR_PLUGIN_DEST}"
- mkdir -p ${DIR_PLUGIN_DEST}
-
- log_info "mkdir -p ${DIR_INFO_DEST}"
- mkdir -p ${DIR_INFO_DEST}
-
- log_info "mkdir -p ${DIR_ROOTSTRAP_DEST}"
- mkdir -p ${DIR_ROOTSTRAP_DEST}
-
-
- # Get Current Info
- log_info "Get Current RS_ID, RS_PATH, DEV_PACKAGE_CONFIG_PATH"
-
- RS_ID=$(xmlstarlet sel -t -m "//rootstrap/@id" -v "." $PLUGIN_FILE)
- RS_PATH=$(xmlstarlet sel -t -m "//rootstrap/@path" -v "." $PLUGIN_FILE)
- DEV_PACKAGE_CONFIG_PATH=$(xmlstarlet sel -t -m "//property[@key='DEV_PACKAGE_CONFIG_PATH']/@value" -v "." $PLUGIN_FILE)
-
- log_info "TYPE=$TYPE"
- log_info "RS_ID=$RS_ID"
- log_info "RS_PATH=$RS_PATH"
- log_info "DEV_PACKAGE_CONFIG_PATH=$DEV_PACKAGE_CONFIG_PATH"
-
-
- # Replace Info
- log_info "Convert RS_ID, RS_PATH, DEV_PACKAGE_CONFIG_PATH"
-
- if [ "$INTERNAL" = true ]; then
- RS_ID=${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}.core${PRIVATE}${SNAPSHOT}
- else
- RS_ID=${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}.core${SNAPSHOT}
- fi
-
- RS_PATH=$(dirname $RS_PATH)"/${RS_ID}"
- DEV_PACKAGE_CONFIG_PATH=$(dirname $DEV_PACKAGE_CONFIG_PATH)"/${RS_ID}.dev.xml"
-
- log_info "NEW RS_ID=$RS_ID"
- log_info "NEW RS_PATH=$RS_PATH"
- log_info "NEW DEV_PACKAGE_CONFIG_PATH=$DEV_PACKAGE_CONFIG_PATH"
-
-
- # Copy
- log_info "cp ${PLUGIN_FILE} ${DIR_PLUGIN_DEST}/${RS_ID}.xml"
- cp ${PLUGIN_FILE} ${DIR_PLUGIN_DEST}/${RS_ID}.xml >/dev/null
-
- log_info "cp ${INFO_FILE} ${DIR_INFO_DEST}/${RS_ID}.dev.xml"
- cp ${INFO_FILE} ${DIR_INFO_DEST}/${RS_ID}.dev.xml >/dev/null
-
-
-
- # Change Plugin XML
- xmlstarlet ed -L -u "//rootstrap/@id" -v "${RS_ID}" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- xmlstarlet ed -L -u "//rootstrap/@path" -v "${RS_PATH}" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
-
- if [ "$INTERNAL" = true ]; then
- if [ -n "${SNAPSHOT}" ]; then
- log_info "SNAPSHOT = [$SNAPSHOT]"
- xmlstarlet ed -L -u "//rootstrap/@name" -v "Tizen ${TYPE[*]^} $PLATFORM_VERSION ${PRIVATE:1} (${SNAPSHOT:1})" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- else
- xmlstarlet ed -L -u "//rootstrap/@name" -v "Tizen ${TYPE[*]^} $PLATFORM_VERSION ${PRIVATE:1}" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- fi
- else
- xmlstarlet ed -L -u "//rootstrap/@name" -v "Tizen ${TYPE[*]^} $PLATFORM_VERSION" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- fi
-
- xmlstarlet ed -L -u "//property[@key='DEV_PACKAGE_CONFIG_PATH']/@value" -v "${DEV_PACKAGE_CONFIG_PATH}" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
-
- if [[ ${TYPE} == *"device64"* ]]; then
- xmlstarlet ed -L -u "//rootstrap/@architecture" -v "aarch64" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- elif [[ ${TYPE} == *"emulator64"* ]]; then
- xmlstarlet ed -L -u "//rootstrap/@architecture" -v "x86_64" ${DIR_PLUGIN_DEST}/${RS_ID}.xml
- fi
-
- # Rename Plugin XML
- #log_info "mv ${DIR_PLUGIN}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}*.xml ${DIR_PLUGIN}/${RS_ID}.xml"
- #mv ${DIR_PLUGIN}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}*.xml ${DIR_PLUGIN}/${RS_ID}.xml >/dev/null
-
- #log_info "mv ${DIR_INFO}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}*.dev.xml ${DIR_INFO}/${RS_ID}.dev.xml"
- #mv ${DIR_INFO}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-${TYPE}*.dev.xml ${DIR_INFO}/${RS_ID}.dev.xml >/dev/null
-
- # Copy Resource
- #DIR_PLUGIN_DEST="${PATH_PACKAGE_RES}/data/tools/smart-build-interface/plugins/"
- #DIR_INFO_DEST="${PATH_PACKAGE_RES}/data/platforms/tizen-${PLATFORM_VERSION}/${PLATFORM_PROFILE}/rootstraps/info/"
- #DIR_ROOTSTRAP_DEST="${PATH_PACKAGE_RES}/data/platforms/tizen-${PLATFORM_VERSION}/${PLATFORM_PROFILE}/rootstraps/"
-
- #mkdir -p ${DIR_PLUGIN_DEST}
- #mkdir -p ${DIR_INFO_DEST}
- #mkdir -p ${DIR_ROOTSTRAP_DEST}
-
- if [[ ${TYPE} == *"device64"* ]]; then
- (
- log_info "Copy RS Resource [${DIR_TARGET}] to [${DIR_ROOTSTRAP_DEST}/${RS_ID}] ... "
- cd ${DIR_TARGET}
- # rm ./usr/lib/*
- # rm ./usr/lib64/*
- zip -r --symlinks ${RS_ID}.zip lib64 lib usr >/dev/null
- unzip ${RS_ID}.zip -d ${DIR_ROOTSTRAP_DEST}/${RS_ID} >/dev/null
- rm *.zip
- )
-elif [[ ${TYPE} == *"emulator64"* ]]; then
- (
- log_info "Copy RS Resource [${DIR_EMULATOR}] to [${DIR_ROOTSTRAP_DEST}/${RS_ID}] ... "
- cd ${DIR_EMULATOR}
- # rm ./usr/lib/*
- # rm ./usr/lib64/*
- zip -r --symlinks ${RS_ID}.zip lib64 lib usr >/dev/null
- unzip ${RS_ID}.zip -d ${DIR_ROOTSTRAP_DEST}/${RS_ID} >/dev/null
- rm *.zip
-)
-elif [[ ${TYPE} == *"device"* ]]; then
- (
- log_info "Copy RS Resource [${DIR_TARGET}] to [${DIR_ROOTSTRAP_DEST}/${RS_ID}] ... "
- cd ${DIR_TARGET}
- zip -r --symlinks ${RS_ID}.zip lib usr >/dev/null
- unzip ${RS_ID}.zip -d ${DIR_ROOTSTRAP_DEST}/${RS_ID} >/dev/null
- rm *.zip
-)
-elif [[ ${TYPE} == *"emulator"* ]]; then
- (
- log_info "Copy RS Resource [${DIR_EMULATOR}] to [${DIR_ROOTSTRAP_DEST}/${RS_ID}] ... "
- cd ${DIR_EMULATOR}
- zip -r --symlinks ${RS_ID}.zip lib usr >/dev/null
- unzip ${RS_ID}.zip -d ${DIR_ROOTSTRAP_DEST}/${RS_ID} >/dev/null
- rm *.zip
-)
- fi
-}
-
-function pkg_build()
-{
-
- pkg_build_internal ${DEVICE}
-
- (
- cd ${PATH_PACKAGE_RES}
- zip -r ${NAME_DEVICE_PKG_ZIP} data >/dev/null
- mv ${PATH_PACKAGE_RES}/*.zip ${pkg_dir}
- log_info "Genarated Basic RS resource [${pkg_dir}] ... "
-)
-
-pkg_build_internal ${EMULATOR}
-(
-cd ${PATH_PACKAGE_RES}
-zip -r ${NAME_EMULATOR_PKG_ZIP} data >/dev/null
-mv ${PATH_PACKAGE_RES}/*.zip ${pkg_dir}
-log_info "Genarated Basic RS resource [${pkg_dir}] ... "
-)
-
-}
-
-###############################################################################
-# function create_pkginfo
-# VAL_PKG="$1"
-# VAL_VERSION="$2"
-# VAL_OS="$3"
-###############################################################################
-function create_pkginfo()
-{
-
- #pkginfo.manifest
- #Package : mobile-3.0-rs-device.core
- #Version : 3.0.8
- #OS : ubuntu-32
- #Maintainer : Seunghwan Lee <sh.cat.lee@samsung.com>
- #Attribute : binary
- #Description : ARM rootstrap for native app development
-
- FILE_PKGINFO="pkginfo.manifest"
- ATTR_PKG="Package"
- ATTR_VERSION="Version"
- ATTR_OS="OS"
- ATTR_MAIN="Maintainer : Seunghwan Lee <sh.cat.lee@samsung.com>"
- ATTR_ATTR="Attribute : binary"
- ATTR_DESC="Description : rootstrap for native app development"
-
-
- if [[ -e $FILE_PKGINFO ]]; then
- rm $FILE_PKGINFO
- fi
-
- VAL_PKG="$1"
- VAL_VERSION="$2"
- VAL_OS="$3"
-
- echo "$ATTR_PKG : $VAL_PKG" | tee -a $FILE_PKGINFO
- echo "$ATTR_VERSION : $VAL_VERSION" | tee -a $FILE_PKGINFO
-
- if [[ ${VAL_OS} == "all" ]]; then
- echo "$ATTR_OS : ubuntu-64, windows-64, macos-64" | tee -a $FILE_PKGINFO
- else
- echo "$ATTR_OS : $VAL_OS" | tee -a $FILE_PKGINFO
- fi
-
- echo "$ATTR_MAIN" | tee -a $FILE_PKGINFO
- echo "$ATTR_ATTR" | tee -a $FILE_PKGINFO
- echo "$ATTR_DESC" | tee -a $FILE_PKGINFO
-
-
-}
-
-###############################################################################
-# function usage
-###############################################################################
-function usage () {
- echo "$SCRIPT_NAME ($SCRIPT_VER) is script to package rootstrap for SDK"
- echo "Usage: $SCRIPT_NAME -C [<config_file>] [<OPTION>]"
- echo " -C, --conf : Configuration File"
- echo " -o, --os : Package OS (ubuntu-64 windows-64 macos-64)"
- echo " -h, --help"
- echo " -v, --version : Display script version information"
- echo " --internal : "
- echo " --snapshot : "
- echo " --sdkpkg : "
- echo " --pkgver : "
- echo ""
- echo "Example:"
- echo " >$SCRIPT_NAME -C rs-config"
- echo " > mobile-3.0-device.core, mobile-3.0-emulator.core"
- echo " >$SCRIPT_NAME -C rs-config -os ubuntu-64"
- echo ""
- echo "Example:"
- echo " >$SCRIPT_NAME -C rs-config"
- echo " > mobile-3.0-device.core, mobile-3.0-emulator.core"
-
- echo ""
- echo "Output Diretory:"
- echo ".temp_pkg"
- echo ".pkg"
-
- return
-}
-
-###############################################################################
-## Get Parameter
-###############################################################################
-OPTS=`getopt -o -d:o:C: --long dir:,os:,conf:,internal,public,snapshot:,sdkpkg,pkgver:,64bit -- "$@"`
-if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
-
-echo ""
-echo " #EXEC_CMD : $SCRIPT_NAME $OPTS"
-eval set -- "$OPTS"
-
-while true; do
- case "$1" in
- -C | --conf ) OPT_CONF=$2;shift;shift;;
- -o | --os ) OS_LIST="${2}"; shift;shift;;
- -h | --help ) usage; exit 0;;
- -v | --version ) echo "${SCRIPT_NAME}" "version : $SCRIPT_VER"; exit 0 ;;
- --internal ) INTERNAL=true; shift;;
- --public ) PUBLIC=true; shift;;
- --snapshot ) SNAPSHOT=$2; shift;shift;;
- --sdkpkg ) SDKPKG=true; shift;;
- --pkgver ) TMP_PKG_VERSION=$2; shift;shift;;
- --64bit )
- echo "64bit!!";
- DEVICE="device64"
- EMULATOR="emulator64"
- shift;;
- -- ) shift; break ;;
- *)
- echo "param error";
- exit 1; shift;;
- esac
-done
-
-###############################################################################
-## Check Environment
-###############################################################################
-if [[ -e ${OPT_CONF} ]]; then
- log_info "source ${OPT_CONF}"
- source "${OPT_CONF}"
-else
- log_error "[Error] Configuration File Does not Exist"
- usage
- exit 1
-fi
-
-log_info "OS_LIST = $OS_LIST"
-
-#CHECK CMD available
-printf "check command ... "
-if [ -z $(which xmlstarlet) ]
-then
- log_error "[Error] Check xmlstarlet command" 1>&2
- exit -1
-fi
-printf "Done\n\n"
-
-
-#CHECK Resource from make_rootstrap.sh
-printf "check Resource Directory ... "
-if [ ! -e ${DIR_INFO} ] || [ ! -e ${DIR_PLUGIN} ] || [ ! -e ${DIR_EMULATOR} ] || [ ! -e ${DIR_TARGET} ]
-then
- echo "Check resource dirs are exist !" 1>&2
- echo "${DIR_INFO}" 1>&2
- echo "${DIR_EMULATOR}" 1>&2
- echo "${DIR_TARGET}" 1>&2
- echo "${DIR_PLUGIN}" 1>&2
- exit -1
-fi
-printf "Done\n\n"
-
-#CHECK configuration
-if [[ -z $PLATFORM_VERSION ]]; then
- echo "[Error] Configure PLATFORM_VERSION is NULL" 1>&2
- exit -1
-fi
-
-if [[ -z $PLATFORM_PROFILE ]]; then
- echo "[Error] Configure PLATFORM_PROFILE is NULL" 1>&2
- exit -1
-fi
-
-if [[ -n $SNAPSHOT ]]; then
- SNAPSHOT=".$SNAPSHOT"
-fi
-
-if [ "$INTERNAL" = true ]; then
- PRIVATE=".private"
-fi
-
-if [ "$PUBLIC" = true ]; then
- PRIVATE=".public"
- INTERNAL=true;
-fi
-
-if [ -z $SNAPSHOT ] && [ "$INTERNAL" = false ]; then
- log_info "SET SDKPKG = true (Snapshot = NULL, INTERNAL = false)"
- SDKPKG=true
-fi
-
-
-###############################################################################
-## Clean Up
-###############################################################################
-
-PATH_PACKAGE_RES=$PWD/$DIR_TMP_PKG
-printf "Clean up Directory ${PATH_PACKAGE_RES} ... "
-
-if [[ -e "$PATH_PACKAGE_RES" ]]; then
- rm -rf $PATH_PACKAGE_RES
-fi
-mkdir $PATH_PACKAGE_RES
-
-printf "Done\n\n"
-
-pkg_dir=$PWD"/$DIR_OUTPUT"
-
-printf "Clean up Directory ${pkg_dir} ... "
-
-if [[ -e ${pkg_dir} ]]; then
- rm -rf ${pkg_dir};
-fi
-mkdir ${pkg_dir};
-printf "Done\n\n"
-
-
-###############################################################################
-## Build rootstarp SDK package
-###############################################################################
-
-printf "make rootstrap Package\n\n"
-
-NAME_DEVICE_PKG_ZIP=${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}${SNAPSHOT}.zip
-NAME_EMULATOR_PKG_ZIP=${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}${SNAPSHOT}.zip
-
-DIR_PLUGIN_DEST="${PATH_PACKAGE_RES}/data/tools/smart-build-interface/plugins/"
-DIR_INFO_DEST="${PATH_PACKAGE_RES}/data/platforms/tizen-${PLATFORM_VERSION}/${PLATFORM_PROFILE}/rootstraps/info/"
-DIR_ROOTSTRAP_DEST="${PATH_PACKAGE_RES}/data/platforms/tizen-${PLATFORM_VERSION}/${PLATFORM_PROFILE}/rootstraps/"
-
-###############################################################################
-#Create Rootstrap Basic Resource to .pkg
-###############################################################################
-pkg_build_internal ${DEVICE}
-(
-cd ${PATH_PACKAGE_RES}
-zip -r ${NAME_DEVICE_PKG_ZIP} data >/dev/null
-mv ${PATH_PACKAGE_RES}/*.zip ${pkg_dir}
-log_info "Genarated Basic RS resource [${pkg_dir}] ... \n\n"
-)
-
-pkg_build_internal ${EMULATOR}
-(
-cd ${PATH_PACKAGE_RES}
-zip -r ${NAME_EMULATOR_PKG_ZIP} data >/dev/null
-mv ${PATH_PACKAGE_RES}/*.zip ${pkg_dir}
-log_info "Genarated Basic RS resource [${pkg_dir}] ... \n\n"
-)
-
-log "Done... [$SECONDS]Sec\n\n"
-
-###############################################################################
-#Create Rootstrap Package for SDK to .pkg
-###############################################################################
-if [[ "$SDKPKG" == true ]] && [[ -z "$SNAPSHOT" ]] ; then
- echo "Start SDK package .. from temp"
-
- if [[ -e ${DIR_TMP_SDK_PKG} ]]; then
- rm -rf ${DIR_TMP_SDK_PKG};
- fi
- mkdir ${DIR_TMP_SDK_PKG};
-
- for OS in $OS_LIST
- do
- mkdir -p ${DIR_TMP_SDK_PKG}/${OS};
-
- cp $DIR_OUTPUT/*.zip $DIR_TMP_SDK_PKG/$OS
-
- mv ${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core*.zip ${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}_${TMP_PKG_VERSION}_${OS}.zip
-
- #device
- create_pkginfo "${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}" "$TMP_PKG_VERSION" "all"
- zip "${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}_${TMP_PKG_VERSION}_${OS}.zip" pkginfo.manifest
-
- #emulator
- mv ${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core*.zip ${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}_${TMP_PKG_VERSION}_${OS}.zip
- create_pkginfo "${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}" "$TMP_PKG_VERSION" "all"
- zip "${DIR_TMP_SDK_PKG}/${OS}/${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}_${TMP_PKG_VERSION}_${OS}.zip" pkginfo.manifest
-done
-
-rm $DIR_OUTPUT/*.zip
-find ${DIR_TMP_SDK_PKG} -name "*.zip" -exec mv {} $DIR_OUTPUT \;
-
-fi
-
-if [[ -n "$SNAPSHOT" ]] ; then
- log_info "Add PkgInfo for ABS [$SNAPSHOT] \n\n"
- #device
- create_pkginfo "${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${DEVICE}.core${PRIVATE}" "0.0.1" "all"
- find $DIR_OUTPUT -name "*device*.zip" -exec zip {} pkginfo.manifest \;
-
-
- #emulator
- create_pkginfo "${PLATFORM_PROFILE}-${PLATFORM_VERSION}-rs-${EMULATOR}.core${PRIVATE}" "0.0.1" "all"
- find $DIR_OUTPUT -name "*emulator*.zip" -exec zip {} pkginfo.manifest \;
-fi
-
-###############################################################################
-# Show PKG
-###############################################################################
-echo "$(ls ${pkg_dir}/*.zip | wc -l) files Genereated ... "
-for i in $(ls ${pkg_dir}/*.zip)
-do
- echo "$(du -h $i | awk '{print $2,"["$1"]"}')"
-done
-
-echo "Done... [$SECONDS]Sec"
-exit 0
+++ /dev/null
-# Rootstrap configraution
-export PLATFORM_VERSION="9.0"
-export PLATFORM_PROFILE="tizeniot"
-
-export BASE_URL_PREFIX="https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Base-Dev/reference/"
-export BASE_URL_POSTFIX_TARGET="/repos/standard/packages/"
-export BASE_URL_POSTFIX_EMULATOR="/repos/standard/packages/"
-
-export BASE_PKG_SVR_TARGET="${BASE_URL_PREFIX}${BASE_URL_POSTFIX_TARGET}"
-export BASE_PKG_SVR_EMULATOR="${BASE_URL_PREFIX}${BASE_URL_POSTFIX_EMULATOR}"
-
-export SNAPSHOT_URL_PREFIX="https://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified-Dev/reference/"
-export SNAPSHOT_URL_POSTFIX_EMULATOR="/repos/emulator/packages/"
-export SNAPSHOT_URL_POSTFIX_TARGET="/repos/standard/packages/"
-
-export RPM_PKG_SVR_EMULATOR="${SNAPSHOT_URL_PREFIX}${SNAPSHOT_URL_POSTFIX_EMULATOR}"
-export RPM_PKG_SVR_TARGET="${SNAPSHOT_URL_PREFIX}${SNAPSHOT_URL_POSTFIX_TARGET}"
-
-# Wget ID/PW for Local Test
-export ID=
-export PW=
+++ /dev/null
-DongHee Yang <donghee.yang@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-HyunGoo Kang <hyungoo1.kang@samsung.com>
+++ /dev/null
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+++ /dev/null
-Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
-Except as noted, this software is licensed under Apache License, Version 2.
-Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
+++ /dev/null
-Tizen SDK Development Guide
-
-
-Contents
-========================================
-
-1 Introduction
-2 Setup Build Environment
-2.1 Linux(Ubuntu)
-2.1.1 Install Tizen SDK
-2.1.2 Install Ruby
-2.1.3 Install Packages needed by DIBS
-2.1.4 Install Pre-Requisite Packages
-2.1.5 More
-2.2 Windows
-2.2.1 Install Tizen SDK
-2.2.2 Install Ruby
-2.2.3 Install Packages needed by DIBS
-2.2.4 Install MSYS GIT
-2.2.5 More
-3 Simple Build and Test
-3.1 Build Package
-3.2 Install Package
-3.3 Launch your own SDK
-4 More DIBS commands
-4.1 List Up Available Packages
-4.2 Update Package List
-4.3 Upgrade Packages
-4.4 Install SDK
-
-
-1 Introduction
-========================================
-
-Tizen SDK is composed of many separated packages which are has their own dependencies. And DIBS(Distributed Intelligent Build System) is the build system designed for building that kind of complexity. It provides various features.
-* Has own packaging system and packaging interface
-* Provides distributed package server/build Server
-* Provides Automatic dependency checker/resolver
-* Provides client/server tools which are easy to use
-This guides will show how to build Tize SDK packages using DIBS
-
-
-2 Setup Build Environment
-========================================
-
-2.1 Linux(Ubuntu)
-
-2.1.1 Install Tizen SDK
-Install the SDK first
-
-2.1.2 Install Ruby
-To use DIBS, you have to install Ruby 1.8.7
-
- $ sudo apt-get install ruby
-
-Higher version of Ruby is not tested yet!
-
-2.1.3 Install Packages needed by DIBS
-
- $ sudo apt-get install wget zip unzip
-
-2.1.4 Install Pre-Requisite Packages
-To build or develop SDK , you have to install following packages
-* For emulator development
- bcc bison flex autoconf gcc libglu1-mesa-dev libsdl1.2-dev libgtk2.0-dev libsdl-image1.2-dev libsdl-gfx1.2-dev debhelper libxml2-dev libasound2-dev libx11-dev zlib1g-dev uuid-dev libv4l-dev
-* GDB 7.2
- quilt libncurses5-dev libexpat1-dev libreadline-dev mingw32(only for building windows version)
-* GCC 4.5
- quilt texinfo bison flex mingw32(only for building windows version)
-
- $ sudo apt-get install {pre-requisite packages}
-
-2.1.5 More
-For your convenience,
-* Add DIBS path to $PATH. Edit shell configuration. ex) .bashrc
-
- $ export PATH={SDK Install dir}/dev-tools:$PATH
-
-2.2 Windows
-
-2.2.1 Install Tizen SDK
-Install the SDK first
-
-2.2.2 Install Ruby
-* You can download Ruby binary at ..
- ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.7-i386-mswin32.zip
- http://rubyforge.org/frs/download.php/75679/rubyinstaller-1.8.7-p357.exe
-
-2.2.3 Install Packages needed by DIBS
-* Login MinGW provided by Tizen SDK. Execute following windows BAT file.
-
- {Tizen-Install Dir}/MinGW/msys/1.0/msys.bat
-
-* Execute the following commands on MinGW environment
-
- $ mingw-get.exe update
- $ mingw-get.exe install msys-wget
- $ mingw-get.exe install msys-zip
- $ mingw-get.exe install msys-unzip
-
-2.2.4 Install MSYS GIT
-* Download the MSYS binary
- http://msysgit.googlecode.com/files/Git-1.7.9-preview20120201.exe
-
-* Install it
-
-2.2.5 More
-For your convenience,
-* Add "/usr/bin/ruby" shell script
-
- #!/bin/sh
- {ruby install dir}/bin/ruby.exe $@
-
- ex)
-
- #!/bin/sh
- /c/Ruby187/bin/ruby.exe $@
-
-* Add "/usr/bin/git" shell script
-
- #!/bin/sh
- {MSYS GIT install dir}/bin/ruby.exe $@
-
- ex)
-
- #!/bin/sh
- /c/Program\ Files/Git/bin/it.exe $@
-
-* Add DIBS path to $PATH. Edit shell configuration. ex) /etc/profile
-
- $ export PATH={SDK Install dir}/dev-tools:$PATH
-
-
-3 Simple Build and Test
-========================================
-
-If you downloaded a SDK package source and modified it, then you want to build it and apply it to Tizen SDK. Here is the simple process to do it.
-
-3.1 Build Package
-Building a SDK package is very simple. Here is the command for buiding package.
-
- ## pkg-build [-u <package server url>] [-o <os>] [-c <clean>] [-r <reverse build dependency check>]
- ## -u : Package server URL which contains binary and development packages.
- ## If ommited, it will use previous server URL.
- ## -o : Target OS(ubuntu-32/ubuntu-64/windows-32/windows-64/macos-64)
- ## -c : Clean build""
- ## If set, start build after downloading all dependent packages
- ## If not set, it will not download dependent packages if already downloaded
- ## -r : Check reverse-build-dependency
- ## This option will check that the packages which depend on me can be built
-
-And Here are simple steps
- 1. Move to source directory
- ex)
-
- $ cd ~/project/common-eplugin
-
- 2. Type the command
- ex)
-
- $ pkg-build -u http://172.21.17.55/dibs/unstable
-
- 3. Now you can see the package files( *.zip, *.tar.gz ) in your source directory
-
-3.2 Install Package
-Installing a SDK package is also very simple. Here is the command for installing package files
-
- ## pkg-cli install-file -p <package file path> [-l <location>] [-f]
- ## -p : Binary package file(*.zip) path which you want to install
- ## -l : Install root location of target SDK
- ## If omitted, current working directory path will be set
- ## -f : Install the package by force
- ## This option will allow installing the package that has lower or equal version compare to installed
-
-Now let's assume that you have just finished building and have a Tizen SDK installation on '~/tizen_sdk'
- 1. Just type the command
- ex)
-
- $ pkg-cli install-file -p common-eplugin_0.20.6_linux.zip -l ~/tizen_sdk
-
-3.3 Launch your own SDK
-Now you can check your modifications. Lauch your SDK!!
- 1. type the following command or use the short-cut for launching Tizen SDK.
- ex)
-
- $ ~/tizen_sdk/IDE/startup.sh
-
-
-4 More DIBS commands
-========================================
-
-There are more useful commands provided
-
-4.1 List Up Available Packages
-You can list up available packages of server.
-
- ## pkg-cli list-rpkg -u <package server url> [-o <os>]
- ## -o : Target OS(ubuntu-32/ubuntu-64/windows-32/windows-64/macos-64)
- ## -u : Package server URL which contains binary and development packages.
- ## If ommited, it will use previous server URL.
-
- 1. List up packages
- ex)
-
- $ pkg-cli list-rpkg -u http://172.21.17.55/dibs/unstable_release
-
-You can list up packages of your install directory
-
- ## pkg-cli list-lpkg [-l <locatio>]
- ## -l : Install root location of target SDK
- ## If omitted, current working directory path will be set
-
- 1. List up packages
- ex)
-
- $ pkg-cli list-lpkg -l ~/tizen_sdk
-
-4.2 Upgrade Packages
-You can upgrade your installed packages from server.
-
- ## pkg-cli upgrade -l <location> -u <package server url>
- ## -u : Package server URL which contains binary and development packages.
- ## If ommited, it will use previous server URL.
- ## -l : Install root location of target SDK
- ## If omitted, current working directory path will be set
-
- 1. Check package for upgrading
- ex)
-
- $ pkg-cli check-upgrade -l ~/tizen_sdk -u http://172.21.17.55/dibs/unstable_release
-
- 2. Upgrade packages
- ex)
-
- $ pkg-cli upgrade -l ~/tizen_sdk -u http://172.21.17.55/dibs/unstable_release
-
- 3. If you want to upgrade specific package, you can upgrade it as installing
- ex)
-
- $ pkg-cli install -p common-eplugin -l ~/tizen_sdk -u http://172.21.17.55/dibs/unstable_release
-
-4.3 Install SDK
-You can also install new SDK using the network install command. Originally this command is used for installing packages by network. But you can set "TIZEN-SDK" as package name, all Tizen SDK packages will be installed.
-
- ## pkg-cli install -p <package name> -u <package server url> [-l <location>] [-t] [-f]
- ## -p : Binary package name which you want to install
- ## -u : Package server URL which contains binary and development packages.
- ## If ommited, it will use previous server URL.
- ## -l : Install root location of target SDK
- ## If omitted, current working directory path will be set
- ## -t : Install the package with all dependent packages
- ## -f : Install the package by force
- ## This option will allow installing the package that has lower or equal version compare to installed
-
- 1. Install "TIZEN-SDK" by network to new location("~/tizen_sdk2")
- ex)
-
- $ pkg-cli install -p TIZEN-SDK -u http://172.21.17.55/dibs/unstable_release -l ~/tizen_sdk2 -t
-
- 2. Change Tizen SDK configuration
- ex)
-
- $ echo "TIZEN_SDK_INSTALLED_PATH=/home/{username}/tizen_sdk2" > ~/.TizenSDK/tizensdkpath
-
- 3. Launch your SDK!
- ex)
-
- $ ~/tizen_sdk2/IDE/startup.sh
-
+++ /dev/null
-#!/usr/bin/ruby
-
-=begin
-
- build-cli
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "socket"
-require 'fileutils'
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/build_server"
-require "utils"
-require "BuildClientOptionParser"
-require "BuildComm"
-require "FileTransferViaFTP"
-require "FileTransferViaDirect"
-require "JobLog"
-require "BuildServerException"
-require "RemoteBuilder"
-
-
-#option parsing
-begin
- option = option_parse
-rescue => e
- puts e.message
- exit 1
-end
-
-
-# check HOST OS
-if not Utils.check_host_OS() then
-
- if Utils.is_linux_like_os Utils::HOST_OS then
- Utils.set_default_linux_host_os
- puts "Warning: Your host OS is not supported!\nWe assume your host OS as #{Utils::HOST_OS} !!!"
- else
- puts "Error: Your host OS is not supported!"
- exit 1
- end
-end
-
-def query( ip, port, sym )
- client = BuildCommClient.create( ip, port, nil, 0 )
- if client.nil? then
- puts "Connection to server failed!"
- return nil
- end
- client.send "QUERY|#{sym.strip}"
- result = client.receive_data()
- if result.nil? then
- puts "Error: #{client.get_error_msg()}"
- end
- client.terminate
- return result
-end
-
-def query_system_info(ip, port)
- # HOST SYSTEM INFO
- puts "* SYSTEM INFO *"
- data = query( ip, port, "SYSTEM")
- if data.nil? then exit 1 end
-
- result = data[0].split(",").map { |x| x.strip }
- puts "HOST-OS: #{result[0]}"
- puts "MAX_WORKING_JOBS: #{result[1]}"
-
- # FTP INFO
- puts "\n* FTP *"
- data = query(ip, port, "FTP")
- if data.nil? then exit 1 end
-
- result = data[0].split(",").map { |x| x.strip }
- puts "FTP_ADDR: #{result[0]}"
- puts "FTP_USERNAME: #{result[1]}"
-
- # SUPPORTED OS INFO
- puts "\n* SUPPORTED OS LIST *"
- data = query(ip, port, "OS")
- if data.nil? then exit 1 end
-
- data.each do |item|
- puts "#{item.strip}"
- end
-
- # Friend lists
- puts "\n* FRIEND SERVER LIST (WAIT|WORK/MAX) jobs [transfer count] *"
- data = query(ip, port, "FRIEND")
- if data.nil? then exit 1 end
- i = 0
- data.each do |item|
- i = i + 1
- info = item.split(",").map { |x| x.strip }
- if info[0] == "DISCONNECTED" then
- puts "#{i}. #{info[0]}"
- else
- puts "#{i}. #{info[0]} #{info[1]} server (#{info[2]}|#{info[3]}/#{info[4]}) [#{info[5]}]"
- end
- end
-end
-
-
-def query_project_list(ip, port)
- puts "* PROJECT(S) *"
- data = query( ip, port, "PROJECT")
- data.each do |item|
- tok = item.split(",").map { |x| x.strip }
- type = (tok[0]=="G" ? "NORMAL":"REMOTE")
- printf("%-25s %s %s\n",tok[1],type,tok[2])
- end
-end
-
-
-def query_job_list(ip, port)
- puts "* JOB(S) *"
- data = query(ip, port, "JOB")
- data.each do |item|
- tok = item.split(",").map { |x| x.strip }
- if tok[4].nil? then
- puts "#{tok[1]} #{tok[0]} #{tok[2]} #{tok[3]}"
- else
- puts "#{tok[1]} #{tok[0]} #{tok[2]} (#{tok[3]}) #{tok[4]}"
- end
- end
-end
-
-def upload_request(bs_ip, bs_port, dock, transporter, package )
- result = false
- begin
- client = BuildCommClient.create( bs_ip, bs_port, nil, 0 )
- if client.nil? then
- raise RuntimeError, "Can't access server #{bs_ip}:#{bs_port}"
- end
- msg = "UPLOAD|#{dock}"
- client.send( msg )
- result = client.send_file(package, transporter)
- ensure
- client.terminate if not client.nil?
- end
-
- if not result then
- raise RuntimeError, "Uploading file failed!..."
- end
-end
-
-
-# if "--os" is not specified, use pe
-if option[:os].nil? then
- option[:os] = "default"
-end
-
-if option[:domain].nil? then
- puts "Warn: Build server IP address is not specified. 127.0.0.1 will be used"
- option[:domain] = "127.0.0.1"
-end
-
-begin
- case option[:cmd]
- when "build"
- client = nil
- result = false
- job_id = nil
- job_status = ""
- job_error = ""
-
- addr = Utils.parse_server_addr(option[:domain])
- if addr.nil? then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
-
- builder = RemoteBuilder.new(addr[0], addr[1], nil, nil, nil, nil)
- options = RemoteBuilder.init_options()
- options[:projects] = option[:project]
- options[:passwd] = option[:passwd]
- options[:os] = option[:os]
- options[:noreverse] = (option[:noreverse] == "YES") ? true : false
- options[:dist] = option[:dist]
- options[:user] = option[:user]
- options[:rebuild] = (option[:rebuild] == "YES") ? true : false
- options[:uselatest] = (option[:uselatest] == "YES") ? true : false
- options[:async] = (option[:async] == "YES") ? true : false
- options[:monitor_level] = Log::LV_USER
- options[:save] = option[:save]
- if options[:save] then
- options[:dock] = Utils.create_uniq_name()
- options[:src_path] = Utils::WORKING_DIR
- end
- result = builder.build(options)
-
- if not result then exit(-1) end
-
- when "query"
- result = Utils.parse_server_addr(option[:domain])
- if result.nil? then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
-
- query_system_info( result[0], result[1] )
- puts ""
- query_project_list( result[0], result[1])
- puts ""
- query_job_list( result[0], result[1])
-
- when "query-system"
- result = Utils.parse_server_addr(option[:domain])
- if result.nil? then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
-
- query_system_info( result[0], result[1] )
-
- when "query-project"
- result = Utils.parse_server_addr(option[:domain])
- if result.nil? then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
-
- query_project_list( result[0], result[1])
-
- when "query-job"
- result = Utils.parse_server_addr(option[:domain])
- if result.nil? then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
-
- query_job_list( result[0], result[1] )
-
- when "query-log"
- result = false
- addr = Utils.parse_server_addr(option[:domain])
- if addr.nil? then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
- output = option[:output]
- flock = "ON"
-
- begin
- if output.nil? then
- log = STDOUT
- else
- if File.exist? output
- raise RuntimeError, "The output file is already exist."
- end
-
- log = File.open(output, "w")
- if not log.flock(File::LOCK_EX|File::LOCK_NB) then
- raise RuntimeError, "The output file is already exist."
- end
- log.sync = true
- puts "Started query log, writing to the file \"#{output}\""
- end
-
- result = JobLog.monitor(addr[0], addr[1], option[:job].strip) do |line,status,errmsg|
- if line.nil? then
- next
- end
-
- if line.eql? "=LOG_ERROR" then
- result = false
- end
-
- log.puts line
- if not output.nil? and flock.eql? "ON" then
- log.flock(File::LOCK_UN)
- flock = "OFF"
- end
- end
- if result and not output.nil? then
- log.puts "=LOG_END"
- puts "End query log, check file \"#{output}\""
- end
- rescue BuildServerException => e
- log.puts e.err_message()
- result = false
- rescue => e
- puts "ERROR: #{e}"
- puts e.backtrace.inspect
- result = false
- ensure
- if not output.nil? then
- log.close if not log.nil?
- end
- end
-
- if not result then
- puts "Fail query-log #{option[:job]}."
- FileUtils.rm output if not output.nil?
- exit(1)
- end
-
- when "cancel"
- result = Utils.parse_server_addr(option[:domain])
- if result.nil? then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
- if not option[:job].nil? then
- client = BuildCommClient.create( result[0], result[1], nil, 0 )
- if not client.nil? then
- client.send "CANCEL|#{option[:job]}|#{option[:passwd]}|#{option[:user]}"
- result1 = client.receive_data()
- if result1.nil? then
- puts "Error: #{client.get_error_msg()}"
- client.terminate
- exit 1
- end
- puts result1
- else
- puts "Connection to server failed!"
- exit 1
- end
- else
- puts "you must input \"cancel job number\"!!"
- exit 1
- end
-
- when "register"
- client = nil
- result = false
- job_id = nil
- job_status = ""
- job_error = ""
-
- # check file exist
- if not File.exist? option[:package] then
- puts "The file does not exist!.. #{option[:package]}"
- exit(-1)
- end
-
- result = Utils.parse_server_addr(option[:domain])
- if result.nil? then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
- bs_ip = result[0]
- bs_port = result[1]
-
- if not option[:fdomain].nil? then
- ftp_result = Utils.parse_ftpserver_url(option[:fdomain])
- if ftp_result.nil? or ftp_result.length != 4 then
- puts "FTP server url is incorrect. (#{option[:fdomain]})"
- puts "Tune as following format."
- puts " ftp://<usrename>:<passwd>@<address>"
- exit 1
- end
- ip = ftp_result[0]
- port = ftp_result[1]
- username = ftp_result[2]
- passwd = ftp_result[3]
- transporter = FileTransferFTP.new( nil, ip, port, username, passwd )
- else
- transporter = FileTransferDirect.new( nil )
- end
-
- # register
- client = BuildCommClient.create( bs_ip, bs_port, nil, 0 )
- if client.nil? then
- puts "Can't access server #{bs_ip}:#{bs_port}"
- exit(-1)
- end
-
- begin
- dock = Utils.create_uniq_name()
- client.send("REGISTER|BINARY|#{File.basename(option[:package])}|#{option[:passwd]}|#{dock}|#{option[:dist]}|#{option[:user]}|#{option[:noreverse]}")
- result = client.read_lines do |line|
- if line.strip.eql?("WAITFORUPLOAD") then
- # upload
- thread = Thread.new do
- begin
- upload_request(bs_ip, bs_port, dock, transporter, option[:package])
- rescue => e
- puts "Transfering file failed!"
- puts e.message
- puts e.backtrace.inspect
- end
- end
-
- thread.join
- client.send("REGISTERCONTINUE")
- elsif line.strip.start_with?("=JOB_START") then
- job_id = line.strip.split(",")[1]
- elsif line.strip.start_with?("=JOB_STATUS") then
- data = line.strip.split(",")
- job_status = data[1]
- job_error = data[2]
- else
- # print log
- puts line
- end
- end
-
- if not result then
- puts "Error: Communication failed! #{client.get_error_msg()}"
- elsif job_id.nil? then
- puts job_error
- result = false
- end
- ensure
- client.terminate
- end
-
- if not result then exit(1) end
-
- # Query log in case sync
- begin
- result = JobLog.monitor(bs_ip, bs_port, job_id) do |line,status,errmsg|
- job_status = status
- job_error = errmsg
- if line.nil? then
- next
- end
-
- category, level, contents = JobLog.parse_log(line)
- if level < Log::LV_USER then next end
-
- if category == "INFO" then
- puts "Info: #{contents}"
- elsif category == "WARN" then
- puts "Warn: #{contents}"
- elsif category == "ERROR" then
- puts "Error: #{contents}"
- else
- next
- end
- end
-
- # Check job status
- if not job_status.eql? "FINISHED" then
- result = false
- end
- rescue BuildServerException => e
- puts e.err_message()
- result = false
- rescue => e
- puts "ERROR: #{e}"
- result = false
- end
-
- if not result then exit(-1) end
-
- else
- raise RuntimeError, "input option incorrect : #{option[:cmd]}"
- end
-
-rescue => e
- puts e.message
- exit(-1)
-end
-
-exit 0
+++ /dev/null
-#!/usr/bin/ruby
-
-=begin
-
- build-svr
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/build_server"
-require "utils"
-require "log.rb"
-require "BuildServerOptionParser"
-require "BuildServerController"
-
-#option parsing
-begin
- option = option_parse
-rescue => e
- puts e.message
- exit 0
-end
-
-# check HOST OS
-if not Utils.check_host_OS() then
-
- if Utils.is_linux_like_os Utils::HOST_OS then
- Utils.set_default_linux_host_os
- puts "Warning: Your host OS is not supported!\nWe assume your host OS as #{Utils::HOST_OS} !!!"
- else
- puts "Error: Your host OS is not supported!"
- exit 1
- end
-end
-
-begin
- case option[:cmd]
- when "create"
- ftpsvr_addr = nil; ftpsvr_port = nil; ftpsvr_username = nil; ftpsvr_passwd = nil
- if not option[:fdomain].nil? then
- ftp_result = Utils.parse_ftpserver_url(option[:fdomain])
- if ftp_result.nil? or ftp_result.length != 4 then
- puts "FTP server url is incorrect. (#{option[:fdomain]})"
- puts "Tune as following format."
- puts " ftp://<usrename>:<passwd>@<address>:<port>"
- exit 1
- end
- ftpsvr_addr = ftp_result[0]
- ftpsvr_port = ftp_result[1]
- ftpsvr_username = ftp_result[2]
- ftpsvr_passwd = ftp_result[3]
- end
- BuildServerController.create_server( option[:name], Utils::WORKING_DIR, ftpsvr_addr, ftpsvr_port, ftpsvr_username, ftpsvr_passwd )
- when "remove"
- BuildServerController.remove_server( option[:name] )
- when "migrate"
- BuildServerController.migrate_server( option[:name], option[:db_dsn], option[:db_user], option[:db_passwd] )
- when "start"
- if( option[:child] ) then # Child Process
- BuildServerController.start_server( option[:name], option[:port] )
- else # Parent Process
- # check server config
- if not File.exist? "#{BuildServer::CONFIG_ROOT}/#{option[:name]}/server.cfg"
- raise RuntimeError, "The server \"#{option[:name]}\" does not exist!"
- end
-
- log = Log.new( "#{BuildServer::CONFIG_ROOT}/#{option[:name]}/main.log" )
- begin
- while(true)
- log.info "Build Server[#{option[:name]}] Start - PORT: [#{option[:port]}]"
-
- # set port option
- port_option = ((option[:port] != "") and (option[:port] != nil)) ? "-p #{option[:port]}" : ""
-
- # Start child process
- cmd = Utils.generate_shell_command("#{File.dirname(__FILE__)}/build-svr start -n #{option[:name]} #{port_option} --CHILD")
-
- io = IO.popen(cmd)
- puts io.readlines()
-
- pid = Process.wait
-
- # End chlid process
- log.info "Child process terminated, pid = #{pid}, status = #{$?.exitstatus}"
- if ($?.exitstatus == 0) then # SERVER STOP COMMAND
- log.info "Down Build Server."
- break
- elsif ($?.exitstatus == 99) then # DIBS UPGRADE
- cmd = "#{File.dirname(__FILE__)}/upgrade -l #{File.dirname(__FILE__)} -S -t BUILDSERVER -n #{option[:name]} #{port_option}"
- if File.exist? "#{BuildServer::CONFIG_ROOT}/#{option[:name]}/upgrade_dist" then
- File.open("#{BuildServer::CONFIG_ROOT}/#{option[:name]}/upgrade_dist","r") do |f|
- f.each_line do |l|
- cmd += " -u #{l.strip}"
- break
- end
- end
- File.delete "#{BuildServer::CONFIG_ROOT}/#{option[:name]}/upgrade_dist"
- end
-
- cmd = Utils.generate_shell_command(cmd)
- puts cmd
- Utils.spawn(cmd)
- log.info cmd
- log.info "Down Build Server for DIBS upgrade."
- break
- else
- log.error("Exit value : #{$?.exitstatus}")
- log.error "Down Build Server. Try reboot Build Server."
- end
- end
- rescue => e
- log.error( e.message, Log::LV_USER)
- end
- end
- when "stop"
- BuildServerController.stop_server( option[:name] )
-
- when "upgrade"
- if not (option[:dist].nil? or option[:dist].empty?) then
- build_server = BuildServerController.get_server(option[:name])
- end
-
- BuildServerController.upgrade_server( option[:name], option[:url], option[:dist] )
-
- when "add-svr"
- svr_result = Utils.parse_server_addr(option[:domain])
- if svr_result.nil? or svr_result.length != 2 then
- puts "Server address is incorrect. Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
- pkgsvr_addr = svr_result[0]
- pkgsvr_port = svr_result[1]
- BuildServerController.add_remote_server( option[:name], pkgsvr_addr, pkgsvr_port )
-
- when "remove-svr"
- BuildServerController.remove_remote_server( option[:name], pkgsvr_addr, pkgsvr_port )
-
- when "add-os"
- BuildServerController.add_target_os( option[:name], option[:os] )
-
- when "remove-os"
- BuildServerController.remove_target_os( option[:name], option[:os] )
-
- when "add-dist"
- svr_result = Utils.parse_server_addr(option[:domain])
- if svr_result.nil? or svr_result.length != 2 then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
- pkgsvr_url = option[:url]
- pkgsvr_addr = svr_result[0]
- pkgsvr_port = svr_result[1]
- BuildServerController.add_distribution( option[:name], option[:dist], pkgsvr_url, pkgsvr_addr, pkgsvr_port, option[:passwd] )
-
- when "clone-dist"
- svr_result = Utils.parse_server_addr(option[:domain])
- if svr_result.nil? or svr_result.length != 2 then
- puts "Server address is incorrect. (#{option[:domain]})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
- pkgsvr_url = option[:url]
- pkgsvr_addr = svr_result[0]
- pkgsvr_port = svr_result[1]
- BuildServerController.clone_distribution( option[:name], option[:origin_dist], option[:target_dist], pkgsvr_url, pkgsvr_addr, pkgsvr_port, option[:passwd] )
-
- when "remove-dist"
- BuildServerController.remove_distribution( option[:name], option[:dist] )
-
- when "lock-dist"
- BuildServerController.lock_distribution( option[:name], option[:dist] )
-
- when "unlock-dist"
- BuildServerController.unlock_distribution( option[:name], option[:dist] )
-
- when "add-sync"
- BuildServerController.add_sync_package_server( option[:name], option[:url], option[:dist] )
-
- when "remove-sync"
- BuildServerController.remove_sync_package_server( option[:name], option[:url], option[:dist] )
-
- when "add-prj"
- if not option[:git].nil? then
- BuildServerController.add_project( option[:name], option[:pid],
- option[:git], option[:branch], option[:remote],
- option[:os], option[:dist] )
- else
- BuildServerController.add_binary_project( option[:name], option[:pid],
- option[:package], option[:os], option[:dist] )
- end
-
- when "remove-prj"
- BuildServerController.remove_project( option[:name], option[:pid], option[:dist] )
-
- when "register"
- BuildServerController.register_package( option[:name], option[:package], option[:dist] )
-
- when "query"
- BuildServerController.query_server( option[:name] )
-
- when "set-attr"
- BuildServerController.set_server_attribute( option[:name], option[:attr], option[:value] )
-
- when "get-attr"
- BuildServerController.get_server_attribute( option[:name], option[:attr] )
-
- else
- raise RuntimeError, "input option incorrect : #{option[:cmd]}"
- end
-
- exit 0
-rescue => e
- puts e.message
-end
-
-
+++ /dev/null
-source 'https://rubygems.org'
-
-gem 'rails', '3.2.8'
-
-# Bundle edge Rails instead:
-# gem 'rails', :git => 'git://github.com/rails/rails.git'
-
-gem 'json'
-
-gem 'execjs'
-
-# Gems used only for assets and not required
-# in production environments by default.
-group :assets do
- gem 'sass-rails', '~> 3.2.3'
- gem 'coffee-rails', '~> 3.2.1'
-
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
- # gem 'therubyracer', :platforms => :ruby
-
- gem 'uglifier', '>= 1.0.3'
-end
-
-gem 'jquery-rails'
-
-# mysql
-gem 'mysql2', '> 0.3' # as stated above
-
-# user
-gem 'builder'
-
-# For encrypt password
-gem "bcrypt-ruby", :require => "bcrypt"
-
-# To use ActiveModel has_secure_password
-# gem 'bcrypt-ruby', '~> 3.0.0'
-
-# To use Jbuilder templates for JSON
-# gem 'jbuilder'
-
-# Use unicorn as the app server
-# gem 'unicorn'
-
-# Deploy with Capistrano
-# gem 'capistrano'
-
-# To use debugger
-# gem 'ruby-debug'
+++ /dev/null
-GEM
- remote: https://rubygems.org/
- specs:
- actionmailer (3.2.8)
- actionpack (= 3.2.8)
- mail (~> 2.4.4)
- actionpack (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
- builder (~> 3.0.0)
- erubis (~> 2.7.0)
- journey (~> 1.0.4)
- rack (~> 1.4.0)
- rack-cache (~> 1.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.1.3)
- activemodel (3.2.8)
- activesupport (= 3.2.8)
- builder (~> 3.0.0)
- activerecord (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
- arel (~> 3.0.2)
- tzinfo (~> 0.3.29)
- activeresource (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
- activesupport (3.2.8)
- i18n (~> 0.6)
- multi_json (~> 1.0)
- arel (3.0.2)
- bcrypt-ruby (3.0.1)
- builder (3.0.3)
- coffee-rails (3.2.2)
- coffee-script (>= 2.2.0)
- railties (~> 3.2.0)
- coffee-script (2.2.0)
- coffee-script-source
- execjs
- coffee-script-source (1.3.3)
- erubis (2.7.0)
- execjs (1.4.0)
- multi_json (~> 1.0)
- hike (1.2.1)
- i18n (0.6.1)
- journey (1.0.4)
- jquery-rails (2.1.3)
- railties (>= 3.1.0, < 5.0)
- thor (~> 0.14)
- json (1.7.5)
- mail (2.4.4)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.19)
- multi_json (1.3.6)
- mysql2 (0.3.11)
- polyglot (0.3.3)
- rack (1.4.1)
- rack-cache (1.2)
- rack (>= 0.4)
- rack-ssl (1.3.2)
- rack
- rack-test (0.6.2)
- rack (>= 1.0)
- rails (3.2.8)
- actionmailer (= 3.2.8)
- actionpack (= 3.2.8)
- activerecord (= 3.2.8)
- activeresource (= 3.2.8)
- activesupport (= 3.2.8)
- bundler (~> 1.0)
- railties (= 3.2.8)
- railties (3.2.8)
- actionpack (= 3.2.8)
- activesupport (= 3.2.8)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (>= 0.14.6, < 2.0)
- rake (0.9.2.2)
- rdoc (3.12)
- json (~> 1.4)
- sass (3.2.1)
- sass-rails (3.2.5)
- railties (~> 3.2.0)
- sass (>= 3.1.10)
- tilt (~> 1.3)
- sprockets (2.1.3)
- hike (~> 1.2)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- thor (0.16.0)
- tilt (1.3.3)
- treetop (1.4.10)
- polyglot
- polyglot (>= 0.3.1)
- tzinfo (0.3.33)
- uglifier (1.3.0)
- execjs (>= 0.3.0)
- multi_json (~> 1.0, >= 1.0.2)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- bcrypt-ruby
- builder
- coffee-rails (~> 3.2.1)
- execjs
- jquery-rails
- json
- mysql2 (> 0.3)
- rails (= 3.2.8)
- sass-rails (~> 3.2.3)
- uglifier (>= 1.0.3)
+++ /dev/null
-== Welcome to Rails
-
-Rails is a web-application framework that includes everything needed to create
-database-backed web applications according to the Model-View-Control pattern.
-
-This pattern splits the view (also called the presentation) into "dumb"
-templates that are primarily responsible for inserting pre-built data in between
-HTML tags. The model contains the "smart" domain objects (such as Account,
-Product, Person, Post) that holds all the business logic and knows how to
-persist themselves to a database. The controller handles the incoming requests
-(such as Save New Account, Update Product, Show Post) by manipulating the model
-and directing data to the view.
-
-In Rails, the model is handled by what's called an object-relational mapping
-layer entitled Active Record. This layer allows you to present the data from
-database rows as objects and embellish these data objects with business logic
-methods. You can read more about Active Record in
-link:files/vendor/rails/activerecord/README.html.
-
-The controller and view are handled by the Action Pack, which handles both
-layers by its two parts: Action View and Action Controller. These two layers
-are bundled in a single package due to their heavy interdependence. This is
-unlike the relationship between the Active Record and Action Pack that is much
-more separate. Each of these packages can be used independently outside of
-Rails. You can read more about Action Pack in
-link:files/vendor/rails/actionpack/README.html.
-
-
-== Getting Started
-
-1. At the command prompt, create a new Rails application:
- <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
-
-2. Change directory to <tt>myapp</tt> and start the web server:
- <tt>cd myapp; rails server</tt> (run with --help for options)
-
-3. Go to http://localhost:3000/ and you'll see:
- "Welcome aboard: You're riding Ruby on Rails!"
-
-4. Follow the guidelines to start developing your application. You can find
-the following resources handy:
-
-* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
-* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
-
-
-== Debugging Rails
-
-Sometimes your application goes wrong. Fortunately there are a lot of tools that
-will help you debug it and get it back on the rails.
-
-First area to check is the application log files. Have "tail -f" commands
-running on the server.log and development.log. Rails will automatically display
-debugging and runtime information to these files. Debugging info will also be
-shown in the browser on requests from 127.0.0.1.
-
-You can also log your own messages directly into the log file from your code
-using the Ruby logger class from inside your controllers. Example:
-
- class WeblogController < ActionController::Base
- def destroy
- @weblog = Weblog.find(params[:id])
- @weblog.destroy
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
- end
- end
-
-The result will be a message in your log file along the lines of:
-
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
-
-More information on how to use the logger is at http://www.ruby-doc.org/core/
-
-Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
-several books available online as well:
-
-* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
-* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
-
-These two books will bring you up to speed on the Ruby language and also on
-programming in general.
-
-
-== Debugger
-
-Debugger support is available through the debugger command when you start your
-Mongrel or WEBrick server with --debugger. This means that you can break out of
-execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install ruby-debug to run the server in debugging
-mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
-
- class WeblogController < ActionController::Base
- def index
- @posts = Post.all
- debugger
- end
- end
-
-So the controller will accept the action, run the first line, then present you
-with a IRB prompt in the server window. Here you can do things like:
-
- >> @posts.inspect
- => "[#<Post:0x14a6be8
- @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
- #<Post:0x14a6620
- @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
- >> @posts.first.title = "hello from a debugger"
- => "hello from a debugger"
-
-...and even better, you can examine how your runtime objects actually work:
-
- >> f = @posts.first
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
- >> f.
- Display all 152 possibilities? (y or n)
-
-Finally, when you're ready to resume execution, you can enter "cont".
-
-
-== Console
-
-The console is a Ruby shell, which allows you to interact with your
-application's domain model. Here you'll have all parts of the application
-configured, just like it is when the application is running. You can inspect
-domain models, change values, and save to the database. Starting the script
-without arguments will launch it in the development environment.
-
-To start the console, run <tt>rails console</tt> from the application
-directory.
-
-Options:
-
-* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
- made to the database.
-* Passing an environment name as an argument will load the corresponding
- environment. Example: <tt>rails console production</tt>.
-
-To reload your controllers and models after launching the console run
-<tt>reload!</tt>
-
-More information about irb can be found at:
-link:http://www.rubycentral.org/pickaxe/irb.html
-
-
-== dbconsole
-
-You can go to the command line of your database directly through <tt>rails
-dbconsole</tt>. You would be connected to the database with the credentials
-defined in database.yml. Starting the script without arguments will connect you
-to the development database. Passing an argument will connect you to a different
-database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
-PostgreSQL and SQLite 3.
-
-== Description of Contents
-
-The default directory structure of a generated Ruby on Rails application:
-
- |-- app
- | |-- assets
- | |-- images
- | |-- javascripts
- | `-- stylesheets
- | |-- controllers
- | |-- helpers
- | |-- mailers
- | |-- models
- | `-- views
- | `-- layouts
- |-- config
- | |-- environments
- | |-- initializers
- | `-- locales
- |-- db
- |-- doc
- |-- lib
- | `-- tasks
- |-- log
- |-- public
- |-- script
- |-- test
- | |-- fixtures
- | |-- functional
- | |-- integration
- | |-- performance
- | `-- unit
- |-- tmp
- | |-- cache
- | |-- pids
- | |-- sessions
- | `-- sockets
- `-- vendor
- |-- assets
- `-- stylesheets
- `-- plugins
-
-app
- Holds all the code that's specific to this particular application.
-
-app/assets
- Contains subdirectories for images, stylesheets, and JavaScript files.
-
-app/controllers
- Holds controllers that should be named like weblogs_controller.rb for
- automated URL mapping. All controllers should descend from
- ApplicationController which itself descends from ActionController::Base.
-
-app/models
- Holds models that should be named like post.rb. Models descend from
- ActiveRecord::Base by default.
-
-app/views
- Holds the template files for the view that should be named like
- weblogs/index.html.erb for the WeblogsController#index action. All views use
- eRuby syntax by default.
-
-app/views/layouts
- Holds the template files for layouts to be used with views. This models the
- common header/footer method of wrapping views. In your views, define a layout
- using the <tt>layout :default</tt> and create a file named default.html.erb.
- Inside default.html.erb, call <% yield %> to render the view using this
- layout.
-
-app/helpers
- Holds view helpers that should be named like weblogs_helper.rb. These are
- generated for you automatically when using generators for controllers.
- Helpers can be used to wrap functionality for your views into methods.
-
-config
- Configuration files for the Rails environment, the routing map, the database,
- and other dependencies.
-
-db
- Contains the database schema in schema.rb. db/migrate contains all the
- sequence of Migrations for your schema.
-
-doc
- This directory is where your application documentation will be stored when
- generated using <tt>rake doc:app</tt>
-
-lib
- Application specific libraries. Basically, any kind of custom code that
- doesn't belong under controllers, models, or helpers. This directory is in
- the load path.
-
-public
- The directory available for the web server. Also contains the dispatchers and the
- default HTML files. This should be set as the DOCUMENT_ROOT of your web
- server.
-
-script
- Helper scripts for automation and generation.
-
-test
- Unit and functional tests along with fixtures. When using the rails generate
- command, template test files will be generated for you and placed in this
- directory.
-
-vendor
- External libraries that the application depends on. Also includes the plugins
- subdirectory. If the app has frozen rails, those gems also go here, under
- vendor/rails/. This directory is in the load path.
+++ /dev/null
-#!/usr/bin/env rake
-# Add your own tasks in files placed in lib/tasks ending in .rake,
-# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
-
-require File.expand_path('../config/application', __FILE__)
-
-Dibs::Application.load_tasks
+++ /dev/null
-=begin
- admin_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class AdminController < ApplicationController
-
- before_filter :check_login_status, :check_admin_group
-
- def queryAllOS
- os_list = SupportedOs.find_by_sql("SELECT supported_os.id AS os_id
- , supported_os.name AS os_name
- , os_category.id AS category_id
- , os_category.name AS category_name
- FROM supported_os
- , os_category
- WHERE supported_os.os_category_id = os_category.id
- ORDER BY supported_os.name")
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- os_list.each do |os|
- doc.OS {
- doc.Id(os.os_id)
- doc.Name(os.os_name)
- doc.CategoryId(os.category_id)
- doc.CategoryName(os.category_name)
- }
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryAllOSCategory
- os_category_list = OsCategory.find(:all, :order => "name")
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- os_category_list.each do |category|
- doc.OsCategory{
- doc.Id(category.id)
- doc.Name(category.name)
- }
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
-end
+++ /dev/null
-=begin
- admin_distribution_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class AdminDistributionController < ApplicationController
-
- before_filter :check_login_status, :check_admin_group
-
- def queryDistributionInfo
- dist_id = params[:distId]
-
- if dist_id.nil? or dist_id.empty?
- render :text => "Distribution id is empty", :content_type => "text/xml", :status => 406
- return
- end
-
- # get distribution
- distribution = Distribution.find(:first, :conditions => ["id = ?", dist_id])
- if distribution.nil?
- render :text => "Can't find distribution: [#{dist_id}]", :content_type => "text/xml", :status => 406
- return
- end
-
- # get sync package server
- sync_package_server = SyncPkgServer.find(:first, :conditions => ["distribution_id = ?", dist_id])
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- #generate to XML
- doc.Data{
- doc.DistributionInfo{
- doc.Id(distribution.id)
- doc.Name(distribution.name)
- doc.PackageServerUrl(distribution.pkgsvr_url)
- doc.PackageServerAddress(distribution.pkgsvr_addr)
- doc.Status(distribution.status)
- doc.Description(distribution.description)
- }
-
- doc.SyncPackageServer{
- if sync_package_server.nil?
- doc.Url("")
- doc.Period("")
- doc.Description("")
- else
- doc.Url(sync_package_server.pkgsvr_url)
- doc.Period(sync_package_server.period)
- doc.Description(sync_package_server.description)
- end
- }
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def addDistribution
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- dist_name = change_item[:DistributionName]
- if dist_name.nil? or dist_name.empty? then
- errmsg = "Distribution name is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- dist = Distribution.find(:first, :conditions => ["name = ?", dist_name])
- if dist.nil?
- dist = Distribution.new
- dist.name = dist_name
- dist.pkgsvr_url = change_item[:URL]
- dist.pkgsvr_addr = change_item[:Address]
- dist.status = change_item[:DistStatus]
- dist.description = change_item[:Description]
- dist.save
-
- sync_pkg_svr = SyncPkgServer.new
- sync_pkg_svr.distribution_id = dist.id
- sync_pkg_svr.pkgsvr_url = change_item[:SyncPkgSvrUrl]
- sync_pkg_svr.period = change_item[:SyncPkgSvrPeriod]
- sync_pkg_svr.description = change_item[:SyncPkgSvrDescription]
- sync_pkg_svr.save
- else
- errmsg = "Distribution [#{dist_name}] already exist"
- end
-
- if errmsg.empty?
- render :json => { :success => "OK!" }
- else
- render :json => { :error=> errmsg }, :status => 406
- end
- end
-
- def removeDistribution
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- dist_id = change_item[:DistributionId]
- if dist_id.nil? or dist_id.empty? then
- errmsg = "Distribution id is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- dist = Distribution.find(:first, :conditions => ["id = ?", dist_id])
- if dist.nil?
- errmsg = "Can't find distribution: [#{dist_id}]"
- else
- # first, remove sync package server
- sync_pkg_svr = SyncPkgServer.find(:first, :conditions => ["distribution_id = ?", dist.id])
-
- if not sync_pkg_svr.nil?
- sync_pkg_svr.destroy
- end
-
- # remove project
- projects = Project.find(:all, :conditions => ["distribution_id = ?", dist.id])
- projects.each do |project|
- err = AdminProjectController.remove_project(project.id)
- if err then
- render :json => { :error => err}, :status => 406
- return
- end
- end
-
- # remove job info
- jobs = Job.find(:all, :conditions => ["distribution_id = ?", dist.id])
-
- if not jobs.nil? then
- jobs.each do |job|
- AdminProjectController.removeJob(job.id)
- end
- end
-
- # remove distribution
- dist.destroy
- end
-
- if errmsg.empty?
- render :json => { :success => "OK!" }
- else
- render :json => { :error=> errmsg }, :status => 406
- end
- end
-
- def modifyDistribution
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- dist_id = change_item[:DistributionId]
- if dist_id.nil? or dist_id.empty? then
- errmsg = "Distribution id is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- dist = Distribution.find(:first, :conditions => ["id = ?", dist_id])
- if dist.nil?
- errmsg = "Can't find distribution: [#{dist_id}]"
- else
- dist.pkgsvr_url = change_item[:URL]
- dist.pkgsvr_addr = change_item[:Address]
- dist.status = change_item[:DistStatus]
- dist.description = change_item[:Description]
- dist.save
-
- sync_pkg_svr_url = change_item[:SyncPkgSvrUrl]
- sync_pkg_svr_period = change_item[:SyncPkgSvrPeriod]
- sync_pkg_svr_description = change_item[:SyncPkgSvrDescription]
- sync_pkg_svr = SyncPkgServer.find(:first, :conditions => ["distribution_id = ?", dist.id])
- if not sync_pkg_svr_url.nil? and not sync_pkg_svr_url.empty?
- if sync_pkg_svr.nil?
- sync_pkg_svr = SyncPkgServer.new
- end
- sync_pkg_svr.distribution_id = dist.id
- sync_pkg_svr.pkgsvr_url = sync_pkg_svr_url
- sync_pkg_svr.period = sync_pkg_svr_period
- sync_pkg_svr.description = sync_pkg_svr_description
- sync_pkg_svr.save
- elsif not sync_pkg_svr.nil? and not sync_pkg_svr_url.nil? and sync_pkg_svr_url.empty?
- # if sync_pkg_svr is already exist and modified sync_pkg_svr_url is empty then remove it
- sync_pkg_svr.destroy
- end
- end
-
- if errmsg.empty?
- render :json => { :success => "OK!" }
- else
- render :json => { :error=> errmsg }, :status => 406
- end
- end
-end
+++ /dev/null
-=begin
- admin_group_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class AdminGroupController < ApplicationController
-
- before_filter :check_login_status, :check_admin_group
- skip_before_filter :check_admin_group, :only => [:queryAllGroup]
-
- def queryAllGroup
- group_list = Group.find(:all)
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- group_list.each do |group|
- doc.Group {
- doc.GroupId(group.id)
- doc.GroupName(group.name)
- doc.AdminFlag(group.admin)
- doc.Description(group.description)
-
- project_list = GroupProjectAccess.find_by_sql("SELECT projects.name AS project_name
- , distributions.name AS distribution_name
- FROM group_project_accesses
- , projects
- , distributions
- WHERE group_project_accesses.group_id = #{group.id}
- AND projects.id = group_project_accesses.project_id
- AND distributions.id = projects.distribution_id
- AND distributions.status = 'OPEN'
- ORDER BY projects.name")
-
- project_list.each do |project|
- doc.AccessableProject {
- doc.ProjectName(project.project_name)
- doc.ProjectDistribution(project.distribution_name)
- }
- end
- }
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryGroupInfo
- group_id = params[:groupId]
- if group_id.nil? or group_id.empty?
- render :text => "Group id is empty", :content_type => "text/xml", :status => 406
- return
- end
-
- group = Group.find(:first, :conditions => ["id = ?", group_id])
- if group.nil?
- render :text => "Can't find group: #{group_id}", :content_type => "text/xml", :status => 406
- return
- end
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- project_list = Project.find_by_sql("SELECT projects.name AS project_name
- , projects.id AS project_id
- , distributions.name AS distribution_name
- FROM projects
- , distributions
- WHERE distributions.id = projects.distribution_id
- AND distributions.status = 'OPEN'
- ORDER BY projects.name")
-
- project_list.each do |project|
- doc.Project{
- doc.Id(project.project_id)
- doc.Name(project.project_name)
- doc.DistName(project.distribution_name)
- }
- end
-
- doc.Group {
- group_access_list = GroupProjectAccess.find(:all, :conditions => ["group_id = ?", group.id])
-
- project_id_list = []
- group_access_list.each do |group_right|
- project_id_list.push group_right.project_id
- end
-
- doc.ProjectIdList(project_id_list.join(","))
- }
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def modifyGroup
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- group_id = change_item[:GroupId]
- if group_id.nil? or group_id.empty?
- errmsg = "group id is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- else
- group = Group.find(:first, :conditions => ["id= ?", group_id])
- end
-
- if group.nil?
- errmsg = "Can't find group: #{group_id}"
- else
- group_name = change_item[:GroupName]
- admin_flag = change_item[:AdminFlag]
- description = change_item[:Description]
- project_id_list = change_item[:ProjectList].split(",")
-
- group.name = group_name
- group.admin = admin_flag
- group.description = description
- group.save
-
- GroupProjectAccess.delete_all(["group_id = ?", group.id])
-
- project_id_list.each do |project_id|
- item = GroupProjectAccess.new
- item.group_id = group.id
- item.project_id = project_id
- item.build = "TRUE"
- item.save
- end
- end
-
-
- if errmsg.empty?
- render :json => { :success => "OK!" }
- else
- render :json => { :error=> errmsg }, :status => 406
- end
- end
-
- def removeGroup
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- group_id = change_item[:GroupId].to_s
- if group_id.nil? or group_id.empty?
- errmsg = "group id is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- else
- group = Group.find(:first, :conditions => ["id = ?", group_id])
- end
-
- if group.nil?
- errmsg = "Can't find group: #{group_id}"
- else
- user_group = UserGroup.find(:first, :conditions => ["group_id = ?", group.id])
- if user_group.nil?
- GroupProjectAccess.delete_all(["group_id = ?", group.id])
- group.destroy
- else
- errmsg = "Can't remove. #{group.id} has users."
- end
- end
-
- if errmsg.empty?
- render :json => { :success => "OK!" }
- else
- render :json => { :error=> errmsg }, :status => 406
- end
- end
-
- def addGroup
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- group_name = change_item[:GroupName]
- if group_name.nil? or group_name.empty?
- errmsg = "Group name is invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- else
- group = Group.find(:first, :conditions => ["name= ?", group_name])
- end
-
- if not group.nil?
- errmsg = "Group already exist"
- else
- group = Group.new
- group.name = group_name
- group.admin = change_item[:AdminFlag]
- group.description = change_item[:Description]
- group.save
-
- project_id_list = change_item[:ProjectList].split(",")
- project_id_list.each do |project_id|
- group_project_access = GroupProjectAccess.new
- group_project_access.group_id = group.id
- group_project_access.project_id = project_id
- group_project_access.save
- end
- end
-
- if errmsg.empty?
- render :json => { :success => "OK!" }
- else
- render :json => { :error=> errmsg }, :status => 406
- end
- end
-end
+++ /dev/null
-=begin
- admin_project_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class AdminProjectController < ApplicationController
- def queryProjectsInDistributionForAdmin
- dist_id = params[:distId]
-
- if dist_id.nil? or dist_id.empty?
- render :text => "Distribution id is empty", :content_type => "text/xml", :status => 406
- return
- end
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- #generate to XML
- doc.Data{
- project_list = Project.find_by_sql("SELECT projects.id
- , projects.name
- , projects.ptype
- , projects.status
- FROM projects
- , distributions
- WHERE distributions.id = \"#{dist_id}\"
- AND distributions.id = projects.distribution_id
- ORDER BY projects.name")
-
- project_list.each do |project|
- doc.Project {
- doc.Id(project.id)
- doc.Name(project.name)
- doc.Type(project.ptype)
- doc.ProjectStatus(project.status)
-
- os_list = ProjectOs.find_by_sql("SELECT supported_os.name AS name
- FROM project_os
- , supported_os
- WHERE project_os.project_id = #{project.id}
- AND project_os.supported_os_id = supported_os.id
- ORDER BY supported_os.name")
- os_list.each do |os|
- doc.OS(os.name)
- end
-
- case project.ptype.upcase
- when "GIT"
- git = ProjectGit.find(:first, :conditions => ["project_id = ?", project.id])
- if not git.nil? then
- doc.GitRepos(git.git_repos)
- doc.GitBranch(git.git_branch)
- end
-
- when "BINARY"
- bin = ProjectBin.find(:first, :conditions => ["project_id = ?", project.id])
- if not bin.nil? then
- doc.PackageName(bin.pkg_name)
- end
- end
- }
- end
-
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def addProject
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- dist_id = change_item[:DistId]
- project_name = change_item[:Name]
- project_type = change_item[:ProjectType].upcase
- project_status = change_item[:ProjectStatus].upcase
-
- if dist_id.nil? or dist_id.empty? or
- project_name.nil? or project_name.empty? or
- project_type.nil? or project_type.empty? or
- project_status.nil? or project_status.empty? then
- errmsg = "add project information invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- if not project_type.eql? "GIT" and not project_type.eql? "BINARY"
- errmsg = "project type is invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
- if not project_status.eql? "OPEN" and not project_status.eql? "CLOSE"
- errmsg = "project status is invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- distribution = Distribution.find(:first, :conditions => ["id = ?", dist_id])
- if distribution.nil?
- errmsg = "Can't find distribution: #{dist_id}"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- project = Project.find(:first, :conditions => ["name = ? and distribution_id = ?", project_name, dist_id])
-
- if not project.nil?
- errmsg = "project already exist"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- project = Project.new
- project.name = project_name
- project.ptype = project_type
- project.status = project_status
- project.distribution_id = dist_id
- #TODO: set project user is admin. admin user id is '1'
- project.user_id = 1
- project.save
-
- if not change_item[:OSIdList].nil?
- os_id_list = change_item[:OSIdList].split(",")
- os_id_list.each do |os_id|
- supported_os = SupportedOs.find(:first, :conditions => ["id = ?", os_id])
- if supported_os.nil?
- errmsg = "project os id is invalid: #{os_id}"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- project_os = ProjectOs.new
- project_os.project_id = project.id
- project_os.supported_os_id = supported_os.id
- project_os.save
- end
- end
-
- case project.ptype
- when "GIT"
- git = ProjectGit.new
- git.project_id = project.id
- git.git_repos = change_item[:Address]
- git.git_branch = change_item[:Branch]
- git.save
- when "BINARY"
- binary = ProjectBin.new
- binary.project_id = project.id
- binary.pkg_name = change_item[:PackageName]
- binary.save
- end
-
- render :json => { :success => "OK!" }
- end
-
- def removeProject
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- if change_item[:ProjectId].nil? or change_item[:ProjectId].empty? then
- errmsg = "project id is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- project_id = change_item[:ProjectId]
-
- err = AdminProjectController.remove_project(project_id)
- if err then
- render :json => { :error => err}, :status => 406
- else
- render :json => { :success => "OK!" }
- end
- end
-
- def AdminProjectController.remove_project(project_id)
- project = Project.find(:first, :conditions => ["id = ?", project_id])
-
- if project.nil?
- errmsg = "project does not exist: #{project_id}"
- return errmsg
- end
-
- # remove job info
- jobs = Job.find(:all, :conditions => ["project_id =?", project_id])
-
- if not jobs.nil? then
- jobs.each do |job|
- AdminProjectController.removeJob(job.id)
- end
- end
-
- # remove source info
- sources = Source.find(:all, :conditions => ["project_id = ?", project_id])
- if not sources.nil? then
- sources.each do |source|
- # remove package
- Package.delete_all(["source_id = ?", source.id])
-
- # remove job info (If sync job ,project_id is empty in jobs)
- jobs = Job.find(:all, :conditions => ["source_id =?", source.id])
- if not jobs.nil? then
- jobs.each do |job|
- AdminProjectController.removeJob(job.id)
- end
- end
-
- source.destroy
- end
-
- end
-
- # remove sub-project table
- case project.ptype
- when "GIT"
- ProjectGit.delete_all(["project_id = ?", project_id])
- ProjectOs.delete_all(["project_id = ?", project_id])
- GroupProjectAccess.delete_all(["project_id = ?", project_id])
- when "BINARY"
- ProjectBin.delete_all(["project_id = ?", project_id])
- GroupProjectAccess.delete_all(["project_id = ?", project_id])
- else
- errmsg = "project type is invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # remove project os
- ProjectOs.delete_all(["project_id = ?", project_id])
-
- # remove project
- project.destroy
-
- return
- end
-
- def AdminProjectController.removeJob(id)
- job = Job.find(id)
-
- # remove child job
- children_job = Job.find(:all, :conditions => ["parent_job_id = ?", job.id])
- children_job.each do |child_job|
- AdminProjectController.removeJob(child_job.id)
- end
-
- JobTimestamp.delete_all(["job_id=?", job.id])
- job.destroy
- end
-
- def modifyProject
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- project_id = change_item[:Id]
- project_name = change_item[:Name]
- project_status = change_item[:ProjectStatus].upcase
-
- if project_id.nil? or project_id.empty? or
- project_name.nil? or project_name.empty? or
- project_status.nil? or project_status.empty? then
- errmsg = "project information invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- if not project_status.eql? "OPEN" and not project_status.eql? "CLOSE"
- errmsg = "project status is invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- project = Project.find(:first, :conditions => ["id = ?", project_id])
- if project.nil?
- errmsg = "project does not exist"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # project data update
- if not project.name.eql? project_name then
- name_check_project = Project.find(:first, :conditions => ["name = ? and distribution_id = ?", project_name, project.distribution_id])
-
- if not name_check_project.nil?
- errmsg = "project already exist"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- project.name = project_name
- end
- project.status = project_status
-
- # remove project os and reset project os
- ProjectOs.delete_all(["project_id = ?", project_id])
- if not change_item[:OSIdList].nil?
- os_id_list = change_item[:OSIdList].split(",")
- os_id_list.each do |os_id|
- supported_os = SupportedOs.find(:first, :conditions => ["id = ?", os_id])
- if supported_os.nil?
- errmsg = "project os id is invalid: #{os_id}"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- project_os = ProjectOs.new
- project_os.project_id = project_id
- project_os.supported_os_id = supported_os.id
- project_os.save
- end
- end
-
- case project.ptype
- when "GIT"
- project_git = ProjectGit.find(:first, :conditions => ["project_id = ?", project_id])
- if project_git.nil?
- project_git.project_id = project_id
- project_git = ProjectGit.new
- end
- project_git.git_repos = change_item[:ProjectAddress]
- project_git.git_branch = change_item[:ProjectBranch]
- project_git.save
-
- when "BINARY"
- project_bin = ProjectBin.find(:first, :conditions => ["project_id = ?", project_id])
- if project_bin.nil?
- project_bin = ProjectBin.new
- project_bin.project_id = project_id
- end
- project_bin.pkg_name = change_item[:PackageName]
- project_bin.save
- end
-
- project.save
- render :json => { :success => "OK!" }
- end
-
- def changeAllProjectStatus
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- dist_id = change_item[:DistId]
- projectStatus = change_item[:ProjectStatus]
-
- if projectStatus.nil? or not (projectStatus.eql? "OPEN" or projectStatus.eql? "CLOSE") then
- errmsg = "project status must be OPEN or CLOSE"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- distribution = Distribution.find(:first, :conditions => ["id = ?", dist_id])
- Project.update_all("status=\"#{projectStatus}\"", :distribution_id => distribution.id)
-
- render :json => { :success => "OK!" }
- end
-end
+++ /dev/null
-=begin
- admin_server_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class AdminServerController < ApplicationController
- def queryAllServer
- # get full distribution list
- server_config = Server_config.find(:all)
- remote_build_servers = RemoteBuildServer.find(:all)
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- #generate to XML
- doc.Data {
- server_config.each do |info|
- doc.ServerConfig {
- doc.Id( info.id )
- doc.Property( info.property )
- doc.Value( info.value )
- }
- end
-
- remote_build_servers.each do |server|
- doc.RemoteBuildServer {
- doc.Id(server.id)
- doc.Address(server.svr_addr)
- supported_os = SupportedOs.find(:first, :conditions => ["id = ?", server.supported_os_id])
- if supported_os.nil?
- doc.SupportedOS("")
- else
- doc.SupportedOS(supported_os.name)
- end
- doc.Status(server.status)
- doc.MaxJobCount(server.max_job_count)
- doc.WorkingJobCount(server.working_job_count)
- doc.WaitingJobCount(server.waiting_job_count)
- doc.Description(server.description)
- }
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryServerConfig
- config_id = params[:configId]
- if config_id.nil?
- #send_data
- render :text => "Config id value is invalid", :content_type => "text/xml"
- return
- end
-
- server_config = Server_config.find(:first, :conditions => ["id = ?", config_id])
- if server_config.nil?
- #send_data
- render :text => "Can't find server config: #{config_id}", :content_type => "text/xml"
- return
- end
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- #generate to XML
- doc.Data {
- doc.Id(server_config.id)
- doc.Property(server_config.property)
- doc.Value(server_config.value)
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def querySupportedOS
- os_id = params[:osId]
- if os_id.nil?
- #send_data
- render :text => "Supported os id is invalid", :content_type => "text/xml"
- return
- end
-
- supported_os = SupportedOs.find(:first, :conditions => ["id = ?", os_id])
- if supported_os.nil?
- #send_data
- render :text => "Can't find supported os: #{os_id}", :content_type => "text/xml"
- return
- end
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- #generate to XML
- doc.Data {
- doc.Id(supported_os.id)
- doc.Name(supported_os.name)
- doc.CategoryId(supported_os.os_category_id)
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryRemoteBuildServer
- server_id = params[:serverId]
- remote_server = RemoteBuildServer.find(:first, :conditions => ["id = ?", server_id])
- if remote_server.nil?
- #send_data
- render :text => "Can't find server: #{server_id}", :content_type => "text/xml"
- return
- end
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- #generate to XML
- doc.Data {
- doc.Id(remote_server.id)
- doc.Address(remote_server.svr_addr)
- doc.Description(remote_server.description)
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def addRemoteBuildServer
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- address = change_item[:Address]
- description = change_item[:Description]
- if address.nil? or address.empty?
- errmsg = "Server address is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- server = RemoteBuildServer.find(:first, :conditions => ["svr_addr = ?", address])
-
- if server.nil?
- server = RemoteBuildServer.new
- server.svr_addr = address.strip
- server.description = description
- server.save
-
- render :json => { :success => "OK!" }
- else
- errmsg = "Server already exist"
- render :json => { :error => errmsg }, :status => 406
- end
- end
-
- def modifyRemoteBuildServer
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- id = change_item[:Id]
- address = change_item[:Address]
- description = change_item[:Description]
- if id.nil? or
- address.nil? or address.empty?
- errmsg = "Server information is invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- server = RemoteBuildServer.find(:first, :conditions => ["id = ?", id])
-
- if server.nil?
- errmsg = "Server does not exist"
- else
- # error check for server already exist
- if not server.svr_addr.eql? address
- check_server = RemoteBuildServer.find(:first, :conditions => ["svr_addr = ?", address])
-
- if not check_server.nil?
- errmsg = "Server already exist"
- render :json => { :error => errmsg }, :status => 406
- return
- end
- end
-
- server.svr_addr = address.strip
- server.description = description.strip
- server.save
- end
-
-
- if errmsg.empty?
- render :json => { :success => "OK!" }
- else
- render :json => { :error => errmsg }, :status => 406
- end
- end
-
- def removeRemoteBuildServer
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- id = change_item[:Id]
- if id.nil? or id.empty?
- errmsg = "Server id is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- server = RemoteBuildServer.find(:first, :conditions => ["id = ?", id])
-
- if server.nil? then
- errmsg = "Server does not exist"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # update job info
- Job.where(:remote_build_server_id => id).update_all(:remote_build_server_id => nil)
-
- server.destroy
- render :json => { :success => "OK!" }
-
- end
-
- def addOSCategory
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- name = change_item[:Name]
- if name.nil? or name.empty?
- errmsg = "Os category name is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- osCategory = OsCategory.find(:first, :conditions => ["name = ?", name])
-
- if osCategory.nil?
- osCategory= OsCategory.new
- osCategory.name = name
- osCategory.save
-
- render :json => { :success => "OK!" }
- else
- errmsg = "Os category already exist"
- render :json => { :error => errmsg }, :status => 406
- end
- end
-
- def removeOSCategory
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- id = change_item[:Id]
- if id.nil? or id.empty?
- errmsg = "Os category id is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- osCategory = OsCategory.find(:first, :conditions => ["id = ?", id])
-
- if osCategory.nil?
- errmsg = "Can't find os category"
- render :json => { :error => errmsg }, :status => 406
- else
- osCategory.destroy
- render :json => { :success => "OK!" }
- end
- end
-
- def addSupportedOS
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- os_name = change_item[:Name]
- category_id = change_item[:OsCategoryId]
- if os_name.nil? or os_name.empty?
- errmsg = "Os name is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
- if category_id.nil? or category_id.empty?
- errmsg = "Os category is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- os_category = OsCategory.find(:first, :conditions => ["id = ?", category_id])
- supported_os = SupportedOs.find(:first, :conditions => ["name = ?", os_name])
-
- if os_category.nil?
- errmsg = "Os category does not exist"
- render :json => { :error => errmsg }, :status => 406
- elsif not supported_os.nil?
- errmsg = "supported os already exist"
- render :json => { :error => errmsg }, :status => 406
- else
- supported_os = SupportedOs.new
- supported_os.name = os_name.strip
- supported_os.os_category_id = os_category.id
- supported_os.save
- render :json => { :success => "OK!" }
- end
- end
-
- def removeSupportedOS
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- os_id = change_item[:Id]
- if os_id.nil? or os_id.empty?
- errmsg = "Os id is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- supported_os = SupportedOs.find(:first, :conditions => ["id = ?", os_id])
-
- if supported_os.nil?
- errmsg = "supported os does not exist"
- render :json => { :error => errmsg }, :status => 406
- end
-
- supported_os.destroy
- render :json => { :success => "OK!" }
- end
-
- def modifySupportedOS
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- os_id = change_item[:Id]
- os_name = change_item[:Name]
- category_id = change_item[:OsCategoryId]
- if os_id.nil? or os_id.empty? or
- os_name.nil? or os_name.empty? or
- category_id.nil? or category_id.empty?
- errmsg = "modify os data is invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- os_category = OsCategory.find(:first, :conditions => ["id = ?", category_id])
- supported_os = SupportedOs.find(:first, :conditions => ["id = ?", os_id])
-
- if os_category.nil?
- errmsg = "Os category does not exist"
-
- render :json => { :error => errmsg }, :status => 406
- elsif supported_os.nil?
- errmsg = "supported os does not exist"
-
- render :json => { :error => errmsg }, :status => 406
- else
- if not supported_os.name.eql? os_name
- check_supported_os = SupportedOs.find(:first, :conditions => ["name = ?", os_name])
- if check_supported_os.nil?
- supported_os.name = os_name
- else
- errmsg = "supported os already exist"
- render :json => { :error => errmsg }, :status => 406
- return
- end
- end
-
- supported_os.os_category_id = os_category.id
- supported_os.save
- render :json => { :success => "OK!" }
- end
- end
-
- def addServerInfo
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- property = change_item[:Property]
- value = change_item[:Value]
- if property.nil? or property.empty?
- errmsg = "Property name is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
- if value.nil? or value.empty?
- errmsg = "Value is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- config = Server_config.find(:first, :conditions => ["property = ?", property])
-
- if not config.nil?
- errmsg = "Config alerady exist"
- render :json => { :error => errmsg }, :status => 406
- else
- config = Server_config.new
- config.property = property
- config.value = value
- config.save
-
- render :json => { :success => "OK!" }
- end
- end
-
- def modifyServerInfo
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- id = change_item[:Id]
- property = change_item[:Property]
- value = change_item[:Value]
- if id.nil? or id.empty? or
- value.nil? or value.empty? or
- property.nil? or property.empty?
- errmsg = "server info is invalid"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- config = Server_config.find(:first, :conditions => ["id = ?", id])
-
- if config.nil?
- errmsg = "Config does not exist"
- render :json => { :error => errmsg }, :status => 406
- else
- config.property = property
- config.value = value
- config.save
-
- render :json => { :success => "OK!" }
- end
- end
-
- def removeServerInfo
- change_group_list = params[:ChangeInfoList]
- change_item = change_group_list[0]
- errmsg = ""
-
- property = change_item[:Property]
- if property.nil? or property.empty?
- errmsg = "Property is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- # get server for error check
- config = Server_config.find(:first, :conditions => ["property = ?", property])
-
- if config.nil?
- errmsg = "Property does not exist"
- render :json => { :error => errmsg }, :status => 406
- else
- config.destroy
- render :json => { :success => "OK!" }
- end
- end
-
-end
+++ /dev/null
-=begin
- admin_user_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class AdminUserController < ApplicationController
-
- before_filter :check_login_status, :check_admin_group
-
- def queryAllUser
- user_list = User.find(:all, :order => "name")
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- user_list.each do |user|
- doc.User {
- doc.Name(user.name)
- doc.Email(user.email)
- doc.Id(user.id)
- doc.GroupList {
- group_list = Group.find_by_sql("SELECT groups.name
- , groups.admin
- , groups.description
- FROM users
- , user_groups
- , groups
- WHERE users.email = \"#{user.email}\"
- AND users.id = user_groups.user_id
- AND user_groups.group_id = groups.id
- ORDER BY users.name")
- group_list.each do |group|
- doc.GroupName(group.name)
- end
- }
- }
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryUserInfo
- user_id = params[:user_id]
-
- user = User.find(:first, :conditions => ["id = ?", user_id])
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- doc.User {
- doc.Name(user.name)
- doc.Email(user.email)
- doc.Id(user.id)
- doc.GroupInfo{
- full_group_list = Group.find(:all)
- full_group_list.each do |group|
- doc.Group {
- doc.Name(group.name)
- doc.Id(group.id)
- }
- end
-
- group_list = Group.find_by_sql("SELECT user_groups.group_id
- FROM users
- , user_groups
- WHERE users.id = #{user.id}
- AND users.id = user_groups.user_id")
- group_id_list = []
- group_list.each do |group|
- group_id_list.push group.group_id
- end
- doc.GroupIdList(group_id_list.join(","))
- }
- }
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def modifyUser
- change_user_list = params[:ChangeInfoList]
- change_item = change_user_list[0]
- errmsg = ""
-
- id = change_item[:Id]
- email = change_item[:Email]
- name = change_item[:Name]
- group_id_list = change_item[:GroupIdList].split(",")
-
- if id.nil? or
- email.nil? or email.empty?
- render :text => "User data is invalid", :status => 406
- return
- end
-
- user = User.find(:first, :conditions => ["id = ?", id])
-
- if user.nil?
- errmsg = "Can't find user information"
- render :text => errmsg, :status => 406
- return
- end
-
- if not user.email.eql? email
- check_user = User.find(:first, :conditions => ["email = ?", email])
- if not check_user.nil?
- errmsg = "Email address already used"
- render :text => errmsg, :status => 406
- return
- end
-
- user.email = email
- end
-
- user.name = name
- user.save
-
- UserGroup.delete_all(["user_id = ?", user.id])
-
- if not group_id_list.nil?
- group_id_list.each do |group_id|
- user_groups = UserGroup.new
-
- user_groups.user_id = user.id
- user_groups.group_id = group_id
- user_groups.status = "ACTIVE"
- user_groups.save
- end
- end
-
- render :json => { :success => "OK!" }
- end
-
- def resetUser
- change_user_list = params[:ChangeInfoList]
- change_item = change_user_list[0]
- errmsg = ""
-
- id = change_item[:Id]
- email = change_item[:Email]
-
- if id.nil? or email.nil? or email.empty?
- render :text => "User data is invalid", :status => 406
- return
- end
-
- user = User.find(:first, :conditions => ["id = ?", id])
-
- if user.nil?
- errmsg = "Can't find user information"
- render :text => errmsg, :status => 406
- return
- end
-
- if not user.email.eql? email
- errmsg = "Email address already used"
- render :text => errmsg, :status => 406
- return
- end
-
- user.password = user.email
- user.password_confirmation = user.email
-
- user.save
-
- render :json => { :success => "OK!" }
- end
-
- def removeUser
- change_user_list = params[:ChangeInfoList]
- change_item = change_user_list[0]
- errmsg = ""
-
- id = change_item[:Id]
- if id.nil?
- render :text => "User infomation invalid", :status => 406
- return
- end
-
- user = User.find(:first, :conditions => ["id = ?", id])
-
- if user.nil?
- errmsg = "Can't find user information"
- render :text => errmsg, :status => 406
- return
- end
-
- UserGroup.delete_all(["user_id = ?", user.id])
-
- user.destroy
- render :json => { :success => "OK!" }
- end
-end
+++ /dev/null
-=begin
- application_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class ApplicationController < ActionController::Base
- #protect_from_forgery
-
- JOBS_STAUTS_WAITING = "WAITING"
-
- helper_method :current_user
-
- def get_user_id
- if @current_user.nil?
- current_user
- end
-
- if not @current_user.nil?
- return @current_user.id
- else
- return nil
- end
- end
-
- def get_user_email
- if @current_user.nil?
- current_user
- end
-
- if not @current_user.nil?
- return @current_user.email
- else
- return nil
- end
- end
-
- def get_user_password
- if @current_user.nil?
- current_user
- end
-
- if not @current_user.nil?
- return @current_user.password_hash
- else
- return nil
- end
- end
-
- def get_group_list(email)
- if not email.nil?
- group_list = Group.find_by_sql("SELECT groups.id
- , groups.name
- , groups.admin
- , groups.description
- FROM users
- , user_groups
- , groups
- WHERE users.id = user_groups.user_id
- AND user_groups.group_id = groups.id
- AND users.email = \"#{email}\"")
- return group_list
- else
- return nil
- end
- end
-
- def is_admin(email)
- if not email.nil?
- group = Group.find_by_sql("SELECT count(*) AS cnt
- FROM users
- , user_groups
- , groups
- WHERE users.id = user_groups.user_id
- AND user_groups.group_id = groups.id
- AND groups.admin = 'TRUE'
- AND users.email = \"#{email}\"")
- if group[0].cnt > 0
- return TRUE
- end
- end
-
- return FALSE
- end
-
- def generate_xml_header(doc)
- email = get_user_email
- group_list = get_group_list(email)
- if is_admin(email)
- admin = "TRUE"
- else
- admin = "FALSE"
- end
-
- doc.Header {
- doc.UserInfo {
- doc.Email(email)
- doc.Name(@current_user.name)
- doc.Admin(admin)
- doc.GroupList {
- group_list.each { |group|
- doc.Group {
- doc.GroupName(group.name)
- doc.GroupAdmin(group.admin)
- doc.GroupDescription(group.description)
- }
- }
- }
- }
- }
- end
-
- private
- def current_user
- @current_user ||= User.find(:first, :conditions => {:email => session[:user_email]}) if session[:user_email]
- end
-
- def check_login_status
- if session[:user_email].nil? then
- render :nothing => true, :status => 401
- return
- end
- end
-
- def check_admin_group
- if session[:user_email].nil? or session[:user_email].empty? then
- render :nothing => true, :status => 401
- return false
- else
- admin = "FALSE"
- user_email = session[:user_email]
-
- user = User.find(:first, :conditions => ["email = ?", user_email])
-
- group_list = get_group_list(user.email)
-
- group_list.each {|group|
- if group.admin == "TRUE"
- admin = "TRUE"
- break;
- end
- }
-
- if user.nil? or admin != "TRUE"
- render :nothing => true, :status => 401
- return false
- end
- end
-
- return true
- end
-end
+++ /dev/null
-=begin
- jobs_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class JobsController < ApplicationController
-
- before_filter :check_login_status
-
- QUERY_CNT = 5
-
- def list
- end
-
- def listAll
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- listQuery(doc, "QUERY", params[:distribution], params[:status], params[:lastID], "", "")
- }
- }
- render :text => out_string, :content_type => "text/xml"
- end
-
- def listSearchUser
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- listQuery(doc, "QUERY", params[:distribution], params[:status], params[:lastID], params[:user], "")
- }
- }
- render :text => out_string, :content_type => "text/xml"
- end
-
- def listSearchGroup
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- listQueryGroup(doc, "QUERY", params[:distribution], params[:status], params[:lastID], params[:group])
- }
- }
- render :text => out_string, :content_type => "text/xml"
- end
-
- def listSearchProject
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- listQueryProject(doc, "QUERY", params[:distribution], params[:status], params[:lastID], params[:project])
- }
- }
- render :text => out_string, :content_type => "text/xml"
- end
-
- def listSearchDate
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- listQuery(doc, "QUERY", params[:distribution], params[:status], params[:lastID], "", params[:date])
- }
- }
- render :text => out_string, :content_type => "text/xml"
- end
-
- def updateList
- condition = params[:Condition]
- param = params[:Param]
- distribution = params[:Distribution]
- status = params[:Status]
- latest_id = params[:LatestId]
- working_job_list = params[:WorkingJobId]
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- #new job list
- case condition
- when "all"
- listQuery(doc, "UPDATE", distribution, status, latest_id, "", "")
- when "user"
- listQuery(doc, "UPDATE", distribution, status, latest_id, param, "")
- when "group"
- listQueryGroup(doc, "UPDATE", distribution, status, latest_id, param)
- when "project"
- listQueryProject(doc, "UPDATE", distribution, status, latest_id, param)
- when "date"
- listQuery(doc, "UPDATE", distribution, status, latest_id, "", param)
- else
- end
-
- # working job list for update
- doc.WorkingJobList {
- if not working_job_list.nil?
- working_job_list.each do |job_id|
- job = get_job_info(job_id)
- doc.Job {
- doc.Id(job.job_id)
- doc.Distribution(job.distribution_name)
- doc.ProjectName(job.project_name)
- doc.JobType(job.job_type)
- doc.JobAttribute(job.job_attribute)
- doc.ParentJobId(job.parent_job_id)
- doc.Os(job.supported_os_name)
- doc.Status(job.status)
- doc.UserName(job.user_name)
- doc.StartTime(job.start_time)
- doc.EndTime(job.end_time)
- doc.ErrorCode(job.error_code)
-
- project_list = get_child_job_project_name(job.job_id)
- doc.ProjectList(project_list)
- }
- generate_xml_sub_jobs(doc,job.job_id)
- end
- end
- }
- }
- }
-
- render :text => out_string, :content_type => "text/xml"
-
- end
-
- def listQuery(doc, query_type, distribution, status, last_id, user, date)
- condition = ""
-
- if(distribution == "ALL")
- distribution = "%"
- end
-
- if(status == "ALL")
- status = "'FINISHED', 'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'"
- elsif(status == "SUCCESS")
- status = "'FINISHED'"
- elsif(status == "WORKING")
- status = "'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'"
- elsif(status == "ERROR")
- status = "'ERROR', 'CANCELED'"
- end
-
- if(query_type == "QUERY")
- if(last_id == "LATEST")
- last_job_id = Job.maximum(:id)
- if last_job_id.nil?
- last_job_id = 0
- end
- else
- last_job_id = last_id.to_i - 1
- end
- condition = "jobs.id <= #{last_job_id}"
- else
- condition = "jobs.id > #{last_id}"
- end
-
- user = user + "%"
-
- date = date + "%"
-
- jobs = Job.find_by_sql("SELECT jobs.id
- , CASE WHEN jobs.jtype like 'MULTI%' THEN 'MULTI'
- ELSE 'SINGLE' END AS job_attribute
- FROM jobs
- LEFT JOIN projects
- ON jobs.project_id = projects.id
- LEFT JOIN users
- ON jobs.user_id = users.id
- LEFT JOIN supported_os
- ON jobs.supported_os_id = supported_os.id
- LEFT JOIN distributions
- ON jobs.distribution_id = distributions.id
- LEFT JOIN remote_build_servers
- ON jobs.remote_build_server_id = remote_build_servers.id
- LEFT JOIN sources
- ON jobs.source_id = sources.id
- WHERE #{condition}
- AND jobs.parent_job_id IS NULL
- AND jobs.status in (#{status})
- AND users.name like '#{user}'
- AND distributions.name like '#{distribution}'
- AND DATE(jobs.start_time) like '#{date}'
- ORDER BY jobs.id DESC
- LIMIT #{QUERY_CNT}")
-
- #generate to XML
- doc.JobList {
- jobs.each {|job_list|
- job = get_job_info(job_list.id)
- doc.Job {
- doc.Id(job.job_id)
- doc.Distribution(job.distribution_name)
- doc.ProjectName(job.project_name)
- doc.JobType(job.job_type)
- doc.JobAttribute(job_list.job_attribute)
- doc.ParentJobId(job.parent_job_id)
- doc.Os(job.supported_os_name)
- doc.Status(job.status)
- doc.UserName(job.user_name)
- doc.StartTime(job.start_time)
- doc.EndTime(job.end_time)
- doc.ErrorCode(job.error_code)
-
- project_list = get_child_job_project_name(job.job_id)
- doc.ProjectList(project_list)
- }
- generate_xml_sub_jobs(doc,job.job_id)
- }
- }
- end
-
- def listQueryGroup(doc, query_type, distribution, status, last_id, group)
-
- if(distribution == "ALL")
- distribution = "%"
- end
-
- if(status == "ALL")
- status = "'FINISHED', 'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'"
- elsif(status == "SUCCESS")
- status = "'FINISHED'"
- elsif(status == "WORKING")
- status = "'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'"
- elsif(status == "ERROR")
- status = "'ERROR', 'CANCELED'"
- end
-
- if(query_type == "QUERY")
- if(last_id == "LATEST")
- last_job_id = Job.maximum(:id)
- if last_job_id.nil?
- last_job_id = 0
- end
- else
- last_job_id = last_id.to_i - 1
- end
- condition = "jobs.id <= #{last_job_id}"
- else
- condition = "jobs.id > #{last_id}"
- end
-
- group = group + "%"
-
- jobs = Job.find_by_sql("SELECT jobs.id
- , CASE WHEN jobs.jtype like 'MULTI%' THEN 'MULTI'
- ELSE 'SINGLE' END AS job_attribute
- FROM jobs
- LEFT JOIN distributions ON jobs.distribution_id = distributions.id
- WHERE #{condition}
- AND jobs.parent_job_id IS NULL
- AND distributions.name like '#{distribution}'
- AND jobs.status in (#{status})
- AND jobs.user_id IN (SELECT users.id
- FROM users
- LEFT JOIN user_groups ON user_groups.user_id = users.id
- LEFT JOIN groups ON groups.id = user_groups.group_id
- WHERE groups.name LIKE '#{group}')
- ORDER BY jobs.id DESC
- LIMIT #{QUERY_CNT}")
-
- #generate to XML
- doc.Data {
- doc.JobList {
- jobs.each {|job_list|
- job = get_job_info(job_list.id)
-
- doc.Job {
- doc.Id(job.job_id)
- doc.Distribution(job.distribution_name)
- doc.ProjectName(job.project_name)
- doc.JobType(job.job_type)
- doc.JobAttribute(job_list.job_attribute)
- doc.ParentJobId(job.parent_job_id)
- doc.Os(job.supported_os_name)
- doc.Status(job.status)
- doc.UserName(job.user_name)
- doc.StartTime(job.start_time)
- doc.EndTime(job.end_time)
- doc.ErrorCode(job.error_code)
-
- project_list = get_child_job_project_name(job.job_id)
- doc.ProjectList(project_list)
- }
- generate_xml_sub_jobs(doc,job.job_id)
- }
- }
- }
- end
-
- def listQueryProject(doc, query_type, distribution, status, last_id, project)
- if(distribution == "ALL")
- distribution = "%"
- else
- distribution = distribution + "%"
- end
-
- if(status == "ALL")
- status = "'FINISHED', 'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'"
- elsif(status == "SUCCESS")
- status = "'FINISHED'"
- elsif(status == "WORKING")
- status = "'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'"
- elsif(status == "ERROR")
- status = "'ERROR', 'CANCELED'"
- end
-
- if(query_type == "QUERY")
- if(last_id == "LATEST")
- last_job_id = Job.maximum(:id)
- if last_job_id.nil?
- last_job_id = 0
- end
- else
- last_job_id = last_id.to_i - 1
- end
- condition = "jobs.id <= #{last_job_id}"
- else
- condition = "jobs.id > #{last_id}"
- end
-
- project = project
-
- jobs = Job.find_by_sql("SELECT jobs.id
- , CASE WHEN jobs.jtype like \"MULTI%\" THEN \"MULTI\"
- ELSE \"SINGLE\" END \"job_attribute\"
- FROM jobs
- LEFT JOIN projects
- ON jobs.project_id = projects.id
- LEFT JOIN users
- ON jobs.user_id = users.id
- LEFT JOIN supported_os
- ON jobs.supported_os_id = supported_os.id
- LEFT JOIN distributions
- ON jobs.distribution_id = distributions.id
- LEFT JOIN remote_build_servers
- ON jobs.remote_build_server_id = remote_build_servers.id
- LEFT JOIN sources
- ON jobs.source_id = sources.id
- WHERE #{condition}
- AND jobs.status IN (#{status})
- AND projects.name like '#{project}'
- AND distributions.name like '#{distribution}'
- ORDER BY jobs.id DESC
- LIMIT #{QUERY_CNT}")
-
- #generate to XML
- doc.Data {
- doc.JobList {
- jobs.each {|job_list|
- job = get_job_info(job_list.id)
-
- doc.Job {
- doc.Id(job.job_id)
- doc.Distribution(job.distribution_name)
- doc.ProjectName(job.project_name)
- doc.JobType(job.job_type)
- doc.JobAttribute(job_list.job_attribute)
- doc.ParentJobId(job.parent_job_id)
- doc.Os(job.supported_os_name)
- doc.Status(job.status)
- doc.UserName(job.user_name)
- doc.StartTime(job.start_time)
- doc.EndTime(job.end_time)
- doc.ErrorCode(job.error_code)
-
- project_list = get_child_job_project_name(job.job_id)
- doc.ProjectList(project_list)
- }
- }
- }
- }
- end
-
- def get_job_info(job_id)
- jobs = Job.find_by_sql("SELECT jobs.id AS job_id
- , jobs.jtype AS job_type
- , jobs.status AS status
- , jobs.parent_job_id AS parent_job_id
- , jobs.error_code AS error_code
- , DATE_FORMAT(jobs.start_time, '%Y-%m-%d %H:%i:%s') AS start_time
- , DATE_FORMAT(jobs.end_time, '%Y-%m-%d %H:%i:%s') AS end_time
- , CASE WHEN jobs.jtype like \"MULTI%\" THEN \"MULTI\"
- ELSE \"SINGLE\" END \"job_attribute\"
- , projects.name AS project_name
- , projects.ptype AS project_type
- , users.name AS user_name
- , users.email AS user_email
- , supported_os.name AS supported_os_name
- , distributions.name AS distribution_name
- , distributions.pkgsvr_url AS pkgsvr_url
- , distributions.pkgsvr_addr AS pkgsvr_addr
- , distributions.description AS distribution_desc
- , remote_build_servers.svr_addr AS remote_build_server_addr
- , remote_build_servers.description AS remote_build_server_desc
- , sources.pkg_ver AS pkg_ver
- , sources.location AS location
- FROM jobs
- LEFT JOIN projects
- ON jobs.project_id = projects.id
- LEFT JOIN users
- ON jobs.user_id = users.id
- LEFT JOIN supported_os
- ON jobs.supported_os_id = supported_os.id
- LEFT JOIN distributions
- ON jobs.distribution_id = distributions.id
- LEFT JOIN remote_build_servers
- ON jobs.remote_build_server_id = remote_build_servers.id
- LEFT JOIN sources
- ON jobs.source_id = sources.id
- WHERE jobs.id = #{job_id}")
- return jobs[0]
- end
-
- def get_child_job_info(parent_job_id)
- job = Job.find_by_sql("SELECT jobs.id AS job_id
- , jobs.jtype AS job_type
- , jobs.status AS status
- , jobs.parent_job_id AS parent_job_id
- , jobs.error_code AS error_code
- , DATE_FORMAT(jobs.start_time, '%Y-%m-%d %H:%i:%s') AS start_time
- , DATE_FORMAT(jobs.end_time, '%Y-%m-%d %H:%i:%s') AS end_time
- , projects.name AS project_name
- , projects.ptype AS project_type
- , users.name AS user_name
- , users.email AS user_email
- , supported_os.name AS supported_os_name
- , distributions.name AS distribution_name
- , distributions.pkgsvr_url AS pkgsvr_url
- , distributions.pkgsvr_addr AS pkgsvr_addr
- , distributions.description AS distribution_desc
- , remote_build_servers.svr_addr AS remote_build_server_addr
- , remote_build_servers.description AS remote_build_server_desc
- , sources.pkg_ver AS pkg_ver
- , sources.location AS location
- FROM jobs
- LEFT JOIN projects
- ON jobs.project_id = projects.id
- LEFT JOIN users
- ON jobs.user_id = users.id
- LEFT JOIN supported_os
- ON jobs.supported_os_id = supported_os.id
- LEFT JOIN distributions
- ON jobs.distribution_id = distributions.id
- LEFT JOIN remote_build_servers
- ON jobs.remote_build_server_id = remote_build_servers.id
- LEFT JOIN sources
- ON jobs.source_id = sources.id
- WHERE jobs.parent_job_id = #{parent_job_id}")
- return job
- end
-
- def get_child_job_project_name(parent_job_id)
- project_list = nil
- job = Job.find_by_sql("SELECT DISTINCT projects.name AS project_name
- FROM jobs
- LEFT JOIN projects
- ON jobs.project_id = projects.id
- WHERE jobs.parent_job_id = #{parent_job_id}
- ORDER BY projects.name")
- job.each do |job|
- if project_list.nil? then
- project_list = job.project_name
- else
- project_list = project_list + ', ' + job.project_name
- end
- end
- return project_list
- end
-
- def get_sub_job_count(job_id)
- return Job.where(:parent_job_id => job_id).count
- end
-
- def generate_xml_sub_jobs(doc, job_id)
- sub_job_cnt = get_sub_job_count(job_id)
- if sub_job_cnt > 0
- child_jobs = get_child_job_info(job_id)
- child_jobs.each {|job|
- doc.Job {
- doc.Id(job.job_id)
- doc.Distribution(job.distribution_name)
- doc.ProjectName(job.project_name)
- doc.JobType(job.job_type)
- doc.JobAttribute("CHILD")
- doc.ParentJobId(job.parent_job_id)
- doc.Os(job.supported_os_name)
- doc.Status(job.status)
- doc.UserName(job.user_name)
- doc.StartTime(job.start_time)
- doc.EndTime(job.end_time)
- doc.ErrorCode(job.error_code)
-
- project_list = get_child_job_project_name(job.job_id)
- doc.ProjectList(project_list)
- }
- generate_xml_sub_jobs(doc,job.job_id)
- }
- end
- end
-
- def log_more
- line_cnt = 999
- conti= 1
- id = params[:id]
- puts id
- line = params[:line].to_i
-
- # Get job information
- job = get_job_info(id)
- if job.nil?
- render :text => "Not found Job ID #{id}", :status => 406
- end
-
- if job.job_type == "MULTIBUILD"
- project_name = job.job_type
- else
- project_name = job.project_name
- end
-
- # Get log file infomation
- server_id = Server_config.find(:first, :conditions => ["property = \"id\""])
- svr_dir = File.join(Utils::DIBS_WEB_CONFIG_PATH, server_id.value)
- log_dir = File.join(svr_dir, "log")
- path = File.join(log_dir, "#{id}.log")
-
- time = Time.new
- timestamp = time.getlocal
-
- #check svr dir
- if not File.exist?(svr_dir) then
- render :text => "[#{svr_dir}] does not exist. please mail to server administrator", :status => 406
- return
- end
-
- #check log dir
- if not File.exist?(log_dir) then
- FileUtils.mkdir_p(log_dir)
- end
-
- #check file exist
- if not File.exist?(path) then
- #if file does not exist then execute query-log command
- Utils.sbi_query_log_command(id, path)
- sleep(1)
- conti = 1
- else
- start_line = line
- last_line = start_line + line_cnt
-
- #count line
- tok = nil
- IO.popen("wc -l #{path}") do |wc|
- tok = wc.read.split(" ")
- end
- end_line = tok[0].to_i
-
- #check line
- if last_line > end_line
- last_line = end_line
- end
-
- #read log file
- log_contents = nil
- if start_line <= end_line
- IO.popen("sed -n \"#{start_line},#{last_line}p\" #{path}") do |sed|
- log_contents = sed.read
- if log_contents.include? "=LOG_END" then
- conti = 0
- end
- end
- end
- end
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Responser {
- generate_xml_header(doc)
- doc.Data {
- doc.JobId(id)
- doc.Distribution(job.distribution_name)
- doc.Project(project_name)
- doc.Builder(job.user_name)
- doc.Status(job.status)
- doc.Time(timestamp)
- doc.Continue(conti)
- if log_contents
- log_contents.each do |data|
- doc.LogData(data, "Line" => line)
- line = line + 1
- end
- end
- }
- }
-
- render :text => out_string, :content_type => "text/xml"
- end
-
- def cancelJob
- id = params[:id]
-
- # get job information
- job = get_job_info(id)
- if job.nil?
- render :text => "Not found Job ID #{id}", :status => 406
- return
- end
-
- # Check job builder
- if get_user_email != job.user_email
- if not is_admin(get_user_email)
- render :text => "You don't have authority to cancel.", :status => 406
- return
- end
- end
-
- # Excute command
- message = ""
- begin
- result, message = Utils.sbi_cancel_command(id, get_user_email, get_user_password)
- rescue => e
- render :text => e.message, :status => 406
- end
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Responser {
- generate_xml_header(doc)
- doc.Data {
- doc.JobId(id)
- doc.Distribution(job.distribution_name)
- doc.Project(job.project_name)
- doc.Builder(job.user_name)
- doc.Status(job.status)
- doc.Message(message)
- }
- }
-
- render :text => out_string, :content_type => "text/xml"
- end
-end
+++ /dev/null
-=begin
- projects_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'json'
-
-class ProjectsController < ApplicationController
-
- layout :myLayout
- before_filter :check_login_status
- respond_to :json
-
- def myLayout
- params[:action] == 'fileUpload' ? nil : 'application'
- end
-
-
- def buildProject
- # get information : dist_name, project_hash, password
- change_group_list = params[:ChangeInfoList]
-
- distribution_list = []
- project_list = []
- os_list = []
-
- dist_name = nil
-
- if change_group_list.nil? or change_group_list.empty?
- errmsg = "Build project is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- change_group_list.each do |change_item|
- project_id = change_item[:projectId]
- os_id = change_item[:osId]
-
- project = Project.find(:first, :conditions => ["id = ?", project_id])
- if project_list.nil?
- errmsg = "Can't find project information: [#{project_id}]"
- render :json => { :error => errmsg }, :status => 406
- return
- end
- os = SupportedOs.find(:first, :conditions => ["id = ?", os_id])
- if os.nil?
- errmsg = "Can't find os information: [#{os_id}]"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- distribution_list.push project.distribution_id
- project_list.push project.name
- os_list.push os.name
- end
-
- distribution_list.uniq!
- project_list.uniq!
- os_list.uniq!
-
- if(distribution_list.length > 1)
- errmsg = "Can't build multiple distribution"
- render :json => { :error => errmsg }, :status => 406
- return
- end
- distribution = Distribution.find(:first, :conditions => ["id = ?", distribution_list[0]])
-
- # execute build command
- begin
- result, job_id, msg = Utils.sbi_build_command(distribution.name, project_list, os_list, get_user_email, get_user_password)
- if result then
- render :json => { :result => "SUCCESS", :job_id => job_id }
- else
- render :json => { :result => "ERROR", :message => msg }
- end
- rescue => e
- render :text => e.message, :status => 406
- end
-
- end
-
- def queryPackageInfo(project_id, os_id)
-
- source = Project.find_by_sql("SELECT sources.pkg_ver AS pkg_ver
- , DATE_FORMAT(jobs.start_time, '%Y-%m-%d %H:%i:%s') AS start_time
- , DATE_FORMAT(jobs.end_time, '%Y-%m-%d %H:%i:%s') AS end_time
- , jobs.source_id AS source_id
- , jobs.supported_os_id AS supported_os_id
- , users.name AS user_name
- , users.email AS user_email
- FROM projects
- , sources
- , jobs
- , users
- WHERE projects.id = sources.project_id
- AND jobs.source_id = sources.id
- AND jobs.user_id = users.id
- AND projects.id = #{project_id}
- AND jobs.supported_os_id = #{os_id}
- ORDER BY jobs.id DESC")
-
-
- if source.nil?
- return nil
- else
- return source[0]
- end
- end
-
- def checkUserAccessProject(user_id, project_id)
- row = Project.find_by_sql("SELECT COUNT(*) AS cnt
- FROM user_groups
- , groups
- , group_project_accesses
- WHERE user_groups.group_id = groups.id
- AND groups.id = group_project_accesses.group_id
- AND user_groups.user_id = #{user_id}
- AND group_project_accesses.project_id = #{project_id}")
- if row[0].cnt > 0
- return TRUE
- end
-
- return FALSE
- end
-
- def queryProjectsInfoInDistribution
- dist_id = params[:distId]
- if dist_id.nil?
- errmsg = "Distribution id is null"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- user_id = get_user_id
- projects = Project.find_by_sql("SELECT projects.name AS project_name
- , projects.ptype AS project_type
- , projects.id AS project_id
- , users.email AS maintainer
- , project_gits.git_repos AS git_repos
- , project_gits.git_branch AS git_branch
- FROM projects
- LEFT JOIN users
- ON users.id = projects.user_id
- LEFT JOIN project_gits
- ON projects.id = project_gits.project_id
- WHERE projects.distribution_id = #{dist_id}
- ORDER BY projects.name")
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- doc.ProjectList {
- projects.each { |project|
- doc.Project {
- doc.Id(project.project_id)
- doc.Name(project.project_name)
- doc.Type(project.project_type)
- doc.Maintainer(project.maintainer)
-
- if project.project_type.eql? "GIT" then
- doc.GitAddress(project.git_repos)
- doc.GitBranch(project.git_branch)
- end
-
- if checkUserAccessProject(user_id, project.project_id)
- doc.GroupAccess("TRUE")
- else
- doc.GroupAccess("FALSE")
- end
-
- os_list = ProjectOs.find(:all, :conditions => ["project_id = ?", project.project_id], :order => "supported_os_id")
- os_list.each { |os|
- doc.ProjectOs {
- os_info = SupportedOs.find(:first, :conditions => ["id = ?", os.supported_os_id])
- doc.OsName(os_info.name)
-
- source = queryPackageInfo(project.project_id, os.supported_os_id)
- if source.nil?
- doc.Package {
- doc.PackageName()
- doc.PackageVersion()
- doc.StartTime()
- doc.EndTime()
- doc.UserName()
- doc.UserEmail()
- }
- else
- packageList = Package.find(:all, :conditions => ["source_id = ? AND supported_os_id = ?", source.source_id, source.supported_os_id])
-
-
- packageList.each { |package|
- doc.Package {
- doc.PackageName(package.pkg_name)
- doc.PackageVersion(source.pkg_ver)
- doc.StartTime(source.start_time)
- doc.EndTime(source.end_time)
- doc.UserName(source.user_name)
- doc.UserEmail(source.user_email)
- }
- }
- end
- }
- }
- }
- }
- }
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryRunningProjectsInfoInDistribution
- dist_name = params[:distribution]
-
- running_project_list = Project.find_by_sql("SELECT projects.name
- , projects.ptype
- , jobs.status
- , supported_os.name AS os_name
- FROM jobs
- , projects
- , supported_os
- , distributions
- WHERE jobs.project_id = projects.id
- AND distributions.name = \"#{dist_name}\"
- AND projects.distribution_id = distributions.id
- AND NOT jobs.status in ('FINISHED', 'ERROR', 'CANCELED')
- AND supported_os.id = jobs.supported_os_id
- ORDER BY jobs.id")
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- if not running_project_list.nil?
- running_project_list.each do |run_project|
- doc.RunProjectInfo {
- doc.ProjectName(run_project.name)
- doc.ProjectOs(run_project.os_name)
- doc.ProjectType(run_project.ptype)
- doc.Status(run_project.status)
- }
- end
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryJobStatus(project_id, supportes_os_id)
- job = Job.find(:first, :conditions => ["status NOT IN ('FINISHED', 'ERROR') AND project_id = ? AND supported_os_id = ?", project_id, supported_os_id, ], :order => "id DESC")
- if job.nil?
- status = job.status
- else
- status = nil
- end
- return status
- end
-
- def queryProjectsInDistribution
- dist_id = params[:distId]
- if dist_id.nil?
- render :text => "Distribution id is empty", :content_type => "text/xml", :status => 406
- return
- end
-
- distribution = Distribution.find(:first, :conditions => ["id = ?", dist_id])
- if distribution.nil?
- render :text => "Can't find distribution information: #{dist_id}", :content_type => "text/xml", :status => 406
- return
- end
-
- projects = Project.find(:all, :conditions => ["distribution_id = ?", distribution.id], :order => "name")
- osList = SupportedOs.find(:all)
-
- user_id = get_user_id
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
- doc.Data {
- doc.BuildServerInfo {
- osList.each do |os|
- doc.SupportedOs{
- doc.Id(os.id)
- doc.Name(os.name)
- }
- end
- doc.DistributionStatus(distribution.status)
- }
-
- projects.each do |project|
- if project.ptype.eql? "BINARY"
- bin = ProjectBin.find(:first, :conditions => ["project_id = ?", project.id])
- if checkUserAccessProject(user_id, project.id)
- doc.BinaryProject {
- doc.Id(project.id)
- doc.Name(project.name)
- doc.Status(project.status)
- if not bin.nil? then
- doc.PackageName(bin.pkg_name)
- end
- }
- else
- doc.OtherBinaryProject {
- doc.Id(project.id)
- doc.Name(project.name)
- doc.Status(project.status)
- if not bin.nil? then
- doc.PackageName(bin.pkg_name)
- end
- }
- end
- else
- buildOsIdList = []
- projectOsList = ProjectOs.find(:all, :conditions => ["project_id = ?", project.id])
- projectOsList.each do |projectOs|
- buildOsIdList.push(projectOs.supported_os_id)
- end
-
- if checkUserAccessProject(user_id, project.id)
- doc.Project {
- doc.Id(project.id)
- doc.Name(project.name)
- doc.Status(project.status)
- doc.OsList(buildOsIdList.join(","))
- }
- else
- doc.OtherProject {
- doc.Id(project.id)
- doc.Name(project.name)
- doc.Status(project.status)
- doc.OsList(buildOsIdList.join(","))
- }
- end
- end
-
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
-
- end
-
- def queryDistribution
- # get full distribution list
- distribution_list = Distribution.find(:all, :conditions => ["status = 'OPEN'"])
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- distribution_list.each do |distribution|
- doc.Distribution {
- doc.Id(distribution.id)
- doc.Name(distribution.name)
- }
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryAllDistribution
- # get full distribution list
- distribution_list = Distribution.find(:all)
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- distribution_list.each do |distribution|
- doc.Distribution {
- doc.Id(distribution.id)
- doc.Name(distribution.name)
- }
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def queryAllProjectInOpenStatus
- project_list = Project.find_by_sql("SELECT projects.name AS project_name
- , projects.id AS project_id
- , distributions.id AS distribution_id
- , distributions.name AS distribution_name
- FROM projects
- , distributions
- WHERE distributions.id = projects.distribution_id
- AND distributions.status = 'OPEN'
- ORDER BY projects.name")
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- project_list.each do |project|
- doc.Project{
- doc.Id(project.project_id)
- doc.Name(project.project_name)
- doc.DistId(project.distribution_id)
- doc.DistName(project.distribution_name)
- }
- end
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def projects
- end
-
- def fileUpload
-
- end
-
- def binaryFileUpload
- project_id = params[:ProjectId]
- uploaded_io = params[:file]
-
- file_path = Rails.root.join('public', 'data', uploaded_io.original_filename)
- File.open(file_path, 'wb') do |file|
- file.write(uploaded_io.read)
- end
-
- project = Project.find(:first, :conditions => ["id = ?", project_id])
- distribution = Distribution.find(:first, :conditions => ["id = ?", project.distribution_id])
- if project.nil?
- render :text => "Can't find project information: [#{project_id}]", :content_type => "text/xml"
- return
- end
-
- begin
- Utils.sbi_register_command(distribution.name, file_path, get_user_email, get_user_password)
- rescue => e
- render :text => e.message, :status => 406
- return
- end
-
- render :nothing => true
- return
-
- render :text => uploaded_io.original_filename + " is uploaded.",
- :content_type => "text/xml"
- end
-
-end
+++ /dev/null
-=begin
- sessions_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class SessionsController < ApplicationController
- def new
- end
-
- def login
- input_list = params[:ChangeInfoList]
- input_item = input_list[0]
-
- create_session(input_item[:Email], input_item[:Password])
- end
-
- def create_session(email, password)
- user = User.authenticate(email, password)
-
- if user
- group_list = get_group_list(user.email)
- if is_admin(user.email)
- admin = "TRUE"
- else
- admin = "FALSE"
- end
-
- session[:user_email] = user.email
- user_info = { :Message => 'Welcome!',
- :Eamil => user.email,
- :Name => user.name,
- :Admin => admin,
- }
- group_info = nil
- group_list.map { |group|
- group_info = {:Group => [:GroupName => group.name,
- :GroupAdmin => group.admin,
- :GroupDescription => group.description] }
- }
-
- render :json => { :Result => 'SUCCESS', :UserInfo => user_info, :GroupInfo => group_info}
- puts user_info
- else
- render :json => { :Result => 'ERROR', :UserInfo => {:Message => 'Fail login'} }
- end
- return
- end
-
- def logout
- session[:user_email] = nil
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
-
- doc.LogOutInfo {
- doc.Message("Welcome...")
- doc.LogInTime("")
- doc.LogOutTime("")
- }
-
- render :text => out_string,
- :content_type => "text/xml"
- end
-
- def create
- user = User.authenticate(params[:email], params[:password])
-
- #generate to XML
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
-
- if user
- session[:user_email] = user.email
- redirect_to "/projects"
- else
- flash.now.alert = "Invalid email or password"
- render "new"
- end
- end
-
- def destroy
- session[:user_email] = nil
- redirect_to root_url, :notice => "Logged out!"
- end
-end
+++ /dev/null
-=begin
- users_controller.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class UsersController < ApplicationController
-
- def new
- @user = User.new(params[:user])
- end
-
- def create
- @user = User.new(params[:user])
-
- if @user.save
- redirect_to "/projects", :notice => "Signed up!"
- else
- render :action => "new"
- end
- end
-
- def signup
- change_list = params[:ChangeInfoList]
- change_item = change_list[0]
-
- @user = User.new()
- @user.email = change_item[:Email]
- @user.name = change_item[:Name]
- @user.password = change_item[:Password]
- @user.password_confirmation = change_item[:PasswordConfirm]
-
- if not User.find_by_email(@user.email).nil? then
- render :json => { :error => "Already exist email account."}, :status => 406
- return
- end
-
- if @user.save
- create_session(@user.email, @user.password)
- else
- render :json => { :error => "Error"}, :status => 406
- end
-
- end
-
- def create_session(email, password)
- user = User.authenticate(email, password)
-
- if user
- group_list = get_group_list(user.email)
- if is_admin(user.email)
- admin = "TRUE"
- else
- admin = "FALSE"
- end
-
- session[:user_email] = user.email
- user_info = { :Message => 'Welcome!',
- :Eamil => user.email,
- :Name => user.name,
- :Admin => admin,
- }
- group_info = nil
- group_list.map { |group|
- group_info = {:Group => [:GroupName => group.name,
- :GroupAdmin => group.admin,
- :GroupDescription => group.description] }
- }
-
- render :json => { :Result => 'SUCCESS', :UserInfo => user_info, :GroupInfo => group_info}
- puts user_info
- else
- render :json => { :Result => 'ERROR', :UserInfo => {:Message => 'Fail login'} }
- end
- return
- end
-
- def show
- email = get_user_email
- user = User.find(:first, :conditions => ["email = ?", email])
-
- doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Response {
- generate_xml_header(doc)
-
- doc.Data {
- doc.User {
- doc.Name(user.name)
- doc.Email(user.email)
- doc.GroupList {
- group_list = get_group_list(user.email)
- group_list.each { |group|
- doc.GroupName(group.name)
- }
- }
- }
- }
- }
-
- #send_data
- render :text => out_string, :content_type => "text/xml"
- end
-
- def modify
- change_list = params[:ChangeInfoList]
- change_item = change_list[0]
- errmsg = ""
-
- email = change_item[:Email]
- name = change_item[:Name]
- password = change_item[:Password]
- password_confirm = change_item[:PasswordConfirm]
-
- if email != get_user_email
- errmsg = "Can't modify email"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- if email.nil? or email.empty?
- errmsg = "Email is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- if name.nil? or name.empty?
- errmsg = "Name is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- if password.nil? or password.empty?
- errmsg = "Password is empty"
- render :json => { :error => errmsg }, :status => 406
- return
- end
-
- if password != password_confirm
- errmsg = "Password is different"
- render :json => { :error => errmsg }, :status => 406
- return
- end
- user = User.find(:first, :conditions => ["email = ?", email])
- user.name = name
- user.password = password
- user.password_confirmation = password_confirm
- user.save
-
- if errmsg.empty?
- render :json => { :success => "OK!" }
- else
- render :json => { :error => errmsg }, :status => 406
- end
- end
-end
+++ /dev/null
-=begin
- utils.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-# constant
-BUILD_SERVER_ADDRESS = "127.0.0.1"
-DIBS_PATH = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
-
-class Utils < ApplicationController
- def Utils.sbi_build_command(distribution, project_list, os_list, email, password)
- job_id = nil
- dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
- if dibs_config.nil?
- raise RuntimeError, "Can't find server port information"
- else
- dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
- end
-
- options = "-d #{dibs_address} --async -U #{email} -w \'#{password}\'"
- options = options + " -N #{project_list.join(",")} -D #{distribution} "
- if (os_list.length > 1) or (not os_list[0].nil?)
- options = options + " -o #{os_list.join(",")} "
- end
-
- cmd = "#{DIBS_PATH}/build-cli build #{options}"
-puts "Build command"
-puts "[[[#{cmd}]]]"
-
- result, msg = execute_shell_return(cmd)
- msg.each { |line|
- if line =~ /Info: Added new job "([0-9][0-9]*)" for.*/ then
- job_id = $1
- end
- }
- return result, job_id, msg
- end
-
- def Utils.sbi_register_command(distribution, file_path, email, password)
- dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
- if dibs_config.nil?
- raise RuntimeError, "Can't find server port information"
- else
- dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
- end
-
- options = "-P #{file_path} -d #{dibs_address} -D #{distribution} --async -U #{email} -w \'#{password}\' "
-
- cmd = "#{DIBS_PATH}/build-cli register #{options}"
-puts "Register command"
-puts "[[[#{cmd}]]]"
- return execute_shell_return(cmd)
- end
-
- def Utils.sbi_cancel_command(job_id, email, password)
- dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
- if dibs_config.nil?
- raise RuntimeError, "Can't find server port information"
- else
- dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
- end
-
- if job_id.nil?
- raise RuntimeError, "Invalid job id : #{job_id}"
- end
-
- options = "-d #{dibs_address} -j #{job_id} -U #{email} -w \'#{password}\' "
-
- cmd = "#{DIBS_PATH}/build-cli cancel #{options}"
-puts "Cancel command"
-puts "[[[#{cmd}]]]"
- result, msg = execute_shell_return(cmd)
- return result, msg
- end
-
- def Utils.sbi_fullbuild_command(server_name, dist_name)
- options = "-n #{server_name} --dist #{dist_name} "
- cmd = "#{DIBS_PATH}/build-svr fullbuild #{options}"
- cmd = "which ruby"
-puts "Fullbuild command"
-puts "[[[#{cmd}]]]"
- return execute_shell_return(cmd)
- end
-
- def Utils.sbi_query_log_command(job_id, path)
- dibs_web_config_path = File.join(Utils::HOME,".build_tools","web_server")
- dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
- if dibs_config.nil?
- raise RuntimeError, "Can't find server port information"
- else
- dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
- end
-
- if job_id.nil? or path.nil? then
- raise RuntimeError, "Invalid query command id : #{job_id} path : #{path}"
- end
-
- options = "-d #{dibs_address} "
- options = options + " -j #{job_id}"
- options = options + " --output #{path}"
-
- cmd = "#{DIBS_PATH}/build-cli query-log #{options}"
-puts "Query-log command"
-puts "[[[#{cmd}]]]"
-
- Thread.new do
- system(cmd)
- end
-
- return path
- end
-
- def Utils.execute_shell_return(cmd)
- result = false
- result_lines = []
-
- # get result
- IO.popen("#{cmd} 2>&1") do |io|
- io.each do |line|
- result_lines.push line
- end
- end
-
- if $? == 0 then
- result = true
- end
-
- return result, result_lines
- end
-
- # set static variable in WORKING_DIR, HOME
- if defined?(WORKING_DIR).nil? then WORKING_DIR = Dir.pwd end
- if defined?(HOME).nil? then
- # get home directory, using Dir.chdir
- Dir.chdir
- HOME = Dir.pwd
- Dir.chdir WORKING_DIR
- end
- DIBS_WEB_CONFIG_PATH = File.join(HOME,".build_tools","web_server")
-end
+++ /dev/null
-module AdminDistributionHelper
-end
+++ /dev/null
-module AdminGroupHelper
-end
+++ /dev/null
-module AdminHelper
-end
+++ /dev/null
-module AdminProjectHelper
-end
+++ /dev/null
-module AdminServerHelper
-end
+++ /dev/null
-module AdminUserHelper
-end
+++ /dev/null
-module ApplicationHelper
-end
+++ /dev/null
-module JobsHelper
-end
+++ /dev/null
-module ProjectsHelper
- def update_text(name)
- end
-end
+++ /dev/null
-module SessionsHelper
-end
+++ /dev/null
-module UsersHelper
-end
+++ /dev/null
-class Distribution < ActiveRecord::Base
- attr_accessible :id, :name, :pkgsvr_url, :pkgsvr_addr, :status, :description
-end
+++ /dev/null
-class Group < ActiveRecord::Base
-# has_many :user_groups
-# has_many :users, :through => :user_groups
- attr_accessible :name, :id
-end
+++ /dev/null
-class GroupProjectAccess < ActiveRecord::Base
- self.primary_key = 'group_id', 'project_id'
- attr_accessible :group_id, :project_id, :build
-end
+++ /dev/null
-class Job < ActiveRecord::Base
- attr_accessible :distribution_id, :id, :supported_os_id, :project_id, :status, :user_id, :remote_build_server_id, :parent_job_id, :source_id, :jtype, :start_time, :end_time, :error_code
-end
+++ /dev/null
-class JobTimestamp < ActiveRecord::Base
- attr_accessible :id, :job_id, :stamp_name, :stamp_time
-end
+++ /dev/null
-class OsCategory < ActiveRecord::Base
- set_table_name "os_category"
- attr_accessible :id, :name
-end
+++ /dev/null
-class Package < ActiveRecord::Base
- attr_accessible :id, :pkg_name, :source_id, :supported_os_id
-end
+++ /dev/null
-class Project < ActiveRecord::Base
- attr_accessible :id, :distribution_id, :name, :ptype, :status
-end
+++ /dev/null
-class ProjectBin < ActiveRecord::Base
- attr_accessible :project_id, :pkg_name
-end
+++ /dev/null
-class ProjectGit < ActiveRecord::Base
- attr_accessible :project_id, :git_repos, :git_branch
-end
+++ /dev/null
-class ProjectOs < ActiveRecord::Base
- self.primary_key = 'project_id', 'supported_os_id'
- attr_accessible :project_id, :supported_os_id
-end
+++ /dev/null
-class RemoteBuildServer < ActiveRecord::Base
- attr_accessible :id, :svr_addr, :description, :status, :max_job_count, :working_job_count, :waiting_job_count
-end
+++ /dev/null
-class Server_config < ActiveRecord::Base
- attr_accessible :property, :value
-end
+++ /dev/null
-class Source < ActiveRecord::Base
- attr_accessible :id, :location, :pkg_ver, :project_id
-end
+++ /dev/null
-class SupportedOs < ActiveRecord::Base
- attr_accessible :id, :os_category_id, :name
-end
+++ /dev/null
-class SyncPkgServer < ActiveRecord::Base
- attr_accessible :description, :distribution_id, :id, :period, :pkgsvr_url
-end
+++ /dev/null
-class SyncProject < ActiveRecord::Base
- attr_accessible :project_id, :sync_pkg_server_id
-end
+++ /dev/null
-class User < ActiveRecord::Base
-# has_many :user_groups
-# has_many :groups, :through => :user_groups
- attr_accessible :id, :email, :password, :password_confirmation, :password_hash, :name
-
- attr_accessor :password
- before_save :encrypt_password
-
- validates_uniqueness_of :email
- validates_presence_of :email
- validates_confirmation_of :password
- validates_presence_of :password, :on => :create
-
- def self.authenticate(email, password)
- user = find_by_email(email)
- if user && user.password_hash == BCrypt::Engine.hash_secret(password, user.password_salt)
- user
- else
- nil
- end
- end
-
- def encrypt_password
- if password.present?
- self.password_salt = BCrypt::Engine.generate_salt
- self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)
- end
- end
-end
+++ /dev/null
-class UserGroup < ActiveRecord::Base
-# belongs_to :users
-# belongs_to :groups
- self.primary_key = 'group_id'
- self.primary_key = 'user_id'
- attr_accessible :group_id, :status, :user_id
-end
+++ /dev/null
-# This file is used by Rack-based servers to start the application.
-
-require ::File.expand_path('../config/environment', __FILE__)
-run Dibs::Application
+++ /dev/null
-require File.expand_path('../boot', __FILE__)
-
-require 'rails/all'
-
-if defined?(Bundler)
- # If you precompile assets before deploying to production, use this line
- Bundler.require(*Rails.groups(:assets => %w(development test)))
- # If you want your assets lazily compiled in production, use this line
- # Bundler.require(:default, :assets, Rails.env)
-end
-
-module Dibs
- class Application < Rails::Application
- # Settings in config/environments/* take precedence over those specified here.
- # Application configuration should go into files in config/initializers
- # -- all .rb files in that directory are automatically loaded.
-
- # Custom directories with classes and modules you want to be autoloadable.
- # config.autoload_paths += %W(#{config.root}/extras)
-
- # Only load the plugins named here, in the order given (default is alphabetical).
- # :all can be used as a placeholder for all plugins not explicitly named.
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
- # Activate observers that should always be running.
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
-
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
- # config.time_zone = 'Central Time (US & Canada)'
-
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
- # config.i18n.default_locale = :de
-
- # Configure the default encoding used in templates for Ruby 1.9.
- config.encoding = "utf-8"
-
- # Configure sensitive parameters which will be filtered from the log file.
- config.filter_parameters += [:password]
-
- # Enable escaping HTML in JSON.
- config.active_support.escape_html_entities_in_json = true
-
- # Use SQL instead of Active Record's schema dumper when creating the database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
-
- # Enforce whitelist mode for mass assignment.
- # This will create an empty whitelist of attributes available for mass-assignment for all models
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
- # parameters by using an attr_accessible or attr_protected declaration.
- config.active_record.whitelist_attributes = true
-
- # Enable the asset pipeline
- config.assets.enabled = true
-
- # Version of your assets, change this if you want to expire all your assets
- config.assets.version = '1.0'
-
- end
-end
+++ /dev/null
-require 'rubygems'
-
-# Set up gems listed in the Gemfile.
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-
-require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
+++ /dev/null
-# Load the rails application
-require File.expand_path('../application', __FILE__)
-
-# Initialize the rails application
-Dibs::Application.initialize!
-
-Rails.logger = Logger.new(STDOUT)
+++ /dev/null
-Dibs::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
-
- # In the development environment your application's code is reloaded on
- # every request. This slows down response time but is perfect for development
- # since you don't have to restart the web server when you make code changes.
- config.cache_classes = false
-
- # Log error messages when you accidentally call methods on nil.
- config.whiny_nils = true
-
- # Show full error reports and disable caching
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
-
- # Don't care if the mailer can't send
- config.action_mailer.raise_delivery_errors = false
-
- # Print deprecation notices to the Rails logger
- config.active_support.deprecation = :log
-
- # Only use best-standards-support built into browsers
- config.action_dispatch.best_standards_support = :builtin
-
- # Raise exception on mass assignment protection for Active Record models
- config.active_record.mass_assignment_sanitizer = :strict
-
- # Log the query plan for queries taking more than this (works
- # with SQLite, MySQL, and PostgreSQL)
- config.active_record.auto_explain_threshold_in_seconds = 0.5
-
- # Do not compress assets
- config.assets.compress = false
-
- # Expands the lines which load the assets
- config.assets.debug = true
-end
+++ /dev/null
-Dibs::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
-
- # Code is not reloaded between requests
- config.cache_classes = true
-
- # Full error reports are disabled and caching is turned on
- config.consider_all_requests_local = false
- config.action_controller.perform_caching = true
-
- # Disable Rails's static asset server (Apache or nginx will already do this)
- config.serve_static_assets = false
-
- # Compress JavaScripts and CSS
- config.assets.compress = true
-
- # Don't fallback to assets pipeline if a precompiled asset is missed
- config.assets.compile = false
-
- # Generate digests for assets URLs
- config.assets.digest = true
-
- # Defaults to nil and saved in location specified by config.assets.prefix
- # config.assets.manifest = YOUR_PATH
-
- # Specifies the header that your server uses for sending files
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
-
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
- # config.force_ssl = true
-
- # See everything in the log (default is :info)
- # config.log_level = :debug
-
- # Prepend all log lines with the following tags
- # config.log_tags = [ :subdomain, :uuid ]
-
- # Use a different logger for distributed setups
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
-
- # Use a different cache store in production
- # config.cache_store = :mem_cache_store
-
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
- # config.action_controller.asset_host = "http://assets.example.com"
-
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
- # config.assets.precompile += %w( search.js )
-
- # Disable delivery errors, bad email addresses will be ignored
- # config.action_mailer.raise_delivery_errors = false
-
- # Enable threaded mode
- # config.threadsafe!
-
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found)
- config.i18n.fallbacks = true
-
- # Send deprecation notices to registered listeners
- config.active_support.deprecation = :notify
-
- # Log the query plan for queries taking more than this (works
- # with SQLite, MySQL, and PostgreSQL)
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
-end
+++ /dev/null
-Dibs::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
-
- # The test environment is used exclusively to run your application's
- # test suite. You never need to work with it otherwise. Remember that
- # your test database is "scratch space" for the test suite and is wiped
- # and recreated between test runs. Don't rely on the data there!
- config.cache_classes = true
-
- # Configure static asset server for tests with Cache-Control for performance
- config.serve_static_assets = true
- config.static_cache_control = "public, max-age=3600"
-
- # Log error messages when you accidentally call methods on nil
- config.whiny_nils = true
-
- # Show full error reports and disable caching
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
-
- # Raise exceptions instead of rendering exception templates
- config.action_dispatch.show_exceptions = false
-
- # Disable request forgery protection in test environment
- config.action_controller.allow_forgery_protection = false
-
- # Tell Action Mailer not to deliver emails to the real world.
- # The :test delivery method accumulates sent emails in the
- # ActionMailer::Base.deliveries array.
- config.action_mailer.delivery_method = :test
-
- # Raise exception on mass assignment protection for Active Record models
- config.active_record.mass_assignment_sanitizer = :strict
-
- # Print deprecation notices to the stderr
- config.active_support.deprecation = :stderr
-end
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-
-# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
-# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
-
-# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
-# Rails.backtrace_cleaner.remove_silencers!
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-
-# Add new inflection rules using the following format
-# (all these examples are active by default):
-# ActiveSupport::Inflector.inflections do |inflect|
-# inflect.plural /^(ox)$/i, '\1en'
-# inflect.singular /^(ox)en/i, '\1'
-# inflect.irregular 'person', 'people'
-# inflect.uncountable %w( fish sheep )
-# end
-#
-# These inflection rules are supported but not enabled by default:
-# ActiveSupport::Inflector.inflections do |inflect|
-# inflect.acronym 'RESTful'
-# end
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-
-# Add new mime types for use in respond_to blocks:
-# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-
-# Your secret key for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
-Dibs::Application.config.secret_token = '7971db0f7470719db67c53a48ec8906f77b093334897b37d3c7de71298f18d1b4c92d56a8e158884f656ad4620f495abdef4f1a00b10498d8fde21a396c7171a'
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-
-Dibs::Application.config.session_store :cookie_store, :key => '_dibs_session'
-
-# Use the database for sessions instead of the cookie-based default,
-# which shouldn't be used to store highly confidential information
-# (create the session table with "rails generate session_migration")
-# Dibs::Application.config.session_store :active_record_store
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-#
-# This file contains settings for ActionController::ParamsWrapper which
-# is enabled by default.
-
-# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
-ActiveSupport.on_load(:action_controller) do
- wrap_parameters :format => [:json]
-end
-
-# Disable root element in JSON by default.
-ActiveSupport.on_load(:active_record) do
- self.include_root_in_json = false
-end
+++ /dev/null
-# Sample localization file for English. Add more files in this directory for other locales.
-# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
-
-en:
- hello: "Hello world"
+++ /dev/null
-=begin
- routes.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-Dibs::Application.routes.draw do
-
- get "sessions/new" => "sessions#new"
-
- resources :users
-
- get "jobs" => "jobs#list"
-
- get "projects/fileUpload"
-
- get "signup" => "users#new", :as => "signup"
-
- post "login" => "sessions#create"
- get "logout" => "sessions#destroy", :as => "logout"
-
-
- # For asynchronous call
-
- post "users/signup"
- post "users/modify"
-
- post "sessions/login"
- delete "sessions/logout"
-
- get "jobs/list/all/:distribution/:status/:lastID" => "jobs#listAll", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
- get "jobs/list/user/:user/:distribution/:status/:lastID" => "jobs#listSearchUser", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
- get "jobs/list/group/:group/:distribution/:status/:lastID" => "jobs#listSearchGroup", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
- get "jobs/list/project/:project/:distribution/:status/:lastID" => "jobs#listSearchProject" , :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/, :project => /[0-9A-Za-z\-\.]+/ }
- get "jobs/list/date/:date/:distribution/:status/:lastID" => "jobs#listSearchDate", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
-
- match "jobs/update" => "jobs#updateList", :format => "json"
- match "jobs/log/:id/:line" => "jobs#log_more"
- match "jobs/cancel/:id" => "jobs#cancelJob"
-
-
- get "projects/queryDistribution"
- get "projects/queryAllDistribution"
- get "projects/queryAllProjectInOpenStatus"
- post "projects/binaryFileUpload"
-
- # projects
- match "projects/queryProjectsInfoInDistribution/:distId" => "projects#queryProjectsInfoInDistribution"
- match "projects/queryProjectsInDistribution/:distId" => "projects#queryProjectsInDistribution"
- post "projects/buildProject"
-
- # admin group
- get "admin_group/queryAllGroup"
- match "admin_group/queryGroupInfo/:groupId" => "admin_group#queryGroupInfo"
- post "admin_group/addGroup"
- post "admin_group/removeGroup"
- post "admin_group/modifyGroup"
-
- # admin user
- get "admin_user/queryAllUser"
- get "admin_user/queryUserInfo/:user_id" => "admin_user#queryUserInfo"
- post "admin_user/removeUser"
- post "admin_user/modifyUser"
- post "admin_user/resetUser"
-
- # admin server
- get "admin_server/queryAllServer"
- match "admin_server/queryServerConfig/:configId" => "admin_server#queryServerConfig"
- match "admin_server/querySupportedOS/:osId" => "admin_server#querySupportedOS"
- match "admin_server/queryRemoteBuildServer/:serverId" => "admin_server#queryRemoteBuildServer"
- post "admin_server/addRemoteBuildServer"
- post "admin_server/removeRemoteBuildServer"
- post "admin_server/modifyRemoteBuildServer"
- post "admin_server/addOSCategory"
- post "admin_server/removeOSCategory"
- post "admin_server/modifyOSCategory"
- post "admin_server/addSupportedOS"
- post "admin_server/removeSupportedOS"
- post "admin_server/modifySupportedOS"
- post "admin_server/addServerInfo"
- post "admin_server/removeServerInfo"
- post "admin_server/modifyServerInfo"
-
- # admin project
- match "admin_project/queryProjectsInDistributionForAdmin/:distId" => "admin_project#queryProjectsInDistributionForAdmin"
- post "admin_project/addProject"
- post "admin_project/removeProject"
- post "admin_project/modifyProject"
- post "admin_project/changeAllProjectStatus"
-
- # admin distribution
- match "admin_distribution/queryDistributionInfo/:distId" => "admin_distribution#queryDistributionInfo"
- post "admin_distribution/addDistribution"
- post "admin_distribution/removeDistribution"
- post "admin_distribution/modifyDistribution"
-
- get "admin/queryAllOS"
- get "admin/queryAllOSCategory"
-
- # The priority is based upon order of creation:
- # first created -> highest priority.
-
- # Sample of regular route:
- # match 'products/:id' => 'catalog#view'
- # Keep in mind you can assign values other than :controller and :action
-
- # Sample of named route:
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
- # This route can be invoked with purchase_url(:id => product.id)
-
- # Sample resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
-
- # Sample resource route with options:
- # resources :products do
- # member do
- # get 'short'
- # post 'toggle'
- # end
- #
- # collection do
- # get 'sold'
- # end
- # end
-
- # Sample resource route with sub-resources:
- # resources :products do
- # resources :comments, :sales
- # resource :seller
- # end
-
- # Sample resource route with more complex sub-resources
- # resources :products do
- # resources :comments
- # resources :sales do
- # get 'recent', :on => :collection
- # end
- # end
-
- # Sample resource route within a namespace:
- # namespace :admin do
- # # Directs /admin/products/* to Admin::ProductsController
- # # (app/controllers/admin/products_controller.rb)
- # resources :products
- # end
-
- # You can have the root of your site routed with "root"
- # just remember to delete public/index.html.
- # root :to => 'welcome#index'
-
- # See how all your routes lay out with "rake routes"
-
- # This is a legacy wild controller route that's not recommended for RESTful applications.
- # Note: This route will make all actions in every controller accessible via GET requests.
- # match ':controller(/:action(/:id))(.:format)'
-end
+++ /dev/null
-# This file is auto-generated from the current state of the database. Instead
-# of editing this file, please use the migrations feature of Active Record to
-# incrementally modify your database, and then regenerate this schema definition.
-#
-# Note that this schema.rb definition is the authoritative source for your
-# database schema. If you need to create the application database on another
-# system, you should be using db:schema:load, not running all the migrations
-# from scratch. The latter is a flawed and unsustainable approach (the more migrations
-# you'll amass, the slower it'll run and the greater likelihood for issues).
-#
-# It's strongly recommended to check this file into your version control system.
-
-ActiveRecord::Schema.define(:version => 20121024015858) do
-
- create_table "distributions", :force => true do |t|
- t.string "name"
- t.string "pkgsvr_url"
- t.string "pkgsvr_addr"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "group_rights", :force => true do |t|
- t.integer "group_id"
- t.integer "project_id"
- t.string "build"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "groups", :force => true do |t|
- t.string "group_name"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "jobs", :force => true do |t|
- t.string "job_id", :null => false
- t.string "project_name"
- t.string "distribution"
- t.string "job_attribute"
- t.string "os"
- t.string "status"
- t.integer "user_id"
- t.string "parent_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "projects", :force => true do |t|
- t.string "project_name"
- t.string "distribution_name"
- t.string "project_type"
- t.string "os_list"
- t.string "password"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "supported_os", :force => true do |t|
- t.string "name"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "users", :force => true do |t|
- t.string "email"
- t.string "user_name"
- t.string "password_hash"
- t.string "password_salt"
- t.integer "group_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
-end
+++ /dev/null
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
-#
-# Examples:
-#
-# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
-# Mayor.create(:name => 'Emanuel', :city => cities.first)
+++ /dev/null
-Use this README file to introduce your application and point to useful places in the API for learning more.
-Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>dibs</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>json.validation.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.tizen.web.jslint.nature.JSLintBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.tizen.web.css.nature.CSSBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.tizen.web.project.builder.WebBuilder</name>
- <arguments>
- <dictionary>
- <key>usedLibraryType</key>
- <value>jQueryMobile</value>
- </dictionary>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>json.validation.nature</nature>
- <nature>org.tizen.web.jslint.nature.JSLintNature</nature>
- <nature>org.tizen.web.css.nature.CSSNature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
- <nature>org.tizen.web.project.builder.WebNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <title>The page you were looking for doesn't exist (404)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/404.html -->
- <div class="dialog">
- <h1>The page you were looking for doesn't exist.</h1>
- <p>You may have mistyped the address or the page may have moved.</p>
- </div>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <title>The change you wanted was rejected (422)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/422.html -->
- <div class="dialog">
- <h1>The change you wanted was rejected.</h1>
- <p>Maybe you tried to change something you didn't have access to.</p>
- </div>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <title>We're sorry, but something went wrong (500)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/500.html -->
- <div class="dialog">
- <h1>We're sorry, but something went wrong.</h1>
- </div>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://172.21.110.234:3300" version="1.0" viewmodes="fullscreen">
- <tizen:application id="q3tpr9HXDs" required_version="1.0"/>
- <content src="index.html"/>
- <icon src="icon.png"/>
- <name>test</name>
-</widget>
+++ /dev/null
-directory for binary upload
+++ /dev/null
-<!--
- index.html
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="ko">
-<head>
- <title>DIBS 2.0</title>
-
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=9" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
- <meta name="description" content="A master-detail template generated by Tizen Web IDE"/>
-
- <link rel="stylesheet" href="stylesheets/jquery.mobile-1.1.1.min.css"/>
- <link rel="stylesheet" href="stylesheets/jqm-docs.css"/>
- <link rel="stylesheet" href="stylesheets/style.css"/>
-
- <script src="javascripts/jquery-1.7.1.min.js"></script>
- <script src="javascripts/jqm-docs.js"></script>
- <script src="javascripts/jquery.mobile-1.1.1.min.js"></script>
- <script src="javascripts/popup-window.js"></script>
-
- <script src="javascripts/main.js"></script>
- <script src="javascripts/dibs-api.js"></script>
- <script src="javascripts/session.js"></script>
- <script src="javascripts/user.js"></script>
- <script src="javascripts/build.js"></script>
- <script src="javascripts/projects.js"></script>
- <script src="javascripts/jobs.js"></script>
- <script src="javascripts/admin-user.js"></script>
- <script src="javascripts/admin-user-modify.js"></script>
- <script src="javascripts/admin-group.js"></script>
- <script src="javascripts/admin-group-add.js"></script>
- <script src="javascripts/admin-group-modify.js"></script>
- <script src="javascripts/admin-project.js"></script>
- <script src="javascripts/admin-project-add.js"></script>
- <script src="javascripts/admin-project-modify.js"></script>
- <script src="javascripts/admin-distribution.js"></script>
- <script src="javascripts/admin-distribution-add.js"></script>
- <script src="javascripts/admin-distribution-modify.js"></script>
- <script src="javascripts/admin-server.js"></script>
- <script src="javascripts/admin-server-add.js"></script>
- <script src="javascripts/admin-server-modify.js"></script>
- <script src="javascripts/admin-server-remove.js"></script>
-</head>
-
-<body>
- <div data-role="page" id="index" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary">
- <h2>Welcome to DIBS</h2>
- <ul>
- <li>This system is support to build project.
- </ul>
- </div><!--/content-primary -->
-
- <div class="content-secondary">
- <ul data-role="listview" id="index-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="login">
- <div data-role="header" data-theme="e" >
- <h1>Log in</h1>
- </div>
- <div data-role="content">
- <form id="login-form">
- <label for="login-form-email" >Email</label>
- <div style="float: left; width: 80%;">
- <input id="login-form-email" type="email" name="email" autocomplete="on"/>
- </div>
- <div style="float: right;">
- <input id="login-form-save" type="checkbox" name="save" class="custom" data-mini="true" checked/>
- <label for="login-form-save">Save</label>
- </div>
- <div style="clear: both; float: left;">
- <label for="login-form-password">Password</label>
- </div>
- <div style="clear: both;">
- <input id="login-form-password" type="password" name="password"/>
- </div>
- <br/>
- <div data-role="controlgroup" data-type="horizontal" style="float: left;">
- <a href="#" data-rel="back" data-role="button" data-mini="true" >Cancel</a>
- <a href="#" onClick="sessionLogin()" data-role="button" data-mini="true" >Log in</a>
- </div>
- </form>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="signup">
- <div data-role="header" data-theme="e" >
- <h1>Sign up</h1>
- </div>
- <div data-role="content">
- <form id="signup-form">
- <label for="signup-form-email">Email</label>
- <input id="signup-form-email" type="email" name="email" autocomplete="off"/>
- <label for="signup-form-name">Name</label>
- <input id="signup-form-name" type="text" name="name" autocomplete="off" />
- <label for="signup-form-password">Password</label>
- <input id="signup-form-password" type="password" name="password" />
- <label for="signup-form-password-confirmation">Password Comfirmation</label>
- <input id="signup-form-password-confirmation" type="password" name="password-confirmation" />
- <div data-role="controlgroup" data-type="horizontal">
- <a href="#" data-rel="back" data-role="button" data-mini="true" >Cancel</a>
- <a href="#" onClick="userSignUp()" data-role="button" data-mini="true" data-inline="true">Sign up</a>
- </div>
- </form>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="projects" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary">
- <div data-role="fieldcontain" style="text-align: center; font-size: 14px;">
- <select id="projects-distribution-select" data-native-menu="false" onchange='projectsQueryProjectListType()'>
- </select>
- </div>
- <br>
- <div id="projects-type-select">
- <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
- <form>
- <input type="radio" name="projects-type-select" id="projects-type-select-1" value="MY" checked="checked" onClick='projectsQueryProjectListType()' />
- <label for="projects-type-select-1">MY PROJECT</label>
- <input type="radio" name="projects-type-select" id="projects-type-select-2" value="ALL" onClick='projectsQueryProjectListType()'/>
- <label for="projects-type-select-2">ALL PROJECT</label>
- <input type="radio" name="projects-type-select" id="projects-type-select-3" value="GIT" onClick='projectsQueryProjectListType()' />
- <label for="projects-type-select-3">GIT PROJECT</label>
- <input type="radio" name="projects-type-select" id="projects-type-select-4" value="BINARY" onClick='projectsQueryProjectListType()' />
- <label for="projects-type-select-4">BINARY PROJECT</label>
- </form>
- </fieldset>
- </div>
- <br>
- <div id="projects-project-list">
- </div>
- </div><!--/content-primary -->
-
- <div class="content-secondary">
- <ul data-role="listview" id="projects-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="build" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary">
- <div>
- <div data-role="fieldcontain" style="text-align: center; font-size: 14px;">
- <select id="build-distribution-select" data-native-menu="false" onchange="buildQueryProjectList()">
- </select>
- </div>
- </div>
- <div id="build-distribution-lock"> </div>
- <div data-role="collapsible" data-collapsed="false" style="width: auto;" >
- <h3>Git project</h3>
- <div align="right" style="font-size: 10px">
- <a href="#" data-role="button" data-inline="true" data-mini="true" onClick='buildBuildProject()'>Build</a>
- </div>
- <div data-role="content">
- <table class="build-project-table" style="font-size: 14px" id="build-git-table">
- </table>
- </div>
- </div>
- <div data-role="collapsible" data-collapsed="false" style="width: auto;" >
- <h3>Binary project</h3>
- <div data-role="content">
- <table class="build-project-table" style="font-size: 14px" id="build-binary-table">
- </table>
- </div>
- </div>
- </div><!--/content-primary -->
-
- <div class="content-secondary">
- <ul data-role="listview" id="build-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="jobs" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary">
- <div data-role="fieldcontain" style="text-align: center; font-size: 14px;">
- <select id="jobs-distribution-select" date-mini="true" data-native-menu="false" onchange="jobsSearchSelected()">
- </select>
- </div>
- <br/>
- <div class="ui-grid-a">
- <div id="jobs-type-select" class="ui-block-a">
- <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
- <form>
- <input type="radio" name="radio-choice" id="jobs-type-1" class="jobSearch" value="ALL" checked="checked" />
- <label for="jobs-type-1">ALL</label>
-
- <input type="radio" name="radio-choice" id="jobs-type-2" class="jobSearch" value="JOBID" />
- <label for="jobs-type-2">JOB ID</label>
-
- <input type="radio" name="radio-choice" id="jobs-type-3" class="jobSearch" value="USER" />
- <label for="jobs-type-3">USER</label>
-
- <input type="radio" name="radio-choice" id="jobs-type-4" class="jobSearch" value="GROUP" />
- <label for="jobs-type-4">GROUP</label>
-
- <input type="radio" name="radio-choice" id="jobs-type-5" class="jobSearch" value="PROJECT" />
- <label for="jobs-type-5">PROJECT</label>
-
- <input type="radio" name="radio-choice" id="jobs-type-6" class="jobSearch" value="DATE" />
- <label for="jobs-type-6">DATE</label>
- </form>
- </fieldset>
- </div>
- <div id="jobs-status-select" class="ui-block-b" style="text-align:right">
- <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
- <form>
- <input type="radio" name="radio-choice" id="jobs-type-7" class="jobSearch" value="ALL" checked="checked" />
- <label for="jobs-type-7">ALL</label>
-
- <input type="radio" name="radio-choice" id="jobs-type-8" class="jobSearch" value="SUCCESS" />
- <label for="jobs-type-8">SUCCESS</label>
-
- <input type="radio" name="radio-choice" id="jobs-type-9" class="jobSearch" value="WORKING" />
- <label for="jobs-type-9">WORKING</label>
-
- <input type="radio" name="radio-choice" id="jobs-type-10" class="jobSearch" value="ERROR" />
- <label for="jobs-type-10">ERROR</label>
- </form>
- </fieldset>
- </div>
- </div>
-
- <div id="jobs-search-input" >
- <input type="search" name="search-mini" id="jobs-search-input-text" autocomplete="off" value="" data-mini="true" />
- <a href="#" onClick="searchJobInput()" data-role="button" data-mini="true" data-inline="true">Search</a>
-
- <ul data-role="listview" id="jobs-search-list" data-inset="true">
- </ul>
- </div>
- <div id="jobs-search-date" >
- <input type="date" name="date" id="jobs-search-date-value" autocomplete="off" data-mini="true" data-inline="true" data-options='{"mode": "flipbox","noButtonFocusMode": true}' />
- <a href="#" onClick="searchJobDate()" data-role="button" data-mini="true" data-inline="true">Search</a>
- </div>
- <br>
- <br>
- <ul id="jobs-job-list" data-role="listview">
- </ul>
- <br>
-
- <button id="jobs-job-more" onClick="queryJobList()" data-mini="true">MORE</button>
- </div><!--/content-primary -->
-
- <div class="content-secondary">
- <ul data-role="listview" id="jobs-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="adminUser" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary">
- <h2>User information</h2>
- <div>
- <table class="imagetable" style="font-size: 14px" id="adminUser-contents">
- </table>
- </div>
- </div><!--/content-primary -->
-
- <div class="content-secondary">
- <ul data-role="listview" id="adminUser-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="adminUserModify" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Modify User</h1>
- </div>
- <div data-role="content">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminUserModify-id" name="id" />
- <br>
- <label for="adminUserModify-name"> User name </label>
- <input type="text" id="adminUserModify-name" name="name" />
- <br>
- <label for="adminUserModify-email"> Email </label>
- <input type="text" id="adminUserModify-email" name="email" />
- <br>
- <div>
- <fieldset data-role="controlgroup" data-mini="true" data-role="fieldcontain" id="adminUserModify-group">
- </fieldset>
- <br>
- </div>
- <br>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href=#adminUser onClick="adminUserResetPassword()" data-role="button" data-inline="true" data-mini="true" data-icon="gear" id="adminUserModify-reset">Reset password</a>
- <a href=#adminUser onClick="adminUserModify()" data-role="button" data-inline="true" data-mini="true" data-icon="gear" id="adminUserModify-save">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminGroup" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary">
- <h2>Group information</h2>
- <div align="right" style="font-size: 10px">
- <a href="#adminGroupAdd" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add group </a>
- </div>
- <div data-role="content" class="container">
- <table class="imagetable" style="font-size: 14px" id="adminGroup-contents">
- </table>
- </div>
- </div><!--/content-primary -->
-
- <div class="content-secondary">
- <ul data-role="listview" id="adminGroup-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="adminServer" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary">
- <h2>Server information</h2>
- <div align="right" style="font-size: 10px">
- <a href="#adminServerAddServerInfo" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add server config </a>
- </div>
- <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false">
- <h2> Server info </h2>
- <ul data-role="listview" id="adminServer-ServerInfo">
- </ul>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#adminServerAddSupportedOs" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add supported os</a>
- <a href="#adminServerAddOSCategory" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add os category</a>
- <a href="#adminServerRemoveOSCategory" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="minus"> Remove os category</a>
- </div>
- <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false">
- <h2> Supported OS </h2>
- <ul data-role="listview" id="adminServer-SupportedOS">
- </ul>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#adminServerAddRemoteBuildServer" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add remote build server </a>
- </div>
- <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false">
- <h2> Remote build server </h2>
- <ul data-role="listview" id="adminServer-RemoteBuildServer">
- </ul>
- </div>
- </div><!--/content-primary -->
- <div class="content-secondary">
- <ul data-role="listview" id="adminServer-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="adminProject" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary" >
- <h2>Project information</h2>
- <div>
- <div data-role="fieldcontain" style="text-align: center; font-size: 14px;">
- <select id="adminProject-distribution-select" data-native-menu="false" onchange="adminProjectSetProjectInfo()">
- </select>
- </div>
- </div>
- <div>
- <div align="right" style="font-size: 10px">
- <a href="#" data-role="button" data-inline="true" data-mini="true" onClick='adminProjectAllProjectStatusChange("OPEN")'>ALL project OPEN</a>
- <a href="#" data-role="button" data-inline="true" data-mini="true" onClick='adminProjectAllProjectStatusChange("CLOSE")'>ALL project CLOSE</a>
- </div>
- <div style="margin-left: 20px; margin-right: 20px; margin-top: 10px">
- <div data-role="collapsible" data-theme="b" data-content-theme="c" data-collapsed="false" >
- <h2> Git project </h2>
- <div align="right" style="font-size: 10px">
- <a href="#adminProjectAddGit" data-role="button" data-rel="dialog" data-inline="true" data-mini="true" data-icon="plus"> Add git project</a>
- </div>
- <br>
- <table class="imagetable" id="adminProject-git" style="font-size: 14px">
- </table>
- </div>
- <br>
- <div data-role="collapsible" data-theme="b" data-content-theme="c" data-collapsed="false" >
- <h2> Binary project </h2>
- <div align="right" style="font-size: 10px">
- <a href="#adminProjectAddBinary" data-role="button"data-rel="dialog" data-inline="true" data-mini="true" data-icon="plus"> Add binary project</a>
- </div>
- <table class="imagetable" id="adminProject-binary" style="font-size: 14px">
- </table>
- </div>
- </div>
- </div>
- </div><!--/content-primary -->
-
- <div class="content-secondary">
- <ul data-role="listview" id="adminProject-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="adminDistribution" class="type-interior">
- <div data-role="header" data-theme="a">
- <a href=#index data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
- <h1>DIBS 2.0</h1>
- <div class="sessionInfo">
- </div>
- </div><!-- /header -->
-
- <div data-role="content" >
- <div class="content-primary" >
- <h2>Distribution information</h2>
- <div>
- <div data-role="fieldcontain" style="text-align: center; font-size: 14px;">
- <select id="adminDistribution-distribution-select" data-native-menu="false" onchange="adminDistributionSetInfo()">
- </select>
- </div>
- <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false" >
- <h2> Package server url </h2>
- <p id="adminDistribution-url" style="font-size: 14px"> </p>
- </div>
- <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false" >
- <h2> Package server address </h2>
- <p id="adminDistribution-address" style="font-size: 14px"> </p>
- </div>
- <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false" >
- <h2> Status </h2>
- <p id="adminDistribution-status" style="font-size: 14px"> </p>
- </div>
- <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false" >
- <h2> Description </h2>
- <p id="adminDistribution-description" style="font-size: 14px"> </p>
- </div>
- <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false" >
- <h2> Sync package server </h2>
- <div id="adminDistribution-syncPackageServer">
- </div>
- </div>
- <br>
- <div align="right" style="font-size: 10px">
- <a href="#adminDistributionAdd" data-role="button" data-rel="dialog" data-inline="true" data-mini="true" data-icon="plus"> Add distribution</a>
- <a href="#adminDistributionModify" data-role="button" data-rel="dialog" data-inline="true" data-mini="true" data-icon="gear"> Modify distribution</a>
- <a href="javascript:adminDistributionRemove()" data-role="button" data-rel="dialog" data-inline="true" data-mini="true" data-icon="minus"> Remove distribution</a>
- </div>
- </div>
- </div><!--/content-primary -->
-
- <div class="content-secondary">
- <ul data-role="listview" id="adminDistribution-navigationBar">
- </ul>
- </div>
- </div><!-- /content -->
- </div><!-- /page -->
-
- <div data-role="page" id="adminDistributionAdd" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Add Distribution</h1>
- </div>
- <div data-role="content">
- <form method="post" style="font-size: 12px">
- <label for="adminDistributionAdd-name"> Distirbution name </label>
- <input type="text" id="adminDistributionAdd-name" name="name" />
- <br>
- <label for="adminDistributionAdd-url"> Package server url </label>
- <input type="text" id="adminDistributionAdd-url" name="url" />
- <br>
- <label for="adminDistributionAdd-address"> Package server address </label>
- <input type="text" id="adminDistributionAdd-address" name="address" />
- <br>
- <label for="adminDistributionAdd-status"> Distribution status </label>
- <select id="adminDistributionAdd-status" name="status" >
- <option value="OPEN" selected="selected">OPEN</option>
- <option value="CLOSE">CLOSE</option>
- </select>
- <br>
- <label for="adminDistributionAdd-description"> Description </label>
- <input type="text" id="adminDistributionAdd-description" name="description" />
- <br>
- <div>
- <h3> Sync package server </h3>
- <label for="adminDistributionAdd-syncPackageServer-url"> Url </label>
- <input type="text" id="adminDistributionAdd-syncPackageServer-url" name="url" />
- <label for="adminDistributionAdd-syncPackageServer-period"> Period </label>
- <input type="text" id="adminDistributionAdd-syncPackageServer-period" name="period" />
- <label for="adminDistributionAdd-syncPackageServer-description"> Description </label>
- <input type="text" id="adminDistributionAdd-syncPackageServer-description" name="description" />
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href=# onClick="adminDistributionAdd()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminDistributionModify" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Modofy Distribution</h1>
- </div>
- <div data-role="content">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminDistributionModify-id" name="id" />
- <br>
- <label for="adminDistributionModify-url"> Package server url </label>
- <input type="text" id="adminDistributionModify-url" name="description" />
- <br>
- <label for="adminDistributionModify-address"> Package server address </label>
- <input type="text" id="adminDistributionModify-address" name="address" />
- <br>
- <label for="adminDistributionModify-status"> Distribution status </label>
- <select id="adminDistributionModify-status" name="status" >
- </select>
- <br>
- <label for="adminDistributionModify-description"> Description </label>
- <input type="text" id="adminDistributionModify-description" name="description" />
- <br>
- <div>
- <h3> Sync package server </h3>
- <label for="adminDistributionModify-syncPackageServer-url"> Url </label>
- <input type="text" id="adminDistributionModify-syncPackageServer-url" name="url" />
- <label for="adminDistributionModify-syncPackageServer-period"> Period </label>
- <input type="text" id="adminDistributionModify-syncPackageServer-period" name="period" />
- <label for="adminDistributionModify-syncPackageServer-description"> Description </label>
- <input type="text" id="adminDistributionModify-syncPackageServer-description" name="description" />
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href=# onClick="adminDistributionModify()" data-role="button" data-inline="true" data-icon="gear">Save</a>
- </div>
- </div>
-
- <div data-role="page" id="adminProjectAddGit" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Add Git Project</h1>
- </div>
- <div data-role="content">
- <form method="post" style="font-size: 12px">
- <label for="adminProjectAddGit-name"> Project name </label>
- <input type="text" id="adminProjectAddGit-name" name="name" />
- <br>
- <label for="adminProjectAddGit-address"> Git address </label>
- <input type="text" id="adminProjectAddGit-address" name="address" />
- <br>
- <label for="adminProjectAddGit-branch"> Git Branch </label>
- <input type="text" id="adminProjectAddGit-branch" name="branch" />
- <br>
- <label for="adminProjectAddGit-status"> Project status </label>
- <select id="adminProjectAddGit-status" name="status" >
- </select>
- <br>
- <div data-role="fieldcontain">
- <fieldset data-role="controlgroup" data-mini="true" id="adminProjectAddGit-os" name="os" >
- </fieldset>
- <br>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#adminProject" onClick="adminProjectAddGitProject()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminProjectAddBinary" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Add Binary Project</h1>
- </div>
- <div data-role="content">
- <form method="post" style="font-size: 12px">
- <label for="adminProjectAddBinary-name"> Project name </label>
- <input type="text" id="adminProjectAddBinary-name" name="name" />
- <br>
- <label for="adminProjectAddBinary-packagename"> Pakcage name</label>
- <input type="text" id="adminProjectAddBinary-packagename" name="name" />
- <br>
- <label for="adminProjectAddBinary-status"> Project status </label>
- <select id="adminProjectAddBinary-status" name="status" >
- </select>
- <br>
- <div data-role="fieldcontain">
- <fieldset data-role="controlgroup" data-mini="true" id="adminProjectAddBinary-os" name="os" >
- </fieldset>
- <br>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="adminProjectAddBinaryProject()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminProjectModifyBinary" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Modify Project</h1>
- </div>
- <div data-role="content">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminProjectModifyBinary-id" disabled="disabled" name="id" />
- <br>
- <label for="adminProjectModifyBinary-name"> Project name </label>
- <input type="text" id="adminProjectModifyBinary-name" name="name" />
- <br>
- <label for="adminProjectModifyBinary-status"> Project status </label>
- <select id="adminProjectModifyBinary-status" name="status" >
- </select>
- <br>
- <label for="adminProjectModifyBinary-packageName"> Pakcage name</label>
- <input type="text" id="adminProjectModifyBinary-packageName" name="name" />
- <div data-role="fieldcontain">
- <fieldset data-role="controlgroup" data-mini="true" id="adminProjectModifyBinary-os" name="os" >
- </fieldset>
- <br>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="adminProjectModfyBinaryProject()" data-role="button" data-inline="true" data-mini="true" data-icon="gear" id="adminProjectModifyBinary-save">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminProjectModifyGit" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Modify Project</h1>
- </div>
- <div data-role="content">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminProjectModifyGit-id" disabled="disabled" name="id" />
- <br>
- <label for="adminProjectModifyGit-name"> Project name </label>
- <input type="text" id="adminProjectModifyGit-name" name="name" />
- <br>
- <label for="adminProjectModifyGit-status"> Project status </label>
- <select id="adminProjectModifyGit-status" name="status" >
- </select>
- <br>
- <label for="adminProjectModifyGit-address"> Git address </label>
- <input type="text" id="adminProjectModifyGit-address" name="address" />
- <br>
- <label for="adminProjectModifyGit-branch"> Git branch</label>
- <input type="text" id="adminProjectModifyGit-branch" name="branch" />
- <br>
- <div data-role="fieldcontain">
- <fieldset data-role="controlgroup" data-mini="true" id="adminProjectModifyGit-os" name="os" >
- </fieldset>
- <br>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="adminProjectModfyGitProject()" data-role="button" data-inline="true" data-mini="true" data-icon="gear" id="adminProjectModifyGit-save">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminGroupAdd" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Add Group</h1>
- </div>
- <div data-role="content">
- <form method="post" style="font-size: 12px">
- <label for="adminGroupAdd-name"> Group name </label>
- <input type="text" id="adminGroupAdd-name" name="name" />
- <br>
- <div data-role="fieldcontain">
- <label for="adminGroupAdd-admin"> Admin Flag </label>
- <br>
- <select id="adminGroupAdd-admin" name="admin" >
- <option value="TRUE">True</option>
- <option value="FALSE" selected="selected">False</option>
- </select>
- </div>
- <br>
- <label for="adminGroupAdd-description"> Description </label>
- <input type="text" id="adminGroupAdd-description" name="description" />
- <br>
- <div data-role="fieldcontain">
- <fieldset data-role="controlgroup" data-mini="true" id="adminGroupAdd-project" name="project" >
- </fieldset>
- <br>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href=# onClick="adminGroupAddGroup()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminGroupModify" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>modify Group</h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminGroupModify-id" name="id" />
- <br>
- <label for="adminGroupModify-name"> Group name </label>
- <input type="text" id="adminGroupModify-name" name="name" />
- <br>
- <div data-role="fieldcontain">
- <label for="adminGroupModify-admin"> Admin Flag </label>
- <br>
- <select id="adminGroupModify-admin" name="admin" >
- </select>
- </div>
- <br>
- <label for="adminGroupModify-description"> Description </label>
- <input type="text" id="adminGroupModify-description" name="description" />
- <br>
- <div>
- <fieldset data-role="controlgroup" data-mini="true" data-role="fieldcontain" id="adminGroupModify-project" name="project" >
- </fieldset>
- <br>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="adminGroupModifyGroup()" data-role="button" data-inline="true" data-mini="true" data-icon="gear" id="adminGroupModify-save">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminServerAddRemoteBuildServer" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Add remote build server</h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <label for="adminServer-AddRemoteBuildServer-Address"> Server address </label>
- <input type="text" id="adminServer-AddRemoteBuildServer-Address" name="address" />
- <br>
- <label for="adminServer-AddRemoteBuildServer-Description"> Server description</label>
- <input type="text" id="adminServer-AddRemoteBuildServer-Description" name="description" />
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href=# onClick="adminServerAddRemoteBuildServer()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminServerModifyRemoteBuildServer" style="height: 800px; width: 800px"> <div data-role="header" >
- <h1>Modify server </h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminServer-modifyRemoteBuildServer-id" name="id" />
- <br>
- <label for="adminServer-modifyRemoteBuildServer-address"> Server address </label>
- <input type="text" id="adminServer-modifyRemoteBuildServer-address" name="address" />
- <br>
- <label for="adminServer-modifyRemoteBuildServer-description"> Description </label>
- <input type="text" id="adminServer-modifyRemoteBuildServer-description" name="description" />
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href=# onClick="adminServerModifyRemoteBuildServer()" data-role="button" data-inline="true" data-mini="true" data-icon="gear" id="adminServer-modifyRemoteBuildServer-save" >Save</a>
- <a href=# onClick="adminServerRemoveRemoteBuildServer()" data-role="button" data-inline="true" data-mini="true" data-icon="minus">Delete</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="userModify" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>User information</h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <label for="userModify-email">Email</label>
- <input type="text" id="userModify-email" disabled="disabled" name="email" />
- <br>
- <label for="userModify-name">Name</label>
- <input type="text" id="userModify-name" name="email" />
- <br>
- <label for="userModify-password">Password</label>
- <input type="password" id="userModify-password" name="password" />
- <br>
- <label for="userModify-password-confirm">Password confirmation</label>
- <input type="password" id="userModify-password-confirm" name="password" />
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="userModifyUserInfo()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminServerAddSupportedOs" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Add supported os</h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminServer-AddSupportedOs-id" name="id" />
- <br>
- <label for="adminServer-AddSupportedOs-name">Supported os name</label>
- <input type="text" id="adminServer-AddSupportedOs-name" name="name" />
- <br>
- <div data-role="fieldcontain">
- <label for="adminServer-AddSupportedOs-OsCategory"> Os category </label>
- <br>
- <select id="adminServer-AddSupportedOs-OsCategory" name="category" >
- </select>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="adminServerAddSupportedOs()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminServerModifySupportedOS" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Modify supported os</h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminServer-ModifySupportedOs-id" name="id" />
- <br>
- <label for="adminServer-ModifySupportedOs-name">Supported os name</label>
- <input type="text" id="adminServer-MoidfySupportedOs-name" name="name" />
- <br>
- <div data-role="fieldcontain">
- <label for="adminServer-ModifySupportedOs-OsCategory"> Os category </label>
- <br>
- <select id="adminServer-ModifySupportedOs-OsCategory" name="os-category" >
- </select>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="adminServerModifySupportedOS()" data-role="button" data-inline="true" data-mini="true" data-icon="gear" id="adminServer-ModifySupportedOs-save" >Save</a>
- <a href="#" onClick="adminServerRemoveSupportedOS()" data-role="button" data-inline="true" data-mini="true" data-icon="minus">Remove</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminServerAddOSCategory" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Add os category</h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <label for="adminServer-AddOsCategory-name">OS category name</label>
- <input type="text" id="adminServer-AddOsCategory-name" name="name" />
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="adminServerAddOSCategory()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminServerRemoveOSCategory" style="height: 800px; width: 800px">
- <div data-role="header" >
- <h1>Remove os category</h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <div data-role="fieldcontain">
- <label for="adminServer-RemoveOSCategory-CategorySelect"> Os category </label>
- <br>
- <select id="adminServer-RemoveOSCategory-CategorySelect" name="osCategory" >
- </select>
- </div>
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href="#" onClick="adminServerRemoveOSCategory()" data-role="button" data-inline="true" data-mini="true" data-icon="minus">Delete</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminServerAddServerInfo" style="height: 800px; width: 800px"> <div data-role="header" >
- <h1>Add server config </h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <label for="adminServer-addServerInfo-property"> Property</label>
- <input type="text" id="adminServer-addServerInfo-property" name="property" />
- <br>
- <label for="adminServer-addServerInfo-value"> Value </label>
- <input type="text" id="adminServer-addServerInfo-value" name="value" />
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href=# onClick="adminServerAddServerInfo()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
- </div>
- </div><!-- /page -->
-
- <div data-role="page" id="adminServerModifyServerInfo" style="height: 800px; width: 800px"> <div data-role="header" >
- <h1>Modify server config </h1>
- </div>
- <div data-role="content" data-role="fieldcontain">
- <form method="post" style="font-size: 12px">
- <input type="hidden" id="adminServer-modifyServerInfo-id" name="property" />
- <br>
- <label for="adminServer-modifyServerInfo-property"> Property</label>
- <input type="text" id="adminServer-modifyServerInfo-property" name="property" />
- <br>
- <label for="adminServer-modifyServerInfo-value"> Value </label>
- <input type="text" id="adminServer-modifyServerInfo-value" name="value" />
- </form>
- </div>
- <div align="right" style="font-size: 10px">
- <a href=# onClick="adminServerModifyServerInfo()" data-role="button" data-inline="true" data-mini="true" data-icon="gear" id="adminServer-modifyServerInfo-save">Save</a>
- <a href=# onClick="adminServerRemoveServerInfo()" data-role="button" data-inline="true" data-mini="true" data-icon="minus">Delete</a>
- </div>
- </div><!-- /page -->
-
-</body>
-
- <script src="javascripts/post-process.js"></script>
-</html>
+++ /dev/null
-/*
- admin-distribution-add.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminDistributionAdd() {
- var changeInfoList = [];
- var changeInfoItem;
- var name = $("#adminDistributionAdd-name").val();
- var url = $("#adminDistributionAdd-url").val();
- var address = $("#adminDistributionAdd-address").val();
- var description = $("#adminDistributionAdd-description").val();
- var distStatus = $("#adminDistributionAdd-status option:selected").val();
-
- var sync_pkg_svr_url = $("#adminDistributionAdd-syncPackageServer-url").val();
- var sync_pkg_svr_period = $("#adminDistributionAdd-syncPackageServer-period").val();
- var sync_pkg_svr_description = $("#adminDistributionAdd-syncPackageServer-description").val();
-
- if(name == "" || url == "" || address == ""){
- alert("You must input full data");
- return;
- }
-
- changeInfoItem = {"DistributionName":name, "URL":url, "Address":address, "DistStatus":distStatus, "Description":description, "SyncPkgSvrUrl":sync_pkg_svr_url, "SyncPkgSvrPeriod":sync_pkg_svr_period, "SyncPkgSvrDescription":sync_pkg_svr_description};
- changeInfoList.push(changeInfoItem);
-
- addDistribution(changeInfoList, function () {
- $("#adminDistributionAdd-name").val("");
- $("#adminDistributionAdd-url").val("");
- $("#adminDistributionAdd-address").val("");
- $("#adminDistributionAdd-description").val("");
- $("#adminDistributionAdd-syncPackageServer-url").val("");
- $("#adminDistributionAdd-syncPackageServer-period").val("");
- $("#adminDistributionAdd-syncPackageServer-description").val("");
-
- $.mobile.changePage("#adminDistribution");
- });
-}
-
+++ /dev/null
-/*
- admin-distribution-modify.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminDistributionModifyPopupInit() {
- var distId = $("#adminDistribution-distribution-select option:selected").val();
- var packageServerUrl = $("#adminDistribution-url").html();
- var packageServeraddress = $("#adminDistribution-address").html();
- var serverStatusText = $("#adminDistribution-status").html();
- var serverDescription = $("#adminDistribution-description").html();
-
- var syncPkgSvrUrl = $("#adminDistribution-syncPackageServer-url").html();
- var syncPkgSvrPeriod = $("#adminDistribution-syncPackageServer-period").html();
- var syncPkgSvrDescription = $("#adminDistribution-syncPackageServer-description").html();
-
- if (syncPkgSvrUrl) {
- syncPkgSvrUrl = syncPkgSvrUrl.replace("Package server url : ", "");
- } else {
- syncPkgSvrUrl = ""
- }
-
- if (syncPkgSvrPeriod) {
- syncPkgSvrPeriod = syncPkgSvrPeriod.replace("Period : ", "");
- } else {
- syncPkgSvrPeriod = ""
- }
- if (syncPkgSvrDescription) {
- syncPkgSvrDescription = syncPkgSvrDescription.replace("Description : ", "");
- } else {
- syncPkgSvrDescription = ""
- }
-
- $("#adminDistributionModify-id").val(distId);
- $("#adminDistributionModify-url").val(packageServerUrl);
- $("#adminDistributionModify-address").val(packageServeraddress);
- $("#adminDistributionModify-description").val(serverDescription);
- $("#adminDistributionModify-syncPackageServer-url").val(syncPkgSvrUrl);
- $("#adminDistributionModify-syncPackageServer-period").val(syncPkgSvrPeriod);
- $("#adminDistributionModify-syncPackageServer-description").val(syncPkgSvrDescription);
-
- $("#adminDistributionModify-status").empty();
- var option;
- if(serverStatusText.toUpperCase() == "OPEN") {
- option = '<option value="OPEN" selected="selected">OPEN</option>';
- } else {
- option = '<option value="OPEN">OPEN</option>';
- }
- $("#adminDistributionModify-status").append(option);
-
- if(serverStatusText.toUpperCase() == "CLOSE") {
- option = '<option value="CLOSE" selected="selected">CLOSE</option>';
- } else {
- option = '<option value="CLOSE">CLOSE</option>';
- }
- $("#adminDistributionModify-status").append(option);
-
- $("#adminDistributionModify-status").selectmenu("refresh");
-}
-
-function adminDistributionModify() {
- var changeInfoList = [];
- var changeInfoItem;
- var distId = $("#adminDistributionModify-id").val();
- var url = $("#adminDistributionModify-url").val();
- var address = $("#adminDistributionModify-address").val();
- var description = $("#adminDistributionModify-description").val();
- var distStatus = $("#adminDistributionModify-status option:selected").val();
- var syncPkgSvrUrl = $("#adminDistributionModify-syncPackageServer-url").val();
- var syncPkgSvrPeriod = $("#adminDistributionModify-syncPackageServer-period").val();
- var syncPkgSvrDescription = $("#adminDistributionModify-syncPackageServer-description").val();
-
- if(distId == "" || url == "" || address == ""){
- alert("You must input full data");
- return;
- }
-
- if(distStatus == "") {
- distStatus = "OPEN";
- }
-
- changeInfoItem = {"DistributionId":distId, "URL":url, "Address":address, "DistStatus":distStatus, "Description":description, "SyncPkgSvrUrl":syncPkgSvrUrl, "SyncPkgSvrPeriod":syncPkgSvrPeriod, "SyncPkgSvrDescription":syncPkgSvrDescription};
- changeInfoList.push(changeInfoItem);
-
- modifyDistribution( changeInfoList, function () {
- $.mobile.changePage("#adminDistribution");
- });
-}
-
+++ /dev/null
-/*
- admin-distribution.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminDistributionInit() {
- queryAllDistribution( function (xml) {
- var oldDistId = $("#adminDistribution-distribution-select option:selected").val();
- var find = false;
- var distributionList = $(xml).find("Data").find("Distribution");
-
- // remove old select options
- $("#adminDistribution-distribution-select").empty();
-
- distributionList.each(function(){
- var distId = $(this).find("Id").text();
- var distName = $(this).find("Name").text();
-
- if( oldDistId == distId ) {
- $("#adminDistribution-distribution-select").append("<option value=\'"+distId+"\' selected=\"selected\">"+distName+"</option>");
- find = true;
-
- } else {
- $("#adminDistribution-distribution-select").append("<option value=\'"+distId+"\'>"+distName+"</option>");
- }
- });
-
- /* default distribution selection */
- if(!find) {
- $("#adminDistribution-distribution-select option:eq(0)").attr("selected", "selected");
- }
-
- $("#adminDistribution-distribution-select").selectmenu('refresh');
-
- // set distribution info
- adminDistributionSetInfo();
- });
-}
-
-function adminDistributionSetInfo() {
- var distId = $("#adminDistribution-distribution-select option:selected").val();
-
- queryDistributionInfo( distId, function (xml) {
- var syncPackageServer = $(xml).find("Data").find("SyncPackageServer");
- var distInfo = $(xml).find("Data").find("DistributionInfo");
- var id = distInfo.find("Id").text();
- var name = distInfo.find("Name").text();
- var url = distInfo.find("PackageServerUrl").text();
- var address = distInfo.find("PackageServerAddress").text();
- var distStatus = distInfo.find("Status").text();
- var distDescription = distInfo.find("Description").text();
-
- $("#adminDistribution-url").text(url);
- $("#adminDistribution-address").text(address);
- $("#adminDistribution-status").text(distStatus);
- $("#adminDistribution-description").text(distDescription);
-
- adminDistributionInitSyncPackageServer(syncPackageServer);
- });
-}
-
-function adminDistributionRemove() {
- var changeInfoList = [];
- var changeInfoItem;
- var distId = $("#adminDistribution-distribution-select option:selected").val();
-
- changeInfoItem = {"DistributionId":distId};
- changeInfoList.push(changeInfoItem);
-
- var r=confirm("Distribution will be removed!!!");
- if (r==false)
- {
- return;
- }
-
- removeDistribution( changeInfoList, function (xml) {
- $.mobile.changePage("#adminDistribution");
- });
-}
-
-function adminDistributionInitSyncPackageServer(serverInfo){
- $("#adminDistribution-syncPackageServer").empty();
-
- var info = '<h3 style="font-size: 16px" id="adminDistribution-syncPackageServer-url">Package server url : '+serverInfo.find("Url").text()+'</h3>';
- info += '<p style="font-size: 14px" id="adminDistribution-syncPackageServer-period">Period : '+serverInfo.find("Period").text()+'</p>';
- info += '<p style="font-size: 14px" id="adminDistribution-syncPackageServer-description">Description : '+serverInfo.find("Description").text()+'</p>';
-
- $("#adminDistribution-syncPackageServer").append(info);
-}
+++ /dev/null
-/*
- admin-group-add.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminGroupAddInit() {
- $("#adminGroupAdd-name").val("");
- $("#adminGroupAdd-description").val("");
-
- queryAllProjectInOpenStatus( function(xml) {
- var fullProjectList = $(xml).find("Data").find("Project");
-
- adminGroupAddGenerateProjectSelect(fullProjectList);
- });
-}
-
-function adminGroupAddGenerateProjectSelect(projectList) {
- $("#adminGroupAdd-project").empty();
-
- projectList.each(function(){
- var projectName = $(this).find("Name").text();
- var projectId = $(this).find("Id").text();
- var projectDistName = $(this).find("DistName").text();
-
- var input = '<input type=checkbox id=adminGroupAdd-project-checkbox-'+projectId+' name=adminGroupAdd-project-checkbox value='+projectId+' />';
- var label = '<label for=adminGroupAdd-project-checkbox-'+projectId+'> '+projectName+'['+projectDistName+'] <label>';
- $("#adminGroupAdd-project").append(input);
- $("#adminGroupAdd-project").append(label);
- });
-
- $("input[name='adminGroupAdd-project-checkbox']").checkboxradio();
-}
-
-function adminGroupAddGroup() {
- var groupName = $("#adminGroupAdd-name").val();
- var adminFlag = $("#adminGroupAdd-admin option:selected").val();
- var description = $("#adminGroupAdd-description").val();
- var selectProjectIdList = [];
- var changeInfoList = [];
-
- var selectArray = $("input[name='adminGroupAdd-project-checkbox']");
- for(var i = 0; i < selectArray.length; i++) {
- if (selectArray[i].checked == true) {
- selectProjectIdList.push(selectArray[i].value);
- }
- }
-
- changeItem = {"GroupName" : groupName, "AdminFlag":adminFlag, "Description":description, "ProjectList" : selectProjectIdList.toString()};
- changeInfoList.push(changeItem);
-
- addGroup(changeInfoList, function() {
- $.mobile.changePage("#adminGroup");
- });
-}
-
+++ /dev/null
-/*
- admin-group-modify.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminGroupModifyInit(groupId) {
- var groupName = $("#adminGroup-contents-"+groupId+"-name").html();
- var adminFlagText = $("#adminGroup-contents-"+groupId+"-flag").html();
- var description = $("#adminGroup-contents-"+groupId+"-description").html();
-
- $("#adminGroupModify-save").attr("onClick", "");
- $("#adminGroupModify-id").val(groupId);
- $("#adminGroupModify-name").val(groupName);
- $("#adminGroupModify-description").val(description);
-
- $("#adminGroupModify-admin").empty();
- if(adminFlagText.toUpperCase() == "TRUE") {
- $("#adminGroupModify-admin").append('<option value="TRUE" selected="selected">TRUE</option>');
- } else {
- $("#adminGroupModify-admin").append('<option value="TRUE">TRUE</option>');
- }
-
- if(adminFlagText.toUpperCase() == "FALSE") {
- $("#adminGroupModify-admin").append('<option value="FALSE" selected="selected">FALSE</option>');
- } else {
- $("#adminGroupModify-admin").append('<option value="FALSE">FALSE</option>');
- }
- $("#adminGroupModify-admin").selectmenu();
- $("#adminGroupModify-admin").selectmenu("refresh");
-
- queryGroupInfo(groupId, function(xml) {
- var fullProjectList = $(xml).find("Data").find("Project");
- var projectIdList = $(xml).find("Data").find("Group").find("ProjectIdList").text().split(",");
-
- adminGroupModifyGenerateProjectSelect(fullProjectList, projectIdList);
- $("#adminGroupModify-save").attr("onClick", "adminGroupModifyGroup()");
- });
-}
-
-function adminGroupModifyGenerateProjectSelect(fullProjectList, projectIdList) {
- $("#adminGroupModify-project").empty();
- fullProjectList.each(function(){
- var projectId = $(this).find("Id").text();
- var projectName = $(this).find("Name").text();
- var projectDistName = $(this).find("DistName").text();
-
- var input;
- if(contains(projectIdList, projectId))
- {
- input = '<input type=checkbox id=adminGroupModify-project-checkbox-'+projectId+' name=adminGroupModify-project-checkbox value='+projectId+' checked=checked />';
- } else {
- input = '<input type=checkbox id=adminGroupModify-project-checkbox-'+projectId+' name=adminGroupModify-project-checkbox value='+projectId+' />';
-
- }
- var label = '<label for=adminGroupModify-project-checkbox-'+projectId+'> '+projectName+'['+projectDistName+'] <label>';
-
- $("#adminGroupModify-project").append(input);
- $("#adminGroupModify-project").append(label);
- });
-
- $("input[name='adminGroupModify-project-checkbox']").checkboxradio();
-}
-
-function adminGroupModifyGroup() {
- var groupId = $("#adminGroupModify-id").val();
- var groupName = $("#adminGroupModify-name").val();
- var description = $("#adminGroupModify-description").val();
- var adminFlag = $("#adminGroupModify-admin option:selected").val();
- var selectProjectList = [];
- var changeInfoList = [];
-
- $("input[name='adminGroupModify-project-checkbox']:checked").each(function() {
- selectProjectList.push($(this).val());
- });
-
- changeItem = {"GroupId" : groupId, "GroupName":groupName, "AdminFlag":adminFlag, "Description":description, "ProjectList":selectProjectList.toString()};
- changeInfoList.push(changeItem);
-
- changeGroup(changeInfoList, function() {
- $.mobile.changePage("#adminGroup");
- });
-}
-
+++ /dev/null
-/*
- admin-group.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminGroupInit() {
- $("#adminGroup-contents").empty();
-
- queryAllGroup( function(xml) {
- var header = $(xml).find("Header");
- var groupList = $(xml).find("Data").find("Group");
-
- adminGroupFillTableInfo(groupList);
- });
-}
-
-function adminGroupFillTableInfo(groupList) {
- var groupTable = document.getElementById("adminGroup-contents");
-
- /* create table header */
- var row = groupTable.insertRow(-1);
- var tableHeader = "<tr><th> Group name </th><th> Project list </th><th> Admin </th><th> Description </th><th> Modify </th><th> Delete </th></tr>";
-
- $("#adminGroup-contents").append(tableHeader);
-
- groupList.each(function(){
- var row = groupTable.insertRow(-1);
- var cell;
- var groupId = $(this).find("GroupId").text();
- var groupName = $(this).find("GroupName").text();
- var adminFlag = $(this).find("AdminFlag").text();
- var description = $(this).find("Description").text();
- var projectList = $(this).find("AccessableProject");
-
- row.setAttribute('id', 'adminGroup-contents-'+groupId);
-
- cell = row.insertCell(-1);
- cell.setAttribute('id', 'adminGroup-contents-'+groupId+'-name');
- cell.innerHTML = groupName
-
- cell = row.insertCell(-1);
- div = adminGroupGenerateProjectListCell(projectList);
- cell.appendChild(div);
-
- cell = row.insertCell(-1);
- cell.setAttribute('id', 'adminGroup-contents-'+groupId+'-flag');
- cell.innerHTML = adminFlag;
-
- cell = row.insertCell(-1);
- cell.setAttribute('id', 'adminGroup-contents-'+groupId+'-description');
- cell.innerHTML = description;
-
- cell = row.insertCell(-1);
- var button = document.createElement('a');
- button.setAttribute('href','#adminGroupModify');
- button.setAttribute('data-role','button');
- button.setAttribute('data-rel','dialog');
- button.setAttribute('onClick','adminGroupModifyInit(\"'+groupId+'\")');
- button.setAttribute('class','adminGroup-contents-button');
- button.innerHTML = " "
- cell.appendChild(button);
-
- cell = row.insertCell(-1);
- var button = document.createElement('input');
- button.setAttribute('type','button');
- button.setAttribute('onClick','adminGroupRemoveGroup('+groupId+')');
- button.setAttribute('class','adminGroup-contents-button');
- cell.appendChild(button);
- });
-
- $(".adminGroup-projectList").collapsible();
- $(".adminGroup-contents-button").button();
-}
-
-function adminGroupGenerateProjectListCell(projectList) {
- var div = document.createElement('div');
- div.setAttribute('data-role', 'collapsible');
- div.setAttribute('data-content-theme', 'b');
- div.setAttribute('class', 'adminGroup-projectList');
- div.setAttribute('style', 'text-align: left');
-
- var header = document.createElement('h3');
- header.innerHTML = "Project list";
- div.appendChild(header);
-
- var ul = document.createElement('ul');
-
- projectList.each(function(){
- var projectName = $(this).find("ProjectName").text();
- var projectDistName = $(this).find("ProjectDistribution").text();
- var item = document.createElement('li');
-
- item.innerHTML = projectName+"["+projectDistName+"]";
- ul.appendChild(item);
- });
-
- div.appendChild(ul);
- return div;
-}
-
-function adminGroupRemoveGroup(groupId) {
- var groupName = $("#adminGroup-contents-"+groupId+"-name").html();
-
- var r=confirm("User ["+groupName+"] will be removed!!!");
- if (r==false)
- {
- return;
- }
-
- var changeInfoList = [];
- var changeInfoItem;
- changeInfoItem = {"GroupId":groupId};
- changeInfoList.push(changeInfoItem);
-
- removeGroup(changeInfoList, function() {
- $.mobile.changePage("#adminGroup");
- });
-}
-
+++ /dev/null
-/*
- admin-project-add.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminProjectAddGitInit() {
- $("#adminProjectAddGit-name").val("");
- $("#adminProjectAddGit-address").val("");
- $("#adminProjectAddGit-branch").val("");
- $("#adminProjectAddGit-status").empty();
-
- var option;
- option = '<option value="OPEN" selected="selected">OPEN</option>';
- $("#adminProjectAddGit-status").append(option);
- option = '<option value="CLOSE">CLOSE</option>';
- $("#adminProjectAddGit-status").append(option);
- $("#adminProjectAddGit-status").selectmenu("refresh");
-
- queryAllOS( function (xml) {
- var osList = $(xml).find("Data").find("OS");
-
- $("#adminProjectAddGit-os").empty();
- $("#adminProjectAddGit-os").append("<legend>os list</legend>");
-
- osList.each(function(){
- var osId = $(this).find("Id").text();
- var osName = $(this).find("Name").text();
-
- var input = '<input type=checkbox id=adminProjectAddGit-os-checkbox-'+osId+' name=adminProjectAddGit-os-checkbox value='+osId+' checked=checked />'
- var label = '<label for=adminProjectAddGit-os-checkbox-'+osId+'> '+osName+'<label>';
- $("#adminProjectAddGit-os").append(input);
- $("#adminProjectAddGit-os").append(label);
- });
-
- $('input[name="adminProjectAddGit-os-checkbox"]').checkboxradio();
- });
-}
-
-function adminProjectAddBinaryInit() {
- $("#adminProjectAddBinary-name").val("");
- $("#adminProjectAddBinary-packagename").val("");
- $("#adminProjectAddBinary-status").empty();
-
- var option;
- option = '<option value="OPEN" selected="selected">OPEN</option>';
- $("#adminProjectAddBinary-status").append(option);
- option = '<option value="CLOSE">CLOSE</option>';
- $("#adminProjectAddBinary-status").append(option);
- $("#adminProjectAddBinary-status").selectmenu("refresh");
-
- queryAllOS( function (xml) {
- var osList = $(xml).find("Data").find("OS");
-
- $("#adminProjectAddBinary-os").empty();
- $("#adminProjectAddBinary-os").append("<legend>os list</legend>");
-
- osList.each(function(){
- var osId = $(this).find("Id").text();
- var osName = $(this).find("Name").text();
-
- var input = '<input type=checkbox id=adminProjectAddBinary-os-checkbox-'+osId+' name=adminProjectAddBinary-os-checkbox value='+osId+' checked=checked />'
- var label = '<label for=adminProjectAddBinary-os-checkbox-'+osId+'> '+osName+'<label>';
- $("#adminProjectAddBinary-os").append(input);
- $("#adminProjectAddBinary-os").append(label);
- });
-
- $('input[name="adminProjectAddBinary-os-checkbox"]').checkboxradio();
- });
-}
-
-function adminProjectAddGitProject() {
- var changeInfoList = [];
- var changeInfoItem;
- var distId = $("#adminProject-distribution-select option:selected").val();
- var name = $("#adminProjectAddGit-name").val();
- var address = $("#adminProjectAddGit-address").val();
- var branch = $("#adminProjectAddGit-branch").val();
- var projectStatus = $("#adminProjectAddGit-status option:selected").val();
- var selectOsList = [];
-
- var selectArray = $("input[name='adminProjectAddGit-os-checkbox']");
- for(var i = 0; i < selectArray.length; i++) {
- if (selectArray[i].checked == true) {
- selectOsList.push(selectArray[i].value);
- }
- }
-
- if(name == "" || address == "" || branch == ""){
- alert("You must input full data(Project name, Git address, Branch)");
- return;
- }
-
- changeInfoItem = {"DistId":distId, "Name":name, "Address":address, "Branch":branch, "ProjectStatus":projectStatus, "ProjectType":"GIT", "OSIdList":selectOsList.toString()};
- changeInfoList.push(changeInfoItem);
-
- addProject(changeInfoList, function () {
- $.mobile.changePage("#adminProject");
- });
-}
-
-function adminProjectAddBinaryProject() {
- var changeInfoList = [];
- var changeInfoItem;
- var distId = $("#adminProject-distribution-select option:selected").val();
- var name = $("#adminProjectAddBinary-name").val();
- var pkgName = $("#adminProjectAddBinary-packagename").val();
- var projectStatus = $("#adminProjectAddBinary-status option:selected").val();
- var selectOsList = [];
-
- var selectArray = $("input[name='adminProjectAddBinary-os-checkbox']");
- for(var i = 0; i < selectArray.length; i++) {
- if (selectArray[i].checked == true) {
- selectOsList.push(selectArray[i].value);
- }
- }
-
- if(name == "" || pkgName == ""){
- alert("You must input full data(Project name, Package name");
- return;
- }
-
- changeInfoItem = {"DistId":distId, "Name":name, "PackageName":pkgName, "ProjectStatus":projectStatus, "ProjectType":"BINARY", "OSIdList":selectOsList.toString()};
- changeInfoList.push(changeInfoItem);
-
- addProject(changeInfoList, function () {
- $.mobile.changePage("#adminProject");
- });
-}
-
+++ /dev/null
-/*
- admin-project-modify.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminProjectModifyBinaryProjectInit(projectId) {
- var projectName = $("#adminProject-binary-"+projectId+"-name").html();
- var projectStatus = $("#adminProject-binary-"+projectId+"-status").html();
- var packageName = $("#adminProject-binary-"+projectId+"-packageName").html();
-
- $("#adminProjectModifyBinary-save").attr("onClick", "");
- $("#adminProjectModifyBinary-id").val(projectId);
- $("#adminProjectModifyBinary-name").val(projectName);
- $("#adminProjectModifyBinary-packageName").val(packageName);
- $("#adminProjectModifyBinary-status").empty();
- $("#adminProjectModifyBinary-os").empty();
- $("#adminProjectModifyBinary-os").append("<legend> os list </legend>");
- $("#adminProjectModifyBinary-status").empty();
-
- var option;
- if(projectStatus.toUpperCase() == "OPEN") {
- option = '<option value="OPEN" selected="selected">OPEN</option>';
- } else {
- option = '<option value="OPEN">OPEN</option>';
- }
- $("#adminProjectModifyBinary-status").append(option);
-
- if(projectStatus.toUpperCase() == "CLOSE") {
- option = '<option value="CLOSE" selected="selected">CLOSE</option>';
- } else {
- option = '<option value="CLOSE">CLOSE</option>';
- }
- $("#adminProjectModifyBinary-status").append(option);
- $("#adminProjectModifyBinary-status").selectmenu();
- $("#adminProjectModifyBinary-status").selectmenu("refresh");
-
- queryAllOS( function (xml) {
- var osList = $(xml).find("Data").find("OS");
- var selectedOsList = [];
-
- var osListElement = document.getElementById("adminProject-binary-"+projectId+"-osList");
- for(var i = 0; i < osListElement.childNodes.length; i++)
- {
- selectedOsList.push(osListElement.childNodes[i].innerHTML);
- }
-
- osList.each(function(){
- var osId = $(this).find("Id").text();
- var osName = $(this).find("Name").text();
- var input;
- if(contains(selectedOsList, osName))
- {
- input = '<input type=checkbox id=adminProjectModifyBinary-os-checkbox-'+osId+' name=adminProjectModifyBinary-os-checkbox value='+osId+' checked=checked />';
- } else {
- input = '<input type=checkbox id=adminProjectModifyBinary-os-checkbox-'+osId+' name=adminProjectModifyBinary-os-checkbox value='+osId+' />';
-
- }
- var label = '<label for=adminProjectModifyBinary-os-checkbox-'+osId+'> '+osName+' <label>';
-
- $("#adminProjectModifyBinary-os").append(input);
- $("#adminProjectModifyBinary-os").append(label);
- });
-
- $("input[name='adminProjectModifyBinary-os-checkbox']").checkboxradio();
- $("#adminProjectModifyBinary-save").attr("onClick", "adminProjectModfyBinaryProject()");
- });
-}
-
-function adminProjectModifyGitProjectInit(projectId) {
- var projectName = $("#adminProject-git-"+projectId+"-name").html();
- var projectAddress = $("#adminProject-git-"+projectId+"-address").html();
- var projectBranch = $("#adminProject-git-"+projectId+"-branch").html();
- var projectStatus = $("#adminProject-git-"+projectId+"-status").html();
-
- $("#adminProjectModifyGit-save").attr("onClick", "");
- $("#adminProjectModifyGit-id").val(projectId);
- $("#adminProjectModifyGit-name").val(projectName);
- $("#adminProjectModifyGit-address").val(projectAddress);
- $("#adminProjectModifyGit-branch").val(projectBranch);
- $("#adminProjectModifyGit-status").empty();
- $("#adminProjectModifyGit-os").empty();
- $("#adminProjectModifyGit-os").append("<legend> os list </legend>");
- var option;
- if(projectStatus.toUpperCase() == "OPEN") {
- option = '<option value="OPEN" selected="selected">OPEN</option>';
- } else {
- option = '<option value="OPEN">OPEN</option>';
- }
- $("#adminProjectModifyGit-status").append(option);
-
- if(projectStatus.toUpperCase() == "CLOSE") {
- option = '<option value="CLOSE" selected="selected">CLOSE</option>';
- } else {
- option = '<option value="CLOSE">CLOSE</option>';
- }
- $("#adminProjectModifyGit-status").append(option);
- $("#adminProjectModifyGit-status").selectmenu();
- $("#adminProjectModifyGit-status").selectmenu("refresh");
-
- queryAllOS( function (xml) {
- var osList = $(xml).find("Data").find("OS");
- var selectedOsList = [];
-
- var osListElement = document.getElementById("adminProject-git-"+projectId+"-osList");
- for(var i = 0; i < osListElement.childNodes.length; i++)
- {
- selectedOsList.push(osListElement.childNodes[i].innerHTML);
- }
-
- osList.each(function(){
- var osId = $(this).find("Id").text();
- var osName = $(this).find("Name").text();
- var input;
- if(contains(selectedOsList, osName))
- {
- input = '<input type=checkbox id=adminProjectModifyGit-os-checkbox-'+osId+' name=adminProjectModifyGit-os-checkbox value='+osId+' checked=checked />';
- } else {
- input = '<input type=checkbox id=adminProjectModifyGit-os-checkbox-'+osId+' name=adminProjectModifyGit-os-checkbox value='+osId+' />';
-
- }
- var label = '<label for=adminProjectModifyGit-os-checkbox-'+osId+'> '+osName+' <label>';
-
- $("#adminProjectModifyGit-os").append(input);
- $("#adminProjectModifyGit-os").append(label);
- });
-
- $("input[name='adminProjectModifyGit-os-checkbox']").checkboxradio();
- $("#adminProjectModifyGit-save").attr("onClick", "adminProjectModfyGitProject()");
- });
-}
-
-function adminProjectModfyBinaryProject() {
- var changeInfoList = [];
- var changeInfoItem;
- var projectId = $("#adminProjectModifyBinary-id").val();
- var projectName = $("#adminProjectModifyBinary-name").val();
- var projectStatus = $("#adminProjectModifyBinary-status option:selected").val();
- var packageName = $("#adminProjectModifyBinary-packageName").val();
- var selectOsList = [];
-
- $("input[name='adminProjectModifyBinary-os-checkbox']:checked").each(function() {
- selectOsList.push($(this).val());
- });
-
- if(projectId == "" || projectName == "" || packageName == ""){
- alert("You must input full data");
- return;
- }
-
- changeInfoItem = {"Id":projectId, "Name":projectName, "ProjectStatus":projectStatus, "PackageName":packageName, "OSIdList":selectOsList.toString()};
- changeInfoList.push(changeInfoItem);
-
- modifyProject(changeInfoList, function () {
- $.mobile.changePage("#adminProject");
- });
-}
-
-function adminProjectModfyGitProject() {
- var distName = $("#adminProject-distribution-select option:selected").val();
- var changeInfoList = [];
- var changeInfoItem;
- var projectId = $("#adminProjectModifyGit-id").val();
- var projectName = $("#adminProjectModifyGit-name").val();
- var projectAddress = $("#adminProjectModifyGit-address").val();
- var projectBranch = $("#adminProjectModifyGit-branch").val();
- var projectStatus = $("#adminProjectModifyGit-status option:selected").val();
- var selectOsList = [];
-
- $("input[name='adminProjectModifyGit-os-checkbox']:checked").each(function() {
- selectOsList.push($(this).val());
- });
-
- if(projectId == "" || projectName == "" || projectAddress == "" || projectBranch == ""){
- alert("You must input full data");
- return;
- }
-
- changeInfoItem = {"Id":projectId, "Name":projectName, "ProjectAddress":projectAddress, "ProjectBranch":projectBranch, "ProjectStatus":projectStatus, "OSIdList":selectOsList.toString()};
- changeInfoList.push(changeInfoItem);
-
- modifyProject(changeInfoList, function () {
- $.mobile.changePage("#adminProject");
- });
-}
-
+++ /dev/null
-/*
- admin-project.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminProjectInit() {
- if( $("#adminProject-distribution-select").children().length == 0 ) {
- queryDistribution( function(xml) {
- $(xml).find("Data").find("Distribution").each(function(){
- var distId = $(this).find("Id").text();
- var distName = $(this).find("Name").text();
-
- $("#adminProject-distribution-select").append("<option value=\'"+distId+"\'>"+distName+"</option>");
- });
-
- /* default distribution selection */
- $("#adminProject-distribution-select option:eq(0)").attr("selected", "selected");
- $("#adminProject-distribution-select").selectmenu('refresh');
-
- // set project info
- adminProjectSetProjectInfo();
- });
- } else {
- // set project info
- adminProjectSetProjectInfo();
- }
-}
-
-function adminProjectSetProjectInfo() {
- var distId = $("#adminProject-distribution-select option:selected").val();
-
- queryProjectsInDistributionForAdmin( distId, function (xml) {
- var projectList = $(xml).find("Data").find("Project");
-
- // update project info
- adminProjectUpdateTable(projectList);
- });
-}
-
-function adminProjectRemoveProject(projectType, projectId) {
- var projectName = $("#adminProject-"+projectType+"-"+projectId+"-name").html();
-
- var r=confirm("Project ["+projectName+"] is removed!!!");
- if (r==false)
- {
- return;
- }
-
- var changeInfoList = [];
- var changeInfoItem;
- changeInfoItem = {"ProjectId":projectId};
- changeInfoList.push(changeInfoItem);
-
- removeProject(changeInfoList, function () {
- $.mobile.changePage("#adminProject");
- });
-}
-
-function adminProjectUpdateTable(projectList) {
- /* project table */
- var projectTable = document.getElementById("adminProject-git");
-
- /* binary project table */
- var binaryProjectTable = document.getElementById("adminProject-binary");
-
- /* remove all table rows */
- $("#adminProject-git").empty();
- $("#adminProject-binary").empty();
-
- // Project table header
- var tableHeader = "<tr><th>Project</th><th>Git repos</th><th>Branch</th><th>OS list</th><th>Status</th><th>Modify</th><th>Delete</th>";
- $("#adminProject-git").append(tableHeader);
-
- // Binary project table header
- var tableHeader = "<tr><th>Project</th><th>Package name</th><th>OS list</th><th>Status</th><th>Modify</th><th>Delete</th>";
-
- $("#adminProject-binary").append(tableHeader);
-
- var binaryProjectIdx = 1;
- // add project information
- projectList.each(function(){
- var id = $(this).find("Id").text();
- var name = $(this).find("Name").text();
- var type = $(this).find("Type").text();
- var projectStatus = $(this).find("ProjectStatus").text();
- var projectPassword = $(this).find("ProjectPassword").text();
- var osList = $(this).find("OS");
-
- if(type.toUpperCase() == "GIT")
- {
- var row = projectTable.insertRow(-1);
- var cell;
-
- cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('id',"adminProject-git-"+id+"-name");
- cell.innerHTML = name;
-
- cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('id',"adminProject-git-"+id+"-address");
- cell.innerHTML = $(this).find("GitRepos").text();
-
- cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('id',"adminProject-git-"+id+"-branch");
- cell.innerHTML = $(this).find("GitBranch").text();
-
- cell = row.insertCell(-1);
- div = adminProjectApendOsCell(osList, id, "git");
- cell.appendChild(div);
-
- cell = row.insertCell(-1);
- cell.setAttribute('id',"adminProject-git-"+id+"-status");
- cell.innerHTML = projectStatus;
-
- cell = row.insertCell(-1);
- var button = document.createElement('a');
- button.setAttribute('href','#adminProjectModifyGit');
- button.setAttribute('data-role','button');
- button.setAttribute('data-rel','dialog');
- button.setAttribute('data-mini','true');
- button.setAttribute('onClick','adminProjectModifyGitProjectInit(\"'+id+'\")');
- button.setAttribute('class','binaryProjectTableButton');
- button.innerHTML = " "
- cell.appendChild(button);
-
- cell = row.insertCell(-1);
- var button = document.createElement('input');
- button.setAttribute('type','button');
- button.setAttribute('data-mini','true');
- button.setAttribute('name',name);
- button.setAttribute('class','binaryProjectTableButton');
- button.setAttribute('onClick','adminProjectRemoveProject(\"git\"'+',\"'+id+'\"'+')');
- cell.appendChild(button);
- }
- else if (type.toUpperCase() == "BINARY")
- {
- var row = binaryProjectTable.insertRow(-1);
- var cell;
-
- cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('id',"adminProject-binary-"+id+"-name");
- cell.innerHTML = name;
-
- cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('id',"adminProject-binary-"+id+"-packageName");
- cell.innerHTML = $(this).find("PackageName").text();
-
- cell = row.insertCell(-1);
- div = adminProjectApendOsCell(osList, id, "binary");
- cell.appendChild(div);
-
- cell = row.insertCell(-1);
- cell.setAttribute('id',"adminProject-binary-"+id+"-status");
- cell.innerHTML = projectStatus;
-
- cell = row.insertCell(-1);
- var button = document.createElement('a');
- button.setAttribute('href','#adminProjectModifyBinary');
- button.setAttribute('data-role','button');
- button.setAttribute('data-inline','true');
- button.setAttribute('data-mini','true');
- button.setAttribute('data-rel','dialog');
- button.setAttribute('onClick','adminProjectModifyBinaryProjectInit(\"'+id+'\")');
- button.setAttribute('class','binaryProjectTableButton');
- cell.appendChild(button);
-
- cell = row.insertCell(-1);
- var button = document.createElement('input');
- button.setAttribute('type','button');
- button.setAttribute('class','binaryProjectTableButton');
- button.setAttribute('data-mini','true');
- button.setAttribute('name',name);
- button.setAttribute('onClick','adminProjectRemoveProject(\"binary\"'+',\"'+id+'\"'+')');
- cell.appendChild(button);
-
- binaryProjectIdx = binaryProjectIdx + 1;
- }
- else
- alert("Unknown project type");
-
- });
-
- $(".binaryProjectTableButton").button();
- $(".adminProject-OsList").collapsible();
-}
-
-function adminProjectApendOsCell(osList, projectId, projectType) {
-
- var div = document.createElement('div');
-
- div.setAttribute('data-role', 'collapsible');
- div.setAttribute('data-mini', 'true');
- div.setAttribute('data-content-theme', 'b');
- div.setAttribute('class', 'adminProject-OsList');
-
- var header = document.createElement('h3');
- header.innerHTML = "OS list";
- div.appendChild(header);
-
- var ul = document.createElement('ul');
- ul.setAttribute('id', 'adminProject-'+projectType+'-'+projectId+'-osList');
-
- // if osList does not exist then just return
- if (osList != undefined) {
- osList.each(function(){
- var item = document.createElement('li');
- item.innerHTML = $(this).text();
- ul.appendChild(item);
- });
- }
-
- div.appendChild(ul);
- return div;
-}
-
-function adminProjectAllProjectStatusChange(projectStatus) {
- var distId = $("#adminProject-distribution-select option:selected").val();
- var changeInfoList = [];
- var changeInfoItem;
-
- var r=confirm("All project status is changed to "+projectStatus+"!!!");
- if (r==false)
- {
- return;
- }
-
- changeInfoItem = {"DistId":distId, "ProjectStatus":projectStatus}
- changeInfoList.push(changeInfoItem);
-
- changeAllProjectStatus(changeInfoList, function () {
- $.mobile.changePage("#adminProject");
- });
-}
+++ /dev/null
-/*
- admin-server-add.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminServerAddSupportedOsInit() {
- queryAllOSCategory(function(xml){
- $(xml).find("Data").find("OsCategory").each(function(){
- var categoryId = $(this).find("Id").text();
- var categoryName = $(this).find("Name").text();
-
- $('#adminServer-AddSupportedOs-OsCategory').append("<option value=\'"+categoryId+"\'>"+categoryName+"</option>");
-
- $('#adminServer-AddSupportedOs-OsCategory').selectmenu('refresh');
- });
- });
-}
-
-function adminServerAddRemoteBuildServer() {
- var changeInfoList = [];
- var changeInfoItem;
-
- var address = $("#adminServer-AddRemoteBuildServer-Address").val();
- var description = $("#adminServer-AddRemoteBuildServer-Description").val();
-
- if(address == ""){
- alert("You must input server address");
- return;
- }
-
- changeInfoItem = {"Address":address, "Description":description};
- changeInfoList.push(changeInfoItem);
-
- addRemoteBuildServer(changeInfoList, function () {
- $("#adminServer-AddRemoteBuildServer-Address").val("");
- $("#adminServer-AddRemoteBuildServer-Description").val("");
-
- $.mobile.changePage("#adminServer");
- });
-}
-
-function adminServerAddSupportedOs() {
- var changeInfoList = [];
- var changeInfoItem;
-
- var osName = $("#adminServer-AddSupportedOs-name").val();
- var osCategoryId = $("#adminServer-AddSupportedOs-OsCategory option:selected").val();
-
- if(osName == "" || osCategoryId == ""){
- alert("You must input os name");
- return;
- }
-
- changeInfoItem = {"Name":osName, "OsCategoryId":osCategoryId};
- changeInfoList.push(changeInfoItem);
-
- addSupportedOS(changeInfoList, function () {
- // Remove select option
- $("#adminServer-AddSupportedOs-name").val("");
- $("#adminServer-AddSupportedOs-OsCategory").empty();
-
- $.mobile.changePage("#adminServer");
- });
-}
-
-function adminServerAddOSCategory() {
- var changeInfoList = [];
- var changeInfoItem;
-
- var categoryName = $("#adminServer-AddOsCategory-name").val();
-
- if(categoryName == ""){
- alert("You must input category name");
- return;
- }
-
- changeInfoItem = {"Name":categoryName};
- changeInfoList.push(changeInfoItem);
-
- addOSCategory(changeInfoList, function () {
- $("#adminServer-AddOsCategory-name").val("");
-
- $.mobile.changePage("#adminServer");
- });
-}
-
-function adminServerAddServerInfo() {
- var property = $("#adminServer-addServerInfo-property").val();
- var value = $("#adminServer-addServerInfo-value").val();
- var changeInfoList = [];
- var changeInfoItem;
-
- if(property == ""){
- alert("property is empty");
- return;
- }
-
- if(value == ""){
- alert("value is empty");
- return;
- }
-
- changeInfoItem = {"Property":property, "Value":value};
- changeInfoList.push(changeInfoItem);
-
- addServerInfo(changeInfoList, function () {
- $.mobile.changePage("#adminServer");
- });
-}
-
+++ /dev/null
-/*
- admin-server-modify.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminServerModifyServerInfoInit(configId) {
- $("#adminServer-modifyServerInfo-id").val(configId);
- $("#adminProjectModifyBinary-save").attr("onClick", "");
-
- queryServerConfig(configId, function(xml) {
- var property = $(xml).find("Data").find("Property").text();
- var value = $(xml).find("Data").find("Value").text();
-
- $("#adminServer-modifyServerInfo-property").val(property);
- $("#adminServer-modifyServerInfo-value").val(value);
- $("#adminProjectModifyBinary-save").attr("onClick", "adminServerModifyServerInfo()");
- });
-}
-
-function adminServerModifyRemoteBuildServerInit(serverId) {
- $("#adminServer-modifyRemoteBuildServer-id").val(serverId);
- $("#adminServer-modifyRemoteBuildServer-save").attr("onClick", "");
-
- queryRemoteBuildServer(serverId, function(xml) {
- var address = $(xml).find("Data").find("Address").text();
- var description = $(xml).find("Data").find("Description").text();
-
- $("#adminServer-modifyRemoteBuildServer-address").val(address);
- $("#adminServer-modifyRemoteBuildServer-description").val(description);
- $("#adminServer-modifyRemoteBuildServer-save").attr("onClick", "adminServerModifyRemoteBuildServer()");
- });
-
-}
-
-function adminServerModifySupportedOSInit(osId) {
- $("#adminServer-ModifySupportedOs-OsCategory").empty();
- $("#adminServer-ModifySupportedOs-id").val(osId);
- $("#adminServer-ModifySupportedOs-save").attr("onClick", "");
-
- querySupportedOS(osId, function(xml) {
- var name = $(xml).find("Data").find("Name").text();
- var category = $(xml).find("Data").find("CategoryId").text();
-
- $("#adminServer-MoidfySupportedOs-name").val(name);
-
- queryAllOSCategory( function(xml){
- $(xml).find("Data").find("OsCategory").each(function(){
- var categoryId = $(this).find("Id").text();
- var categoryName = $(this).find("Name").text();
- var option = ""
-
- if(categoryId == category) {
- option = '<option value="'+categoryId+'" selected="selected">'+categoryName+'</option>'
- } else {
- option = '<option value="'+categoryId+'">'+categoryName+'</option>'
- }
-
- $('#adminServer-ModifySupportedOs-OsCategory').append(option);
- $('#adminServer-ModifySupportedOs-OsCategory').selectmenu("refresh");
- $("#adminServer-ModifySupportedOs-save").attr("onClick", "adminServerModifySupportedOS()");
- });
- });
- });
-}
-
-function adminServerModifyRemoteBuildServer() {
- var changeInfoList = [];
- var changeInfoItem;
- var id = $("#adminServer-modifyRemoteBuildServer-id").val();
- var address = $("#adminServer-modifyRemoteBuildServer-address").val();
- var description = $("#adminServer-modifyRemoteBuildServer-description").val();
-
- if(id == "" || address == ""){
- alert("server infomation is invalid");
- return;
- }
-
- changeInfoItem = {"Id":id, "Address":address, "Description":description};
- changeInfoList.push(changeInfoItem);
-
- modifyRemoteBuildServer(changeInfoList, function () {
- $.mobile.changePage("#adminServer");
- });
-}
-
-function adminServerModifySupportedOS() {
- var changeInfoList = [];
- var changeInfoItem;
- var id = $("#adminServer-ModifySupportedOs-id").val();
- var name = $("#adminServer-MoidfySupportedOs-name").val();
- var osCategory = $("#adminServer-ModifySupportedOs-OsCategory option:selected").val();
-
- changeInfoItem = {"Id":id, "Name":name, "OsCategoryId":osCategory};
- changeInfoList.push(changeInfoItem);
-
- modifySupportedOS(changeInfoList, function () {
- $.mobile.changePage("#adminServer");
- });
-}
-
-function adminServerModifyServerInfo() {
- var id = $("#adminServer-modifyServerInfo-id").val();
- var property = $("#adminServer-modifyServerInfo-property").val();
- var value = $("#adminServer-modifyServerInfo-value").val();
- var changeInfoList = [];
- var changeInfoItem;
-
- if(id == ""){
- alert("info data is invalid");
- return;
- }
-
- if(property == ""){
- alert("property is empty");
- return;
- }
-
- if(value == ""){
- alert("value is empty");
- return;
- }
-
- changeInfoItem = {"Id":id, "Property":property, "Value":value};
- changeInfoList.push(changeInfoItem);
-
- modifyServerInfo(changeInfoList, function () {
- $.mobile.changePage("#adminServer");
- });
-}
-
+++ /dev/null
-/*
- admin-server-remove.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminServerRemoveOSCategoryInit() {
- // Remove select option
- $('#adminServer-RemoveOSCategory-CategorySelect').empty();
-
- queryAllOSCategory(function(xml){
- $(xml).find("Data").find("OsCategory").each(function(){
- var categoryId = $(this).find("Id").text();
- var categoryName = $(this).find("Name").text();
-
- $('#adminServer-RemoveOSCategory-CategorySelect').append("<option value=\'"+categoryId+"\'>"+categoryName+"</option>");
-
- });
- });
-
- $('#adminServer-RemoveOSCategory-CategorySelect').selectmenu('refresh');
-}
-
-function adminServerRemoveOSCategory() {
- var changeInfoList = [];
- var changeInfoItem;
- var osCategoryId = $("#adminServer-RemoveOSCategory-CategorySelect option:selected").val();
-
- if(osCategoryId == ""){
- alert("Os category is invalid");
- return;
- }
-
- changeInfoItem = {"Id":osCategoryId};
- changeInfoList.push(changeInfoItem);
-
- removeOSCategory(changeInfoList, function () {
- $.mobile.changePage("#adminServer");
- });
-}
-
-function adminServerRemoveSupportedOS() {
- var changeInfoList = [];
- var changeInfoItem;
- var id = $('#adminServer-ModifySupportedOs-id').val();
-
- changeInfoItem = {"Id":id};
- changeInfoList.push(changeInfoItem);
-
- removeSupportedOS(changeInfoList, function () {
- $.mobile.changePage("#adminServer");
- });
-}
-
-function adminServerRemoveServerInfo() {
- var property = $('#adminServer-modifyServerInfo-property').val();
- var changeInfoList = [];
- var changeInfoItem;
-
- if(property == ""){
- alert("property is empty");
- return;
- }
-
- changeInfoItem = {"Property":property};
- changeInfoList.push(changeInfoItem);
-
- removeServerInfo(changeInfoList, function () {
- $.mobile.changePage("#adminServer");
- });
-}
-
-function adminServerRemoveRemoteBuildServer() {
- var changeInfoList = [];
- var changeInfoItem;
- var serverId = $('#adminServer-modifyRemoteBuildServer-id').val();
-
- if(serverId == ""){
- alert("server address is invalid");
- return;
- }
-
- changeInfoItem = {"Id":serverId};
- changeInfoList.push(changeInfoItem);
-
- removeRemoteBuildServer(changeInfoList, function () {
- $.mobile.changePage("#adminServer");
- });
-}
-
+++ /dev/null
-/*
- admin-server.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminServerInit() {
- $('#adminServer-RemoteBuildServer').collapsible();
-
- queryAllServer( function (xml) {
- var serverConfig = $(xml).find("Data").find("ServerConfig");
- var buildServerList = $(xml).find("Data").find("RemoteBuildServer");
- var syncPackageServerList = $(xml).find("Data").find("SyncPackageServer");
- adminServerInitServerInfo(serverConfig);
- adminServerRemoteInitRemoteBuildServer(buildServerList);
- });
-
- queryAllOS( function (xml) {
- $("#adminServer-SupportedOS").empty();
-
- $(xml).find("Data").find("OS").each(function(){
- var id = $(this).find("Id").text();
- var name = $(this).find("Name").text();
- var categoryId = $(this).find("CategoryId").text();
- var categoryName = $(this).find("CategoryName").text();
-
- var li = '<li><a href="#adminServerModifySupportedOS" ';
- li += 'onClick="adminServerModifySupportedOSInit(\''+id+'\')" ';
- li += 'data-rel="dialog">';
- li += '<h3>'+name+'</h3>';
- li += '<p>OS category : '+categoryName+'</p>';
- li += '</a></li>';
-
- $("#adminServer-SupportedOS").append(li);
- });
-
- $("#adminServer-SupportedOS").listview('refresh');
- });
-}
-
-function adminServerInitServerInfo(serverConfig){
- $("#adminServer-ServerInfo").empty();
-
- serverConfig.each(function(){
- var id = $(this).find("Id").text();
- var property = $(this).find("Property").text();
- var value = $(this).find("Value").text();
-
- var li = '<li><a href="#adminServerModifyServerInfo" ';
- li += 'onClick="adminServerModifyServerInfoInit('+id+')" ';
- li += 'data-rel="dialog">';
- li += '<p>'+property+' : '+value+'</p>';
- li += '</a></li>';
- $("#adminServer-ServerInfo").append(li);
- });
-
- $("#adminServer-ServerInfo").listview('refresh');
-}
-
-function adminServerRemoteInitRemoteBuildServer(serverList){
- $("#adminServer-RemoteBuildServer").empty();
-
- serverList.each(function(){
- var id = $(this).find("Id").text();
- var address = $(this).find("Address").text();
- var description = $(this).find("Description").text();
-
- var li = '<li><a href="#adminServerModifyRemoteBuildServer" ';
- li += 'onClick="adminServerModifyRemoteBuildServerInit(\''+id+'\')" ';
- li += 'data-rel="dialog">';
- li += '<h3>'+address+'</h3>';
- li += '<p>Description : '+$(this).find("Description").text()+'</p>';
- li += '<br><p>Runtime infomation</p>';
- li += '<p>Status: '+$(this).find("Status").text()+'</p>';
- li += '<p>Supported OS: '+$(this).find("SupportedOS").text()+'</p>';
- li += '<p>Max job count: '+$(this).find("MaxJobCount").text()+'</p>';
- li += '<p>Working job count: '+$(this).find("WorkingJobCount").text()+'</p>';
- li += '<p>Waiting job count: '+$(this).find("WaitingJobCount").text()+'</p>';
- li += '</a></li>';
-
- $("#adminServer-RemoteBuildServer").append(li);
- });
-
- $("#adminServer-RemoteBuildServer").listview('refresh');
-}
+++ /dev/null
-/*
- admin-user-modify.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminUserModifyInit(userId) {
- var name = $("#adminUser-contents-"+userId+"-name").html();
- var email = $("#adminUser-contents-"+userId+"-email").html();
-
- $("#adminUserModify-id").val(userId);
- $("#adminUserModify-name").val(name);
- $("#adminUserModify-email").val(email);
- $("#adminUserModify-save").attr("onClick", "");
-
- queryUserInfoForAdmin(userId, function(xml) {
- var fullGroupList = $(xml).find("Data").find("GroupInfo").find("Group");
- var userGroupIdList = $(xml).find("Data").find("GroupInfo").find("GroupIdList").text().split(",");
-
- adminUserModifyGenerateGroupSelect(fullGroupList, userGroupIdList);
- $("#adminUserModify-save").attr("onClick", "adminUserModify()");
- });
-}
-
-function adminUserModifyGenerateGroupSelect(fullGroupList, userGroupIdList) {
- $("#adminUserModify-group").empty();
- fullGroupList.each(function(){
- var groupName = $(this).find("Name").text();
- var groupId = $(this).find("Id").text();
-
- var input;
- if(contains(userGroupIdList, groupId))
- {
- input = '<input type=checkbox id=adminUserModify-group-checkbox-'+groupId+' name=adminUserModify-group-checkbox value='+groupId+' checked=checked />';
- } else {
- input = '<input type=checkbox id=adminUserModify-group-checkbox-'+groupId+' name=adminUserModify-group-checkbox value='+groupId+' />';
-
- }
- var label = '<label for=adminUserModify-group-checkbox-'+groupId+'> '+groupName+'<label>';
-
- $("#adminUserModify-group").append(input);
- $("#adminUserModify-group").append(label);
- });
-
- $("input[name='adminUserModify-group-checkbox']").checkboxradio();
-}
-
-
-function adminUserModify() {
- var changeInfoList = [];
- var changeInfoItem;
- var id = $("#adminUserModify-id").val();
- var name = $("#adminUserModify-name").val();
- var email = $("#adminUserModify-email").val();
- var selectGroupList = [];
-
- $("input[name='adminUserModify-group-checkbox']:checked").each(function() {
- selectGroupList.push($(this).val());
- });
-
- changeInfoItem = {"Type":"ModifyUser", "Id":id, "Email":email, "Name":name, "GroupIdList":selectGroupList.toString()};
- changeInfoList.push(changeInfoItem);
-
- changeUser(changeInfoList, function () {
- });
-}
-
-function adminUserResetPassword() {
- if(confirm('Are you sure reset password?')) {
- var changeInfoList = [];
- var changeInfoItem;
- var id = $("#adminUserModify-id").val();
- var email = $("#adminUserModify-email").val();
-
- changeInfoItem = {"Type":"Reset password", "Id":id, "Email":email};
- changeInfoList.push(changeInfoItem);
-
- resetPasswordUser(changeInfoList, function () {
- alert('Password is "'+email+'"');
- });
- }
- else {
- return -1;
- }
-}
+++ /dev/null
-/*
- admin-user.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function adminUserInit() {
- $("#adminUser-contents").empty();
-
- /* create table header */
- var tableHeader = "<tr><th>User name</th><th>Email</th><th>Group</th><th>Modify</th><th>Delete</th></tr>";
- $("#adminUser-contents").append(tableHeader);
-
- queryAllUser( function(xml) {
- var userList = $(xml).find("Data").find("User");
-
- adminUserFillTable(userList);
- });
-}
-
-function adminUserFillTable(userList) {
- var userTable = document.getElementById("adminUser-contents");
-
- userList.each(function(){
- var row = userTable.insertRow(-1);
- var cell;
- var userId = $(this).find("Id").text();
- var userName = $(this).find("Name").text();
- var groupList = $(this).find("GroupName");
- var email = $(this).find("Email").text();
-
- cell = row.insertCell(-1);
- cell.setAttribute('id',"adminUser-contents-"+userId+"-name");
- cell.innerHTML = userName;
-
- cell = row.insertCell(-1);
- cell.setAttribute('id',"adminUser-contents-"+userId+"-email");
- cell.innerHTML = email;
-
- cell = row.insertCell(-1);
- div = adminUserGenerateGroupListCell(groupList);
- cell.appendChild(div);
-
- cell = row.insertCell(-1);
- var button = document.createElement('a');
- button.setAttribute('href','#adminUserModify');
- button.setAttribute('data-role','button');
- button.setAttribute('data-rel','dialog');
- button.setAttribute('data-mini','ture');
- button.setAttribute('class','adminUser-contentsButton');
- button.setAttribute('onClick','adminUserModifyInit('+userId+')');
- button.innerHTML = " "
- cell.appendChild(button);
-
- cell = row.insertCell(-1);
- var button = document.createElement('input');
- button.setAttribute('type','button');
- button.setAttribute('name',email);
- button.setAttribute('data-mini','ture');
- button.setAttribute('class','adminUser-contentsButton');
- button.setAttribute('onClick','adminUserRemoveUser('+userId+')');
- cell.appendChild(button);
- });
-
- $(".adminUser-groupList").collapsible();
- $(".adminUser-contentsButton").button();
-}
-
-function adminUserGenerateGroupListCell(groupList) {
- var div = document.createElement('div');
-
- groupList.each(function(){
- var item = document.createElement('li');
- item.innerHTML = $(this).text();
- div.appendChild(item);
- });
- return div;
-}
-
-function adminUserRemoveUser(userId) {
- var email = $("#adminUser-contents-"+userId+"-email").html();
-
- var r=confirm("User ["+email+"] is removed!!!");
- if (r==false)
- {
- return;
- }
-
- var changeInfoList = [];
- var changeInfoItem;
- changeInfoItem = {"Type":"RemoveUser", "Id":userId};
- changeInfoList.push(changeInfoItem);
-
- removeUser(changeInfoList, function () {
- $.mobile.changePage("#adminUser");
- });
-}
-
+++ /dev/null
-// This is a manifest file that'll be compiled into application.js, which will include all the files
-// listed below.
-//
-// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
-// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
-//
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// the compiled file.
-//
-// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
-// GO AFTER THE REQUIRES BELOW.
-//
-//= require jquery
-//= require jquery_ujs
-//= require_tree .
+++ /dev/null
-/*
- build.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function buildInit() {
- if( $("#build-distribution-select").children().length == 0 ) {
- queryDistribution( function(xml) {
- $(xml).find("Data").find("Distribution").each(function(){
- var id = $(this).find("Id").text();
- var name = $(this).find("Name").text();
-
- $("#build-distribution-select").append("<option value=\'"+id+"\'>"+name+"</option>");
- });
-
- /* default distribution selection */
- defualt_dist_id = buildGetCookieDistribution();
- $("#build-distribution-select").val(defualt_dist_id);
- $("#build-distribution-select").selectmenu('refresh');
-
- // query Project list
- buildQueryProjectList();
-
- // add batch file selector event
- //buildBatchFilePathSelector();
- });
- } else {
- // query Project list
- buildQueryProjectList();
-
- // add batch file selector event
- //buildBatchFilePathSelector();
- }
-}
-
-function buildQueryProjectList() {
- var distId = $("#build-distribution-select option:selected").val();
-
- buildSetCookieDistribution(distId);
-
- queryProjectsInDistribution( distId, function(xml) {
- $("#build-git-table").empty();
- $("#build-binary-table").empty();
-
- var xmlBody = $(xml).find("Data");
- var distributionStatus = xmlBody.find("BuildServerInfo").find("DistributionStatus").text();
- if (distributionStatus == "CLOSE") {
- var distributionLock = document.getElementById("build-distribution-lock");
- distributionLock.innerHTML = '<p> Distribution is locked </p>';
- } else {
- var distributionLock = document.getElementById("build-distribution-lock");
- distributionLock.innerHTML = '';
- }
-
- buildAddGitTableRow( xmlBody.find("BuildServerInfo").find("SupportedOs"),
- distributionStatus,
- xmlBody.find("Project"),
- xmlBody.find("OtherProject"));
- buildAddBinaryTableRow( distributionStatus,
- xmlBody.find("BinaryProject"),
- xmlBody.find("OtherBinaryProject"));
- });
-}
-
-function buildSelectAll(id, flag) {
- var checkboxes = document.getElementsByName('buildGitProjectTable-checkbox-'+id);
- for(var i in checkboxes) {
- if(!checkboxes[i].disabled) {
- checkboxes[i].checked = flag;
- }
- }
-}
-
-function contains(a, obj) {
- for (var i = 0; i < a.length; i++) {
- if (a[i] == obj) {
- return true;
- }
- }
- return false;
-}
-
-function buildAddGitTableRow(supportedOs, distributionStatus, projectList, otherProjectList) {
- // Table header
- var idx = 0;
- var tableHeader = "";
- var osArray = new Array();
- var projectTable = document.getElementById("build-git-table");
-
- // Project table header
- tableHeader = "<tr><th>Project</th>";
- supportedOs.each(function(){
- var osId = $(this).find("Id").text();
- var osName = $(this).find("Name").text();
- tableHeader = tableHeader + "<th>"+osName+"</th>";
-
- osArray[idx] = osId;
- idx++;
- });
-
- tableHeader = tableHeader + "<th>ALL</th></tr>";
- $("#build-git-table").append(tableHeader);
-
- // table row - projectList
- projectList.each(function(){
- var id = $(this).find("Id").text();
- var name = $(this).find("Name").text();
- var projectOsArray = $(this).find("OsList").text().split(",");
- var projectStatus = $(this).find("Status").text();
- var buildAvailable = true;
-
- var row = projectTable.insertRow(-1);
-
- var cell = row.insertCell(0);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('bgcolor', '#dcddc0');
- cell.innerHTML = name;
-
- if (distributionStatus == "CLOSE" || projectStatus == "CLOSE") {
- buildAvailable = false;
- }
-
- buildAddBinaryTableCell(id, osArray, projectOsArray, buildAvailable, row);
- });
-
- otherProjectList.each(function(){
- var id = $(this).find("Id").text();
- var name = $(this).find("Name").text();
- var row = projectTable.insertRow(-1);
-
- var cell = row.insertCell(0);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('bgcolor', '#c0c0c0');
- cell.innerHTML = name;
-
- buildAddBinaryTableCell(id, osArray, "", false, row);
- });
-}
-
-function buildAddBinaryTableRow(distributionStatus, binaryProjectList, otherProjectList) {
- var binaryProjectTable = document.getElementById("build-binary-table");
- var row = binaryProjectTable.insertRow(-1);
- var thCell = document.createElement('th');
- thCell.innerHTML = "Project";
- row.appendChild(thCell);
- thCell = document.createElement('th');
- thCell.innerHTML = "Package name";
- row.appendChild(thCell);
- thCell = document.createElement('th');
- thCell.innerHTML = "Register";
- row.appendChild(thCell);
-
- /* insert binary project in binary project table */
- binaryProjectList.each(function(){
- var id = $(this).find("Id").text();
- var name = $(this).find("Name").text();
- var projectStatus = $(this).find("Status").text();
- var packageName = $(this).find("PackageName").text();
- var row = '<tr><td bgcolor="#dcddc0" style="text-align:left">'+name+'</td>';
- row += '<td bgcolor="#dcddc0" style="text-align:left">' + packageName + '</td>'
- if (distributionStatus == "CLOSE" || projectStatus == "CLOSE") {
- row += '<td bgcolor="#c0c0c0" style="text-align:left"></td>';
- } else {
- row += '<td bgcolor="#dcddc0" style="text-align:left"><a href="upload.html" onClick="buildUploadBinaryName(\'' +id+'\')" class="binary_project_button" data-role="button" data-ajax="false" data-mini="true">REGISTER</a>';
- }
- row += '</tr>'
-
- $("#build-binary-table tr:last").after(row);
- });
-
- otherProjectList.each(function(){
- var name = $(this).find("Name").text();
- var packageName = $(this).find("PackageName").text();
- var row = binaryProjectTable.insertRow(-1);
-
- /* add project name */
- var cell = row.insertCell(0);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('bgcolor', '#c0c0c0');
- cell.innerHTML = name;
-
- /* add package name */
- cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('bgcolor', '#c0c0c0');
- cell.innerHTML = packageName;
-
- /* add empty cell for register */
- cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('bgcolor', '#c0c0c0');
- cell.innerHTML = "";
- });
-
- $('.binary_project_button').button();
- $('.binary_project_button').popupWindow({
- height:200,
- width:400,
- top:50,
- left:50
- });
-}
-
-function buildAddBinaryTableCell(projectId, osArray, projectOsArray, buildAvailable, row) {
- for (i=0;i<osArray.length;i++)
- {
- var cell = row.insertCell(-1);
- var osId = osArray[i];
-
- cell.setAttribute('id', "buildGitProjectTable-"+projectId+"-"+osId);
- cell.setAttribute('style', 'text-align: center');
- if (buildAvailable) {
- /* add cell with build checkbox */
- cell.setAttribute('bgcolor', '#dcddc0');
-
- var buttonnode = document.createElement('input');
- buttonnode.setAttribute('type','checkbox');
- buttonnode.setAttribute('id','buildGitProjectTable-checkbox-'+projectId+'-'+osId);
- buttonnode.setAttribute('name','buildGitProjectTable-checkbox-'+projectId);
- buttonnode.setAttribute('class','projectTableBuildButton');
- cell.appendChild(buttonnode);
-
- if(!contains(projectOsArray, osId))
- {
- buttonnode.setAttribute('disabled','disabled');
- }
- } else {
- /* add empty cell for status */
- cell.setAttribute('bgcolor', '#c0c0c0');
- cell.innerHTML = "";
- }
- }
-
- if (buildAvailable) {
- /* append all checkbox */
- var cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: center');
- cell.setAttribute('bgcolor', '#dcddc0');
-
- var buttonnode = document.createElement('input');
- buttonnode.setAttribute('type','checkbox');
- buttonnode.setAttribute('id','buildGitProjectTable-all-checkbox'+projectId);
- buttonnode.setAttribute('name','all-checkbox');
- buttonnode.setAttribute('class','projectTableAllButton');
- buttonnode.setAttribute('onClick','buildSelectAll(\''+projectId+'\', this.checked)');
- cell.appendChild(buttonnode);
- } else {
- /* add empty cell for all*/
- cell = row.insertCell(-1);
- cell.setAttribute('style', 'text-align: left');
- cell.setAttribute('bgcolor', '#c0c0c0');
- cell.innerHTML = "";
- }
-}
-
-function buildBuildProject() {
- var distId = $("#build-distribution-select option:selected").val();
- var checkedBuildButton = $(".projectTableBuildButton:checked");
- var buildProjectList = [];
-
- checkedBuildButton.each(function(index){
- var name = $(this).attr("id");
- var projectId = name.split("-")[2];
- var osId = name.split("-")[3];
- var buildData = { "distId":distId, "projectId" : projectId, "osId" : osId};
- buildProjectList.push(buildData);
- });
-
- buildProject(buildProjectList, function (json) {
- if(json.result != "SUCCESS") {
- if(json.error != "") {
- alert(json.message);
- }
- else {
- alert("Build request fail!");
- }
- }
- else {
- $.mobile.changePage("#jobs");
- }
- });
-}
-
-function buildUploadBinaryName(project_id) {
- localStorage.uploadBinaryProjectId = project_id;
-}
-
-function buildBatchFilePathSelector() {
- var files, file, extension;
- var filePath = document.getElementById("buildBatchFileUploadPath");
- var filePathOutputList = document.getElementById("buildBatchFileList");
-
- filePath.addEventListener("change", function(e) {
- files = e.target.files;
- filePathOutputList.innerHTML = "";
-
- for (var i = 0, len = files.length; i < len; i++) {
- file = files[i];
- alert(file.webkitRelativePath);
- filePathOutputList.innerHTML += "<li style='font-size:12px'>" + file.name + "</li>";
- }
- }, false);
-}
-
-function buildClear() {
- $("#build-distribution-select").empty();
- $("#build-git-table").empty();
- $("#build-binary-table").empty();
-}
-
-function buildSetCookieDistribution(id)
-{
- saveCookie("build_distribution", id, 7);
-}
-
-function buildGetCookieDistribution()
-{
- id = getCookie("build_distribution");
- if(id == "") {
- id = 0;
- }
- return id;
-}
+++ /dev/null
-/*
- dibs-api.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-// controller: Users
-function signUp(infoList, successFunction) {
- var url = 'users/signup';
- postForServer(url, infoList, successFunction);
-}
-
-function queryUserInfo(successFunction) {
- var url = 'users/query';
- getInfoFromServer(url, successFunction);
-}
-
-function modifyUserInfo(changeInfoList, successFunction) {
- var url = 'users/modify';
- postForServer(url, changeInfoList, successFunction);
-}
-
-// controller: Sessions
-function login(infoList, successFunction) {
- var url = 'sessions/login';
- postForServer(url, infoList, successFunction);
-}
-
-function logout() {
- var url = 'sessions/logout';
- deleteForServer(url, function() {
- expireSession();
- dibsWebClear();
- });
-}
-
-// controller: projects
-function queryDistribution(successFunction) {
- var url = 'projects/queryDistribution';
- getInfoFromServer(url, successFunction);
-}
-
-function queryAllDistribution(successFunction) {
- var url = 'projects/queryAllDistribution';
- getInfoFromServer(url, successFunction);
-}
-
-function queryAllProjectInOpenStatus(successFunction) {
- var url = 'projects/queryAllProjectInOpenStatus';
- getInfoFromServer(url, successFunction);
-}
-
-function buildProject(changeInfoList, successFunction) {
- var url = 'projects/buildProject';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function queryProjectsInDistribution(distId, successFunction) {
- var url = 'projects/queryProjectsInDistribution/' + distId;
- getInfoFromServer(url, successFunction);
-}
-
-function queryProjectsInfoInDistribution(distId, successFunction) {
- var url = 'projects/queryProjectsInfoInDistribution/' + distId;
- getInfoFromServer(url, successFunction);
-}
-
-// controller : jobs
-function queryJobsList(url, successFunction) {
- return getInfoFromServer(url, successFunction);
-}
-function updateList(data, successFunction) {
- var url = "jobs/update";
- var param = $.param(data);
- return getInfoFromServerData(url, param, successFunction);
-}
-function queryJobsLog(job_id, next_line, successFunction) {
- var url = "jobs/log/"+ job_id + "/" + next_line;
- getInfoFromServerNoPreProcess(url, successFunction);
-}
-function cancelJobsJobid(job_id, successFunction) {
- var url = "jobs/cancel/"+ job_id;
- getInfoFromServerNoPreProcess(url, successFunction);
-}
-
-// controller : admin_group
-function queryAllGroup(successFunction) {
- var url = 'admin_group/queryAllGroup';
- getInfoFromServer(url, successFunction);
-}
-
-function queryGroupInfo(groupId, successFunction) {
- var url = 'admin_group/queryGroupInfo/' + groupId;
- getInfoFromServer(url, successFunction);
-}
-
-function addGroup(changeInfoList, successFunction) {
- var url = 'admin_group/addGroup';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function removeGroup(changeInfoList, successFunction) {
- var url = 'admin_group/removeGroup';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function changeGroup(changeInfoList, successFunction) {
- var url = 'admin_group/modifyGroup';
- postForServer(url, changeInfoList, successFunction);
-}
-
-// controller : admin_user
-function queryAllUser(successFunction) {
- var url = 'admin_user/queryAllUser';
- getInfoFromServer(url, successFunction);
-}
-
-function queryUserInfoForAdmin(email, successFunction) {
- var url = 'admin_user/queryUserInfo/' + email;
- getInfoFromServer(url, successFunction);
-}
-
-function changeUser(changeInfoList, successFunction) {
- var url = 'admin_user/modifyUser';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function resetPasswordUser(changeInfoList, successFunction) {
- var url = 'admin_user/resetUser';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function removeUser(changeInfoList, successFunction) {
- var url = 'admin_user/removeUser';
- postForServer(url, changeInfoList, successFunction);
-}
-
-// controller : admin_server
-function queryAllServer(successFunction) {
- var url = 'admin_server/queryAllServer';
- getInfoFromServer(url, successFunction);
-}
-
-function queryServerConfig(configId, successFunction) {
- var url = 'admin_server/queryServerConfig/' + configId;
- getInfoFromServer(url, successFunction);
-}
-
-function queryRemoteBuildServer(serverId, successFunction) {
- var url = 'admin_server/queryRemoteBuildServer/' + serverId;
- getInfoFromServer(url, successFunction);
-}
-
-function querySupportedOS(osId, successFunction) {
- var url = 'admin_server/querySupportedOS/' + osId;
- getInfoFromServer(url, successFunction);
-}
-
-function addRemoteBuildServer(changeInfoList, successFunction) {
- var url = 'admin_server/addRemoteBuildServer';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function removeRemoteBuildServer(changeInfoList, successFunction) {
- var url = 'admin_server/removeRemoteBuildServer';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function modifyRemoteBuildServer(changeInfoList, successFunction) {
- var url = 'admin_server/modifyRemoteBuildServer';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function addOSCategory(changeInfoList, successFunction) {
- var url = 'admin_server/addOSCategory';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function removeOSCategory(changeInfoList, successFunction) {
- var url = 'admin_server/removeOSCategory';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function modifyOSCategory(changeInfoList, successFunction) {
- var url = 'admin_server/modifyOSCategory';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function addSupportedOS(changeInfoList, successFunction) {
- var url = 'admin_server/addSupportedOS';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function removeSupportedOS(changeInfoList, successFunction) {
- var url = 'admin_server/removeSupportedOS';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function modifySupportedOS(changeInfoList, successFunction) {
- var url = 'admin_server/modifySupportedOS';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function addServerInfo(changeInfoList, successFunction) {
- var url = 'admin_server/addServerInfo';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function removeServerInfo(changeInfoList, successFunction) {
- var url = 'admin_server/removeServerInfo';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function modifyServerInfo(changeInfoList, successFunction) {
- var url = 'admin_server/modifyServerInfo';
- postForServer(url, changeInfoList, successFunction);
-}
-
-// controller : admin_project
-function queryProjectsInDistributionForAdmin(distId, successFunction) {
- var url = 'admin_project/queryProjectsInDistributionForAdmin/' + distId;
- getInfoFromServer(url, successFunction);
-}
-
-function addProject(changeInfoList, successFunction) {
- var url = 'admin_project/addProject';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function removeProject(changeInfoList, successFunction) {
- var url = 'admin_project/removeProject';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function modifyProject(changeInfoList, successFunction) {
- var url = 'admin_project/modifyProject';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function changeAllProjectStatus(changeInfoList, successFunction) {
- var url = 'admin_project/changeAllProjectStatus';
- postForServer(url, changeInfoList, successFunction);
-}
-
-// controller : admin_distribution
-function queryDistributionInfo(distId, successFunction) {
- var url = 'admin_distribution/queryDistributionInfo/' + distId;
- getInfoFromServer(url, successFunction);
-}
-
-function addDistribution(changeInfoList, successFunction) {
- var url = 'admin_distribution/addDistribution';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function removeDistribution(changeInfoList, successFunction) {
- var url = 'admin_distribution/removeDistribution';
- postForServer(url, changeInfoList, successFunction);
-}
-
-function modifyDistribution(changeInfoList, successFunction) {
- var url = 'admin_distribution/modifyDistribution';
- postForServer(url, changeInfoList, successFunction);
-}
-
-// controller : admin
-function queryAllOS(successFunction) {
- var url = 'admin/queryAllOS';
- getInfoFromServer(url, successFunction);
-}
-
-function queryAllOSCategory(successFunction) {
- var url = 'admin/queryAllOSCategory';
- getInfoFromServer(url, successFunction);
-}
-
-function getInfoFromServer(url, successFunction) {
- return $.ajax({
- url: baseUrl+url,
- type: 'GET',
- dataType: 'xml',
- timeout: 30000,
- beforeSend: function() { $.mobile.showPageLoadingMsg(); }, //Show spinner
- complete: function() { $.mobile.hidePageLoadingMsg() }, //Hide spinner
- success: function(xml) {
- setSessionInfo(xml);
- successFunction(xml);
- },
- error: function(jqXHR) {
- errorProcess(jqXHR);
- }
- });
-}
-
-function getInfoFromServerNoPreProcess(url, successFunction) {
- return $.ajax({
- url: baseUrl+url,
- type: 'GET',
- dataType: 'xml',
- timeout: 30000,
- success: function(xml) {
- setSessionInfo(xml);
- successFunction(xml);
- },
- error: function(jqXHR) {
- errorProcess(jqXHR);
- }
- });
-}
-
-function getInfoFromServerData(url, data, successFunction) {
- return $.ajax({
- url: baseUrl+url,
- type: 'GET',
- dataType: 'xml',
- text: 'JSONP',
- data: data,
- timeout: 300000,
- success: function(xml) {
- setSessionInfo(xml);
- successFunction(xml);
- },
- error: function(jqXHR) {
- errorProcess(jqXHR);
- }
- });
-}
-
-function postForServer(url, changeInfoList, successFunction) {
- $.ajax({
- url: baseUrl+url,
- type: 'POST',
- data: JSON.stringify({ ChangeInfoList: changeInfoList }),
- dataType: 'json',
- contentType: "application/json; charset=utf-8",
- timeout: 3600000,
- beforeSend: function() { $.mobile.showPageLoadingMsg(); }, //Show spinner
- complete: function() { $.mobile.hidePageLoadingMsg(); }, //Hide spinner
- success: function(xml) {
- successFunction(xml);
- },
- error: function(jqXHR) {
- errorProcess(jqXHR);
- }
- });
-}
-
-function deleteForServer(url, successFunction) {
- $.ajax({
- url: baseUrl+url,
- type: 'DELETE',
- async: false,
- cache: false,
- dataType: 'xml',
- timeout: 1000,
- beforeSend: function() { $.mobile.showPageLoadingMsg(); }, //Show spinner
- complete: function() { $.mobile.hidePageLoadingMsg(); }, //Hide spinner
- success: function(xml) {
- expireSession();
- dibsWebClear();
- },
- error: function(jqXHR) {
- errorProcess(jqXHR);
- }
- });
-}
-
-function errorProcess(jqXHR){
- switch (parseInt(jqXHR.status)) {
- case 401:
- expireSession();
- break;
- case 406:
- alert("Internal server error : " + jqXHR.responseText);
- break;
- case 0:
- console.error("Error response status : "+jqXHR.status);
- break;
- default:
- console.error("Error response status : "+jqXHR.status);
- alert("Server error : "+jqXHR.status);
- break;
- }
-}
+++ /dev/null
-/*
- jobs.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-var suggestion_list = [];
-var update_ajax;
-var request_list = [];
-var request_idx = 0;
-
-$(function() {
- $('#jobs-type-select input[type="radio"]').checkboxradio().click(function() {
- jobsSearchSelected();
- });
-
- $('#jobs-status-select input[type="radio"]').checkboxradio().click(function() {
- jobsStatusSelected();
- });
-
- $("#jobs-search-input-text").on("input", function(e) {
- var selectedValue = $('#jobs-type-select').find("input[type='radio']:checked").val();
- switch(selectedValue) {
- case "GROUP":
- case "PROJECT":
- suggestJobSearchList($(this).val());
- break;
- default:
- return;
- }
- });
-
- $('#jobs-search-input-text').keypress(function() {
- if(event.keyCode == '13') {
- searchJobInput();
- }
- });
-
- $('#jobs-search-date-value').keypress(function() {
- if(event.keyCode == '13') {
- searchJobDate();
- }
- });
-});
-
-function jobsInit() {
- jobQueryDistribution();
-}
-
-function jobsSearchSelected() {
- clearSuggestJobSearchList();
-
- var selectedValue = $('#jobs-type-select').find("input[type='radio']:checked").val();
- switch(selectedValue) {
- case "ALL":
- selectJobAll();
- break;
- case "JOBID":
- selectJobId();
- break;
- case "USER":
- selectUser();
- break;
- case "GROUP":
- selectGroup();
- break;
- case "PROJECT":
- selectProject();
- break;
- case "DATE":
- selectDate();
- break;
- default:
- alert("Sorry. Please, report bug.");
- break;
- }
-}
-
-function jobsStatusSelected() {
- var selectedValue = $('#jobs-status-select').find("input[type='radio']:checked").val();
- switch(selectedValue) {
- case "ALL":
- jobsSearchSelected();
- break;
- case "SUCCESS":
- jobsSearchSelected();
- break;
- case "WORKING":
- jobsSearchSelected();
- break;
- case "ERROR":
- jobsSearchSelected();
- break;
- default:
- alert("Sorry. Please, report bug.");
- break;
- }
-}
-
-function searchJobInput() {
- var searchText = $("#jobs-search-input-text").val();
- if(searchText.length > 0) {
- searchJob(searchText);
- }
-}
-
-function searchJobDate() {
- var searchText = $("#jobs-search-date-value").val();
- if(searchText.length > 0) {
- searchJob(searchText);
- }
-}
-
-function searchJob(searchText) {
- var distribution = $("#jobs-distribution-select option:selected").text();
- var selectedValue = $('#jobs-type-select').find("input[type='radio']:checked").val();
- switch(selectedValue) {
- case "ALL":
- alert("Can't search on ALL!!");
- break;
- case "JOBID":
- queryJobListJobId(distribution, searchText);
- break;
- case "USER":
- queryJobListUserName(distribution, searchText);
- break;
- case "GROUP":
- queryJobListUserGroup(distribution, searchText);
- break;
- case "PROJECT":
- queryJobListProject(distribution, searchText);
- break;
- case "DATE":
- queryJobListDate(distribution, searchText);
- break;
- default:
- alert("Sorry. Please, report bug.");
- break;
- }
-}
-
-function selectJobAll() {
- var distribution = $("#jobs-distribution-select option:selected").text();
- $("#jobs-search-date").hide();
- $("#jobs-search-input").hide();
- queryJobListAll(distribution);
-}
-
-function selectJobId() {
- $("#jobs-search-date").hide();
- $("#jobs-search-input").show();
- $("#jobs-search-input-text").val("").textinput();
- clearJobList();
-}
-
-function selectUser() {
- var distribution = $("#jobs-distribution-select option:selected").text();
- $("#jobs-search-date").hide();
- $("#jobs-search-input").show();
-
- var name = sessionStorage.sessionInfoName;
- $("#jobs-search-input-text").val(name).textinput();
-
- queryJobListUserName(distribution, name);
-}
-
-function selectGroup() {
- var distribution = $("#jobs-distribution-select option:selected").text();
- $("#jobs-search-date").hide();
- $("#jobs-search-input").show();
-
- var group = sessionStorage.sessionInfoGroup;
- $("#jobs-search-input-text").val(group).textinput();
-
- jobsQueryGroupList("JOBS");
-
- queryJobListUserGroup(distribution, group);
-}
-
-function selectProject() {
- var distribution = $("#jobs-distribution-select option:selected").text();
- $("#jobs-search-date").hide();
- $("#jobs-search-input").show();
- clearJobList();
-
- $("#jobs-search-input-text").val("").textinput();
-
- jobsQueryProjectsList(distribution);
-}
-
-function selectDate() {
- var distribution = $("#jobs-distribution-select option:selected").text();
- var today = new Date();
- var yyyy = today.getFullYear();
- var mm = today.getMonth()+1; //January is 0!
- var dd = today.getDate(); //January is 0!
- if(dd<10) {
- dd='0'+dd;
- }
- if(mm<10) {
- mm='0'+mm;
- }
-
- var date = yyyy+'-'+mm+'-'+dd;
- $('#jobs-search-date-value').val(date);
-
- $("#jobs-search-input").hide();
- $("#jobs-search-date").show();
- clearJobList();
- queryJobListDate(distribution, date);
-}
-
-function clearJobList() {
- $("#jobs-job-list").empty();
-}
-
-function queryJobListAll(distribution) {
- queryJobListByButton("all", "", distribution, "LATEST");
-}
-
-function queryJobListJobId(distribution, jobId) {
- queryJobListByButton("all", "", distribution, eval(parseInt(jobId) + 1));
-}
-function queryJobListUserName(distribution, name) {
- var encodingName = encodeURIComponent(name);
- queryJobListByButton("user", encodingName, distribution, "LATEST");
-}
-
-function queryJobListUserGroup(distribution, group) {
- queryJobListByButton("group", group, distribution, "LATEST");
-}
-
-function queryJobListProject(distribution, project) {
- queryJobListByButton("project", project, distribution, "LATEST");
-}
-
-function queryJobListDate(distribution, date) {
- queryJobListByButton("date", date, distribution, "LATEST");
-}
-
-function queryJobListByButton(condition, param, distribution, jobId) {
- clearJobList();
- clearRequestList();
- var selectedStatus= $('#jobs-status-select').find("input[type='radio']:checked").val();
- var request = queryJobList("jobs/list", condition, param, distribution, selectedStatus, jobId);
- if(request != undefined) {
- request.done(function() {
- console.log("Start update");
- jobUpdateList(condition, param, distribution, selectedStatus);
- });
- }
-}
-
-function jobQueryDistribution() {
- if( $("#jobs-distribution-select").children().length == 0 ) {
- queryDistribution( function(xml) {
- // append "ALL" distribution
- $("#jobs-distribution-select").append("<option value='ALL'>ALL</option>");
-
- $(xml).find("Data").find("Distribution").each(function(){
- var id = $(this).find("Id").text();
- var name = $(this).find("Name").text();
-
- $("#jobs-distribution-select").append("<option value=\'"+id+"\'>"+name+"</option>");
- });
-
- /* default distribution selection */
- $("#jobs-distribution-select option:eq(0)").attr("selected", "selected");
- $("#jobs-distribution-select").selectmenu('refresh');
-
- selectJobAll();
- });
- } else {
- jobsSearchSelected();
- }
-}
-
-function queryJobList(requestUrl, condition, param, queryDistribution, selectedStatus, jobId) {
- var url = "";
- if(condition == "all") {
- url = requestUrl+"/"+condition+"/"+queryDistribution+"/"+selectedStatus+"/"+jobId;
- }
- else {
- url = requestUrl+"/"+condition+"/"+param+"/"+queryDistribution+"/"+selectedStatus+"/"+jobId;
- }
- console.log("url :"+url);
- return queryJobsList(url, function(xml) {
- var lastJobId = 0;
- $(xml).find("JobList").find("Job").each(function(){
- var id = $(this).find("Id").text();
- var jobAttribute = $(this).find("JobAttribute").text();
- var parentJobId = $(this).find("ParentJobId").text();
- var li = "";
- if(jobAttribute == "CHILD")
- {
- li = generateHtmlJobList($(this));
- console.log("add-child-job parent's id:"+parentJobId);
- $("#jobs-li-"+parentJobId+"-sub-job-area").append(li);
- $("#jobs-li-"+id).collapsible();
- $("#jobs-li-"+id+"-sub-job-button").button();
-
- $("#jobs-li-link-"+id).popupWindow({
- height:900,
- width:800,
- top:30,
- left:50
- });
- console.log("add-child-job id:"+id);
-
- //Display sub-jobs button
- if($("#jobs-li-"+parentJobId+"-sub-job-button-div").hasClass("ui-screen-hidden") == true) {
- $("#jobs-li-"+parentJobId+"-sub-job-button-div").removeClass("ui-screen-hidden");
- }
- }
- else
- {
- li = generateHtmlJobList($(this));
-
- lastJobId = id;
- $("#jobs-job-list").append(li).listview('refresh');
- $("#jobs-li-"+id+"-sub-job-button").button();
-
- $("#jobs-li-link-"+id).popupWindow({
- height:900,
- width:800,
- top:30,
- left:50
- });
- }
-
- });
-
- console.log("last job id :"+lastJobId);
- if(lastJobId > 0)
- {
- var moreJobListUrl = 'queryJobList("'+requestUrl+'", "'+condition+'", "'+param+'", "'+queryDistribution+'", "'+selectedStatus+'", "'+lastJobId+'")';
- console.log(moreJobListUrl);
- $('#jobs-job-more').attr("onClick", moreJobListUrl);
- $('#jobs-job-more').removeClass('ui-disabled');
- }
- else
- {
- $('#jobs-job-more').addClass('ui-disabled');
- }
- $('#jobs-job-more').button('refresh');
-
- }, errorProcess);
-}
-
-function jobUpdateList(condition, param, distribution, selectedStatus) {
- var latest_job_id= $("#jobs-job-list li").first().attr("title");
- if(latest_job_id == undefined) {
- latest_job_id = 0;
- }
- var working_job_list = searchWorkingList();
- item = {"Condition":condition, "Param":param, "Distribution":distribution, "Status":selectedStatus, "LatestId":latest_job_id, "WorkingJobId":working_job_list};
-
- var update_ajax = updateList(item, function(xml) {
- var firstLi= $("#jobs-job-list li").first();
-
- // Add new job list
- $(xml).find("JobList").find("Job").each(function(){
- var id = $(this).find("Id").text();
- var jobAttribute = $(this).find("JobAttribute").text();
- var parentJobId = $(this).find("ParentJobId").text();
- var li = generateHtmlJobList($(this));
-
- if(jobAttribute == "CHILD") {
- console.log("add-child-job parent's id:"+parentJobId);
- $("#jobs-li-"+parentJobId+"-sub-job-area").append(li);
- $("#jobs-li-"+id).collapsible();
- $("#jobs-li-"+id+"-sub-job-button").button();
- $("#jobs-job-list").listview('refresh');
-
- $("#jobs-li-link-"+id).popupWindow({
- height:900,
- width:800,
- top:30,
- left:50
- });
- console.log("add-child-job id:"+id);
-
- //Display sub-jobs button
- if($("#jobs-li-"+parentJobId+"-sub-job-button-div").hasClass("ui-screen-hidden") == true) {
- $("#jobs-li-"+parentJobId+"-sub-job-button-div").removeClass("ui-screen-hidden");
- }
- }
- else {
- $(li).insertBefore(firstLi);
- $("#jobs-job-list").listview('refresh');
- $("#jobs-li-"+id+"-sub-job-button").button();
- $("#jobs-li-link-"+id).popupWindow({
- height:900,
- width:800,
- top:30,
- left:50
- });
- console.log("ADD List :"+id);
- }
- });
-
- // Update working job list
- $(xml).find("WorkingJobList").find("Job").each(function(){
- var job_id = $(this).find("Id").text();
- var parent_job_id = $(this).find("ParentJobId").text();
- var job_status = $(this).find("Status").text();
- var job_error_code = $(this).find("ErrorCode").text();
- var start_time = $(this).find("StartTime").text();
- var end_time = $(this).find("EndTime").text();
- var font_color = "black";
-
- switch(job_status)
- {
- case "ERROR" :
- if(job_error_code != "") {
- job_status = job_error_code;
- }
- case "CANCELED" :
- font_color = "red";
- break;
- case "INITIALIZING" :
- case "JUST_CREATED" :
- case "PENDING" :
- case "WORKING" :
- case "REMOTE_WORKING" :
- font_color = "blue";
- break;
- case "WAITING" :
- font_color = "green";
- break;
- case "FINISHED" :
- font_color = "black";
- break;
- default:
- console.error(job_status+" status is not define.");
- font_color = "black";
- break;
- }
-
- // in case, exist job list element or not exist
- if($("#jobs-li-"+job_id).length != 0) {
- var html_status = '<strong><font color="'+font_color+'">'+job_status+'</strong>';
- var html_time = 'TIME: <strong>' +start_time+ ' ~ '+end_time+ '</strong>';
- $("#jobs-li-status-"+job_id).html(html_status);
- $("#jobs-li-time-"+job_id).html(html_time);
- console.log("UPDATE List :"+job_id);
- }
- else {
- console.log("add-child-job parent's id:"+parent_job_id);
- var li = generateHtmlJobList($(this));
- $("#jobs-li-"+parent_job_id+"-sub-job-area").append(li);
- $("#jobs-li-"+job_id).collapsible();
- $("#jobs-li-"+job_id+"-sub-job-button").button();
- $("#jobs-job-list").listview('refresh');
-
- $("#jobs-li-link-"+job_id).popupWindow({
- height:900,
- width:800,
- top:30,
- left:50
- });
- console.log("add-child-job id:"+job_id);
-
- //Display sub-jobs button
- if($("#jobs-li-"+parent_job_id+"-sub-job-button-div").hasClass("ui-screen-hidden") == true) {
- $("#jobs-li-"+parent_job_id+"-sub-job-button-div").removeClass("ui-screen-hidden");
- }
- }
- });
- });
-
- var idx = addRequestList(update_ajax);
- update_ajax.done(function() {
- console.log("update complete. retry in 2 sec.");
- setTimeout(function(){
- if(isPolling(idx) && $.mobile.activePage.attr('id') == "jobs" && idx < 900) {
- console.log("Update request.");
- request_list[idx].polling = false;
- jobUpdateList(condition, param, distribution, selectedStatus);
- }
- else {
- console.log("Stop update.");
- }
- }, 2000);
- });
-}
-
-function clearSuggestJobSearchList() {
- $("#jobs-search-list").empty();
-}
-
-function jobsQueryGroupList() {
- suggestion_list = [];
-
- queryAllGroup( function(xml) {
- var idx = 0;
-
- $(xml).find("Data").find("GroupName").each(function(){
- suggestion_list[idx]= $(this).text();
- idx++;
- });
- }, errorProcess);
-}
-
-function suggestJobSearchList(inputText) {
- var sugList = $("#jobs-search-list");
-
- if(inputText.length < 1) {
- sugList.html("");
- sugList.listview("refresh");
- } else {
- var str = "";
- var suggestion = "";
- for(var i=0, len=suggestion_list.length; i<len; i++) {
- suggestion = suggestion_list[i];
-
- if(suggestion.search(inputText) >= 0)
- {
- str += "<li data-mini='true'><a href='#' onClick='jobSuggestListClick(\""+suggestion+"\")'>"+suggestion+"</a></li>";
- }
- }
- sugList.html(str);
- sugList.listview("refresh");
- }
-}
-
-function jobSuggestListClick(suggestText) {
- $("#jobs-search-input-text").val(suggestText);
- $("#jobs-search-list").empty();
-
- var distribution = $("#jobs-distribution-select option:selected").text();
- var project = "";
- console.log(distribution);
-
- if(distribution === "ALL") {
- var startIndex = suggestText.search(/\[/);
- var endIndex = suggestText.search('\]');
-
- if(startIndex > 0 && endIndex >0) {
- project = suggestText.substr(0, startIndex);
- distribution = suggestText.substr(startIndex+1, endIndex-startIndex-1);
- queryJobListProject(distribution, project);
- }
- else {
- searchJob(suggestText);
- }
- }
- else {
- project = suggestText;
- queryJobListProject(distribution, project);
- }
-}
-
-function jobsQueryProjectsList() {
- var distribution = $("#jobs-distribution-select option:selected").text();
- var distribution_id = $("#jobs-distribution-select option:selected").val();
- suggestion_list = [];
-
- if(distribution == "ALL") {
- queryAllProjectInOpenStatus(function(xml) {
- var idx = 0;
-
- $(xml).find("Data").find("Project").each(function(){
- var projectName = $(this).find("Name").text();
- var distName = $(this).find("DistName").text();
- suggestion_list[idx]= projectName+"["+distName+"]"
- idx++;
- });
- });
- }
- else {
- queryProjectsInDistribution(distribution_id, function(xml) {
- var idx = 0;
-
- $(xml).find("Data").find("Project").each(function(){
- suggestion_list[idx]= $(this).find("ProjectName").text();
- idx++;
- });
- });
- }
-}
-
-function jobsClear() {
- $("#jobs-distribution-select").empty();
- clearJobList();
-}
-
-
-function generateHtmlJobList(xml) {
- var id = xml.find("Id").text();
- var distribution = xml.find("Distribution").text();
- var projectName = xml.find("ProjectName").text();
- var jobType = xml.find("JobType").text();
- var jobAttribute = xml.find("JobAttribute").text();
- var os = xml.find("Os").text();
- var jobStatus = xml.find("Status").text();
- var jobErrorCode = xml.find("ErrorCode").text();
- var userName = xml.find("UserName").text();
- var startTime = xml.find("StartTime").text();
- var endTime = xml.find("EndTime").text();
- var projectList = xml.find("ProjectList").text();
- var li = "";
- var font_color = "black";
-
- switch(jobStatus)
- {
- case "ERROR" :
- if(jobErrorCode != "") {
- jobStatus = jobErrorCode;
- }
- console.log(id);
- console.log(jobErrorCode);
- case "CANCELED" :
- font_color = "red";
- break;
- case "INITIALIZING" :
- case "JUST_CREATED" :
- case "PENDING" :
- case "WORKING" :
- case "REMOTE_WORKING" :
- font_color = "blue";
- break;
- case "WAITING" :
- font_color = "green";
- break;
- case "FINISHED" :
- font_color = "black";
- break;
- default:
- console.error(job_status+" status is not define.");
- font_color = "black";
- break;
- }
-
- if(jobAttribute == "SINGLE")
- {
- li = '<li class="jobs-li-header" data-role="list-divider" title="'+id+'">'
- + '<span>'+id+ ' ' +projectName+ '</span><span style="float: right">'+distribution+'</span></li>'
- + '<li id="jobs-li-'+id+'" class="jobs-list-data" title="'+id+'" data-icon="false">'
- + '<a href=log.html?jobid='+id+' id="jobs-li-link-'+id+'" class="logWindow" data-ajax="false">'
- + '<h3>' +projectName+ '</h3>'
- + '<p>ID : <strong>' +id+ '</strong></p>'
- + '<p>TYPE : <strong>' +jobType+ '</strong></p>'
- + '<p>OS : <strong>' + os + '</strong></p>'
- + '<p>USER : <strong>' +userName+ '</strong></p>'
- + '<p id="jobs-li-time-'+id+'">TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>';
-
- li = li + '<p id="jobs-li-status-'+id+'" class="ui-li-aside jobs-li-status"><strong><font color="'+font_color+'">'+jobStatus+'</strong></p>';
- li = li + '</a>';
- li = li + '<div id="jobs-li-'+id+'-sub-job-button-div" class="ui-screen-hidden" style="position: absolute; top: 95px; right: 20px;"><button id="jobs-li-'+id+'-sub-job-button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" data-corners="true" onClick="clickSubJobs('+id+')"></button></div>'
- li = li + '<div class="ui-screen-hidden">'
- + '<p class="jobs-li-hidden-id">'+id+'</p>'
- + '<p class="jobs-li-hidden-attr">'+jobAttribute+'</p>'
- + '</div>';
- li = li + '</li>';
- //For Sub job
- li = li + '<li id="jobs-li-'+id+'-child" class="ui-screen-hidden">'
- + '<div id="jobs-li-'+id+'-sub-job-area"></div></li>';
- }
- else if(jobAttribute == "MULTI")
- {
- li = '<li class="jobs-li-header" data-role="list-divider" title="'+id+'">'
- + '<span>'+id+ ' ' +jobAttribute+ '</span><span style="float: right">'+distribution+'</span></li>';
- li = li + '<li id="jobs-li-'+id+'" class="jobs-list-data" title="'+id+'" data-icon="false">';
- li = li + '<a href=log.html?jobid='+id+' id="jobs-li-link-'+id+'" class="logWindow" data-ajax="false">'
- + '<h3>' +projectList+ '</h3>'
- + '<p>ID : <strong>' +id+ '</strong></p>'
- + '<p>TYPE : <strong>' +jobType+ '</strong></p>'
- + '<p>USER : <strong>' +userName+ '</strong></p>'
- + '<p id="jobs-li-time-'+id+'">TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>'
-
- li = li + '<p id="jobs-li-status-'+id+'" class="ui-li-aside jobs-li-status" title="'+id+'"><strong><font color="'+font_color+'">'+jobStatus+'</strong></p>';
- li = li + '</a>';
- li = li + '<div id="jobs-li-'+id+'-sub-job-button-div" class="ui-screen-hidden" style="position: absolute; top: 80px; right: 20px;"><button id="jobs-li-'+id+'-sub-job-button" data-inline="true" data-mini="true" data-icon="plus" data-iconpos="notext" data-corners="true" onClick="clickSubJobs('+id+')"></button></div>'
- li = li + '<div class="ui-screen-hidden">'
- + '<p class="jobs-li-hidden-id">'+id+'</p>'
- + '<p class="jobs-li-hidden-attr">'+jobAttribute+'</p>'
- + '</div>';
- li = li + '</li>';
- //For Sub job
- li = li + '<li id="jobs-li-'+id+'-child" class="ui-screen-hidden">'
- + '<div id="jobs-li-'+id+'-sub-job-area"></div></li>';
- }
- else if(jobAttribute == "CHILD")
- {
- li = '<div id="jobs-li-'+id+'" class="jobs-list-data" title="'+id+'" data-role="collapsible" data-collapsed="true" data-mini="true" data-iconpos="right" style="clear: both;">'
- + '<h3><span style="width: 80%;">['+id+ '] '+projectName+' - '+os+'</span><span id="jobs-li-status-'+id+'" class="jobs-li-status" style="float: right; font-size: 12px;"><font color="'+font_color+'">'+jobStatus+'</font></span></h3>'
- + '<a href=log.html?jobid='+id+' id="jobs-li-link-'+id+'" class="logWindow" data-ajax="false" style="text-decoration: none; color: black">'
- + '<h4>' +projectName+ '</h4>'
- + '<p class="ui-li-desc">ID : <strong>' +id+ '</strong></p>'
- + '<p>TYPE : <strong>' +jobType+ '</strong></p>'
- + '<p>OS : <strong>' +os+ '</strong></p>'
- + '<p id="jobs-li-time-'+id+'">TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>'
- + '</a>';
- li = li + '<div class="ui-screen-hidden">'
- + '<p class="jobs-li-hidden-id">'+id+'</p>'
- + '<p class="jobs-li-hidden-attr">'+jobAttribute+'</p>'
- + '</div>';
- li = li + '<div id="jobs-li-'+id+'-sub-job-button-div" class="ui-screen-hidden" style="float: right; position: relative; top: -20px;"><button id="jobs-li-'+id+'-sub-job-button" data-inline="true" data-mini="true" data-icon="minus" data-iconpos="notext" data-corners="true" onClick="clickSubJobs('+id+')"></button></div>';
- //For Sub job
- li = li + '<div id="jobs-li-'+id+'-child" style="clear: both; width: 97%; position: relative; left: 30px;">'
- + '<div id="jobs-li-'+id+'-sub-job-area"></div></div>';
- li = li + '</div>';
- }
-
- return li;
-}
-
-function searchWorkingList() {
- working_job_array = new Array();
- $("#jobs-job-list .jobs-list-data").each(function(index) {
- var job_attr = $(this).find(".jobs-li-hidden-attr").text();
- var job_id = $(this).find(".jobs-li-hidden-id").text();
- var job_status= $(this).find(".jobs-li-status").text();
- switch(job_status)
- {
- case "INITIALIZING" :
- case "JUST_CREATED" :
- case "PENDING" :
- case "WORKING" :
- case "REMOTE_WORKING" :
- case "WAITING" :
- working_job_array.push(job_id);
- break;
- default:
- break;
- }
- });
- return working_job_array;
-}
-
-/* For background update AJAX */
-function classAjax() {
- var polling = false;
- var ajaxObj = undefined;
-}
-
-function addRequestList(ajaxObj) {
- var class_ajax = new classAjax();
- class_ajax.polling = true;
- class_ajax.ajaxObj = ajaxObj;
-
- return request_list.push(class_ajax) - 1;
-}
-
-function clearRequestList() {
- while(request_list.length > 0) {
- var last_request = request_list[request_list.length - 1];
- if(last_request.polling == true && last_request.ajaxObj != undefined) {
- last_request.ajaxObj.abort();
- }
- request_list.pop();
- }
- console.log("Clear all update.");
-}
-
-function isPolling(idx) {
- if(request_list[idx] != undefined) {
- return request_list[idx].polling;
- }
- else {
- return false;
- }
-}
-
-function clickSubJobs(job_id) {
- if($("#jobs-li-"+job_id+"-child").hasClass("ui-screen-hidden") == true) {
- $("#jobs-li-"+job_id+"-child").removeClass("ui-screen-hidden");
- $("#jobs-li-"+job_id+"-sub-job-button").buttonMarkup({icon:"minus"});
- }
- else {
- $("#jobs-li-"+job_id+"-child").addClass("ui-screen-hidden");
- $("#jobs-li-"+job_id+"-sub-job-button").buttonMarkup({icon:"plus"});
- }
-}
-
+++ /dev/null
-/*
- log.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-var request;
-var stop = 1;
-
-var baseUrl;
-var job_id;
-var last_line = 0;
-
-var init = function () {
- console.log("init() called");
- var myUrl = location.href;
- var varCut = myUrl.indexOf("?");
- var varCheck = myUrl.substring(varCut+1);
- eval(varCheck);
-
- job_id = jobid;
- $('#job-info-id').text(job_id);
- console.log(job_id);
-
- var baseCut = myUrl.indexOf("log.html");
-
- baseUrl = myUrl.substring(0, baseCut);
- console.log("base url:"+baseUrl);
-
- queryLog();
-};
-
-$(document).ready(init);
-
-function queryLog()
-{
- var next_line = Number(last_line) + 1;
- queryJobsLog(job_id, next_line, function(xml) {
- /* pre-process for header */
- job_id = $(xml).find("Data").find("JobId").text();
- var distribution = $(xml).find("Data").find("Distribution").text();
- var project = $(xml).find("Data").find("Project").text();
- var builder = $(xml).find("Data").find("Builder").text();
- var job_status = $(xml).find("Data").find("Status").text();
- var time = $(xml).find("Data").find("Time").text();
- var conti = Number($(xml).find("Data").find("Continue").text());
- var working_status = 0;
-
- $('#job-info-distribution').html(distribution);
- $('#job-info-project').html(project);
- $('#job-info-builder').html(builder);
- $('#job-info-status').html(job_status);
- switch(job_status)
- {
- case "ERROR" :
- case "CANCELED" :
- $('#job-info-status').css("color","red");
- $('#job-info-cancel input').attr("disabled", true);
- working_status = 0;
- break;
- case "INITIALIZING" :
- case "JUST_CREATED" :
- case "PENDING" :
- case "WORKING" :
- case "REMOTE_WORKING" :
- $('#job-info-status').css("color","blue");
- working_status = 1;
- break;
- case "WAITING" :
- $('#job-info-status').css("color","green");
- working_status = 1;
- break;
- case "FINISHED" :
- $('#job-info-status').css("color","black");
- $('#job-info-cancel input').attr("disabled", true);
- working_status = 0;
- break;
- default:
- console.error(job_status+" status is not define.");
- $('#job-info-cancel input').attr("disabled", true);
- working_status = 0;
- break;
- }
-
- /* Insert data */
- $(xml).find("Data").find("LogData").each(function() {
- var line_number = $(this).attr("Line");
- var line_data = $(this).text();
-
- var row = '<tr><td width="30" style="text-align: right;">' + line_number + '</td>'
- + '<td style="text-align: left;">' + line_data + '</td></tr>';
- $("#log-contents").append(row);
- last_line = line_number;
- });
-
- if(working_status == 1){
- console.log("scroll");
- scrollToBottom();
- }
- console.log("next_line :" +next_line);
- console.log("conti :" +conti);
- console.log("working_status :"+working_status);
-
- autoQueryLog(conti, working_status);
- });
-}
-
-function autoQueryLog(conti, working_status) {
- if(working_status == 1 && stop) {
- console.log("status is working. try request");
- setTimeout(function(){queryLog()}, 1000);
- }
- else if(conti && stop) {
- console.log("contiue request");
- setTimeout(function(){queryLog()}, 100);
- }
-}
-
-function stopLog() {
- stop = 0;
-}
-
-function moreLog() {
- stop = 1;
- queryLog();
-}
-
-function cancelJob() {
- cancelJobsJobid(job_id, function(xml) {
- var message = $(xml).find("Data").find("Message").text();
- alert(message);
- });
-}
-
-function getYScroll()
-{
- var yScroll;
- if (window.innerHeight && window.scrollMaxY) {
- yScroll = window.innerHeight + window.scrollMaxY;
- } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
- yScroll = document.body.scrollHeight;
- } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
- yScroll = document.body.offsetHeight;
- }
- return yScroll;
-}
-
-function scrollToBottom() {
- window.scrollTo(0,getYScroll());
-}
-
+++ /dev/null
-/*
- main.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-//Initialize function
-var baseUrl = "";
-
-var init = function () {
- console.log("init() called");
- var myUrl = location.href;
- var urlCut = myUrl.indexOf("index.html");
- var sharpCut = myUrl.indexOf("#");
-
- if(urlCut > 0) {
- baseUrl = myUrl.substring(0, urlCut);
- }
- else if(sharpCut > 0) {
- baseUrl = myUrl.substring(0, sharpCut);
- }
- else {
- baseUrl = window.location.href;
- }
- console.log("base url:"+baseUrl);
-};
-$(document).ready(init);
-
-$.ajaxSetup({
- beforeSend: function(xhr) {
- xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
- }
-});
-
-
-$( document ).bind( "pageshow", function( event, data ){
-});
-
-$( document ).bind( "pagechange", function( event, data ){
- var id = $.mobile.activePage.attr('id');
-
- switch(id){
- case "index":
- generateNavigationBar(id);
- break;
- case "signup":
- clearFormData('signup-form');
- break;
- case "login":
- clearLoginData();
- getUserId();
- break;
- case "projects":
- generateNavigationBar(id);
- projectsInit(id);
- break;
- case "build":
- generateNavigationBar(id);
- buildInit(id);
- break;
- case "jobs":
- generateNavigationBar(id);
- jobsInit();
- break;
- case "log":
- logInit();
- break;
- case "adminUser":
- generateNavigationBar(id);
- adminUserInit();
- break;
- case "adminGroup":
- generateNavigationBar(id);
- adminGroupInit();
- break;
- case "adminServer":
- generateNavigationBar(id);
- adminServerInit();
- break;
- case "adminProject":
- generateNavigationBar(id);
- adminProjectInit();
- break;
- case "adminDistribution":
- generateNavigationBar(id);
- adminDistributionInit();
- break;
- case "adminDistributionModify":
- adminDistributionModifyPopupInit();
- break;
- case "adminGroupAdd":
- adminGroupAddInit();
- break;
- case "adminProjectAddGit":
- adminProjectAddGitInit();
- break;
- case "adminProjectAddBinary":
- adminProjectAddBinaryInit();
- break;
- case "adminServerAddSupportedOs":
- adminServerAddSupportedOsInit();
- break;
- case "adminServerRemoveOSCategory":
- adminServerRemoveOSCategoryInit();
- break;
- case "signup":
- //queryGroupListForSignup();
- break;
- default:
- break;
- }
-
- // Call check session info
- checkSessionInfo();
-});
-
-$( document ).bind( "mobileinit", function() {
- $.support.cors = true;
- $.support.cors = true;
- $.mobile.pushStateEnabled = false;
-});
-
-function clearFormData(elementId){
- $("#"+elementId).find(':input').each(function() {
- switch(this.type) {
- case 'text':
- case 'password':
- case 'select-multiple':
- case 'select-one':
- case 'textarea':
- $(this).val('');
- break;
- case 'checkbox':
- case 'radio':
- $(this).checked = false;
- break;
- }
- });
-}
-
-function generateNavigationBar(id) {
- if(sessionStorage.sessionInfoEmail)
- {
- var admin = sessionStorage.sessionInfoAdmin;
- if(admin == "TRUE")
- {
- generateNavigationBarAdmin(id);
- }
- else
- {
- generateNavigationBarUser(id);
- }
- } else {
- $("#"+id+"-navigationBar").empty();
- }
-}
-
-function generateNavigationBarUser(id) {
- var naviHtml = ""
- naviHtml = '<li data-role="list-divider">BUILD</li>';
- switch(id){
- case "projects":
- naviHtml += '<li data-theme="b" ><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- break;
- case "build":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li data-theme="b"><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- break;
- case "jobs":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li data-theme="b"><a href="#jobs">Jobs</a></li>';
- break;
- default:
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- break;
- }
-
- $("#"+id+"-navigationBar").empty();
- $("#"+id+"-navigationBar").append(naviHtml).listview("refresh");
-}
-
-function generateNavigationBarAdmin(id) {
- var naviHtml = ""
- naviHtml = '<li data-role="list-divider">BUILD</li>';
- switch(id){
- case "projects":
- naviHtml += '<li data-theme="b" ><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li><a href="#adminUser">User</a></li>';
- naviHtml += '<li><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li><a href="#adminServer">Server</a></li>';
- naviHtml += '<li><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li><a href="#adminProject">Project</a></li>';
- break;
- case "build":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li data-theme="b" ><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li><a href="#adminUser">User</a></li>';
- naviHtml += '<li><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li><a href="#adminServer">Server</a></li>';
- naviHtml += '<li><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li><a href="#adminProject">Project</a></li>';
- break;
- case "jobs":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li data-theme="b" ><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li><a href="#adminUser">User</a></li>';
- naviHtml += '<li><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li><a href="#adminServer">Server</a></li>';
- naviHtml += '<li><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li><a href="#adminProject">Project</a></li>';
- break;
- case "adminUser":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li data-theme="b" ><a href="#adminUser">User</a></li>';
- naviHtml += '<li><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li><a href="#adminServer">Server</a></li>';
- naviHtml += '<li><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li><a href="#adminProject">Project</a></li>';
- break;
- case "adminGroup":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li><a href="#adminUser">User</a></li>';
- naviHtml += '<li data-theme="b" ><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li><a href="#adminServer">Server</a></li>';
- naviHtml += '<li><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li><a href="#adminProject">Project</a></li>';
- break;
- case "adminServer":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li><a href="#adminUser">User</a></li>';
- naviHtml += '<li><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li data-theme="b" ><a href="#adminServer">Server</a></li>';
- naviHtml += '<li><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li><a href="#adminProject">Project</a></li>';
- break;
- case "adminDistribution":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li><a href="#adminUser">User</a></li>';
- naviHtml += '<li><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li><a href="#adminServer">Server</a></li>';
- naviHtml += '<li data-theme="b" ><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li><a href="#adminProject">Project</a></li>';
- break;
- case "adminProject":
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li><a href="#adminUser">User</a></li>';
- naviHtml += '<li><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li><a href="#adminServer">Server</a></li>';
- naviHtml += '<li><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li data-theme="b" ><a href="#adminProject">Project</a></li>';
- break;
- default:
- naviHtml += '<li><a href="#projects">Projects</a></li>';
- naviHtml += '<li><a href="#build">Build</a></li>';
- naviHtml += '<li><a href="#jobs">Jobs</a></li>';
- naviHtml += '<li data-role="list-divider">ADMIN</li>';
- naviHtml += '<li><a href="#adminUser">User</a></li>';
- naviHtml += '<li><a href="#adminGroup">Group</a></li>';
- naviHtml += '<li><a href="#adminServer">Server</a></li>';
- naviHtml += '<li><a href="#adminDistribution">Distribution</a></li>';
- naviHtml += '<li><a href="#adminProject">Project</a></li>';
- break;
- }
-
- $("#"+id+"-navigationBar").empty();
- $("#"+id+"-navigationBar").append(naviHtml).listview("refresh");
-}
-
-function dibsWebClear(){
- projectsClear();
- buildClear();
- jobsClear();
-}
-
-function getCookie(key)
-{
- var cook = document.cookie + ";";
- var idx = cook.indexOf(key, 0);
- var val = "";
-
- if (idx != -1) {
- cook = cook.substring(idx, cook.length);
- begin = cook.indexOf("=", 0) + 1;
- end = cook.indexOf(";", begin);
- val = unescape(cook.substring(begin, end));
- }
-
- return val;
-}
-
-function saveCookie(key, value, expire_days)
-{
- var today = new Date();
- today.setDate(today.getDate() + expire_days);
- document.cookie = key + "=" + escape(value) + "; path=/; expires=" + today.toGMTString() + ";";
-}
+++ /dev/null
-/*
- popup-window.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-(function($){
- $.fn.popupWindow = function(instanceSettings){
-
- return this.each(function(){
-
- $(this).click(function(){
-
- $.fn.popupWindow.defaultSettings = {
- centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
- centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
- height:500, // sets the height in pixels of the window.
- left:0, // left position when the window appears.
- location:1, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
- menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
- resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
- scrollbars:1, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
- status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
- width:500, // sets the width in pixels of the window.
- windowName:null, // name of window set from the name attribute of the element that invokes the click
- windowURL:null, // url used for the popup
- top:0, // top position when the window appears.
- toolbar:0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
- };
-
- settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
-
- var windowFeatures = 'height=' + settings.height +
- ',width=' + settings.width +
- ',toolbar=' + settings.toolbar +
- ',scrollbars=' + settings.scrollbars +
- ',status=' + settings.status +
- ',resizable=' + settings.resizable +
- ',location=' + settings.location +
- ',menuBar=' + settings.menubar;
-
- settings.windowName = this.name || settings.windowName;
- settings.windowURL = this.href || settings.windowURL;
- var centeredY,centeredX;
-
- if(settings.centerBrowser){
-
- if ($.browser.msie) {//hacked together for IE browsers
- centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
- centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
- }else{
- centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
- centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
- }
- window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
- }else if(settings.centerScreen){
- centeredY = (screen.height - settings.height)/2;
- centeredX = (screen.width - settings.width)/2;
- window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
- }else{
- window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();
- }
- return false;
- });
-
- });
- };
-})(jQuery);
+++ /dev/null
-/*
- post-process.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-$('.uploadWindow').popupWindow({
- height:200,
- width:400,
- top:50,
- left:50
-});
-
+++ /dev/null
-/*
- projects.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-function projectsInit() {
- if( $("#projects-distribution-select").children().length == 0 ) {
- queryDistribution( function(xml) {
- $(xml).find("Data").find("Distribution").each(function(){
- var id = $(this).find("Id").text();
- var name = $(this).find("Name").text();
-
- $("#projects-distribution-select").append("<option value=\'"+id+"\'>"+name+"</option>");
- });
-
- /* default distribution selection */
- defualt_dist_id = projectsGetCookieDistribution();
- $("#projects-distribution-select").val(defualt_dist_id);
- $("#projects-distribution-select").selectmenu('refresh');
-
- $('#projects-type-select input[type="radio"]').attr("checked",false).checkboxradio("refresh");
- $('#projects-type-select input[type="radio"]:first').attr("checked",true).checkboxradio("refresh");
- projectsQueryProjectListType();
- });
- } else {
- projectsQueryProjectListType();
- }
-}
-
-function projectsQueryProjectListType() {
- var dist_id = $("#projects-distribution-select option:selected").val();
-
- projectsSetCookieDistribution(dist_id);
-
- queryProjectsInfoInDistribution( dist_id, function(xml) {
- $("#projects-project-list").empty();
-
- var projectList = document.getElementById("projects-project-list");
- var projectType = $('#projects-type-select').find("input[type='radio']:checked").val();
-
- $(xml).find("Data").find("ProjectList").find("Project").each(function(){
- switch(projectType) {
- case "ALL":
- projectsAppendProjectList($(this), projectList);
- break;
- case "MY":
- var groupAccess = $(this).find("GroupAccess").text();
- if(groupAccess == "TRUE") {
- projectsAppendProjectList($(this), projectList);
- }
- break;
- case "GIT":
- var type = $(this).find("Type").text();
- if(type == "GIT") {
- projectsAppendProjectList($(this), projectList);
- }
- break;
- case "BINARY":
- var type = $(this).find("Type").text();
- if(type == "BINARY") {
- projectsAppendProjectList($(this), projectList);
- }
- break;
- default:
- ;
- }
- });
-
- $('.projects-project-list-collapsible').collapsible();
- $('.projects-project-list-listview').listview();
-
- });
-}
-
-function projectsAppendProjectList( project, projectList ) {
- var id = project.find("Id").text();
- var name = project.find("Name").text();
- var type = project.find("Type").text();
- var groupAccess = project.find("GroupAccess").text();
- var maintainer = project.find("Maintainer").text();
- var git_address = project.find("GitAddress").text();
- var git_branch = project.find("GitBranch").text();
-
- var div = document.createElement('div');
- div.setAttribute('data-role', 'collapsible');
- div.setAttribute('data-inset', 'false');
- div.setAttribute('data-mini', 'true');
- div.setAttribute('class', 'projects-project-list-collapsible');
- if(groupAccess == "TRUE") {
- div.setAttribute('data-theme', "b");
- }
- else {
- div.setAttribute('data-theme', "d");
- }
- projectList.appendChild(div);
-
- var h2 = document.createElement('h2');
- h2.innerHTML = '<span class="alignleft">'+name+'</span><span class="alignright">'+type+'</span>';
- div.appendChild(h2);
-
- var infoLine = document.createElement('p');
- infoLine.setAttribute('style', 'font-size: 12px');
- infoLine.innerHTML = "Maintainer: <b>"+maintainer+"</b><br><br>";
- if(type === "GIT") {
- infoLine.innerHTML += "Git address: <b>"+git_address+"</b><br><br>";
- infoLine.innerHTML += "Git branch: <b>"+git_branch+"</b><br><br>";
- }
- div.appendChild(infoLine);
-
- var ul = document.createElement('ul');
- ul.setAttribute('data-role', "listview");
- ul.setAttribute('class', "projects-project-list-listview");
- ul.setAttribute('data-filter-theme', "c");
- ul.setAttribute('data-divider-theme', "c");
- div.appendChild(ul);
-
- project.find("ProjectOs").each(function(){
- var osName = $(this).find("OsName").text();
-
- var li = document.createElement('li');
- li.setAttribute('style', 'font-size: 12px');
- li.setAttribute('data-role', "list-divider")
- li.innerHTML = "<strong>"+osName+"</strong>";
- ul.appendChild(li);
-
- $(this).find("Package").each(function(){
- var packageName = $(this).find("PackageName").text();
- var packageVersion = $(this).find("PackageVersion").text();
- var startTime = $(this).find("StartTime").text();
- var endTime= $(this).find("EndTime").text();
- var userName = $(this).find("UserName").text();
- var userEmail = $(this).find("UserEmail").text();
-
- if(packageName != "")
- {
- var liInfo = document.createElement('li');
- liInfo.setAttribute('style', 'font-size: 12px');
- var info = "<h3>"+packageName+" "+packageVersion+"</h3>";
- info += "<p>Lastest build time : <strong>"+startTime+" ~ "+endTime+"</strong></p>";
- info += "<p>Lastest build user : <strong>"+userName+" ["+userEmail+"]</strong></p>";
- liInfo.innerHTML = info;
- ul.appendChild(liInfo);
- }
- });
- });
-}
-
-function projectsClear() {
- $("#projects-distribution-select").empty();
- $("#projects-project-list").empty();
-}
-
-function projectsSetCookieDistribution(id)
-{
- saveCookie("projects_distribution", id, 7);
-}
-
-function projectsGetCookieDistribution()
-{
- id = getCookie("projects_distribution");
- if(id == "") {
- id = 0;
- }
- return id;
-}
+++ /dev/null
-/*
- session.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-$(function() {
- $('#login-form-password').keydown(function() {
- if(event.keyCode == '13') {
- sessionLogin();
- }
- });
-});
-
-function setSessionInfo(xml){
- var email = $(xml).find("Header").find("UserInfo").find("Email").text();
- var name = $(xml).find("Header").find("UserInfo").find("Name").text();
- var admin = $(xml).find("Header").find("UserInfo").find("Admin").text();
- var group;
- var idx = 0;
- $(xml).find("Header").find("UserInfo").find("GroupList").find("Group").each(function() {
- if(idx == 0) {
- group = $(this).find("GroupName").text();
- }
- });
-
- sessionStorage.sessionInfoEmail = email;
- sessionStorage.sessionInfoName = name;
- sessionStorage.sessionInfoGroup = group;
- sessionStorage.sessionInfoAdmin = admin;
-
- checkSessionInfo();
-}
-
-function checkSessionInfo(){
- var email = sessionStorage.sessionInfoEmail;
- var name = sessionStorage.sessionInfoName;
-
- if(email)
- {
- sessionHtml = '<div data-role="controlgroup" style="text-align: left; font-size: 12px" data-type="horizontal" class="ui-btn-right ui-btn-corner-all">';
- sessionHtml += '<p data-direction="reverse" ><a href="#userModify" onClick="userQueryUserInfo()" data-rel="dialog">'+name+'</a> | ';
- sessionHtml += '<a href=# onClick="logout()" data-direction="reverse">Log out</a></p></div>';
- }
- else
- {
- sessionHtml = '<div data-role="controlgroup" data-type="horizontal" class="ui-btn-right ui-btn-corner-all">';
- sessionHtml += '<a href=#signup data-direction="reverse" data-role="button" data-rel="dialog">Sign up</a>';
- sessionHtml += '<a href=#login data-direction="reverse" data-role="button" data-rel="dialog">Log in</a> </div>';
- }
- $(".sessionInfo").html(sessionHtml).trigger("create");
-}
-
-function clearSessionInfo(){
- sessionStorage.sessionInfoEmail = "";
- sessionStorage.sessionInfoName = "";
- sessionStorage.sessionInfoGroup = "";
- sessionStorage.sessionInfoAdmin = "";
-}
-
-function expireSession(){
- clearSessionInfo();
- $.mobile.changePage("index.html");
- generateNavigationBar("index");
-}
-
-function sessionLogin() {
- var infoList = [];
- var infoItem;
- var email = $('#login-form-email').val();
- var password = $('#login-form-password').val();
-
- if(email == ""){
- alert("Email is invalid");
- return false;
- }
-
- if(password == ""){
- alert("Password is invalid");
- return false;
- }
-
- changeInfoItem = {"Type":"ModifyUser", "Email":email, "Password":password };
- infoList.push(changeInfoItem);
-
- login(infoList, function (json) {
- var result = json.Result;
- var message = json.UserInfo.Message;
- var email = json.UserInfo.Eamil;
- var name = json.UserInfo.Name;
- var group = json.UserInfo.GroupName;
- var admin = json.UserInfo.Admin;
-
- if(result == "SUCCESS")
- {
- sessionStorage.sessionInfoEmail = email;
- sessionStorage.sessionInfoName = name;
- sessionStorage.sessionInfoGroup = group;
- sessionStorage.sessionInfoAdmin = admin;
-
- saveUserId(email);
-
- $.mobile.changePage("#index");
- }
- else
- {
- alert(message);
- }
- });
-}
-
-function clearLoginData()
-{
- $("#login-form-email").val("");
- $("#login-form-password").val("");
-}
-function getUserId()
-{
- id = getCookie("user_email");
- if(id != "") {
- $("#login-form-email").val(id);
- }
-}
-
-function saveUserId(id)
-{
- if($("#login-form-save").attr("checked") == "checked") {
- if (id != "") {
- saveCookie("user_email", id, 7);
- } else {
- saveCookie("user_email", id, -1);
- }
- }
- else {
- saveCookie("user_email", id, -1);
- }
-}
+++ /dev/null
-/*
- user.js
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-$(function() {
- $('#user-password-confirmation').keypress(function() {
- if(event.keyCode == '13') {
- userSignUp();
- }
- });
-});
-
-function userSignUp() {
- var infoList = [];
- var infoItem;
- var email = $('#signup-form-email').val();
- var name = $('#signup-form-name').val();
- var password = $('#signup-form-password').val();
- var password_confirm = $('#signup-form-password-confirmation').val();
- var emailCheckReg = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/
-
- if(email == "" || !emailCheckReg.test(email)){
- alert("Email is invalid");
- return false;
- }
- if(name == ""){
- alert("Name is invalid");
- return false;
- }
-
- if(password == ""){
- alert("Password is invalid");
- return false;
- }
-
- if(password != password_confirm){
- alert("Password is different");
- return false;
- }
-
- changeInfoItem = {"Type":"ModifyUser", "Email":email, "Name":name, "Password":password, "PasswordConfirm":password_confirm};
- infoList.push(changeInfoItem);
-
- signUp(infoList, function (json) {
- alert("Success sign up");
-
- var result = json.Result;
- var message = json.UserInfo.Message;
- var email = json.UserInfo.Eamil;
- var name = json.UserInfo.Name;
- var group = json.UserInfo.GroupName;
- var admin = json.UserInfo.Admin;
-
- if(result == "SUCCESS")
- {
- sessionStorage.sessionInfoEmail = email;
- sessionStorage.sessionInfoName = name;
- sessionStorage.sessionInfoGroup = group;
- sessionStorage.sessionInfoAdmin = admin;
- $.mobile.changePage("#index");
- }
- else
- {
- alert(message);
- }
- });
-}
-
-function userQueryUserInfo() {
- queryUserInfo( function (xml) {
- var email = $(xml).find("Data").find("User").find("Email").text();
- var name = $(xml).find("Data").find("User").find("Name").text();
-
- $("#userModify-email").val(email).textinput();
- $("#userModify-name").val(name).textinput();
- });
-}
-
-function userModifyUserInfo() {
- var changeInfoList = [];
- var changeInfoItem;
- var email = $('#userModify-email').val();
- var name = $('#userModify-name').val();
- var password = $('#userModify-password').val();
- var password_confirm = $('#userModify-password-confirm').val();
-
- if(email == ""){
- alert("Email is invalid");
- return false;
- }
- if(name == ""){
- alert("Name is invalid");
- return false;
- }
-
- if(password == ""){
- alert("Password is invalid");
- return false;
- }
-
- if(password != password_confirm){
- alert("Password is different");
- return false;
- }
-
- changeInfoItem = {"Type":"ModifyUser", "Email":email, "Name":name, "Password":password, "PasswordConfirm":password_confirm};
- changeInfoList.push(changeInfoItem);
-
- modifyUserInfo(changeInfoList, function (xml) {
- alert("Success changed information");
- });
-}
+++ /dev/null
-<!--
- log.html
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <script src="javascripts/jquery-1.7.1.min.js"></script>
-
- <script src="javascripts/dibs-api.js"></script>
- <script src="javascripts/session.js"></script>
- <script src="javascripts/log.js"></script>
- <style>
- body {
- margin: 0;
- border: none;
- padding: 0;
- overflow:scroll;
- overflow:auto;
- }
- #header {
- border: solid 1px;
- height: 28px;
- width: 100%;
- padding: 0;
- background-color: yellow;
- position:fixed;
- z-index: 9;
- vertical-align:middle
- }
- .job-info {
- height: 26px;
- position: relative;
- top: 7px;
- left: 5px;
- font-size: 12px;
- float: left;
- vertical-align:middle
- }
- .job-info-data {
-
- }
- #job-info-cancel {
- position: absolute;
- right:10px;
- }
- #body {
- position: absolute;
- top: 30px;
- width: 100%;
- }
- </style>
-</head>
-
-<body>
- <div id="header">
- <div class="job-info" style="width: 120px;">
- <span>Job ID: </span>
- <strong><span id="job-info-id" class="job-info-data"></span></strong>
- </div>
- <div class="job-info" style="width: 200px;">
- <span>Distribution: </span>
- <strong><span id="job-info-distribution" class="job-info-data"></span></strong>
- </div>
- <div class="job-info" style="width: 200px;">
- <span>Project: </span>
- <strong><span id="job-info-project" class="job-info-data"></span></strong>
- </div>
- <div class="job-info" style="width: 200px; display:none;">
- <span>Builder: </span>
- <strong><span id="job-info-builder" class="job-info-data"></span></strong>
- </div>
- <div class="job-info" style="width: 200px;">
- <span>Status: </span>
- <strong><span id="job-info-status" class="job-info-data"></span></strong>
- </div>
- <div id="job-info-cancel" data-mini="true">
- <input type="button" data-mini="true" value="CANCEL" onClick=cancelJob() / >
- </div>
- </div>
- <div id="body">
- <table id="log-contents" style="width: 100%; border: #000000 1px solid; font-size:9pt">
- </table>
- <div id="footer" data-role="controlgroup" data-mini="true" data-type="horizontal">
- <input type="button" value="More" onClick=moreLog() / >
- <input type="button" value="Stop" onClick=stopLog() / >
- </div>
-</body>
-</html>
-
+++ /dev/null
-# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
-#
-# To ban all spiders from the entire site uncomment the next two lines:
-# User-Agent: *
-# Disallow: /
+++ /dev/null
-/*
- * This is a manifest file that'll be compiled into application.css, which will include all the files
- * listed below.
- *
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
- *
- * You're free to add application-wide styles to this file and they'll appear at the top of the
- * compiled file, but it's generally better to create a new file per style scope.
- *
- *= require_self
- *= require_tree .
- */
+++ /dev/null
-/*
- style.css
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-*/
-
-body {
-
-}
-
-div.content-primary {
- width: 65%;
-}
-
-div.content-secondary {
- width: 25%;
-}
-
-#jobs-search-input .ui-input-search {
- width: 80%;
- display: inline-block;
-}
-
-#jobs-search-date .ui-input-text {
- width: 80%;
- display: inline-block;
-}
-
-table.imagetable {
- font-family: verdana,arial,sans-serif;
- font-size:11px;
- color:#333333;
- border-width: 1px;
- border-color: #999999;
- border-collapse: collapse;
- text-align : center;
-}
-table.imagetable th {
- background:#b5cfd2;
- border-width: 1px;
- padding: 8px;
- border-style: solid;
- border-color: #999999;
- text-align: center;
-}
-table.imagetable td {
- background:#dcddc0;
- border-width: 1px;
- padding: 8px;
- border-style: solid;
- border-color: #999999;
- max-width: 500px;
-}
-
-table.build-project-table {
- font-family: verdana,arial,sans-serif;
- font-size:11px;
- border-width: 1px;
- border-color: #999999;
- border-collapse: collapse;
-}
-table.build-project-table th {
- background:#b5cfd2;
- border-width: 1px;
- padding: 8px;
- border-style: solid;
- border-color: #999999;
- text-align: center;
-}
-table.build-project-table td {
- border-width: 1px;
- padding: 8px;
- border-style: solid;
- border-color: #999999;
-}
-
-.alignleft {
- float: left;
-}
-
-.alignright {
- float: right;
-}
-
-#signup-form * {
- text-align: left;
- font-size: 12px;
-}
-
-#login-form * {
- text-align: left;
- font-size: 12px;
-}
-
+++ /dev/null
-<!--
- upload.html
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
--->
-
-<head>
- <script type="text/javascript" src="javascripts/jquery-1.7.1.min.js"></script>
-</head>
-<body>
- <form enctype="multipart/form-data">
- <input name="file" type="file" />
- <input id="register" type="button" value="Upload" />
- </form>
- <progress hidden="hidden"></progress>
-</body>
-</html>
-
-<script>
-$('#register').click(function(){
- var prj_id = localStorage.uploadBinaryProjectId;
- var formData = new FormData($('form')[0]);
-
- formData.append("ProjectId", prj_id);
-
- $('progress').removeAttr("hidden");
-
- $.ajax({
- url: 'projects/binaryFileUpload', //server script to process data
- type: 'POST',
- xhr: function() { // custom xhr
- myXhr = $.ajaxSettings.xhr();
- if(myXhr.upload){ // check if upload property exists
- myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // for handling the progress of the upload
- }
- return myXhr;
- },
- //Ajax events
- beforeSend: beforeSendHandler,
- success: completeHandler,
- error: errorHandler,
-
- // Form data
- data: formData,
-
- //Options to tell JQuery not to process data or worry about content-type
- cache: false,
- contentType: false,
- processData: false
- });
-});
-
-function beforeSendHandler(e){
-}
-
-function completeHandler(e){
- alert("Register started! Closed this page");
-
- //close window
- window.open('about:blank','_self');
- opener = window;
- window.close();
-}
-
-function errorHandler(e){
-}
-
-function progressHandlingFunction(e){
- if(e.lengthComputable){
- $('progress').attr({value:e.loaded,max:e.total});
- }
-}
-</script>
+++ /dev/null
-#!/usr/bin/env ruby
-# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
-
-APP_PATH = File.expand_path('../../config/application', __FILE__)
-require File.expand_path('../../config/boot', __FILE__)
-require 'rails/commands'
+++ /dev/null
-# Logfile created on Mon Feb 06 23:18:31 +0900 2012 by logger.rb/22285
-I, [2012-02-06T23:18:31.266112 #30127] INFO -- : option parsing start
-I, [2012-02-06T23:18:31.266200 #30127] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-06T23:18:31.266322 #30127] INFO -- : option parsing end
+++ /dev/null
-#!/bin/sh -xe
-# clean
-clean()
-{
- rm -rf $SRCDIR/*.zip
- rm -rf $SRCDIR/*.tar.gz
-}
-
-# build
-build()
-{
- echo "build"
-}
-
-# install
-install()
-{
- BIN_DIR=$SRCDIR/package/tizen-dibs-test.package.${TARGET_OS}/data/tools/dibs
- mkdir -p $BIN_DIR
-
- BIN_DIR=$SRCDIR/package/dibs.package.${TARGET_OS}/data/tools/dibs/
- mkdir -p $BIN_DIR
- cp -f $SRCDIR/pkg-* $BIN_DIR/
- cp -f $SRCDIR/build-* $BIN_DIR/
- cp -rf $SRCDIR/src $BIN_DIR/
- cp -rf $SRCDIR/dibs-web $BIN_DIR/
- cp -f $SRCDIR/upgrade $BIN_DIR/
- cp -f $SRCDIR/web-svr $BIN_DIR/
- echo $VERSION > $BIN_DIR/VERSION
-
- TEST_DIR=$SRCDIR/package/dibs-test.package.${TARGET_OS}/data/test/dibs
- mkdir -p $TEST_DIR/performance_log
- cp -f $SRCDIR/test/performance_analyzer $TEST_DIR/
- cp -f $SRCDIR/test/statistics $TEST_DIR/
-}
+++ /dev/null
-#!/bin/sh -xe
-# clean
-clean()
-{
- rm -rf $SRCDIR/*.zip
- rm -rf $SRCDIR/*.tar.gz
-}
-
-# build
-build()
-{
- echo "build"
-}
-
-# install
-install()
-{
- BIN_DIR=$SRCDIR/package/dibs.package.${TARGET_OS}/data/tools/dibs/
- mkdir -p $BIN_DIR
- cp -f $SRCDIR/pkg-* $BIN_DIR/
- cp -f $SRCDIR/build-* $BIN_DIR/
- cp -rf $SRCDIR/src $BIN_DIR/
- cp -rf $SRCDIR/dibs-web $BIN_DIR/
- cp -f $SRCDIR/web-svr $BIN_DIR/
- cp -f $SRCDIR/upgrade $BIN_DIR/
- echo $VERSION > $BIN_DIR/VERSION
-}
+++ /dev/null
-#!/bin/sh -xe
-# clean
-clean()
-{
- rm -rf $SRCDIR/*.zip
- rm -rf $SRCDIR/*.tar.gz
-}
-
-# build
-build()
-{
- echo "build"
-}
-
-# install
-install()
-{
- BIN_DIR=$SRCDIR/package/dibs.package.${TARGET_OS}/data/tools/dibs/
- mkdir -p $BIN_DIR
- cp -f $SRCDIR/pkg-* $BIN_DIR/
- cp -f $SRCDIR/build-* $BIN_DIR/
- cp -rf $SRCDIR/src $BIN_DIR/
- cp -rf $SRCDIR/dibs-web $BIN_DIR/
- cp -f $SRCDIR/web-svr $BIN_DIR/
- cp -f $SRCDIR/upgrade $BIN_DIR/
- echo $VERSION > $BIN_DIR/VERSION
-}
+++ /dev/null
-* 2.2.10
-- parser rule changed
--- pkginfo.manifest custom field as a multiline
-== hyoun jiil <jiil.hyoun@samsung.com> 2015-06-22
-* 2.2.9
-- remove mail.rb
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-09-03
-* 2.2.8
-- remove white space of some source for test
--- it is not neccessary
--- only for demo
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-26
-* 2.2.7
-- remove white space of some source for test
--- it is not neccessary
--- only for demo
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-26
-* 2.2.6
-- remove white space of some source for test
--- it's not neccessary
--- only for demo
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-26
-* 2.2.5
-- remove white space of some source for test
--- it's not neccessary
--- only for demo
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-26
-* 2.2.4
-- snapshot name check when multiple package server sync
--- avoid snapshot name 'sync_sync_xxxx'
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-21
-* 2.2.3
-- multiple package server sync is no good design
--- Now package server can sync only one depth
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-19
-* 2.2.2
-- Fix pkg-svr clean/remove-snapshot bug
--- Now changes folder snapshot log also remove
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-14
-* 2.1.65
-- fix windows package bug caused by nasca
--- package has nasca encript file
--- it just need repackaging
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-08-05
-* 2.1.64
-- Copy project access information in clone distribution
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2014-05-28
-* 2.1.63
-- Fixed search job with project name matching.
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2014-04-14
-* 2.1.62
-- Fixed bug remove distribution
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2014-04-14
-* 2.1.61
-- Fixed display jobs list in web page.
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2014-03-03
-* 2.1.60
-- Fixed db connection timeout error
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-02-14
-* 2.1.59
-- Fixed os_info init process
-== jonghwan park <jonghwan2.park@samsung.com> 2014-01-28
-* 2.1.58
-- Added make-image option [-x] for except packages
-== jonghwan park <jonghwan2.park@samsung.com> 2014-01-27
-* 2.1.57
-- Fixed marshar error bug and some minor bugs
-== donghee yang <donghee.yang@samsung.com> 2014-01-23
-* 2.1.56
-- add gen dependency graph tool in pkg-cli
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-01-17
-* 2.1.55
-- added uselatest option in build-cli
--- it support fullbuild using commit id
-- added clone-dist option for build-svr
--- it support distribution clone
-== hyoun jiil <jiil.hyoun@samsung.com> 2014-01-15
-* 2.1.54
-- added make-image option [-i] for installmanager
-== jonghwan park <jonghwan2.park@samsung.com> 2013-12-06
-* 2.1.53
-- Fixed bug that transferred job failed when it has no "master" branch
-== donghee yang <donghee.yang@samsung.com> 2013-11-19
-* 2.1.52
-- support ftp as a package server
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-11-18
-* 2.1.51
-- support version number over 3 dots
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-11-14
-* 2.1.50
-- Fixed Timeout problem
-== donghee yang <donghee.yang@samsung.com> 2013-10-08
-* 2.1.49
-- Fixed bug about undisplayed project list in Projects page.
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2013-10-08
-* 2.1.48
-- Fixed sdk-image name (TIZNE -> TIZEN)
-== jonghwan park <jonghwan2.park@samsung.com> 2013-09-12
-* 2.1.47
-- add xml format for perfomance analyzer
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-09-09
-* 2.1.46
-- git repository essue fix
--- when repository change then build failed in friend server
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-08-21
-* 2.1.45
-- db connection refectoring
-- not support SQLite
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-08-19
-* 2.1.44
-- set tizen-dibs-test to test meta package
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-07-31
-* 2.1.43
-- change dibs-test dir and remove executer
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-07-31
-* 2.1.42
-- fix dibs-test dir
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-07-31
-* 2.1.41
-- add tizen-dibs-test and dibs-test package
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-07-28
-* 2.1.40
-- Fixed some minor bugs
-== Sungmin Kim <dev.sungmin.kim@samsung.com> 2013-06-04
-* 2.1.33
-- Applied "retry count" when downloading files
-- Changed "stop" command format of pkg sver
-- Fixed some minor bugs
-== donghee yang <donghee.yang@samsung.com> 2013-06-04
-* 2.1.32
-- DIBS command should be forcibly enter your email address and password.
-== Taejun ha <taejun.ha@samsung.com> 2013-04-24
-* 2.1.31
-- Fixed a bug that calc for empty room
-- Fixed a bug that local commit id is used for remote build
-- Shows reverse build jobs in DIBS WEB
-- Shows "ERROR CODE" in DIBS WEB
-== donghee yang <donghee.yang@samsung.com> 2013-04-24
-* 2.1.30
-- Fixed a bug that infinite loop of getting source code
-== donghee yang <donghee.yang@samsung.com> 2013-04-19
-* 2.1.29
-- Fixed a bug that migrating DB does not work
-== donghee yang <donghee.yang@samsung.com> 2013-04-19
-* 2.1.28
-- Fixed a bug that upgrade does not work
-== donghee yang <donghee.yang@samsung.com> 2013-04-19
-* 2.1.27
-- Fixed build server failure caused by job number
-== donghee yang <donghee.yang@samsung.com> 2013-04-19
-* 2.1.26
-- Added new user "sync-manager" for package synchronization
-- Changed to insert error code when job is ended with "ERROR"
-- Added time-stamping of job
-- Modified to make child build servers work without DB
-== donghee yang <donghee.yang@samsung.com> 2013-04-19
-* 2.1.25
-- Fixed a bug that remote job is not released from remote server queue
-== donghee yang <donghee.yang@samsung.com> 2013-04-12
-* 2.1.24
-- Fixed a bug that job assignment to child server is wrong
-== donghee yang <donghee.yang@samsung.com> 2013-04-12
-* 2.1.23
-- Modified to make build-server work when max-job is zero
-== donghee yang <donghee.yang@samsung.com> 2013-04-12
-* 2.1.22
-- Fixed not to build redundent jobs
-- Modified to use separate process for file transfering
-== donghee yang <donghee.yang@samsung.com> 2013-04-11
-* 2.1.21
-- Fixed the calculation of file transfer rate
-== donghee yang <donghee.yang@samsung.com> 2013-04-11
-* 2.1.20
-- Separate the process for log monitor
-== donghee yang <donghee.yang@samsung.com> 2013-04-10
-* 2.1.19
-- Fixed a bug that noreverse option is not working
-- Fixed a bug about checking dependency of multi job
-- Modified to continue build process when "git reset fail"
-- Fixed a but that remote job return wrong status
-- Fixed a bug that JOB numbering return 0
-== donghee yang <donghee.yang@samsung.com> 2013-04-05
-* 2.1.18
-- Increase protocol version from 1.8.0 to 1.9.0
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2013-04-04
-* 2.1.17
-- Add command about "pkg-cli changeLog -u url [-s snapshotName1,snapshotName2]"
-- Fixed Multi-job about sub-job add internal job for cancel process
-- Fixed stoping query-log when couldn't search in JOB queue
-- Fixed reverse-job to add int DB first after creation
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2013-04-03
-* 2.1.16
-- Fixed query-log terminated when status is not "FINISHED"
-- Fixed bug about file lock in build-cli
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2013-04-01
-* 2.1.15
-- Fixed some bug about query-log
-- Improve process in web side
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2013-03-29
-* 2.1.14
-- Support query-log command
-- Improve process to receive log
-== Sungmin kim <dev.sungmin.kim@samsung.com> 2013-03-28
-* 2.1.13
-- Fixed a bug that there are too many open files on build-svr
-== donghee yang <donghee.yang@samsung.com> 2013-03-27
-* 2.1.12
-- Project lock Applied with dibs web
-== taejun ha <taejun.ha@samsung.com> 2013-03-26
-* 2.1.11
-- Fixed a bug that "CANCEL" of remote job is not finished
-== donghee yang <donghee.yang@samsung.com> 2013-03-26
-* 2.1.10
-- Added more check points for immediate "CANCEL"
-== donghee yang <donghee.yang@samsung.com> 2013-03-26
-* 2.1.9
-- Fixed a bug that "CANCEL" is not done immediately
-== donghee yang <donghee.yang@samsung.com> 2013-03-26
-* 2.1.8
-- Modified to use hard-link instead of copying
-- Removed "verbose" option in build-cli
-== donghee yang <donghee.yang@samsung.com> 2013-03-25
-* 2.1.7
-- add log for debug
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-03-21
-* 2.1.6
-- Fixed client cache bug
-- Fixed Job numbering bug
-== donghee yang <donghee.yang@samsung.com> 2013-03-20
-* 2.1.5
-- bug fix : log file remove when job initializing
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-03-15
-* 2.1.4
-- several bug fix (for upgrade)
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-03-15
-* 2.1.3
-- Fixed download cache bug
-- Update comm.protoco.version to 1.8.0
-== donghee yang <donghee.yang@samsung.com> 2013-03-14
-* 2.1.2
-- several bug fix
-- db version update
-- fixed disk full problem
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-03-14
-* 2.1.1
-- Fixed a bug about setting external dependent package path
-== donghee yang <donghee.yang@samsung.com> 2013-03-14
-* 2.1.0
-- Version up
-== donghee yang <donghee.yang@samsung.com> 2013-03-12
-* 2.0.12
-== donghee yang <donghee.yang@samsung.com> 2013-03-12
-* 2.0.11
-- Fixed a bug in installing dep packages of local package
-== donghee yang <donghee.yang@samsung.com> 2013-01-23
-* 2.0.10
-- hot fix No method error
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-01-23
-* 2.0.9
-- several bug fix
--- sync bug fix
-== hyoun jiil <jiil.hyoun@samsung.com> 2013-01-21
-* 2.0.8
-- WEB
--- Update new job list and job's status in JOBS page.
--- Update added job log and job's status in JOBS LOG page.
-== sungmin kim <dev.sungmin.kim@samsung.com> 2012-12-12
-* 2.0.7
-- several bug fix
-- Add distribution to upgrade commnad
-- WEB
--- Fixed bug about request url include dot
--- Support browser about IE9
--- Add loading event (spinner)
-== hyoun jiil <jiil.hyoun@samsung.com> 2012-12-24
-* 2.0.6
-- several internal bug fix
-== hyoun jiil <jiil.hyoun@samsung.com> 2012-12-24
-* 2.0.5
-- Upgraded protocol version to 1.7.0
-- Fixed Sign Up bug on WEB
-- Fixed Job group filtering on WEB
-- Fixed User Delete on WEB
-== donghee yang <donghee.yang@samsung.com> 2012-12-14
-* 2.0.4
-- Fixed below bug again
-== donghee yang <donghee.yang@samsung.com> 2012-12-12
-* 2.0.3
-- fixed bug about web, build-cli query
-== donghee yang <donghee.yang@samsung.com> 2012-12-12
-* 2.0.2
-- fixed bug about web, build-cli query
-== sungmin kim <dev.sungmin.kim@samsung.com> 2012-12-12
-* 2.0.1
-- fixed build.os
-== sungmin kim <dev.sungmin.kim@samsung.com> 2012-12-12
-* 2.0.0
-- DIBS web added.
-== sungmin kim <dev.sungmin.kim@samsung.com> 2012-12-12
-* 1.2.20
-- display distribution when query
-== hyoun jiil <jiil.hyoun@samsung.com> 2012-11-29
-* 1.2.19
-- Fixed remote build bug and undefined method bug
-== donghee yang <donghee.yang@samsung.com> 2012-11-29
-* 1.2.18
-- Fixed "cancel" operation of remote job
-== donghee yang <donghee.yang@samsung.com> 2012-11-29
-* 1.2.17
-- change dir seperator when windows remove script execute
-== hyoun jiil <jiil.hyoun@samsung.com> 2012-11-28
-* 1.2.16
-- Increased communication timeout to 120sec
-== donghee yang <donghee.yang@samsung.com> 2012-11-28
-* 1.2.15
-- Increased communication timeout to 60sec
-== donghee yang <donghee.yang@samsung.com> 2012-11-28
-* 1.2.14
-- Applied basic job priority
-- Old job directory will be cleaned when restart
-== donghee yang <donghee.yang@samsung.com> 2012-11-28
-* 1.2.13
-- multi-build can passing --noreverse option
-== hyoun jiil <jiil.hyoun@samsung.com> 2012-10-29
-* 1.2.12
-- Change log on working package server
-== hyoun jiil <jiil.hyoun@samsung.com> 2012-10-29
-* 1.2.10
-- Change log support
-== hyoun jiil <jiil.hyoun@samsung.com> 2012-10-29
-* 1.2.9
-- Added distribution lock
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-18
-* 1.2.8
-- Fixed "cancel" bug
-- Changed to remain logss about communication errors
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-18
-* 1.2.7
-- Fixed a bug that reverse build choose wrong distribution project
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-17
-* 1.2.6
-- Increase TimeOut to 30 sec
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-17
-* 1.2.5
-- Fixed a bug that pkg-build is not working
-- Fixed some bugs when using ruby1.9.1
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-17
-* 1.2.4
-- Fixed a bug that "upgrade" of sub servers are not done
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-16
-* 1.2.3
-- Set "wget" retry count to 3
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-16
-* 1.2.2
-- Fixed server log contents
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-16
-* 1.2.1
-- Fixed some bugs : upgrade, parse error handling, pkg-build, remote job cancel
-== hyoun jiil <jiil.hyoun@samsung.com> 2011-10-16
-* 1.2.0
-- change log support
-- db support
-- multiple distribution support
-== hyoun jiil <jiil.hyoun@samsung.com> 2012-10-16
+++ /dev/null
-Source : dibs
-Version :2.2.10
-Maintainer : taejun ha<taejun.ha@samsung.com>, jiil hyoun <jiil.hyoun@samsung.com>, donghyuk yang <donghyouk.yang@samsung.com>, donghee yang <donghee.yang@samsung.com>, sungmin kim <dev.sungmin.kim@samsung.com, jonghwan park <jonghwan2.park@samsung.com>
-
-Package : tizen-dibs-test
-Label : DIBS Test Tools
-Attribute : test
-OS : ubuntu-32, ubuntu-64, windows-32, windows-64, macos-64
-Build-host-os : ubuntu-32
-Install-dependency : dibs-test
-Description : This package includes some tools for testing DIBS
-
-Package : dibs
-OS : ubuntu-32, ubuntu-64, windows-32, windows-64, macos-64
-Build-host-os : ubuntu-32
-Description : Distribute Inteligent Build System
-
-Package : dibs-test
-OS : ubuntu-32, ubuntu-64, windows-32, windows-64, macos-64
-Build-host-os : ubuntu-32
-Install-dependency : dibs
-Description : Test package for DIBS
-
-
+++ /dev/null
-Include: pkginfo.manifest
-
-Package : dibs
-OS : ubuntu-32, windows-32, macos-64, ubuntu-64, windows-64
-Build-host-os : windows-32, macos-64, ubuntu-64, windows-64
-Description : Distribute Inteligent Build System
+++ /dev/null
-#!/usr/bin/ruby
-
-=begin
-
- pkg-build
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/pkg_server"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/builder"
-require "utils"
-require "packageServer"
-require "Builder"
-require "optionparser"
-
-begin
- option = parse
-rescue => e
- puts e.message
- exit 0
-end
-
-#generate server when local package server is not set
-
-# check HOST OS
-if not Utils.check_host_OS() then
-
- if Utils.is_linux_like_os Utils::HOST_OS then
- Utils.set_default_linux_host_os
- puts "Warning: Your host OS is not supported!\nWe assume your host OS as #{Utils::HOST_OS} !!!"
- else
- puts "Error: Your host OS is not supported!"
- exit 1
- end
-end
-
-# if "--os" is not specified, use host os type
-if option[:os].nil? then
- option[:os] = Utils::HOST_OS
-end
-
-path = Dir.pwd
-if not File.exist? "package" then
- puts "current dirctory \"#{path}\" is not package root directory"
- exit 1
-end
-
-# if url specified
-if not option[:url].nil? then
- begin
- builder = Builder.get("default")
- if builder.pkgserver_url != option[:url] then
- puts "Package server URL has been changed! Creating new builder..."
- builder = Builder.create("default", option[:url], nil, nil, nil)
- end
- rescue
- puts "Default builder does not exist! Creating new builder..."
- builder = Builder.create("default", option[:url], nil, nil, nil)
- end
-else # if url is not specified
- begin
- builder = Builder.get("default")
- rescue
- puts "Default builder does not exist! Creating new builder..."
- builder = Builder.create("default", "http://172.21.111.132/pkgserver/unstable",nil, nil, nil)
- end
-end
-
-#build project
-if not builder.build( Utils::WORKING_DIR, option[:os], option[:clean], [], true) then
- puts "Build Failed!"
- exit 1
-else
- puts "Build Succeeded!"
- exit 0
-end
-
+++ /dev/null
-#!/usr/bin/ruby
-
-=begin
-
- pkg-clean
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/pkg_server"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/builder"
-require "utils"
-require "packageServer"
-require "Builder"
-require "CleanOptionParser"
-
-path = Dir.pwd
-if not File.exist? "package" then
- puts "current dirctory \"#{path}\" is not package root directory"
- exit 1
-end
-
-option = parse
-
-#generate server when local package server is not set
-
-# check HOST OS
-if not Utils.check_host_OS() then
-
- if Utils.is_linux_like_os Utils::HOST_OS then
- Utils.set_default_linux_host_os
- puts "Warning: Your host OS is not supported!\nWe assume your host OS as #{Utils::HOST_OS} !!!"
- else
- puts "Error: Your host OS is not supported!"
- exit 1
- end
-end
-
-begin
- builder = Builder.get("default")
-rescue
- puts "Default builder does not exist! Creating new builder..."
- builder = Builder.create("default", "http://172.21.111.132/pkgserver/unstable",nil)
-end
-
-#build project
-if not builder.clean( Utils::WORKING_DIR ) then
- puts "Clean failed!"
-else
- puts "Clean succeeded!"
-end
-
+++ /dev/null
-#!/usr/bin/ruby
-
-=begin
-
- pkg-cli
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-require 'logger'
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/pkg_server"
-
-#library
-require "utils"
-require "clientOptParser"
-require "client"
-require "packageServer"
-
-#set global variable
-@WORKING_DIR = nil
-
-#option parsing
-begin
- option = option_parse
-rescue => e
- # if option parse error print help message
- puts e.message
- exit 0
-end
-
-# check HOST OS
-if not Utils.check_host_OS() then
-
- if Utils.is_linux_like_os Utils::HOST_OS then
- Utils.set_default_linux_host_os
- puts "Warning: Your host OS is not supported!\nWe assume your host OS as #{Utils::HOST_OS} !!!"
- else
- puts "Error: Your host OS is not supported!"
- exit 1
- end
-end
-#if "--os" is not specfied, use host os type
-if option[:os].nil? then
- option[:os] = Utils::HOST_OS
-end
-
-case option[:cmd]
-when "clean" then
- client = Client.create( nil, option[:loc], nil, false )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.clean(option[:f])
-when "download" then
- client = Client.create( option[:url], option[:loc], nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- file_loc = client.download( option[:pkg], option[:os], option[:t] )
-when "make-img" then
- client = Client.create( option[:url], option[:loc], nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.make_img( option[:os], option[:info], option[:el] )
-when "dep-graph" then
- client = Client.create( option[:url], option[:loc], nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.gen_dep_graph( option[:os], option[:type] )
-when "install" then
- client = Client.create( option[:url], option[:loc], nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.install( option[:pkg], option[:os], option[:t], option[:f] )
-when "install-file" then
- if option[:t] then
- client = Client.create( option[:url], option[:loc], nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.install_local_pkg( option[:pkg], option[:t], option[:f] )
- else
- client = Client.create( nil, option[:loc], nil, false )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.install_local_pkg( option[:pkg], option[:t], option[:f] )
- end
-when "uninstall" then
- client = Client.create( nil, option[:loc], nil, false )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.uninstall( option[:pkg], option[:t] )
-when "upgrade" then
- client = Client.create( option[:url], option[:loc], nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.upgrade( option[:os], option[:t] )
-when "check-upgrade" then
- client = Client.create( option[:url], option[:loc], nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.check_upgrade( option[:os] )
-when "show-rpkg" then
- client = Client.create( option[:url], nil, nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- puts client.show_pkg_info( option[:pkg], option[:os] )
-when "list-rpkg" then
- client = Client.create( option[:url], nil, nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- result = client.show_pkg_list( option[:os] )
- if not result.nil? and not result.empty? then
- result.each do |i|
- name = i[0].strip
- version = i[1].strip
- desc = i[2].strip
- puts name + " (" + version + ")"
- end
- end
-when "show-lpkg" then
- client = Client.create( nil, option[:loc], nil, false )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- puts client.show_installed_pkg_info( option[:pkg] )
-when "list-lpkg" then
- client = Client.create( nil, option[:loc], nil, false )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- result = client.show_installed_pkg_list()
- if not result.nil? and not result.empty? then
- result.each do |i|
- name = i[0].strip
- version = i[1].strip
- desc = i[2].strip
- puts name + " (" + version + ")"
- end
- else
- puts "Info: There is no any package."
- end
-when "build-dep" then
- client = Client.create( option[:url], nil, nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- result = client.get_build_dependent_packages( option[:pkg], option[:os], true )
- if result.nil? then
- puts "Error: Failed to get remote package list. try update first."
- exit 1
- end
- ret = ""
- result.each do |i|
- ret = ret + i + " --> "
- end
- ret = ret.strip
- ret[-3..-1] = ""
- puts ret
-when "install-dep" then
- client = Client.create( option[:url], nil, nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- result = client.get_install_dependent_packages( option[:pkg], option[:os], true, false )
- if result.nil? then
- puts "Error: Failed to get remote package list. try update first."
- exit 1
- end
- ret = ""
- result.each do |i|
- ret = ret + i + " --> "
- end
- ret = ret.strip
- ret[-3..-1] = ""
- puts ret
-when "register" then
- client = Client.create( nil, nil, nil )
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.register(option[:address], option[:dist], option[:pkg], option[:passwd])
-when "snapshotlist" then
- client = Client.create(option[:url],nil,nil);
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- client.printSnapshotList(option[:all]);
-when "changelog" then
- client = Client.create(option[:url], nil, nil);
- if client.nil? then
- puts "Error: Cannot create package client!"
- exit 1
- end
- if option[:snapshot].nil?() then
- client.printChangeLog();
- else
- client.printChangeLog(option[:snapshot][0], option[:snapshot][1]);
- end
-else
- raise RuntimeError, "Input is incorrect : #{option[:cmd]}"
-end
+++ /dev/null
-#!/usr/bin/ruby
-
-=begin
-
- pkg-svr
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/pkg_server"
-require "utils"
-require "packageServer"
-require "serverOptParser"
-
-#option parsing
-begin
- option = option_parse
-rescue => e
- puts e.message
- exit 0
-end
-
-begin
- if option[:cmd].eql? "list" then
- if option[:id].empty? then
- PackageServer.list_id
- else
- PackageServer.list_dist option[:id]
- end
- exit
- end
-
- server = PackageServer.new( option[:id] )
-
- if server.nil?
- raise RuntimeError, "server class creation fail"
- end
-
- case option[:cmd]
- when "create"
- server.create( option[:id], option[:dist], option[:url], option[:loc] )
- when "register"
- server.register( option[:pkgs], option[:dist], option[:gensnap], option[:test], false )
- when "gen-snapshot"
- server.generate_snapshot( option[:snaps][0], option[:dist], option[:bsnap] )
- when "sync"
- server.sync( option[:dist], option[:force], option[:snaps][0] )
- when "add-dist"
- server.add_distribution( option[:dist], option[:url], option[:clone] )
- when "add-os"
- server.add_os( option[:dist], option[:os] )
- when "remove"
- if not option[:force] then
- puts "Do you want to really? then input \"YES\""
- input = $stdin.gets.strip
- if input.eql? "YES" then
- puts "Remove server!"
- else
- puts "Remove is canceled by user input"
- exit(0)
- end
- end
-
- server.remove_server()
- when "remove-dist"
- if not option[:force] then
- puts "Do you want to really? then input \"YES\""
- input = $stdin.gets.strip
- if input.eql? "YES" then
- puts "Remove server!"
- else
- puts "Remove is canceled by user input"
- exit(0)
- end
- end
-
- server.remove_dist( option[:dist] )
- when "remove-pkg"
- server.remove_pkg( option[:dist], option[:pkgs], option[:os] )
- when "remove-snapshot"
- server.remove_snapshot( option[:dist], option[:snaps] )
- when "clean"
- server.clean( option[:dist], option[:snaps] )
- when "start"
- server.start( option[:port], option[:passwd] )
- when "stop"
- server.stop( option[:passwd] )
- else
- raise RuntimeError, "input option incorrect : #{option[:cmd]}"
- end
-rescue => e
- puts e.message
-end
-
-
+++ /dev/null
-=begin
-
- BinaryUploadProject.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-require 'dbi'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "CommonProject.rb"
-require "RegisterPackageJob.rb"
-require "Version.rb"
-require "PackageManifest.rb"
-
-
-class BinaryUploadProject < CommonProject
- attr_accessor :pkg_name
-
- # initialize
- def initialize( name, server, os_list, dist_name, pkg_name = nil )
- super(name, "BINARY", server, os_list, dist_name, "OPEN")
- @pkg_name = pkg_name
- end
-
-
- # create new job
- def create_new_job( filename, dock = "0" )
- file_path = "#{@server.transport_path}/#{dock}/#{filename}"
- new_job = create_new_job_from_local_file( file_path )
- if not new_job.nil? then
- new_job.set_auto_remove(true)
- end
-
- return new_job
- end
-
-
- def create_new_job_from_local_file( file_path )
- filename = File.basename(file_path)
- new_name = filename.sub(/(.*)_(.*)_(.*)\.zip/,'\1,\2,\3')
- pkg_name = new_name.split(",")[0]
- os = new_name.split(",")[2]
-
- # check file name
- if @pkg_name != pkg_name then
- @server.log.error( "registed name is #{@pkg_name} not #{pkg_name} !", Log::LV_USER)
- return nil
- end
-
- # check os name
- if not @server.supported_os_list.include? os then
- @server.log.error( "server not support OS : #{os}", Log::LV_USER)
- return nil
- end
-
- # check package info
- if not File.exist? file_path then
- @server.log.error( "file not exists in #{file_path}", Log::LV_USER)
- return nil
- end
-
- pkginfo_dir = "#{@path}/pkginfos"
- if not File.exist? pkginfo_dir then FileUtils.mkdir_p pkginfo_dir end
- if not Utils.extract_a_file(file_path, "pkginfo.manifest", pkginfo_dir) then
- @server.log.error( "pkginfo.manifest file is not exist", Log::LV_USER)
- return nil
- end
- begin
- pkginfo =PackageManifest.new("#{pkginfo_dir}/pkginfo.manifest")
- rescue => e
- @server.log.error( e.message, Log::LV_USER)
- return nil
- end
-
- ##set up change log
- #change_log = {}
- #begin
- # change_log = Parser.read_changelog "#{pkginfo_dir}/changelog" if File.exist? "#{pkginfo_dir}/changelog"
- #rescue => e
- # @server.log.error( e.message, Log::LV_USER)
- # return nil
- #end
-
- #if not change_log.empty? and pkginfo.packages[0].change_log.empty? then
- # pkginfo.packages.each {|pkg| pkg.change_log = change_log}
- #end
-
- #if @server.changelog_check and not pkginfo.packages[0].does_change_exist? then
- # @server.log.error( "change log not found", Log::LV_USER)
- # return nil
- #end
-
- pkgs = pkginfo.get_target_packages(os)
- if pkgs.count != 1 then
- @server.log.error( "only one package can upload at one time", Log::LV_USER)
- return nil
- end
- if pkgs[0].package_name != @pkg_name then
- @server.log.error( "package name is #{pkgs[0].package_name} not #{@pkg_name}", Log::LV_USER)
- return nil
- end
-
- new_job = RegisterPackageJob.new( file_path, self, @server, nil, @dist_name )
- end
-
-
- def self.create_table(db, post_fix)
- db.do "CREATE TABLE project_bins (
- project_id INTEGER NOT NULL,
- pkg_name VARCHAR(32) NOT NULL,
- PRIMARY KEY ( project_id ),
- CONSTRAINT fk_project_bins_projects1 FOREIGN KEY ( project_id ) REFERENCES projects ( id ) )#{post_fix}"
- end
-
-
- def self.load(name, dist_name, server, db)
- row, prj_os_list, source_info, package_info = load_row(name, dist_name, db)
- prj_id = row['id']
- prj_name = row['name']
- prj_status = row['status']
-
- new_project = BinaryUploadProject.new(prj_name, server, prj_os_list, dist_name)
- new_project.set_project_id( prj_id )
- new_project.set_source_info( source_info )
- new_project.set_package_info( package_info )
- new_project.set_project_status( prj_status )
-
- row=db.select_one("SELECT * FROM project_bins WHERE project_id=#{prj_id}")
- if row.nil? then return nil end
- new_project.pkg_name=row['pkg_name']
-
- return new_project
- end
-
-
- def save(db)
- is_new = save_common(db)
- init()
-
- if is_new then
- db.do "INSERT INTO project_bins VALUES (#{@prj_id},'#{@pkg_name}')"
- db.do "INSERT INTO group_project_accesses
- VALUES ( (SELECT groups.id FROM groups WHERE groups.name = 'admin'),'#{@prj_id}','TRUE')"
- else
- db.do "UPDATE project_bins SET pkg_name='#{@pkg_name}' WHERE project_id=#{@prj_id})"
- end
- end
-
-
- def save_source_info(ver,info)
- @server.get_db_connection() do |db|
- save_source_info_internal(ver,info, db)
- end
- end
-
-
- # save package info
- def save_package_info_from_manifest(version, file_path, os)
- begin
- pkginfo =PackageManifest.new(file_path)
- rescue => e
- @server.log.error e.message
- return
- end
-
- pkginfo.get_target_packages(os).each do |pkg|
- save_package_info(pkg.version, pkg.package_name, os)
- end
- end
-
-
- def unload(db)
- if @prj_id != -1 then
- db.do "DELETE FROM project_bins WHERE project_id=#{@prj_id}"
- end
- unload_common(db)
- end
-end
+++ /dev/null
-=begin
-
- BuildClientOptionParser.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-require 'optparse'
-require 'utils'
-
-class BuildClientUsage
- BUILD="build-cli build -N <project name> -d <server address> -U <user-id> -w <user-password> [-o <os>] [--async] [-D <distribution name>] [--save]"
- QUERY="build-cli query -d <server address>"
- QUERY_SYSTEM="build-cli query-system -d <server address>"
- QUERY_PROJECT="build-cli query-project -d <server address>"
- QUERY_JOB="build-cli query-job -d <server address>"
- QUERY_LOG="build-cli query-log -d <server address> -j <job number> [--output <output file path>]"
- CANCEL="build-cli cancel -j <job number> -d <server address> -U user-id -w <user-password>"
- REGISTER="build-cli register -P <package file> -d <server address> -U user-id -w <user-password> [-t <ftp server url>] [-D <distribution name>]"
-end
-
-
-def option_error_check( options )
- case options[:cmd]
-
- when "build" then
- if options[:project].nil? or options[:project].empty? or
- options[:domain].nil? or options[:domain].empty? or
- options[:passwd].nil? or options[:passwd].empty? or
- options[:user].nil? or options[:user].empty? then
- raise ArgumentError, "Usage: " + BuildClientUsage::BUILD
- end
-
- when "query" then
- if options[:domain].nil? or options[:domain].empty? then
- raise ArgumentError, "Usage: " + BuildClientUsage::QUERY
- end
-
- when "query-system" then
- if options[:domain].nil? or options[:domain].empty? then
- raise ArgumentError, "Usage: " + BuildClientUsage::QUERY_SYSTEM
- end
-
- when "query-project" then
- if options[:domain].nil? or options[:domain].empty? then
- raise ArgumentError, "Usage: " + BuildClientUsage::QUERY_PROJECT
- end
-
- when "query-job" then
- if options[:domain].nil? or options[:domain].empty? then
- raise ArgumentError, "Usage: " + BuildClientUsage::QUERY_JOB
- end
-
- when "query-log" then
- if options[:domain].nil? or options[:domain].empty? or
- options[:job].nil? or options[:job].empty? then
- raise ArgumentError, "Usage: " + BuildClientUsage::QUERY_LOG
- end
-
- when "cancel" then
- if options[:job].nil? or options[:job].empty? or
- options[:domain].nil? or options[:domain].empty? or
- options[:passwd].nil? or options[:passwd].empty? or
- options[:user].nil? or options[:user].empty? then
- raise ArgumentError, "Usage: " + BuildClientUsage::CANCEL
- end
- when "register" then
- if options[:package].nil? or options[:package].empty? or
- options[:domain].nil? or options[:domain].empty? or
- options[:passwd].nil? or options[:passwd].empty? or
- options[:user].nil? or options[:user].empty? then
- raise ArgumentError, "Usage: " + BuildClientUsage::REGISTER
- end
-
- else
- raise ArgumentError, "Input is incorrect : #{options[:cmd]}"
- end
-
- if ARGV.length > 1 then
- raise ArgumentError, "Unknown argument value : #{ARGV[1]}"
- end
-end
-
-def option_parse
- options = {}
- banner = "Requiest service to build-server command-line tool." + "\n" \
- + "\n" + "Usage: build-cli <SUBCOMMAND> [OPTS] or build-cli (-h|-v)" + "\n" \
- + "\n" + "Subcommands:" + "\n" \
- + "\t" + "build Build and create package." + "\n" \
- + "\t" + "query Query information about build-server." + "\n" \
- + "\t" + "query-system Query system information about build-server." + "\n" \
- + "\t" + "query-project Query project information about build-server." + "\n" \
- + "\t" + "query-job Query job information about build-server." + "\n" \
- + "\t" + "query-log Query log contents about job in build-server." + "\n" \
- + "\t" + "cancel Cancel a building project." + "\n" \
- + "\t" + "register Register the package to the build-server." + "\n" \
- + "\n" + "Subcommand usage:" + "\n" \
- + "\t" + BuildClientUsage::BUILD + "\n" \
- + "\t" + BuildClientUsage::QUERY + "\n" \
- + "\t" + BuildClientUsage::QUERY_SYSTEM + "\n" \
- + "\t" + BuildClientUsage::QUERY_PROJECT + "\n" \
- + "\t" + BuildClientUsage::QUERY_JOB + "\n" \
- + "\t" + BuildClientUsage::QUERY_LOG + "\n" \
- + "\t" + BuildClientUsage::CANCEL + "\n" \
- + "\t" + BuildClientUsage::REGISTER + "\n" \
- + "\n" + "Options:" + "\n"
- #+ "\t" + "resolve Request change to resolve-status for build-conflict." + "\n" \
- #+ "\t" + BuildClientUsage::RESOLVE + "\n" \
-
- optparse = OptionParser.new(nil, 32, ' '*8) do|opts|
-
- # Set a banner, displayed at the top
- # of the help screen.
-
- opts.banner = banner
-
- opts.on( '-N', '--project <project name>', 'project name' ) do|project|
- if not Utils.multi_argument_test( project, "," ) then
- raise ArgumentError, "Project variable parsing error : #{project}"
- end
- options[:project] = project
- end
-
- options[:domain] = nil
- opts.on( '-d', '--address <server address>', 'build server address: 127.0.0.1:2224' ) do|domain|
- options[:domain] = domain
- end
-
- options[:os] = nil
- opts.on( '-o', '--os <operating system>', 'target operating system: ubuntu-32/ubuntu-64/windows-32/windows-64/macos-64' ) do |os|
- if not Utils.multi_argument_test( os, "," ) then
- raise ArgumentError, "OS variable parsing error : #{os}"
- end
- options[:os] = os
- end
-
- options[:async] = "NO"
- opts.on( '--async', 'asynchronous job' ) do
- options[:async] = "YES"
- end
-
- options[:noreverse] = "NO"
- opts.on( '--noreverse', 'do not check reverse build' ) do
- options[:noreverse] = "YES"
- end
-
- options[:uselatest] = "NO"
- opts.on( '--uselatest', 'use latest git commit id build' ) do
- options[:uselatest] = "YES"
- end
-
- options[:rebuild] = "NO"
- opts.on( '--rebuild', 'do not check package version' ) do
- options[:rebuild] = "YES"
- end
-
- options[:save] = false
- opts.on( '--save', 'save the files built from remote server' ) do
- options[:save] = true
- end
-
- opts.on( '-j', '--job <job number>', 'job number' ) do|job|
- options[:job] = job
- end
-
- options[:passwd] = ""
- opts.on( '-w', '--passwd <user-password>', 'user password' ) do|passwd|
- options[:passwd] = passwd
- end
-
- opts.on( '-P', '--pkg <package file>', 'package file path' ) do|package|
- options[:package] = package.strip
- end
-
- opts.on( '-D', '--dist <distribution name>', 'distribution name' ) do|dist|
- options[:dist] = dist
- end
-
- opts.on( '-t', '--ftp <ftp server url>', 'ftp server url: ftp://dibsftp:dibsftp@127.0.0.1' ) do|domain|
- options[:fdomain] = domain
- end
-
- options[:user] = ""
- opts.on( '-U', '--user <user email>', 'user email infomation' ) do|user|
- options[:user] = user
- end
-
- options[:output] = nil
- opts.on( '--output <output_path>', 'output file path' ) do|path|
- options[:output] = path
- end
-
- opts.on( '-h', '--help', 'display help' ) do
- opts.help.split("\n").each {|op| puts op if not op.include? "--noreverse" and not op.include? "--rebuild" and not op.include? "--uselatest"}
- exit
- end
-
- opts.on( '-v', '--version', 'display version' ) do
- puts "DIBS(Distributed Intelligent Build System) version " + Utils.get_version()
- exit
- end
-
-
- end
-
- cmd = ARGV[0]
-
- if cmd.eql? "build" or #cmd.eql? "resolve" or
- cmd.eql? "query" or cmd.eql? "query-system" or
- cmd.eql? "query-project" or cmd.eql? "query-job" or
- cmd.eql? "query-log" or
- cmd.eql? "cancel" or
- cmd.eql? "register" or
- cmd =~ /(-v)|(--version)/ or
- cmd =~ /(help)|(-h)|(--help)/ then
-
- if cmd.eql? "help" then
- ARGV[0] = "-h"
- end
-
- options[:cmd] = ARGV[0]
- else
- raise ArgumentError, "Usage: build-cli <SUBCOMMAND> [OPTS] or build-cli -h"
- end
-
- optparse.parse!
-
- option_error_check options
-
- return options
-end
+++ /dev/null
-=begin
-
- BuildJob.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/builder"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/pkg_server"
-require "client.rb"
-require "PackageManifest.rb"
-require "Version.rb"
-require "Builder.rb"
-require "RemoteBuilder.rb"
-require "utils.rb"
-require "ReverseBuildChecker.rb"
-require "CommonJob.rb"
-require "BuildServerException.rb"
-require "FileUtil"
-
-class BuildJob < CommonJob
-
- attr_accessor :pkginfo, :source_path
- attr_accessor :pkgsvr_client
- attr_accessor :no_reverse
- attr_accessor :remote_id, :remote_status, :remote_error_msg
-
- # initialize
- def initialize (project, os, server)
- super(server)
- @project = project
- @os = os
- @type = "BUILD"
-
- @host_os = Utils::HOST_OS
- if not @server.distmgr.nil? and @server.has_db? and
- not @project.nil? and not @project.is_transferred? then
- @pkgsvr_url = @server.distmgr.get_distribution(project.dist_name).pkgsvr_url
- @pkgsvr_ip = @server.distmgr.get_distribution(project.dist_name).pkgsvr_ip
- @pkgsvr_port = @server.distmgr.get_distribution(project.dist_name).pkgsvr_port
- @pkgsvr_password = @server.distmgr.get_distribution(project.dist_name).pkgsvr_password
- else
- @pkgsvr_url = ""
- @pkgsvr_ip = ""
- @pkgsvr_port = ""
- @pkgsvr_password = ""
- end
-
- # this item will be initialized on pre-verify
- @pkginfo = nil
- @pkgsvr_client = nil
- @log = nil
- @parent = nil # for job hierachy
-
- #for cancel operation
- #@pending_ancestor = nil # for cancel pending job
- @remote_id = nil # for cancel remote_working job
- @build_dep_prjs = nil # for cacnel pending job
- @remote_status = ""
- @remote_error_msg = ""
-
- ## for resolving build-break
- #@rev_fail_projects = [] # list of [project,os]
- #@rev_success_jobs = [] # list of job
-
- # remote build
- @remote_server = nil
-
- # job type
- @is_rev_build_check_job = false
- @is_remote_job = false
-
- # "verified" means that server will not check any rule
- @is_verified = false
- # "send_result_back" mean that server will send package file by network
- @send_result_back = false
- @dock_num = "0"
- @result_files = []
-
- @external_pkgs = []
- @force_rebuild = false
-
- @no_reverse = false
- end
-
-
- def get_distribution_name()
- return @project.dist_name
- end
-
-
- def get_buildroot()
- return @buildroot_dir
- end
-
-
- # set reverse build check job
- def set_rev_build_check_job( parent )
- @is_rev_build_check_job = true
-
- # if parent exists, share build-root
- if not parent.nil? then
- set_parent_job( parent )
- end
- end
-
-
- def is_rev_build_check_job()
- return @is_rev_build_check_job
- end
-
-
- def set_remote_job(server)
- @is_remote_job = true
- @remote_server=server
- server.add_working_job(self)
- end
-
-
- def is_remote_job()
- return (not @remote_server.nil?)
- end
-
-
- def get_remote_server()
- return @remote_server
- end
-
-
- def set_no_reverse()
- @no_reverse = true
- end
-
-
- def set_verified( value )
- @is_verified = value
- end
-
-
- def set_send_result_back( dock_num )
- @send_result_back = true
- @dock_num = dock_num
- end
-
-
- def is_send_result_back?
- return @send_result_back
- end
-
-
- def get_result_files()
- return @result_files
- end
-
- # set force rebuild
- # This make project to build
- # even though there is a package of same version on pkg-server
- def set_force_rebuild(value)
- @force_rebuild = value
- end
-
-
- # add external packages to overwrite before build
- def add_external_package( file_name )
- @external_pkgs.push file_name
- end
-
-
- # for transferred project, this will overwite URL
- def set_package_server_url(url)
- @pkgsvr_url = url
- end
-
-
- #cancel
- def cancel()
- # kill sub process if exist?
- kill_sub_process()
-
- # cancel all its sub jobs
- @sub_jobs.select{|x| x.event == "NONE" and x.status != "FINISHED" and x.status != "ERROR" and x.status != "CANCELED" }.each do |sub|
- sub.event = "CANCEL"
- end
-
- # cancel all its reverse job
- @server.jobmgr.reverse_build_jobs.each do |job|
- if job.get_parent_job() == self and job.event == "NONE" then
- job.event = "CANCEL"
- end
- end
-
- if @status == "REMOTE_WORKING" then
- client = BuildCommClient.create( @remote_server.ip, @remote_server.port, @log )
- if not client.nil? then
- client.send "CANCEL|#{@remote_id}||"
- result1 = client.receive_data()
- if result1.nil? then
- @log.info( "cancel operation failed [connection error] !!", Log::LV_USER)
- else
- result1.each do |l|
- @log.info(l, Log::LV_USER)
- end
- end
- client.terminate
- end
- end
-
- # wait for job thread to finish
- @thread.join if not @thread.nil?
-
- # cancel log print
- if not @log.nil? then
- @log.info( "JOB is canceled by cancel operation !!", Log::LV_USER)
- end
- end
-
-
- # check building is possible
- def can_be_built_on?(host_os)
- if @pkginfo.nil? then return false end
-
- @pkginfo.packages.each do |pkg|
- if not pkg.os_list.include? @os then next end
- if not pkg.build_host_os.include? host_os then
- return false
- end
- end
-
- return true
- end
-
-
- def get_packages()
- return @pkginfo.packages
- end
-
-
- def get_build_dependencies(target_os)
- return @pkginfo.get_build_dependencies(target_os)
- end
-
-
- def get_source_dependencies(target_os,host_os)
- return @pkginfo.get_source_dependencies(target_os,host_os)
- end
-
-
- def is_same_with?(wjob)
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- if @type != wjob.type then return false end
-
- prj1 = get_project()
- prj2 = wjob.get_project()
-
- # check project name
- if prj1.nil? or prj2.nil? or
- prj1.name != prj2.name then
- return false
- end
-
- # check version
- if @pkginfo.nil? or wjob.pkginfo.nil? or
- not(Version.new(@pkginfo.get_version()) == Version.new(wjob.pkginfo.get_version())) then
- return false
- end
- end
-
-
- def is_compatible_with?(o)
- # must have same distribution
- if get_distribution_name() != o.get_distribution_name() then
- return false
- end
-
- if type != o.type then return false end
-
- my_project = get_project()
- other_project = o.get_project()
-
- # check project name
- if my_project.nil? or other_project.nil? or
- my_project.name != other_project.name then
- return false
- end
-
- # check version
- if @pkginfo.nil? or o.pkginfo.nil? or
- not(Version.new(@pkginfo.get_version()) == Version.new(o.pkginfo.get_version())) then
- return false
- end
-
- # check compat os
- @pkginfo.get_target_packages(@os).each do |p|
- if not p.os_list.include?(o.os) then return false end
- end
-
- return true
- end
-
-
- def has_build_dependency?(other_job)
-
- if has_same_packages?(other_job) or
- does_depend_on?(other_job) or
- does_depended_by?(other_job) then
-
- return true
- else
- return false
- end
- end
-
-
- def has_same_packages?( wjob )
-
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- # same package must have same os
- if not @os.eql? wjob.os then
- return false
- end
-
- # check package name
- get_packages().each do |pkg|
- wjob.get_packages().each do |wpkg|
- if pkg.package_name == wpkg.package_name then
- #puts "Removed from candiated... A == B"
- return true
- end
- end
- end
-
- return false
- end
-
-
- def does_depend_on?( wjob )
-
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- # compare build dependency
- get_build_dependencies(@os).each do |dep|
- wjob.get_packages().each do |wpkg|
- # dep packages of my job must have same name and target os
- # with packages in working job
- if dep.package_name == wpkg.package_name and
- dep.target_os_list.include? wjob.os then
- #puts "Removed from candiated... A -> B"
- return true
- end
- end
- end
-
- return false
- end
-
-
- def does_depended_by?( wjob )
-
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- get_packages().each do |pkg|
- wjob.get_build_dependencies(wjob.os).each do |dep|
- # dep package of working job must have same name and target os
- # with packages in my job
- if dep.package_name == pkg.package_name and
- dep.target_os_list.include? @os then
- #puts "Checking... A <- B"
- return true
- end
- end
- end
- return false
- end
-
-
- # return the job is asyncronous job
- def is_asynchronous_job?
- return true
- end
-
-
- # get project that my job is dependent on
- def get_build_dependent_projects()
- if @build_dep_prjs.nil? then
- deps = @pkginfo.get_build_dependencies(@os)
- pkgs = deps.map do |x|
- # if "os" is not specified, use my "os"
- if x.target_os_list.nil? or x.target_os_list.empty? then
- os = @os
- else
- os = x.target_os_list[0]
- end
-
- # package as item
- @pkgsvr_client.get_pkg_from_list(x.package_name, os)
- end
- prjs = @server.prjmgr.get_projects_from_pkgs(pkgs, get_distribution_name())
- @build_dep_prjs = prjs
- end
-
- return @build_dep_prjs
- end
-
-
- # check if the project is my dependent project
- def is_build_dependent_project( prj, os )
- dep_list = get_build_dependent_projects()
- dep_list.each do |dep|
- if dep[0] == prj and dep[1] == os then
- return true
- end
- end
-
- return false
- end
-
-
- def progress
- return ""
- end
-
-
- def get_log_url()
- # only when server support log url
- if @server.job_log_url.empty? then
- return ""
- end
-
- return "#{@server.job_log_url}/#{@id}/log"
- end
-
-
- #
- # PROTECTED METHODS
- #
-
-
- # main module
- protected
- def job_main()
- @log.info( "Invoking a thread for building Job #{@id}", Log::LV_USER)
- @log.info( "New Job #{@id} is started", Log::LV_USER)
-
- # checking build dependency
- if not @is_remote_job and not @is_verified then
- check_build_dependency()
- end
-
- # clean build
- build()
-
- lock_event
-
- if not @parent.nil? and not @is_rev_build_check_job then
- copy_result_files(@parent.source_path)
- end
-
- # upload
- if not @is_rev_build_check_job and not @send_result_back and @parent.nil? then
- upload()
- end
-
- # copy result files to transport path
- if @send_result_back and not @is_rev_build_check_job then
- copy_result_files_to_master()
- end
-
- # INFO. don't change this string
- @log.info( "Job is completed!", Log::LV_USER)
- @status = "FINISHED"
- end
-
-
- # check if local package version is greater than server
- def check_package_version( source_info )
- @log.info( "Checking package version ...", Log::LV_USER)
-
- # check if version is same and source_info is different
- ver_local = @pkginfo.packages[0].version
- old_source_info = @project.get_source_info( ver_local )
- if ( not @force_rebuild and
- not old_source_info.nil? and old_source_info != source_info ) then
-
- raise BuildServerException.new("ERR106"), "#{ver_local}"
- end
-
- # compare with package version in package server
- @pkginfo.packages.each do |pkg|
- # check all supported os
- ver_svr = @pkgsvr_client.get_attr_from_pkg( pkg.package_name, @os, "version")
- # ignore if package does not exist
- if ver_svr.nil? then next end
-
- # compare version
- if ( not @force_rebuild and
- ( Version.new(ver_local) < Version.new(ver_svr) or
- Version.new(ver_local) == Version.new(ver_svr) ) ) then
-
- raise BuildServerException.new("ERR105"), "#{ver_local} <= #{ver_svr}"
- end
- end
-
- return true
- end
-
-
- # build dependency version
- # make sure that package server has all dependency packages of job
- def check_build_dependency()
- @log.info( "Checking build dependency ...", Log::LV_USER)
- @pkgsvr_client.update
- unmet_bdeps = []
- @pkginfo.get_build_dependencies( @os ).each do |dep|
- # if parent exist, search parent source path first
- # if not found, check package server
- ver_svr = nil
- if not @parent.nil? then
- local_pkg = get_local_path_of_dependency( dep, @parent )
- if not local_pkg.nil? then
- ver_svr = Utils.get_version_from_package_file( local_pkg )
- else
- ver_svr = nil
- end
- end
- if not ver_svr.nil? then next end
-
- if not remote_package_of_dependency_exist?(dep) then
- unmet_bdeps.push dep
- end
- end
-
- @log.info( "Checking install dependency ...", Log::LV_USER)
- unmet_ideps = []
- @pkginfo.get_install_dependencies( @os ).each do |dep|
- # if parent exist, search pkginfos for all sub jobs
- # if not found, check package server
- found = false
- if not @parent.nil? and @parent.type == "MULTIBUILD" then
- @parent.get_sub_jobs().each do |j|
- os = (dep.target_os_list.empty?) ? @os : dep.target_os_list[0]
- if j.pkginfo.pkg_exist?(dep.package_name, dep.base_version, os) then
- found = true; break
- end
- end
- end
- if found then next end
-
- if not remote_package_of_dependency_exist?(dep) then
- unmet_ideps.push dep
- end
- end
-
- # unmet dependencies found , report the errors
- if not unmet_bdeps.empty? or not unmet_ideps.empty? then
- unmet_pkgs = []
- unmet_bdeps.each do |d|
- os = (d.target_os_list.empty?) ? @os : d.target_os_list[0]
- unmet_pkgs.push "#{d.package_name}(#{os})"
- end
- unmet_ideps.each do |d|
- os = (d.target_os_list.empty?) ? @os : d.target_os_list[0]
- unmet_pkgs.push "#{d.package_name}(#{os})"
- end
- unmet_pkgs.uniq!
- raise BuildServerException.new("ERR200"), unmet_pkgs.join(",")
- end
- end
-
-
- # build clean
- def build()
- # build
- build_normal()
- end
-
-
- # check whether build this job or not
- # if not build, then return its compat pkgs list
- def check_compatable_packages
- compat_pkgs = [] # [ package name, os, local_path ]
-
- @pkginfo.get_target_packages(@os).each do |p|
- # if package has only os then must build
- if p.os_list.count <= 1 then return [] end
-
- compat_found = false
- p.os_list.each do |o|
- # check parent pkgs first
- if not @parent.nil? then
- parent_pkgs = Dir.glob("#{@parent.source_path}/#{p.package_name}_*_*.zip")
- parent_pkgs.each do |lp|
- lpname = Utils.get_package_name_from_package_file( lp )
- lver = Utils.get_version_from_package_file(lp)
- los = Utils.get_os_from_package_file( lp )
- if lpname == p.package_name and o == los and lver == p.version then
- compat_pkgs.push [p.package_name,o,lp]
- compat_found = true
- break
- end
- end
- end
- if compat_found then break end
-
- # check other package already in package server
- ver_svr = @pkgsvr_client.get_attr_from_pkg( p.package_name, o, "version")
- if not ver_svr.nil? and p.version.eql? ver_svr then
- compat_pkgs.push [p.package_name,o,nil]
- compat_found = true
- break
- end
- end
-
- # if there is no compat pkgs for one pkg, then must build
- if not compat_found then return [] end
- end
-
- return compat_pkgs
- end
-
-
- def build_normal()
- @log.info( "Started to build this job...", Log::LV_USER)
-
- # create builder
- if @is_remote_job then
- builder = RemoteBuilder.create_from_server(@remote_server, @server.ftp_addr, @server.ftp_port, @server.ftp_username, @server.ftp_passwd)
- @log.info( "JobBuilder##{@id} is created", Log::LV_USER)
- @log.info( " - Remote Server : #{@remote_server.ip}:#{@remote_server.port}" )
- if not @server.ftp_addr.nil? then
- @log.info( " - FTP Server : #{@server.ftp_addr}" )
- end
- else
- builder = Builder.create( "JB#{@id}", @pkgsvr_url, nil,
- "#{@buildroot_dir}", @server.build_cache_dir )
- if builder.nil? then
- raise BuildServerException.new("ERR201")
- end
- @log.info( "JobBuilder##{@id} is created", Log::LV_USER)
- @log.info( " - Package Server : #{@pkgsvr_url}" )
- @log.info( " - Build Cache Path : #{@server.build_cache_dir}" )
- end
- @log.info( " - Log Path : #{@log.path}" )
-
- # if sub job, install dependent packages of parent-pkgs and not clean
- use_clean = true
- local_pkgs = []
- @external_pkgs.each do |p|
- local_pkgs.push "#{@job_root}/external_pkgs/#{p}"
- end
- if not @parent.nil? then
- use_clean = false
- # get local packages to install
- deps = @pkginfo.get_build_dependencies(@os)
- local_pkgs += get_local_paths_of_chained_dependencies( deps, @parent )
- end
- local_pkgs.uniq!
-
- #compatable os support
- compat_ok = true
- compat_pkgs = check_compatable_packages
- if compat_pkgs.size > 0 and not @is_rev_build_check_job then
- # bring package from server for reverse check
- compat_pkgs.each do |p|
- pkg_name = p[0]; cos = p[1]; local_path = p[2]
-
- if not local_path.nil? then
- ext = File.extname(local_path)
- base_package_name= File.basename(local_path, "#{cos}#{ext}")
- @log.info( "Copying compatible package:#{local_path}", Log::LV_USER)
- @log.info( "Creating package file ... #{base_package_name}#{@os}#{ext}", Log::LV_USER)
- #FileUtils.ln local_path, "#{@source_path}/#{base_package_name}#{@os}#{ext}", :force => true
- if not FileUtil.safeLink(local_path, "#{@source_path}/#{base_package_name}#{@os}#{ext}") then
- @log.error("Failed to link file [#{local_path}] to [#{@source_path}/#{base_package_name}#{@os}#{ext}]")
- end
- else
- @log.info( "Downloading compatible package:#{pkg_name}(#{cos})", Log::LV_USER)
- loc = @pkgsvr_client.download(pkg_name, cos, false)
- if loc.nil? or loc.count != 1 then
- @log.warn( "Downloading compatible package failed!:#{pkg_name}(#{cos})", Log::LV_USER)
- compat_ok = false
- break
- end
- ext = File.extname(loc[0])
- base_package_name= File.basename(loc[0], "#{cos}#{ext}")
- @log.info( "Creating package file ... #{base_package_name}#{@os}#{ext}", Log::LV_USER)
- FileUtils.mv loc[0], "#{@source_path}/#{base_package_name}#{@os}#{ext}"
- end
- end
- else
- compat_ok = false
- end
-
- # if compat check failed
- if not compat_ok then
- # build
- if @is_remote_job then
- result = builder.build_job(self, local_pkgs)
- # if remote build finishes, remove job from remote server
- get_remote_server().remove_working_job(self)
- get_remote_server().update_db()
- else
- result = builder.build_job(self, use_clean, local_pkgs, false )
- end
- if not result then
- raise BuildServerException.new("ERR202")
- end
- end
-
- # check reverse dependecy if not sub jobs
- if not @no_reverse and not @is_rev_build_check_job and not @is_verified and
- not ReverseBuildChecker.check( self, true ).empty? then
-
- raise BuildServerException.new("ERR203")
- end
- end
-
-
- def upload()
- begin
- add_timestamp("UPLOAD_START")
- @log.info( "Uploading ...", Log::LV_USER)
-
- # get package path list
- binpkg_path_list = Dir.glob("#{@source_path}/*_*_#{@os}.zip")
-
- # upload
- u_client = Client.create( @pkgsvr_url, nil, @log )
- if u_client.nil? then
- raise BuildServerException.new("ERR023")
- end
-
- snapshot = u_client.upload( @pkgsvr_ip, @pkgsvr_port, binpkg_path_list, @server.ftp_addr, @server.ftp_port, @server.ftp_username, @server.ftp_passwd, @pkgsvr_password)
-
- if snapshot.nil? then
- raise BuildServerException.new("ERR204")
- end
-
- # update local
- @log.info( "Upload succeeded. Sync local pkg-server again...", Log::LV_USER)
- @pkgsvr_client.update
- @log.info("Snapshot: #{snapshot}", Log::LV_USER)
-
- ensure
- add_timestamp("UPLOAD_END")
- end
- end
-
-
- def copy_result_files(dst_path)
- @log.info( "Copying result files to #{dst_path}", Log::LV_USER)
-
- # get package path list
- binpkg_path_list = Dir.glob("#{@source_path}/*_*_#{@os}.zip")
-
- binpkg_path_list.each do |file|
- @result_files.push File.basename(file)
- @log.info( " * #{file}", Log::LV_USER)
- #FileUtils.ln(file,"#{dst_path}/", :force => true)
- if not FileUtil.safeLink(file,"#{dst_path}/") then
- @log.error("Failed to link file [#{file}] to [#{dst_path}]")
- end
- end
- end
-
-
- # copy binary package files and log file to transport dir
- def copy_result_files_to_master()
- outgoing_dir = "#{@server.transport_path}/#{@dock_num}"
- if not File.exist? outgoing_dir then
- FileUtils.mkdir_p outgoing_dir
- end
-
- # copy result files
- copy_result_files( outgoing_dir )
- end
-
-
- protected
- def get_local_path_of_dependency( dep, parent )
- dep_target_os = get_os_of_dependency(dep)
-
- # search my parent job and its parent job
- binpkgs = Dir.glob("#{parent.source_path}/#{dep.package_name}_*_#{dep_target_os}.zip")
- if binpkgs.count == 0 and not parent.get_parent_job().nil? then
- binpkgs = Dir.glob("#{parent.get_parent_job().source_path}/#{dep.package_name}_*_#{dep_target_os}.zip")
- end
-
- if binpkgs.count > 0 then
- pkg = binpkgs[0]
- version = Utils.get_version_from_package_file(pkg)
- if dep.match? version then
- return pkg
- else
- return nil
- end
- else
- return nil
- end
- end
-
-
- protected
- def get_local_paths_of_chained_dependencies( deps, parent )
- pkg_paths = []
-
- # get packages names that is related my build dependency
- chained_deps = get_local_chained_dependencies( deps, parent )
-
- # get all local path of dependencies
- chained_deps.each do |dep|
- new_path = get_local_path_of_dependency(dep, parent)
- if not new_path.nil? then
- pkg_paths.push new_path
- end
- end
-
- # remove duplicates
- pkg_paths.uniq!
-
- return pkg_paths
- end
-
-
- protected
- def get_local_chained_dependencies( deps, parent )
-
- chained_deps = []
- chained_deps += deps
-
- # if parent is multi build job, gether all install dependency of dependency.
- if parent.type == "MULTIBUILD" then
- begin
- old_deps_count = chained_deps.count
- new_deps = []
- chained_deps.each do |dep|
- dep_target_os = get_os_of_dependency(dep)
-
- parent.get_sub_jobs().each do |j|
- new_deps += j.pkginfo.get_install_dependencies(dep_target_os, dep.package_name)
- end
- end
- chained_deps += new_deps
- chained_deps.uniq! {|d| d.package_name }
- end while chained_deps.count != old_deps_count
- end
-
- # check parent of parent
- if not parent.get_parent_job().nil? then
- chained_deps = get_local_chained_dependencies(chained_deps, parent.get_parent_job())
- end
-
- return chained_deps
- end
-
-
- protected
- def remote_package_of_dependency_exist?(dep)
- dep_target_os = get_os_of_dependency(dep)
-
- # search
- ver_svr = @pkgsvr_client.get_attr_from_pkg( dep.package_name, dep_target_os, "version")
- if ver_svr.nil? then return false end
- if not dep.match? ver_svr then return false end
-
- return true
- end
-
-
- # get target os of dependency
- protected
- def get_os_of_dependency(dep)
- # use the target os if not specified
- if dep.target_os_list.count != 0 then
- dep_target_os = dep.target_os_list[0]
- else
- dep_target_os = @os
- end
- end
-
-end
+++ /dev/null
-=begin
-
- BuildServer.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'rubygems'
-require 'fileutils'
-require 'dbi'
-require 'thread'
-require 'bcrypt'
-require 'file/tail'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "SocketJobRequestListener.rb"
-require "JobManager.rb"
-require "JobClean.rb"
-require "RemoteBuildServer.rb"
-require "PackageSync.rb"
-require "ProjectManager.rb"
-require "DistributionManager.rb"
-require "db_utils.rb"
-require "FileUtil"
-
-class BuildServer
- attr_accessor :id, :path, :status, :host_os, :log
- attr_accessor :remote_servers
- attr_accessor :git_server_url, :git_bin_path
- attr_accessor :config_port
- attr_accessor :allowed_git_branch
- attr_accessor :jobmgr
- attr_accessor :test_time
- attr_accessor :password
- attr_accessor :finish
- attr_accessor :build_cache_dir
- attr_accessor :ftp_addr
- attr_accessor :ftp_port
- attr_accessor :ftp_username
- attr_accessor :ftp_passwd
- attr_accessor :cleaner
- attr_accessor :prjmgr, :distmgr
- attr_accessor :transport_path
- attr_accessor :cancel_lock
- attr_accessor :upgrade
- attr_accessor :db
- attr_accessor :db_dsn, :db_user, :db_passwd, :db_version
- CONFIG_ROOT = "#{Utils::HOME}/.build_tools/build_server"
- HOST_OS = Utils::HOST_OS
-
- # initialize
- def initialize (id, path, ftpsvr_addr, ftpsvr_port, ftpsvr_username, ftpsvr_passwd)
- @id = id
- @path = path
- @run_file_path = File.join(BuildServer::CONFIG_ROOT, @id, "run")
- @remote_servers = []
- @req_listener = []
- @finish = false
- @running_port = nil
- @config_port = nil
- # status
- @status = "INITIALIZING"
- # host_os
- @host_os = HOST_OS
- # log
- @log =nil
- @git_server_url = "gerrithost"
- @git_bin_path = "/usr/bin/git"
- @allowed_git_branch = ""
- # local package server
- @pkgsvr_cache_path = nil
- # Job Manager
- @jobmgr = JobManager.new(self)
- @test_time=0 #test time in mili-seconds
- @password="0000"
- @ftp_addr = ftpsvr_addr
- @ftp_port = ftpsvr_port
- @ftp_username = ftpsvr_username
- @ftp_passwd = ftpsvr_passwd
- @cleaner=nil
- @prjmgr = ProjectManager.new(self)
- @distmgr = DistributionManager.new(self)
- #
- @transport_path = "#{@path}/transport"
- @cancel_lock = Mutex.new
-
- @upgrade = false
-
- #DB settring
- @db = nil
- @db_dsn = nil
- @db_user = nil
- @db_passwd = nil
- @db_version = 5
- @sqlite3_db_mutex = Mutex.new
-
- #DB upgrade SQL command
- @db_migrate = []
-
- @latest_job_id = nil
- @job_id_mutex = Mutex.new
- end
-
- #name send_mail
- #return "YES" when send_mail setted
- #return "NO" (default or DB conncetion error)
- def send_mail
- result = nil
- begin
- get_db_connection() do |db|
- result = db.select_one("SELECT value FROM server_configs WHERE property = 'send_mail'")[0]
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- return (result.nil?) ? "NO" : result
- end
-
- def send_mail=(mail)
- begin
- get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{mail.strip}' WHERE property = 'send_mail'"
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- end
-
- #name keep_time
- #return keep_time
- #return 86400 (default or DB conncetion error)
- def keep_time
- result = nil
- begin
- get_db_connection() do |db|
- result = db.select_one("SELECT value FROM server_configs WHERE property = 'keep_time'")[0]
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- return (result.nil?) ? 86400 : result.to_i
- end
-
- def keep_time=(second)
- begin
- get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{second}' WHERE property = 'keep_time'"
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- end
-
- #name pkg_sync_period
- #return pkg_sync_period
- #return 600 (default or DB conncetion error)
- def pkg_sync_period
- result = nil
- begin
- get_db_connection() do |db|
- result = db.select_one("SELECT value FROM server_configs WHERE property = 'pkg_sync_period'")[0]
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- return (result.nil?) ? 600 : result.to_i
- end
-
- def pkg_sync_period=(second)
- begin
- get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{second}' WHERE property = 'pkg_sync_period'"
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- end
-
- #name changelog_check
- #return chengelog_check flag
- #return false (default or DB conncetion error)
- def changelog_check
- result = nil
- begin
- get_db_connection() do |db|
- result = db.select_one("SELECT value FROM server_configs WHERE property = 'changelog_check'")[0]
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- return (result.nil?) ? false : result =~ /true/i
- end
-
- def changelog_check=(check)
- t = check =~ /true/i
- begin
- get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{t.to_s}' WHERE property = 'changelog_check'"
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- end
-
- #name job_log_url
- #return job_log_url
- #return "" (default or DB conncetion error)
- def job_log_url
- result = nil
- begin
- get_db_connection() do |db|
- result = db.select_one("SELECT value FROM server_configs WHERE property = 'job_log_url'")[0]
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- return (result.nil?) ? "" : result
- end
-
- def job_log_url=(url)
- begin
- get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{url.strip}' WHERE property = 'job_log_url'"
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- end
-
-
- def port
- return @running_port
- end
-
-
- def port=(svr_port)
- @running_port = svr_port
- if has_db? then
- begin
- get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{svr_port}' WHERE property = 'port'"
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- end
- end
-
- def save_id_to_db(id)
- begin
- get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{id.strip}' WHERE property = 'id'"
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- end
-
- def save_path_to_db(path)
- begin
- get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{path.strip}' WHERE property = 'path'"
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- end
-
- def db_inc
- return (@db_dsn =~ /^Mysql/i) ? "AUTO_INCREMENT" : "AUTOINCREMENT"
- end
-
- def db_post_fix
- return (@db_dsn =~ /^Mysql/i) ? "ENGINE = INNODB DEFAULT CHARSET = UTF8" : ""
- end
-
- def db_now
- return (@db_dsn =~ /^Mysql/i) ? "NOW()" : "datetime('now')"
- end
-
- def db_insert_id(db)
- return (@db_dsn =~ /^Mysql/i) ? db.func(:insert_id).to_s : db.select_one("SELECT last_insert_rowid()")[0]
- end
-
-
- def has_db?()
- return (not @db_dsn.nil?)
- end
-
-
- # start server daemon
- def start
- # set build cache dir
- @build_cache_dir="#{BuildServer::CONFIG_ROOT}/#{@id}/build_cache"
- if not File.exist? @build_cache_dir then
- FileUtils.mkdir_p @build_cache_dir
- end
-
- # init job directory if needed
- if not File.exist? "#{@path}/jobs" then FileUtils.mkdir_p "#{@path}/jobs" end
-
- # init transport path
- if not File.exist? @transport_path then FileUtils.mkdir_p @transport_path end
-
- #lock the build server. Do not run the same server at the same time
- if not lockServer() then
- printErrorMessage("Server \"#{id}\" is already running.")
- return
- end
-
- #check that the port is open
- if BuildCommServer.port_open? port then
- printErrorMessage("Port \"#{port}\" is already in use.")
- return
- end
-
- # init project mgr
- @log.info "Setting Project Manager..."
- @prjmgr.load()
-
- # init job mgr
- @log.info "Intializing Job Manager..."
- @jobmgr.init()
-
- # set job request listener
- @log.info "Setting listener..."
- listener2 = SocketJobRequestListener.new(self)
- listener2.start
- @req_listener.push listener2
-
- # set job cleaner
- @log.info "Setting Job Cleaner..."
- @cleaner = JobCleaner.new(self)
- @cleaner.start
-
- # init latest job id
- if has_db? then
- @latest_job_id = get_latest_job_id_from_db()
- else
- @latest_job_id = get_latest_job_id_from_directory()
- end
-
- # set package server synchrontizer
- @log.info "Setting Package Server Synchronizer..."
- if has_db? then
- @pkg_sync = PackageServerSynchronizer.new(self)
- @pkg_sync.start
- end
-
- # update friend server status
- @log.info "Initializing Remote Servers..."
- if has_db? then
- @remote_servers = get_remote_servers()
- @remote_servers.each do |server|
- server.create_system_monitor()
- end
- end
-
- # main loop
- @log.info "Entering main loop..."
- @status = "RUNNING"
- begin
- if @test_time > 0 then start_time = Time.now end
- while( not @finish )
-
- # handle jobs
- @jobmgr.handle()
-
- # sleep
- if @test_time > 0 then
- curr_time = Time.now
- if (curr_time - start_time).to_i > @test_time then
- puts "Test time is elapsed!"
- break
- end
- else
- sleep 1
- end
- end
- rescue => e
- @log.error( e.message, Log::LV_USER)
- @log.error e.backtrace.inspect
- end
-
- if(@upgrade)
- exit(99)
- end
- # TODO: something should be done for server down
-
- end
-
-
- # stop sever daemon
- def stop
- @finish = true
- end
-
-
- # check the job can be built on this server
- def can_build?(job)
- # check max allowed jobs
- if @jobmgr.max_working_jobs <= 0 then
- return false
- end
-
- # check me
- if job.can_be_built_on? @host_os then
- return true
- end
-
- return false
- end
-
-
- # name get_remote_servers
- # return RemoteBuildServer array
- # return [] (default or DB conncetion error)
- def get_remote_servers()
- result = []
- begin
- get_db_connection() do |db|
- result = RemoteBuildServer.load_all(db, self)
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- return result
- end
-
-
- # add new remote friend server
- # name add_remote_server
- # return true when remote server add success
- # return false when remote server already exist or build server is running or DB conncetion error
- def add_remote_server( ip, port )
- result = false
- if @status == "RUNNING" then return false end
- newsvr = nil
-
- begin
- get_db_connection() do |db|
- rs = RemoteBuildServer.load(ip, port, db, self)
- if rs.nil? then
- newsvr = RemoteBuildServer.new(ip, port, "", self)
- newsvr.save(db)
- @remote_servers.push newsvr
- result = true
- end
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # remove remote friend server
- # name remove_remote_server
- # return true when remote server remove success
- # return false when remote server not exist or build server is running or DB connection error
- def remove_remote_server( ip, port )
- result = false
- if @status == "RUNNING" then return false end
-
- begin
- get_db_connection() do |db|
- rs = RemoteBuildServer.load(ip, port, db)
- if not rs.nil? then
- rs.unload(db)
- result = true
- end
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # name get_sync_package_servers
- # return array of {pkgsvr_url => <package server url>, name => <distribution name>}
- # return [] when package server not exist or DB error occurred
- def get_sync_package_servers()
- result = []
- begin
- get_db_connection() do |db|
- db.select_all("SELECT sync_pkg_servers.pkgsvr_url, distributions.name FROM sync_pkg_servers,distributions WHERE sync_pkg_servers.distribution_id = distributions.id") do |row |
- result.push [row['pkgsvr_url'], row['name']]
- end
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # add new remote pkg server
- # name add_sync_package_server
- # return true when add sync package server successed
- # return false when sync package server already exist or distribution name not matched or DB conncetion error
- def add_sync_package_server( url, dist )
- result = false
- begin
- get_db_connection() do |db|
- row = db.select_one("SELECT distributions.id FROM sync_pkg_servers,distributions WHERE sync_pkg_servers.pkgsvr_url='#{url}' and distributions.name='#{dist}' and sync_pkg_servers.distribution_id = distributions.id")
- if not row.nil? then return false end
- row = db.select_one("SELECT id FROM distributions WHERE name='#{dist}'")
- dist_id = row['id']
- db.do "INSERT INTO sync_pkg_servers (pkgsvr_url,period,distribution_id) VALUES('#{url}',600,#{dist_id})"
- end
- result = true
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # remove remote pkg server
- # name remove_sync_package_server
- # return true when remove sync package server successed
- # return false when sync package server not exist when DB conncetion error
- def remove_sync_package_server( url, dist )
- result = false
- begin
- get_db_connection() do |db|
- row = db.select_one("SELECT distributions.id FROM sync_pkg_servers,distributions WHERE sync_pkg_servers.pkgsvr_url='#{url}' and distributions.name='#{dist}' and sync_pkg_servers.distribution_id = distributions.id")
- if row.nil? then return false end
- dist_id = row['id']
- db.do("DELETE FROM sync_pkg_servers WHERE pkgsvr_url='#{url}' and distribution_id=#{dist_id}")
- end
- result = true
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # name supported_os_list
- # return array of os name [<os name>, ... ]
- # return [] when DB error occurred
- def supported_os_list
- result = []
- begin
- get_db_connection() do |db|
- db.select_all("SELECT * FROM supported_os") do |row |
- result.push row['name']
- end
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # add new target OS.
- # name add_supported_os
- # return true when add supported os successed
- # return false when supported os already exist or DB connection error
- def add_supported_os( os_name )
- result = false
- os_category = Utils.get_os_category( os_name )
- if os_category.nil? then return false end
-
- begin
- get_db_connection() do |db|
- row = db.select_one("SELECT * FROM supported_os WHERE name='#{os_name}'")
- if not row.nil? then return false end
- db.do "INSERT INTO supported_os(os_category_id, name) SELECT os_category.id, '#{os_name}' FROM os_category WHERE os_category.name='#{os_category}'"
- end
- result = true
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # remove target OS.
- #name remove_supported_os( os_name )
- #return true when supported_os removed
- #return false when supported_os not exist or DB connection error
- def remove_supported_os( os_name )
- result = false
- begin
- get_db_connection() do |db|
- row = db.select_one("SELECT * FROM supported_os WHERE name='#{os_name}'")
- if row.nil? then return false end
- db.do("DELETE FROM supported_os WHERE name='#{os_name}'")
- end
- result = true
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- def self.get_supported_os_id(db, os_name)
- row = db.select_one("SELECT * FROM supported_os WHERE name='#{os_name}'")
- if not row.nil? then
- return row['id']
- else
- return "NULL"
- end
- end
-
-
- # get remote server
- def get_available_server ( job )
- candidates = []
-
- # calculate empty rooms
- # if sub job, his parent should be excluded
- local_empty_rooms = @jobmgr.get_number_of_empty_room
-
- if local_empty_rooms > 0 and can_build?(job) then
- candidates.push self
- end
-
- # get availables server
- if job.type == "MULTIBUILD" or job.type == "REGISTER" then
- # if max working job is zero, check max-non-build-jobs
- if @jobmgr.max_working_jobs == 0 and
- local_empty_rooms >= -1 * @jobmgr.get_max_jobs() then
- candidates.push self
- end
- else
- # if normal JOB
- @remote_servers.each do |server|
- if ( server.status == "RUNNING" and server.can_build?( job ) and
- not server.has_waiting_jobs and
- server.get_file_transfer_cnt() == 0 and
- server.get_number_of_empty_room > 0 )
- candidates.push server
- end
- end
- end
-
- if candidates.count == 0 then return nil end
-
- # get best
- # it is better if working jobs count is less
- best_server = candidates[0]
- max_empty_room = best_server.get_number_of_empty_room
- candidates.each do |server|
- # check whether idle, use it
- if not server.has_working_jobs then return server end
-
- # skip
- if server == best_server then next end
-
- # compare remain rooms
- empty_room = server.get_number_of_empty_room
- if empty_room > max_empty_room then
- max_empty_room = empty_room
- best_server = server
- end
- end
-
- return best_server
- end
-
-
- # check there is some servers that can build the job
- def check_job_availability(job)
-
- # check me
- if can_build? job then return true end
-
- #if not found, check friends
- @remote_servers.each do |server|
- if server.status == "RUNNING" and
- job.can_be_built_on? server.host_os then
- return true
- end
- end
-
- return false
- end
-
-
- # return available working slot
- def get_number_of_empty_room
- return @jobmgr.get_number_of_empty_room
- end
-
-
- # check there are working jobs
- def has_working_jobs
- return @jobmgr.has_working_jobs
- end
-
-
- # check there are waiting jobs
- def has_waiting_jobs
- return @jobmgr.has_waiting_jobs
- end
-
- def get_dbversion
- db_version = nil
- begin
- db = DBI.connect("DBI:#{@db_dsn}", @db_user, @db_passwd)
- db_version = db.select_one("SELECT (value) FROM server_configs WHERE property = 'db_version'")[0].to_i
- rescue DBI::DatabaseError => e
- #puts e.errstr
- ensure
- db.disconnect if db
- end
- return db_version
- end
-
- def db_upgrade
- result = true
- create = false
- load_migrate_list
- begin
- db = DBI.connect("DBI:#{@db_dsn}", @db_user, @db_passwd)
- db_version = db.select_one("SELECT (value) FROM server_configs WHERE property = 'db_version'")[0].to_i
- if db_version.nil? then
- create = true
- else
- list = @db_migrate[db_version..@db_version]
- if not list.nil? then
- list.each do |sql_list|
- sql_list.each do |sql|
- db.do sql
- end
- end
- end
- db.do("UPDATE server_configs SET value = '#{@db_version}' WHERE property = 'db_version'")
- end
- rescue => e
- puts e.errstr
- result = false
- ensure
- db.disconnect if db
- end
- if create then create_db end
- return result
- end
-
- def load_migrate_list
- if @db_dsn =~ /^Mysql/i then
- @db_migrate[1]=["ALTER TABLE jobs CHANGE COLUMN id id INTEGER AUTO_INCREMENT NOT NULL",
- "ALTER TABLE distributions ADD pkgsvr_password VARCHAR(64)"]
- @db_migrate[2]=["ALTER TABLE projects ADD COLUMN status VARCHAR(32) NOT NULL DEFAULT 'OPEN'"]
- @db_migrate[3]=["CREATE TABLE job_timestamps (id INTEGER PRIMARY KEY #{db_inc()}, job_id INTEGER, stamp_name VARCHAR(64), stamp_time DATETIME)#{db_post_fix()}",
- "ALTER TABLE jobs ADD COLUMN error_code VARCHAR(32)",
- "INSERT INTO users (name,email,password_hash,password_salt) VALUES ('sync-manager','sync-manager@user','$2a$10$H.w3ssI9KfuvNEXXp1qxD.b3Wm8alJG.HXviUofe4nErDn.TKUAka','$2a$10$H.w3ssI9KfuvNEXXp1qxD.')",
- "INSERT INTO user_groups (user_id, group_id) SELECT users.id,groups.id FROM users,groups WHERE users.email = 'sync-manager@user' and groups.name = 'admin'",
- "INSERT INTO server_configs (property,value) VALUES ('max_jobs','4')"]
- @db_migrate[4]=["ALTER TABLE projects DROP COLUMN password"]
- else
- @db_migrate[1]=["ALTER TABLE distributions ADD pkgsvr_password VARCHAR(64)"]
- @db_migrate[2]=["ALTER TABLE projects ADD COLUMN status VARCHAR(32) NOT NULL DEFAULT 'OPEN'"]
- @db_migrate[3]=["CREATE TABLE job_timestamps (id INTEGER PRIMARY KEY #{db_inc()}, job_id INTEGER, stamp_name VARCHAR(64), stamp_time DATETIME)#{db_post_fix()}",
- "ALTER TABLE jobs ADD COLUMN error_code VARCHAR(32)",
- "INSERT INTO users (name,email,password_hash,password_salt) VALUES ('sync-manager','sync-manager@user','$2a$10$H.w3ssI9KfuvNEXXp1qxD.b3Wm8alJG.HXviUofe4nErDn.TKUAka','$2a$10$H.w3ssI9KfuvNEXXp1qxD.')",
- "INSERT INTO user_groups (user_id, group_id) SELECT users.id,groups.id FROM users,groups WHERE users.email = 'sync-manager@user' and groups.name = 'admin'",
- "INSERT INTO server_configs (property,value) VALUES ('max_jobs','4')"]
- @db_migrate[4]=["ALTER TABLE projects DROP COLUMN password"]
- end
- end
-
- def gen_db()
- hash = DBUtils.dsn_parser @db_dsn
- case hash[:database]
- when "Mysql" then
-
- File.open("create_db.txt","w") do |f|
- f.puts "GRANT ALL ON #{hash[:name]}.* TO '#{@db_user}'@'%' IDENTIFIED BY '#{@db_passwd}';"
- f.puts "CREATE DATABASE #{hash[:name]};"
- end
-
- if hash[:host].eql? "localhost" or hash[:host].eql? "127.0.0.1" then
- socket_str = ""
- socket_str = "--socket=#{hash[:socket]}" if not hash[:socket].nil?
- puts "Mysql DB #{hash[:name]} generating"
- system("mysql -h #{hash[:host]} #{socket_str} -u #{@db_user} --password=#{@db_passwd} < create_db.txt")
- else
- port_str = ""
- port_str = "-P #{hash[:port]}" if not port.nil?
- puts "Mysql DB #{hash[:name]} generating"
- system("mysql -h #{hash[:host]} #{port_str} -u #{@db_user} --password=#{@db_passwd} < create_db.txt")
- end
- else puts "not support DB #{@db_dsn}"
- end
- end
-
- def create_db()
- gen_db()
- begin
- get_db_connection() do |db|
- inc = db_inc
- post_fix = db_post_fix
- now = db_now
-
- # remove table
- db.tables.each do |table|
- db.do "DROP TABLE #{table}"
- end
-
- # create table
- db.do "CREATE TABLE server_configs ( id INTEGER PRIMARY KEY #{inc}, property VARCHAR(64) NOT NULL, value VARCHAR(256) )#{post_fix}"
- db.do "INSERT INTO server_configs (property,value) VALUES ('id','#{@id}')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('path','#{@path}')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('db_version','#{@db_version}')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('port','2222')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('max_working_jobs','2')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('max_jobs','4')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('send_mail','NO')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('keep_time','86400')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('pkg_sync_period','600')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('changelog_check','false')"
- db.do "INSERT INTO server_configs (property,value) VALUES ('job_log_url','')"
- db.do "CREATE TABLE os_category ( id INTEGER PRIMARY KEY #{inc}, name VARCHAR(32) NOT NULL UNIQUE ) #{post_fix}"
- db.do "INSERT INTO os_category (name) VALUES ( 'linux' )"
- db.do "INSERT INTO os_category (name) VALUES ( 'windows' )"
- db.do "INSERT INTO os_category (name) VALUES ( 'macos' )"
-
- PackageDistribution.create_table(db, inc, post_fix)
-
- # sync package server
- db.do "CREATE TABLE sync_pkg_servers (
- id INTEGER PRIMARY KEY #{inc},
- distribution_id INTEGER NOT NULL,
- pkgsvr_url VARCHAR(256),
- period INTEGER,
- description VARCHAR(255),
- CONSTRAINT fk_sync_pkg_servers_distributions1 FOREIGN KEY ( distribution_id ) REFERENCES distributions ( id ) ) #{post_fix}"
-
- db.do "CREATE TABLE supported_os (
- id INTEGER PRIMARY KEY #{inc},
- os_category_id INTEGER NOT NULL,
- name VARCHAR(32) NOT NULL UNIQUE,
- CONSTRAINT fk_supported_os_os_category1 FOREIGN KEY ( os_category_id ) REFERENCES os_category ( id ) ) #{post_fix}"
-
- RemoteBuildServer.create_table(db, inc, post_fix)
-
- # USERS/GROUPS
- # users
- db.do "CREATE TABLE users ( id INTEGER PRIMARY KEY #{inc}, name VARCHAR(32) NOT NULL UNIQUE, email VARCHAR(256), password_hash VARCHAR(256), password_salt VARCHAR(256) ) #{post_fix}"
- # groups
- db.do "CREATE TABLE groups ( id INTEGER PRIMARY KEY #{inc}, name VARCHAR(32) NOT NULL UNIQUE, admin VARCHAR(32) NOT NULL DEFAULT 'FALSE', description VARCHAR(256) )#{post_fix}"
- # user groups (users -- groups)
- db.do "CREATE TABLE user_groups ( user_id INTEGER NOT NULL, group_id INTEGER NOT NULL, status VARCHAR(32) NOT NULL DEFAULT 'ACTIVE', PRIMARY KEY ( user_id, group_id ),
- CONSTRAINT fk_users_has_groups_users1 FOREIGN KEY ( user_id ) REFERENCES users ( id ),
- CONSTRAINT fk_users_has_groups_groups1 FOREIGN KEY ( group_id ) REFERENCES groups ( id )) #{post_fix}"
-
- db.do "INSERT INTO users (name,email,password_hash,password_salt) VALUES ('administrators','admin@user','$2a$10$H.w3ssI9KfuvNEXXp1qxD.b3Wm8alJG.HXviUofe4nErDn.TKUAka','$2a$10$H.w3ssI9KfuvNEXXp1qxD.')"
- db.do "INSERT INTO users (name,email,password_hash,password_salt) VALUES ('sync-mananger','sync-manager@user','$2a$10$H.w3ssI9KfuvNEXXp1qxD.b3Wm8alJG.HXviUofe4nErDn.TKUAka','$2a$10$H.w3ssI9KfuvNEXXp1qxD.')"
- db.do "INSERT INTO groups (name, admin, description) VALUES ('admin','TRUE','')"
- db.do "INSERT INTO user_groups (user_id, group_id) SELECT users.id,groups.id FROM users,groups WHERE users.email = 'admin@user' and groups.name = 'admin'"
- db.do "INSERT INTO user_groups (user_id, group_id) SELECT users.id,groups.id FROM users,groups WHERE users.email = 'sync-manager@user' and groups.name = 'admin'"
-
- # PROJECTS
- CommonProject.create_table(db, inc, post_fix)
- GitBuildProject.create_table(db, post_fix)
- BinaryUploadProject.create_table(db, post_fix)
- db.do "CREATE TABLE group_project_accesses(
- group_id INTEGER NOT NULL,
- project_id INTEGER NOT NULL,
- build VARCHAR(32) NOT NULL DEFAULT 'TRUE',
- PRIMARY KEY ( group_id,project_id ),
- CONSTRAINT fk_groups_has_projects_groups1 FOREIGN KEY ( group_id ) REFERENCES groups ( id ),
- CONSTRAINT fk_groups_has_projects_projects1 FOREIGN KEY ( project_id ) REFERENCES projects ( id ) )#{post_fix}"
-
- # JOBS
- CommonJob.create_table(db, inc, post_fix)
- end
- return true
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return false
- end
-
-
- def get_db_connection(transaction=true)
- begin
- if @db_dsn.nil? then
- return false
- else
- if @db.nil? or not @db.connected? then
- @db = DBI.connect("DBI:#{@db_dsn}", @db_user, @db_passwd)
- #@db.do "set session wait_timeout=5" # makes "Mysql servr has gone away" error
- end
- end
-
- @db['AutoCommit'] = false
- @db.transaction do |dbh|
- yield dbh if block_given?
- end
-
- return true
-
- rescue DBI::DatabaseError => e
- if e.errstr =~ /server has gone away/ then
- @db = nil
- retry
- else
- raise BuildServerException.new("ERR950"), e.errstr
- end
- rescue DBI::InterfaceError => e
- raise BuildServerException.new("ERR950"), e.errstr
- rescue => e
- @log.error e.message if not @log.nil?
- @log.error e.backtrace.inspect if not @log.nil?
- end
-
- return false
- end
-
- # name check_user_id_from_email( user_email )
- # return id string
- # return -1 when id of email is not exist or DB conncetion error
- def check_user_id_from_email(user_email)
- result = -1
- begin
- get_db_connection() do |db|
- row = db.select_one("SELECT * FROM users WHERE email='#{user_email}'")
- if not row.nil? then
- result = row['id']
- end
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # name get_email_using_user_id( user_id )
- # return email string
- # return -1 when email of id is not exist or DB connection error
- def get_email_using_user_id(user_id)
- result = -1
- begin
- get_db_connection() do |db|
- row = db.select_one("SELECT * FROM users WHERE id='#{user_id}'")
- if not row.nil? then
- result = row['email']
- end
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- return result
- end
-
- #name check_user_password( user_id , passwd )
- #return 1 when passwd matched
- #return -1 when passwd unmatched or DB conncetion error
- def check_user_password(user_id, passwd)
- row = nil
- begin
- get_db_connection() do |db|
- row = db.select_one("SELECT * FROM users WHERE id='#{user_id}'")
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- if not row.nil? then
- if row['password_hash'].eql? passwd
- # if passwd is encript and that value equal password_hash then return true
- return 1
- else
- return row['password_hash'] == BCrypt::Engine.hash_secret(passwd, row['password_salt'])
- end
- else
- return -1
- end
- end
-
-
- def qualify_admin_to_access(prj_id)
- # nothing to do, admin can change everything on web admin tool
- end
-
-
- def accept_system_monitor(conn)
- sock_domain, remote_port, remote_hostname, remote_ip = conn.peeraddr
- @log.info "Connected to system monitor from #{remote_ip}"
- Thread.new do
- begin
- while true
- BuildCommServer.send(conn,
- "=STATUS,#{@status},#{@host_os},#{@jobmgr.max_working_jobs}")
- sleep 5
- end
- rescue => e
- @log.error e.message
- ensure
- BuildCommServer.disconnect(conn)
- @log.info "Disconnected from system monitor on #{remote_ip}"
- end
- end
- end
-
- def query_job_log(job_number, conn)
- @log.info "Sending job log : #{job_number}"
-
- job_status = ""
- job = @jobmgr.search_job(job_number)
-
- Thread.new do
- job_log_path = File.join(@path, "jobs", job_number, "log")
-
- if File.exist? job_log_path then
- begin
- File::Tail::Logfile.open(job_log_path) do |log|
- log.interval = 0.05
- # send log file information using file-tail
- log.tail do |line|
- BuildCommServer.send(conn, line)
-
- if not job.nil? then
- # Send status when changed status
- if not job.status.eql? job_status then
- job_status = job.status
- BuildCommServer.send(conn, "=JOB_STATUS,#{job_status}")
- end
-
- if not log.return_if_eof and
- (job.status.eql? "FINISHED" or job.status.eql? "ERROR" or job.status.eql? "CANCELED") then
-
- log.return_if_eof = true
- # this will make a time for finishing log write
- sleep 2
- end
- else
- if log.eof? then
- break
- end
- end
- end
- end
- if not job.nil? and job.status == "FINISHED" and job.is_send_result_back? then
- job.get_result_files().each do |file|
- BuildCommServer.send(conn, "=JOB_FILE,#{file}")
- end
- end
- rescue => e
- @log.error e.message
- @log.error e.backtrace.inspect
- if e.message.eql? "Connection is closed" then
- BuildCommServer.disconnect(conn)
- Thread.exit
- end
- end
- else
- @log.error "Can't find job log file : #{job_log_path}"
- BuildCommServer.send(conn, "Can't find job log file : #{job_number}")
- BuildCommServer.send(conn, "=LOG_ERROR")
- end
-
- if job.nil? then
- begin
- get_db_connection() do |db|
- job_status = db.select_one("SELECT status FROM jobs WHERE id = #{job_number}")[0]
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
- BuildCommServer.send(conn, "=JOB_STATUS,#{job_status}")
- end
-
- BuildCommServer.send_end(conn)
- BuildCommServer.disconnect(conn)
- end
-
-
- end
-
-
- public
- def get_next_job_id()
- @job_id_mutex.synchronize do
- tmp_id = @latest_job_id.to_i + 1
- @latest_job_id = tmp_id.to_s
-
- return @latest_job_id
- end
- end
-
- #If the 'run' file is already locked, server is already running.
- #in this case return false
- private
- def lockServer
- return FileUtil.exclusiveLock(@run_file_path)
- end
-
- private
- def printErrorMessage(errMsg)
- @log.info "Server creation failed"
- @log.error errMsg
-
- puts "Server creation failed"
- puts errMsg
- end
-
-
- # get latest id from DB
- # name get_latest_job_id_from_db
- # return max id string
- # return 0 when job id is not exist or DB connection error
- private
- def get_latest_job_id_from_db()
- job_id = nil
- begin
- get_db_connection() do |db|
- row = db.select_one("SELECT MAX(id) as id FROM jobs")
- job_id = row['id']
- end
- rescue BuildServerException => e
- if not @log.nil? then
- @log.error e.message
- end
- rescue => e
- if not @log.nil? then
- @log.error e.errstr
- end
- end
-
- if not job_id.nil? then
- return job_id.to_s
- else
- return "0"
- end
- end
-
-
- # get id from "jobs" directory
- private
- def get_latest_job_id_from_directory()
- job_directories = Dir.entries("#{@path}/jobs").select { |dir|
- not dir.start_with? "." and File.directory?("#{@path}/jobs/#{dir}") and dir.to_s =~ /^\d+$/
- }
- max_id = 0
- job_directories.each do |job_id|
- if job_id.to_i > max_id then
- max_id = job_id.to_i
- end
- end
-
- return max_id.to_s
- end
-
-end
-
+++ /dev/null
-=begin
-
- BuildServerController.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "BuildServer.rb"
-require "BuildComm.rb"
-require "BuildServerException.rb"
-
-class BuildServerController
- @@instance_map = {}
-
- # create
- def self.create_server (id, path, ftpsvr_addr=nil, ftpsvr_port=nil, ftpsvr_username=nil, ftpsvr_passwd=nil)
-
- # check server config root
- check_build_server_root
-
- # check id
- if File.exist? "#{BuildServer::CONFIG_ROOT}/#{id}"
- raise RuntimeError, "Creating server failed. The server id is already exist"
- end
-
- # create new instance and return it
- @@instance_map[id] = BuildServer.new( id, path, ftpsvr_addr, ftpsvr_port, ftpsvr_username, ftpsvr_passwd)
-
- # set default
- if Utils.is_windows_like_os(Utils::HOST_OS) then
- @@instance_map[id].git_bin_path="/c/Program\\ Files/Git/bin/git.exe"
- else
- @@instance_map[id].git_bin_path="/usr/bin/git"
- end
-
- # set default server port
- default_port = 2222
- @@instance_map[id].port = default_port
-
- # write config
- write_server_config( @@instance_map[id] )
-
- # set logger
- @@instance_map[id].log = Log.new( "#{BuildServer::CONFIG_ROOT}/#{id}/log" )
-
- puts "Created new build server: \"#{id}\""
- puts " - server location : #{path}"
- puts " - server configure file : #{BuildServer::CONFIG_ROOT}/#{id}/server.cfg"
- puts " - default server port : #{default_port}"
-
- return @@instance_map[id]
- end
-
-
- def self.remove_server (id)
-
- # check server config root
- check_build_server_root
-
- # check id
- if File.exist? "#{BuildServer::CONFIG_ROOT}/#{id}"
- FileUtils.rm_rf "#{BuildServer::CONFIG_ROOT}/#{id}"
- @@instance_map[id] = nil
- puts "Removed the server \"#{id}\""
- else
- puts "The server \"#{id}\" does not exist!"
- end
- end
-
- def self.migrate_server (id, dsn, user, passwd)
- # set DB environment
- server = get_server(id)
- # if dsn is nil, use default dsn
- if dsn.nil? then
- raise RuntimeError, 'you must set db_dsn'
- end
- server.db_dsn = dsn
- server.db_user = user if not user.nil?
- server.db_passwd = passwd if not passwd.nil?
-
- # check db
- if migrate_db(server) then
- write_server_config(server)
- end
- end
-
- def self.migrate_db (server)
- version = server.get_dbversion
- if version.nil? then server.create_db end
- return server.db_upgrade
- end
-
- # get
- def self.get_server( id )
-
- # check instance first
- if not @@instance_map[id] == nil
- return @@instance_map[id]
- end
-
- # check server config
- if not File.exist? "#{BuildServer::CONFIG_ROOT}/#{id}/server.cfg"
- raise RuntimeError, "The server \"#{id}\" does not exist!"
- end
-
- # get server config and return its object
- @@instance_map[id] = read_server_config(id)
-
- # set logger first
- @@instance_map[id].log = Log.new( "#{BuildServer::CONFIG_ROOT}/#{id}/log" )
-
- return @@instance_map[id]
- end
-
-
- # start server
- def self.start_server( id, port )
- server = get_server(id)
-
- if server.has_db? then
- migrate_db(server)
- server.jobmgr.cancel_broken_status
- end
-
- server_dir = "#{BuildServer::CONFIG_ROOT}/#{server.id}"
-
- # if user input exsist, set user's port number.
- if (port != "") and (port != nil) then
- # update server port information
- original_string = "SERVER_PORT=#{server.config_port}"
- replacement_string = "SERVER_PORT=#{port}"
- contents = File.read("#{server_dir}/server.cfg").gsub("#{original_string}", "#{replacement_string}")
-
- # write to config file
- File.open("#{server_dir}/server.cfg", "w") { |f| f.puts contents }
- # update to db
- server.port = port
- else # if user input not exsist, set config file's port number.
- server.port = server.config_port
- end
-
- # write run port
- File.open( "#{server_dir}/run", "w" ) { |f| f.puts server.port }
-
- # start
- if server.has_db? then
- server.save_id_to_db(server.id)
- server.save_path_to_db(server.path)
- end
- server.start
- end
-
-
- # stop server
- def self.stop_server( id )
-
- # server
- server = get_server(id)
-
- client = BuildCommClient.create( "127.0.0.1", server.port )
- if client.nil? then
- puts "Server is not running!"
- return false
- end
-
- # send request
- stop_ok = false
- if client.send "STOP|#{server.password}" then
- # recevie & print
- mismatched = false
- result = client.read_lines do |l|
- puts l
- if l.include? "Password mismatched!" then
- mismatched = true
- end
- end
- if result and not mismatched then
- stop_ok = true
- end
- end
-
- # terminate
- client.terminate
-
- if not stop_ok then
- puts "Server stop failed!"
- end
-
- return true
- end
-
- # upgrade server
- def self.upgrade_server( id, pkgsvr_url, dist_name )
-
- server = get_server(id)
-
- # distribution check
- if pkgsvr_url.nil? then
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
-
- if dist_name.nil? then
- dist = server.distmgr.get_first_distribution()
- if dist.nil? then
- puts "No distribution exits!"
- puts "Upgrade Failed!!"
- return false
- end
- else
- dist = server.distmgr.get_distribution( dist_name )
- if dist.nil? then
- puts "Distribution \"#{dist_name}\" is not exits"
- puts "Upgrade Failed!!"
- return false
- end
- end
- pkgsvr_url = dist.pkgsvr_url
- end
-
- client = BuildCommClient.create( "127.0.0.1", server.port )
- if client.nil? then
- puts "Server is not running!"
- return false
- end
-
- # send request
- upgrade_ok = false
- if client.send "UPGRADE|#{server.password}|#{pkgsvr_url}" then
- # recevie & print
- mismatched = false
- result = client.read_lines do |l|
- puts l
- if l.include? "Password mismatched!" then
- mismatched = true
- end
- end
- if result and not mismatched then
- upgrade_ok = true
- end
- end
-
- # terminate
- client.terminate
-
- if not upgrade_ok then
- puts "Server upgrade failed!"
- end
-
- return true
- end
-
-
- # add friend server
- def self.add_remote_server( id, ip, port )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # add
- if server.add_remote_server( ip, port ) then
- puts "Friend server is added successfully!"
- return true
- else
- puts "Friend server already exists in list!"
- return false
- end
- end
-
-
- # remove friend server
- def self.remove_remote_server( id, ip, port )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # add
- if server.remove_remote_server( ip, port ) then
- puts "Friend server is removed successfully!"
- return true
- else
- puts "Friend server does not exist in list!"
- return false
- end
- end
-
-
- # add supported target os
- def self.add_target_os( id, os_name )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # add
- if server.add_supported_os( os_name ) then
- puts "Target OS is added successfully!"
- return true
- else
- puts "Target OS already exists in list!"
- return false
- end
- end
-
-
- # remove supported target os
- def self.remove_target_os( id, os_name )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # add
- if server.remove_supported_os( os_name ) then
- puts "Target OS is removed successfully!"
- return true
- else
- puts "Target OS does not exist in list!"
- return false
- end
-
- server.quit
- end
-
-
- # add distribution
- def self.add_distribution( id, dist_name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # add
- if server.distmgr.add_distribution( dist_name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password ) then
- puts "Distribution is added successfully!"
- return true
- else
- puts "Distribution already exists in list!"
- return false
- end
- end
-
- # clone distribution
- def self.clone_distribution( id, origin_dist_name, target_dist_name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # add
- if server.distmgr.clone_distribution( origin_dist_name, target_dist_name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password ) then
- puts "Distribution is cloned successfully!"
- return true
- else
- puts "Fail clone distribution. check the log file"
- return false
- end
- end
-
-
-
- # remove distribution
- def self.remove_distribution( id, dist_name )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # remove
- if server.distmgr.remove_distribution( dist_name ) then
- puts "Distribution is removed successfully!"
- return true
- else
- puts "Distribution does not exist in list!"
- return false
- end
- end
-
-
- # lock distribution
- def self.lock_distribution(id, dist_name)
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # remove
- if server.distmgr.set_distribution_lock(dist_name, true) then
- puts "Distribution is locked!"
- return true
- else
- puts "Locking distribution failed!"
- return false
- end
- end
-
-
- # unlock distribution
- def self.unlock_distribution(id, dist_name)
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # remove
- if server.distmgr.set_distribution_lock(dist_name, false) then
- puts "Distribution is unlocked!"
- return true
- else
- puts "Unlocking distribution failed!"
- return false
- end
- end
-
-
- # add remote package server
- def self.add_sync_package_server(id, url, dist_name)
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # check distribution
- dist_name = check_distribution_name(dist_name, server)
- if dist_name.nil? then return false end
-
- # add
- if server.add_sync_package_server( url, dist_name ) then
- puts "Remote package server is added!"
- return true
- else
- puts "The server already exists in list!"
- return false
- end
- end
-
-
- def self.check_distribution_name(dist_name, server)
- if (dist_name.nil? or dist_name.empty?) then
- dist_name = server.distmgr.get_default_distribution_name()
- end
- if dist_name.nil? or dist_name.empty? then
- puts "No distribution is defined!"
- return nil
- end
-
- return dist_name
- end
-
- # remove remote package server
- def self.remove_sync_package_server(id, url, dist_name)
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # check distribution
- dist_name = check_distribution_name(dist_name, server)
- if dist_name.nil? then return false end
-
- # remove
- if server.remove_sync_package_server( url, dist_name ) then
- puts "Remote package server is removed!"
- return true
- else
- puts "The server does not exist in list!"
- return false
- end
- end
-
-
- # add project
- def self.add_project( id, project_name, git_repos, git_branch, remote_server_id,
- os_string, dist_name )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- supported_os_list = server.supported_os_list
- # get supported os for project.
- # if not specified, all supported os of the server will be used
- if os_string.nil? or os_string.empty? then
- os_list = supported_os_list
- else
- os_list = os_string.strip.split(",")
-
- # check OS name
- os_list.each do |os|
- if not supported_os_list.include? os then
- puts "Unsupported OS name \"#{os}\" is used!"
- puts "Check the following supported OS list:"
- supported_os_list.each do |s_os|
- puts " * #{s_os}"
- end
-
- return false
- end
- end
- end
-
- # add
- if git_repos.nil? or git_branch.nil? then
- puts "Git repository or branch must be specified!"
- return false
- end
-
- # check distribution
- dist_name = check_distribution_name(dist_name, server)
- if dist_name.nil? then return false end
-
- result = server.prjmgr.add_git_project( project_name, git_repos, git_branch, os_list, dist_name )
- if result then
- puts "Adding project succeeded!"
- return true
- else
- puts "Adding project failed!"
- return false
- end
- end
-
-
- # add binary project
- def self.add_binary_project( id, project_name, pkg_name, os_string, dist_name )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- supported_os_list = server.supported_os_list
- # get supported os for project.
- # if not specified, all supported os of the server will be used
- if os_string.nil? or os_string == "default" then
- os_list = supported_os_list
- else
- os_list = os_string.strip.split(",")
- # check OS name
- os_list.each do |os|
- if not supported_os_list.include? os then
- puts "Unsupported OS name \"#{os}\" is used!"
- puts "Check the following supported OS list:"
- supported_os_list.each do |s_os|
- puts " * #{s_os}"
- end
-
- return false
- end
- end
- end
-
- # check distribution
- dist_name = check_distribution_name(dist_name, server)
- if dist_name.nil? then return false end
-
- # add
- result = server.prjmgr.add_binary_project( project_name, pkg_name,
- os_list, dist_name )
- if result then
- puts "Adding project succeeded!"
- return true
- else
- puts "Adding project failed!"
- return false
- end
- end
-
-
- # remove project
- def self.remove_project( id, project_name, dist_name )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # check distribution
- dist_name = check_distribution_name(dist_name, server)
- if dist_name.nil? then return false end
-
- result = server.prjmgr.remove_project( project_name, dist_name )
- if result then
- puts "Removing project succeeded!"
- return true
- else
- puts "Removing project failed!"
- return false
- end
- end
-
-
- def self.register_package(id, file_path, dist_name)
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
-
- # check distribution
- dist_name = check_distribution_name(dist_name, server)
- if dist_name.nil? then return false end
-
- # check file exist?
- if not File.exist? file_path then
- puts "File not found!"
- return false
- end
- file_path = File.expand_path(file_path)
-
- # send request
- success = true
- job_id = nil
- job_status = nil
- job_error = nil
- result = false
- begin
- client = BuildCommClient.create( "127.0.0.1", server.port )
- if client.nil? then
- puts "Server is not running!"
- return false
- end
- if client.send "REGISTER|BINARY-LOCAL|#{file_path}|#{server.password}|#{dist_name}" then
- # recevie & print
- result = client.read_lines do |l|
- if l.strip.start_with?("=JOB_START") then
- job_id = l.strip.split(",")[1]
- elsif l.strip.start_with?("=JOB_STATUS") then
- data = l.strip.split(",")
- job_status = data[1]
- job_error = data[2]
- else
- puts l
- end
- end
- if not result then
- puts "Error: Communication failed! #{client.get_error_msg()}"
- elsif job_id.nil? then
- puts job_error
- result = false
- end
- end
- rescue => e
- puts "ERROR: #{e}"
- result = false
- ensure
- client.terminate if not client.nil?
- end
-
- if not result then
- puts "Registering package failed!"
- return false
- end
-
- begin
- result = JobLog.monitor("127.0.0.1", server.port, job_id) do |line,status,errmsg|
- job_status = status
- job_error = errmsg
- if line.nil? then
- next
- end
-
- category, level, contents = JobLog.parse_log(line)
- if level < Log::LV_USER then next end
-
- if category == "INFO" then
- puts "Info: #{contents}"
- elsif category == "WARN" then
- puts "Warn: #{contents}"
- elsif category == "ERROR" then
- puts "Error: #{contents}"
- else
- next
- end
- end
- rescue BuildServerException => e
- puts e.err_message()
- result = false
- end
-
- # Check job status
- if not job_status.eql? "FINISHED" then
- result = false
- end
-
- return result
- end
-
- # server
- def self.query_server( id )
- server = get_server(id)
-
- if not server.has_db? then
- puts BuildServerException.get_message("ERR021")
- return false
- end
- migrate_db(server)
- server.prjmgr.load()
-
- puts "* REMOTE SERVER(S) *"
- server.get_remote_servers.each do |s|
- puts " * #{s.ip}:#{s.port}"
- end
- puts ""
-
- puts "* SUPPORTED OS *"
- server.supported_os_list.each do |os|
- puts " * #{os}"
- end
- puts ""
-
- puts "* DISTRIBUTION(S) *"
- server.distmgr.get_all_distributions().each do |d|
- puts " * #{d.name}"
- end
- puts ""
-
- puts "* SYNC PACKAGE SERVER(S) *"
- server.get_sync_package_servers.each do |s|
- puts " * [#{s[1]}] #{s[0]}"
- end
- puts ""
-
- puts "* PROJECT(S) *"
- server.prjmgr.get_all_projects().each do |p|
- puts " * [#{p.dist_name}] #{p.name}"
- end
- end
-
-
- # server
- def self.set_server_attribute( id, attr, value )
- result = true
-
- if attr.nil? or attr.empty? or value.nil? or value.empty? then
- puts "Attribute/Value must be specified!"
- return false
- end
-
- server = get_server(id)
-
- if not server.has_db? and attr != "GIT_BIN_PATH" and attr != "PASSWORD" and
- attr != "FTP_ADDR" and attr != "FTP_PORT" and
- attr != "FTP_USERNAME" and attr != "FTP_PASSWD" and
- attr != "DB_DSN" and attr != "DB_USER" and
- attr != "DB_PASSWD" and attr != "PASSWORD" and
- attr != "MAX_WORKING_JOBS" and attr != "MAX_JOBS" then
-
- puts BuildServerException.get_message("ERR021")
- return false
- end
-
- case attr
- when "GIT_BIN_PATH"
- server.git_bin_path = value
- when "MAX_WORKING_JOBS"
- server.jobmgr.max_working_jobs = value.to_i
- when "MAX_JOBS"
- server.jobmgr.set_max_jobs(value.to_i)
- when "JOB_LOG_URL"
- server.job_log_url = value
- when "SEND_MAIL"
- server.send_mail = value
- when "TEST_TIME"
- server.test_time = value.to_i
- when "PASSWORD"
- server.password = value
- when "JOB_KEEP_TIME"
- server.keep_time = value.to_i
- when "FTP_ADDR"
- server.ftp_addr = value
- when "FTP_PORT"
- server.ftp_port = value
- when "FTP_USERNAME"
- server.ftp_username = value
- when "FTP_PASSWD"
- server.ftp_passwd = value
- when "CHANGELOG_CHECK"
- server.changelog_check = value
- when "DB_DSN"
- server.db_dsn = db_dsn if not value.empty?
- when "DB_USER"
- server.db_user = value if not value.empty?
- when "DB_PASSWORD"
- server.db_passwd = value if not value.empty?
- else
- puts "Wrong attribute name!"
- result = false
- end
-
- if not server.has_db? then
- client = BuildCommClient.create( "127.0.0.1", server.port )
- if not client.nil? then
- # send request
- if client.send "SET|#{attr}|#{value}" then
- result = client.read_lines
- end
- # terminate
- client.terminate
- end
- end
-
- if result then write_server_config( server ) end
-
- return result
- end
-
-
- # server
- def self.get_server_attribute( id, attr )
- result = true
-
- if attr.nil? or attr.empty? then
- puts "Attribute name must be specified!"
- return false
- end
-
- server = get_server(id)
- if not server.has_db? and attr != "GIT_BIN_PATH" and attr != "PASSWORD" and
- attr != "FTP_ADDR" and attr != "FTP_PORT" and
- attr != "FTP_USERNAME" and attr != "FTP_PASSWD" and
- attr != "DB_DSN" and attr != "DB_USER" and
- attr != "DB_PASSWD" and attr != "PASSWORD" and
- attr != "MAX_WORKING_JOBS" and attr != "MAX_JOBS" then
-
- puts BuildServerException.get_message("ERR021")
- return false
- end
-
- case attr
- when "GIT_BIN_PATH"
- puts server.git_bin_path
- when "MAX_WORKING_JOBS"
- puts server.jobmgr.max_working_jobs
- when "MAX_JOBS"
- puts server.jobmgr.get_max_jobs()
- when "JOB_LOG_URL"
- puts server.job_log_url
- when "SEND_MAIL"
- puts server.send_mail
- when "TEST_TIME"
- puts server.test_time
- when "PASSWORD"
- puts server.password
- when "JOB_KEEP_TIME"
- puts server.keep_time
- when "FTP_ADDR"
- puts server.ftp_addr
- when "FTP_PORT"
- puts server.ftp_port
- when "FTP_USERNAME"
- puts server.ftp_username
- when "FTP_PASSWD"
- puts server.ftp_passwd
- when "CHANGELOG_CHECK"
- puts server.changelog_check
- when "DB_DSN"
- puts server.db_dsn
- when "DB_USER"
- puts server.db_user
- when "DB_PASSWORD"
- puts server.db_passwd
- else
- puts "Wrong attribute name!"
- result = false
- end
-
- return result
- end
-
-
- #####################
- private
- #####################
-
- # check build server config path
- def self.check_build_server_root
- if not File.exist? BuildServer::CONFIG_ROOT
- puts "Server configuation is not found."
- puts "Creating new server configuration... #{BuildServer::CONFIG_ROOT}"
- FileUtils.mkdir_p "#{BuildServer::CONFIG_ROOT}"
- end
- end
-
-
- # write server configuration
- def self.write_server_config( server )
- # create config folder
- server_dir = "#{BuildServer::CONFIG_ROOT}/#{server.id}"
- if not File.exist? server_dir then
- FileUtils.mkdir_p( server_dir )
- end
-
- # write configuration
- File.open( "#{server_dir}/server.cfg", "w" ) do |f|
- f.puts "ID=#{server.id}"
- f.puts "PATH=#{server.path}"
- f.puts "GIT_BIN_PATH=#{server.git_bin_path}"
- f.puts "SERVER_PORT=#{server.port}"
- f.puts "TEST_TIME=#{server.test_time}" if server.test_time > 0
- f.puts "PASSWORD=#{server.test_time}" if server.password != "0000"
- if not server.ftp_addr.nil? then
- f.puts "FTP_URL=ftp://#{server.ftp_username}:#{server.ftp_passwd}@#{server.ftp_addr}:#{server.ftp_port}"
- end
- f.puts "#only supports \"Mysql\""
- f.puts "DB_DSN=#{server.db_dsn}"
- f.puts "DB_USER=#{server.db_user}"
- f.puts "DB_PASSWORD=#{server.db_passwd}"
- if not server.has_db? then
- f.puts "MAX_WORKING_JOBS=#{server.jobmgr.max_working_jobs}"
- f.puts "MAX_JOBS=#{server.jobmgr.get_max_jobs()}"
- end
- end
- end
-
-
- # read server configuration
- def self.read_server_config( id )
- path=""
- git_bin_path="/usr/bin/git"
- running_port=nil
- config_port=nil
- test_time=0
- password="0000"
- ftp_addr=nil
- ftp_port=nil
- ftp_username=nil
- ftp_passwd=nil
- db_dsn=nil
- db_user=nil
- db_passwd=nil
- max_working_jobs=2
- max_jobs=4
-
- # read configuration
- server_dir = "#{BuildServer::CONFIG_ROOT}/#{id}"
- File.open( "#{server_dir}/server.cfg", "r" ) do |f|
- f.each_line do |l|
- if l.strip.start_with?("#") then next end
- idx = l.index("=") + 1
- length = l.length - idx
-
- if l.start_with?("PATH=")
- path = l[idx,length].strip
- elsif l.start_with?("GIT_BIN_PATH=")
- git_bin_path = l[idx,length].strip
- elsif l.start_with?("SERVER_PORT=")
- config_port = l[idx,length].strip.to_i
- elsif l.start_with?("TEST_TIME=")
- test_time = l[idx,length].strip.to_i
- elsif l.start_with?("PASSWORD=")
- password = l[idx,length].strip.to_i
- elsif l.start_with?("FTP_URL=")
- ftp_result = Utils.parse_ftpserver_url(l[idx,length].strip)
- ftp_addr = ftp_result[0]
- ftp_port = ftp_result[1]
- ftp_username = ftp_result[2]
- ftp_passwd = ftp_result[3]
- elsif l.start_with?("DB_DSN=")
- db_dsn = l[idx,length].strip if not l[idx,length].strip.empty?
- elsif l.start_with?("DB_USER=")
- db_user = l[idx,length].strip if not l[idx,length].strip.empty?
- elsif l.start_with?("DB_PASSWORD=")
- db_passwd = l[idx,length].strip if not l[idx,length].strip.empty?
- elsif l.start_with?("ID=")
- if not l[idx,length].strip.eql? id then
- raise RuntimeError, "Server configuration FAILED: #{server_dir}/server.cfg: ID must be \"#{id}\""
- end
- elsif l.start_with?("MAX_WORKING_JOBS=")
- max_working_jobs = l[idx,length].strip.to_i
- elsif l.start_with?("MAX_JOBS=")
- max_jobs = l[idx,length].strip.to_i
- else
- next
- end
- end
- end
-
- # create server object
- obj = BuildServer.new( id, path, ftp_addr, ftp_port, ftp_username, ftp_passwd )
-
- # get running port
- if File.exist? "#{server_dir}/run" then
- f = File.open( "#{server_dir}/run", "r" )
- l = f.gets
- running_port = l.strip.to_i
- f.close
- end
-
- # set port information
- obj.port = running_port if (running_port != nil)
- obj.config_port = config_port
-
- # set git binary path
- obj.git_bin_path = git_bin_path
-
- # set test time
- obj.test_time = test_time
-
- # set password
- obj.password = password
-
- # DB settring
- obj.db_dsn = db_dsn if not db_dsn.nil?
- obj.db_user = db_user
- obj.db_passwd = db_passwd
-
- # max working jobs
- if not obj.has_db? then
- obj.jobmgr.max_working_jobs = max_working_jobs
- obj.jobmgr.set_max_jobs(max_jobs)
- end
-
- # save config
- #write_server_config( obj )
-
- # create object & return it
- return obj
- end
-end
+++ /dev/null
-class BuildServerException < Exception
- attr_accessor :err_code
-
- @@err_msgs = {
- "ERR001" => "Invalid request format is used!",
- "ERR002" => "Distribution not found!",
- "ERR003" => "Unsupported OS name used!",
- "ERR004" => "User account not found!",
- "ERR005" => "Project access denied!",
- "ERR006" => "Job creation failed!",
- "ERR007" => "No supported OS defined in build server!",
- "ERR008" => "Distribution locked!",
- "ERR009" => "Project not found!",
- "ERR010" => "Build operation not allowed on this project type!",
- "ERR011" => "User password not matched!",
-
- "ERR013" => "Project from file-name/distribution not found!",
- "ERR014" => "Job cancel failed!",
- "ERR015" => "Server password not matched!",
- "ERR016" => "Can't received register file!",
- "ERR017" => "Project locked!",
-
- "ERR018" => "Connection failed!",
- "ERR019" => "Receiving data failed!",
- "ERR020" => "Sending data failed!",
-
- "ERR021" => "No DB exists and create(migrate) DB first!",
- "ERR022" => "There already exists same job.",
- "ERR023" => "Cannot create package client!",
- "ERR024" => "Attribute not supports!",
- "ERR025" => "no latest commit exists",
-
- "ERR100" => "Package info file(\"package/pkginfo.manifest\") does not exist!",
- "ERR101" => "Parsing package info file failed!",
- "ERR102" => "Parsing change-log file failed!",
- "ERR103" => "Change log not found!",
- "ERR104" => "No servers supports the \"Host-OS\"!",
- "ERR105" => "Version must be increased!",
- "ERR106" => "Source code has been changed without increasing version!",
- "ERR107" => "Package file not found!",
- "ERR108" => "Unsupported OS used in package file name!",
- "ERR109" => "Extracting package file failed!",
- "ERR110" => "Initializing sub jobs failed!",
- "ERR111" => "Git clone failed!!",
- "ERR112" => "Git checkout failed!!",
- "ERR113" => "Git reset failed!!",
-
- "ERR200" => "Unmet dependency found!",
- "ERR201" => "Creating job builder failed!",
- "ERR202" => "Building job failed!",
- "ERR203" => "Reverse-build-check failed!",
- "ERR204" => "Uploading package file(s) failed!",
- "ERR205" => "Job stopped by failure of its sub job!",
-
- "ERR900" => "Cancel event received!",
- "ERR901" => "Job already upload status. Cancel failed!",
-
- "ERR950" => "DB connection failed!!!"
- }
-
- def initialize(code)
- @err_code = code
- end
-
- def err_message(prefix = "Error: ")
- if not message().nil? and not message().empty? and
- message() != "BuildServerException" then
-
- return "#{prefix}#{@@err_msgs[@err_code]}: #{message()}"
- else
- return "#{prefix}#{@@err_msgs[@err_code]}"
- end
- end
-
-
- def self.get_message(err_code, prefix = "Error: ")
- return "#{prefix}#{@@err_msgs[err_code]}"
- end
-end
+++ /dev/null
-=begin
-
- BuildServerOptionParser.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-require 'optparse'
-require 'utils'
-
-class BuildServerUsage
- CREATE="build-svr create -n <server name> [-t <ftp server url>]"
- REMOVE="build-svr remove -n <server name>"
- MIGRATE="build-svr migrate -n <server name> [--dsn <db dsn> [--dbuser <db_user> --dbpassword <db_password>] ]"
- START="build-svr start -n <server name> [-p <port>]"
- STOP="build-svr stop -n <server name>"
- UPGRADE="build-svr upgrade -n <server name> [-D <distribution name>] [-u <package server url>]"
- ADD_SVR="build-svr add-svr -n <server name> -d <friend server address>"
- REMOVE_SVR= "build-svr remove-svr -n <server name> -d <friend server address>"
- ADD_OS= "build-svr add-os -n <server name> -o <os>"
- REMOVE_OS="build-svr remove-os -n <server name> -o <os>"
- ADD_DIST= "build-svr add-dist -n <server name> -D <distribution name> -u <package server url> -d <package server address> [-w <password>]"
- CLONE_DIST= "build-svr clone-dist -n <server name> -O <origin distribution name> -T <target distribution name> -u <package server url> -d <package server address> [-w <password>]"
- REMOVE_DIST="build-svr remove-dist -n <server name> -D <distribution name>"
- LOCK_DIST="build-svr lock-dist -n <server name> -D <distribution name>"
- UNLOCK_DIST="build-svr unlock-dist -n <server name> -D <distribution name>"
- ADD_SYNC="build-svr add-sync -n <server name> -u <remote pkg server url> [--dist <distribution>]"
- REMOVE_SYNC="build-svr remove-sync -n <server name> -u <remote pkg server url> [--dist <distribution>]"
- ADD_PRJ="build-svr add-prj -n <server name> -N <project name> (-g <git repository> -b <git branch>|-P <package name>) [-o <os list>] [--dist <distribution>]"
- REMOVE_PRJ="build-svr remove-prj -n <server name> -N <project name> [--dist <distribution>]"
- REGISTER="build-svr register -n <server name> -P <package file> [--dist <distribution>]"
- QUERY="build-svr query -n <server name>"
- SET_ATTR="build-svr set-attr -n <server name> -A <attribute> -V <value>"
- GET_ATTR="build-svr get-attr -n <server name> -A <attribute>"
-end
-
-def option_error_check( options )
- case options[:cmd]
-
- when "create"
- if options[:name].nil? or options[:name].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::CREATE
- end
-
- when "remove"
- if options[:name].nil? or options[:name].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::REMOVE
- end
-
- when "migrate"
- if options[:name].nil? or options[:name].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::MIGRATE
- end
-
- when "start"
- if options[:name].nil? or options[:name].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::START
- end
-
- when "stop"
- if options[:name].nil? or options[:name].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::STOP
- end
-
- when "upgrade"
- if options[:name].nil? or options[:name].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::UPGRADE
- end
-
- when "add-svr"
- if options[:name].nil? or options[:name].empty? or
- (options[:domain].nil? or options[:domain].empty?) then
- raise ArgumentError, "Usage: " + BuildServerUsage::ADD_SVR
- end
-
- when "remove-svr"
- if options[:name].nil? or options[:name].empty? or
- (options[:domain].nil? or options[:domain].empty?) then
- raise ArgumentError, "Usage: " + BuildServerUsage::REMOVE_SVR
- end
-
- when "add-os"
- if options[:name].nil? or options[:name].empty? or
- options[:os].nil? or options[:os].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::ADD_OS
- end
-
- when "remove-os"
- if options[:name].nil? or options[:name].empty? or
- options[:os].nil? or options[:os].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::REMOVE_OS
- end
-
- when "add-dist"
- if options[:name].nil? or options[:name].empty? or
- options[:dist].nil? or options[:dist].empty? or
- options[:url].nil? or options[:url].empty? or
- options[:domain].nil? or options[:domain].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::ADD_DIST
- end
-
- when "clone-dist"
- if options[:name].nil? or options[:name].empty? or
- options[:origin_dist].nil? or options[:origin_dist].empty? or
- options[:target_dist].nil? or options[:target_dist].empty? or
- options[:url].nil? or options[:url].empty? or
- options[:domain].nil? or options[:domain].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::ADD_DIST
- end
-
- when "remove-dist"
- if options[:name].nil? or options[:name].empty? or
- options[:dist].nil? or options[:dist].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::REMOVE_DIST
- end
-
- when "lock-dist"
- if options[:name].nil? or options[:name].empty? or
- options[:dist].nil? or options[:dist].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::LOCK_DIST
- end
-
- when "unlock-dist"
- if options[:name].nil? or options[:name].empty? or
- options[:dist].nil? or options[:dist].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::UNLOCK_DIST
- end
-
- when "add-sync"
- if options[:name].nil? or options[:name].empty? or
- (options[:url].nil? or options[:url].empty?) then
- raise ArgumentError, "Usage: " + BuildServerUsage::ADD_SYNC
- end
-
- when "remove-sync"
- if options[:name].nil? or options[:name].empty? or
- (options[:url].nil? or options[:url].empty?) then
- raise ArgumentError, "Usage: " + BuildServerUsage::REMOVE_SYNC
- end
-
- when "add-prj"
- if options[:name].nil? or options[:name].empty? or
- options[:pid].nil? or options[:pid].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::ADD_PRJ
- end
-
- when "remove-prj"
- if options[:name].nil? or options[:name].empty? or
- options[:pid].nil? or options[:pid].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::REMOVE_PRJ
- end
-
- when "register"
- if options[:name].nil? or options[:name].empty? or
- options[:package].nil? or options[:package].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::REGISTER
- end
-
- when "query"
- if options[:name].nil? or options[:name].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::QUERY
- end
-
- when "set-attr"
- if options[:name].nil? or options[:name].empty? or
- options[:attr].nil? or options[:attr].empty? or
- options[:value].nil? or options[:value].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::SET_ATTR
- end
-
- when "get-attr"
- if options[:name].nil? or options[:name].empty? or
- options[:attr].nil? or options[:attr].empty? then
- raise ArgumentError, "Usage: " + BuildServerUsage::SET_ATTR
- end
-
- else
- raise ArgumentError, "Input is incorrect : #{options[:cmd]}"
- end
-end
-
-def option_parse
- options = {}
- banner = "Build-server administer service command-line tool." + "\n" \
- + "\n" + "Usage: build-svr <SUBCOMMAND> [OPTS] or build-svr (-h|-v)" + "\n" \
- + "\n" + "Subcommands:" + "\n" \
- + "\t" + "create Create the build-server." + "\n" \
- + "\t" + "remove Remove the build-server." + "\n" \
- + "\t" + "migrate build-server DB migrate." + "\n" \
- + "\t" + "start Start the build-server." + "\n" \
- + "\t" + "stop Stop the build-server." + "\n" \
- + "\t" + "upgrade Upgrade the build-server include friends." + "\n" \
- + "\t" + "add-svr Add remote build/package server for support multi-OS or distribute build job." + "\n" \
- + "\t" + "remove-svr Remove remote build/package server for support multi-OS or distribute build job." + "\n" \
- + "\t" + "add-os Add supported OS." + "\n" \
- + "\t" + "remove-os Remove supported OS." + "\n" \
- + "\t" + "add-dist Add distribution." + "\n" \
- + "\t" + "clone-dist Clone distribution." + "\n" \
- + "\t" + "remove-dist Remove distribution." + "\n" \
- + "\t" + "lock-dist Lock distribution." + "\n" \
- + "\t" + "unlock-dist Unlock distribution." + "\n" \
- + "\t" + "add-sync Add package repository URL to synchronize with." + "\n" \
- + "\t" + "remove-sync Remove package repository URL." + "\n" \
- + "\t" + "add-prj Add project to build." + "\n" \
- + "\t" + "remove-prj Remove project." + "\n" \
- + "\t" + "register Register the package to the build-server." + "\n" \
- + "\t" + "query Show build server configuration." + "\n" \
- + "\t" + "set-attr Set build server atribute." + "\n" \
- + "\t" + "get-attr Get build server atribute." + "\n" \
- + "\n" + "Subcommand usage:" + "\n" \
- + "\t" + BuildServerUsage::CREATE + "\n" \
- + "\t" + BuildServerUsage::REMOVE + "\n" \
- + "\t" + BuildServerUsage::MIGRATE + "\n" \
- + "\t" + BuildServerUsage::START + "\n" \
- + "\t" + BuildServerUsage::STOP + "\n" \
- + "\t" + BuildServerUsage::UPGRADE + "\n" \
- + "\t" + BuildServerUsage::ADD_SVR + "\n" \
- + "\t" + BuildServerUsage::REMOVE_SVR + "\n" \
- + "\t" + BuildServerUsage::ADD_OS + "\n" \
- + "\t" + BuildServerUsage::REMOVE_OS + "\n" \
- + "\t" + BuildServerUsage::ADD_DIST + "\n" \
- + "\t" + BuildServerUsage::CLONE_DIST + "\n" \
- + "\t" + BuildServerUsage::REMOVE_DIST + "\n" \
- + "\t" + BuildServerUsage::LOCK_DIST + "\n" \
- + "\t" + BuildServerUsage::UNLOCK_DIST + "\n" \
- + "\t" + BuildServerUsage::ADD_SYNC + "\n" \
- + "\t" + BuildServerUsage::REMOVE_SYNC + "\n" \
- + "\t" + BuildServerUsage::ADD_PRJ + "\n" \
- + "\t" + BuildServerUsage::REMOVE_PRJ + "\n" \
- + "\t" + BuildServerUsage::REGISTER + "\n" \
- + "\t" + BuildServerUsage::QUERY + "\n" \
- + "\t" + BuildServerUsage::SET_ATTR + "\n" \
- + "\t" + BuildServerUsage::GET_ATTR + "\n" \
- + "\n" + "Options:" + "\n"
-
- optparse = OptionParser.new(nil, 32, ' '*8) do|opts|
- # Set a banner, displayed at the top
- # of the help screen.
-
- opts.banner = banner
-
- opts.on( '-n', '--name <server name>', 'build server name' ) do|name|
- options[:name] = name
- end
-
- opts.on( '-u', '--url <package server url>', 'package server url: http://127.0.0.1/dibs/unstable' ) do|url|
- options[:url] = url
- end
-
- opts.on( '-d', '--address <server address>', 'server address: 127.0.0.1:2224' ) do|domain|
- options[:domain] = domain
- end
-
- options[:port] = nil
- opts.on( '-p', '--port <port>', 'server port number: 2224' ) do|port|
- options[:port] = port.strip.to_i
- end
-
- opts.on( '-P', '--pkg <package name/file>', 'package file path or name' ) do|package|
- options[:package] = package.strip
- end
-
- options[:os] = nil
- opts.on( '-o', '--os <target os list>', 'ex) ubuntu-32,windows-32' ) do|os|
- if not Utils.multi_argument_test( os, "," ) then
- raise ArgumentError, "OS variable parsing error : #{os}"
- end
- options[:os] = os
- end
-
- opts.on( '-N', '--pname <project name>', 'project name' ) do|pid|
- options[:pid] = pid
- end
-
- opts.on( '-g', '--git <git repository>', 'git repository' ) do|git|
- options[:git] = git
- end
-
- opts.on( '-b', '--branch <git branch>', 'git branch' ) do|branch|
- options[:branch] = branch
- end
-
- #opts.on( '-r', '--remote <remote server id>', 'remote server id' ) do|remote|
- # options[:remote] = remote
- #end
- options[:dist] = ""
- opts.on( '-D', '--dist <distribution name>', 'distribution name' ) do |dist|
- options[:dist] = dist
- end
-
- options[:origin_dist] = ""
- opts.on( '-O', '--origin-dist <origin distribution name>', 'origin distribution name' ) do |dist|
- options[:origin_dist] = dist
- end
-
- options[:target_dist] = ""
- opts.on( '-T', '--target-dist <target distribution name>', 'target distribution name' ) do |dist|
- options[:target_dist] = dist
- end
-
-
- options[:passwd] = ""
- opts.on( '-w', '--passwd <password>', 'password for managing project' ) do|passwd|
- options[:passwd] = passwd
- end
-
- opts.on( '-t', '--ftp <ftp server url>', 'ftp server url: ftp://dibsftp:dibsftp@127.0.0.1:1024' ) do|domain|
- options[:fdomain] = domain
- end
-
- opts.on( '-A', '--attr <attribute name>', 'attribute' ) do |attr|
- options[:attr] = attr
- end
-
- options[:db_dsn] = nil
- opts.on( '--dsn <dsn>', 'Data Source Name ex) mysql:host=localhost;database=test' ) do |dsn|
- options[:db_dsn] = dsn
- end
-
- options[:db_user] = nil
- opts.on( '--dbuser <user>', 'DB user id' ) do |user|
- options[:db_user] = user
- end
-
- options[:db_passwd] = nil
- opts.on( '--dbpassword <password>', 'DB password' ) do |password|
- options[:db_passwd] = password
- end
-
-
- opts.on( '-V', '--value <value>', 'value' ) do |value|
- options[:value] = value
- end
-
- opts.on( '-h', '--help', 'display this information' ) do
- opts.help.split("\n").each {|op| puts op if not op.include? "--CHILD"}
- exit
- end
-
- opts.on( '-v', '--version', 'display version' ) do
- puts "DIBS(Distributed Intelligent Build System) version " + Utils.get_version()
- exit
- end
-
- opts.on( '-C', '--CHILD', 'child process' ) do
- options[:child] = true
- end
-
- end
-
- cmd = ARGV[0]
- if cmd.eql? "create" or cmd.eql? "remove" or
- cmd.eql? "start" or cmd.eql? "upgrade" or
- cmd.eql? "stop" or cmd.eql? "migrate" or
- cmd.eql? "add-svr" or cmd.eql? "remove-svr" or
- cmd.eql? "add-os" or cmd.eql? "remove-os" or
- cmd.eql? "add-dist" or cmd.eql? "clone-dist" or
- cmd.eql? "remove-dist" or
- cmd.eql? "lock-dist" or cmd.eql? "unlock-dist" or
- cmd.eql? "add-sync" or cmd.eql? "remove-sync" or
- cmd.eql? "add-prj" or cmd.eql? "remove-prj" or
- cmd.eql? "register" or
- cmd.eql? "query" or
- cmd.eql? "set-attr" or cmd.eql? "get-attr" or
- cmd =~ /(-v)|(--version)/ or
- cmd =~ /(help)|(-h)|(--help)/ then
-
- if cmd.eql? "help" then
- ARGV[0] = "-h"
- end
-
- options[:cmd] = ARGV[0]
- else
- raise ArgumentError, "Usage: build-svr <SUBCOMMAND> [OPTS] or build-svr -h"
- end
-
- optparse.parse!
-
- option_error_check options
-
- return options
-end
-
+++ /dev/null
-=begin
-
- CommonJob.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-require "time"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "utils.rb"
-require "JobLog.rb"
-require "BuildServerException.rb"
-
-
-class CommonJob
-
- attr_accessor :id, :server, :log, :status, :priority
- attr_accessor :os, :type, :pre_jobs, :user_id, :event, :sub_jobs, :thread, :error
- USER_JOB_PRIORITY = 100
- AUTO_JOB_PRIORITY = 0
-
- # initialize
- public
- def initialize(server, id=nil)
- @id = nil
- @server = server
- @parent = nil
- @sub_jobs = []
- @priority = USER_JOB_PRIORITY # higher numbered job get priority
- @os = "Unknown"
- @type = "Unknown"
- @pre_jobs = [] #pre-requisite jobs
- @project = nil
- @user_id = 1
-
- @status = "JUST_CREATED"
- @event = "NONE" # CANCEL/CANCELING
- @event_lock = Mutex.new
- @locked = false
- @log = nil
-
- @start_time = nil
- @end_time = nil
- @thread = nil
- @sub_pid = 0
-
- @error = nil
- end
-
- # event check
- def check_event
- # CANCEL/CANCELING
- if (@event == "CANCELING") then raise BuildServerException.new("ERR900"),"Cancel event received JOB ##{@id}" end
- end
-
- # set parent
- public
- def set_parent_job( parent )
- @parent = parent
- end
-
-
- # get parent
- public
- def get_parent_job()
- return @parent
- end
-
-
- # check this job has a parent job
- public
- def is_sub_job?
- return (not @parent.nil?)
- end
-
-
- # get all sub jobs
- public
- def get_sub_jobs
- return @sub_jobs
- end
-
-
- # add sub job
- public
- def add_sub_job( job )
- @sub_jobs.push job
- # this will make sub-job to share build-root of parent
- job.set_parent_job( self )
- end
-
-
- # create logger
- public
- def create_logger( verbose = false )
- @log = JobLog.new( self, verbose )
- return @log
- end
-
-
- public
- def get_project()
- return @project
- end
-
-
- public
- def set_project( project )
- @project = project
- end
-
-
- public
- def is_transferred?
- if not @project.nil? then
- return @project.is_transferred?
- else
- return false
- end
- end
-
- public
- def get_user_email
- return @server.get_email_using_user_id(@user_id)
- end
-
-
- # execute
- public
- def execute(sync=false)
-
- # create a thread for job
- @thread = Thread.new do
- begin
- job_main()
- rescue BuildServerException => e
- @log.error( e.err_message, Log::LV_USER )
- # "CANCEL" operation(ERR900) must be excluded
- if e.err_code != "ERR900" then
- @status = "ERROR"
- @error = e
- end
- rescue => e
- @log.error e.message
- @log.error e.backtrace.inspect
- @status = "ERROR"
- ensure
- # parent job will call sub job's terminate method
- # if "WORKING"(canceled) and "ERROR", must call "terminate" here
- if not is_sub_job? and (@status == "ERROR" or @status == "FINISHED") then
- terminate()
- end
- @thread = nil
- end
- end
-
- if sync then
- @thread.join
- end
-
- return true
- end
-
-
- #terminate
- public
- def terminate()
- #do noting
- end
-
- #cancel
- public
- def cancel()
- kill_sub_process
-
- @sub_jobs.select{|x| x.event == "NONE" and x.status != "FINISHED" and x.status != "ERROR" and x.status != "CANCELED" }.each do |sub|
- sub.event = "CANCEL"
- end
- # wait for job thread to finish
- @thread.join if not @thread.nil?
-
- if not @log.nil? then
- @log.info( "JOB is canceled by cancel operation !!", Log::LV_USER)
- end
- end
-
-
- # show progress
- public
- def progress
- # do nothing
- return ""
- end
-
-
- # create process to execute command
- public
- def execute_command(cmd)
- # if canceled, must prevent invoking more process
- check_event
-
- # execute
- pid, status = Utils.execute_shell_with_log(cmd, @log.path, false)
- @sub_pid = pid
-
- # wait for finish
- begin
- pid, status = Process.waitpid2(pid)
- rescue Errno::ECHILD
- # pid is not exist
- # do notting
- end
- @sub_pid = 0
-
- # if canceled, must exit job thread
- check_event
-
- # return
- return pid, status
- end
-
- def lock_event(&block)
- @event_lock.synchronize do
- if not @locked then
- yield if block_given?
- @locked = true
- else
- raise BuildServerException.new("ERR901"),"JOB ##{@id} alreay in Upload status\n - cancel failed"
- end
- end
- end
-
- public
- def self.create_table(db, inc, post_fix)
- db.do "CREATE TABLE jobs (
- id INTEGER PRIMARY KEY #{inc},
- project_id INTEGER,
- user_id INTEGER NOT NULL,
- supported_os_id INTEGER,
- distribution_id INTEGER,
- parent_job_id INTEGER,
- remote_build_server_id INTEGER,
- source_id INTEGER,
- jtype VARCHAR(32) NOT NULL,
- status VARCHAR(32) NOT NULL DEFAULT 'JUST_CREATED',
- start_time DATETIME,
- end_time DATETIME,
- error_code VARCHAR(32),
- CONSTRAINT fk_jobs_projects1 FOREIGN KEY ( project_id ) REFERENCES projects ( id ),
- CONSTRAINT fk_jobs_users1 FOREIGN KEY ( user_id ) REFERENCES users ( id ),
- CONSTRAINT fk_jobs_supported_os1 FOREIGN KEY ( supported_os_id ) REFERENCES supported_os ( id ),
- CONSTRAINT fk_jobs_distributions1 FOREIGN KEY ( distribution_id ) REFERENCES distributions ( id ),
- CONSTRAINT fk_jobs_jobs1 FOREIGN KEY ( parent_job_id ) REFERENCES jobs ( id ),
- CONSTRAINT fk_jobs_sources1 FOREIGN KEY ( source_id ) REFERENCES sources ( id ),
- CONSTRAINT fk_jobs_remote_build_servers1 FOREIGN KEY ( remote_build_server_id ) REFERENCES remote_build_servers ( id ) )#{post_fix}"
- db.do "CREATE TABLE job_timestamps (
- id INTEGER PRIMARY KEY #{inc},
- job_id INTEGER,
- stamp_name VARCHAR(64),
- stamp_time DATETIME)#{post_fix}"
- end
-
-
- # save to db
- public
- def save(db)
- now = @server.db_now
- prj_id = @project.nil? ? "NULL" : @project.get_project_id()
- if @id.nil? then
- @start_time = Time.now
- os_id = BuildServer.get_supported_os_id(db, @os)
- dist_id = PackageDistribution.get_distribution_id(db, get_distribution_name())
- parent_id = @parent.nil? ? "NULL" : @parent.id
- @id = @server.get_next_job_id()
- db.do "INSERT INTO jobs(id,project_id,user_id,supported_os_id, distribution_id, parent_job_id,jtype,status,start_time)
- VALUES (#{@id},#{prj_id},#{@user_id},#{os_id},#{dist_id},#{parent_id},'#{@type}','#{@status}',#{now})"
- else
- remote_bs_id = (@type == "BUILD" and not get_remote_server().nil?) ?
- get_remote_server().id : "NULL"
- if @status == "FINISHED" and not @project.nil? and
- (@type == "BUILD" or @type == "REGISTER") then
- source_id = @project.get_source_id_from_ver(pkginfo.get_version(),db)
- db.do "UPDATE jobs SET source_id=#{source_id} WHERE id=#{@id}"
- end
- db.do "UPDATE jobs SET status='#{@status}',remote_build_server_id=#{remote_bs_id} WHERE id=#{@id}"
- if @end_time.nil? and
- @status == "FINISHED" or @status == "ERROR" or @status == "CANCELED" then
-
- @end_time = Time.now
- db.do "UPDATE jobs SET end_time=#{now} WHERE id=#{@id}"
- if @status == "ERROR" and not @error.nil? then
- db.do "UPDATE jobs SET error_code='#{@error.err_code}' WHERE id=#{@id}"
- end
- end
- end
- end
-
-
- public
- def add_timestamp(name)
- if not @server.has_db? then return end
-
- now = @server.db_now()
- begin
- @server.get_db_connection() do |db|
- db.do "INSERT INTO job_timestamps(job_id,stamp_name,stamp_time)
- VALUES (#{@id},'#{name}',#{now})"
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
-
- end
- end
-
-
- def kill_sub_process()
- if @sub_pid != 0 then
- if not @log.nil? then
- @log.info("Killing sub process! id = #{@sub_pid}")
- end
- Utils.kill_process(@sub_pid)
- end
- end
-
-
- #
- # PROTECTED METHODS
- #
-
- # main module
- protected
- def job_main
- # do nothing
- end
-end
+++ /dev/null
-=begin
-
- CommonProject.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-
-class CommonProject
- attr_accessor :prj_id, :name, :type, :os_list, :dist_name, :path, :status
-
- # initialize
- def initialize( name, type, server, os_list, dist_name="BASE", status="OPEN" )
- @prj_id = -1
- if name.nil? then
- @name = "TRANSFERRED"
- else
- @name = name
- end
- @type = type
- @os_list = os_list
- @server = server
- @dist_name = dist_name
- @status = status
- @source_info = {}
- @package_info = {}
- @is_transferred = false
- if @dist_name == "BASE" then
- @path = "#{@server.path}/projects/#{@name}"
- else
- @path = "#{@server.path}/projects/#{@dist_name}/#{@name}"
- end
- end
-
-
- def ==(y)
- @name == y.name and @dist_name = y.dist_name
- end
-
-
- def init()
- # create project directory if not exist
- if not File.exist? @path then FileUtils.mkdir_p @path end
- end
-
-
- def set_transferred()
- @is_transferred = true
- end
-
-
- def is_transferred?
- return @is_transferred
- end
-
-
-
- def set_source_info(info)
- @source_info = info
- end
-
-
- def save_source_info(ver, info)
- @source_info[ver] = info
-
- # save to db
- begin
- @server.get_db_connection() do |db|
- save_source_info_internal(ver, info, db)
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- end
-
-
- def get_source_info(ver)
- return @source_info[ver]
- end
-
-
- def set_package_info(info)
- @package_info = info
- end
-
-
- def save_package_info(ver, pkg_name, pkg_os)
- if @package_info[ver].nil? then
- @package_info[ver] = []
- end
- @package_info[ver].push [pkg_name, pkg_os]
-
- # save to db
- begin
- @server.get_db_connection() do |db|
- save_package_info_internal(ver, pkg_name, pkg_os, db)
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- end
-
-
- # get latest package version
- def get_latest_version()
- versions = @package_info.keys
- if not versions.empty? then
- versions.sort! {|x,y| Version.new(x).compare(Version.new(y)) }
- return versions[-1]
- else
- return nil
- end
- end
-
-
- # get all package version
- def get_all_versions()
- return @package_info.keys
- end
-
-
- def include_package?(pkg_name, ver=nil, os=nil)
- # check version first
- if not ver.nil? then
- ver = get_latest_version()
- end
-
- if ver.nil? or @package_info[ver].nil? then return false end
- if not os.nil? and not @os_list.include? os then return false end
-
- # check name and version
- @package_info[ver].each do |pkg|
- if pkg_name == pkg[0] and os == pkg[1] then
- return true
- end
- end
-
- return false
- end
-
-
- def set_project_id(id)
- @prj_id = id
- end
-
-
- def get_project_id()
- return @prj_id
- end
-
- def set_project_status(status)
- @status = status
- end
-
- def get_project_status()
- return @status
- end
-
- def self.create_table(db, inc, post_fix)
- db.do "CREATE TABLE projects (
- id INTEGER PRIMARY KEY #{inc},
- distribution_id INTEGER NOT NULL,
- user_id INTEGER,
- name VARCHAR(32) NOT NULL,
- ptype VARCHAR(32) NOT NULL,
- status VARCHAR(32) NOT NULL DEFAULT 'OPEN',
- CONSTRAINT fk_projects_users1 FOREIGN KEY ( user_id ) REFERENCES users ( id ),
- CONSTRAINT fk_projects_distributions1 FOREIGN KEY ( distribution_id ) REFERENCES distributions ( id ) )#{post_fix}"
-
- db.do "CREATE TABLE project_os (
- project_id INTEGER NOT NULL,
- supported_os_id INTEGER NOT NULL,
- PRIMARY KEY ( project_id,supported_os_id ),
- CONSTRAINT fk_projects_has_supported_os_projects FOREIGN KEY ( project_id ) REFERENCES projects ( id ),
- CONSTRAINT fk_projects_has_supported_os_supported_os1 FOREIGN KEY ( supported_os_id ) REFERENCES supported_os ( id ) )#{post_fix}"
-
- db.do "CREATE TABLE sources (
- id INTEGER PRIMARY KEY #{inc},
- project_id INTEGER NOT NULL,
- pkg_ver VARCHAR(64) NOT NULL,
- location VARCHAR(256) NOT NULL,
- CONSTRAINT fk_project_sources_projects1 FOREIGN KEY ( project_id ) REFERENCES projects ( id ))#{post_fix}"
-
- db.do "CREATE TABLE packages (
- id INTEGER PRIMARY KEY #{inc},
- source_id INTEGER NOT NULL,
- supported_os_id INTEGER NOT NULL,
- pkg_name VARCHAR(64) NOT NULL,
- CONSTRAINT fk_project_packages_project_sources1 FOREIGN KEY ( source_id ) REFERENCES sources ( id ),
- CONSTRAINT fk_project_packages_supported_os1 FOREIGN KEY ( supported_os_id ) REFERENCES supported_os ( id ) )#{post_fix}"
-
- end
-
-
- protected
- def self.load_row(name, dist_name, db)
- row = db.select_one("SELECT projects.* FROM projects,distributions WHERE projects.name='#{name}' and
- projects.distribution_id=distributions.id and distributions.name='#{dist_name}'")
- if row.nil? then return nil end
-
- # get supported_os
- prj_id = row['id']
- os_list = []
- db.select_all("SELECT supported_os.name FROM project_os,supported_os WHERE project_id=#{prj_id} and supported_os.id = project_os.supported_os_id") do |r|
- os_list.push r['name']
- end
-
- # get source info/ package info
- source_info = {}
- package_info = {}
- db.select_all("SELECT * FROM sources WHERE project_id=#{prj_id}") do |r|
- source_info[r['pkg_ver']] = r['location']
-
- source_id = r['id']
- db.select_all("SELECT packages.pkg_name,supported_os.name as os_name
- FROM packages,supported_os WHERE source_id=#{source_id} and packages.supported_os_id=supported_os.id") do |r2|
- if package_info[r['pkg_ver']].nil? then
- package_info[r['pkg_ver']] = []
- end
- package_info[r['pkg_ver']].push [r2['pkg_name'], r2['os_name']]
- end
- end
-
- return row, os_list, source_info, package_info
- end
-
-
- protected
- def save_common(db)
- if @prj_id == -1 then
- row = db.select_one("SELECT * FROM distributions WHERE name='#{@dist_name}'")
- dist_id = row['id']
- db.do "INSERT INTO projects (distribution_id,name,ptype,status)
- VALUES (#{dist_id},'#{@name}','#{@type}','#{@status}')"
- @prj_id = db.func(:insert_id)
- @os_list.each do |os|
- row = db.select_one("SELECT * FROM supported_os WHERE name='#{os}'")
- os_id = row['id']
- db.do "INSERT INTO project_os VALUES(#{@prj_id},#{os_id})"
- end
-
- return true
- else
- row = db.select_one("SELECT * FROM distributions WHERE name='#{@dist_name}'")
- dist_id = row['id']
- db.do "UPDATE projects SET ptype='#{@type}',status='#{@status}' WHERE name='#{@name}' and distribution_id=#{dist_id})"
- db.do "DELETE FROM project_os WHERE project_id=#{@prj_id}"
- @os_list.each do |os|
- row = db.select_one("SELECT * FROM supported_os WHERE name='#{os}'")
- os_id = row['id']
- db.do "INSERT INTO project_os VALUES(#{@prj_id},#{os_id})"
- end
-
- @source_info.each do |src_ver,info|
- save_source_info_internal(src_ver, info, db)
- end
-
- @package_info.each do |src_ver,pkg_name_os_pair|
- pkg_name_os_pair.each do |pkg_name, pkg_os|
- save_package_info_internal(src_ver, pkg_name, pkg_os, db)
- end
- end
-
- return false
- end
- end
-
-
- public
- def get_source_id_from_ver( src_ver, db )
- row=db.select_one("SELECT * FROM sources WHERE project_id=#{@prj_id} and pkg_ver='#{src_ver}'")
- if row.nil? then
- return "NULL"
- else
- return row['id']
- end
- end
-
-
- protected
- def save_source_info_internal(src_ver, info, db)
- row1=db.select_one("SELECT * FROM sources WHERE project_id=#{@prj_id} and pkg_ver='#{src_ver}'")
- if row1.nil? then
- db.do "INSERT INTO sources(project_id, pkg_ver,location)
- VALUES(#{@prj_id},'#{src_ver}','#{info}')"
- else
- db.do "UPDATE sources SET location='#{info}' "+
- "WHERE project_id=#{@prj_id} and pkg_ver='#{src_ver}'"
- end
- end
-
-
- protected
- def save_package_info_internal(src_ver, pkg_name, pkg_os, db)
- row=db.select_one("SELECT * FROM sources WHERE project_id=#{@prj_id} and pkg_ver='#{src_ver}'")
- source_id = row['id']
- row = db.select_one("SELECT * FROM supported_os WHERE name='#{pkg_os}'")
- os_id = row['id']
- row1=db.select_one("SELECT * FROM packages WHERE source_id=#{source_id} and pkg_name='#{pkg_name}' and supported_os_id=#{os_id}")
- if row1.nil? then
- db.do "INSERT INTO packages(source_id,supported_os_id,pkg_name) VALUES(#{source_id},#{os_id},'#{pkg_name}')"
- end
- end
-
-
- # return its prject id and if not exist?, return -1
- protected
- def unload_common(db)
- row = db.select_one("SELECT * FROM projects WHERE id=#{@prj_id}")
- if row.nil? then return -1 end
- db.do "DELETE FROM project_os WHERE project_id=#{@prj_id}"
- db.do "DELETE FROM group_project_accesses WHERE project_id=#{@prj_id}"
- db.select_all("SELECT * FROM sources WHERE project_id=#{@prj_id}") do |r|
- source_id = r['id']
- db.do "DELETE FROM packages WHERE source_id=#{source_id}"
- end
- db.do "DELETE FROM sources WHERE project_id=#{@prj_id}"
- db.do("DELETE FROM projects WHERE id=#{@prj_id}")
- end
-
-
- public
- def self.get_project_row(name, dist_name, db)
- return db.select_one("SELECT * FROM projects WHERE name='#{name}' AND distribution_id=(SELECT id FROM distributions WHERE name='#{dist_name}')")
- end
-
- public
- def self.get_project_from_pkg_name_row(pkg_name, dist_name, db)
- return db.select_one("SELECT projects.id,projects.distribution_id,projects.name,projects.ptype
- FROM distributions,projects,project_bins
- WHERE distributions.name='#{dist_name}' and
- distributions.id = projects.distribution_id and
- projects.id = project_bins.project_id and
- project_bins.pkg_name = '#{pkg_name}'")
- end
-
- public
- def self.get_all_project_rows(db)
- result = []
- db.select_all("SELECT projects.name,distributions.name as dist_name,projects.ptype FROM projects,distributions WHERE projects.distribution_id=distributions.id") do |row |
- result.push row.to_h
- end
- return result
- end
-
- public
- def self.get_project_rows_in_distribution(db, distribution_name)
- result = []
- db.select_all("SELECT projects.name,distributions.name as dist_name,projects.ptype FROM projects,distributions WHERE projects.distribution_id=distributions.id AND distributions.name = '#{distribution_name}'") do |row|
- result.push row.to_h
- end
- return result
- end
-end
+++ /dev/null
-=begin
-
- DistributionManager.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-require 'thread'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/pkg_server"
-require "SocketJobRequestListener.rb"
-require "RegisterPackageJob.rb"
-require "packageServer.rb"
-
-class PackageDistribution
- attr_accessor :name, :pkgsvr_url, :pkgsvr_ip, :pkgsvr_port, :pkgsvr_password, :status, :description, :id
-
- def initialize( name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password, status )
- @id = -1
- @name = name
- @pkgsvr_url = pkgsvr_url
- @pkgsvr_ip = pkgsvr_ip
- @pkgsvr_port = pkgsvr_port
- @pkgsvr_password = pkgsvr_password
- @status = status
- @description = ""
- end
-
-
- def self.create_table(db, inc, post_fix)
- db.do "CREATE TABLE distributions (
- id INTEGER PRIMARY KEY #{inc},
- name VARCHAR(32) NOT NULL UNIQUE,
- pkgsvr_url VARCHAR(256),
- pkgsvr_addr VARCHAR(64),
- pkgsvr_password VARCHAR(64),
- status VARCHAR(32) NOT NULL DEFAULT 'OPEN',
- description VARCHAR(256) ) #{post_fix}"
- end
-
-
- def self.load(name, db)
- row = db.select_one("SELECT * FROM distributions WHERE name='#{name}'")
- return ( row.nil? ) ? nil : load_row(row)
- end
-
-
- def unload(db)
- #TODO remove sync_pkg_server
- #TODO remove projects
- #TODO remove jobs
- db.do("DELETE FROM distributions WHERE name='#{@name}'")
- end
-
-
- def self.load_all(db)
- result = []
- db.select_all("SELECT * FROM distributions") do |row |
- result.push load_row(row)
- end
- return result
- end
-
-
- def self.load_first(db)
- row = db.select_one("SELECT * FROM distributions ORDER BY id")
- return ( row.nil? ) ? nil : load_row(row)
- end
-
-
- def self.load_row(row)
- pkgsvr_ip = row['pkgsvr_addr'].split(":")[0]
- pkgsvr_port = row['pkgsvr_addr'].split(":")[1].to_i
- new_obj = new(row['name'], row['pkgsvr_url'], pkgsvr_ip, pkgsvr_port, row['pkgsvr_password'], row['status'])
- new_obj.description = row['description']
- new_obj.id = row['id']
-
- return new_obj
- end
-
-
- def save(db)
- dist_addr = @pkgsvr_ip + ":" + @pkgsvr_port.to_s
- row = db.select_one("SELECT * FROM distributions WHERE name='#{@name}'")
- if row.nil? then
- db.do "INSERT INTO distributions(name, pkgsvr_url, pkgsvr_addr, pkgsvr_password, status, description) VALUES ('#{@name}','#{@pkgsvr_url}','#{dist_addr}','#{@pkgsvr_password}','#{@status}','#{@description}')"
- else
- db.do "UPDATE distributions SET pkgsvr_url='#{@pkgsvr_url}', pkgsvr_addr='#{dist_addr}', pkgsvr_password='#{@pkgsvr_password}', status='#{@status}', description='#{@description}' WHERE name='#{@name}'"
- end
- end
-
-
- def self.get_distribution_id(db, dist_name)
- row = db.select_one("SELECT * FROM distributions WHERE name='#{dist_name}'")
- return ( row.nil? ) ? "NULL" : row['id']
- end
-end
-
-
-class DistributionManager
-
- # initialize
- def initialize( server )
- @server = server
- end
-
-
- # get default distribution
- def get_default_distribution_name()
- dist = get_first_distribution()
- return ( dist.nil? ) ? nil : dist.name
- end
-
-
- def get_default_pkgsvr_url()
- dist = get_first_distribution()
- return ( dist.nil? ) ? "" : dist.pkgsvr_url
- end
-
-
- # get distribution
- #name get_distribution(name)
- #return PackageDistribution
- #return nil when package distribution not exit or DB connection error
- def get_distribution(name)
- # conntect DB
- result = nil
- begin
- @server.get_db_connection() do |db|
- result = get_distribution_internal(name, db)
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- return result
- end
-
-
- def get_distribution_internal(name, db)
- return PackageDistribution.load(name, db)
- end
-
-
- # add
- #name add_distribution(name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password)
- #return true when add distribution successed
- #return false when distribution already exist or DB connection error
- def add_distribution(name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password)
- result = false
- begin
- @server.get_db_connection() do |db|
- if not get_distribution_internal(name, db).nil? then
- @server.log.info "The distribution \"#{name}\" already exists on server"
- @server.log.error "Adding distribution failed!"
- else
- new_dist = PackageDistribution.new(name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password, "OPEN")
- new_dist.save(db)
- result = true
- @server.log.info "Added a new distribution \"#{name}\""
- end
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- return result
- end
-
-
- # clone
- #name clone_distribution(origin_name, target_name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password)
- #return true when add distribution successed
- #return false when distribution already exist or DB connection error
- def clone_distribution(origin_name, target_name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password)
- result = false
- begin
- @server.get_db_connection() do |db|
- if get_distribution_internal(origin_name, db).nil? then
- puts "The distribution \"#{origin_name}\" is not exists on server"
- puts "Clone distribution failed!"
- @server.log.info "The distribution \"#{origin_name}\" is not exists on server"
- @server.log.error "Clone distribution failed!"
- elsif not get_distribution_internal(target_name, db).nil? then
- puts "The distribution \"#{target_name}\" already exists on server"
- puts "Clone distribution failed!"
- @server.log.info "The distribution \"#{target_name}\" already exists on server"
- @server.log.error "Clone distribution failed!"
- else
- new_dist = PackageDistribution.new(target_name, pkgsvr_url, pkgsvr_ip, pkgsvr_port, pkgsvr_password, "OPEN")
- new_dist.save(db)
- @server.log.info "Added a new distribution \"#{target_name}\""
-
- #Get project list
- projects = @server.prjmgr.get_projects_in_distribution(origin_name)
-
- #Add project
- projects.each do |prj|
- if prj.type.eql? "GIT" then
- @server.prjmgr.add_git_project(prj.name, prj.repository, prj.branch, prj.os_list, target_name)
- elsif prj.type.eql? "BINARY" then
- @server.prjmgr.add_binary_project(prj.name, prj.pkg_name, prj.os_list, target_name)
- end
-
- new_prj = @server.prjmgr.get_project(prj.name, target_name)
-
- # copy source info
- source_cnt = db.select_one("SELECT count(*) val FROM sources WHERE project_id =#{prj.prj_id}")[0]
- if( source_cnt > 0 )
- db.do "INSERT INTO sources(project_id, pkg_ver,location)
- SELECT #{new_prj.prj_id}, pkg_ver, location FROM sources WHERE project_id = #{prj.prj_id}"
- end
-
- # copy access info
- rows = db.select_all("SELECT * FROM group_project_accesses WHERE project_id = #{prj.prj_id}")
- if rows.nil? then
- next
- end
- rows.each do |row|
- group_id = row['group_id']
- if group_id == 1 then
- next
- end
- db.do "INSERT INTO group_project_accesses (group_id, project_id, build)
- VALUES (#{group_id}, #{new_prj.prj_id}, 'TRUE')"
- end
- end
-
- result = true
- end
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- end
- return result
- end
-
-
- # remove
- #name remove_distribution(name)
- #return ture when remove distribution successed
- #return false when distribution not exist or DB connection error or DB conncetion error
- def remove_distribution(name)
- result = false
- begin
- @server.get_db_connection() do |db|
- dist = get_distribution_internal(name, db)
- if dist.nil? then
- @server.log.error "The distribution \"#{name}\" does not exists on server"
- @server.log.error "Removing distribution failed!"
- else
- dist.unload(db)
- result = true
- @server.log.info "Removed the distribution \"#{name}\""
- end
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
-
- #name get_first_distribution()
- #return PackageDistribution
- #return nil when no distribution exist or DB connection error
- def get_first_distribution()
- result = nil
- begin
- @server.get_db_connection() do |db|
- result = PackageDistribution.load_first(db)
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
-
- #name get_all_distributions()
- #return PackageDistribution list
- #return [] when no PackageDistribution exist or DB connection error
- def get_all_distributions()
- result = []
- begin
- @server.get_db_connection() do |db|
- result = PackageDistribution.load_all(db)
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
-
- #name set_distribution_lock(name, value=true)
- #return true when distribution lock setted
- #return false when distribution lock not exist or DB connection error
- def set_distribution_lock(name, value=true)
- result = false
- begin
- @server.get_db_connection() do |db|
- # check already exist
- dist = get_distribution_internal(name, db)
- if dist.nil? then return false end
-
- dist.status = (value)? "CLOSE" : "OPEN"
- dist.save(db)
- end
- if value then
- @server.log.info "The distribution \"#{name}\" is locked!"
- else
- @server.log.info "The distribution \"#{name}\" is unlocked!"
- end
- result = true
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
- #END
-end
+++ /dev/null
-=begin
-
- GitBuildJob.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-require "thread"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "BuildJob.rb"
-require "utils.rb"
-require "BuildServerException.rb"
-
-
-$git_mutex = Mutex.new
-
-class GitBuildJob < BuildJob
- attr_accessor :git_commit, :git_branch, :git_repos
-
- # initialize
- def initialize( project, os, server )
- super(project, os, server)
- @git_repos = project.repository
- @git_branch = project.branch
- @git_commit = nil
- end
-
-
- def terminate()
- # report error
- if @status == "ERROR" then
- @log.error( "Job is stopped by ERROR" , Log::LV_USER)
- @server.cleaner.clean_afterwards(@id)
- elsif @status == "CANCELED" then
- if not @log.nil? then
- @log.error( "Job is CANCELED" , Log::LV_USER)
- end
- @server.cleaner.clean_afterwards(@id)
- else
- @log.info( "Job is FINISHED successfully!" , Log::LV_USER)
-
- # if succeeded, register source info and copy pkginfo.manifest
- @log.info( "Updating the source info for project \"#{@project.name}\"" , Log::LV_USER)
- if not is_transferred? then
- @project.save_source_info( @pkginfo.get_version(), @git_commit)
- @project.save_package_info_from_manifest( @pkginfo.get_version(),
- "#{@source_path}/package/pkginfo.manifest", @os)
- end
- @server.jobmgr.save_job_status(self)
- # clean up
- @server.cleaner.clean(@id)
- end
-
- # clean up builder directory if exist?
- if Builder.exist? "JB#{@id}" then
- Builder.remove("JB#{@id}")
- end
-
- # send mail
- if ( @server.send_mail.eql? "YES" ) and ( not @pkginfo.nil? ) and ( not @pkginfo.packages.nil? ) then
- mail_list = []
- contents = []
- contents.push " "
- contents.push " Git information : #{@git_commit} "
- contents.push " "
- contents.push "%-30s| %10s | %10s" % ["package name", "version", "os"]
- contents.push "---------------------------------------------------------------"
- @pkginfo.packages.each do |pkg|
- if not pkg.os.eql? @os then next end
- mail_list = mail_list | Mail.parse_email( pkg.maintainer )
- contents.push("%-30s| %10s | %10s" % [ pkg.package_name, pkg.version, pkg.os] )
- end
-
- if @status == "ERROR" then
- subject = "[DIBS] Build fail"
- contents.push " "
- contents.push "check log file"
- contents.push "* Log : #{@server.job_log_url}/#{@id}/log"
- elsif @status == "CANCELED" then
- subject = "[DIBS] Build canceled"
- else
- subject = "[DIBS] Build success"
- end
- Mail.send_mail(mail_list, subject, contents.join("\n"))
- end
-
- # close logger
- @log.close
- end
-
-
- # verify
- def init
- @job_root = "#{@server.path}/jobs/#{@id}"
- @source_path = @job_root+"/temp"
- @job_working_dir=@job_root+"/works"
- @buildroot_dir = "#{@job_root}/buildroot"
-
- # mkdir job root
- if not File.exist? @job_root then FileUtils.mkdir_p @job_root end
-
- # create logger
- if @log.nil? then
- @log = JobLog.new(self)
- end
-
- @log.info( "Initializing job...", Log::LV_USER)
-
- # if internal job, copy external_pkgs
- if not @external_pkgs.empty? then
- @log.info( "Copying external dependent pkgs...", Log::LV_USER)
- ext_pkgs_dir = "#{@job_root}/external_pkgs"
-
- incoming_dir = "#{@server.transport_path}/#{@dock_num}"
- if File.exist? incoming_dir then
- FileUtils.mv "#{incoming_dir}", "#{ext_pkgs_dir}"
- end
-
- FileUtils.mkdir_p incoming_dir
- end
-
- # download source code
- @git_commit = get_source_code()
-
- # check pkginfo.manifest
- if not File.exist? "#{@source_path}/package/pkginfo.manifest" then
- raise BuildServerException.new("ERR100")
- end
-
- # set up pkg info
- begin
- @pkginfo = PackageManifest.new("#{@source_path}/package/pkginfo.manifest")
- rescue => e
- raise BuildServerException.new("ERR101"), e.message
- end
-
- # set up pkgsvr_client
- @pkgsvr_client = Client.create(@pkgsvr_url, @job_working_dir, @log)
- if @pkgsvr_client.nil? then
- raise BuildServerException.new("ERR023")
- end
-
- # checking version if not reverse-build job or not internal-job
- if not @is_rev_build_check_job and not @is_verified then
-
- #check change log
- change_log = {}
- begin
- change_log = Parser.read_changelog "#{@source_path}/package/changelog" if File.exist? "#{@source_path}/package/changelog"
- rescue => e
- raise BuildServerException.new("ERR102"), e.message
- end
-
- if not change_log.empty? and @pkginfo.packages[0].change_log.empty? then
- @pkginfo.packages.each {|pkg| pkg.change_log = change_log}
- end
-
- if @server.changelog_check and not @pkginfo.packages[0].does_change_exist? then
- raise BuildServerException.new("ERR103"), @pkginfo.packages[0].version
- end
-
- # check availabiltiy
- if not @server.check_job_availability( self ) then
- raise BuildServerException.new("ERR104"), "#{@os}"
- end
-
- check_package_version(@git_commit)
- end
-
- return true
- end
-
-
- def is_same_with?(wjob)
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
- if @type != wjob.type then return false end
-
- prj1 = @project
- prj2 = wjob.get_project()
-
- # check project name
- if prj1.nil? or prj2.nil? or
- prj1.name != prj2.name then
- return false
- end
-
- # check version
- if @pkginfo.nil? or wjob.pkginfo.nil? or
- not(Version.new(@pkginfo.get_version()) == Version.new(wjob.pkginfo.get_version())) then
- return false
- end
-
- if @git_commit != wjob.git_commit then return false end
-
- # check compat os
- wjob.pkginfo.get_target_packages(wjob.os).each do |p|
- if not p.os_list.include?(@os) then return false end
- end
-
-
- return true
- end
-
-
- #
- # PROTECTED/PRIVATE METHODS
- #
-
- protected
- def get_source_code()
- $git_mutex.synchronize do
- get_source_code_internal()
- end
- end
-
-
- protected
- def get_source_code_internal()
- # check git directory
- cache_path = "#{@project.path}/cache"
- if not File.exist? cache_path then
- FileUtils.mkdir_p cache_path
- end
- git_path = "#{cache_path}/#{File.basename(@git_repos)}"
-
- # verify git & check branch name
- if File.exist? git_path then
- std_out_lines = git_cmd_return( "branch", git_path)
- if std_out_lines.nil? then
- @log.warn( "Git cache is corrupted! : #{@project.name}", Log::LV_USER)
- FileUtils.rm_rf git_path
- else
- branch_list = std_out_lines.select{|x| x.start_with?("*")}
- if branch_list.count == 0 then
- @log.warn( "Git cache is corrupted! : #{@project.name}", Log::LV_USER)
- FileUtils.rm_rf git_path
- else
- current_branch = branch_list[0].split(" ")[1].strip
- if current_branch != @git_branch then
- @log.warn( "Branch name is changed.", Log::LV_USER)
- FileUtils.rm_rf git_path
- end
- end
- end
- end
-
- # git reset origin operation
- if File.exist? git_path and not git_cmd("reset --hard origin/#{@git_branch}", git_path,@log) then
- @log.warn( "Failed on \"git reset --hard origin/#{@git_branch}\"", Log::LV_USER)
- FileUtils.rm_rf git_path
- end
-
- # git pull operation
- if File.exist? git_path and not git_cmd("pull", git_path,@log) then
- @log.warn( "Failed on \"git pull\"", Log::LV_USER)
- FileUtils.rm_rf git_path
- end
-
- # if no git, clone it
- if not File.exist? git_path then
- # if "git pull" failed, try to "git clone"
- if not git_cmd("clone #{@git_repos}", cache_path, @log) then
- raise BuildServerException.new("ERR111"), "git clone #{@git_repos}"
- end
- # git checkout
- if not git_cmd("checkout #{@git_branch}", git_path, @log) then
- raise BuildServerException.new("ERR112"), "git checkout #{@git_branch}"
- end
- end
-
- if @git_commit.nil? then
- # get git commit-id
- commit_id = ""
- result_line = git_cmd_return("log -1", git_path)
- if result_line != nil then
- result_line.each do |l|
- if l.start_with?("commit ") then
- commit_id = l.split(" ")[1].strip
- end
- end
- end
-
- @git_commit = commit_id
- else
- # git reset
- if not git_cmd("reset --hard #{@git_commit}", git_path, @log) then
- @log.warn( "Failed on \"git reset --hard #{@git_commit}\"", Log::LV_USER)
- FileUtils.rm_rf git_path
- if not git_cmd("clone #{@git_repos}", cache_path, @log) then
- raise BuildServerException.new("ERR111"), "git clone #{@git_repos}"
- end
- if not git_cmd("reset --hard #{@git_commit}", git_path, @log) then
- raise BuildServerException.new("ERR113"), "git reset --hard #{@git_commit}"
- end
- end
- end
-
- # copy to source path
- Utils.execute_shell_return( "cp -r #{git_path} #{@source_path}" )
-
- return @git_commit
- end
-
-
- protected
- def git_cmd(cmd, working_dir, log)
- build_command = "cd \"#{working_dir}\";#{@server.git_bin_path} #{cmd}"
-
- pid, status = execute_command( build_command )
- if not status.nil? and status.exitstatus != 0 then
- return false
- else
- return true
- end
- end
-
-
- protected
- def git_cmd_return(cmd, working_dir)
- build_command = "cd \"#{working_dir}\";#{@server.git_bin_path} #{cmd}"
- ret = Utils.execute_shell_return(build_command)
-
- return ret
- end
-end
+++ /dev/null
-=begin
-
- GitProject.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-require 'dbi'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "CommonProject.rb"
-require "GitBuildJob.rb"
-require "Version.rb"
-require "PackageManifest.rb"
-
-# mutax for git operation
-
-
-class GitBuildProject < CommonProject
- attr_accessor :repository, :branch
-
- # initialize
- def initialize( name, server, os_list, dist_name, repos = nil, branch = nil )
- super(name, "GIT", server, os_list, dist_name, "OPEN")
- @repository = repos
- @branch = branch
- end
-
-
- # get commid-id of specified package version
- def get_commit_id( version )
- return get_source_info( version )
- end
-
-
- # create new job
- # if this project cannot support os, return nil
- def create_new_job( os )
- if @os_list.include? os then
- return GitBuildJob.new( self, os, @server )
- else
- return nil
- end
- end
-
-
- # create new job
- def create_new_job_from_version( os, version=nil )
- new_job=create_new_job( os )
-
- # set commit id
- if version.nil? then
- version = get_latest_version()
- end
-
- commit = get_commit_id( version )
- if not commit.nil? then
- new_job.git_commit = commit
- end
-
- return new_job
- end
-
-
- # save package info
- def save_package_info_from_manifest(version, file_path, os)
- begin
- pkginfo =PackageManifest.new(file_path)
- rescue => e
- @server.log.error e.message
- return
- end
-
- pkginfo.get_target_packages(os).each do |pkg|
- save_package_info(pkg.version, pkg.package_name, os)
- end
- end
-
-
- def self.create_table(db, post_fix)
- db.do "CREATE TABLE project_gits (
- project_id INTEGER NOT NULL,
- git_repos VARCHAR(128) NOT NULL,
- git_branch VARCHAR(32) NOT NULL,
- PRIMARY KEY ( project_id ),
- CONSTRAINT fk_project_gits_projects1 FOREIGN KEY ( project_id ) REFERENCES projects ( id ) )#{post_fix}"
- end
-
-
- def self.load(name, dist_name, server, db)
- row, prj_os_list, source_info, package_info = load_row(name, dist_name, db)
- if row.nil? then return nil end
-
- prj_id = row['id']
- prj_name = row['name']
- prj_status = row['status']
-
- new_project = GitBuildProject.new(prj_name, server, prj_os_list, dist_name)
- new_project.set_project_id( prj_id )
- new_project.set_source_info( source_info )
- new_project.set_package_info( package_info )
- new_project.set_project_status( prj_status )
-
- row=db.select_one("SELECT * FROM project_gits WHERE project_id=#{prj_id}")
- if row.nil? then return nil end
- new_project.repository=row['git_repos']
- new_project.branch=row['git_branch']
-
- return new_project
- end
-
- def save(db)
- is_new = save_common(db)
- init()
-
- if is_new then
- db.do "INSERT INTO project_gits VALUES (#{@prj_id},'#{@repository}','#{@branch}')"
- db.do "INSERT INTO group_project_accesses
- VALUES ( (SELECT groups.id FROM groups WHERE groups.name = 'admin'),'#{@prj_id}','TRUE')"
- else
- db.do "UPDATE project_gits SET git_repos='#{@repository}',git_branch='#{@branch}' WHERE project_id=#{@prj_id})"
- end
- end
-
-
- def unload(db)
- if @prj_id != -1 then
- db.do "DELETE FROM project_gits WHERE project_id=#{@prj_id}"
- end
- unload_common(db)
- end
-
- def get_latest_source_info(db)
- source_info = nil
- data = db.select_one("SELECT * FROM sources WHERE project_id =#{@prj_id} ORDER BY id DESC")
- if not data.nil? then
- source_info = {"pkg_ver" => data[2], "location" => data[3]}
- end
- return source_info
- end
-
-end
+++ /dev/null
-=begin
-
- JobClean.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-require "thread"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "Action.rb"
-require "ScheduledActionHandler.rb"
-
-$access_listfile = Mutex.new
-
-class JobCleanAction < Action
-
- def initialize( time, job_path, list_file, server )
- super(time,0)
-
- @job_path = job_path
- @job_id = @job_path.split("/")[-1]
- @list_file = list_file
- @server = server
- end
-
-
- def init
- $access_listfile.synchronize do
- File.open(@list_file, "a") do |f|
- f.puts "#{@job_id},#{time.year},#{time.month},#{time.day},#{time.hour},#{time.min},#{time.sec}"
- end
- end
- end
-
-
- def execute
- # Start to clean job
- @server.log.info "Executing clean action for the job #{@job_id}"
- begin
- execute_internal()
- rescue => e
- @server.log.error e.message
- @server.log.error e.backtrace.inspect
- end
- end
-
-
- private
- def execute_internal()
- # remove directories
- if File.exist? "#{@job_path}/buildroot" then
- FileUtils.rm_rf "#{@job_path}/buildroot"
- end
- if File.exist? "#{@job_path}/temp" then
- FileUtils.rm_rf "#{@job_path}/temp"
- end
- if File.exist? "#{@job_path}/external_pkgs" then
- FileUtils.rm_rf "#{@job_path}/external_pkgs"
- end
-
- # remove line for the job
- $access_listfile.synchronize do
- lines = []
- # get all lines
- if File.exist? @list_file then
- File.open(@list_file,"r") do |f|
- f.each_line do |l|
- lines.push l
- end
- end
- end
-
- # write the line except my job_id
- File.open(@list_file,"w") do |f|
- lines.each do |l|
- if l.split(",")[0].eql? @job_id then next end
- f.puts l
- end
- end
- end
- end
-end
-
-
-class JobCleaner
- attr_accessor :quit
-
- # init
- def initialize( server )
- @server = server
- @handler = ScheduledActionHandler.new
- @list_file = "#{BuildServer::CONFIG_ROOT}/#{@server.id}/clean"
- end
-
-
- # start thread
- def start()
-
- list_file2 = "#{BuildServer::CONFIG_ROOT}/#{@server.id}/clean_backup"
- jobs_path = "#{@server.path}/jobs"
- if not File.exist? jobs_path then
- FileUtils.mkdir_p jobs_path
- end
-
- # read clean list
- clean_list = []
- if File.exist? @list_file then
- FileUtils.mv(@list_file,list_file2)
- File.open(list_file2, "r") do |f|
- f.each_line do |l|
- id = l.split(",")[0]
- year = l.split(",")[1]
- month = l.split(",")[2]
- day = l.split(",")[3]
- hour = l.split(",")[4]
- min = l.split(",")[5]
- sec = l.split(",")[6]
-
- # create job and register
- job_path = "#{jobs_path}/#{id}"
- time = Time.mktime(year.to_i, month.to_i, day.to_i, hour.to_i, min.to_i, sec.to_i)
- @server.log.info "Registered clean-action for the job in list : #{id}"
- @handler.register(JobCleanAction.new(time,job_path,@list_file, @server))
-
- # add clean list
- clean_list.push id
- end
- end
- end
-
-
- # scan all jobs
- Dir.new(jobs_path).entries.each do |id|
- # skip . or ..
- if id.eql? "." or id.eql? ".." then next end
-
- # remove directory if jobs directory is created too long ago
- job_path = "#{jobs_path}/#{id}"
- dir_keep_time = 86400 < @server.keep_time ? @server.keep_time : 86400
- if File.ctime(job_path) + dir_keep_time < Time.now then
- FileUtils.rm_rf job_path
- @server.log.info "Removed the job directory: #{id}"
- next
- end
-
- if not clean_list.include? id then
- time = Time.now
- @server.log.info "Registered clean-action for old job : #{id}"
- @handler.register(JobCleanAction.new(time,job_path,@list_file, @server))
- end
- end
-
- # start handler
- @handler.start
- end
-
-
- # clean after some time
- def clean_afterwards(job_id)
- time = Time.now + @server.keep_time
- job_path = "#{@server.path}/jobs/#{job_id}"
- @handler.register(JobCleanAction.new(time, job_path, @list_file, @server))
-
- @server.log.info "Registered delayed clean-action for the job #{job_id}"
- end
-
-
- # clean directly
- def clean(job_id)
- time = Time.now
- job_path = "#{@server.path}/jobs/#{job_id}"
- @handler.register(JobCleanAction.new(time, job_path, @list_file, @server))
-
- @server.log.info "Registered clean-action for the job #{job_id}"
- end
-end
+++ /dev/null
-=begin
-
- JobLog.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__)) + "/common"
-require "log"
-require "logger"
-require "BuildComm.rb"
-require "BuildServerException.rb"
-
-
-class JobLog < Log
-
- def initialize(job, verbose = false)
- log_level = (verbose) ? Log::LV_NORMAL : Log::LV_USER
- if job.nil? then
- super(nil)
- else
- if not File.exist? "#{job.server.path}/jobs/#{job.id}" then
- FileUtils.mkdir_p "#{job.server.path}/jobs/#{job.id}"
- end
- super("#{job.server.path}/jobs/#{job.id}/log",log_level)
- end
- @parent_job=job
- end
-
-
- def JobLog.parse_log(line)
- data = line.sub(/(^[a-zA-Z], \[[^\]]*\][ \t]*)/,"")
- if $1.nil? then
- return "UNKNOWN", 1, line
- end
-
- data_tok = data.split(" -- : ")
- if data_tok.nil? then
- return "UNKNOWN", 1, line
- elsif data_tok.count != 2 then
- return "INFO", 1, ""
- end
-
- category = data_tok[0]
- sub_data = data_tok[1]
- level = sub_data[1..1].to_i
- contents = sub_data[4..-1]
-
- if contents.nil? then
- contents = ""
- end
-
- return category, level, contents
- end
-
-
- def JobLog.monitor(ip, port, job_id)
-
- result = true
- job_status = ""
- begin
- client = BuildCommClient.create( ip, port, nil, 0 )
- if client.nil? then
- raise BuildServerException.new("ERR018"), "#{ip}:#{port}"
- end
-
- client.send "LOG|#{job_id}"
- result = client.read_lines do |line|
- if line.strip.start_with?("=JOB_STATUS") then
- data = line.strip.split(",")
- job_status = data[1]
- job_error = data[2]
-
- if block_given? then
- yield nil,job_status,job_error
- end
- else
- if block_given? then
- yield line.strip,job_status,job_error
- else
- puts line.strip
- end
- end
- end
-
- if not result then
- raise BuildServerException.new("ERR019"), "#{client.get_error_msg()}"
- end
-
- ensure
- client.terminate if not client.nil?
- end
-
- return result
- end
-end
+++ /dev/null
-=begin
-
- JobManager.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-require 'thread'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/pkg_server"
-require "SocketJobRequestListener.rb"
-require "RegisterPackageJob.rb"
-require "packageServer.rb"
-require "BuildServerException.rb"
-
-class JobManager
- attr_accessor :jobs, :internal_jobs, :reverse_build_jobs
- attr_accessor :internal_job_schedule
-
- # initialize
- def initialize( parent )
- @server = parent
- @jobs = []
- @internal_jobs = []
- @reverse_build_jobs = []
- @new_job_index = 0
- @internal_job_schedule = Mutex.new
- @latest_job_touch = Mutex.new
- @max_build_jobs = 2
- @max_jobs = 4
- end
-
- def cancel_broken_status
- begin
- @server.get_db_connection() do |db|
- db.do "UPDATE jobs SET status = 'CANCELED' WHERE status != 'FINISHED' and status != 'ERROR' and status != 'CANCELED'"
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- end
-
- def max_working_jobs
- result = nil
- if @server.has_db? then
- result = nil
- begin
- @server.get_db_connection() do |db|
- result = db.select_one("SELECT value FROM server_configs WHERE property = 'max_working_jobs'")[0]
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- @max_build_jobs = result.to_i if not result.nil?
- end
-
- return @max_build_jobs
- end
-
- def max_working_jobs=(job_cnt)
- @max_build_jobs = job_cnt
- if @max_jobs < @max_build_jobs then
- @max_jobs = @max_build_jobs
- end
-
- if @server.has_db? then
- begin
- @server.get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{@max_build_jobs}' WHERE property = 'max_working_jobs'"
- db.do "UPDATE server_configs SET value = '#{@max_jobs}' WHERE property = 'max_jobs'"
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- end
- end
-
-
- def get_max_jobs()
- if @server.has_db? then
- result = nil
- begin
- @server.get_db_connection() do |db|
- result = db.select_one("SELECT value FROM server_configs WHERE property = 'max_jobs'")[0]
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- @max_jobs = result.to_i if not result.nil?
- end
-
- if @max_jobs < @max_build_jobs then
- @max_jobs = @max_build_jobs
- end
-
- return @max_jobs
- end
-
-
- def set_max_jobs(cnt)
- if cnt > @max_build_jobs then
- @max_jobs = cnt
- else
- @max_jobs = @max_build_jobs
- end
-
- if @server.has_db? then
- begin
- @server.get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{@max_jobs}' WHERE property = 'max_jobs'"
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- end
- end
-
-
- # initialize
- def init()
- # load latest job idx if exist
- file_path = "#{BuildServer::CONFIG_ROOT}/#{@server.id}/latest_job"
- if File.exist? file_path then
- latest_idx = -1
- File.open( file_path, "r" ) do |f|
- f.each_line do |l|
- latest_idx = l.strip.to_i
- break
- end
- end
- if latest_idx < 0 then latest_idx = -1 end
- @new_job_index = latest_idx + 1
- else
- @new_job_index = 0
- end
- end
-
-
- #name is_user_accessable(job,user_id)
- #return true when all including job is accessable
- #return false when denyed or DB connection error
- def is_user_accessable(job,user_id)
- if job.type == "MULTIBUILD" then
- job.get_sub_jobs().each do |subjob|
- if is_user_accessable(subjob,user_id) then
- return true
- end
- end
- else
- result = nil
- begin
- @server.get_db_connection() do |db|
- result = db.select_one "SELECT user_groups.group_id FROM user_groups,group_project_accesses
- WHERE user_groups.group_id = group_project_accesses.group_id and
- group_project_accesses.project_id = #{job.get_project.get_project_id} and
- user_groups.user_id = #{user_id}"
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- return (not result.nil?)
- end
- return false
- end
-
- def create_new_register_job( file_path, dist_name )
- return RegisterPackageJob.new( file_path, nil, @server, nil, dist_name )
- end
-
- def set_remote(job, rserver)
- job.set_remote_job(rserver)
- begin
- @server.get_db_connection() do |db|
- db.do "UPDATE jobs SET remote_build_server_id = '#{rserver.id}' WHERE id = '#{job.id}'"
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- end
-
- # add a normal job
- def add_job ( new_job )
- @server.log.info "Added new job \"#{new_job.id}\""
- save_job_status(new_job)
- @jobs.push( new_job )
- end
-
- # add internal job for multi-build job
- def add_internal_job( new_job )
- @server.log.info "Added new job \"#{new_job.id}\""
- save_job_status(new_job)
- @internal_jobs.push( new_job )
- end
-
- # add reverse build chek job
- def add_reverse_build_job( new_job )
- @server.log.info "Added new job \"#{new_job.id}\""
- save_job_status(new_job)
- @reverse_build_jobs.push( new_job )
- end
-
- # stop internal job selection
- def stop_internal_job_schedule()
- @internal_job_schedule.lock
- end
-
-
- # start internal job selection
- def resume_internal_job_schedule()
- @internal_job_schedule.unlock
- end
-
- # intialize normal job
- def initialize_job ( job )
- job.status = "INITIALIZING"
- job.thread = Thread.new do
- begin
- save_job_status(job)
- job.add_timestamp("INIT_START")
-
- # init
- job.init
- job.check_event
- if job.status == "INITIALIZING" then
- job.status = "WAITING"
- save_job_status(job)
- job.add_timestamp("INIT_END")
- end
- @server.log.info "Checking the job \"#{job.id}\" was finished!"
- rescue BuildServerException => e
- @server.log.info "Initializig the job \"#{job.id}\" failed!"
- if e.err_code != "ERR900" then
- job.status = "ERROR"
- end
- if not job.log.nil? then
- job.log.error(e.err_message(""), Log::LV_USER)
- else
- @server.log.error e.message
- end
- if job.status == "ERROR" then
- job.error = e
- job.terminate()
- save_job_status(job)
- end
- rescue => e
- @server.log.error e.message
- @server.log.error e.backtrace.inspect
- job.status = "ERROR"
- ensure
- job.thread = nil
- end
- end
- @server.log.info "Job \"#{job.id}\" entered INITIALIZING status"
- end
-
-
- #execute
- def execute(job)
- job.status = "WORKING"
- save_job_status(job)
- job.add_timestamp("WORK_START")
-
- # start build
- job.execute
- @server.log.info "Moved the job \"#{job.id}\" to working job list"
- end
-
-
- # execute remote
- def execute_remote(job, rserver)
-
- # start build
- set_remote(job, rserver)
-
- # status change & job control
- job.status = "REMOTE_WORKING"
- save_job_status(job)
- job.add_timestamp("WORK_START")
-
- if job.execute() then
- @server.log.info "Moved the job \"#{job.id}\" to remote job list"
- else
- @server.log.info "Moving the job \"#{job.id}\" to remote failed"
- end
- end
-
- def cancel_job( job)
- job.event = "CANCELING"
- @server.log.info "Creating thread for canceling the job \"#{job.id}\""
- Thread.new do
- begin
- @server.log.info "Job-Cancel-Thread started! \"#{job.id}\""
-
- # job cancel
- job.cancel
-
- # cancel finished
- @server.log.info "Updating job status to CANCELED... \"#{job.id}\""
- job.status = "CANCELED"
- save_job_status(job)
-
- # call terminate process for job
- @server.log.info "Calling CALLBACK, terminate... \"#{job.id}\""
- job.terminate
- rescue Exception => e
- @server.log.error e.message
- @server.log.error e.backtrace.inspect
- ensure
- @server.log.info "Job-Cancel-Thread is finished! \"#{job.id}\""
- end
- end
- end
-
- # handle
- def handle()
- # for cancel jobs
- (@jobs + @internal_jobs + @reverse_build_jobs).select {|j| j.event == "CANCEL" }.each do |job|
- cancel_job( job )
- end
-
- # for reverse build jobs
- job_list = @reverse_build_jobs
- job_list.each do |job|
- # if "ERROR", "FINISHED", "CANCELED" remove it from list
- if job.status == "ERROR"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is stopped by ERROR"
- dispose_job(job)
- elsif job.status == "FINISHED"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is removed by FINISH status"
- dispose_job(job)
- elsif job.status == "CANCELED"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is removed by CANCELED status"
- dispose_job(job)
- end
-
- # if "JUST_CREATED", initialize it
- if job.status == "JUST_CREATED" then
- initialize_job( job )
- end
- end
-
- # for internal jobs
- job_list = @internal_jobs
- job_list.each do |job|
- # if "ERROR", "FINISHED", "CANCELED" remove it from list
- if job.status == "ERROR"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is stopped by ERROR"
- dispose_job(job)
- elsif job.status == "FINISHED"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is removed by FINISH status"
- dispose_job(job)
- elsif job.status == "CANCELED"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is removed by CANCELED status"
- dispose_job(job)
- end
-
- # if "JUST_CREATED", initialize it
- if job.status == "JUST_CREATED" then
- initialize_job( job )
- end
- end
-
- # for normal job
- job_list = @jobs
- job_list.each do |job|
- # if "ERROR", "FINISHED", "CANCELED" remove it from list
- if job.status == "ERROR"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is stopped by ERROR"
- dispose_job(job)
- elsif job.status == "FINISHED"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is removed by FINISH status"
- dispose_job(job)
- elsif job.status == "CANCELED"
- save_job_status(job)
- @server.log.info "Job \"#{job.id}\" is removed by CANCELED status"
- dispose_job(job)
- end
-
- # if "JUST_CREATED", initialize it
- if job.status == "JUST_CREATED" then
- initialize_job( job )
- end
- end
-
- # remove duplicated jobs
- remove_duplicated_jobs()
-
- # reverse build job -> internal job -> normal job
- job = get_available_job
-
- # available job not exist?, continue
- if not job.nil? then
- # oherwise, check remote server
- rserver = @server.get_available_server( job )
- if rserver != nil and rserver == @server then
- execute(job)
- elsif rserver != nil then
- execute_remote(job, rserver)
- else
- #puts "No available server"
- end
- end
-
- end
-
-
- def dispose_job(job)
- # update remote server state if needed
- if job.type == "BUILD" and job.is_remote_job then
- job.get_remote_server.remove_working_job(job)
- job.get_remote_server.update_db()
- end
-
- # remove from queue
- @jobs.delete_if {|j| j.id == job.id}
- @internal_jobs.delete_if {|j| j.id == job.id}
- @reverse_build_jobs.delete_if {|j| j.id == job.id}
- end
-
-
- # will remove redundent jobs
- def remove_duplicated_jobs()
- @jobs.reverse.each do |j1|
- if j1.status != "WAITING" then next end
-
- @jobs.each do |j2|
- if j1.id == j2.id then next end
- if j2.status != "WAITING" and j2.status != "WORKING" and
- j2.status != "REMOTE_WORKING" then
- next
- end
-
- if j1.is_same_with?(j2) then
- begin
- raise BuildServerException.new("ERR022"), "(#{j2.id})"
- rescue BuildServerException => e
- j1.error = e
- j1.log.error(e.err_message(""), Log::LV_USER)
- j1.status = "ERROR"
- end
- break
- end
- end
- end
- end
-
-
- # select the job whith no build-dependency problem
- def get_available_job
- # select reverse build job with round-robin method
- selected_job = nil
- @reverse_build_jobs.each do |job|
- if job.status == "WAITING" then
- selected_job = job
- break
- end
- end
- # rotate array
- if @reverse_build_jobs.count > 0 then
- @reverse_build_jobs.push @reverse_build_jobs.shift
- end
- if not selected_job.nil? then return selected_job end
-
- # if no reverse build job exist!
- @internal_job_schedule.synchronize do
- # internal job first
- ret = nil
- if @internal_jobs.count > 0 then
- ret = get_available_job_in_list(@internal_jobs, true)
- end
-
- # not found, select normal job
- if ret.nil? then
- ret = get_available_job_in_list(@jobs, false)
- end
-
- return ret
- end
- end
-
-
- # return "max_working_jobs_cnt - current_working_jobs_cnt"
- def get_number_of_empty_room
- working_cnt = 0
- parent_list = []
- (@jobs + @internal_jobs + @reverse_build_jobs).each do |job|
- if job.status == "WORKING" then
- working_cnt = working_cnt + 1
- else
- next
- end
-
- # must exclude parent job
- if not job.get_parent_job().nil? then
- parent_list.push job.get_parent_job()
- end
- end
-
- parent_list.uniq!
-
- return max_working_jobs - working_cnt + parent_list.count
- end
-
-
- # check there are working jobs
- def has_working_jobs
- (@jobs + @internal_jobs + @reverse_build_jobs).each do |job|
- if job.status == "WORKING" then
- return true
- end
- end
-
- return false
- end
-
-
- # check there are waiting jobs
- def has_waiting_jobs
- (@jobs + @internal_jobs + @reverse_build_jobs).each do |job|
- if job.status == "WAITING" then
- return true
- end
- end
-
- return false
- end
-
-
- def get_working_jobs
- result = []
- (@jobs + @internal_jobs + @reverse_build_jobs).each do |job|
- if job.status == "WORKING" then
- result.push job
- end
- end
-
- return result
- end
-
-
- def get_waiting_jobs
- result = []
- (@jobs + @internal_jobs + @reverse_build_jobs).each do |job|
- if job.status == "WAITING" then
- result.push job
- end
- end
-
- return result
- end
-
-
- def get_remote_jobs
- result = []
- (@jobs + @internal_jobs + @reverse_build_jobs).each do |job|
- if job.status == "REMOTE_WORKING" then
- result.push job
- end
- end
-
- return result
- end
-
-
- # Additionally, "commit" option will assign job number
- def commit_job(job)
- if @server.has_db? and not job.is_transferred? then
- result = save_job_status(job)
- else
- job.id = @server.get_next_job_id()
- result = true
- end
- return result
- end
-
-
- #name save_job_status(job)
- #return true when save successed or transferred
- #return false when DB error occurred
- def save_job_status(job)
- # if transferred job, no need to save
- if job.is_transferred? then return true end
-
- result = false
- begin
- @server.get_db_connection() do |db|
- job.save(db)
- job.sub_jobs.each do |j|
- j.save(db)
- end
- end
- result = true
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
- def search_job (job_id)
- (@jobs + @internal_jobs + @reverse_build_jobs).each do |job|
- if job.id == job_id then
- return job
- end
- job.sub_jobs.each do |sjob|
- if sjob.id == job_id then
- return sjob
- end
- end
- end
- return nil
- end
-
- protected
- # select the job whith no build-dependency problem
- # if "check_dep_wait" is true, it will check the build dependency
- # among items of "WAIT" status in list
- def get_available_job_in_list( jobs, check_dep_wait=false )
-
- # gather all working jobs and full-build jobs
- check_dep_jobs = []
- jobs.each do |job|
- if job.event != "NONE" then next end
-
- if job.status == "WORKING" or job.status == "REMOTE_WORKING" then # or job.status == "PENDING" then
- check_dep_jobs.push job
- elsif ( check_dep_wait and job.status == "WAITING") then
- check_dep_jobs.push job
- end
- end
-
- # get candidates for waiting jobs
- candidate_jobs = []
- jobs.each do |job|
- if job.event != "NONE" then next end
- if job.status != "WAITING" then next end
-
- # check build dependency against working job
- pre_jobs = []
- check_dep_jobs.each do |cjob|
- if job == cjob then next end
- # In case that "WORKING/REMOTE_WORKING" job has build dependency on me
- if (cjob.status == "WORKING" or cjob.status == "REMOTE_WORKING" ) and
- (job.has_build_dependency?( cjob ) or job.is_compatible_with?( cjob)) then
- pre_jobs.push cjob
- elsif check_dep_wait and cjob.status == "WAITING" and
- (job.does_depend_on? cjob or
- (job.id > cjob.id and job.is_compatible_with? cjob) ) then
- pre_jobs.push cjob
- end
- end
-
- # check pre-requisite jobs are changed, notify to user
- is_changed = false
- if pre_jobs.count != job.pre_jobs.count then
- is_changed=true
- else
- pre_jobs.each do |pjob|
- if not job.pre_jobs.include? pjob then
- is_changed = true
- break
- end
- end
- end
- if pre_jobs.count > 0 and is_changed then
- job.log.info( "Waiting for finishing following jobs:", Log::LV_USER)
- pre_jobs.each do |bjob|
- if bjob.type == "BUILD" then
- job.log.info( " * #{bjob.id} #{bjob.pkginfo.packages[0].source}", Log::LV_USER)
- elsif bjob.type == "MULTIBUILD" then
- job.log.info( " * #{bjob.id} (Multi Build Job)", Log::LV_USER)
- end
- end
- end
- job.pre_jobs = pre_jobs
-
- # no pre-requisite jobs, return its job
- if job.pre_jobs.count == 0 then
- candidate_jobs.push job
- end
- end
-
- # select a job by priority
- if candidate_jobs.count == 0 then return nil end
- max_priority = -1
- max_priority_job = nil
- candidate_jobs.each do |job|
- if max_priority < job.priority then
- max_priority = job.priority
- max_priority_job = job
- end
- end
-
- return max_priority_job
- end
-
-end
+++ /dev/null
-=begin
-
- MultiBuildJob.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/builder"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/pkg_server"
-require "client.rb"
-require "PackageManifest.rb"
-require "Version.rb"
-require "Builder.rb"
-require "RemoteBuilder.rb"
-require "JobLog.rb"
-require "CommonJob.rb"
-require "FileUtil"
-
-class MultiBuildJob < CommonJob
-
- attr_accessor :source_path
- attr_accessor :pkgsvr_client
-
- # initialize
- def initialize (server)
- super(server)
- @log = nil
- @type = "MULTIBUILD"
-
- @host_os = Utils::HOST_OS
- @pkgsvr_url = nil
- @pkgsvr_ip = nil
- @pkgsvr_port = nil
- @pkgsvr_password = nil
-
- # "send_result_back" mean that server will send package file by network
- @send_result_back = false
- @dock_num = "0"
- @result_files = []
- end
-
-
- def get_distribution_name()
- return @sub_jobs[0].get_project().dist_name
- end
-
-
- def get_buildroot()
- return @buildroot_dir
- end
-
-
- def is_rev_build_check_job()
- return false
- end
-
- def set_no_reverse()
- @sub_jobs.each do |sub|
- sub.no_reverse = true
- end
- end
-
-
- # This make project to build
- # even though there is a package of same version on pkg-server
- def set_force_rebuild(value)
- @sub_jobs.each do |sub|
- sub.set_force_rebuild(value)
- end
- end
-
-
- def set_send_result_back( dock_num )
- @send_result_back = true
- @dock_num = dock_num
- end
-
-
- def is_send_result_back?
- return @send_result_back
- end
-
-
- def get_result_files()
- return @result_files
- end
-
-
- #
- def init
- @job_root = "#{@server.path}/jobs/#{@id}"
- @source_path = @job_root+"/temp"
- @job_working_dir=@job_root+"/works"
- @buildroot_dir = "#{@job_root}/buildroot"
-
- # mkdir job root
- if not File.exist? @job_root then FileUtils.mkdir_p @job_root end
-
- # create logger
- if @log.nil? then
- @log = JobLog.new(self)
- end
-
- @log.info( "Initializing job...", Log::LV_USER)
-
- # create source path
- if not File.exist? @source_path then
- FileUtils.mkdir_p @source_path
- end
-
- # initialize all sub jobs and add them to "internal_jobs"
- tstatus = @status
- @sub_jobs.each do |job|
- begin
- job.status = "INITIALIZING"
- @log.info( "Initializing sub-job(#{job.id})...", Log::LV_USER)
-
- job.add_timestamp("INIT_START")
-
- # initialize job
- job.init
- if job.status == "INITIALIZING" then
- job.status = "WAITING"
- job.add_timestamp("INIT_END")
- end
- rescue BuildServerException => e
- if e.err_code != "ERR900" then
- job.error = e
- job.status = "ERROR"
- end
- @log.error( "Failed to initialize sub-job \"#{job.get_project().name}\" for #{job.os}. (#{job.id})", Log::LV_USER)
- @log.error( " * #{e.err_message("")}", Log::LV_USER)
- tstatus = "ERROR"
- end
- end
-
- if tstatus == "ERROR" then
- # Changed the status of initialized sub-jobs if parent is in ERROR status
- @sub_jobs.each do |job|
- if job.status == "WAITING" then
- job.event = "CANCEL"
- job.status = "CANCELED"
- end
- # Add internal job for cancel,error process
- @server.jobmgr.add_internal_job(job)
- end
-
- raise BuildServerException.new("ERR110")
- end
-
-
- # set up pkgsvr_client
- first_project = @sub_jobs[0].get_project()
- dist = @server.distmgr.get_distribution(first_project.dist_name)
- @pkgsvr_url = dist.pkgsvr_url
- @pkgsvr_ip = dist.pkgsvr_ip
- @pkgsvr_port = dist.pkgsvr_port
- @pkgsvr_password = dist.pkgsvr_password
- @pkgsvr_client = Client.create(@pkgsvr_url, @job_working_dir, @log)
- if @pkgsvr_client.nil? then
- raise BuildServerException.new("ERR023")
- end
-
- return true
- end
-
-
- #terminate
- def terminate()
-
- # report error
- if @status == "ERROR" then
- # register delayed clean action for sub jobs
- @sub_jobs.each do |job|
- @server.cleaner.clean_afterwards(job.id)
- end
-
- # register delayed clean action for me
- @log.error( "Job is stopped by ERROR" , Log::LV_USER)
- @server.cleaner.clean_afterwards(@id)
-
- elsif @status == "CANCELED" then
- # register delayed clean action for sub jobs
- @sub_jobs.each do |job|
- @server.cleaner.clean_afterwards(job.id)
- end
-
- # register delayed clean action for me
- @log.error( "Job is stopped by CANCEL" , Log::LV_USER)
- @server.cleaner.clean_afterwards(@id)
-
- else
- # terminate all sub jobs
- @sub_jobs.each do |job|
- if not job.log.nil? then job.terminate() end
- end
-
- # register direct clean action for me
- @server.cleaner.clean(@id)
- end
-
- # close logger
- @log.close
- end
-
-
- # check building is possible
- def can_be_built_on?(host_os)
- return true
- end
-
-
- def get_packages()
- packages = []
- @sub_jobs.each do |job|
- packages = packages + job.get_packages()
- end
- packages.uniq!
-
- return packages
- end
-
-
- def get_build_dependencies(target_os)
- deps = []
- @sub_jobs.each do |job|
- deps = deps + job.get_build_dependencies(target_os)
- end
- deps.uniq!
-
- return deps
- end
-
-
- def get_source_dependencies(target_os, host_os)
- deps = []
- @sub_jobs.each do |job|
- deps = deps + job.get_source_dependencies(target_os,host_os)
- end
- deps.uniq!
-
- return deps
- end
-
-
- def is_same_with?(o)
- return false
- end
-
-
- def is_compatible_with?(o)
- return false
- end
-
- def has_build_dependency?(other_job)
-
- if has_same_packages?(other_job) or
- does_depend_on?(other_job) or
- does_depended_by?(other_job) then
-
- return true
- else
- return false
- end
- end
-
-
- def has_same_packages?( wjob )
- @sub_jobs.each do |job2|
- if wjob.type == "MULTIBUILD" then
- wjob.sub_jobs.each do |wjob2|
- if job2.has_same_packages?( wjob2 ) then return true end
- end
- else
- if job2.has_same_packages?( wjob ) then return true end
- end
- end
-
- return false
- end
-
-
- def does_depend_on?( wjob )
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- # compare build dependency
- get_build_dependencies(@os).each do |dep|
- wjob.get_packages().each do |wpkg|
- # dep packages of my job must have same name and target os
- # with packages in working job
- if dep.package_name == wpkg.package_name and
- dep.target_os_list.include? wjob.os then
- #puts "Removed from candiated... A -> B"
- return true
- end
- end
- end
-
- return false
- end
-
-
- def does_depended_by?( wjob )
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- get_packages().each do |pkg|
- wjob.get_build_dependencies(wjob.os).each do |dep|
- # dep package of working job must have same name and target os
- # with packages in my job
- if dep.package_name == pkg.package_name and
- dep.target_os_list.include? @os then
- #puts "Checking... A <- B"
- return true
- end
- end
- end
- return false
- end
-
-
- # return the job is asyncronous job
- def is_asynchronous_job?
- return false
- end
-
-
- def get_log_url()
- # only when server support log url
- if @server.job_log_url.empty? then
- return ""
- end
-
- return "#{@server.job_log_url}/#{@id}/log"
- end
-
- #
- # PROTECTED/PRIVATE METHODS
- #
-
-
- # main module
- protected
- def job_main()
- @log.info( "Invoking a thread for MULTI-BUILD Job #{@id}", Log::LV_USER)
- @log.info( "New Job #{@id} is started", Log::LV_USER)
-
- # initialize status map
- job_status_map = {}
- @sub_jobs.each do |job|
- job_status_map[job.id] = job.status
- end
-
- # add to internal job
- @server.jobmgr.internal_job_schedule.synchronize do
- @sub_jobs.each do |job|
- # init finished, add internal_jobs
- @server.jobmgr.add_internal_job(job)
- @log.info( "Added new job \"#{job.get_project().name}\" for #{job.os}! (#{job.id})",
- Log::LV_USER)
- end
- end
-
- # show job status changes
- all_jobs_finished = false
- stop_status = "FINISHED"
- while not all_jobs_finished
- all_jobs_finished = true
- @sub_jobs.each do |job|
- job_status = job.status
- # check status chanaged, if then print
- if job_status_map[ job.id ] != job_status then
- @log.info(" * Sub-Job \"#{job.get_project().name}(#{job.os})\" has entered \"#{job_status}\" state. (#{job.id})", Log::LV_USER)
- job_status_map[ job.id ] = job_status
- end
- # check all jobs are finished
- if job_status != "ERROR" and job_status != "FINISHED" and job_status != "CANCELED" then
- all_jobs_finished = false
- end
- # check there is some error or cancel
- if stop_status == "FINISHED" and
- (job_status == "ERROR" or job_status == "CANCELED") then
- # cancel all other un-finished jobs
- @sub_jobs.each do |sub|
- sub_status = sub.status
- if sub_status != "ERROR" and sub_status != "FINISHED" and
- sub_status != "CANCELED" and sub.event == "NONE" then
- @log.info(" * Sub-Job \"#{sub.get_project().name}(#{sub.os})\" has entered \"CANCELING\" state. (#{sub.id})", Log::LV_USER)
- sub.event = "CANCEL"
- end
- end
-
- stop_status = job_status
- break
- end
- end
- check_event
- sleep 1
- end
-
- if stop_status == "ERROR" then
- raise BuildServerException.new("ERR205")
- elsif stop_status == "CANCELED" then
- @event = "CANCEL" if @event == "NONE"
- raise BuildServerException.new("ERR205")
- end
-
- lock_event
-
- # upload
- if not @send_result_back then
- upload()
- end
-
- # copy result files to transport path
- if @send_result_back then
- copy_result_files_to_master()
- end
-
- # INFO. don't change this string
- @log.info( "Job is completed!", Log::LV_USER)
- @status = "FINISHED"
- end
-
-
- private
- def upload()
- @log.info( "Uploading ...", Log::LV_USER)
-
- # get package path list
- binpkg_path_list = Dir.glob("#{@source_path}/*_*_*.zip")
-
- # upload
- u_client = Client.create( @pkgsvr_url, nil, @log )
- if u_client.nil? then
- raise BuildServerException.new("ERR023")
- end
-
- snapshot = u_client.upload( @pkgsvr_ip, @pkgsvr_port, binpkg_path_list, @server.ftp_addr, @server.ftp_port, @server.ftp_username, @server.ftp_passwd, @pkgsvr_password)
-
- if snapshot.nil? then
- raise BuildServerException.new("ERR204")
- end
-
- # update local
- @log.info( "Upload succeeded. Sync local pkg-server again...", Log::LV_USER)
- @pkgsvr_client.update
- @log.info("Snapshot: #{snapshot}", Log::LV_USER)
- end
-
-
- # copy binary package files and log file to transport dir
- private
- def copy_result_files_to_master()
- outgoing_dir = "#{@server.transport_path}/#{@dock_num}"
- if not File.exist? outgoing_dir then
- FileUtils.mkdir_p outgoing_dir
- end
-
- # copy result files
- copy_result_files( outgoing_dir )
- end
-
-
- private
- def copy_result_files(dst_path)
- @log.info( "Copying result files to #{dst_path}", Log::LV_USER)
-
- # get package path list
- binpkg_path_list = Dir.glob("#{@source_path}/*_*_*.zip")
-
- binpkg_path_list.each do |file|
- @result_files.push File.basename(file)
- @log.info( " * #{file}", Log::LV_USER)
- #FileUtils.ln(file,"#{dst_path}/", :force => true)
- if not FileUtil.safeLink(file,"#{dst_path}/") then
- @log.error("Failed to link file [#{file}] to [#{dst_path}]")
- end
- end
- end
-
-end
+++ /dev/null
-=begin
-
- PackageSync.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-require "thread"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "Action.rb"
-require "ScheduledActionHandler.rb"
-require "BuildServerException.rb"
-
-
-class PackageSyncAction < Action
- attr_accessor :pkgsvr_url, :dist_name
- @@new_id = 0
-
- def initialize( time, url, dist_name, server )
- super(time, server.pkg_sync_period)
- my_id = @@new_id
- @@new_id += 1
- @pkgsvr_url = url
- @dist_name = dist_name
- @server = server
- @pkgsvr_client = nil
- @main_client = nil
- @sync_root = "#{@server.path}/sync/#{my_id}"
- @download_path = "#{@sync_root}/remote"
- @original_path = "#{@sync_root}/main"
- @user_id = nil
- end
-
-
- def init
- # create directory
- if File.exist? @download_path then
- FileUtils.rm_rf @download_path
- FileUtils.rm_rf @original_path
- end
-
- FileUtils.mkdir_p @download_path
- FileUtils.mkdir_p @original_path
-
- # create client
- @pkgsvr_client = Client.create( @pkgsvr_url, @download_path, @server.log )
- if @pkgsvr_client.nil? then
- raise BuildServerException.new("ERR023")
- end
-
- main_url = @server.distmgr.get_distribution(@dist_name).pkgsvr_url
- @main_client = Client.create( main_url, @original_path, @server.log )
- if @main_client.nil? then
- raise BuildServerException.new("ERR023")
- end
-
- @user_id = @server.check_user_id_from_email("sync-manager@user")
- end
-
-
- def execute
- @server.log.info "Executing package-sync action for server \"#{@pkgsvr_url}\""
-
- begin
- execute_internal()
- rescue => e
- @server.log.error e.message
- @server.log.error e.backtrace.inspect
- end
- end
-
-
- private
- def execute_internal()
- # check update
- pkgs = check_package_update
-
- # request to register
- registered_jobs = []
-
- # if updates are found, download them
- downloaded_files = []
- pkgs.each do |pkg|
- pkg_name=pkg[0]; os=pkg[1]; prj=pkg[2]
-
- file_paths = @pkgsvr_client.download(pkg_name, os, false)
- if file_paths.nil? then next end
- downloaded_files += file_paths
-
- file_paths.each do |file_path|
- @server.log.info "Creating new job for registering \"#{file_path}\""
- new_job = prj.create_new_job_from_local_file( file_path )
- if new_job.nil? then
- @server.log.error "Creating job failed: #{prj.name} #{pkg_name} #{@dist_name}"
- next
- end
- new_job.priority = CommonJob::AUTO_JOB_PRIORITY
- new_job.user_id = @user_id if @user_id != -1
-
- # add job
- @server.jobmgr.commit_job(new_job)
- # create logger, this step must be done after 'commit'
- new_job.create_logger()
- @server.jobmgr.add_job( new_job )
- registered_jobs.push new_job
- end
- end
-
- # wait for finish all jobs
- all_jobs_finished = false
- while not all_jobs_finished
- unfinished_jobs = registered_jobs.select do |j|
- (j.status != "ERROR" and j.status != "FINISHED" and j.status != "CANCELED")
- end
- if unfinished_jobs.empty? then
- all_jobs_finished = true
- else
- sleep 10
- end
- end
-
- # remove files
- downloaded_files.each do |file_path|
- @server.log.info "Removed downloaded file: \"#{file_path}\""
- FileUtils.rm_rf file_path
- end
- end
-
-
- protected
- def check_package_update
- pkgs = []
-
- # update
- @pkgsvr_client.update()
- @main_client.update()
-
- # for all BINARY project
- bin_prjs = @server.prjmgr.get_all_projects().select { |p|
- (p.type == "BINARY" and p.dist_name == @dist_name)
- }
- bin_prjs.each do |p|
- pkg_name = p.pkg_name
- compat_pkgs = []
- p.os_list.each do |os|
- # get pkg version in server
- main_ver = @main_client.get_attr_from_pkg(pkg_name, os, "version")
- remote_pkg = @pkgsvr_client.get_pkg_from_list(pkg_name, os)
- if remote_pkg.nil? then next end
- remote_ver = remote_pkg.version
- if remote_ver.nil? then next end
-
- if main_ver.nil? or Version.new(main_ver) < Version.new(remote_ver) then
- if (compat_pkgs.index { |pkg| remote_pkg.size == pkg[0] and remote_pkg.checksum == pkg[1] } ) == nil then
- pkgs.push [pkg_name, os, p]
- compat_pkgs.push [remote_pkg.size, remote_pkg.checksum]
- end
- end
- end
- end
-
- return pkgs
- end
-
-end
-
-
-class PackageServerSynchronizer
- attr_accessor :quit
-
- # init
- def initialize( server )
- @server = server
- @handler = ScheduledActionHandler.new
- end
-
-
- # start thread
- def start()
-
- # start thread for handling action
- @handler.start
-
- Thread.new do
- monitor()
- end
- end
-
-
- private
- def monitor()
- while(true)
- # wait 10 seconds
- sleep 10
-
- # get info from DB
- syncs = @server.get_sync_package_servers()
-
- # check removal
- @handler.get_actions().each do |act|
- exist = false
- syncs.each do |sync|
- url=sync[0]; dist_name=sync[1]
- if url == act.pkgsvr_url and dist_name == act.dist_name then
- exist = true
- break
- end
- end
- if not exist then
- @handler.unregister(act)
- @server.log.info "Unregistered package-sync action!: #{act.dist_name} <= \"#{act.pkgsvr_url}\""
- end
- end
-
- # check add/modify
- syncs.each do |sync|
- url=sync[0]; dist_name=sync[1]
- exist = false
- @handler.get_actions().each do |act|
- if act.pkgsvr_url == url and act.dist_name == dist_name then
- exist = true
- end
- end
-
- if not exist then
- new_time = Time.new + 10
- begin
- @handler.register( PackageSyncAction.new(new_time, url, dist_name, @server) )
- @server.log.info "Registered package-sync action!: #{dist_name} <= \"#{url}\""
- rescue BuildServerException => e
- @server.log.error e.message
- @server.log.error "Registering package-sync action failed!: #{dist_name} <= \"#{url}\""
- end
- end
- end
-
- end
- end
-end
+++ /dev/null
-=begin
-
- ProjectManager.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-require 'dbi'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "GitBuildProject.rb"
-require "BinaryUploadProject.rb"
-require "MultiBuildJob.rb"
-require "PackageManifest.rb"
-require "package.rb"
-
-class ProjectManager
-
- # initialize
- def initialize( server )
- @server = server
- @project_root = "#{@server.path}/projects"
- end
-
-
- # load existing project from server configuration
- def load()
- # check project root
- if not File.exist? @project_root then
- FileUtils.mkdir_p @project_root
- end
- end
-
-
- # get_project of the name
- # return GitBuildProject or BinaryUploadProject
- # return nil when project not exist or DB connection error
- def get_project(name, dist_name)
- begin
- @server.get_db_connection() do |db|
- return get_project_internal(name, dist_name, db)
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return nil
- end
-
-
- #name get_all_projects_summary
- #return project hash list
- #return [] when project not exists or DB connection error
- def get_all_projects_summary()
- result = []
- begin
- @server.get_db_connection() do |db|
- result = CommonProject.get_all_project_rows(db)
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- return result
- end
-
- #name get_all_project
- #return project list
- #return [] when DB error occurred
- def get_projects_in_distribution(distribution_name)
- result = []
- begin
- @server.get_db_connection() do |db|
- rows = CommonProject.get_project_rows_in_distribution(db, distribution_name)
- rows.each do |row|
- if row['ptype'] == "GIT" then
- prj = GitBuildProject.load(row['name'], row['dist_name'], @server, db)
- else
- prj = BinaryUploadProject.load(row['name'], row['dist_name'], @server, db)
- end
- if not prj.nil? then result.push prj end
- end
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
-
- #name get_all_project
- #return project list
- #return [] when DB error occurred
- def get_all_projects()
- result = []
- begin
- @server.get_db_connection() do |db|
- rows = CommonProject.get_all_project_rows(db)
- rows.each do |row|
- if row['ptype'] == "GIT" then
- prj = GitBuildProject.load(row['name'], row['dist_name'], @server, db)
- else
- prj = BinaryUploadProject.load(row['name'], row['dist_name'], @server, db)
- end
- if not prj.nil? then result.push prj end
- end
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # name add_git_project( name, repos, branch, os_list, dist_name)
- # return true when add git project successed
- # return false when git project already exist or DB connection error
- def add_git_project(name, repos, branch, os_list, dist_name)
- new_prj = nil
- result = false
- begin
- @server.get_db_connection() do |db|
- prj = get_project_internal(name, dist_name, db)
- if prj.nil? then
- # create new object
- new_prj = GitBuildProject.new(name, @server, os_list, dist_name, repos, branch)
-
- # save to db
- new_prj.save(db)
- result = true
-
- # authorize admin to access
- @server.qualify_admin_to_access(new_prj.get_project_id())
- @server.log.info "Added new GIT project \"#{name}\"(#{dist_name})"
- else
- @server.log.error "Adding project failed!: the project \"#{name}\"(#{dist_name}) already exists"
- end
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
-
- #name add_binary_project(name, pkg_name, os_list, dist_name)
- #return true when add binary project successed
- #return false when project already exist ro DB connection error
- def add_binary_project(name, pkg_name, os_list, dist_name)
- new_prj = nil
- result = false
- begin
- result = @server.get_db_connection() do |db|
- prj = get_project_internal(name, dist_name, db)
- if prj.nil? then
- # create new object
- new_prj = BinaryUploadProject.new(name, @server, os_list, dist_name, pkg_name)
-
- # save to db
- new_prj.save(db)
-
- # init
- new_prj.init()
-
- # authorize admin to access
- @server.qualify_admin_to_access(new_prj.get_project_id())
- @server.log.info "Added new BINARY project \"#{name}\"(#{dist_name})"
- result = true
- else
- @server.log.error "Adding project failed!: the project \"#{name}\"(#{dist_name}) already exists"
- end
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
-
- #name remove_project( name, dist_name )
- #return true when add binary project successed
- #return false when project not exist or DB connection error
- def remove_project( name, dist_name )
- result = false
- begin
- @server.get_db_connection() do |db|
- prj = get_project_internal(name, dist_name, db)
- if prj.nil? then
- @server.log.error "The project \"#{name}\"(#{dist_name}) does not exists on server"
- @server.log.error "Removing project failed!"
- else
- # unload from DB
- prj.unload(db)
-
- # remove project directory
- FileUtils.rm_rf prj.path
-
- @server.log.info "Removed the project \"#{name}\"(#{dist_name})"
- result = true
- end
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
- public
- #name get_project_accessable(project_name, dist_name, user_id)
- #return true when project accessable
- #return false when project not accessable or DB connection error
- def get_project_accessable(project_name, dist_name, user_id)
- prj = get_project(project_name, dist_name)
- result = false
- begin
- data = nil
- @server.get_db_connection() do |db|
- data = db.select_one "SELECT user_groups.group_id FROM user_groups,group_project_accesses
- WHERE user_groups.user_id = #{user_id} and
- user_groups.group_id = group_project_accesses.group_id and
- group_project_accesses.project_id = #{prj.get_project_id} and
- group_project_accesses.build = 'TRUE'"
- end
- result = (not data.nil?)
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- return result
- end
-
- #name get_project_pkg_name_accessable(pkg_name, dist_name, user_id)
- #return true when project accessable
- #return false when project not accessable or DB connection error
- def get_project_pkg_name_accessable(pkg_name, dist_name, user_id)
- result = false
- prj = get_project_from_package_name(pkg_name, dist_name)
- begin
- data = nil
- @server.get_db_connection() do |db|
- data = db.select_one "SELECT user_groups.group_id FROM user_groups,group_project_accesses
- WHERE user_groups.user_id = #{user_id} and
- user_groups.group_id = group_project_accesses.group_id and
- group_project_accesses.project_id = #{prj.get_project_id} and
- group_project_accesses.build = 'TRUE'"
- end
- result = (not data.nil?)
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
- return result
- end
-
- # create new job for project
- # if cannot create, return nil
- def create_new_job( name, os, dist_name )
- prj = get_project( name, dist_name )
- if prj.nil? then
- @server.log.error "Cannot get project info \"#{name}\"(#{dist_name})"
- end
-
- return prj.create_new_job( os )
- end
-
-
- # create new multi build job
- def create_new_multi_build_job( sub_job_list )
- result = MultiBuildJob.new( @server )
-
- sub_job_list.each do |job|
- result.add_sub_job( job )
- end
-
- return result
- end
-
-
- # get project that includes specified pkg name and os
- # will return [project,os,ver] list
- def get_projects_from_pkgs(pkgs, dist_name="BASE")
- result = []
- get_all_projects().each do |prj|
- # check distribution name
- if prj.dist_name != dist_name then next end
-
- pkgs.each do |pkg|
- name = pkg.package_name
- ver = pkg.version
- os = pkg.os
-
- # check project provide target package
- if prj.include_package?(name, ver, os) then
- result.push [prj, os, ver]
- break
- end
- end
- end
-
- return result
- end
-
-
- #name get_project_from_package_name(pkg_name, dist_name)
- #result project
- #result nil when project not exist or DB connection error
- def get_project_from_package_name(pkg_name, dist_name)
- result = nil
- begin
- @server.get_db_connection() do |db|
- result = get_project_from_pkg_name_internal(pkg_name,dist_name,db)
- end
- rescue BuildServerException => e
- if not @server.log.nil? then
- @server.log.error e.message
- end
- rescue => e
- if not @server.log.nil? then
- @server.log.error e.errstr
- end
- end
-
- return result
- end
-
-
- # get project from git repository
- def get_git_project( repos, dist_name )
- get_all_projects().each do |prj|
- # check project's distribution
- if prj.dist_name != dist_name then next end
- if prj.type == "GIT" and prj.repository == repos then
- return prj
- end
- end
-
- return nil
- end
-
-
- # this project will not be saved on DB
- def create_transferred_git_project(repos, dist_name, os, project_name, git_branch)
- newPrj = GitBuildProject.new(project_name, @server, [os], dist_name, repos, git_branch)
- newPrj.set_transferred()
-
- return newPrj
- end
-
-
- # write configuration
- def write_configuration(name, repos, branch, passwd, os_list )
- config_file = "#{@project_root}/#{name}/build"
- File.open( config_file, "w" ) do |f|
- f.puts "TYPE=GIT"
- if not passwd.nil? and not passwd.empty? then
- f.puts "PASSWD=#{passwd}"
- end
- f.puts "GIT_REPOSITORY=#{repos}"
- f.puts "GIT_BRANCH=#{branch}"
- f.puts "OS_LIST=#{os_list.join(",")}"
- end
- end
-
-
- # write configuration
- def write_configuration_for_binary_project(name, pkg_name, passwd, os_list )
- config_file = "#{@project_root}/#{name}/build"
- File.open( config_file, "w" ) do |f|
- f.puts "TYPE=BINARY"
- if not passwd.nil? and not passwd.empty? then
- f.puts "PASSWD=#{passwd}"
- end
- f.puts "PACKAGE_NAME=#{pkg_name}"
- f.puts "OS_LIST=#{os_list.join(",")}"
- end
- end
-
-
- private
- def get_project_internal(name, dist_name, db)
- row = CommonProject.get_project_row(name, dist_name, db)
- if row.nil? then return nil end
- prj_type = row['ptype']
-
- if prj_type == "GIT" then
- return GitBuildProject.load(name, dist_name, @server, db)
- else
- return BinaryUploadProject.load(name, dist_name, @server, db)
- end
- end
-
- private
- def get_project_from_pkg_name_internal(pkg_name, dist_name, db)
- row = CommonProject.get_project_from_pkg_name_row(pkg_name, dist_name, db)
- return ( row.nil? ) ? nil : BinaryUploadProject.load(row[:name], dist_name, @server, db)
- end
-end
+++ /dev/null
-=begin
-
- RegisterBinaryJob.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/builder"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/plkg_server"
-require "client.rb"
-require "PackageManifest.rb"
-require "Version.rb"
-require "utils.rb"
-require "ReverseBuildChecker.rb"
-require "CommonJob.rb"
-require "JobLog.rb"
-require "BuildServerException.rb"
-require "FileUtil"
-
-class RegisterPackageJob < CommonJob
-
- attr_accessor :source_path
- attr_accessor :pkgsvr_client, :pkg_type
- attr_accessor :pkg_name, :pkginfo, :pkg_version
- attr_accessor :no_reverse
-
-
- # initialize
- def initialize( local_path, project, server, ftpurl=nil, dist_name=nil )
- super(server)
- @log = nil
- @type = "REGISTER"
- @no_reverse = false
-
- @host_os = Utils::HOST_OS
- if not project.nil? then
- dist = @server.distmgr.get_distribution(project.dist_name)
- else
- dist = @server.distmgr.get_distribution(dist_name)
- end
- @pkgsvr_url = dist.pkgsvr_url
- @pkgsvr_ip = dist.pkgsvr_ip
- @pkgsvr_port = dist.pkgsvr_port
- @pkgsvr_password = dist.pkgsvr_password
-
- @local_path=local_path
- @file_path = nil
- @filename = File.basename(local_path)
- if @filename =~ /.*_.*_.*\.zip/ then
- @pkg_type = "BINARY"
- new_name = @filename.sub(/(.*)_(.*)_(.*)\.zip/,'\1,\2,\3')
- @pkg_name = new_name.split(",")[0]
- @pkg_version = new_name.split(",")[1]
- @os = new_name.split(",")[2]
- else
- @pkg_type = "ARCHIVE"
- @pkg_name = @filename
- @pkg_version = "0"
- end
- @pkginfo = nil #This info is valid only for BINARY package
- @project = project
- if not dist_name.nil? then
- @dist_name = dist_name
- elsif not @project.nil? then
- @dist_name = @project.dist_name
- else
- @dist_name = "BASE"
- end
- @auto_remove = false
- end
-
-
- def get_distribution_name()
- return @dist_name
- end
-
-
- def get_buildroot()
- return @buildroot_dir
- end
-
-
- def is_rev_build_check_job()
- return false
- end
-
-
- def set_auto_remove(value)
- @auto_remove=value
- end
-
-
- def set_no_reverse()
- @no_reverse = true
- end
-
-
- def set_send_result_back( dock_num )
- # do nothing
- end
-
-
- def is_send_result_back?
- return false
- end
-
-
- def execute_shell(cmd)
- # if canceled, must prevent invoking more process
- check_event
- ret = Utils.execute_shell(cmd)
- # if canceled, must exit job thread
- check_event
- return ret
- end
-
-
- #
- def init
- @job_root = "#{@server.path}/jobs/#{@id}"
- @source_path = @job_root+"/temp"
- @job_working_dir=@job_root+"/works"
- @buildroot_dir = "#{@job_root}/buildroot"
-
- # mkdir job root
- if not File.exist? @job_root then FileUtils.mkdir_p @job_root end
-
- # create logger
- if @log.nil? then
- @log = JobLog.new(self)
- end
-
- @log.info( "Initializing job...", Log::LV_USER)
-
- # create dummy source path
- if not File.exist? @source_path then
- FileUtils.mkdir_p @source_path
- end
-
- # copy package file to source path
- @file_path = "#{@source_path}/#{File.basename(@local_path)}"
- if not File.exist? @local_path then
- raise BuildServerException.new("ERR107"), @local_path
- end
-
- if @auto_remove then
- # if remote upload remove file and its directory
- FileUtils.mv(@local_path, @file_path)
- FileUtils.rm_rf("#{File.dirname(@local_path)}")
- else
- #FileUtils.ln(@local_path, @file_path, :force => true)
- if not FileUtil.safeLink(@local_path, @file_path) then
- @log.error("Failed to link file [#{@local_path}] to [#{@file_path}]")
- end
- end
-
- # check if the os is supported by build server
- if @pkg_type == "BINARY" and
- not @server.supported_os_list.include? @os then
-
- raise BuildServerException.new("ERR108"), @os
- end
-
- # set up pkgsvr_client
- @pkgsvr_client = Client.create(@pkgsvr_url, @job_working_dir, @log)
- if @pkgsvr_client.nil? then
- raise BuildServerException.new("ERR023")
- end
-
- # checking version if not reverse-build job
- if @pkg_type == "BINARY" then
- # extrac pkg file
- cmd = "cd \"#{@source_path}\";unzip #{@file_path}"
- if not execute_shell(cmd) then
- raise BuildServerException.new("ERR109"), @file_path
- end
-
- # check pkginfo.manifest
- if not File.exist? "#{@source_path}/pkginfo.manifest" then
- raise BuildServerException.new("ERR100")
- end
-
- # set up pkg info
- begin
- @pkginfo = PackageManifest.new("#{@source_path}/pkginfo.manifest")
- rescue => e
- raise BuildServerException.new("ERR101"), e.message
- end
-
- # TODO: need to check change log file
-
- check_package_version()
- end
-
- return true
- end
-
-
- #terminate
- def terminate()
- # report error
- if @status == "ERROR" then
- @log.error( "Job is stopped by ERROR" , Log::LV_USER)
- @server.cleaner.clean_afterwards(@id)
- else
- @log.info( "Job is FINISHED successfully!" , Log::LV_USER)
-
- # if succeeded, register source info and copy pkginfo.manifest
- if not @project.nil? then
- @log.info( "Updating the source info for project \"#{@project.name}\"" , Log::LV_USER)
- @project.save_source_info( @pkginfo.get_version(), '')
- @project.save_package_info_from_manifest( @pkginfo.get_version(),"#{@source_path}/pkginfo.manifest", @os)
- end
-
- # clean up
- @server.cleaner.clean(@id)
- end
-
- # close logger
- @log.close
- end
-
-
- # check building is possible
- def can_be_built_on?(host_os)
- return true
- end
-
-
- def get_packages()
- if @pkg_type == "BINARY" then
- return @pkginfo.packages
- else
- return []
- end
- end
-
-
- def get_build_dependencies(target_os)
- return []
- end
-
-
- def get_source_dependencies(target_os,host_os)
- return []
- end
-
-
- def is_same_with?(wjob)
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- if @type != wjob.type then return false end
-
- case @pkg_type
- when "BINARY"
- if @pkg_name == wjob.pkg_name and
- @pkg_version == wjob.pkg_version and
- wjob.pkginfo.packages.count == 1 and
- wjob.pkginfo.packages[0].os_list.include?(@os) then
- return true
- end
- when "ARCHIVE"
- if @pkg_name == wjob.pkg_name then return true end
- end
-
- return false
- end
-
-
- def is_compatible_with?(o)
- return false
- end
-
-
- def has_build_dependency?(other_job)
- if has_same_packages?(other_job) or
- does_depended_by?(other_job) then
-
- return true
- else
- return false
- end
- end
-
-
- def has_same_packages?( wjob )
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- if @type != wjob.type then return false end
-
- case @pkg_type
- when "BINARY"
- if @pkg_name == wjob.pkg_name and
- @os == wjob.os then
- return true
- end
- when "ARCHIVE"
- if @pkg_name == wjob.pkg_name then return true end
- end
-
- return false
- end
-
-
- # binary/archive package should not have build-dependencies
- def does_depend_on?( wjob )
- return false
- end
-
-
- def does_depended_by?( wjob )
- # must have same distribution
- if get_distribution_name() != wjob.get_distribution_name() then
- return false
- end
-
- if @pkg_type == "BINARY" then
- wjob.get_build_dependencies(wjob.os).each do |dep|
- # dep package of working job must have same name and target os
- # with packages in my job
- if dep.package_name == @pkg_name and
- dep.target_os_list.include? @os then
- #puts "Checking... A <- B"
- return true
- end
- end
- else
- wjob.get_source_dependencies(wjob.os,@host_os).each do |dep|
- if dep.package_name == @pkg_name then
- return true
- end
- end
- end
-
- return false
- end
-
-
- # return the job is asyncronous job
- def is_asynchronous_job?
- return false
- end
-
-
- def progress
- return ""
- end
-
-
- def get_log_url()
- # only when server support log url
- if @server.job_log_url.empty? then
- return ""
- end
-
- return "#{@server.job_log_url}/#{@id}/log"
- end
-
- #
- # PROTECTED METHODS
- #
-
-
- # main module
- protected
- def job_main()
- @log.info( "Invoking a thread for REGISTER Job #{@id}", Log::LV_USER)
- @log.info( "New Job #{@id} is started", Log::LV_USER)
-
- # clean build
- if not @no_reverse then
- if not ReverseBuildChecker.check( self, true ).empty? then
- raise BuildServerException.new("ERR203")
- end
- end
-
- # if this package has compatible OS, check
- if @pkg_type == "BINARY" and
- @pkginfo.packages[0].os_list.count > 1 then
-
- pkg = @pkginfo.packages[0]
- pkg.os_list.each do |os|
- if @os == os then next end
-
- # skip when the os does not exist in project's supported os list
- if not @project.nil? and not @project.os_list.include? os then next end
-
- # skip when there is higher version of the package
- ver_svr = @pkgsvr_client.get_attr_from_pkg( pkg.package_name, @os, "version")
- if not ver_svr.nil? and
- Version.new(@pkg_version) <= Version.new(ver_svr) then next end
-
- # make new package file for compatible OS
- newfile = "#{@pkg_name}_#{@pkg_version}_#{os}.zip"
- @log.info( "Copying #{@filename} to #{newfile}" )
- #FileUtils.ln(@file_path,"#{@source_path}/#{newfile}",:force => true)
- if not FileUtil.safeLink(@file_path,"#{@source_path}/#{newfile}") then
- @log.error("Failed to link file [#{@file_path}] to [#{@source_path}/#{newfile}]")
- end
-
- # reverse check
- if not @no_reverse then
- if not ReverseBuildChecker.check( self, true, os ) then
- raise BuildServerException.new("ERR203")
- end
- end
- end
- end
-
- lock_event
-
- # upload
- upload()
-
- # INFO. don't change this string
- @log.info( "Job is completed!", Log::LV_USER)
- @status = "FINISHED"
- end
-
-
- # build projects that dependes on me
- # can ignore some projects
- def check_reverse_build( target_os )
- @log.info( "Checking reverse build dependency ...", Log::LV_USER)
-
- # get reverse-dependent projects
- rev_pkgs = []
- if @pkg_type == "BINARY" then
- rev_pkgs += @pkgsvr_client.get_reverse_build_dependent_packages(@pkg_name, target_os)
- else
- rev_pkgs += @pkgsvr_client.get_reverse_source_dependent_packages(@pkg_name)
- end
-
- rev_projects = @server.prjmgr.get_projects_from_pkgs(rev_pkgs, get_distribution_name())
-
- # create reverse build job
- rev_build_jobs = []
- rev_projects.each do |p|
- prj = p[0]
- os = p[1]
- version = p[2]
-
- if prj.type != "GIT" then next end
-
- # create sub jobs for checking
- new_job = prj.create_new_job_from_version(os, version)
- new_job.set_rev_build_check_job(self)
-
- rev_build_jobs.push new_job
- end
-
- # reverse build
- if rev_build_jobs.count > 0 then
- rev_prjs_txt = rev_build_jobs.map {|j| "#{j.get_project().name}(#{j.os})"}.join(", ")
- @log.info( " * Will check reverse-build for next projects: #{rev_prjs_txt}", Log::LV_USER)
- end
- rev_build_jobs.each do |new_job|
- @log.info( " * Checking reverse-build ... #{new_job.get_project().name}(#{new_job.id})", Log::LV_USER)
- # job init
- result = new_job.init()
- # if init is succeeded!, try to execute
- if result then
- # check available server
- rserver = @server.get_available_server( new_job )
- if rserver != nil and rserver != @server then
- new_job.set_remote_job( rserver )
- end
- # execute
- new_job.execute(true)
- if new_job.status == "ERROR" then result = false end
- end
-
- # check result
- if not result then
- return false
- end
- end
-
- return true
- end
-
-
- def upload()
- @log.info( "Uploading ...", Log::LV_USER)
-
- # get package path list
- if @pkg_type == "ARCHIVE" then
- binpkg_path_list = Dir.glob("#{@source_path}/#{@pkg_name}")
- else
- binpkg_path_list = Dir.glob("#{@source_path}/*_*_*.zip")
- end
-
- # upload
- u_client = Client.create( @pkgsvr_url, nil, @log )
- if u_client.nil? then
- raise BuildServerException.new("ERR023")
- end
-
- snapshot = u_client.upload( @pkgsvr_ip, @pkgsvr_port, binpkg_path_list, @server.ftp_addr, @server.ftp_port, @server.ftp_username, @server.ftp_passwd, @pkgsvr_password)
-
- if snapshot.nil? then
- raise BuildServerException.new("ERR204")
- end
-
- # update local
- @log.info( "Upload succeeded. Sync local pkg-server again...", Log::LV_USER)
- @pkgsvr_client.update
- @log.info("Snapshot: #{snapshot}", Log::LV_USER)
- end
-
-
- # check if local package version is greater than server
- def check_package_version()
- @log.info( "Checking package version ...", Log::LV_USER)
-
- # package update
- @pkgsvr_client.update
-
- @pkginfo.packages.each do |pkg|
- ver_local = pkg.version
- #ver_svr = @pkgsvr_client.get_package_version( pkg.package_name, @os )
- ver_svr = @pkgsvr_client.get_attr_from_pkg( pkg.package_name, @os, "version")
- if not ver_svr.nil? and Version.new(ver_local) <= Version.new(ver_svr) then
- raise BuildServerException.new("ERR105"), "#{ver_local} <= #{ver_svr}"
- end
- end
-
- return true
- end
-end
+++ /dev/null
-=begin
-
- RemoteBuildServer.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "BuildComm.rb"
-require 'thread'
-
-class RemoteBuildServer
- attr_accessor :id, :ip, :port, :description, :status, :host_os
- attr_accessor :max_working_jobs, :working_jobs, :waiting_jobs, :working_job_count, :waiting_job_count
- attr_accessor :path
- attr_accessor :jobmgr, :distmgr
-
- # initialize
- def initialize(ip, port, desc, parent)
- @id = -1
- @ip = ip
- @port = port
- @description = desc
- @status = "DISCONNECTED"
- @host_os = Utils::HOST_OS
- @max_working_jobs = 2
- @working_jobs = []
- @waiting_jobs = []
- @path = ""
- @file_transfer_cnt_mutex = Mutex.new
- @file_transfer_cnt = 0
- @jobmgr = nil
- @distmgr = nil
- @monitor_thread = nil
- @parent = parent
- end
-
-
- # check the job can be built on this server
- def can_build?(job)
-
- # check me
- if job.can_be_built_on? @host_os then
- return true
- end
-
- return false
- end
-
-
- # create monitor to check remote build server status
- def create_system_monitor()
- @parent.log.info " * Creating system monitor for #{@ip}:#{@port}..."
- @monitor_thread = Thread.new do
- while true
- begin
- client = BuildCommClient.create( @ip, @port )
- if not client.nil? and client.send("MONITOR|SYSTEM") then
- result = client.read_lines(15,15) do |l|
- tok = l.split(",").map { |x| x.strip }
- status = tok[1]
- host_os = tok[2]
- max_working_jobs = tok[3].to_i
- if status != @status or max_working_jobs != @max_working_jobs then
- @status = status
- @max_working_jobs = max_working_jobs
- @host_os = host_os
- update_db()
- end
- end
- end
- rescue => e
- @parent.log.error "Remote server connection failed! : #{e.message}"
- ensure
- if not client.nil? then client.terminate end
- end
-
- @status = "DISCONNECTED"
- update_db()
-
- # after 1 min, try to reconnect
- sleep 60
- end
- end
-
- @parent.log.info "Created system monitor for #{@ip}:#{@port}"
- end
-
-
- def update_db()
- working_job_count = @working_jobs.count
- waiting_job_count = @waiting_jobs.count
- begin
- @parent.get_db_connection() do |db|
- db.do "UPDATE remote_build_servers SET
- status = '#{@status}',
- supported_os_id = (SELECT supported_os.id FROM supported_os WHERE supported_os.name = '#{@host_os}'),
- max_job_count = #{@max_working_jobs},
- working_job_count = #{working_job_count},
- waiting_job_count = #{waiting_job_count} WHERE id = #{@id}"
- end
- rescue BuildServerException => e
- if not @parent.log.nil? then
- @parent.log.error e.message
- end
- rescue => e
- if not @parent.log.nil? then
- @parent.log.error e.errstr
- end
- end
- end
-
-
- def add_working_job(job)
- @working_jobs.push job
- end
-
-
- def remove_working_job(job)
- @working_jobs.delete job
- end
-
-
- # return available working slot
- def get_number_of_empty_room
- return @max_working_jobs - @working_jobs.count
- end
-
-
- # check there are working jobs
- def has_working_jobs
- return (@working_jobs.count > 0)
- end
-
-
- # check there are waiting jobs
- def has_waiting_jobs
- return (@waiting_jobs.count > 0)
- end
-
-
- def add_file_transfer()
- @file_transfer_cnt_mutex.synchronize do
- @file_transfer_cnt += 1
- end
- end
-
- def remove_file_transfer()
- @file_transfer_cnt_mutex.synchronize do
- @file_transfer_cnt -= 1
- end
- end
-
- def get_file_transfer_cnt()
- return @file_transfer_cnt
- end
-
-
- def set_id(id)
- @id = id
- end
-
-
- def self.create_table(db, inc, post_fix)
- db.do "CREATE TABLE remote_build_servers (
- id INTEGER PRIMARY KEY #{inc},
- svr_addr VARCHAR(64) NOT NULL UNIQUE,
- description VARCHAR(256),
- status VARCHAR(32),
- supported_os_id INTEGER,
- max_job_count INTEGER,
- working_job_count INTEGER,
- waiting_job_count INTEGER,
- CONSTRAINT fk_remote_build_servers_supported_os1 FOREIGN KEY ( supported_os_id ) REFERENCES supported_os ( id ) )#{post_fix}"
- end
-
-
- def self.load(ip, port, db, parent)
- saddr="#{ip}:#{port}"
- row = db.select_one("SELECT remote_build_servers.*,supported_os.name as host_os_name FROM remote_build_servers, supported_os WHERE svr_addr='#{saddr}' and remote_build_servers.supported_os_id = supported_os.id")
- if not row.nil? then
- return load_row(row, parent)
- end
-
- return nil
- end
-
-
- def self.load_all(db, parent)
- result = []
- db.select_all("SELECT *,'' as host_os_name FROM remote_build_servers WHERE supported_os_id IS NULL
- UNION ALL
- SELECT remote_build_servers.*, supported_os.name as host_os_name FROM remote_build_servers, supported_os WHERE remote_build_servers.supported_os_id = supported_os.id") do |row|
- result.push load_row(row, parent)
- end
-
- return result
- end
-
-
- def self.load_row(row, parent)
- svr_ip,svr_port=row['svr_addr'].strip.split(":")
- new_obj = new(svr_ip, svr_port, row['description'], parent )
- new_obj.set_id( row['id'] )
- new_obj.status = row['status']
- if row['max_job_count'].nil? then
- new_obj.max_working_jobs = 0
- else
- new_obj.max_working_jobs = row['max_job_count'].to_i
- end
- new_obj.working_job_count =row['working_job_count']
- new_obj.waiting_job_count =row['waiting_job_count']
- new_obj.host_os = row['host_os_name']
-
- return new_obj
- end
-
-
- def unload(db)
- db.do("DELETE FROM remote_build_servers WHERE id=#{@id}")
- end
-
-
- def save(db)
- saddr="#{@ip}:#{@port}"
- db.do "INSERT INTO remote_build_servers (svr_addr,description) VALUES ('#{saddr}','#{@description}')"
- end
-end
-
+++ /dev/null
-=begin
-
- RemoteBuilder.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/pkg_server"
-require "utils"
-require "PackageManifest"
-require "log"
-require "FileTransferViaFTP"
-require "FileTransferViaDirect"
-require "BuildServerException.rb"
-
-
-class RemoteBuilder
- attr_accessor :log
-
- # initialize
- def initialize( addr, port ,ftp_addr, ftp_port, ftp_username, ftp_passwd)
- @addr = addr
- @port = port
- @ftp_addr = ftp_addr
- @ftp_port = ftp_port
- @ftp_username = ftp_username
- @ftp_passwd = ftp_passwd
-
- @log = StandardOutLogPrinter.new
- @job = nil
- end
-
-
- def RemoteBuilder.create_from_server(rserver, ftp_addr, ftp_port, ftp_username, ftp_passwd)
-
- return RemoteBuilder.new(rserver.ip, rserver.port, ftp_addr, ftp_port, ftp_username, ftp_passwd)
- end
-
-
- # build_job
- def build_job( job, local_pkgs )
- # set job
- @job = job
- old_log = @log
- @log = job.log
-
- # build
- options = RemoteBuilder.init_options()
- options[:git_repos] = @job.get_project().repository
- options[:git_commit] = @job.git_commit
- options[:src_path] = @job.source_path
- options[:os] = @job.os
- options[:noreverse] = @job.no_reverse
- options[:local_pkgs] = local_pkgs
- options[:dist] = @job.get_project().dist_name
- options[:user] = "admin@user"
- options[:is_rev_build] = @job.is_rev_build_check_job()
- options[:dock] = Utils.create_uniq_name()
- options[:save] = @job.is_rev_build_check_job() ? false : true
- options[:pkgsvr_url] = @job.server.distmgr.get_distribution(options[:dist]).pkgsvr_url
- options[:project_name] = @job.get_project().name
- options[:git_branch] = @job.get_project().branch
- ret = build( options )
-
- # reset job
- @job = nil
- @log = old_log
-
- # return
- return ret
- end
-
-
- # build
- def build( options )
- @log.info( "Start to build on remote server...", Log::LV_USER ) if not @job.nil?
-
- # send local packages if build is invoked from JOB
- if not @job.nil? and not options[:local_pkgs].empty? then
- begin
- @job.add_timestamp("REMOTE_UPLOAD_START")
- @job.get_remote_server().add_file_transfer()
- options[:local_pkgs].each do |pkg_path|
- @log.info( "Sending file... : #{pkg_path}", Log::LV_USER )
- if Utils.is_unix_like_os(Utils::HOST_OS) then
- result = send_file_to_remote2( pkg_path, options[:dock] )
- else
- result = send_file_to_remote( pkg_path, options[:dock] )
- end
- if not result then
- @log.error( "File transfering failed!", Log::LV_USER )
- @job.get_remote_server().remove_file_transfer()
- return false
- end
- end
- ensure
- @job.get_remote_server().remove_file_transfer()
- @job.add_timestamp("REMOTE_UPLOAD_END")
- end
- end
-
- # send build request
- @log.info( "Sending build request to remote server...", Log::LV_USER ) if not @job.nil?
-
- result, job_id, job_error = send_build_request( options )
- if not result then
- @log.error( job_error, Log::LV_USER ) if not job_error.nil?
- @log.error( "Building job request on remote server failed!", Log::LV_USER ) if not @job.nil?
- return false
- end
-
- if options[:async] then return result end
-
- result_files = []
- if Utils.is_unix_like_os(Utils::HOST_OS) then
- result, result_files = send_monitor_request2(job_id, options[:monitor_level])
- else
- result, result_files = send_monitor_request(job_id, options[:monitor_level])
- end
-
- if not result then
- @log.error( "Building job on remote server failed!", Log::LV_USER )
-
- #Cancel remote job
- if not @job.nil? then
- begin
- client = BuildCommClient.create( @addr, @port, @log )
- if not client.nil? then
- client.send "CANCEL|#{@job.remote_id}|#{@job.get_project.passwd}|admin@user"
- client.receive_data()
- client.terminate
- end
- rescue => e
- @log.error(e, Log::LV_USER)
- end
- end
- return false
- end
-
- # receive binary package if not reverse build
- if options[:save] then
- @job.add_timestamp("REMOTE_DOWNLOAD_START") if not @job.nil?
- result_files.each do |file_name|
- @log.info( "Receiving file from remote server : #{file_name}", Log::LV_USER )
- if Utils.is_unix_like_os(Utils::HOST_OS) then
- result = receive_file_from_remote2( "#{options[:src_path]}/#{file_name}", options[:dock] )
- else
- result = receive_file_from_remote( "#{options[:src_path]}/#{file_name}", options[:dock] )
- end
- if not result then
- @log.error( "File transfering failed! : #{file_name}", Log::LV_USER )
- return false
- end
- end
- @job.add_timestamp("REMOTE_DOWNLOAD_END") if not @job.nil?
- end
-
- return true
- end
-
-
- protected
- def RemoteBuilder.init_options()
- options = {}
- options[:projects] = nil
- options[:passwd] = nil
- options[:git_repos] = nil
- options[:git_commit] = nil
- options[:src_path] = nil
- options[:os] = nil
- options[:noreverse] = false
- options[:local_pkgs] = []
- options[:dist] = nil
- options[:user] = nil
- options[:is_rev_build] = false
- options[:rebuild] = false
- options[:save] = false
- options[:async] = false
- options[:monitor_level] = Log::LV_NORMAL
- options[:pkgsvr_url] = nil
- options[:project_name] = nil
- options[:git_branch] = nil
- options[:uselatest] = false
-
- return options
- end
-
-
- # upload binary packages that is need to be overwrite
- # before remote package
- protected
- def send_file_to_remote(file_path, dock = "0")
- # create client
- client = BuildCommClient.create( @addr, @port, @log )
- if client.nil? then
- @log.error( "Creating communication client failed!", Log::LV_USER)
- return false
- end
-
- # upload file
- result = true
- file_name = file_path.split("/")[-1]
- msg = "UPLOAD|#{dock}"
- if client.send( msg ) then
- if not @ftp_addr.nil? then
- transporter=FileTransferFTP.new(@log, @ftp_addr, @ftp_port, @ftp_username, @ftp_passwd)
- else
- transporter=FileTransferDirect.new(@log)
- end
-
- result=client.send_file( file_path, transporter )
- if not result then
- @log.error( "File uploading failed...#{file_name}", Log::LV_USER)
- end
- end
-
- #close connections
- client.terminate
-
- return result
- end
-
-
- protected
- def send_file_to_remote2(file_path, dock = "0")
-
- ruby_path=File.join(Config::CONFIG["bindir"],
- Config::CONFIG["RUBY_INSTALL_NAME"] +
- Config::CONFIG["EXEEXT"])
-
- if @ftp_addr.nil? then
- ftp_addr = "0"
- ftp_port = "0"
- ftp_username = "0"
- ftp_passwd = "0"
- else
- ftp_addr = @ftp_addr
- ftp_port = @ftp_port
- ftp_username = @ftp_username
- ftp_passwd = @ftp_passwd
- end
-
- if @log.path.nil? then
- cmd = "#{ruby_path} \"#{File.expand_path(File.dirname(__FILE__))}/send_file.rb\" #{@addr} #{@port} #{dock} \"#{file_path}\" #{ftp_addr} #{ftp_port} #{ftp_username} #{ftp_passwd}"
- else
- cmd = "#{ruby_path} \"#{File.expand_path(File.dirname(__FILE__))}/send_file.rb\" #{@addr} #{@port} #{dock} \"#{file_path}\" #{ftp_addr} #{ftp_port} #{ftp_username} #{ftp_passwd} \"#{@log.path}\""
- end
-
- cmd = Utils.generate_shell_command( cmd )
- proc1 = IO.popen("#{cmd} 2>&1");
- if @log.path.nil? then
- while line = proc1.gets()
- if line.start_with?("=TRANSFER_END") then
- break
- else
- puts line
- end
- end
- end
-
- status = nil
- begin
- pid, status = Process.waitpid2( proc1.pid )
- rescue Errno::ECHILD
- return false
- end
-
- return ((not status.nil? and status.exitstatus == 0) ? true : false);
- end
-
-
- # send build request
- protected
- def send_build_request( options )
- result = true
- job_id = nil
- job_status = ""
- job_error = nil
-
- begin
- client = BuildCommClient.create( @addr, @port, @log )
- if client.nil? then
- raise BuildServerException.new("ERR018"), "#{@addr}:#{@port}"
- end
-
- if not options[:git_repos].nil? then
- commit = options[:git_commit].nil? ? "" : options[:git_commit]
- pkg_list = options[:local_pkgs].map { |path| File.basename(path) }.join(",")
- # format: BUILD|GIT|repository|passwd|os|async|
- # no_reverse|dist_name|
- # user_email|rebuild|internal|rev-build|
- # commit|pkgs|dock_num|pkgsvr_url|project_name|git_branch
- msg = "BUILD|GIT|#{options[:git_repos]}||#{options[:os]}|NO|"+
- "#{options[:noreverse] ? "YES" : "NO"}|#{options[:dist]}|"+
- "#{options[:user]}|NO|YES|#{options[:is_rev_build] ? "YES":"NO"}|"+
- "#{commit}|#{pkg_list}|#{options[:dock]}|#{options[:pkgsvr_url]}|"+
- "#{options[:project_name]}|#{options[:git_branch]}"
- else
- # format: BUILD|GIT|project_list|passwd|os|async|
- # no_reverse|dist_name|
- # user_email|rebuild|internal|rev-build|
- # commit|pkgs|dock_num|pkgsvr_url|project_name|git_branch|latestCommit
- msg = "BUILD|GIT|#{options[:projects]}|#{options[:passwd]}|"+
- "#{options[:os]}|"+
- "#{options[:async] ? "YES" : "NO"}|"+
- "#{options[:noreverse] ? "YES" : "NO"}|#{options[:dist]}|"+
- "#{options[:user]}|#{options[:rebuild] ? "YES" : "NO"}|"+
- "NO||||#{options[:dock].nil? ? "" : options[:dock]}||||#{options[:uselatest] ? "YES" : "NO"}"
- end
-
- if not client.send( msg ) then
- raise BuildServerException.new("ERR020"), "#{client.get_error_msg()}"
- end
-
- result = client.read_lines do |line|
- if line.strip.start_with?("=JOB_START") then
- job_id = line.strip.split(",")[1]
- elsif line.strip.start_with?("=JOB_STATUS") then
- data = line.strip.split(",")
- job_status = data[1]
- job_error = data[2]
- else
- @log.output( line.strip, Log::LV_USER)
- end
- end
-
- if not result then
- raise BuildServerException.new("ERR019"), "#{client.get_error_msg()}"
- end
- if job_id.nil? then
- result = false
- end
-
- @job.remote_id = job_id if not @job.nil?
- @job.remote_status = job_status if not @job.nil?
- @job.remote_error_msg = job_error if not @job.nil?
- rescue BuildServerException => e
- @log.error( e.err_message(""), Log::LV_USER )
- result = false
- rescue => e
- @log.error( "#{e.message()}", Log::LV_USER )
- result = false
- ensure
- client.terminate if not client.nil?
- end
-
- return result, job_id, job_error
- end
-
-
- # send monitor request
- protected
- def send_monitor_request(job_id, min_level)
- result_files = []
- result = true
- job_status = "JUST_CREATED"
-
- begin
- result = JobLog.monitor(@addr, @port, job_id) do |line,status,errmsg|
- job_status = status
- @job.remote_status = status if not @job.nil?
- @job.remote_error_msg = errmsg if not @job.nil?
- if line.nil? then
- next
- end
- if line.strip.start_with?("=JOB_FILE") then
- result_files.push( line.strip.split(",")[1] )
- end
-
- category, level, contents = JobLog.parse_log(line)
- if level < min_level then next end
- if category == "INFO" then
- @log.info( contents, level )
- elsif category == "WARN" then
- @log.warn( contents, level )
- elsif category == "ERROR" then
- @log.error( contents, level )
- else
- next
- end
- end
-
- rescue BuildServerException => e
- @log.error( e.err_message(""), Log::LV_USER )
- result = false
- rescue => e
- @log.error( "#{e.message()}", Log::LV_USER )
- result = false
- end
-
- if job_status != "FINISHED" then
- if not @job.nil? then
- @log.error( "Remote job is finished with \"#{@job.remote_status}\"! #{@job.remote_error_msg}", Log::LV_USER)
- end
- result = false
- end
-
- return result, result_files
- end
-
-
- protected
- def send_monitor_request2(job_id, min_level)
- result_files = []
- result = true
- job_status = "JUST_CREATED"
- job_errmsg = ""
-
- ruby_path=File.join(Config::CONFIG["bindir"],
- Config::CONFIG["RUBY_INSTALL_NAME"] +
- Config::CONFIG["EXEEXT"])
-
- if @log.path.nil? then
- cmd = "#{ruby_path} \"#{File.expand_path(File.dirname(__FILE__))}/monitor_log.rb\" #{@addr} #{@port} #{job_id} #{min_level}"
- else
- cmd = "#{ruby_path} \"#{File.expand_path(File.dirname(__FILE__))}/monitor_log.rb\" #{@addr} #{@port} #{job_id} #{min_level} \"#{@log.path}\""
- end
- cmd = Utils.generate_shell_command( cmd )
- IO.popen("#{cmd} 2>&1") do |io|
- if @log.path.nil? then
- io.each do |l|
- if l.start_with?("=LOG_END") then
- break
- else
- puts l
- end
- end
- end
- result, job_status, job_errmsg, result_files = Marshal.load(io.read)
- end
- if job_status != "FINISHED" then
- if not @job.nil? then
- @log.error( "Remote job is finished with \"#{job_status}\"! #{job_errmsg}", Log::LV_USER)
- end
- result = false
- end
-
- return result, result_files
- end
-
-
- # receive binary package of remote server
- protected
- def receive_file_from_remote(file_path, dock = "0")
- # create client
- client = BuildCommClient.create( @addr, @port, @log )
- if client.nil? then
- @log.error( "Creating communication client failed!", Log::LV_USER)
- return false
- end
-
- # download file
- result = true
- file_name = file_path.split("/")[-1]
- msg = "DOWNLOAD|#{dock}|#{file_name}"
- if client.send( msg ) then
- if not @ftp_addr.nil? then
- transporter=FileTransferFTP.new(@log, @ftp_addr, @ftp_port, @ftp_username, @ftp_passwd)
- else
- transporter=FileTransferDirect.new(@log)
- end
- result=client.receive_file(file_path, transporter)
- if not result then
- @log.error( "File downloading failed...#{file_name}", Log::LV_USER)
- end
- end
-
- #close connections
- client.terminate
-
- return result
- end
-
-
- protected
- def receive_file_from_remote2(file_path, dock = "0")
- result = true
-
- ruby_path=File.join(Config::CONFIG["bindir"],
- Config::CONFIG["RUBY_INSTALL_NAME"] +
- Config::CONFIG["EXEEXT"])
-
- if @ftp_addr.nil? then
- ftp_addr = "0"
- ftp_port = "0"
- ftp_username = "0"
- ftp_passwd = "0"
- else
- ftp_addr = @ftp_addr
- ftp_port = @ftp_port
- ftp_username = @ftp_username
- ftp_passwd = @ftp_passwd
- end
-
- if @log.path.nil? then
- cmd = "#{ruby_path} \"#{File.expand_path(File.dirname(__FILE__))}/receive_file.rb\" #{@addr} #{@port} #{dock} \"#{file_path}\" #{ftp_addr} #{ftp_port} #{ftp_username} #{ftp_passwd}"
- else
- cmd = "#{ruby_path} \"#{File.expand_path(File.dirname(__FILE__))}/receive_file.rb\" #{@addr} #{@port} #{dock} \"#{file_path}\" #{ftp_addr} #{ftp_port} #{ftp_username} #{ftp_passwd} \"#{@log.path}\""
- end
- cmd = Utils.generate_shell_command( cmd )
- proc1 = IO.popen("#{cmd} 2>&1");
- if @log.path.nil? then
- while line = proc1.gets()
- if line.start_with?("=TRANSFER_END") then
- break
- else
- puts line
- end
- end
- end
-
- status = nil
- begin
- pid, status = Process.waitpid2( proc1.pid )
- rescue Errno::ECHILD
- return false
- end
-
- return ((not status.nil? and status.exitstatus == 0) ? true : false);
- end
-end
+++ /dev/null
-=begin
-
- ReverseBuildChecker.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "log"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/pkg_server"
-require "utils.rb"
-require "client.rb"
-require "PackageManifest.rb"
-
-class ReverseBuildChecker
-
- # check
- def ReverseBuildChecker.check( job, exit_on_error, override_os = nil )
- log = job.log
- job_os = (override_os.nil?) ? job.os : override_os
-
- # start
- log.info( "Checking reverse build dependency ...", Log::LV_USER)
-
- # get target packages that be checked
- bin_pkg_name_list = []
- src_pkg_name_list = []
- case job.type
- when "BUILD"
- job.pkginfo.get_target_packages(job_os).each do |pkg|
- bin_pkg_name_list.push pkg.package_name
- end
- when "REGISTER"
- if job.pkg_type == "BINARY" then
- bin_pkg_name_list.push job.pkg_name
- else
- src_pkg_name_list.push job.pkg_name
- end
- end
-
- # get reverse projects from build dependency
- rev_pkgs = []
- bin_pkg_name_list.each do |pkg_name|
- rev_pkgs += job.pkgsvr_client.get_reverse_build_dependent_packages(pkg_name, job_os)
- end
- src_pkg_name_list.each do |pkg_name|
- rev_pkgs += job.pkgsvr_client.get_reverse_source_dependent_packages(pkg_name)
- end
- rev_pkgs.uniq!
- rev_projects = job.server.prjmgr.get_projects_from_pkgs(rev_pkgs, job.get_distribution_name())
-
- # create reverse build job
- rev_build_jobs = []
- rev_projects.each do |p|
- rev_prj = p[0]
- rev_os = p[1]
- rev_ver = p[2]
-
- # if not "GIT" project, ignore it
- if rev_prj.type != "GIT" then next end
- found = false
-
- # if this is sub job, all other sibling job must be excluded
- if job.is_sub_job? then
- job.get_parent_job().get_sub_jobs().each do |sub_job|
- sub_prj = sub_job.get_project()
- sub_os = sub_job.os
- if rev_prj == sub_prj and rev_os == sub_os then
- found = true
- break
- end
- end
- if found then next end
- end
-
- # create job
- new_job = rev_prj.create_new_job_from_version( rev_os, rev_ver )
- new_job.set_rev_build_check_job( job )
-
- # set user id
- new_job.user_id = job.user_id
-
- # commit to DB
- job.server.jobmgr.commit_job(new_job)
-
- rev_build_jobs.push new_job
- end
-
- # reverse build
- if rev_build_jobs.count > 0 then
- rev_prjs_msg = rev_build_jobs.map {|j| "#{j.get_project().name}(#{j.os})"}.join(", ")
- log.info( " * Will check reverse-build for projects: #{rev_prjs_msg}", Log::LV_USER)
- end
-
- # for all reverse job
- rev_build_jobs.each do |rev_job|
- # add to job manager
- job.server.jobmgr.add_reverse_build_job(rev_job)
- log.info( " * Added new job for reverse-build ... #{rev_job.get_project().name}(#{rev_job.os}) (#{rev_job.id})", Log::LV_USER)
- end
-
- # wait for job finish
- rev_build_finished = false
- success_list = []
- failure_list = []
- cancel_other_jobs = false
- while not rev_build_finished
-
- job.check_event
-
- rev_build_finished = true
- rev_build_jobs.each do |rev_job|
- rev_prj = rev_job.get_project()
- rev_os = rev_job.os
-
- case rev_job.status
- when "ERROR", "CANCELED"
- # add fail list
- if not is_project_included?(failure_list, rev_prj, rev_os) then
- log.info( " * Reverse-build FAIL ... #{rev_prj.name}(#{rev_os}) (#{rev_job.id})", Log::LV_USER)
- failure_list.push [ rev_prj, rev_os ]
- end
-
- # if "exist on error" cancel all other jobs
- if exit_on_error then
- cancel_other_jobs = true
- rev_build_jobs.each do |j|
- if j.status != "ERROR" and j.status != "FINISHED" and
- j.status != "CANCELED" and j.event == "NONE" then
-
- j.event = "CANCEL"
- end
- end
- break
- end
- when "FINISHED"
- # add success list
- if not success_list.include? rev_job then
- log.info( " * Reverse-build OK ... #{rev_prj.name}(#{rev_os}) (#{rev_job.id})", Log::LV_USER)
- success_list.push rev_job
- end
- else
- rev_build_finished = false
- end
- end
-
- sleep 1
- end
-
- # clean up all reverse build jobs
- rev_build_jobs.each do |rev_job|
- if rev_job.status == "ERROR" or rev_job.status == "CANCELED" then
- rev_job.server.cleaner.clean_afterwards(rev_job.id)
- else
- rev_job.server.cleaner.clean(rev_job.id)
- end
- end
-
- return failure_list
- end
-
-
- private
- def self.is_project_included?( prj_list, prj, os )
- prj_list.each do |p|
- if p[0] == prj and p[1] == os then return true end
- end
-
- return false
- end
-end
+++ /dev/null
-=begin
-
- SocketJobRequestListener.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "BuildComm.rb"
-require "BuildServerException.rb"
-require 'timeout'
-
-class SocketJobRequestListener
-
- # initialize
- def initialize (parent)
- @parent_server = parent
- @thread = nil
- @finish_loop = false
- @comm_server = nil
- @log = @parent_server.log
- end
-
- # start listening
- def start()
- @thread = Thread.new do
- # make loop recover when unhandled exception occurred
- while not @finish_loop
- begin
- main()
- rescue => e
- @log.error e.message
- @log.error e.backtrace.inspect
- end
- end
- end
- end
-
-
-
- # quit listening
- def stop_listening()
- @finish_loop = true
- end
-
- private
-
- # thread main
- def main()
- # server open
- begin
- if not @parent_server.ftp_addr.nil? then
- ftp_url = Utils.generate_ftp_url(@parent_server.ftp_addr, @parent_server.ftp_port,
- @parent_server.ftp_username, @parent_server.ftp_passwd)
- else
- ftp_url = nil
- end
- cache_dir = "#{@parent_server.transport_path}/.cache"
- @comm_server = BuildCommServer.create(@parent_server.port, @log, ftp_url, cache_dir)
- rescue
- @log.info "Server creation failed"
- puts "Server creation failed"
- @parent_server.stop
- return
- end
-
- # loop
- @log.info "Entering Control Listening Loop ... "
- @finish_loop = false
- @comm_server.wait_for_connection(@finish_loop) do |req|
- handle_job_request( req )
- end
-
- # quit
- @comm_server.terminate
- end
-
-
- # wait for job requests
- def wait_for_job_requests
- req_list = []
- req_list.push @tcp_server.accept
-
- return req_list
- end
-
-
- # handle job request
- def handle_job_request( req )
-
- # read request
- req_line = nil
- begin
- # Maximum response time from client is 10 sec
- Timeout::timeout( 10 ) do
- req_line = req.gets()
- end
- rescue Timeout::Error
- req_line = nil
- end
- if req_line.nil? then return end
-
- # accept
- BuildCommServer.send_begin(req)
-
- # parse request
- cmd = ""
- if req_line.split("|").count > 0 then
- cmd = req_line.split("|")[0].strip
- end
-
- case cmd
- when "BUILD"
- handle_cmd_build( req_line, req )
- when "QUERY"
- handle_cmd_query( req_line, req )
- when "SET"
- handle_cmd_set( req_line,req )
- when "CANCEL"
- handle_cmd_cancel( req_line, req )
- when "STOP"
- handle_cmd_stop( req_line, req )
- when "UPGRADE"
- handle_cmd_upgrade( req_line, req )
- when "REGISTER"
- handle_cmd_register( req_line, req )
- when "MONITOR"
- handle_cmd_monitor( req_line, req )
- when "LOG"
- handle_cmd_log( req_line, req )
- when "DOWNLOAD"
- Thread.new do
- begin
- handle_cmd_download( req_line, req )
- rescue => e
- @log.error "Transfering file failed!"
- @log.error e.message
- @log.error e.backtrace.inspect
- end
- end
- when "UPLOAD"
- Thread.new do
- begin
- handle_cmd_upload( req_line, req )
- rescue => e
- @log.error "Transfering file failed!"
- @log.error e.message
- @log.error e.backtrace.inspect
- end
- end
- else
- @log.info "Received Unknown REQ: #{req_line}"
- raise "Unknown request: #{req_line}"
- end
-
- end
-
-
- # "BUILD"
- def handle_cmd_build( line, req )
- @log.info "Received REQ: #{line}"
-
- begin
- handle_cmd_build_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, "=JOB_STATUS,ERROR,#{e.err_message()}")
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
- @log.info "Handled REQ: #{line}"
- end
-
-
- def handle_cmd_build_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 3 then
- raise BuildServerException.new("ERR001"), line
- end
-
- # check type
- if tok[1] != "GIT" then
- raise BuildServerException.new("ERR001"), line
- end
-
- # 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18
- # Case1. BUILD|GIT|project_name|passwd|os_list|async|no_reverse|dist_name|user_email|rebuild| | | | |dock_num| | | |latestCommit
- # Case2. BUILD|GIT|git_repos | |os |async|no_reverse|dist_name|user_email|rebuild|internal|rev_build|commit|pkgs|dock_num|pkgsvr_url|project_name|git_branch
-
- # parse
- project_name_list = tok[2].split(",")
- passwd = tok[3]
- os_list = tok[4].split(",")
- async = tok[5].eql? "YES"
- no_reverse = tok[6].eql? "YES"
- dist_name = (not tok[7].nil? and not tok[7].empty?) ? tok[7].strip : ""
- user_email = (not tok[8].nil? and not tok[8].empty?) ? tok[8].strip : ""
- rebuild = tok[9].eql? "YES"
- is_internal = tok[10].eql? "YES"
- rev_job = tok[11].eql? "YES"
- git_commit = (not tok[12].nil? and not tok[12].empty?) ? tok[12] : nil
- pkg_files = (not tok[13].nil? and not tok[13].empty?) ? tok[13].split(",") : []
- dock_num = (not tok[14].nil? and not tok[14].empty?) ? tok[14].strip : "0"
- pkgsvr_url = (not tok[15].nil? and not tok[15].empty?) ? tok[15].strip : nil
- project_name = (not tok[16].nil? and not tok[16].empty?) ? tok[16].strip : nil
- git_branch = (not tok[17].nil? and not tok[17].empty?) ? tok[17].strip : nil
- uselatest = tok[18].eql? "YES"
- if (dist_name.nil? or dist_name.empty?) then
- dist_name = @parent_server.distmgr.get_default_distribution_name()
- end
-
- # check distribution
- if not is_internal then
- check_distribution(dist_name, req)
- end
-
- # check supported os if not internal job
- if not is_internal then
- os_list = check_supported_os( os_list , req )
- end
-
- # check user email
- if not is_internal then
- user_id = @parent_server.check_user_id_from_email( user_email )
- if user_id == -1 then
- raise BuildServerException.new("ERR004"), user_email
- end
- end
-
- # check user psssword
- if not is_internal and not @parent_server.check_user_password(user_id, passwd) then
- raise BuildServerException.new("ERR011"), "Email : #{user_email} && Password : #{passwd}"
- end
-
-
- # multi build job
- if project_name_list.count > 1 or os_list.count > 1 then
- new_job_list = []
- i = 0
- project_name_list.each do |pname|
- check_build_project(pname,dist_name,req)
- if not check_project_user_id(pname,dist_name,user_id) then
- raise BuildServerException.new("ERR005"), "#{user_email} -> #{pname}"
- end
- os_list.each do |os|
- new_job = create_new_job( pname, os, dist_name )
- if new_job.nil? then
- @log.warn "\"#{pname}\" does not support #{os}"
- next
- else
- new_job.user_id = user_id
- if uselatest then
- commitId = get_latest_commit(pname, dist_name)
- if commitId.nil? then
- raise BuildServerException.new("ERR025"), pname
- else
- new_job.git_commit = commitId
- end
- end
- end
- new_job_list.push new_job
- @log.info "Received a request for building this project : #{pname}, #{os}"
- end
- i = i + 1
- end
-
- if new_job_list.count > 1 then
- new_job = @parent_server.prjmgr.create_new_multi_build_job( new_job_list )
- if new_job.nil? then
- raise BuildServerException.new("ERR006"),"Multi-Build job"
- else
- new_job.user_id = user_id
- end
- elsif new_job_list.count == 1 then
- new_job = new_job_list[0]
- else
- raise BuildServerException.new("ERR006"),"No valid sub jobs in Multi-Build job"
- end
-
- # transferred job
- elsif is_internal then
- git_repos = project_name_list[0]
- os = os_list[0]
-
- new_job = create_new_transferred_job(git_repos, os, git_commit, pkg_files, dock_num, dist_name, pkgsvr_url, project_name, git_branch )
- if new_job.nil? then
- raise BuildServerException.new("ERR006"),"Transfered-Build job"
- else
- new_job.user_id = user_id
- end
- if rev_job then new_job.set_rev_build_check_job(nil) end
-
- # single job
- elsif project_name_list.count == 1 and os_list.count == 1 then
- pname = project_name_list[0]
- os = os_list[0]
-
- check_build_project(pname,dist_name,req)
- if not check_project_user_id(pname,dist_name,user_id) then
- raise BuildServerException.new("ERR005"), "#{user_email} -> #{pname}"
- end
- new_job = create_new_job( pname, os, dist_name )
- if new_job.nil? then
- raise BuildServerException.new("ERR006"), "\"#{pname}\" does not support #{os} in #{dist_name}"
- else
- new_job.user_id = user_id
- if uselatest then
- commitId = get_latest_commit(pname, dist_name)
- if commitId.nil? then
- raise BuildServerException.new("ERR025"), pname
- else
- new_job.git_commit = commitId
- end
- end
- end
- else
- raise BuildServerException.new("ERR006"), "Cannot find your project to build!"
- end
-
- # check reverse build
- if no_reverse then new_job.set_no_reverse end
-
- # set force rebuild if needed
- if rebuild then new_job.set_force_rebuild(true) end
-
- # set send result back
- if dock_num != "0" and not is_internal then
- new_job.set_send_result_back( dock_num )
- end
-
- @parent_server.jobmgr.commit_job(new_job)
-
- # create logger and disconnect client
- logger = new_job.create_logger(false)
- BuildCommServer.send(req, "=JOB_START,#{new_job.id}")
- logger.info("Added new job \"#{new_job.id}\" for #{new_job.os}!", Log::LV_USER)
- if not @parent_server.job_log_url.empty? then
- logger.info(" * Log URL : #{@parent_server.job_log_url}/#{new_job.id}/log", Log::LV_USER)
- end
-
- if async then
- BuildCommServer.send(req,"Info: Added new job \"#{new_job.id}\" for #{new_job.os}!")
- BuildCommServer.send(req,"Info: Above job(s) will be processed asynchronously!")
- end
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
-
- # add to job queue
- if new_job.is_rev_build_check_job() then
- @parent_server.jobmgr.add_reverse_build_job( new_job )
- else
- @parent_server.jobmgr.add_job( new_job )
- end
- end
-
-
- def check_build_project(prj_name, dist_name, req)
- # check project
- prj = check_project_exist(prj_name, dist_name, req)
-
- # check project status
- if prj.status != "OPEN" then
- raise BuildServerException.new("ERR017"), "#{prj_name} on #{dist_name}. project is [[#{prj.status}]]"
- end
-
- # check project type
- if prj.type == "BINARY" then
- raise BuildServerException.new("ERR010"), prj.type
- end
- end
-
-
- # "QUERY"
- def handle_cmd_query( line, req )
- begin
- handle_cmd_query_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, e.err_message())
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
- end
-
-
- def handle_cmd_query_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 2 then
- raise BuildServerException.new("ERR001"), line
- end
-
- case tok[1]
-
- # QUERY, FTP
- when "FTP"
- if not @parent_server.ftp_addr.nil? then
- BuildCommServer.send(req,"#{@parent_server.ftp_addr},#{@parent_server.ftp_username},#{@parent_server.ftp_passwd}")
- else
- BuildCommServer.send(req,"NONE,NONE,NONE")
- end
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
-
- # QUERY,JOB
- when "JOB"
- #puts "Received QUERY JOB"
-
- # gather all jobs to show
- job_list = @parent_server.jobmgr.jobs + @parent_server.jobmgr.internal_jobs + @parent_server.jobmgr.reverse_build_jobs
-
- # send the status
- job_list.each do |job|
- status = job.status
- if status == "REMOTE_WORKING" then status = "REMOTE" end
- if job.event != "NONE" then status = "CANCEL" end
-
- case job.type
- when "BUILD"
- BuildCommServer.send(req,"#{status},#{job.id},#{job.get_project().name},#{job.os} #{job.progress},#{job.get_distribution_name}")
- when "REGISTER"
- if job.pkg_type == "BINARY" and not job.get_project().nil? then
- BuildCommServer.send(req,"#{status},#{job.id},#{job.get_project().name},#{job.os} #{job.progress},#{job.get_distribution_name}")
- else
- BuildCommServer.send(req,"#{status},#{job.id},#{job.pkg_name},#{job.get_distribution_name}")
- end
- when "MULTIBUILD"
- BuildCommServer.send(req,"#{status},#{job.id},MULTI-BUILD : #{job.get_sub_jobs().map{|x| x.id}.join(" ")},#{job.get_distribution_name}")
- end
- end
-
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
-
- # QUERY,SYSTEM
- when "SYSTEM"
- #puts "Received QUERY SYSTEM"
-
- BuildCommServer.send(req,"#{@parent_server.host_os},#{@parent_server.jobmgr.max_working_jobs}")
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- when "PROJECT"
- # print GIT projects
- sorted_list = @parent_server.prjmgr.get_all_projects_summary().sort { |x,y| x['name'] <=> y['name'] }
- sorted_list.select{|x| x['ptype'] == "GIT"}.each do |prj|
- BuildCommServer.send(req,"G,#{prj['name']},#{prj['dist_name']}")
- end
- # print BINARY projects
- sorted_list.select{|x| x['ptype'] == "BINARY"}.each do |prj|
- BuildCommServer.send(req,"B,#{prj['name']},#{prj['dist_name']}")
- end
- # print REMOTE project
- sorted_list.select{|x| x['ptype'] == "REMOTE"}.each do |prj|
- BuildCommServer.send(req,"R,#{prj['name']},#{prj['dist_name']}")
- end
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
-
- when "OS"
- # print GIT projects
- @parent_server.supported_os_list.each do |os_name|
- BuildCommServer.send(req,"#{os_name}")
- end
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
-
- when "FRIEND"
- # print GIT projects
- @parent_server.remote_servers.each do |server|
- BuildCommServer.send(req,"#{server.status},#{server.host_os},#{server.waiting_jobs.count},#{server.working_jobs.count},#{server.max_working_jobs},#{server.get_file_transfer_cnt}")
- end
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
-
- else
- raise BuildServerException.new("ERR001"), line
- end
- end
-
- # "SET"
- def handle_cmd_set( line, req )
- begin
- handle_cmd_set_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, e.err_message())
- ensure
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
- end
-
- def handle_cmd_set_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 3 then
- raise BuildServerException.new("ERR001"), line
- end
- attr = tok[1]
- value = tok[2]
- case tok[1]
- when "MAX_WORKING_JOBS"
- BuildCommServer.send(req, "OK")
- @parent_server.jobmgr.max_working_jobs = value.to_i
- else
- raise BuildServerException.new("ERR024"), line
- end
- end
-
- # "CANCEL"
- def handle_cmd_cancel( line, req )
- @log.info "Received REQ: #{line}"
-
- begin
- handle_cmd_cancel_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, e.err_message())
- rescue => e
- @log.error(e.message)
- BuildCommServer.send(req, e.err_message())
- ensure
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
- @log.info "Handled REQ: #{line}"
- end
-
-
- def handle_cmd_cancel_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 4 then
- raise BuildServerException.new("ERR001"), line
- end
- cancel_job = nil
-
- job_number = tok[1]
- user_password = tok[2]
- user_email = tok[3]
-
- #CANCEL, JOB
- (@parent_server.jobmgr.jobs + @parent_server.jobmgr.internal_jobs + @parent_server.jobmgr.reverse_build_jobs).each do |j|
- if "#{j.id}" == "#{job_number}" then
- cancel_job = j
- break
- end
- end
-
- if cancel_job.nil? then
- raise BuildServerException.new("ERR014"), "Job #{job_number} not found."
- end
-
- if cancel_job.event != "NONE" then
- raise BuildServerException.new("ERR014"), "Job already canceled."
- end
-
- if not cancel_job.is_transferred? then
- # check user email
- user_id = @parent_server.check_user_id_from_email(user_email)
- if user_id == -1 then
- raise BuildServerException.new("ERR004"), user_email
- end
-
- # check user psssword
- if not @parent_server.check_user_password(user_id, user_password) then
- raise BuildServerException.new("ERR011"), "Email : #{user_email} && Password : #{passwd}"
- end
-
- # check project accessable
- if not @parent_server.jobmgr.is_user_accessable(cancel_job,user_id) then
- raise BuildServerException.new("ERR014"), "Access denied #{user_email}"
- end
- end
-
- if cancel_job.type == "MULTIBUILD" then
- sub_projects = cancel_job.get_sub_jobs().map{|sub| sub.get_project }
- BuildCommServer.send(req, "\"#{cancel_job.id}, #{cancel_job.get_sub_jobs().map{|x| x.id}.join(", ")}\" will be canceled")
-
- else
- prj = cancel_job.get_project()
- if prj.nil? then
- raise BuildServerException.new("ERR014"), "No project infomation"
- end
-
- BuildCommServer.send(req, "\"#{cancel_job.id}\" will be canceled")
- end
-
- cancel_job.lock_event do
- cancel_job.event = "CANCEL"
- end
- end
-
-
- # "STOP"
- def handle_cmd_stop( line, req )
- @log.info "Received REQ: #{line}"
-
- begin
- handle_cmd_stop_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, e.err_message())
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
- @log.info "Handled REQ: #{line}"
- end
-
-
- def handle_cmd_stop_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 2 then
- raise BuildServerException.new("ERR001"), line
- end
-
- if tok[1] != @parent_server.password then
- raise BuildServerException.new("ERR015"), ""
- else
- BuildCommServer.send(req,"Server will be down!")
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
- if tok[1] == @parent_server.password then
- @parent_server.finish = true
- end
- end
-
-
- # "UPGRADE"
- def handle_cmd_upgrade( line, req )
- @log.info "Received REQ: #{line}"
-
- begin
- handle_cmd_upgrade_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, e.err_message())
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
- @log.info "Handled REQ: #{line}"
- end
-
-
- def handle_cmd_upgrade_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 3 then
- raise BuildServerException.new("ERR001"), line
- end
- password = tok[1]
- pkgsvr_url = tok[2]
-
- # write package server url
- File.open("#{BuildServer::CONFIG_ROOT}/#{@parent_server.id}/upgrade_dist","w") do |f|
- f.puts pkgsvr_url
- end
-
- if password != @parent_server.password then
- raise BuildServerException.new("ERR015"), ""
- else
- BuildCommServer.send(req,"Server will be upgraded!")
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
- # set flag for quit message loop
- @parent_server.finish = true
- @parent_server.upgrade = true
- end
-
-
- # "REGISTER"
- def handle_cmd_register( line, req )
- @log.info "Received REQ: #{line}"
-
- Thread.new do
- begin
- handle_cmd_register_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, "=JOB_STATUS,ERROR,#{e.err_message()}")
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- rescue => e
- @log.error "Transfering file failed!"
- @log.error e.message
- @log.error e.backtrace.inspect
- end
- end
-
-
- @log.info "Handled REQ: #{line}"
- end
-
-
- def handle_cmd_register_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 4 then
- raise BuildServerException.new("ERR001"), line
- end
-
- type = tok[1]
-
- case type
- # REGISTER|BINARY-LOCAL|local_path|passwd|dist_name
- # REGISTER|SOURCE-LOCAL|local_path|passwd|dist_name
- when "BINARY-LOCAL", "SOURCE-LOCAL"
- file_path = tok[2]
- dist_name = tok[4]
- if (dist_name.nil? or dist_name.empty?) then
- dist_name = @parent_server.distmgr.get_default_distribution_name()
- end
-
- # check distribution
- check_distribution(dist_name, req)
-
- # check project
- file_name = File.basename(file_path)
- prj = check_project_for_package_file_name(file_name, dist_name, req)
- # check project status
- if prj.status != "OPEN" then
- raise BuildServerException.new("ERR017"), "#{prj.name} on #{dist_name}. project is [[#{prj.status}]]"
- end
-
- new_job = @parent_server.jobmgr.create_new_register_job( file_path, dist_name )
-
- @parent_server.jobmgr.commit_job(new_job)
- logger = new_job.create_logger()
-
- # notify that job has been received
- BuildCommServer.send(req, "=JOB_START,#{new_job.id}")
- logger.info( "Added new job \"#{new_job.id}\" for #{new_job.os}!", Log::LV_USER)
- if not @parent_server.job_log_url.empty? then
- logger.info( " * Log URL : #{@parent_server.job_log_url}/#{new_job.id}/log", Log::LV_USER)
- end
-
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
-
- # add
- @parent_server.jobmgr.add_job( new_job )
-
- # REGISTER|BINARY|filename|passwd|dock|dist_name|user_email|no_reverse
- when "BINARY"
- # parse
- filename = tok[2]
- passwd = tok[3]
- dock = (tok[4].nil? or tok[4].empty?) ? "0" : tok[4].strip
- dist_name = tok[5]
- user_email = (tok[7].nil? or tok[7].empty?) ? "" : tok[6].strip
- no_reverse = tok[7].eql? "YES"
-
- if (dist_name.nil? or dist_name.empty?) then
- dist_name = @parent_server.distmgr.get_default_distribution_name()
- end
-
- # check distribution
- check_distribution(dist_name, req)
-
- # check project
- prj = check_project_for_package_file_name(filename, dist_name, req)
-
- # check project status
- if prj.status != "OPEN" then
- raise BuildServerException.new("ERR017"), "#{prj.name} on #{dist_name}. project is [[#{prj.status}]]"
- end
-
- # check user email
- user_id = @parent_server.check_user_id_from_email( user_email )
- if user_id == -1 then
- raise BuildServerException.new("ERR004"), user_email
- end
-
- # check user psssword
- if not @parent_server.check_user_password(user_id, passwd) then
- raise BuildServerException.new("ERR011"), "Email : #{user_email} && Password : #{passwd}"
- end
-
- if not check_project_pkg_name_user_id(filename, dist_name, user_id) then
- raise BuildServerException.new("ERR005"), "#{user_email} -> #{prj.name}"
- end
-
- # save thread and wait uplaod
- BuildCommServer.send(req, "WAITFORUPLOAD")
- req_line = req.gets
- if req_line.nil? or not req_line.strip.eql?("REGISTERCONTINUE") then
- raise BuildServerException.new("ERR016"), req_line
- else
- @log.info "register file is received successfully"
- end
-
- # create new job
- @log.info "Received a request for uploading binaries : #{filename}"
- new_job = create_new_upload_job( prj.name, filename, dock, dist_name )
- if new_job.nil? then
- raise BuildServerException.new("ERR006"), "Register-job #{filename}, #{prj.name}, #{dist_name}"
- end
-
- new_job.user_id = user_id
-
- # check reverse build
- if no_reverse then new_job.set_no_reverse end
-
- @parent_server.jobmgr.commit_job(new_job)
-
- # create logger and set
- logger = new_job.create_logger()
-
- # notify that job has been received
- BuildCommServer.send(req, "=JOB_START,#{new_job.id}")
- logger.info( "Added new job \"#{new_job.id}\" for #{new_job.os}!", Log::LV_USER)
- if not @parent_server.job_log_url.empty? then
- logger.info( " * Log URL : #{@parent_server.job_log_url}/#{new_job.id}/log", Log::LV_USER)
- end
-
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
-
- # add
- @parent_server.jobmgr.add_job( new_job )
- else
- raise BuildServerException.new("ERR001"), line
- end
-
- end
-
-
- # "MONITOR"
- def handle_cmd_monitor( line, req )
- @log.info "Received REQ: #{line}"
-
- begin
- handle_cmd_monitor_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, e.err_message())
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
- @log.info "Handled REQ: #{line}"
- end
-
-
- # "LOG"
- def handle_cmd_log( line, req )
- @log.info "Received REQ: #{line.strip}"
-
- begin
- handle_cmd_log_internal( line, req )
- rescue BuildServerException => e
- @log.error(e.message)
- BuildCommServer.send(req, e.err_message())
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
- @log.info "Handled REQ: #{line.strip}"
- end
-
-
- def handle_cmd_monitor_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 2 then
- raise BuildServerException.new("ERR001"), line
- end
-
- case tok[1]
- # MONITOR,SYSTEM
- when "SYSTEM"
- @parent_server.accept_system_monitor(req)
- else
- raise BuildServerException.new("ERR001"), line
- end
- end
-
-
- def handle_cmd_log_internal( line, req )
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 2 then
- raise BuildServerException.new("ERR001"), line
- end
-
- job_number = tok[1]
- @parent_server.query_job_log(job_number, req)
- end
-
-
- # "UPLOAD"
- def handle_cmd_upload( line, req )
- @log.info "Received File transfer REQ : #{line}"
-
- tok = line.split("|").map { |x| x.strip }
- dock_num = (tok[1].nil? or tok[1].empty?) ? "0" : tok[1].strip
-
- incoming_dir = "#{@parent_server.transport_path}/#{dock_num}"
- if not File.exist? incoming_dir then FileUtils.mkdir_p incoming_dir end
- @comm_server.receive_file( req, incoming_dir )
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
-
- # "DOWNLOAD"
- # format = DOWNLOAD|dock_num|file_name
- def handle_cmd_download( line, req )
- @log.info "Received File transfer REQ : #{line}"
- tok = line.split("|").map { |x| x.strip }
- dock_num = (tok[1].nil? or tok[1].empty?) ? "0" : tok[1].strip
- file_name = tok[2]
-
- @log.info "Received a request for download file : #{file_name}"
- outgoing_dir = "#{@parent_server.transport_path}/#{dock_num}"
- @log.info "Sending requested file...: #{file_name}"
- @comm_server.send_file(req, "#{outgoing_dir}/#{file_name}")
- # remove file if "dock" defined
- if dock_num != "0" and File.exist? "#{outgoing_dir}/#{file_name}" then
- @log.info "Removing requested file...: #{file_name}"
- FileUtils.rm_rf "#{outgoing_dir}/#{file_name}"
- if Utils.directory_emtpy?(outgoing_dir) then
- FileUtils.rm_rf "#{outgoing_dir}"
- end
- end
-
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-
-
- private
- def check_project_user_id(project_name, dist_name, user_id)
- return @parent_server.prjmgr.get_project_accessable(project_name, dist_name, user_id)
- end
-
- private
- def check_project_exist(project_name, dist_name, req)
- prj = @parent_server.prjmgr.get_project(project_name, dist_name)
- if prj.nil? then
- raise BuildServerException.new("ERR009"), "#{project_name} on #{dist_name}"
- end
-
- return prj
- end
-
- private
- def check_project_pkg_name_user_id(file_name, dist_name, user_id)
- # get package name
- new_name = file_name.sub(/(.*)_(.*)_(.*)\.zip/,'\1,\2,\3')
- pkg_name = new_name.split(",")[0]
- return @parent_server.prjmgr.get_project_pkg_name_accessable(pkg_name, dist_name, user_id)
- end
-
- private
- def check_project_for_package_file_name(filename, dist_name, req)
- # get package name
- new_name = filename.sub(/(.*)_(.*)_(.*)\.zip/,'\1,\2,\3')
- pkg_name = new_name.split(",")[0]
- prj = @parent_server.prjmgr.get_project_from_package_name(pkg_name, dist_name)
- if prj.nil? then
- raise BuildServerException.new("ERR013"), "#{pkg_name} #{dist_name}"
- end
-
- return prj
- end
-
- private
- def check_distribution(dist_name, req, only_exist = false)
- dist = @parent_server.distmgr.get_distribution(dist_name)
- if dist.nil? then
- raise BuildServerException.new("ERR002"), dist_name
- elsif dist.status != "OPEN" and not only_exist then
- raise BuildServerException.new("ERR008"), dist_name
- end
- end
-
- private
- def check_supported_os(os_list, req)
-
- # check if supported os list contain at least one OS
- host_supported_os_list = @parent_server.supported_os_list
- if host_supported_os_list.empty? then
- raise BuildServerException.new("ERR007"), ""
- end
-
- result = []
- os_list.each do |os|
- if os == "all" or os == "*" then
- result = result + host_supported_os_list
-
- elsif os == "default" then
- os = host_supported_os_list[0]
- result.push os
- @log.info "The default OS \"#{os}\" is used as target OS"
-
- elsif os.include? "*" then
- reg_os = os.gsub("*","[a-zA-Z0-9.]*")
- host_supported_os_list.each do |svr_os|
- matches = svr_os.match("#{reg_os}")
- if not matches.nil? and matches.size == 1 and
- matches[0] == svr_os then
- result.push svr_os
- end
- end
- elsif host_supported_os_list.include?(os) then
- result.push os
- else
- msgs = "#{os}... Use a name in (" +
- host_supported_os_list.join("|") + ")"
- raise BuildServerException.new("ERR003"),msgs
- end
- end
-
- result.uniq!
- if result.empty? then
- raise BuildServerException.new("ERR003"), "There is no OS name matched."
- end
-
- return result
- end
-
- private
- def get_latest_commit( project_name, dist_name )
- nPrj = @parent_server.prjmgr.get_project(project_name, dist_name)
- result = nil
- if nPrj.type.eql? "GIT" then
- @parent_server.get_db_connection() do |db|
- source_info = nPrj.get_latest_source_info(db)
- if not source_info.nil? then
- result = source_info["location"]
- end
- end
- end
- return result
- end
-
- private
- def create_new_job( project_name, os, dist_name )
- return @parent_server.prjmgr.create_new_job(project_name, os, dist_name)
- end
-
-
- private
- def create_new_upload_job( project_name, filename, dock, dist_name)
-
- return @parent_server.prjmgr.get_project(project_name, dist_name).create_new_job(filename, dock)
- end
-
-
- private
- def create_new_transferred_job( git_repos, os, git_commit, pkg_files, dock_num, dist_name, pkgsvr_url, project_name, git_branch )
- prj = @parent_server.prjmgr.create_transferred_git_project( git_repos, dist_name, os, project_name, git_branch )
- new_job = prj.create_new_job(os)
- new_job.set_package_server_url(pkgsvr_url)
- new_job.set_verified( true )
- new_job.set_send_result_back( dock_num )
- new_job.git_commit = git_commit
- pkg_files.each do |file|
- new_job.add_external_package( file )
- end
-
- return new_job
- end
-end
+++ /dev/null
-#!/usr/bin/ruby
-=begin
-
- monitor_log.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'logger'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__)) + "/common"
-require 'JobLog'
-require 'log.rb'
-require 'utils.rb'
-
-# parse arguments
-addr = ARGV[0]
-port = ARGV[1]
-job_id = ARGV[2]
-min_level = ARGV[3].to_i
-log_path = ARGV[4]
-if log_path.nil? then
- log = StandardOutLogPrinter.new
-else
- log = Log.new(log_path)
-end
-result_files = []
-result = true
-job_status = "JUST_CREATED"
-job_errmsg = ""
-begin
- result = JobLog.monitor(addr, port, job_id) do |line,status,errmsg|
- job_status = status
- job_errmsg = errmsg
- if line.nil? then
- next
- end
- if line.strip.start_with?("=JOB_FILE") then
- result_files.push( line.strip.split(",")[1] )
- end
-
- category, level, contents = JobLog.parse_log(line)
- if level < min_level then next end
- if category == "INFO" then
- log.info( contents, level )
- STDOUT.flush
- elsif category == "WARN" then
- log.warn( contents, level )
- STDOUT.flush
- elsif category == "ERROR" then
- log.error( contents, level )
- STDOUT.flush
- else
- next
- end
- end
-
-rescue BuildServerException => e
- log.error( e.err_message("") )
- result = false
-rescue => e
- log.error( "#{e.message()}" )
- result = false
-end
-if log_path.nil? then
- puts "=LOG_END"
- STDOUT.flush
-end
-Marshal.dump([result, job_status, job_errmsg, result_files], $stdout)
+++ /dev/null
-#!/usr/bin/ruby
-=begin
-
- send_file.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'logger'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__)) + "/common"
-require 'JobLog'
-require 'log.rb'
-require 'utils.rb'
-require "FileTransferViaFTP"
-require "FileTransferViaDirect"
-
-# parse arguments
-addr = ARGV[0]
-port = ARGV[1]
-dock = ARGV[2]
-file_path = ARGV[3]
-file_path = ARGV[3]
-ftp_addr = ARGV[4]
-ftp_port = ARGV[5]
-ftp_username = ARGV[6]
-ftp_passwd = ARGV[7]
-log_path = ARGV[8]
-if log_path.nil? then
- log = StandardOutLogPrinter.new
-else
- log = Log.new(log_path)
-end
-
-begin
- result = false
-
- # create client
- client = BuildCommClient.create( addr, port, log )
- if client.nil? then
- log.error( "Creating communication client failed!", Log::LV_USER)
- exit(1)
- end
-
- # download file
- file_name = file_path.split("/")[-1]
- msg = "DOWNLOAD|#{dock}|#{file_name}"
- if client.send( msg ) then
- if ftp_addr != "0" then
- transporter=FileTransferFTP.new(log, ftp_addr, ftp_port, ftp_username, ftp_passwd)
- else
- transporter=FileTransferDirect.new(log)
- end
- result=client.receive_file(file_path, transporter)
- if not result then
- log.error( "File downloading failed...#{file_name}", Log::LV_USER)
- end
- end
-rescue => e
- log.error( "#{e.message()}" )
- result = false
-ensure
- #close connections
- client.terminate if not client.nil?
-
- # send result
- if log_path.nil? then
- puts "=TRANSFER_END"
- STDOUT.flush
- end
- if result then
- exit 0
- else
- exit 1
- end
-end
-
+++ /dev/null
-#!/usr/bin/ruby
-=begin
-
- send_file.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'logger'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__)) + "/common"
-require 'JobLog'
-require 'log.rb'
-require 'utils.rb'
-require "FileTransferViaFTP"
-require "FileTransferViaDirect"
-
-
-# parse arguments
-addr = ARGV[0]
-port = ARGV[1]
-dock = ARGV[2]
-file_path = ARGV[3]
-ftp_addr = ARGV[4]
-ftp_port = ARGV[5]
-ftp_username = ARGV[6]
-ftp_passwd = ARGV[7]
-log_path = ARGV[8]
-if log_path.nil? then
- log = StandardOutLogPrinter.new
-else
- log = Log.new(log_path)
-end
-
-begin
- result = false
-
- # create client
- client = BuildCommClient.create( addr, port, log )
- if client.nil? then
- log.error( "Creating communication client failed!", Log::LV_USER)
- exit(1)
- end
-
- # upload file
- file_name = file_path.split("/")[-1]
- msg = "UPLOAD|#{dock}"
- if client.send( msg ) then
- if ftp_addr != "0" then
- transporter=FileTransferFTP.new(log, ftp_addr, ftp_port, ftp_username, ftp_passwd)
- else
- transporter=FileTransferDirect.new(log)
- end
-
- result=client.send_file( file_path, transporter )
- if not result then
- log.error( "File uploading failed...#{file_name}", Log::LV_USER)
- end
- end
-
-rescue => e
- log.error( "#{e.message()}" )
- result = false
-ensure
- #close connections
- client.terminate if not client.nil?
-
- # send result
- if log_path.nil? then
- puts "=TRANSFER_END"
- STDOUT.flush
- end
- if result then
- exit 0
- else
- exit 1
- end
-end
-
+++ /dev/null
-=begin
-
- Builder.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/pkg_server"
-require "client"
-require "utils"
-require "PackageManifest"
-require "log"
-require "FileUtil"
-
-class Builder
- private_class_method :new
- attr_accessor :id, :pkgserver_url, :log, :buildroot_dir, :cache_dir
-
- CONFIG_ROOT = Utils::HOME + "/.build_tools/builder"
- @@instance_map = {}
-
- # initialize
- def initialize (id, pkgserver_url, log_path, buildroot_dir, cache_dir)
- @id = id
- @pkgserver_url = pkgserver_url
- @host_os = Utils::HOST_OS
- @buildroot_dir = buildroot_dir
- @cache_dir = cache_dir
- @job = nil
- if not log_path.nil? then
- @log = Log.new(log_path)
- else
- @log = DummyLog.new
- end
- end
-
-
- # create
- def self.create (id, pkgserver_url, log_path, buildroot_dir, cache_dir)
-
- # check builder config root
- check_builder_config_root
-
- # if exist , overwrite
- if File.exist? "#{CONFIG_ROOT}/#{id}"
- FileUtils.rm_rf "#{CONFIG_ROOT}/#{id}"
- end
-
- # create buildroot if not set
- if buildroot_dir.nil? then
- buildroot_dir = "#{CONFIG_ROOT}/#{id}/buildroot"
- if not File.exist? buildroot_dir then
- FileUtils.mkdir_p buildroot_dir
- end
- end
-
- # create cachedir if not set
- if cache_dir.nil? then
- cache_dir = "#{CONFIG_ROOT}/#{id}/build_cache"
- if not File.exist? cache_dir then
- FileUtils.mkdir_p cache_dir
- end
- end
-
- # create new instance and return it
- @@instance_map[id] = new( id, pkgserver_url, log_path, buildroot_dir, cache_dir )
-
- # write config
- write_builder_config( @@instance_map[id] )
- return @@instance_map[id]
- end
-
-
- def self.remove( id )
- # check builder config root
- check_builder_config_root
-
- # check id
- if File.exist? "#{CONFIG_ROOT}/#{id}"
- FileUtils.rm_rf "#{CONFIG_ROOT}/#{id}"
- @@instance_map[id] = nil
- puts "Removed the builder \"#{id}\""
- end
- end
-
-
- def self.exist?( id )
- # check builder config root
- check_builder_config_root
-
- # check id
- if File.exist? "#{CONFIG_ROOT}/#{id}" then
- return true
- else
- return false
- end
- end
-
- # get
- def self.get( id )
-
- # check instance first
- if not @@instance_map[id] == nil
- return @@instance_map[id]
- end
-
- # check builder config
- if not File.exist? "#{CONFIG_ROOT}/#{id}/builder.cfg"
- raise RuntimeError, "The builder \"#{id}\" does not exist."
- end
-
- # get builder config and return its object
- @@instance_map[id] = read_builder_config(id)
-
- return @@instance_map[id]
- end
-
-
- # clean
- def clean( src_path )
-
- return clean_project_directory( src_path, nil )
- end
-
-
- # build_job
- def build_job( job, clean, local_pkgs, is_local_build )
- # set job
- @job = job
- old_log = @log
- @log = job.log
-
- # build
- ret = build(job.source_path, job.os, clean, local_pkgs, is_local_build)
-
- # reset job
- @job = nil
- @log = old_log
-
- # return
- return ret
- end
-
-
- # build
- def build( src_path, os, clean, local_pkgs, is_local_build )
-
- # create pkginfo
- if not File.exist? "#{src_path}/package/pkginfo.manifest" then
- @log.error( "The \"package/pkginfo.manifest\" file does not exist!", Log::LV_USER)
- return false
- end
-
- # read pkginfo
- begin
- pkginfo = PackageManifest.new("#{src_path}/package/pkginfo.manifest")
- rescue => e
- @log.error( e.message, Log::LV_USER)
- return false
- end
-
- # set default build os
- build_host_os = @host_os
-
- # check there are packages which can be built
- if not pkginfo.package_exist?(os, build_host_os ) then
- if is_local_build and File.exist? "#{src_path}/package/pkginfo.manifest.local" then
- begin
- pkginfo = PackageManifest.new("#{src_path}/package/pkginfo.manifest.local")
- rescue => e
- @log.error( e.message, Log::LV_USER)
- return false
- end
- if not pkginfo.package_exist?(os, build_host_os ) then
-
- @log.error( "This project does not support a build on this host OS: #{build_host_os}")
- @log.error( " * Check \"Build-host-os\" in pkginfo.manifest or pkginfo.manifest.local" )
-
- return false
- end
- else
- @log.error( "This project does not support a build on this host OS: #{build_host_os}")
- @log.error( " * Check \"Build-host-os\" in pkginfo.manifest" )
-
- return false
- end
- end
-
- #set up change log
- change_log = {}
- begin
- change_log = Parser.read_changelog "#{src_path}/package/changelog" if File.exist? "#{src_path}/package/changelog"
- rescue => e
- @log.error( e.message, Log::LV_USER)
- return false
- end
-
- if not change_log.empty? and pkginfo.packages[0].change_log.empty? then
- pkginfo.packages.each {|pkg| pkg.change_log = change_log}
- end
-
- # set build root
- build_root_dir = @buildroot_dir
- if not File.exist? build_root_dir then
- FileUtils.mkdir_p build_root_dir
- end
-
- # create client
- @log.info( "Downloding client is initializing...", Log::LV_USER)
- cl = Client.create(@pkgserver_url, build_root_dir, @log)
- if cl.nil? then
- @log.error( "Cannot create package client!", Log::LV_USER )
- return false
- end
- if clean then
- cl.clean(true)
- end
-
- # get local repository path list
- repos_paths = []
- local_pkgs.each do |path|
- repos_paths.push File.dirname(path)
- end
- repos_paths.uniq!
-
- # install build dependencies
- @log.info( "Installing dependent packages...", Log::LV_USER)
- pkginfo.get_build_dependencies( os ).each do |dep|
- # if job, check "CANCEL"
- if not @job.nil? then @job.check_event() end
-
- if dep.target_os_list.count != 0 then
- dep_target_os = dep.target_os_list[0]
- else
- dep_target_os = os
- end
- @log.info( " * #{dep.package_name}", Log::LV_USER)
-
- # get local dependent package
- pkgexp = Regexp.new("\/#{dep.package_name}_.*_#{dep_target_os}\.zip$")
- local_dep_pkgs = local_pkgs.select{|l| l =~ pkgexp}
-
- # install package from remote package server
- if local_dep_pkgs.empty? then
- if not cl.install(dep.package_name, dep_target_os, true, false) then
- @log.error( "Installing \"#{dep.package_name}\" failed!", Log::LV_USER)
- return false
- end
- else
- local_dep_pkgs.each do |l|
- @log.info( "Installing local package...#{l}", Log::LV_USER)
- if not File.exist? l then
- @log.error( "File not found!: #{l}", Log::LV_USER )
- end
- cl.install_local_pkg(l,true,false, repos_paths)
- end
- end
- end
-
- @log.info( "Downloading dependent source packages...", Log::LV_USER)
- src_archive_list = []
- pkginfo.get_source_dependencies(os,build_host_os).each do |dep|
- src_archive_list.push dep.package_name
- end
- src_archive_list.uniq!
- src_archive_list.each do |archive_name|
- @log.info( " * #{archive_name}", Log::LV_USER)
- if cl.download_dep_source(archive_name).nil? then
- @log.error( "Downloading \"#{archive_name}\" failed!", Log::LV_USER)
- return false
- end
- end
-
- # make clean
- @log.info( "Make clean...", Log::LV_USER)
- if not clean_project_directory( src_path, os ) then
- return false
- end
-
- @log.info( "Make build...", Log::LV_USER)
- if not execute_build_command("build", src_path, build_root_dir, os, pkginfo.get_version) then
- return false
- end
-
- # execute install script
- @log.info( "Make install...", Log::LV_USER)
- if not execute_build_command("install", src_path, build_root_dir, os, pkginfo.get_version) then
- return false
- end
-
- # check uncompressed directory size
- if not check_uncompressed_size(pkginfo, os, src_path ) then
- return false
- end
-
- # write pkginfo
- @log.info( "Generatiing pkginfo.manifest...", Log::LV_USER)
- if not write_pkginfo_files(pkginfo,os,src_path) then
- @log.error( "Failed to write pkginfo.manifest", Log::LV_USER)
- return false
- end
-
- # zip
- @log.info( "Zipping...", Log::LV_USER)
- if not make_zip(pkginfo,os,src_path) then
- @log.error( "Creating packages failed!", Log::LV_USER)
- return false
- end
-
- return true
- end
-
-
- private
-
-
- # check builder config root
- def self.check_builder_config_root
- if not File.exist? Builder::CONFIG_ROOT
- puts "Builder configuation is not found."
- puts "Creating new builder configuration... #{Builder::CONFIG_ROOT}"
- FileUtils.mkdir_p "#{Builder::CONFIG_ROOT}"
- end
- end
-
-
- # write builder configuration
- def self.write_builder_config( obj )
- # create config folder
- builder_dir = "#{CONFIG_ROOT}/#{obj.id}"
- if not File.exist? builder_dir then
- FileUtils.mkdir_p( "#{builder_dir}" )
- end
-
- # write configuration
- File.open( "#{builder_dir}/builder.cfg", "w" ) do |f|
- f.puts "ID=#{obj.id}"
- f.puts "PSERVER_URL=#{obj.pkgserver_url}"
- f.puts "LOG-PATH=#{obj.log.path}"
- f.puts "CACHE-DIR=#{obj.cache_dir}"
- end
- end
-
-
- # read builder configuration
- def self.read_builder_config( id )
- pkgserver_url=""
-
- # read configuration
- builder_dir = "#{CONFIG_ROOT}/#{id}"
- log_path = nil
- cache_dir = "#{CONFIG_ROOT}/#{id}/build_cache"
- buildroot_dir = "#{CONFIG_ROOT}/#{id}/buildroot"
- File.open( "#{builder_dir}/builder.cfg", "r" ) do |f|
- f.each_line do |l|
- if l.start_with?("PSERVER_URL=")
- pkgserver_url = l.split("=")[1].strip
- elsif l.start_with?("LOG-PATH=")
- log_path = l.split("=")[1].strip
- log_path = nil if log_path == "STDOUT"
- elsif l.start_with?("CACHE-DIR=")
- cache_dir = l.split("=")[1].strip
- elsif l.start_with?("BUILDROOT-DIR=")
- buildroot_dir = l.split("=")[1].strip
- else
- next
- end
- end
- end
-
- if log_path.empty? then log_path = nil end
-
- # create object & return it
- return new( id, pkgserver_url, log_path, buildroot_dir, cache_dir )
- end
-
-
- # execute build command
- def execute_build_command( target, src_path, build_root_dir, os, version )
-
- # get category
- os_category = Utils.get_os_category( os )
-
- # convert directory format when windows
- if Utils.is_windows_like_os( @host_os ) then
- src_path2 = Utils.get_unix_path( src_path )
- else
- src_path2 = src_path
- end
-
- env_def =
- "BUILD_TARGET_OS=#{os} \
-TARGET_OS=#{os} \
-TARGET_OS_CATEGORY=#{os_category} \
-SRCDIR=\"#{src_path2}\" \
-ROOTDIR=\"#{build_root_dir}\" \
-VERSION=\"#{version}\" "
-
- # check script file
- script_file = "#{src_path}/package/build.#{@host_os}"
- if not File.exist? script_file then
- if Utils.is_linux_like_os( @host_os ) then
- script_file = "#{src_path}/package/build.linux"
- elsif Utils.is_windows_like_os( @host_os ) then
- script_file = "#{src_path}/package/build.windows"
- elsif Utils.is_macos_like_os( @host_os ) then
- script_file = "#{src_path}/package/build.macos"
- end
- # check old script file
- if not File.exist? script_file then
- @log.error( "The script file not found!: \"package/build.#{@host_os}\"", Log::LV_USER)
- return false
- end
- end
-
- # read build script
- # this will ignore last lines without block
- contents = []
- File.open( script_file, "r" ) do |f|
- lines = []
- f.each_line do |l|
- lines.push l
- if l.start_with? "}" then
- contents = contents + lines
- lines = []
- end
- end
- end
-
- # generate shell script
- File.open( "#{src_path}/.build.sh", "w" ) do |f|
- f.puts "#!/bin/sh -xe"
- contents.each do |l|
- f.puts l
- end
-
- case target
- when "clean"
- f.puts " "
- when "build"
- f.puts " "
- when "build_cache"
- f.puts "CACHEDIR=${PKG_CACHE_DIR}/$(cache_key)"
- when "save_cache"
- f.puts "rm -rf ${PKG_CACHE_DIR}/*"
- f.puts "CACHEDIR=${PKG_CACHE_DIR}/$(cache_key)"
- f.puts "mkdir -p ${CACHEDIR}"
- when "install"
- f.puts " "
- else
- @log.warn( "Wrong build-target is used: \"#{target}\"", Log::LV_USER)
- return false
- end
- f.puts "#{target}"
- f.puts "echo \"success\""
- end
- Utils.execute_shell( "chmod +x #{src_path}/.build.sh" )
- build_command = "cd \"#{src_path}\";" + env_def + "./.build.sh"
-
- # execute script
- status = nil
- if not @job.nil? then
- pid, status = @job.execute_command( build_command )
- else
- pid, status = Utils.execute_shell_with_log( build_command, @log.path )
- end
-
- if not status.nil? and status.exitstatus != 0 then
- @log.error( "Failed on build script: \"#{target}\"", Log::LV_USER)
- return false
- else
- Utils.execute_shell( "rm -rf #{src_path}/.build.sh" )
- return true
- end
- end
-
-
- # write pkginfo.manifest
- def write_pkginfo_files(pkginfo,os,src_path)
- # get category
- os_category = Utils.get_os_category( os )
-
- pkginfo.packages.each do |pkg|
- # skip if not support the target os
- if not pkg.os_list.include? os
- next
- end
-
- # install/remove script files
- if not copy_post_install_script(pkg,os,src_path) then return false end
- if not copy_post_remove_script(pkg,os,src_path) then return false end
-
- # write manifest file
- install_dir = "#{src_path}/package/#{pkg.package_name}.package.#{os}"
-
- # if there is no intall directory, error
- if not File.exist? install_dir then
- install_dir = "#{src_path}/package/#{pkg.package_name}.package.#{os_category}"
-
- if not File.exist? install_dir then
- @log.error( "Following directory must be created before writing pkginfo.manifest", Log::LV_USER)
- @log.error( " * package/#{pkg.package_name}.package.#{os}", Log::LV_USER)
- @log.error( "Host OS name : #{@host_os}", Log::LV_USER)
- @log.error( "It caused wrong pkginfo.manifest, pkginfo.manifest.local or build script", Log::LV_USER)
- return false
- end
- end
-
- # write pkginfo.manifest
- File.open("#{install_dir}/pkginfo.manifest", "w") do |f|
- f.puts pkg
- f.puts ""
- f.puts pkg.change_log_string
- end
- end
-
- return true
- end
-
-
- # copy post-install script
- def copy_post_install_script(pkg,os,src_path)
-
- tar = nil
- src = nil
-
- # get category
- os_category_list = []
- pkg.os_list.each do |cos|
- os_category_list.push Utils.get_os_category(cos)
- end
-
- # check compatable os
- (pkg.os_list + os_category_list).uniq.each do |cos|
- if File.exist? "#{src_path}/package/#{pkg.package_name}.install.#{cos}" then
- if src.nil? then
- src = "#{src_path}/package/#{pkg.package_name}.install.#{cos}"
- else
- @log.error( "compatable package can have only one install script\n but you have another availabe install scripts", Log::LV_USER)
- @log.error( " * package/#{File.basename src}", Log::LV_USER)
- @log.error( " * package/#{pkg.package_name}.install.#{cos}", Log::LV_USER)
- return false
- end
- end
- end
-
- install_dir = "#{src_path}/package/#{pkg.package_name}.package.#{os}"
-
- # if there is no intall directory, error
- if not File.exist? install_dir then
- os_category = Utils.get_os_category( os )
- install_dir = "#{src_path}/package/#{pkg.package_name}.package.#{os_category}"
-
- if not File.exist? install_dir then
- @log.error( "Following directory must be created before writing pkginfo.manifest", Log::LV_USER)
- @log.error( " * package/#{pkg.package_name}.package.#{os}", Log::LV_USER)
- @log.error( "Host OS name : #{@host_os}", Log::LV_USER)
- @log.error( "It caused wrong pkginfo.manifest, pkginfo.manifest.local or build script", Log::LV_USER)
- return false
- end
- end
-
- if not src.nil? then
- if Utils.is_unix_like_os( os ) then
- tar = "#{install_dir}/install.sh"
- elsif Utils.is_windows_like_os( os) then
- tar = "#{install_dir}/install.BAT"
- else
- puts "Unknown OS: #{os} "
- return true
- end
-
- #FileUtils.ln(src, tar,:force => true)
- if not FileUtil.safeLink(src, tar) then
- @log.error("Failed to link file #{src} to #{tar}")
- return false
- end
- end
-
- return true
- end
-
-
- # copy post-remove script
- def copy_post_remove_script(pkg,os,src_path)
-
- tar = nil
- src = nil
-
- # get category
- os_category_list = []
- pkg.os_list.each do |cos|
- os_category_list.push Utils.get_os_category(cos)
- end
-
- # check compatable os
- (pkg.os_list + os_category_list).uniq.each do |cos|
- if File.exist? "#{src_path}/package/#{pkg.package_name}.remove.#{cos}" then
- if src.nil? then
- src = "#{src_path}/package/#{pkg.package_name}.remove.#{cos}"
- else
- @log.error( "compatable package can have only one remove script but you have another availabe remove scripts", Log::LV_USER)
- @log.error( " * package/#{File.basename src}", Log::LV_USER)
- @log.error( " * package/#{pkg.package_name}.remove.#{cos}", Log::LV_USER)
- return false
- end
- end
- end
-
- install_dir = "#{src_path}/package/#{pkg.package_name}.package.#{os}"
-
- # if there is no intall directory, error
- if not File.exist? install_dir then
- os_category = Utils.get_os_category( os )
- install_dir = "#{src_path}/package/#{pkg.package_name}.package.#{os_category}"
-
- if not File.exist? install_dir then
- @log.error( "Following directory must be created before writing pkginfo.manifest", Log::LV_USER)
- @log.error( " * package/#{pkg.package_name}.package.#{os}", Log::LV_USER)
- @log.error( "Host OS name : #{@host_os}", Log::LV_USER)
- @log.error( "It caused wrong pkginfo.manifest, pkginfo.manifest.local or build script", Log::LV_USER)
- return false
- end
- end
-
- if not src.nil?
- if Utils.is_unix_like_os( os ) then
- tar = "#{install_dir}/remove.sh"
- elsif Utils.is_windows_like_os( os) then
- tar = "#{install_dir}/remove.BAT"
- else
- puts "Unknown OS: #{os} "
- return true
- end
-
- #FileUtils.ln(src, tar,:force => true)
- if not FileUtil.safeLink(src, tar) then
- @log.error("Failed to link file #{src} to #{tar}")
- return false
- end
- end
- return true
- end
-
-
- # create package file
- def make_zip(pkginfo,os,src_path)
- # get category
- os_category = Utils.get_os_category( os )
-
- pkginfo.packages.each do |pkg|
- # skip if not support the target os
- if not pkg.os_list.include? os
- next
- end
-
- # cd install dir
- install_dir = "#{src_path}/package/#{pkg.package_name}.package.#{os}"
- if not File.exist? install_dir then
- install_dir = "#{src_path}/package/#{pkg.package_name}.package.#{os_category}"
-
- if not File.exist? install_dir then
- @log.error( "Following directory must be created before writing pkginfo.manifest", Log::LV_USER)
- @log.error( " * package/#{pkg.package_name}.package.#{os}", Log::LV_USER)
- @log.error( "Host OS name : #{@host_os}", Log::LV_USER)
- @log.error( "It caused wrong pkginfo.manifest, pkginfo.manifest.local or build script", Log::LV_USER)
- return false
- end
- end
-
- # zip
- @log.info( "Creating package file ... #{pkg.package_name}_#{pkg.version}_#{os}.zip", Log::LV_USER)
- cmd = "cd \"#{install_dir}\"; zip -r -y #{src_path}/#{pkg.package_name}_#{pkg.version}_#{os}.zip *"
- @log.info( cmd )
- if not @job.nil? then
- @job.execute_command( cmd )
- else
- Utils.execute_shell_with_log(cmd, @log.path)
- end
-
- if not File.exist? "#{src_path}/#{pkg.package_name}_#{pkg.version}_#{os}.zip" then
- return false
- end
- end
- return true
- end
-
-
- # clean the temporary directory for packaged
- def clean_project_directory(src_path, target_os = nil)
-
- # if os is not set, use host os instead
- if target_os.nil? then target_os = @host_os end
-
- # convert path if windows
- if Utils.is_windows_like_os(@host_os) then
- build_root_dir = Utils.get_unix_path( @buildroot_dir )
- else
- build_root_dir = @buildroot_dir
- end
-
- # create pkginfo
- begin
- pkginfo = PackageManifest.new("#{src_path}/package/pkginfo.manifest")
- rescue => e
- @log.error( e.message, Log::LV_USER)
- return false
- end
-
- # get category
- # make clean
- pkginfo.packages.each do |pkg|
- os = pkg.os
- os_category = Utils.get_os_category( os )
-
- if File.exist? "#{src_path}/package/#{pkg.package_name}.package.#{pkg.os}" then
- FileUtils.rm_rf "#{src_path}/package/#{pkg.package_name}.package.#{pkg.os}"
- elsif File.exist? "#{src_path}/package/#{pkg.package_name}.package.#{os_category}" then
- FileUtils.rm_rf "#{src_path}/package/#{pkg.package_name}.package.#{os_category}"
- end
- end
-
- # clean local-only package's directory
- if File.exist? "#{src_path}/package/pkginfo.manifest.local" then
- begin
- pkginfo = PackageManifest.new("#{src_path}/package/pkginfo.manifest.local")
- rescue => e
- @log.error( e.message, Log::LV_USER)
- return false
- end
- pkginfo.packages.each do |pkg|
- os = pkg.os
- os_category = Utils.get_os_category( os )
-
- if File.exist? "#{src_path}/package/#{pkg.package_name}.package.#{pkg.os}" then
- FileUtils.rm_rf "#{src_path}/package/#{pkg.package_name}.package.#{pkg.os}"
- elsif File.exist? "#{src_path}/package/#{pkg.package_name}.package.#{os_category}" then
- FileUtils.rm_rf "#{src_path}/package/#{pkg.package_name}.package.#{os_category}"
- end
- end
- end
-
- # execute
- return execute_build_command("clean", src_path, build_root_dir, target_os, pkginfo.get_version)
- end
-
- def check_uncompressed_size(pkginfo, os, src_path)
-
- pkginfo.packages.each do |pkg|
- # skip if not support the target os
- if not pkg.os_list.include? os
- next
- end
-
- size = Utils.get_directory_size("#{src_path}/package/#{pkg.package_name}.package.#{os}")
- if not size.nil? then
- pkg.uncompressed_size = "#{size}"
- end
- end
-
- return true
-
- end
-end
+++ /dev/null
-=begin
-
- CleanOptionParser.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'optparse'
-require 'logger'
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "utils"
-
-def parse()
-
- #option parsing
- option = {}
- optparse = OptionParser.new(nil, 32, ' '*8) do |opts|
- opts.banner = "Clean the package service command-line tool." + "\n" \
- + "\n" + "Usage: pkg-clean [-h] [-v]" + "\n" \
- + "\n" + "Options:" + "\n"
-
- opts.on('-h','--help', 'display help') do
- puts opts
- exit
- end
-
- opts.on('-v','--version', 'display version') do
- puts "DIBS(Distributed Intelligent Build System) version " + Utils.get_version()
- exit
- end
- end
-
- optparse.parse!
-
- return option
-end
+++ /dev/null
-=begin
-
- optionparser.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'optparse'
-require 'logger'
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "utils"
-
-def parse()
-
- #option parsing
- option = {}
- optparse = OptionParser.new do |opts|
- opts.banner = "Build and packaging service command-line tool." + "\n" \
- + "\n" + "Usage: pkg-build -u <package server url> [-o <os>] [-c] [-h] [-v]" + "\n" \
- + "\n" + "Options:" + "\n"
-
- opts.on('-u','--url <package server url>', 'remote package server url: http://127.0.0.1/dibs/unstable') do |url|
- option[:url] = url
- end
-
- option[:os] = nil
- opts.on('-o','--os <os>', 'operating system ') do |os|
- option[:os] = os
- end
-
- option[:clean] = false
- opts.on('-c','--clean', 'clean build') do
- option[:clean] = true
- end
-
- option[:rev] = false
- #opts.on('-r','--rev', 'reverse build dependency check') do
- # option[:rev] = true
- #end
-
- opts.on('-h','--help', 'display help') do
- puts opts
- exit
- end
-
- opts.on('-v','--version', 'display version') do
- puts "DIBS(Distributed Intelligent Build System) version " + Utils.get_version()
- exit
- end
- end
-
- optparse.parse!
-
- if option[:url].nil? or option[:url].empty? then
- raise ArgumentError, "Usage: pkg-build -u <package server url> [-o <os>] [-c] [-h]"
- end
-
- return option
-end
+++ /dev/null
-=begin
-
- Action.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class Action
- attr_accessor :time, :period
-
- def initialize( time, period )
- @time = time
- @period = period
- end
-
-
- # initialize action
- def init()
- end
-
-
- # execute action
- def execute()
- end
-
-end
+++ /dev/null
-=begin
-
- BuildComm.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "log"
-require "socket"
-require 'timeout'
-require "net/ftp"
-require 'thread'
-require "FileTransferViaFTP"
-require "FileTransferViaDirect"
-require "FileUtil"
-
-ATTEMPTS = ["first", "second", "third"]
-
-class BuildCommServer
- VERSION = "1.9.1"
-
- private_class_method :new
-
- def initialize(port, log, ftp_url, cache_dir)
- @port = port
- @log = log
- @ftp_url = ftp_url
- @cache_dir = cache_dir
- @tcp_server = TCPServer.open( port )
- @download_cache_mutex = Mutex.new
- end
-
- def self.create(port, log, ftp_url=nil, cache_dir=nil)
- # checking port is available
- if port_open? port then
- raise "Port \"#{port}\" is already in use."
- end
-
- if log.nil? then
- log = DummyLog.new
- end
-
- # create cache dir if not nil
- if not cache_dir.nil? and not File.exist? cache_dir then
- FileUtils.mkdir_p cache_dir
- end
-
- return new(port, log, ftp_url, cache_dir)
- end
-
-
- # wait for connection and handle request
- def wait_for_connection(quit_loop)
- while( not quit_loop )
- req = @tcp_server.accept
-
- begin
- yield req if block_given?
- rescue
- @log.error $!
- @log.error "Caught a connection exception"
- req.close
- end
- end
- end
-
-
- # terminate
- def terminate
- @tcp_server.close()
- end
-
-
- # send_begin
- def self.send_begin( req )
- send( req, "=BEGIN,#{VERSION}")
- end
-
-
- def self.send_end( req )
- send( req, "=END")
- end
-
-
- def self.send_chk( req )
- send( req, "=CHK" )
- end
-
-
- def self.send( req, line )
- begin
- if not req.nil? then
- req.puts line
- end
- rescue
- raise "Connection is closed"
- end
- end
-
-
- def send_file(req, src_file)
- begin
- if not File.exist? src_file then
- @log.error "\"#{src_file}\" file does not exist"
- req.puts "ERROR"
- return false
- end
-
- req.puts "READY"
- @log.info "Ready to send file"
-
- while line = req.gets()
- tok = line.split(",").map { |x| x.strip }
- cmd = tok[0].strip
- case cmd
- when "CHECK_TRANSPORTER"
- type = tok[1].strip
- case type
- when "DIRECT"
- transporter = FileTransferDirect.new(@log)
- when "FTP"
- if not @ftp_url.nil? then
- url_contents = Utils.parse_ftpserver_url(@ftp_url)
- ip = url_contents[0]
- port = url_contents[1]
- username = url_contents[2]
- passwd = url_contents[3]
- transporter = FileTransferFTP.new(@log, ip, port, username, passwd)
- else
- transporter = FileTransferFTP.new(@log)
- end
- else
- req.puts "ERROR"
- @log.error "Unsupported transporter type! : #{type}"
- return false
- end
-
- req.puts "TRANSPORTER_OK"
-
- if not transporter.send_file( src_file, req, false ) then
- return false
- else
- return true
- end
-
- else
- @log.warn "Unhandled message: #{line}"
- end
- end
-
- rescue => e
- puts "[BuildCommServer] Exception"
- @log.error e.message
- @log.error e.backtrace.inspect
- return false
- end
-
- return true
- end
-
-
- # NOTE. dst_file can be directory
- def receive_file(req, dst_file)
- begin
- req.puts "READY"
- @log.info "Ready to receive file"
-
- while line = req.gets()
- tok = line.split(",").map { |x| x.strip }
- cmd = tok[0].strip
- case cmd
- when "CHECK_CACHE"
- file_name = tok[1]
- file_size = tok[2].to_i
- checksum = tok[3]
-
- # check download cache
- if File.exist? dst_file and File.directory? dst_file then
- target_file = File.join(dst_file,file_name)
- else
- target_file = dst_file
- end
- if not @cache_dir.nil? and
- check_download_cache( target_file, file_size, checksum ) then
-
- @log.info "Download cache hit! Copied from cache.: #{file_name}"
- req.puts "CACHED"
- else
- @log.info "Cached file not found!#{file_name}"
- req.puts "NOT_CACHED"
- end
-
- when "CHECK_TRANSPORTER"
- type = tok[1].strip
- case type
- when "DIRECT"
- transporter = FileTransferDirect.new(@log)
- when "FTP"
- if not @ftp_url.nil? then
- url_contents = Utils.parse_ftpserver_url(@ftp_url)
- ip = url_contents[0]
- port = url_contents[1]
- username = url_contents[2]
- passwd = url_contents[3]
- transporter = FileTransferFTP.new(@log, ip, port, username, passwd)
- else
- transporter = FileTransferFTP.new(@log)
- end
- else
- req.puts "ERROR"
- @log.error "Unsupported transporter type! : #{type}"
- return false
- end
-
- req.puts "TRANSPORTER_OK"
-
- if not transporter.receive_file( dst_file, req, false ) then
- return false
- end
-
- # add to cache
- if not @cache_dir.nil? then
- add_download_cache(target_file)
- end
- break
-
- else
- @log.warn "Unhandled message: #{line}"
- end
- end
- rescue => e
- puts "[BuildCommServer] Exception"
- @log.error e.message
- @log.error e.backtrace.inspect
- return false
- end
-
- return true
- end
-
-
- def self.disconnect( req )
- begin
- # flush before close
- req.flush
- req.close
- rescue
- end
- end
-
- def self.port_open?( port )
- Timeout::timeout(1) do
- begin
- TCPSocket.new("127.0.0.1",port).close
- true
- rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
- false
- end
- end
- rescue Timeout::Error
- false
- end
-
-
- private
- def check_download_cache(dst_file, file_size, checksum )
- file_name = File.basename(dst_file)
- cache_file = "#{@cache_dir}/#{file_name}"
-
- @download_cache_mutex.synchronize do
- found = false
- # check file exist
- if File.exist? cache_file and
- File.size(cache_file) == file_size and
- Utils.checksum(cache_file) == checksum then
-
- # if hit , touch and copy
- FileUtils.touch cache_file
- #FileUtils.ln(cache_file, dst_file, :force => true)
- if (FileUtil.safeLink(cache_file, dst_file)) then
- found = true
- else
- @log.error "Failed to link file [#{cache_file}] to [#{dst_file}]"
- end
- end
-
- # refresh cache dir
- curr_time = Time.now
- Dir.entries(@cache_dir).each do |fname|
- if fname == "." or fname == ".." then next end
- file_path = "#{@cache_dir}/#{fname}"
- if File.mtime(file_path) + 3600 < curr_time then
- FileUtils.rm_rf file_path
- end
- end
-
- return found
- end
- end
-
-
- private
- def add_download_cache(dst_file)
- file_name = File.basename(dst_file)
- cache_file = "#{@cache_dir}/#{file_name}"
- @download_cache_mutex.synchronize do
- # copy & touch
- #FileUtils.ln(dst_file, cache_file, :force => true)
- if not FileUtil.safeLink(dst_file, cache_file) then
- @log.error "Failed to link file [#{dst_file}] to [#{cache_file}]"
- end
- FileUtils.touch cache_file
- end
- end
-end
-
-
-class BuildCommClient
- VERSION = "1.9.1"
- FIRST_RESPONSE_TIMEOUT = 120
-
- private_class_method :new
-
- def initialize(socket, log)
- @job_id = nil
- @job_status = ""
- @job_error = ""
- @log = log
- @socket = socket
- @error_msg = ""
- end
-
-
- # create
- # if sec 0 or nil then not set timeout. it's timeout spec
- def self.create(ip, port, log = nil, sec = 10, retries = 3)
- # open socket
- socket = nil
- for i in 1..retries
- begin
- timeout(sec) do
- socket = TCPSocket.open( ip, port )
- end
- rescue Timeout::Error
- log.warn("Connection Timed Out!") if not log.nil?
- socket = nil
- rescue => e # unknown exception
- log.warn("TCPSocket Error: #{e.message}") if not log.nil?
- socket = nil
- end
- if not socket.nil? then break end
- log.warn("Retrying...") if not log.nil? and i < retries
- end
-
- # refused
- if socket.nil? then
- return nil
- end
-
- if log.nil? then
- log = DummyLog.new
- end
-
- return new(socket, log)
- end
-
- def get_error_msg()
- return @error_msg
- end
-
- def get_job_id
- return @job_id
- end
-
- def get_job_status
- return @job_status
- end
-
- def get_job_error
- return @job_status
- end
-
- def set_error_msg( msg )
- @error_msg = msg
- end
-
-
- def send( msg )
- if @socket.nil? then
- @error_msg = "Connection is not available!"
- return false
- end
- begin
- @socket.puts( msg )
- rescue => e
- @error_msg = e.message
- return false
- end
-
- return true
- end
-
-
- # handle
- def read_lines(begin_timeout = nil, data_timeout = nil)
-
- result = true
- begin
- # get first line
- l = nil
- if begin_timeout.nil? then
- begin_timeout = FIRST_RESPONSE_TIMEOUT
- end
-
- timeout( begin_timeout ) do
- l = @socket.gets()
- end
-
- if l.nil? then
- @error_msg = "Connection closed or No more message"
- return false
- end
-
- # check protocol
- if not protocol_matched? l.strip then
- @error_msg = "Comm. Protocol version is mismatched! #{VERSION}. Upgrade your DIBS client!"
- return false
- end
-
- # get contents
- while true
- line = nil
- if not data_timeout.nil? then
- timeout( data_timeout ) do
- line = @socket.gets()
- end
- else
- line = @socket.gets()
- end
-
- if line.nil? then
- @error_msg = "Disconnected by remote server!"
- result = false
- break
- elsif line.strip == "=END" then
- break
- elsif line.strip == "=CHK" then
- next
- end
-
- # execute
- yield line.strip if block_given?
- end
- rescue Timeout::Error
- @error_msg = "Connection timed out!"
- result = false
-
- rescue => e
- @error_msg = e.message
- result = false
- end
-
- return result
- end
-
-
- # return result
- def receive_data
- result = []
-
- begin
- l = nil
- timeout(FIRST_RESPONSE_TIMEOUT) do
- l = @socket.gets()
- end
-
- if l.nil? then
- @error_msg = "Connection closed or No more message"
- return nil
- end
-
- # check protocol
- if not protocol_matched? l.strip then
- @error_msg = "Comm. Protocol version is mismatched! #{VERSION}. Upgrade your DIBS client!"
- return nil
- end
-
- # get contents
- while line = @socket.gets()
- if line.strip == "=END" then break end
- if line.strip == "=CHK" then next end
- # print
- result.push line.strip
- end
-
- rescue Timeout::Error
- @error_msg = "Connection timed out!"
- return nil
-
- rescue => e
- @error_msg = e.message
- return nil
- end
-
- return result
- end
-
-
- def send_file(src_file, transporter )
-
- result = true
- begin
- l = @socket.gets()
- if l.nil? then
- @log.error "[BuildCommClient] Connection refused"
- return false
- end
-
- # check protocol
- if not protocol_matched? l.strip then
- @log.error "[BuildCommClient] Comm. Protocol version is mismatched! #{VERSION}. Upgrade your DIBS client!"
- return false
- end
-
- while line = @socket.gets()
- cmd = line.split(",")[0].strip
- case cmd
- when "READY"
- @log.info "Server is ready!"
- file_name = File.basename(src_file)
- file_size = File.size(src_file)
- checksum = Utils.checksum(src_file)
- send "CHECK_CACHE,#{file_name},#{file_size},#{checksum}"
-
- when "CACHED"
- @log.info "Server already has cached file"
- break
-
- when "NOT_CACHED"
- @log.info "Server does not have cached file"
- send "CHECK_TRANSPORTER,#{transporter.type}"
-
- when "TRANSPORTER_OK"
- if not transporter.send_file( src_file, @socket, true ) then
- result = false
- else
- @log.info "Sending file succeeded!"
- end
-
- when "TRANSPORTER_FAIL"
- @log.warn "Server does not support transporter type: #{transporter.type}"
- result = false
-
- when "ERROR"
- result = false
-
- when "=END"
- break
-
- else
- @log.warn "Unhandled message: #{line}"
- end
- end
- rescue => e
- puts "[BuildCommClient] Exception"
- @log.error e.message
- @log.error e.backtrace.inspect
- return false
- end
-
- return result
- end
-
-
- # return file
- def receive_file(dst_file, transporter)
- result = true
-
- begin
- l = @socket.gets()
-
- if l.nil? then
- @log.error "[BuildCommClient] Connection refused"
- return false
- end
-
- # check protocol
- if not protocol_matched? l.strip then
- @log.error "[BuildCommClient] Comm. Protocol version is mismatched! #{VERSION}. Upgrade your DIBS client!"
- return false
- end
-
- while line = @socket.gets()
- cmd = line.split(",")[0].strip
- case cmd
- when "READY"
- @log.info "Server is ready!"
- send "CHECK_TRANSPORTER,#{transporter.type}"
-
- when "TRANSPORTER_OK"
- if not transporter.receive_file( dst_file, @socket, true ) then
- result = false
- else
- @log.info "Receiving file succeeded!"
- end
-
- when "ERROR"
- result = false
-
- when "=END"
- break
-
- else
- @log.warn "Unhandled message: #{line}"
- end
- end
- rescue => e
- puts "[BuildCommServer] Exception"
- @log.error e.message
- @log.error e.backtrace.inspect
- return false
- end
-
- return result
- end
-
-
- def terminate
- @socket.close
- end
-
-
- private
-
-
- # check protocol
- def protocol_matched?(l)
-
- version = ( l.split(",")[1].nil? ? "1.0.0" : l.split(",")[1] )
- if not l.start_with? "=BEGIN" or
- version.nil? or version != VERSION then
- return false
- else
- return true
- end
- end
-end
+++ /dev/null
-=begin
-
- FileTransferViaDirect.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'socket'
-require 'log'
-
-class FileTransferDirect
- attr_accessor :type
-
- def initialize(logger)
- @type = "DIRECT"
-
- if not logger.nil? then
- @log = logger
- else
- @log = DummyLog.new
- end
- end
-
-
- def send_file( src_file, conn, is_client=true )
-
- filename = File.basename(src_file)
- size = File.size( src_file )
- checksum = Utils.checksum( src_file )
-
- if is_client then
- conn.puts "RECEIVE_REQ"
- end
-
- while line = conn.gets()
- tok = line.split(",") { |x| x.strip }
- cmd = tok[0].strip
- case cmd
- when "SEND_REQ"
- conn.puts "FILE_INFO,#{filename},#{size},#{checksum}"
-
- full_size = size
- old_progress = 0
- # read file contents
- # send via tcp/ip
- trBegin = Time.now()
- File.open(src_file, "rb") do |io|
- while size > 0
- buf = io.read(size > 1024*1024 ? 1024*1024 : size)
- conn.write( buf )
- size -= buf.length
-
- progress = ((( full_size - size ) * 10 ) / full_size )
- if not progress.eql? old_progress then
- @log.info "File transfer : #{progress}0 %"
- old_progress = progress
- end
- end
- end
- trEnd = Time.now()
- if (trEnd - trBegin) != 0 then
- trRate = (full_size / (trEnd - trBegin) / 1000).to_i
- else
- trRate = 10000
- end
- @log.info "Upload is succeeded! #{trRate}KByte/s"
- conn.puts "SEND_OK"
-
- # wait for download result
- when "RECEIVE_OK"
- @log.info "Received download success message from remote site"
- return true
-
- when "RECEIVE_FAIL"
- @log.info "Received download fail message from remote site"
- return false
-
- else
- @log.error "Unhandled message: #{line}"
- return false
- end
- end
- end
-
-
- def receive_file( dst_file, conn, is_client=false )
-
- if is_client then
- conn.puts "SEND_REQ"
- end
-
- while line = conn.gets()
- tok = line.split(",") { |x| x.strip }
- cmd = tok[0].strip
- case cmd
- when "RECEIVE_REQ"
- conn.puts "SEND_REQ"
- when "FILE_INFO"
- @log.info "Received file info from remote site"
- filename = tok[1].strip
- size = tok[2].strip.to_i
- full_size = size
- checksum = tok[3].strip
-
- if File.directory? dst_file then
- dst_file = File.join(dst_file, filename)
- end
-
- trBegin = Time.now()
- File.open( dst_file, "wb" ) do |io|
- while size > 0
- buf = conn.read(size > 1024*1024 ? 1024*1024 : size)
- if buf.nil? then
- @log.error "Reading data from connection failed!"
- return false
- end
- io.write( buf )
- size -= buf.length
- end
- end
- trEnd = Time.now()
- trRate = (full_size / (trEnd - trBegin) / 1000).to_i
- @log.info "Download is succeeded! #{trRate}KByte/s"
-
- conn.puts "RECEIVE_OK"
-
- when "SEND_OK"
- @log.info "Received success message from remote site"
- return true
-
- else
- @log.error "Unhandled message: #{line}"
- return false
- end
- end
- end
-end
+++ /dev/null
-=begin
-
- FileTransferViaFTP.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'socket'
-require 'log'
-
-class FileTransferFTP
- attr_accessor :type
- ATTEMPTS = ["first", "second", "third"]
-
- def initialize(logger, ip=nil, port=nil, username=nil, passwd=nil )
- @type = "FTP"
- @ip = ip
- @port = port
- @username = username
- @passwd = passwd
- if not logger.nil? then
- @log = logger
- else
- @log = DummyLog.new
- end
- end
-
-
- def send_file( src_file, conn, is_client=true )
-
- if is_client then
- # check ftp info
- if @ip.nil? or @port.nil? or @username.nil? or @passwd.nil? then
- @log.error "No FTP information!"
- conn.puts "UPLOAD_FAIL"
- return false
- end
- conn.puts "DOWNLOAD_REQ,#{@ip},#{@port},#{@username},#{@passwd}"
- end
-
- ip = @ip; port = @port; username = @username; passwd = @passwd
- while line = conn.gets()
- tok = line.split(",") { |x| x.strip }
- cmd = tok[0].strip
- case cmd
- when "UPLOAD_REQ"
- if @ip.nil? or @port.nil? or @username.nil? or @passwd.nil? then
- ip = tok[1].strip
- port = tok[2].strip
- username = tok[3].strip
- passwd = tok[4].strip
- @log.info "Using FTP information from remote... [#{ip}, #{port}]"
- end
-
- # upload to ftp
- ftp_filepath = nil
- for attempt in ATTEMPTS
- ftp_filepath = putfile( src_file, ip, port, username, passwd )
- if !ftp_filepath.nil? then
- break
- else
- @log.info "The #{attempt} uploading attempt failed!"
- end
- end
-
- if ftp_filepath.nil? then
- conn.puts "UPLOAD_FAIL"
- return false
- else
- @log.info "Upload is succeeded at #{attempt}"
- conn.puts "UPLOAD_OK,#{ftp_filepath}"
- end
-
- # wait for download result
- when "DOWNLOAD_OK"
- @log.info "Received download success message from remote site"
- # clean
- cleandir( ftp_filepath, ip, port, username, passwd)
- @log.info "Cleaned temporary dir on FTP server: #{ftp_filepath}"
- return true
-
- when "DOWNLOAD_FAIL"
- @log.info "Received download fail message from remote site"
- return false
-
- else
- @log.error "Unhandled message: #{line}"
- return false
- end
- end
- end
-
-
- def receive_file( dst_file, conn, is_client=false )
-
- if is_client then
- # check ftp info
- if @ip.nil? or @port.nil? or @username.nil? or @passwd.nil? then
- @log.error "No FTP information!"
- conn.puts "DOWNLOAD_FAIL"
- return false
- end
- conn.puts "UPLOAD_REQ,#{@ip},#{@port},#{@username},#{@passwd}"
- end
-
- ip = @ip; port = @port; username = @username; passwd = @passwd
- while line = conn.gets()
- tok = line.split(",") { |x| x.strip }
- cmd = tok[0].strip
- case cmd
- when "DOWNLOAD_REQ"
- if @ip.nil? or @port.nil? or @username.nil? or @passwd.nil? then
- ip = tok[1].strip
- port = tok[2].strip
- username = tok[3].strip
- passwd = tok[4].strip
- @log.info "Using FTP information from remote... [#{ip}, #{port}]"
- end
-
- conn.puts "UPLOAD_REQ,#{ip},#{port},#{username},#{passwd}"
- when "UPLOAD_OK"
- @log.info "Received upload success message from remote site"
- filepath = tok[1].strip
- # download from ftp
- dst_filepath = nil
- for attempt in ATTEMPTS
- dst_filepath = getfile( filepath, dst_file, ip, port, username, passwd )
- if not dst_filepath.nil? then
- break
- else
- @log.info "The #{attempt} downloading attempt failed!"
- end
- end
- if dst_filepath.nil? then
- conn.puts "DOWNLOAD_FAIL"
- return false
- else
- @log.info " Server is the #{attempt} successful attempt to download"
- conn.puts "DOWNLOAD_OK"
- return true
- end
-
- when "UPLOAD_FAIL"
- @log.info "Received upload fail message from remote site"
- return false
-
- else
- @log.error "Unhandled message: #{line}"
- return false
- end
- end
- end
-
-
- def putfile( bpath, ip, port, username, passwd )
- filename = File.basename(bpath)
- uniqdir = Utils.create_uniq_name
- ftp_filepath = File.join(uniqdir, filename)
-
- begin
- ftp = Net::FTP.new
- if port.nil? or port == "" then
- ftp.connect(ip)
- else
- ftp.connect(ip, port)
- end
- @log.info "[FTP log] Connected FTP server (#{ip}:#{port})"
- ftp.login(username, passwd)
- ftp.binary = true
- ftp.passive = true
- ftp.mkdir(uniqdir)
- ftp.chdir(uniqdir)
- ftp.put(bpath)
- @log.info "[FTP log] Put a file"
- @log.info "[FTP log] from \"#{bpath}\" to \"#{ftp_filepath}\""
- files = ftp.list(filename)
- if files.empty? then
- @log.error "[FTP log] Failed to upload file (#{filename} does not exist)"
- return nil
- end
- ftp.quit
- @log.info "[FTP log] Disconnected FTP server"
- rescue => e
- @log.error "[FTP log] Exception"
- @log.error e.message
- @log.error e.backtrace.inspect
- return nil
- end
- return ftp_filepath
- end
-
- def getfile( bpath, target, ip, port, username, passwd )
- dirname = File.dirname(bpath)
- filename = File.basename(bpath)
-
- # target can be directory or file
- if File.directory? target then
- dst_file = File.join(target,filename)
- else
- dst_file = target
- end
-
- begin
- ftp = Net::FTP.new
- if port.nil? or port == "" then
- ftp.connect(ip)
- else
- ftp.connect(ip, port)
- end
- @log.info "[FTP log] Connected FTP server (#{ip}:#{port})"
- ftp.login(username, passwd)
- ftp.binary = true
- ftp.passive = true
- ftp.chdir(dirname)
- ftp.get(filename, dst_file)
- @log.info "[FTP log] Get a file"
- @log.info "[FTP log] from \"#{bpath}\" to \"#{dst_file}\""
- ftp.quit
- @log.info "[FTP log] Disconnected FTP server"
- rescue => e
- @log.error "[FTP log] Exception"
- @log.error e.message
- @log.error e.backtrace.inspect
- return nil
- end
- if not File.exist? dst_file then
- @log.error "[FTP log] Failed to download file (#{dst_file} does not exist)"
- return nil
- end
- return bpath
- end
-
- def cleandir(path, ip, port, username, passwd)
- dirname = File.dirname(path)
-
- begin
- ftp = Net::FTP.new
- if port.nil? or port == "" then
- ftp.connect(ip)
- else
- ftp.connect(ip, port)
- end
- @log.info "[FTP log] Connected FTP server (#{ip}:#{port})"
- ftp.login(username, passwd)
- old_dir = ftp.pwd
- ftp.chdir(dirname)
- list = ftp.ls
- # TODO: if list is directory?
- list.each do |l|
- file = l.split(" ")[-1].strip
- ftp.delete(file)
- end
- ftp.chdir(old_dir)
- ftp.rmdir(dirname)
- @log.info "[FTP log] Clean dir (#{dirname})"
- ftp.quit
- @log.info "[FTP log] Disconnected FTP server"
- rescue => e
- @log.error "[FTP log] Exception"
- @log.error e.message
- @log.error e.backtrace.inspect
- return nil
- end
-
- return true
- end
-end
+++ /dev/null
-require "fileutils"
-
-class FileUtil
- public
- def FileUtil.getFileNameFromURL(url)
- fileName = url.split('/')[-1]
- return fileName
- end
-
- public
- def FileUtil.getFlatURL(url)
- if url.nil? or url.empty? then
- return ""
- end
-
- return url.delete(".:/@")
- end
-
- public
- def FileUtil.exclusiveLock(filePath)
- if (not File.exist?(filePath))
- FileUtils.mkdir_p(filePath)
- end
-
- file = File.new(filePath)
- if (file.flock(File::LOCK_EX | File::LOCK_NB))
- return true;
- else
- return false
- end
- end
-
- public
- def FileUtil.safeLink(target, linkname, force = true)
- # linkname can be a file or a directory
- #
- # if linkname does not exist, it sould be a filename.
- # - File.dirname(linkpath) should exists and be a directory.
- # if linkname does exist, it should be a directory.
- # - if it is a file, FileUtils.ln() will be a error.
- # - if it is a file, FileUtils.cp() will be finished successfully.
- linkpath = linkname
- if not File.exist? linkname then
- linkpath = File.dirname(linkname)
- end
-
- # both target and linkpath should exist.
- if not File.exist? target and not File.exist? linkpath then
- return false
- end
-
- # compare device between target and linkpath
- # - execute ln if it is same device
- # - execute cp if it is different device
- target_device = File.stat(target).dev
- linkpath_device = File.stat(linkpath).dev
- if target_device.eql? linkpath_device then
- FileUtils.ln(target, linkname, :force => force)
- else
- FileUtils.cp(target, linkname)
- end
-
- return true
- end
-end
+++ /dev/null
-=begin
-
- PackageManifest.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "parser"
-
-class PackageManifest
- attr_accessor :packages
-
- def initialize( file_path )
- @packages = Parser.read_multy_pkginfo_from file_path
- end
-
-
- # scan all build dependencies
- def get_build_dependencies( target_os )
- # for all
- list = []
- @packages.each do |pkg|
- # package that has the target os
- if not pkg.os_list.include?(target_os)
- next
- end
-
- # package that has the target os
- pkg.build_dep_list.each do |dep|
- list.push dep
- end
- end
- list.uniq!
-
- return list
- end
-
-
- # scan all source dependencies
- def get_source_dependencies( target_os, host_os )
- # for all
- list = []
- @packages.each do |pkg|
- # only package that used in target os
- if not pkg.os_list.include?(target_os)
- next
- end
-
- # package that has the host os
- if not pkg.build_host_os.include?(host_os)
- next
- end
-
- # package that has the target os
- pkg.source_dep_list.each do |dep|
- # if dep.target_os_list.include? target_os
- list.push dep
- # end
- end
- end
- list.uniq!
-
- return list
- end
-
-
- # scan all install dependencies
- def get_install_dependencies( target_os, pkg_name=nil )
- # for all
- list = []
- @packages.each do |pkg|
- if not pkg_name.nil? and pkg.package_name != pkg_name then next end
- # only package that used in target os
- if not pkg.os_list.include?(target_os)
- next
- end
-
- # package that has the target os
- pkg.install_dep_list.each do |dep|
- list.push dep
- end
- end
- list.uniq!
-
- return list
- end
-
-
- def package_exist?(target_os, host_os)
- @packages.each do |pkg|
- # only package that used in target os
- if pkg.os_list.include?(target_os) and
- pkg.build_host_os.include?(host_os)
- return true
- end
- end
-
- return false
- end
-
-
- def get_version()
- return @packages[0].version
- end
-
-
- def get_target_packages(target_os)
- pkgs = []
- @packages.each do |pkg|
- if pkg.os_list.include?(target_os) then
- pkgs.push pkg
- end
- end
-
- return pkgs
- end
-
-
- def pkg_exist?(name,ver,os)
- @packages.each do |pkg|
- if pkg.package_name != name then next end
- if not ver.nil? and pkg.version != ver then next end
- if not os.nil? and not pkg.os_list.include?(os) then next end
-
- return true
- end
-
- return false
- end
-end
+++ /dev/null
-#$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common/model"
-require 'model/Property'
-
-class PropertyParser
- attr_accessor :seperate
- def initialize(seperate)
- if seperate.nil? then
- @seperate = ":";
- else
- @seperate = seperate;
- end
- end
-
- public
- def parseFile(filePath)
- propertySection = Array.new;
- properties = Array.new;
-
- f = File.open(filePath,"r");
- f.each_line do |line|
- if line.empty? || line.eql?("\n") then
- if not properties.empty?() then
- propertySection.push(properties);
- properties = Array.new
- end
- else
- sepLine = line.split(@seperate);
- properties.push(Property.new(sepLine[0].strip, sepLine[1].strip))
- end
-
- end
-
- if (not properties.empty?) then
- propertySection.push(properties);
- end
-
- return propertySection;
- end
-end
+++ /dev/null
-=begin
-
- ScheduledActionHandler.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require 'thread'
-
-class ScheduledActionHandler
- attr_accessor :quit, :thread
-
- # init
- def initialize( )
- @thread = nil
- @quit = false
- @actions = []
- @mutex = Mutex.new
- end
-
-
- # register a action
- def register( action )
- # init action
- action.init
- # add to list
- @mutex.synchronize do
- @actions.push action
- end
- end
-
-
- # unregsister a action
- def unregister( action )
- @mutex.synchronize do
- @actions.delete(action)
- end
- end
-
-
- # get all actions
- def get_actions()
- return @actions
- end
-
-
- # start thread
- def start()
- @thread = Thread.new do
- # main
- thread_main()
-
- # close
- terminate()
- end
- end
-
-
- protected
-
- def thread_main
-
- while not @quit
-
- current_time = Time.new
-
- # get list
- action_list = Array.new(@actions)
- action_list.each do |action|
- # if its time is reached, execute action
- if not action.time.nil? and current_time > action.time then
- action.execute
-
- # if periodic action, renew the time
- # else remove it from list
- if action.period != 0 then
- while current_time > action.time
- action.time = action.time + action.period
- end
- else
- unregister(action)
- end
- end
- end
-
- # sleep 10 sec
- sleep 10
- end
- end
-
-
- def terminate
- end
-
-end
+++ /dev/null
-=begin
-
- Version.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-
-class Version < Array
- include Comparable
- def initialize s
- super(s.split('.').map { |e| e.to_i })
- end
- def compare x
- self <=> x
- end
- def to_s
- return self.join(".")
- end
-end
+++ /dev/null
-=begin
-
- db_utils.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class DBUtils
- def DBUtils.dsn_parser (db_dsn)
- dsn_hash={}
- case db_dsn
- when /^SQLite3:/ then
- dsn_hash[:database] = "SQLite3"
- dsn = db_dsn.split(':')
- dsn_hash[:name] = dsn[1].strip
- when /^Mysql:/ then
- dsn_hash[:database] = "Mysql"
- dsn = db_dsn.split(':')
- if dsn[2].nil? then
- dsn[1].split(';').each do |attr|
- case attr.split('=')[0].strip
- when /database/i then
- dsn_hash[:name] = attr.split('=')[1].strip
- when /host/i then
- dsn_hash[:host] = attr.split('=')[1].strip
- when /port/i then
- dsn_hash[:port] = attr.split('=')[1].strip
- when /socket/i then
- dsn_hash[:socket] = attr.split('=')[1].strip
- when /flag/i then
- dsn_hash[:flag] = attr.split('=')[1].strip
- else
- dsn_hash[:etc] = attr.split('=')[1].strip
- end
- end
- else
- dsn_hash[:name] = dsn[1].strip
- dsn_hash[:host] = dsn[2].strip
- end
- end
- return dsn_hash
- end
-end
+++ /dev/null
-=begin
-
- dependency.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "Version"
-
-class Dependency
- attr_accessor :package_name, :comp, :base_version, :target_os_list
- def initialize (package_name, comp, base_version, target_os_list)
- @package_name = package_name
- @comp = comp
- @base_version = base_version
- @target_os_list = target_os_list
- end
-
- def to_s
- string = @package_name
- if not @comp.nil? and not @base_version.nil? then
- string = string + " ( #{@comp} #{@base_version} )"
- end
-
- if not @target_os_list.empty? then
- string = string + " [ #{@target_os_list.join("|")} ]"
- end
- return string
- end
-
- def match? ver
- if @base_version.nil?
- return true
- end
-
- # compare to base version
- if @comp == ">>"
- return Version.new(ver) > Version.new(@base_version)
- elsif @comp == ">="
- return Version.new(ver) >= Version.new(@base_version)
- elsif @comp == "=="
- return Version.new(ver) == Version.new(@base_version)
- elsif @comp == "<="
- return Version.new(ver) <= Version.new(@base_version)
- elsif @comp == "<<"
- return Version.new(ver) < Version.new(@base_version)
- else
- return true
- end
- end
-end
-
+++ /dev/null
-#!/usr/bin/ruby
-=begin
-
- execute_with_log.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'logger'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require 'utils.rb'
-
-# parse arguments
-cmd = ARGV[0]
-log_path = ARGV[1]
-
-# create logger
-if log_path.nil? or log_path.empty? then
- log = DummyLog.new
-else
- log = Logger.new(log_path)
-end
-
-# generate command
-cmd = Utils.generate_shell_command(cmd, nil)
-
-# execute and write log
-IO.popen("#{cmd} 2>&1") do |io|
- io.each do |line|
- log.info "{1} #{line}"
- end
-end
-
-# return exit code
-exit $?.exitstatus
+++ /dev/null
-=begin
-
- log.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "logger"
-
-class Log
-
- attr_accessor :path, :cnt, :logger
-
- # Log LEVEL
- LV_NORMAL = 1
- LV_USER = 2
-
-
- # init
- def initialize(path, lv=LV_USER)
- @cnt = 0
- @path = path
- @level = lv
- @closed = false
- if @path.nil? then
- @logger = Logger.new(STDOUT)
- else
- @logger = Logger.new(path, "monthly")
- end
-
- # diable logger format
- @default_formatter = @logger.formatter
- @no_prefix_formatter = proc do |severity, datetime, progname, msg|
- " >#{msg}"
- end
- end
-
-
- def info(msg, lv=LV_NORMAL)
- if @path.nil? then puts "Info: #{msg}" else @logger.info "{#{lv}} #{msg}" end
- output_extra("Info: " + msg, lv)
- @cnt = @cnt + 1
- end
-
- def warn(msg, lv=LV_NORMAL)
- if @path.nil? then puts "Warn: #{msg}" else @logger.warn "{#{lv}} #{msg}" end
- output_extra("Warn: " + msg, lv)
- @cnt = @cnt + 1
- end
-
-
- def error(msg, lv=LV_NORMAL)
- if @path.nil? then puts "Error: #{msg}" else @logger.error "{#{lv}} #{msg}" end
- output_extra("Error: " + msg, lv)
- @cnt = @cnt + 1
- end
-
-
- def output(msg, lv=LV_NORMAL)
- if @path.nil? then puts msg else @logger.info "{#{lv}} #{msg}" end
- output_extra(msg, lv)
- @cnt = @cnt + 1
- end
-
- def close
- @closed = true
- end
-
-
- def is_closed?
- return @closed
- end
-
- protected
- def output_extra(msg, lv)
- #do nothing
- end
-end
-
-
-class DummyLog
- attr_accessor :path, :cnt
- def initialize()
- @path = ""
- @cnt = 0
- end
- def info(str, lv=nil)
- puts "I, [#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")}] INFO -- : " + str
- end
- def error(str, lv=nil)
- puts "E, [#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")}] ERROR -- : " + str
- end
- def warn(str, lv=nil)
- puts "W, [#{Time.now.strftime("%Y-%m-%dT%H:%M:%S")}] WARN -- : " + str
- end
- def output(str, lv=nil)
- puts "" + str
- end
-end
-
-
-class StandardOutLog < Log
-
- def initialize(path)
- super(path)
- end
-
- protected
- def output_extra(msg, lv)
- if lv >= @level then
- $stdout.puts msg
- end
- end
-end
-
-
-class StandardOutLogPrinter < Log
-
- def initialize()
- super(nil)
- end
-
- def info(msg, lv=LV_NORMAL)
- if lv >= @level then
- puts "Info: #{msg}"
- @cnt = @cnt + 1
- end
- end
-
- def warn(msg, lv=LV_NORMAL)
- if lv >= @level then
- puts "Warn: #{msg}"
- @cnt = @cnt + 1
- end
- end
-
-
- def error(msg, lv=LV_NORMAL)
- if lv >= @level then
- puts "Error: #{msg}"
- @cnt = @cnt + 1
- end
- end
-
-
- def output(msg, lv=LV_NORMAL)
- if lv >= @level then
- puts msg
- @cnt = @cnt + 1
- end
- end
-end
+++ /dev/null
-SENDER = "sdk.slp@samsung.com"
-SERVER_ADDR = "http://172.21.17.46:8080"
+++ /dev/null
-class Property
- attr_accessor(:key, :value)
-
- def initialize(key, value)
- @key = key;
- @value = value;
- end
-end
\ No newline at end of file
+++ /dev/null
-=begin
-
- package.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-class Package
- attr_accessor :package_name, :label, :os, :build_host_os, :maintainer, :attribute, :install_dep_list, :build_dep_list, :source_dep_list, :conflicts, :source, :src_path, :path, :origin, :checksum, :size, :uncompressed_size, :description, :os_list, :custom, :change_log
- def initialize (package_name)
- @package_name = package_name
- @label = ""
- @version = nil
- @os = ""
- @os_list = []
- @build_host_os = []
- @maintainer = ""
- @attribute = []
- @install_dep_list = []
- @build_dep_list = []
- @source_dep_list = []
- @conflicts = []
- @source = ""
- @src_path = ""
- @path = ""
- @origin = ""
- @checksum = ""
- @size = ""
- @uncompressed_size = ""
- @description = ""
- @custom = ""
- @change_log = {}
- end
-
- def print
- puts self.to_s
- end
-
- def version
- return @version.to_s
- end
-
- def version= (str)
- @version = Version.new(str)
- end
-
- def to_s
- string = "Package : " + @package_name
- if not @label.empty? then string = string + "\n" + "Label : " + @label end
- if not @version.nil? then string = string + "\n" + "Version : " + @version.to_s end
- if not @os_list.empty? then string = string + "\n" + "OS : " + @os_list.join(", ") end
- if not @build_host_os.empty? then string = string + "\n" + "Build-host-os : " + @build_host_os.join(", ") end
- if not @maintainer.empty? then string = string + "\n" + "Maintainer : " + @maintainer end
- if not @attribute.empty? then string = string + "\n" + "Attribute : " + @attribute.join("|") end
- if not @install_dep_list.empty? then
- string = string + "\n" + "Install-dependency : " + @install_dep_list.map {|x| x.to_s}.join(", ")
- end
- if not @build_dep_list.empty? then
- string = string + "\n" + "Build-dependency : " + @build_dep_list.map {|x| x.to_s}.join(", ")
- end
- if not @source_dep_list.empty? then
- string = string + "\n" + "Source-dependency : " + @source_dep_list.map {|x| x.to_s}.join(", ")
- end
- if not @conflicts.empty? then
- string = string + "\n" + "Conflicts : " + @conflicts.map {|x| x.to_s}.join(", ")
- end
- if not @source.empty? then string = string + "\n" + "Source : " + @source end
- if not @src_path.empty? then string = string + "\n" + "Src-path : " + @src_path end
- if not @path.empty? then string = string + "\n" + "Path : " + @path end
- if not @origin.empty? then string = string + "\n" + "Origin : " + @origin end
- if not @checksum.empty? then string = string + "\n" + "SHA256 : " + @checksum end
- if not @size.empty? then string = string + "\n" + "Size : " + @size end
- if not @uncompressed_size.empty? then string = string + "\n" + "Uncompressed-size : " + @uncompressed_size end
- if not @custom.empty? then string = string + "\n" + @custom end
- if not @description.empty? then string = string + "\n" + "Description : " + @description end
- return string
- end
-
- def print_to_file(file)
- file.puts self.to_s
- end
-
- def change_log_string
- if @change_log.empty? then return "" end
-
- string = ""
- @change_log.sort.each do |list|
- string = "* " + list[0].to_s + "\n" + list[1] + "\n" + string
- end
- return "#Change log\n" + string
- end
-
- def does_change_exist?
- if not @change_log[@version].nil? then
- return true
- end
- return false
- end
-
- def get_changes
- return @change_log[@version]
- end
-end
+++ /dev/null
-=begin
-
- parser.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-require "package"
-require "dependency"
-
-class Parser
- def Parser.read_multy_pkginfo_from (file, only_common = false)
- pkglist = []
- package = nil
- common_source = ""
- common_version = ""
- common_maintainer = ""
- change_log = {}
- multi_line = nil
- change_version = nil
- change_contents = ""
-
- #file check
-
- File.open file,"r" do |f|
- #variable initialize
- state = "INIT"
- f.each_line do |l|
- l.tr!("\r","")
- # commant
- if l.strip.start_with? "#" then next end
-
- field_name = l.split(':')[0]
-
- case state
- when "INIT" then
- case field_name
- when /^[ \t]*$/ then next
- when /^[ \t]*Source[ \t]*$/i then
- state = "COMMON"
- if common_source.empty? then common_source = l.sub(/^[ \t]*Source[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- when /^[ \t]*Version[ \t]*$/i then
- state = "COMMON"
- if common_version.empty? then common_version = check_version l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- when /^[ \t]*Maintainer[ \t]*$/i then
- state = "COMMON"
- if common_maintainer.empty? then common_maintainer = l.sub(/^[ \t]*Maintainer[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- when /^[ \t]*Package[ \t]*$/i then
- state = "PACKAGE"
- package_name = l.sub(/^[ \t]*Package[ \t]*:[ \t]*/i,"").strip
- if not package_name.empty? then
- package = Package.new(package_name)
- package.source = common_source
- package.version = common_version
- package.maintainer = common_maintainer
- else
- raise RuntimeError, "Package name is not set in \"#{file}\" file"
- end
- when /^\*[ \t]*([0-9][.0-9]*)[ \t]*$/ then
- state = "CHANGELOG"
- change_log[change_version] = change_contents.strip if not change_version.nil?
- change_version = Version.new($1)
- change_contents = ""
- when /^[ \t]*Include[ \t]*$/i then
- pfile = File.dirname(file) + "/" + l.sub(/^[ \t]*Include[ \t]*:[ \t]*/i,"").strip
- if File.exist? pfile then
- pkglist = pkglist + (Parser.read_multy_pkginfo_from pfile)
- list = Parser.read_multy_pkginfo_from(pfile, true)
- common_source = list[0] if common_source.empty?
- common_version = list[1] if common_version.empty?
- common_maintainer = list[2] if common_maintainer.empty?
- change_log = list[3] if change_log.empty?
- else
- raise RuntimeError, "Not exist \"#{pfile}\""
- end
- when /^[ \t]*ORIGIN[ \t]*$/ then #for compatable
- multi_line = nil
- next
- else raise RuntimeError, "Can't parse below line in \"#{file}\" file \n\t#{l}"
- end
- when "COMMON" then
- case field_name
- when /^[ \t]*$/ then state = "INIT"
- when /^[ \t]*Source[ \t]*$/i then
- state = "COMMON"
- if common_source.empty? then common_source = l.sub(/^[ \t]*Source[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- when /^[ \t]*Version[ \t]*$/i then
- state = "COMMON"
- if common_version.empty? then common_version = check_version l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- when /^[ \t]*Maintainer[ \t]*$/i then
- state = "COMMON"
- if common_maintainer.empty? then common_maintainer = l.sub(/^[ \t]*Maintainer[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- when /^[ \t]*ORIGIN[ \t]*$/ then #for compatable
- multi_line = nil
- next
- else raise RuntimeError, "Can't parse below line in \"#{file}\" file \n\t#{l}"
- end
- when "PACKAGE" then
- case field_name
- when /^[ \t]*$/ then
- state = "INIT"
- if not package.package_name.empty? then
- pkglist.push package
- package = nil
- else raise RuntimeError, "Package name is not set in \"#{file}\" file"
- end
- multi_line = nil
- when /^[ \t]*Source[ \t]*$/i then
- if common_source.empty? and package.source.empty? then package.source = l.sub(/^[ \t]*Source[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- multi_line = nil
- when /^[ \t]*Version[ \t]*$/i then
- if common_version.empty? and package.version.empty? then package.version = check_version l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- multi_line = nil
- when /^[ \t]*Maintainer[ \t]*$/i then
- if common_maintainer.empty? and package.maintainer.empty? then package.maintainer = l.sub(/^[ \t]*Maintainer[ \t]*:[ \t]*/i,"").strip
- else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
- end
- multi_line = nil
- when /^[ \t]*OS[ \t]*$/i then
- package.os_list = l.sub(/^[ \t]*OS[ \t]*:[ \t]*/i,"").tr(" \t\n\r", "").split(",")
- package.os = package.os_list[0]
- multi_line = nil
- when /^[ \t]*Label[ \t]*$/i then
- package.label = l.sub(/^[ \t]*Label[ \t]*:[ \t]*/i,"").strip
- multi_line = nil
- when /^[ \t]*Build-host-os[ \t]*$/i then
- package.build_host_os = l.sub(/^[ \t]*Build-host-os[ \t]*:[ \t]*/i,"").tr(" \t\n\r", "").split(",")
- multi_line = nil
- when /^[ \t]*Attribute[ \t]*$/i then
- package.attribute = l.sub(/^[ \t]*Attribute[ \t]*:[ \t]*/i,"").tr(" \t\n\r","").split("|")
- multi_line = nil
- when /^[ \t]*Install-dependency[ \t]*$/i then
- package.install_dep_list = dep_parser l.sub(/^[ \t]*Install-dependency[ \t]*:[ \t]*/i,"").split(',')
- multi_line = nil
- when /^[ \t]*Build-dependency[ \t]*$/i then
- package.build_dep_list = dep_parser l.sub(/^[ \t]*Build-dependency[ \t]*:[ \t]*/i,"").split(',')
- multi_line = nil
- when /^[ \t]*Source-dependency[ \t]*$/i then
- package.source_dep_list = dep_parser l.sub(/^[ \t]*Source-dependency[ \t]*:[ \t]*/i,"").split(',')
- multi_line = nil
- when /^[ \t]*Conflicts[ \t]*$/i then
- package.conflicts = dep_parser l.sub(/^[ \t]*Conflicts[ \t]*:[ \t]*/i,"").split(',')
- multi_line = nil
- when /^[ \t]*Src-path[ \t]*$/i then
- package.src_path = l.sub(/^[ \t]*Src-path[ \t]*:[ \t]*/i,"").strip
- multi_line = nil
- when /^[ \t]*Path[ \t]*$/i then
- package.path = l.sub(/^[ \t]*Path[ \t]*:[ \t]*/i,"").strip
- multi_line = nil
- when /^[ \t]*Origin[ \t]*$/i then
- package.origin = l.sub(/^[ \t]*Origin[ \t]*:[ \t]*/i,"").strip
- multi_line = nil
- when /^[ \t]*SHA256[ \t]*$/i then
- package.checksum = l.sub(/^[ \t]*SHA256[ \t]*:[ \t]*/i,"").strip
- multi_line = nil
- when /^[ \t]*Size[ \t]*$/i then
- package.size = l.sub(/^[ \t]*Size[ \t]*:[ \t]*/i,"").strip
- multi_line = nil
- when /^[ \t]*Uncompressed-size[ \t]*$/i then
- package.uncompressed_size = l.sub(/^[ \t]*Uncompressed-size[ \t]*:[ \t]*/i,"").strip
- multi_line = nil
- when /^[ \t]*Description[ \t]*$/i then
- package.description = l.sub(/^[ \t]*Description[ \t]*:[ \t]*/i,"").strip
- multi_line = "Description"
- when /^[ \t]*ORIGIN[ \t]*$/ then #for compatable
- multi_line = nil
- next
- when /^[ \t]*C-/ then
- if package.custom.empty? then package.custom = l.rstrip
- else package.custom = package.custom + "\n" + l.rstrip
- end
- multi_line = "Custom"
- else
- if multi_line.nil? then raise RuntimeError, "Can't parse below line in \"#{file}\" file \n\t#{l}" end
- case multi_line
- when "Description" then package.description = package.description + "\n" + l.rstrip
- when "Custom" then package.custom = package.custom + "\n" + l.rstrip
- else raise RuntimeError, "Can't parse below line in \"#{file}\" file \n\t#{l}"
- end
- end
- when "CHANGELOG" then
- case field_name
- when /^[ \t]*$/ then
- state = "INIT"
- if not change_version.nil? then
- if change_log[change_version].nil? then change_log[change_version] = change_contents.strip
- else raise RuntimeError, "change log version is duplicated in \"#{file}\" file \n\t#{l}"
- end
- end
- change_version = nil
- change_contents = ""
- when /^\*[ \t]*([0-9][.0-9]*)[ \t]*$/ then
- if not change_version.nil? then
- if change_log[change_version].nil? then change_log[change_version] = change_contents.strip
- else raise RuntimeError, "change log version is duplicated in \"#{file}\" file \n\t#{l}"
- end
- end
- change_version = Version.new($1)
- change_contents = ""
- else
- change_contents = change_contents + "\n" + l.rstrip
- end
- else raise RuntimeError, "UNKNOWN state #{field_name}"
- end
- end
-
- # check last package
- if not package.nil? then pkglist.push package end
- if not change_version.nil? then
- if change_log[change_version].nil? then change_log[change_version] = change_contents.strip
- else raise RuntimeError, "change log version is duplicated in \"#{file}\" file \n\t#{change_version.to_s}"
- end
- end
- pkglist.each {|pkg| pkg.change_log = change_log }
- end
- if only_common then return [common_source, common_version, common_maintainer, change_log] end
- return pkglist
- end
-
- def Parser.check_version(version)
- if not version =~ /^[0-9][.0-9]*$/ then
- raise RuntimeError, "Version format not matched \"#{version}\"\nVersion format must be \"{digit}.{digit}...\""
- end
- return version
- end
-
- def Parser.read_changelog(file)
- return read_multy_pkginfo_from(file,true)[3]
- end
-
- def Parser.read_single_pkginfo_from (file)
- return read_multy_pkginfo_from(file)[0]
- end
-
- def Parser.read_repo_pkg_list_from (file)
- result = {}
- read_multy_pkginfo_from(file).each { |x| result[x.package_name]=x }
- return result
- end
-
- #for test
- def Parser.print (array)
- array.each do |package|
- puts package.to_s
- puts ""
- end
- end
-
- private
- def Parser.dep_parser (string_list)
- dependency_list = []
- string_list.each do |dep|
- #variable initialize
- package_name = ""
- comp = nil
- base_version = nil
- target_os_list = []
- #string trim
- dependency = dep.tr " \t\r\n", ""
- #version extract
- vs = dependency.index('(')
- ve = dependency.index(')')
- if not vs.nil? and not ve.nil? then
- comp = dependency[(vs+1)..(vs+2)]
- base_version = dependency[(vs+3)..(ve-1)]
- end
- #os list extract
- os = dependency.index('[')
- oe = dependency.index(']')
- if not os.nil? and not oe.nil? then
- target_os_list = dependency[(os+1)..(oe-1)].split("|")
- end
- # package_name extract
- pe = dependency.index(/[\]\[\)\(]/)
- if pe.nil?
- package_name = dependency
- else
- package_name = dependency[0..pe-1]
- end
- #package_name check
- if not package_name.empty? then
- dependency_list.push Dependency.new(package_name,comp,base_version,target_os_list)
- end
- end
- return dependency_list
- end
-end
+++ /dev/null
-=begin
-
- utils.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-require 'rbconfig'
-require 'find'
-
-class Utils
- STARTUP_INFO_SIZE = 68
- PROCESS_INFO_SIZE = 16
- NORMAL_PRIORITY_CLASS = 0x00000020
-
- def Utils.identify_current_OS()
- os = "UnsupportedOS"
-
- case `uname -s`.strip
- when "Linux"
- arch = `getconf LONG_BIT`.strip
- arch = "unknown" if arch.length != 2
- if File.exist? "/etc/debian_version" then
- os = "ubuntu-#{arch}"
- elsif File.exist? "/etc/redhat-release" then
- os = "redhat-#{arch}"
- elsif File.exist? "/etc/SuSE-release" then
- os = "opensuse-#{arch}"
- elsif File.exist? "/etc/mandrake-release" then
- os = "mandrake-#{arch}"
- else
- os = "unknownlinux-#{arch}"
- end
- when "MINGW32_NT-5.1"
- progfile_path = Utils.execute_shell_return("echo $PROGRAMFILES","windows")[0].strip
- if progfile_path.include?("(x86)") then arch = "64" else arch = "32" end
- os = "windows-#{arch}"
- when "MINGW32_NT-6.1"
- progfile_path = Utils.execute_shell_return("echo $PROGRAMFILES","windows")[0].strip
- if progfile_path.include?("(x86)") then arch = "64" else arch = "32" end
- os = "windows-#{arch}"
- when "Darwin"
- os = "macos-64"
- end
-
- return os
- end
-
- def Utils.set_default_linux_host_os()
- HOST_OS.sub!(/.*-/,"ubuntu-")
- end
-
- def Utils.check_host_OS()
- if Utils.get_all_OSs().include? HOST_OS then
- return true
- else
- return false
- end
- end
-
-
- def Utils.get_all_OSs()
- return ["ubuntu-32","ubuntu-64","windows-32","windows-64","macos-64"]
- end
-
-
- def Utils.create_uniq_name
- time = Time.new
-
- # uniq snapshot_name name is year_month_day_hour_min_sec_microsec
- return time.strftime("%m%d%H%M%S") + time.usec.to_s.rjust(6, '0')
- end
-
- def Utils.is_url_remote(url)
- if url.nil? then
- return false
- end
-
- protocol = url.split(':')[0]
-
- case protocol
- when "http" then return true
- when "ftp" then return true
- else return false
- end
- end
-
- # if source_ver > target_ver, return -1
- # if source_ver < target_ver, return 1
- # if source_ver == target_ver, return 0
- def Utils.compare_version(source_ver, target_ver)
- sver = source_ver.split('-')[0]
- tver = target_ver.split('-')[0]
-
- arr_sver = sver.split('.')
- arr_tver = tver.split('.')
-
- slen = arr_sver.length
- tlen = arr_tver.length
- len = tlen
-
- if slen > tlen then
- gap = slen - tlen
- gap.times do
- arr_tver.push("0")
- end
- len = slen
- elsif tlen > slen then
- gap = tlen - slen
- gap.times do
- arr_sver.push("0")
- end
- len = tlen
- end
-
- len.times do |i|
- if arr_sver[i].to_i < arr_tver[i].to_i then
- return 1
- elsif arr_sver[i].to_i > arr_tver[i].to_i then
- return -1
- end
- end
-
- return 0
- end
-
-
- def Utils.generate_shell_command(cmd, os_category = nil)
- if os_category.nil? then os_category = get_os_category( HOST_OS ) end
-
- if os_category == "windows" then
- mingw_path = "sh.exe -c "
- cmd = cmd.gsub("\"", "\\\"")
- cmd = mingw_path + "\"#{cmd}\""
- end
-
- return cmd
- end
-
-
- def Utils.execute_shell(cmd, os_category = nil)
- ret = false
-
- # generate command
- cmd = generate_shell_command(cmd, os_category)
-
- `#{cmd}`
- if $?.to_i == 0 then ret = true else ret = false end
-
- return ret
- end
-
-
- def Utils.execute_shell_return(cmd, os_category = nil)
- result_lines = []
-
- # generate command
- cmd = generate_shell_command(cmd, os_category)
-
- # get result
- IO.popen("#{cmd} 2>&1") do |io|
- io.each do |line|
- result_lines.push line
- end
- end
-
- if $?.to_i == 0 then
- return result_lines
- else
- return nil
- end
- end
-
- def Utils.execute_shell_return_ret(cmd, os_category = nil)
-
- # generate command
- cmd = generate_shell_command(cmd, os_category)
-
- return `#{cmd}`
- end
-
-
- # create process and log its all output(stderr, stdout)
- # can decide whether wait or not
- def Utils.execute_shell_with_log(cmd, log_path, wait=true)
-
- if log_path.nil? or log_path.empty? then
- return execute_shell_with_stdout(cmd, nil)
- end
-
- ruby_path=File.join(Config::CONFIG["bindir"],
- Config::CONFIG["RUBY_INSTALL_NAME"] +
- Config::CONFIG["EXEEXT"])
-
- # call execute
- os_category = get_os_category( HOST_OS )
- if os_category == "windows" then
- cmd = cmd.gsub("\"", "\\\"")
- end
-
- cmd = "#{ruby_path} \"#{File.expand_path(File.dirname(__FILE__))}/execute_with_log.rb\" \"#{cmd}\" \"#{log_path}\""
-
- # print log
- pipe = IO.popen("#{cmd} 2>&1")
- if wait then
- return Process.waitpid2(pipe.pid)
- else
- return [pipe.pid,nil]
- end
- end
-
-
- def Utils.execute_shell_with_stdout(cmd, os_category = nil)
-
- logger = Logger.new(STDOUT)
-
- # generate command
- cmd = generate_shell_command(cmd, os_category)
-
- # print log
- pipe = IO.popen("#{cmd} 2>&1") do |io|
- io.each do |line|
- logger.info line
- end
- end
-
- return [nil, nil]
- end
-
-
- def Utils.spawn(cmd, os_category = nil)
-
- if os_category.nil? then os_category = get_os_category( HOST_OS ) end
-
- if os_category == "windows" then
- create_process(cmd)
- else
- fork do
- exec(cmd)
- end
- end
-
- end
-
- def Utils.create_process(command)
-
- params = [
- 'L', # IN LPCSTR lpApplicationName
- 'P', # IN LPSTR lpCommandLine
- 'L', # IN LPSECURITY_ATTRIBUTES lpProcessAttributes
- 'L', # IN LPSECURITY_ATTRIBUTES lpThreadAttributes
- 'L', # IN BOOL bInheritHandles
- 'L', # IN DWORD dwCreationFlags
- 'L', # IN LPVOID lpEnvironment
- 'L', # IN LPCSTR lpCurrentDirectory
- 'P', # IN LPSTARTUPINFOA lpStartupInfo
- 'P' # OUT LPPROCESS_INFORMATION lpProcessInformation
- ]
- returnValue = 'I' # BOOL
-
- startupInfo = [STARTUP_INFO_SIZE].pack('I') + ([0].pack('I') * (STARTUP_INFO_SIZE - 4))
- processInfo = [0].pack('I') * PROCESS_INFO_SIZE
-
- createProcess = Win32API.new("kernel32", "CreateProcess", params, returnValue)
-
- createProcess.call(0, command, 0, 0, 0, NORMAL_PRIORITY_CLASS, 0, 0, startupInfo, processInfo)
-
- ($0 == __FILE__ ) ? processInfo : processInfo.unpack("LLLL")[2]
- end
-
- def Utils.is_absolute_path(path)
- if is_unix_like_os( HOST_OS ) then
- # if path start "/" then absoulte path
- if path.start_with?("/") then
- return true
- else
- return false
- end
- elsif is_windows_like_os( HOST_OS ) then
- # if path start "c:/" or "D:/" or ... then absoulte path
- if path =~ /^[a-zA-Z]:[\/]/ then
- return true
- else
- return false
- end
- else
- puts "HOST_OS is invalid"
- end
- end
-
-
- # this will be used on MinGW/MSYS
- def Utils.get_unix_path(path)
- if is_unix_like_os( HOST_OS ) then
- return path
- elsif is_windows_like_os( HOST_OS ) then
- new_path = path
- if is_absolute_path( new_path ) then
- new_path = "/" + new_path[0,1] + new_path[2..-1]
- end
- return new_path
- else
- puts "HOST_OS is invalid"
- return path
- end
- end
-
- def Utils.file_lock(lock_file_name)
- lock_file = File.new(lock_file_name, File::RDWR|File::CREAT, 0644)
- lock_file.flock(File::LOCK_EX)
- lock_file.rewind
- lock_file.flush
- lock_file.truncate(lock_file.pos)
-
- return lock_file
- end
-
- def Utils.file_unlock(lock_file)
- lock_file.close
- end
-
- def Utils.parse_server_addr(saddr)
- addr = saddr.split(":")
- return nil unless addr.length == 2
- return addr
- end
-
- def Utils.parse_ftpserver_url(surl)
- return nil unless surl.start_with? "ftp://"
-
- surl = surl[6..-1]
- parse1 = surl.split("@")
- return nil unless parse1.length == 2
-
- idpw = parse1[0]
- url = parse1[1]
- parse1 = idpw.split(":")
- return nil unless parse1.length == 2
-
- id = parse1[0]
- passwd = parse1[1]
- if url.end_with? "/" then url = url.chop end
-
- parse1 = url.split(":")
- if parse1.length == 2 then
- ip = parse1[0]
- port = parse1[1]
- elsif parse1.length == 1 then
- ip = parse1[0]
- port = 21
- else
- return nil
- end
-
- return [ip, port, id, passwd]
- end
-
-
- def Utils.generate_ftp_url(addr, port, username, passwd)
- return "ftp://#{username}:#{passwd}@#{addr}:#{port}"
- end
-
-
- def Utils.extract_a_file(file_path, target_file, path)
- dirname = File.dirname(file_path)
- filename = File.basename(file_path)
- ext = File.extname(filename)
-
- # path should be unix path if it is used in tar command
- _package_file_path = Utils.get_unix_path(file_path)
- _path = Utils.get_unix_path(path)
-
- case ext
- when ".zip" then
- if not path.nil? then
- extract_file_command = "unzip -xo #{_package_file_path} #{target_file} -d #{_path}"
- else
- extract_file_command = "unzip -xo #{_package_file_path} #{target_file}"
- end
- when ".tar" then
- if not path.nil? then
- extract_file_command = "tar xf #{_package_file_path} -C #{_path} #{target_file}"
- else
- extract_file_command = "tar xf #{_package_file_path} #{target_file}"
- end
- end
-
- # check exit code
- ret = execute_shell "#{extract_file_command}"
- if not ret then return false end
-
- # check result file
- if not path.nil? then
- target_file_path = File.join(path, target_file)
- else
- target_file_path = target_file
- end
-
- if not File.exist? target_file_path then
- return false
- else
- return true
- end
- end
-
-
- # check if the os is windows-like
- def Utils.is_windows_like_os(os_name)
- if os_name.start_with? "windows-" then
- return true
- else
- return false
- end
- end
-
-
- # check if the os is unix-like
- def Utils.is_unix_like_os(os_name)
- if Utils.is_linux_like_os os_name or
- os_name.start_with?"macos-" then
- return true
- else
- return false
- end
- end
-
-
- # check if the os is linux-like
- def Utils.is_linux_like_os(os_name)
- if os_name.start_with? "ubuntu-" or
- os_name.start_with? "redhat-" or
- os_name.start_with? "opensuse-" or
- os_name.start_with? "mandrake-" or
- os_name.start_with? "unknownlinux-" then
- return true
- else
- return false
- end
- end
-
-
- # check if the os is macos-like
- def Utils.is_macos_like_os(os_name)
- if os_name.start_with?"macos-" then
- return true
- else
- return false
- end
- end
-
-
- def Utils.get_os_category(os_name)
- if is_linux_like_os os_name then
- return "linux"
- elsif is_macos_like_os os_name then
- return "macos"
- elsif is_windows_like_os os_name then
- return "windows"
- else
- return os_name
- end
- end
-
-
- def Utils.get_package_name_from_package_file( local_path )
- filename = File.basename(local_path)
- if filename =~ /.*_.*_.*\.zip/ then
- new_name = filename.sub(/(.*)_(.*)_(.*)\.zip/,'\1,\2,\3')
- return new_name.split(",")[0]
- end
- return nil
- end
-
-
- def Utils.get_version_from_package_file( local_path )
- filename = File.basename(local_path)
- if filename =~ /.*_.*_.*\.zip/ then
- new_name = filename.sub(/(.*)_(.*)_(.*)\.zip/,'\1,\2,\3')
- return new_name.split(",")[1]
- end
- return nil
- end
-
-
- def Utils.get_os_from_package_file( local_path )
- filename = File.basename(local_path)
- if filename =~ /.*_.*_.*\.zip/ then
- new_name = filename.sub(/(.*)_(.*)_(.*)\.zip/,'\1,\2,\3')
- return new_name.split(",")[2]
- end
- return nil
- end
-
- def Utils.multi_argument_test( arg, seperator )
- return ( not arg.end_with? seperator and not arg.split( seperator ).select{|x| x.empty?}.length > 0 )
- end
-
- def Utils.directory_emtpy?(dir_path)
- return (Dir.entries(dir_path).join == "...")
- end
-
-
- def Utils.checksum(file_path)
- if File.exist? file_path then
- return execute_shell_return("shasum -a 256 \"#{file_path}\"").last.split(" ").first
- else
- return nil
- end
- end
-
- def Utils.validatePkgFile(filepath, orig_checksum, orig_size)
- checksum = checksum(filepath)
- size = File.size filepath
- if checksum.eql? orig_checksum and size.to_s.eql? orig_size then
- return true
- else
- return false
- end
- end
-
- def Utils.get_version()
- version_file = "#{File.dirname(__FILE__)}/../../VERSION"
-
- if not File.exist? version_file then
- return nil
- end
-
- f = File.open( version_file, "r" )
- version = f.readline
- f.close
-
- return version
- end
-
-
- def Utils.kill_process(base_pid)
- # stop process execution
- # NOTE. On MinGW "STOP" option stop whole process, so don't use it
- os_category = get_os_category(HOST_OS)
- if os_category != "windows" then
- Process.kill("STOP", base_pid)
- end
-
- # get all sub processes # kill&wait
- sub_pids = get_sub_processes(base_pid)
- sub_pids.each do |pid|
- Utils.kill_process(pid)
- end
-
- begin
- Process.kill(9, base_pid)
- Process.waitpid2(base_pid)
- rescue
- # do nothing
- end
- end
-
-
- def Utils.get_sub_processes(base)
- result = []
-
- # generate pid => ppid hash
- # NOTE. MinGW does not support "-o" option and has different output format
- os_category = get_os_category(HOST_OS)
- if os_category != "windows" then
- Hash[*`ps -eo pid,ppid`.scan(/\d+/).map{|x| x.to_i}].each do |pid,ppid|
- if ppid == base then
- result.push pid
- end
- end
- else
- # NOTE.On windows, there two types of pid. win pid, mingw pid
- # Sometime these different pids has same value with difference process
- # Root of pid is win pid and leaf node is mingw pid
- # So, after we get mingw pid, win pid should not be checked.
- # gather MinGW/MSYS process id
- Hash[*`ps -e`.scan(/^[\s]*(\d+)[\s]+(\d+)/).flatten.map{|x| x.to_i}].each do |pid,ppid|
- if ppid == base then
- result.push pid
- end
- end
-
- # gather windows process id if no mingw pid
- if result.count == 0 then
- require 'rubygems'
- require 'sys/proctable'
- Sys::ProcTable.ps do |proc|
- if proc.ppid == base then
- result.push proc.pid
- end
- end
- end
- end
-
- result.uniq!
- return result
- end
-
-
- def Utils.get_sub_files_info(path_list) # return [PATH,size,ctime,mtime] list
- list = []
- path_list.each do |path|
- Find.find(path) do |dep_path|
- if (File.exist?(dep_path) and not File.directory? dep_path)
- fsize = File.size(dep_path)
- ctime = File.ctime(dep_path)
- mtime = File.mtime(dep_path)
- list.push [dep_path,fsize,ctime,mtime]
- end
- end
- end
- return list
- end
-
-
- def Utils.get_directory_size(path)
-
- os_category = get_os_category(HOST_OS)
- if os_category == "macos" then
- cmd = "du -sk \"#{path}\""
- ret = Utils.execute_shell_return(cmd);
- if not ret.nil? and not ret[0].nil? then
- return ret[0].split(" ")[0].to_i * 1024
- end
- else
- cmd = "du --block-size=1 -s \"#{path}\""
- ret = Utils.execute_shell_return(cmd);
- if not ret.nil? and not ret[0].nil? then
- return ret[0].split(" ")[0].to_i
- end
- end
-
- return nil
- end
-
-
- if defined?(HOST_OS).nil? then
- HOST_OS = Utils.identify_current_OS()
- end
-
- # set static variable in WORKING_DIR, HOME
- if defined?(WORKING_DIR).nil? then WORKING_DIR = Dir.pwd end
- if defined?(HOME).nil? then
- # get home directory, using Dir.chdir
- Dir.chdir
- HOME = Dir.pwd
- Dir.chdir WORKING_DIR
- end
-
-end
+++ /dev/null
-require "SnapshotController"
-require "PackageServerConstants"
-require "fileutils"
-
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "FileUtil"
-
-class ChangeLogController
- def initialize(serverURL, ssController)
- @serverUrl = serverURL
- @ssController = ssController
- end
-
- ##Get
- public
- def getLatestChangeLog()
- recentSnapshotName = @ssController.getLatestSnapshot().getName();
- return getChangeLog(recentSnapshotName)
- end
-
- public
- def getChangeLog(snapshotName)
- logPath = downloadChangeLog(snapshotName)
-
- if (logPath.nil?() || !File.exist?(logPath)) then
- return;
- end
-
-
- return loadChangeLog(logPath);
- end
-
- public
- def getTotalChangeLog(startSnapshotName, endSnapshotName)
- if (endSnapshotName.nil?())
- return;
- elsif (endSnapshotName.nil?())
- return getChangeLog(startSnapshot);
- else
- changeLog = String.new
-
- totalSnapshotList = @ssController.getTotalSnapshotName(startSnapshotName,endSnapshotName)
- totalSnapshotList.each() do |snapshotName|
- changeLog = changeLog + getChangeLog(snapshotName) + "\n"
- end
-
- return changeLog
- end
- end
-
- private
- def downloadChangeLog(snapshotName)
- changeLogURLPath = getChangeLogURLPath(snapshotName)
-
- localPath = getChangeLogPath()
-
- FileUtils.mkdir_p(localPath)
-
- logger = DummyLog.new()
-
- if (FileDownLoader.download(changeLogURLPath,localPath,logger)) then
- return File.join(localPath, getChangeLogFile(snapshotName))
- else
- return nil
- end
- end
-
- private
- def getChangeLogPath()
- flatServerName = FileUtil.getFlatURL(@serverUrl)
- return File.join(PackageServerConfig::CONFIG_PATH, flatServerName, PackageServerConstants::CHANGE_LOG_DIRECTORY_NAME)
- end
-
- private
- def getChangeLogURLPath(snapshotName)
- changeLogURLPath = File.join(@serverUrl, PackageServerConstants::CHANGE_LOG_DIRECTORY_NAME, getChangeLogFile(snapshotName));
-
- return changeLogURLPath
- end
-
- private
- def getChangeLogFile(snapshotName)
- if (snapshotName.nil?() || snapshotName.empty?())
- return ""
- end
- return snapshotName + PackageServerConstants::CHANGE_LOG_FILE_EXTENSION
- end
-
- private
- def loadChangeLog(logPath)
- changeLog = String.new
-
- file = File.open(logPath,"r")
- file.each_line do |line|
- changeLog = changeLog + line
- end
-
- return changeLog
- end
-end
\ No newline at end of file
+++ /dev/null
-=begin
-
- DistSync.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-require "thread"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "Action.rb"
-require "ScheduledActionHandler.rb"
-
-class DistSyncAction < Action
-
- def initialize(time, pkgserver, dist_name )
- super(time, pkgserver.sync_interval)
-
- @pkgserver = pkgserver
- @dist_name = dist_name
- end
-
-
- def init
- end
-
-
- def execute
- # Start to sync job
- @pkgserver.log.info "Executing sync action for the #{@dist_name}"
- begin
- execute_internal()
- rescue => e
- @pkgserver.log.error e.message
- @pkgserver.log.error e.backtrace.inspect
- end
- end
-
-
- private
- def execute_internal()
- # update pkg info
- @pkgserver.reload_dist_package
-
- # sync
- @pkgserver.sync( @dist_name, false )
- end
-end
-
-
-class DistSync
- attr_accessor :quit
-
- # init
- def initialize( server )
- @server = server
- @handler = ScheduledActionHandler.new
- end
-
- # start thread
- def start()
- # scan all sync distribution
- @server.distribution_list.each do |dist|
- # if dist does not have parent server then skip sync
- if dist.server_url.empty? then next end
-
- time = Time.now
- @server.log.info "Registered sync-action for dist : #{dist.name}"
- @handler.register(DistSyncAction.new(time, @server, dist.name))
- end
-
- # start handler
- @handler.start
- end
-end
+++ /dev/null
-class PackageServerConstants
- #changelog information
- CHANGE_LOG_DIRECTORY_NAME = "changes"
- CHANGE_LOG_FILE_EXTENSION = ".log"
-
- #distribution information
- DISTRIBUTION_INFO_FILE_NAME = "distribution.info"
-
- #snapshot information
- SNAPSHOT_INFO_FILE_NAME = "snapshot.info"
- SNAPSHOT_NAME_FIELD = "name"
- SNAPSHOT_TIME_FIELD = "time"
- SNAPSHOT_TYPE_FIELD = "type"
- SNAPSHOT_PATH_FIELD = "path"
- SNAPSHOT_MANUAL_TYPE_VALUE = "manual"
-end
\ No newline at end of file
+++ /dev/null
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "PropertyParser"
-require "PackageServerConstants"
-require 'model/snapshot'
-
-class SnapshotController
- attr_accessor :snapshotList
- def initialize(snapshotFilePath)
- @snapshotList = Array.new
-
- if (File.directory? snapshotFilePath) then
- snapshotFilePath = File.join(snapshotFilePath, PackageServerConstants::SNAPSHOT_INFO_FILE_NAME)
- end
-
- loadSnapshot(snapshotFilePath)
- end
-
- public
- def getAllSnapshotList
- return @snapshotList
- end
-
- public
- def getManualSnapshotList
- manualSnapshotList = Array.new
-
- @snapshotList.each() do |snapshot|
- if (snapshot.getType().eql?(PackageServerConstants::SNAPSHOT_MANUAL_TYPE_VALUE)) then
- manualSnapshotList.push(snapshot[name])
- end
- end
-
- return manualSnapshotList
- end
-
- public
- def getLatestSnapshot
- return @snapshotList.pop()
- end
-
- public
- def getTotalSnapshotName(startSnapshotName, endSnapshotName)
- totalSnapshotList = Array.new
-
- @snapshotList.each() do |snapshot|
- snapshotName = snapshot.getName()
- if (snapshotName.eql?(startSnapshotName) || snapshotName.eql?(endSnapshotName)) then
- if (totalSnapshotList.empty?) then
- totalSnapshotList.push(snapshotName)
- else
- break
- end
- end
-
- if (not totalSnapshotList.empty?) then
- totalSnapshotList.push(snapshotName)
- end
- end
-
- return totalSnapshotList
- end
-
- private
- def loadSnapshot(snapshotPath)
- if not File.exist?(snapshotPath) then
- return;
- end
-
- parser = PropertyParser.new(nil)
- propertySection = parser.parseFile(snapshotPath);
-
- propertySection.each() do |properties|
- snapshot = Snapshot.new(properties)
- @snapshotList.push(snapshot);
- end
-
- end
-end
\ No newline at end of file
+++ /dev/null
-=begin
-
- SocketRegisterListener.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'socket'
-require 'thread'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/build_server"
-require "packageServerConfig"
-require "BuildComm"
-require "net/ftp"
-
-# mutax for register operation
-$register_mutex = Mutex.new
-
-class SocketRegisterListener
-
- # initialize
- def initialize (parent)
- @parent_server = parent
- @thread = nil
- @finish_loop = false
- @log = @parent_server.log
- end
-
- # start listening
- def start()
- @log.info "SocketRegisterListener start"
- @thread = Thread.new do
- main()
- end
- end
-
- # quit listening
- def stop_listening()
- @finish_loop = true
- end
-
- private
-
- # thread main
- def main()
- @log.info "SocketRegisterListener entering main loop"
- # server open
- begin
- @comm_server = BuildCommServer.create(@parent_server.port, @log)
- rescue => e
- @log.info "Server creation failed"
- @log.error e.message
- @log.error e.backtrace.inspect
- return
- end
-
- # loop
- @log.info "Entering Control Listening Loop ... "
- @finish_loop = false
- @comm_server.wait_for_connection(@finish_loop) do |req|
- begin
- handle_job_request( req )
- rescue => e
- @log.info "error occured in handle_job_request function"
- @log.error e.message
- @log.error e.backtrace.inspect
- end
- end
-
- # quit
- @comm_server.terminate
- end
-
- # wait for job requests
- def wait_for_job_requests
- req_list = []
- req_list.push @tcp_server.accept
-
- return req_list
- end
-
- # handle job request
- def handle_job_request( req )
-
- # read request
- req_line = req.gets
- if req_line.nil? then return end
-
- # parse request
- cmd = ""
- if req_line.split("|").count > 0 then
- cmd = req_line.split("|")[0].strip
- end
-
- case cmd
- when "UPLOAD"
- Thread.new do
- handle_cmd_upload( req_line, req )
- end
- when "REGISTER"
- Thread.new do
- handle_cmd_register( req_line, req )
- end
- when "STOP"
- handle_cmd_stop( req_line, req )
- else
- @log.error "Received Unknown REQ: #{req_line}"
- end
- @log.info "REQ processing done"
- end
-
- # "UPLOAD"
- def handle_cmd_upload( line, req )
- @log.info "Received File transfer REQ : #{line}"
-
- BuildCommServer.send_begin(req)
-
- tok = line.split("|").map { |x| x.strip }
- if tok.count > 1 then
- dock_name = tok[1].strip
- incoming_dir = "#{@parent_server.incoming_path}/#{dock_name}"
- FileUtils.mkdir_p(incoming_dir)
- else
- incoming_dir = "#{@parent_server.incoming_path}"
- end
-
- file_path_list = []
- begin
- @comm_server.receive_file(req, incoming_dir)
- rescue => e
- @log.error "Failed to transfer file"
- @log.error e.message
- @log.error e.backtrace.inspect
- end
- BuildCommServer.send_end(req)
- end
-
- # "Register"
- def handle_cmd_register( line, req )
- @log.info "Received register REQ : #{line}"
- BuildCommServer.send_begin(req)
-
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 4 then
- @log.error "Received Wrong REQ : #{line}"
- BuildCommServer.send(req, "ERROR|Invalid REQ format")
- return
- end
- dist_name = tok[1].strip
- password = tok[2].strip
-
- if tok[3].start_with? "DOCK" then
- dock_name = tok[4]
- idx = 5
- else
- dock_name = ""
- idx = 3
- end
-
- file_path_list = []
-
- while idx < tok.length do
- if dock_name.empty? then
- file_path_list.push "#{@parent_server.incoming_path}/#{tok[idx]}"
- else
- file_path_list.push "#{@parent_server.incoming_path}/#{dock_name}/#{tok[idx]}"
- end
- idx = idx + 1
- end
- # password check
- if @parent_server.passwd.eql? password then
- @log.info "Register command password check pass"
- else
- @log.error "Received register command, but passwd mismatched : [#{password}]"
- BuildCommServer.send(req,"ERROR|Password mismatched!")
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- return
- end
-
- BuildCommServer.send(req, "WAITFORUPLOAD")
- req_line = req.gets
- if req_line.nil? or not req_line.strip.eql?("REGISTERCONTINUE") then
- BuildCommServer.send(req,"ERROR|Invalid message received : [#{req_line}]")
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- return
- else
- @log.info "register file is received successfully"
- end
-
- # register mutex
- $register_mutex.synchronize do
- begin
- @parent_server.reload_dist_package()
- snapshot_name = @parent_server.register( file_path_list, dist_name, true, false, true)
- BuildCommServer.send(req,"SUCC|#{snapshot_name}")
- rescue => e
- @log.error "register failed"
- @log.error e.message
- @log.error e.backtrace.inspect
- BuildCommServer.send(req, "ERROR|#{e.message}")
- @parent_server.release_lock_file
- return
- end
- end
-
- if not dock_name.empty? then
- FileUtils.rm_rf "#{@parent_server.incoming_path}/#{dock_name}"
- end
-
- BuildCommServer.send_end(req)
- end
-
- # "STOP"
- def handle_cmd_stop( line, req )
- @log.info "Received STOP REQ"
-
- BuildCommServer.send_begin(req)
-
- tok = line.split("|").map { |x| x.strip }
- if tok.count < 2 then
- @log.error "Received Wrong REQ : #{line}"
- BuildCommServer.send(req, "ERROR|Invalid REQ format")
- return
- end
- passwd = tok[1].strip
-
- if @parent_server.passwd.eql? passwd then
- @parent_server.finish = true
- @log.info "Package server stop flag set"
- BuildCommServer.send(req,"SUCC")
- else
- @log.error "Received stop command, but passwd mismatched : #{passwd}"
- BuildCommServer.send(req,"ERROR|Password mismatched!")
- end
- BuildCommServer.send_end(req)
- BuildCommServer.disconnect(req)
- end
-end
-
+++ /dev/null
-=begin
-
- client.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require "fileutils"
-require "thread"
-require "net/ftp"
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/build_server"
-require "downloader"
-require "installer"
-require "packageServerConfig"
-require "package"
-require "parser"
-require "utils"
-require "log"
-require "Version"
-require "BuildComm"
-require "FileTransferViaFTP"
-require "FileTransferViaDirect"
-require 'digest'
-require "SnapshotController"
-require "ChangeLogController"
-require 'PackageServerConstants'
-require "FileUtil"
-
-$update_mutex = Mutex.new
-$get_snapshot_mutex = Mutex.new
-$cache_mutex = Mutex.new
-class Client
-
- # constant
- PKG_LIST_FILE_PREFIX = "pkg_list_"
- INSTALLED_PKG_LIST_FILE = "installedpackage.list"
- CONFIG_PATH = "#{PackageServerConfig::CONFIG_ROOT}/client"
- PACKAGE_INFO_DIR = ".info"
- DEFAULT_INSTALL_DIR = "#{Utils::HOME}/build_root"
- #DEFAULT_SERVER_ADDR = "http://172.21.17.55/dibs/unstable"
- OS_INFO_FILE = "os_info"
- ARCHIVE_PKG_LIST_FILE = "archive_pkg_list"
-
- attr_accessor :server_addr, :location, :pkg_hash_os, :is_server_remote, :installed_pkg_hash_loc, :archive_pkg_list, :all_dep_list, :log, :support_os_list, :config_dist_path, :download_path, :tmp_path, :snapshot_path, :snapshots_path, :snapshot_url
- private_class_method :new
-
- public
- # initialize
- # create "remote package hash" and "installed package hash"
- # @server_addr = server address (can be included distribution, snapshot)
- # @location = client location (download and install file to this location)
- def initialize(server_addr, location, logger, access_svr = true)
-
- # set log
- if logger.nil? or logger.class.to_s.eql? "String" then
- @log = DummyLog.new()
- else
- @log = logger
- end
-
- # create directory
- if not File.exist? CONFIG_PATH then FileUtils.mkdir_p "#{CONFIG_PATH}" end
- # set location
- if location.nil? then location = get_default_inst_dir() end
-
- @location = location
- @snapshot_path = nil
- @snapshot_url = false
- @pkg_hash_os = {}
- @installed_pkg_hash_loc = {}
- @archive_pkg_list = []
- @all_dep_list = []
- @support_os_list = []
- @server_addr = nil
-
-
- # if client should access remote server, set server information
- if access_svr then
- if not server_addr.nil? then
- # chop server address, if end with "/"
- if server_addr.strip.end_with? "/" then server_addr = server_addr.chop end
- server_addr.strip!
-
- if is_snapshot_url(server_addr) then
- @snapshot_url = true
- @server_addr, @snapshot_path = split_addr_and_snapshot(server_addr)
- else
- @server_addr = server_addr
- end
- @is_server_remote = Utils.is_url_remote(server_addr)
- @config_dist_path = CONFIG_PATH + "/" + get_flat_serveraddr
- @download_path = @config_dist_path + "/downloads"
- @tmp_path = @config_dist_path + "/tmp"
- @snapshots_path = @config_dist_path + "/snapshots"
-
- # create directory
- if not File.exist? @config_dist_path then FileUtils.mkdir_p "#{@config_dist_path}" end
- if not File.exist? @download_path then FileUtils.mkdir_p "#{@download_path}" end
- if not File.exist? @snapshots_path then FileUtils.mkdir_p "#{@snapshots_path}" end
- if not File.exist? @tmp_path then FileUtils.mkdir_p "#{@tmp_path}" end
- end
- end
-
- @configs = {}
- #default cache size = 8G
- @configs[:CACHE_SIZE] = "8000"
- end
-
-
- public
- def self.create(server_addr, location, logger, access_svr = true)
- new_client = new(server_addr, location, logger, access_svr )
- if new_client.init(access_svr) then
- return new_client
- else
- return nil
- end
- end
-
-
- public
- def init(access_svr)
- if access_svr then
- # read remote pkg list, and hash list
- @log.info "Update remote package list and supported os list.."
- if update() then
- @log.info "Initialize - #{@server_addr}, #{@location}"
- else
- @log.error "Failed to update remote package list."
- return false
- end
- end
-
- # read installed pkg list, and create hash
- if not File.exist? @location then FileUtils.mkdir_p "#{@location}" end
- @log.info "Update local package list.. [#{@location}]"
- read_installed_pkg_list()
-
- return true
- end
-
-
- # make cache clean
- private
- def remove_old_files_in_cache
- #get dir info
- cache_list = get_cache_dir_list
- cache_info_list = Utils.get_sub_files_info(cache_list).sort {|a,b| a[3] <=> b[3]} # [path,size,ctime,mtime]
- cache_size = 0
- cache_info_list.each {|file| cache_size += file[1]}
-
- read_configs
- max_cache_size = get_config_max_cache_size
-
- extra_size = cache_size - max_cache_size
-
- if extra_size < 0 then return end
-
- remove_list = []
- while extra_size > 0 do
- old_package = cache_info_list.shift
- remove_list.push old_package[0]
- extra_size -= old_package[1]
- end
-
- if not remove_list.empty? then
- @log.info "Removed oldest package files.. (Now not fully caching)"
- @log.info " * #{remove_list.map{|path| File.basename(path)}.join(", ")}"
- FileUtils.rm_rf remove_list
- end
- end
-
- private
- def get_cache_dir_list
- return Dir.entries(CONFIG_PATH).select{|dir| not dir.start_with? "." and File.directory? CONFIG_PATH + "/#{dir}/downloads" }.map{|dir| CONFIG_PATH + "/#{dir}/downloads"}
- end
-
- private
- def get_config_max_cache_size
- return (@configs[:CACHE_SIZE] =~ /^([0-9][0-9]*)$/i)? ($1.to_i * 1024 * 1024) : (8 * 1024 * 1024 * 1024) #default size 4G : unit = MB
- end
-
- private
- def read_configs
- file_path = CONFIG_PATH + "/config"
- if not File.exist? file_path then return end
-
- File.open file_path, "r" do |f|
- f.each_line do |l|
- row = l.split(":")
- @configs[row[0].strip.to_sym] = row[1..-1].join(":").strip
- end
- end
- end
-
-
- public
- # update package list from server
- def update()
-
- if @server_addr.nil? then
- @log.warn "Server address is null"
- return false
- end
-
- if not @snapshot_url then
- $get_snapshot_mutex.synchronize do
- @snapshot_path = get_lastest_snapshot(@is_server_remote)
- end
- end
- @log.info "The lastest snapshot : #{@snapshot_path}"
- if @snapshot_path.nil? then
- @log.warn "Failed to get the lastest package list."
- @snapshot_path = ""
- end
-
- lock = nil
- begin
- lock = Utils.file_lock(File.join(CONFIG_PATH,".pkglist_cache_lock"))
-
- exists_snapshot = false
- if is_snapshot_exist(@snapshot_path) then
- @log.info "Snapshot information is already cached [#{get_pkglist_path()}]"
- exists_snapshot = true
- else
- @log.info "Snapshot information is not cached."
- end
-
- list_path = get_pkglist_path()
- if list_path.nil? then
- @log.error "Failed to get package list path."
- return false
- end
-
- # clean
- clean_list()
-
- if !exists_snapshot then
- uniq_name = Utils.create_uniq_name
- tmp_dir = File.join(@config_dist_path, uniq_name)
- FileUtils.mkdir_p tmp_dir
- if not download_os_list(@is_server_remote, tmp_dir) then
- @log.error "\"#{@server_addr}\" does not have supported os list file properly."
- Utils.execute_shell("rm -rf #{tmp_dir}")
- return false
- else
- read_supported_os_list(tmp_dir)
- end
-
- if not download_pkg_list(@is_server_remote, tmp_dir) then
- @log.error "\"#{@server_addr}\" does not have package list file properly."
- Utils.execute_shell("rm -rf #{tmp_dir}")
- return false
- else
- read_remote_pkg_list(tmp_dir)
- end
-
- if not download_archive_pkg_list(@is_server_remote, tmp_dir) then
- @log.error "\"#{@server_addr}\" does not have archive package list file properly. This error can be ignored"
- else
- read_archive_pkg_list(tmp_dir)
- end
-
- Utils.execute_shell("mv #{tmp_dir} #{list_path}")
- @log.info "Moved \"#{tmp_dir}\" to"
- @log.info " \"#{list_path}\""
-
- # tmp_dir should be removed whether mv command is failed
- Utils.execute_shell("rm -rf #{tmp_dir}")
- remove_snapshots()
- else
- # load os/package infos
- read_supported_os_list(list_path)
- read_remote_pkg_list(list_path)
- read_archive_pkg_list(list_path)
- end
-
- ensure
- Utils.file_unlock(lock) if not lock.nil?
- end
-
- @log.info "Update package list from \"#{@server_addr}\".. OK"
-
- return true
- end
-
- private
- def clean_list()
- @pkg_hash_os.clear
- @archive_pkg_list.clear
- @support_os_list.clear
- @log.info "Cleard package list, supported os list.. OK"
- end
-
- public
- # download package
- def download(pkg_name, os, trace, loc = nil)
-
- if loc.nil? then loc = @location end
-
- if not File.exist? loc then FileUtils.mkdir_p "#{loc}" end
-
- dependent_pkg_list = []
-
- # get dependent list
- if trace then
- dependent_pkg_list = get_install_dependent_packages(pkg_name, os, true, true)
- if dependent_pkg_list.nil? then
- @log.error "Failed to get dependency for \"#{pkg_name}\" package"
- return nil
- end
- else dependent_pkg_list = [pkg_name] end
-
- surl = @server_addr
- # download files
- file_local_path = []
- dependent_pkg_list.each do |p|
- pkg_name = get_attr_from_pkg(p, os, "name")
- pkg_path = get_attr_from_pkg(p, os, "path")
- pkg_ver = get_attr_from_pkg(p, os, "version")
- pkg_checksum = get_attr_from_pkg(p, os, "checksum")
- pkg_size = get_attr_from_pkg(p, os, "size")
- if pkg_path.nil? or pkg_ver.nil? then
- @log.error "\"#{p}\" package does not exist in package server. Check if it exist in package server"
- return nil
- end
- url = surl + pkg_path
- filename = File.basename pkg_path
-
- file_path = get_file_from_cache(filename, pkg_checksum, pkg_size, loc)
- if file_path.nil? then
-
- file_path = File.join(loc, filename)
-
- result = FileDownLoader.download(url, loc, @log)
- if not result or not File.exist? file_path then
- @log.error "File Download Failed!!"
- @log.error "* #{url} -> #{loc}"
- return nil
- end
-
- if Utils.validatePkgFile(file_path, pkg_checksum, pkg_size) then
- add_file_to_cache(file_path)
- else
- @log.error "File Validation Failed!!"
- @log.info "Valiate : file path : #{file_path}, shasum : #{pkg_checksum}, size : #{pkg_size}", Log::LV_USER
- return nil
- end
- else
- @log.info "Cached #{pkg_name} package file.. OK"
- end
- file_local_path.push(file_path)
- end
-
- if trace then
- @log.info "Downloaded \"#{pkg_name}\" package with all dependent packages.. OK"
- end
- @log.info " [path: #{file_local_path.join(", ")}]"
-
- return file_local_path
- end
- public
- def gen_dep_graph(os, type)
- if (os == "all") then
- puts "==graph explain=="
- puts " box : package name"
- puts " red arrow : install dependency"
- puts " blue arrow : build dependency"
- puts "execute below graph generate command on your shell\n"
- @support_os_list.each do |os| make_dep_graph(os, type) end
- else
- if(@support_os_list.include? os)
- puts "execute below command on your shell\n"
- make_dep_graph(os, type)
- else
- @log.error "not support os name : #{os}\n server supports #{@support_os_list.join(',')}"
- end
- end
- end
-
- def dot_ident(string)
- return string.gsub(/[^a-zA-z0-9_]/,'')
- end
-
- def make_dep_graph(os,type)
- all_pkg_list = @pkg_hash_os[os].values
- string = "digraph #{type}_dependency {\nranksep=1.5\n"
- all_pkg_list.each { |pkg|
- id_pkg = dot_ident(pkg.package_name)
- string += "#{id_pkg} [label=\"#{pkg.package_name}\",shape=box];\n"
- if(type.eql? 'install' or type.eql? 'all') then
- pkg.install_dep_list.each { |dep|
- if(dep.target_os_list.include? os or dep.target_os_list.empty?) then
- string += "#{id_pkg} -> #{dot_ident(dep.package_name)} [color=red];\n"
- else
- string += "#{id_pkg} -> #{dot_ident(dep.package_name)} [color=red,label=\"#{dep.target_os_list[0]}\",fontcolor=red,style=bold];\n"
- end
- }
- end
- if(type.eql? 'build' or type.eql? 'all') then
- pkg.build_dep_list.each { |dep|
- if(dep.target_os_list.include? os or dep.target_os_list.empty?) then
- string += "#{id_pkg} -> #{dot_ident(dep.package_name)} [color=blue];\n"
- else
- string += "#{id_pkg} -> #{dot_ident(dep.package_name)} [color=blue,label=\"#{dep.target_os_list[0]}\",fontcolor=blue,style=bold];\n"
- end
- }
- end
- }
- string += "}"
- File.open("#{type}_dep_#{os}.dot","w"){|file| file.write(string)}
- puts "dot -Tpng -o #{type}_dep_#{os}.png #{type}_dep_#{os}.dot"
- end
-
- public
- def make_img(os, img_info, remove_list = nil)
- if (os == "all") then
- @support_os_list.each { |os| image_generator(os, img_info, remove_list) }
- else
- image_generator(os, img_info, remove_list)
- end
- end
-
- private
- # make sdk image
- def image_generator(os, img_info, user_input_list)
- # select meta and install-type packages
- metapackage_list = []
- installtype_list = []
- @pkg_hash_os[os].values.each { |pkg|
- attr = get_attr_from_pkg(pkg.package_name, os, "attribute")
- if attr.nil? or attr.empty? then next end
- if attr[0].strip.upcase.eql? "ROOT" or attr[0].strip.upcase.eql? "MANDATORY" then
- metapackage_list.push(pkg.package_name)
- elsif attr[0].strip.upcase.eql? "INSTALL" then
- installtype_list.push(pkg.package_name)
- end
- }
-
- @log.info "<< Meta-Package List >>"
- @log.info " - #{metapackage_list.sort}"
- @log.info "<< Install Type Package List >>"
- @log.info " - #{installtype_list}"
- @log.info ""
-
- # validate user input
- if user_input_list.empty? or user_input_list.nil? then
- user_input_list = []
- else
- user_input_list.each { |i|
- flag = false
- metapackage_list.each { |j| if "#{i}" == "#{j}" then flag = true end}
- if flag == false then
- @log.info "[#{i}] is not in package server. please check it (We are case-sensitive)."
- return false
- end
- }
- # get all meta-packages in user input
- remove_metapackage_list = []
- user_input_list.each { |i|
- get_install_dependent_packages(i, os, true, true).each { |j|
- attr = get_attr_from_pkg(j, os, "attribute")
- if attr.nil? or attr.empty? then next end
- if attr[0].strip.upcase.eql? "ROOT" then
- remove_metapackage_list.push(j)
- end
- }
- }
- @log.info "<< User Input List>>"
- @log.info " - #{user_input_list}"
- @log.info " - #{remove_metapackage_list}"
- @log.info ""
- end
-
- # get final package list
- img_pkg_list = []
- if user_input_list.empty? then
- metapackage_list.each { |pkg|
- img_pkg_list = img_pkg_list + get_install_dependent_packages(pkg, os, true, true)
- }
- else
- metapackage_list = metapackage_list - remove_metapackage_list
- metapackage_list.each { |pkg|
- img_pkg_list = img_pkg_list + get_install_dependent_packages_with_except(pkg, os, true, true, user_input_list)
- }
- end
-
- img_pkg_list.uniq!
- img_pkg_list = img_pkg_list + installtype_list
- @log.info "<< Final Package List >>"
- @log.info " - #{img_pkg_list.sort}"
- @log.info ""
-
- # init workspace
- workspace = @location+"/temp_for_tizen_sdk_imgs_#{os}"
- if File.directory? workspace then FileUtils.remove_dir(workspace, true) end
-
- # download packages
- img_pkg_list.each do |pkg| download(pkg, os, false, "#{workspace}/binary") end
-
- # update pkg list
- list_path = get_pkglist_path()
- read_remote_pkg_list(list_path)
-
- # write pkg_list_os file
- f = File.new("#{workspace}/pkg_list_#{os}", "w");
- img_pkg_list.each do |pkg|
- f.write( @pkg_hash_os[os][pkg] );
- f.write("\n\n");
- end
- f.close
-
- # write os_info file
- File.open("#{workspace}/#{OS_INFO_FILE}", 'w') do |f| f.puts os end
-
- # set image.info
- message = "";
- message = img_info;
-
- if message.to_s.eql? "" then
- server = @server_addr;
- origin = File.dirname( server );
- dist = get_distribution
- else
- # chop server address, if end with "/"
- if message.strip.end_with? "/" then message = message.chop end
- message.strip!
- server = message;
- origin = File.dirname( server );
- dist = File.basename( server );
- end
-
- # write image.info
- f = File.new("#{workspace}/image.info", "w");
- f.write("origin : #{origin}\ndistribution : #{dist}\n");
- f.close
-
- # compress files
- snapshot = snapshot_path.split('/')[-1]
- img_name = "TIZEN-SDK-IMG_#{snapshot}_#{os}.zip"
- cmd = "cd #{workspace}; zip -q -r #{@location}/TIZEN-SDK-IMG_#{snapshot_path.split('/')[-1]}_#{os}.zip *;"
- Utils.execute_shell_with_log(cmd, @log.path)
-
- # clean workspace
- FileUtils.remove_dir(workspace, true)
- @log.info "<< SDK-Image Info. >>"
- @log.info " - server addr : #{@server_addr}"
- @log.info " - snapshot : #{snapshot}"
- @log.info " - os : #{os}"
- @log.info " - location : #{location}/"
- @log.info " - name : #{img_name}"
-
- return
- end
-
- private
- def get_file_from_cache(filename, pkg_checksum, pkg_size, location)
- if not File.directory? location then return nil end
- downloaded_file_path = nil
- @log.info "Wait for cache sync",Log::LV_USER
- begin
- lock = Utils.file_lock(File.join(CONFIG_PATH,".cache_lock"))
- @log.info "Entering cache sync",Log::LV_USER
- cached_filepath = get_cached_filepath(filename, pkg_checksum, pkg_size)
- if not cached_filepath.nil? and File.exist? cached_filepath then
- #FileUtils.ln(cached_filepath, location, :force => true)
- if (FileUtil.safeLink(cached_filepath, location)) then
- downloaded_file_path = File.join(location, File.basename(cached_filepath))
- end
- end
- ensure
- Utils.file_unlock(lock) if not lock.nil?
- end
- @log.info "Cache sync done",Log::LV_USER
- if not downloaded_file_path.nil? and not File.exist? downloaded_file_path then
- downloaded_file_path = nil
- end
- return downloaded_file_path
- end
-
- private
- def add_file_to_cache(filepath)
- if filepath.nil? or filepath.empty? or not File.exist? filepath then return end
- if not File.exist? @download_path then FileUtils.mkdir_p "#{@download_path}" end
-
- filename = File.basename(filepath)
- cachefile = File.join(@download_path, filename)
-
- @log.info "Moving \"#{filename}\" to download cache directory"
- @log.info " [path: #{@download_path}]"
-
- if not File.exist? cachefile then
- #FileUtils.ln(filepath, @download_path, :force => true)
- if not FileUtil.safeLink(filepath, @download_path) then
- @log.info "Failed to link file [#{filepath}] to "
- @log.info " [#{@download_path}]"
- end
- end
-
- if not File.exist? cachefile then
- @log.info "Failed to move [#{filename}] to "
- @log.info " [#{@download_path}]"
- end
-
- begin
- lock = Utils.file_lock(File.join(CONFIG_PATH,".cache_lock"))
-
- remove_old_files_in_cache
- ensure
- Utils.file_unlock(lock) if not lock.nil?
- end
- end
-
- private
- def remove_snapshots()
- listing_prefix = "#{@snapshots_path}/*"
- dirs = Dir[listing_prefix].sort_by { |f| File.mtime(f) }.reverse
-
- if not dirs.nil? and dirs.length >= 20 then
- Utils.execute_shell("rm -rf #{dirs[19..-1].join(" ")}")
- @log.info "Removed old snapshots.."
- @log.info " * #{dirs[19]} ~ "
- end
- end
-
- private
- def get_cached_filepath(pkg_filename, pkg_checksum, pkg_size)
- cached_filepath = "#{@download_path}/#{pkg_filename}"
- if File.exist? cached_filepath then
- if Utils.validatePkgFile(cached_filepath, pkg_checksum, pkg_size) then
- FileUtils.touch cached_filepath
- return cached_filepath
- else
- return nil
- end
- end
- return nil
- end
-
- public
- # download dependent source
- def download_dep_source(file_name)
-
- file_url = @server_addr + "/source/#{file_name}"
- if not FileDownLoader.download(file_url, @location, @log) then
- @log.error "Failed download #{file_name}"
- return nil
- end
- file_local_path = File.join(@location, file_name)
- @log.info "Downloaded \"#{file_name}\" source file.. OK"
- @log.info " [path: #{file_local_path}]"
-
- return file_local_path
- end
-
- private
- def upload_request(ip, port, dock, transporter, binary_path_list)
- binary_path_list.each do |bpath|
- client2 = BuildCommClient.create(ip, port, @log)
- begin
- if client2.nil? then
- raise RuntimeError, "Failed to create BuildCommClient instance.."
- end
-
- @log.info "Send UPLOAD REQ.. [UPLOAD|#{dock}]"
- result = client2.send("UPLOAD|#{dock}")
- if not result then
- raise RuntimeError, "Failed to send ready REQ.."
- end
- result = client2.send_file(bpath, transporter)
- ensure
- client2.terminate
- end
- end
- end
-
- public
- # upload package
- def upload(ip, port, binary_path_list, ftp_addr=nil, ftp_port=nil, ftp_username=nil, ftp_passwd=nil, password="")
-
- # check ip and port
- if ip.nil? or port.nil? then
- @log.error "Ip and port should be set."
- return nil
- end
-
- # check binary path list
- if binary_path_list.nil? or binary_path_list.empty? then
- @log.error "Binary package path should be set."
- return nil
- end
-
- begin
- if not ftp_addr.nil? then
- transporter=FileTransferFTP.new(@log, ftp_addr, ftp_port, ftp_username, ftp_passwd)
- else
- transporter=FileTransferDirect.new(@log)
- end
- rescue => e
- @log.error "FTP failed to put file (exception)"
- @log.error "#{e.message}"
- @log.error e.backtrace.inspect
- return nil
- end
-
- binary_list = []
- binary_path_list.each do |binary_path|
- if File.exist? binary_path then
- binary_list.push(File.basename(binary_path))
- else
- @log.error "Binary file does not exist"
- return nil
- end
- end
-
- client = BuildCommClient.create(ip, port, @log)
- if client.nil? then
- @log.error "Can't access server #{ip}:#{port}"
- return nil
- end
-
- begin
- # create unique dock number
- dock = Utils.create_uniq_name()
-
- dist = get_distribution
- if dist.empty? then
- @log.error "Distribution is empty.."
- return nil
- end
-
- @log.info "Send register message.. [REGISTER|#{dist}|#{password}|DOCK|#{dock}|#{binary_list.join("|")}]"
- snapshot = nil
-
- client.send "REGISTER|#{dist}|#{password}|DOCK|#{dock}|#{binary_list.join("|")}"
-
- client.read_lines do |line|
- if line.eql?("WAITFORUPLOAD") then
- # upload
- @log.info "Get WAITFORUPLOAD message"
- thread = Thread.new do
- begin
- upload_request(ip, port, dock, transporter, binary_path_list)
- rescue => e
- puts "Transfering file failed!"
- puts e.message
- end
- end
-
- thread.join
- client.send("REGISTERCONTINUE")
- elsif line.start_with? "SUCC" then
- snapshot = line.split("|")[1]
- elsif line.start_with? "ERROR" then
- @log.error line.strip
- return nil
- else
- @log.error "Unknown message received : #{l}"
- end
- end
- ensure
- client.terminate
- end
-
- if not snapshot.nil? and not snapshot.empty? then
- snapshot = @server_addr + "/snapshots/" + snapshot
- @log.info "Registered successfully! [#{binary_path_list.join("|")}]"
- if snapshot.empty? then
- @log.error "Failed to generate snapshot"
- end
-
- return snapshot
- else
- return nil
- end
- end
-
- private
- # verify package before uploading
- def verify_upload(pkg_name, pkg_path)
-
- manifest_file = "pkginfo.manifest"
- uniq_name = Utils.create_uniq_name
- path = Utils::HOME + "/tmp/#{uniq_name}"
- if not File.exist? path then FileUtils.mkdir_p "#{path}" end
- begin
- if not FileInstaller.extract_a_file(pkg_path, manifest_file, path, @log) then
- @log.error "The \"pkginfo.manifest\" file does not exist in \"#{pkg_path}\""
- return false
- end
- manifest_path = File.join(path, manifest_file)
- pkg = Parser.read_single_pkginfo_from manifest_path
- if File.exists? manifest_path then FileUtils.rm_f(manifest_path) end
- FileUtils.remove_dir(path, true)
- rescue Interrupt
- @log.error "Client: Interrupted.."
- FileUtils.remove_dir(path, true)
- @log.info "Removed #{path}"
- raise Interrupt
- rescue RuntimeError => e
- @log.error( e.message, Log::LV_USER)
- FileUtils.remove_dir(path, true)
- @log.info "Removed #{path}"
- return false
- end
- new_pkg_ver = pkg.version
- new_pkg_install_dep_list = pkg.install_dep_list
- os = pkg.os
-
- list = get_all_reverse_install_dependent_packages_remote(pkg_name, os, true)
-
- if not list.nil? then
- list.each do |p|
- ilist = get_attr_from_pkg(p, os, "install_dep_list")
- if ilist.nil? then next end
- ilist.each do |l|
- if l.package_name.eql? pkg_name then
- if not l.match? new_pkg_ver then
- @log.error "\"#{p}\" package has following install dependency : #{l.package_name} (#{l.comp} #{l.base_version})"
- return false
- end
- end
- end
- end
- end
-
- if not new_pkg_install_dep_list.nil? then
- new_pkg_install_dep_list.each do |l|
- if not check_remote_pkg(l.package_name, os) then
- @log.error "\"#{pkg_name}\" package has following install dependency : #{l.package_name} (#{l.comp} #{l.base_version}), but \"#{l.package_name}\" is not exist on server"
- return false
- end
- rver = get_attr_from_pkg(l.package_name, os, "version")
- if not l.match? rver then
- @log.error "\"#{pkg_name}\" package has following install dependency : #{l.package_name} (#{l.comp} #{l.base_version})"
- return false
- end
- end
- end
-
- @log.info "Passed to verify packages for uploading.. OK"
- return true
- end
-
- private
- # get distribution
- def get_distribution()
- server = @server_addr
- if server.nil? or server.empty? then
- @log.error "Server addr is nil"
- return nil
- end
-
- dist = ""
- dist = File.basename(server)
-
- return dist
- end
-
- private
- def get_flat_serveraddr()
- server = @server_addr
- if server.nil? or server.empty? then
- @log.error "Server addr is nil"
- @log.error "check sync_pkg_servers table pkgsvr_url column is null"
- return "nil"
- end
-
- server = server.delete ".:/@"
- return server
- end
-
- public
- # install package
- # install all install dependency packages
- def install(pkg_name, os, trace, force)
-
- ret = install_internal( pkg_name, os, trace, force )
- return ret
- end
-
-
- private
- def install_internal(pkg_name, os, trace, force)
-
- if trace.nil? then trace = true end
- if force.nil? then force = false end
-
- # check meta package
- is_meta_pkg = check_meta_pkg(pkg_name, os)
- if is_meta_pkg then trace = true end
-
- # compare package version with installed package's
- pkg_ver = get_attr_from_pkg(pkg_name, os, "version")
- if pkg_ver.nil? or pkg_ver.empty? then
- @log.error "#{pkg_name} package does not exist in remote package list"
- return false
- end
-
-
- compare_result = compare_version_with_installed_pkg(pkg_name, pkg_ver)
- if not force then
- case compare_result
- when -1 then
- @log.warn "Checked \"#{pkg_name}\" package version : it is bigger then remote package version"
- return true
- when 0 then
- @log.warn "Checked \"#{pkg_name}\" package version : it is same with remote package version"
- return true
- when 1, 2 then
- end
- end
-
- # if enable trace, create all dependent package list
- if trace then
- dependent_pkg_list = get_install_dependent_packages(pkg_name, os, true, force)
- if dependent_pkg_list.nil? then
- @log.error "Failed to get dependency for \"#{pkg_name}\" package"
- return false
- end
- else
- dependent_pkg_list = [pkg_name]
- end
-
- # TODO: need to compare dependent package version
- # install packages including dependent packages
- dependent_pkg_list.each do |pkg|
- if not install_pkg(pkg, os, force) then
- @log.error "#{pkg} does not exist"
- return false
- end
- add_pkg_info(pkg, os)
- end
-
- # write installed package information to file
- write_pkg_hash_to_file(nil)
-
- if trace then
- @log.info "Installed \"#{pkg_name} [#{pkg_ver}]\" package with all dependent packages.. OK"
- @log.info " [#{dependent_pkg_list.join(" -> ")}]"
- else
- @log.info "Install only \"#{pkg_name} [#{pkg_ver}]\" package.. OK"
- end
-
- return true
- end
-
-
- public
- # install local package (ignore dependent packages)
- def install_local_pkg(pkg_path, trace, force, repos_paths = nil)
-
- ret = install_local_pkg_internal(pkg_path, trace, force, repos_paths)
- return ret
- end
-
-
- private
- def install_local_pkg_internal(pkg_path, trace, force, repos_paths)
-
- pkg_name = Utils.get_package_name_from_package_file( pkg_path )
- pkg_os = Utils.get_os_from_package_file( pkg_path )
-
- if not File.exist? pkg_path then
- @log.error "\"#{pkg_path}\" file does not exist"
- return false
- end
- filename = File.basename(pkg_path)
- ext = File.extname(filename)
- if not ext.eql? ".zip" then
- @log.error "\"#{filename}\" is not zip file. binary package file should have .zip ext"
- return false
- end
- pkg_name = filename.split("_")[0]
- manifest_file = "pkginfo.manifest"
-
- uniq_name = Utils.create_uniq_name
- path = Utils::HOME + "/tmp/#{uniq_name}"
- if not File.exist? path then FileUtils.mkdir_p "#{path}" end
- begin
- if not FileInstaller.extract_a_file(pkg_path, manifest_file, path, @log) then
- @log.error "pkginfo.manifest file does not exist in #{pkg_path}"
- return false
- end
- manifest_path = File.join(path, manifest_file)
- pkg = Parser.read_single_pkginfo_from manifest_path
- new_pkg_ver = pkg.version
- pkg_conflicts = pkg.conflicts
- FileUtils.remove_dir(path, true)
- rescue Interrupt
- @log.error "Client: Interrupted.."
- FileUtils.remove_dir(path, true)
- @log.info "Removed #{path}"
- raise Interrupt
- rescue RuntimeError => e
- @log.error( e.message, Log::LV_USER)
- FileUtils.remove_dir(path, true)
- @log.info "Removed #{path}"
- return false
- end
-
- compare_result = compare_version_with_installed_pkg(pkg_name, new_pkg_ver)
- if not force then
- case compare_result
- when -1 then
- @log.warn "Installed \"#{pkg_name}\" package version is bigger.."
- return true
- when 0 then
- @log.warn "Checked \"#{pkg_name}\" package version : it is same with installed package version"
- return true
- when 1, 2 then
- end
- end
-
- if check_installed_pkg(pkg_name) then
- uninstall(pkg_name, false)
- end
-
- # TODO: Resolve conflicts
- if not resolve_conflicts_internal(pkg_conflicts) then
- @log.error "Failed to resolve conflicts [#{pkg_name}]"
- return false
- end
-
-
- if trace then
- install_dep_pkgs = pkg.install_dep_list
- new_pkg_os = pkg_os
- install_dep_pkgs.each do |p|
- # check local path first
- if not repos_paths.nil? then
- # search
- binpkgs = []
- repos_paths.each do |repos_path|
- binpkgs += Dir.glob("#{repos_path}/#{p.package_name}_*_#{new_pkg_os}.zip")
- end
- if not binpkgs.empty? then
- if not install_local_pkg_internal(binpkgs[0], true, false, repos_paths) then
- @log.warn "#{p} package is not installed"
- end
- else
- if not install_internal(p.package_name, new_pkg_os, true, false) then
- @log.warn "#{p} package is not installed"
- end
- end
- else
- if not install_internal(p.package_name, new_pkg_os, true, false) then
- @log.warn "#{p} package is not installed"
- end
- end
- end
- end
-
- # install package
- ret = FileInstaller.install(pkg_name, pkg_path, "binary", @location, @log)
-
- if not ret then
- @log.error "Install failed \"#{pkg_path} [#{new_pkg_ver}]\" file.. "
- return false
- end
-
- add_local_pkg_info(pkg_name)
- write_pkg_hash_to_file(nil)
-
- @log.info "Installed \"#{pkg_path} [#{new_pkg_ver}]\" file.. OK"
- return true
- end
-
-
- public
- # upgrade package
- def upgrade(os, trace)
-
- if trace.nil? then trace = true end
- list = check_upgrade(os)
-
- if list.empty? or list.nil? then
- @log.info "There is no packages for upgrading.."
- return false
- end
-
- list.each do |p|
- if check_installed_pkg(p) then
- if not uninstall(p, trace) then
- @log.error "Failed to uninstall \"#{p}\" package.."
- return false
- end
- end
-
- if not install_internal(p, os, trace, false) then
- @log.error "Failed to install \"#{p}\" package.."
- return false
- end
- end
-
- @log.info "Upgraded packages from #{@server_addr}.. OK"
- return true
- end
-
- public
- # check package which will be upgraded
- def check_upgrade(os)
-
- update_pkgs = []
- installed_pkg_hash_key = get_installed_pkg_list_file_path()
- installed_pkg_hash = installed_pkg_hash_loc[installed_pkg_hash_key]
- remote_pkg_hash = pkg_hash_os[os]
-
- if remote_pkg_hash.nil? then
- @log.error "There is no remote package list for #{os}."
- return nil
- end
-
- if installed_pkg_hash.nil? then
- @log.warn "There is no any installed package in \"#{@location}\""
- return remote_pkg_hash.keys
- end
-
- arr_keys = installed_pkg_hash.keys
- arr_keys.each do |k|
- installed_ver = get_attr_from_installed_pkg(k, "version")
- if not check_remote_pkg(k, os) then next end
- remote_ver = get_attr_from_pkg(k, os, "version")
- compare_result = compare_version_with_installed_pkg(k, remote_ver)
- case compare_result
- when -1 then next
- when 0 then next
- when 1 then
- @log.output "\"#{k}\" package : #{installed_ver} -> #{remote_ver}"
- update_pkgs.push(k)
- end
- end
-
- @log.info "Checked packages for upgrading.. OK"
- return update_pkgs
- end
-
- public
- # get default path for installing
- def get_default_inst_dir()
- return Dir.pwd
- end
-
- public
- # uninstall package
- # trace : if true, uninstall all dependent packages
- def uninstall(pkg_name, trace)
-
- type = "binary"
- pkg_list = []
- pkg_hash = nil
-
- if not check_installed_pkg(pkg_name) then
- @log.error "\"#{pkg_name}\" package is not installed."
- return false
- end
-
- pkg_ver = get_attr_from_installed_pkg(pkg_name, "version")
-
- if trace then
- pkg_list = get_all_reverse_install_dependent_packages(pkg_name, true)
- if pkg_list.nil? then
- @log.error "Failed to get \"#{pkg_name}\" package dependency information."
- return false
- end
- else
- pkg_list.push(pkg_name)
- end
-
- pkg_list.each do |p|
- if not check_installed_pkg(p) then next end
- if not FileInstaller.uninstall(p, type, @location, @log) then
- @log.error "Failed uninstall \"#{pkg_name}\" package"
- return false
- end
- pkg_hash = remove_pkg_info(p)
- end
-
- if trace then
- @log.info "Uninstalled \"#{pkg_name} [#{pkg_ver}]\" package with all dependent packages.. OK"
- @log.info " [#{pkg_list.join(" -> ")}]"
- else
- @log.info "Uninstalled only \"#{pkg_name} [#{pkg_ver}]\" package.. OK"
- end
-
- write_pkg_hash_to_file(nil)
- return true
- end
-
- public
- # clean
- def clean(force)
- if not force then
- puts "Do you really want to remove \"#{@location}\" path? [yes]"
- input = $stdin.gets.strip
- if input.upcase.eql? "YES" then
- @log.info "Removed \"#{@location}\""
- else
- @log.info "Canceled"
- return
- end
- end
- if File.exist? @location then FileUtils.rm_rf(@location) end
- FileUtils.mkdir_p(@location)
- #@pkg_hash_os.clear
- @installed_pkg_hash_loc.clear
- #@archive_pkg_list.clear
- @log.info "Cleaned \"#{@location}\" path.. OK"
- end
-
- public
- # get reverse build dependent packages (just 1 depth)
- def get_reverse_build_dependent_packages(pkg_name, os)
-
- result = []
- pkg_hash = @pkg_hash_os[os]
- if pkg_hash.nil? then return [] end
- pkg_list = pkg_hash.values
- pkg_list.each do |pkg|
- pkg.build_dep_list.each do |dep|
- if dep.package_name.eql? pkg_name and
- not dep.target_os_list.nil? and
- dep.target_os_list.include? os then
- result.push(pkg)
- end
- end
- end
-
- return result
- end
-
- public
- # get reverse source dependent packages (just 1 depth)
- def get_reverse_source_dependent_packages(pkg_name)
-
- result = []
- @support_os_list.each do |os|
- pkg_hash = @pkg_hash_os[os]
- pkg_list = pkg_hash.values
- pkg_list.each do |pkg|
- pkg.source_dep_list.each do |p|
- if p.package_name.eql? pkg_name then
- result.push(pkg)
- end
- end
- end
- end
-
- return result
- end
-
- public
- # get reverse install dependent packages (jush 1 depth)
- def get_reverse_install_dependent_packages(pkg_name, os)
-
- result = []
- pkg_hash = @pkg_hash_os[os]
- pkg_list = pkg_hash.values
- pkg_list.each do |pkg|
- pkg.install_dep_list.each do |p|
- if p.package_name.eql? pkg_name then
- result.push(pkg.package_name)
- end
- end
- end
-
- return result
- end
-
- public
- # get all build dependent packages (considered build priority, and reverse)
- def get_build_dependent_packages(pkg_name, os, reverse)
-
- if not check_remote_pkg(pkg_name, os) then return nil end
- if reverse.nil? then reverse = true end
-
- @all_dep_list.clear
- begin
- get_build_dependency_arr(pkg_name, os, 0)
- # in case of cross build dependency
- rescue SystemStackError
- @log.error "Failed to get dependency relation because #{pkg_name} package has cross install dependency."
- return nil
- end
-
- max = 0
- @all_dep_list.each do |p|
- if p[0].to_i > max then
- max = p[0].to_i
- else next end
- end
-
- result = []
- i = 0
- while i <= max
- @all_dep_list.each do |p|
- if p[0].to_i.eql? i then
- d = p[1]
- remote_os = get_attr_from_pkg(d.package_name, os, "os")
- remote_ver = get_attr_from_pkg(d.package_name, os, "version")
- if not d.target_os_list.include? remote_os then
- @log.error "\"#{pkg_name}\" package needs \"#{d.package_name}\" #{d.target_os_list.to_s}, but \"#{d.package_name}\" (#{remote_os}) package is in server"
- return nil
- end
- if not d.match? remote_ver then
- @log.error "\"#{pkg_name}\" package needs \"#{d.package_name}\" #{d.comp} #{d.base_version}, but \"#{d.package_name}\" (#{remote_ver}) package is in server"
- return nil
- else result.push(d.package_name) end
- end
- end
- i = i + 1
- end
-
- @log.info "Get build dependent packages for #{pkg_name} package.. OK"
- if reverse then return result.reverse.uniq.push(pkg_name)
- else return result.uniq.insert(0, pkg_name) end
- end
-
- public
- # get all install dependent packages (considered install priority, reverse, and force)
- # reverse : return reverse result
- # force : install package force
- def get_install_dependent_packages(pkg_name, os, reverse, force)
-
- if not check_remote_pkg(pkg_name, os) then return nil end
- if reverse.nil? then reverse = true end
-
- @all_dep_list.clear
- begin
- get_install_dependency_arr(pkg_name, os, force, 0)
- # in case of cross build dependency
- rescue SystemStackError
- @log.error "Failed to get dependency relation because #{pkg_name} package has cross install dependency."
- return nil
- end
-
- max = 0
- @all_dep_list.each do |p|
- if p[0].to_i > max then
- max = p[0].to_i
- else next end
- end
-
- result = []
- i = 0
- while i <= max
- @all_dep_list.each do |p|
- if p[0].to_i.eql? i then
- d = p[1]
- remote_ver = get_attr_from_pkg(d.package_name, os, "version")
- if not d.match? remote_ver then
- @log.error "\"#{pkg_name}\" package needs \"#{d.package_name}\" #{d.comp} #{d.base_version}, but \"#{d.package_name}\" (#{remote_ver}) package is in server"
- return nil
- else result.push(d.package_name) end
- end
- end
- i = i + 1
- end
-
- @log.info "Get install dependent packages for \"#{pkg_name}\" package.. OK"
- if reverse then return result.reverse.uniq.push(pkg_name)
- else return result.uniq.insert(0, pkg_name) end
- end
-
- public
- # get all install dependent packages for except (considered install priority, reverse, and force)
- # reverse : return reverse result
- # force : install package force
- def get_install_dependent_packages_with_except(pkg_name, os, reverse, force, input_list)
- if not check_remote_pkg(pkg_name, os) then return nil end
- if reverse.nil? then reverse = true end
-
- @all_dep_list.clear
- begin
- get_install_dependency_arr_with_except(pkg_name, os, force, 0, input_list)
- # in case of cross build dependency
- rescue SystemStackError
- @log.error "Failed to get dependency relation because #{pkg_name} package has cross install dependency."
- return nil
- end
-
- max = 0
- @all_dep_list.each do |p|
- if p[0].to_i > max then
- max = p[0].to_i
- else next end
- end
-
- result = []
- i = 0
- while i <= max
- @all_dep_list.each do |p|
- if p[0].to_i.eql? i then
- d = p[1]
- remote_ver = get_attr_from_pkg(d.package_name, os, "version")
- if not d.match? remote_ver then
- @log.error "\"#{pkg_name}\" package needs \"#{d.package_name}\" #{d.comp} #{d.base_version}, but \"#{d.package_name}\" (#{remote_ver}) package is in server"
- return nil
- else result.push(d.package_name) end
- end
- end
- i = i + 1
- end
-
- @log.info "Get install dependent packages for \"#{pkg_name}\" package.. OK"
- if reverse then return result.reverse.uniq.push(pkg_name)
- else return result.uniq.insert(0, pkg_name) end
- end
-
- public
- # get all reverse install dependent packages (considered reverse install priority for tracing uninstall)
- def get_all_reverse_install_dependent_packages(pkg_name, reverse)
-
- if not check_installed_pkg(pkg_name) then return nil end
- if reverse.nil? then reverse = true end
-
- begin
- res = get_all_reverse_install_dependency_arr(pkg_name, 0)
- rescue SystemStackError
- @log.error "Failed to get dependency relation because #{pkg_name} package has cross install dependency."
- return nil
- end
- res2 = res.split("::")
- result = []
- res2.each do |r|
- result.push(r.split(':')[1])
- end
-
- @log.info "Get all reverse install dependent packages for #{pkg_name} package.. OK"
- if reverse then return result.reverse.uniq
- else return result end
- end
-
- public
- # get all reverse remote dependent packages (considered reverse install priority for tracing uninstall)
- def get_all_reverse_install_dependent_packages_remote(pkg_name, os, reverse)
- #if not check_remote_pkg(pkg_name, os) then return nil end
- if reverse.nil? then reverse = true end
-
- begin
- res = get_all_reverse_install_dependency_arr_remote(pkg_name, os, 0)
- rescue SystemStackError
- @log.error "Failed to get dependency relation because #{pkg_name} package has cross install dependency."
- return nil
- end
- res2 = res.split("::")
- result = []
- res2.each do |r|
- result.push(r.split(':')[1])
- end
-
- @log.info "Get all reverse install dependent packages for #{pkg_name} package.. OK"
- if reverse then return result.reverse
- else return result end
- end
-
- public
- # check package whether to exist in remote server
- def check_remote_pkg(pkg_name, os)
-
- pkg_hash = @pkg_hash_os[os]
- if pkg_hash.nil? then return false end
- pkg = pkg_hash[pkg_name]
- if pkg.nil? then
- #@log.warn "There is no \"#{pkg_name}\" remote package information in list"
- return false
- end
-
- return true
- end
-
- public
- # check package whether to exist in installed packages
- def check_installed_pkg(pkg_name)
-
- installed_pkg_hash_key = get_installed_pkg_list_file_path()
- pkg_hash = @installed_pkg_hash_loc[installed_pkg_hash_key]
- if pkg_hash.nil? then return false end
- pkg = pkg_hash[pkg_name]
-
- if pkg.nil? then return false end
- return true
- end
-
- public
- # get attribute from installed package
- def get_attr_from_installed_pkg(pkg_name, attr)
-
- if not check_installed_pkg(pkg_name) then return nil end
- pkg = get_installed_pkg_from_list(pkg_name)
-
- if pkg.nil? then return nil end
-
- case attr
- when "version" then return pkg.version
- when "source" then return pkg.source
- when "src_path" then return pkg.src_path
- when "os" then return pkg.os
- when "build_dep_list" then return pkg.build_dep_list
- when "install_dep_list" then return pkg.install_dep_list
- when "attribute" then return pkg.attribute
- end
- end
-
- public
- # get attribute from remote package
- def get_attr_from_pkg(pkg_name, os, attr)
-
- if not check_remote_pkg(pkg_name, os) then return nil end
- pkg = get_pkg_from_list(pkg_name, os)
-
- if pkg.nil? then return nil end
-
- case attr
- when "name" then return pkg.package_name
- when "path" then return pkg.path
- when "source" then return pkg.source
- when "version" then return pkg.version
- when "src_path" then return pkg.src_path
- when "os" then return pkg.os
- when "os_list" then return pkg.os_list
- when "build_dep_list" then return pkg.build_dep_list
- when "install_dep_list" then return pkg.install_dep_list
- when "attribute" then return pkg.attribute
- when "checksum" then return pkg.checksum
- when "size" then return pkg.size
- when "conflicts" then return pkg.conflicts
-
- end
- end
-
- public
- # show a package information
- def show_pkg_info(pkg_name, os)
- if not check_remote_pkg(pkg_name, os) then
- @log.error "\"#{pkg_name}\" package does not exist"
- return ""
- end
-
- pkg = get_pkg_from_list(pkg_name, os)
- return pkg.to_s
- end
-
- public
- # show all packages information
- def show_pkg_list(os)
- pkg_hash = @pkg_hash_os[os]
- if pkg_hash.nil? then
- @log.error "\"#{os}\" package list does not exist"
- return ""
- end
-
- pkg_all_list = []
- pkg_list = pkg_hash.values
- pkg_list.each do |p|
- pkg_all_list.push([p.package_name, p.version, p.description])
- end
- return pkg_all_list.sort
- end
-
- public
- # show installed package information
- def show_installed_pkg_info(pkg_name)
-
- if not check_installed_pkg(pkg_name) then
- @log.error "\"#{pkg_name}\" package does not exist"
- return ""
- end
-
- pkg = get_installed_pkg_from_list(pkg_name)
- return pkg.to_s
- end
-
- public
- # show all installed packages information
- def show_installed_pkg_list()
-
- file_path = get_installed_pkg_list_file_path()
- pkg_hash = @installed_pkg_hash_loc[file_path]
- if pkg_hash.nil? then
- @log.error "Installed package list does not exist"
- return nil
- end
- pkg_all_list = []
- pkg_list = pkg_hash.values
- pkg_list.each do |p|
- pkg_all_list.push([p.package_name, p.version, p.description])
- end
- return pkg_all_list.sort
- end
-
-
- private
- def get_build_dependency_arr(pkg_name, os, n)
- pkg_hash = @pkg_hash_os[os]
- pkg = pkg_hash[pkg_name]
-
- if pkg.nil? then
- @log.error "\"#{pkg_name}\" package does not exist in server. please check it"
- return
- end
-
- # if package is already installed, skip tracing dependency
- if check_installed_pkg(pkg_name) then
- # compare version with installed package version
- new_pkg_ver = get_attr_from_pkg(pkg_name, os, "version")
- compare_result = compare_version_with_installed_pkg(pkg_name, new_pkg_ver)
- if compare_result == -1 or compare_result == 0 then return end
- end
-
- pkg.build_dep_list.each do |l|
- @all_dep_list.push([n, l])
- get_build_dependency_arr(l.package_name, os, n+1)
- end
-
- return
- end
-
- private
- def get_install_dependency_arr(pkg_name, os, force, n)
-
- pkg_hash = @pkg_hash_os[os]
- pkg = pkg_hash[pkg_name]
-
- if pkg.nil? then
- @log.error "\"#{pkg_name}\" package does not exist in server. please check it"
- return
- end
-
- # if package is already installed, skip tracing dependency
- if check_installed_pkg(pkg_name) then
- # compare version with installed package version
- new_pkg_ver = get_attr_from_pkg(pkg_name, os, "version")
- compare_result = compare_version_with_installed_pkg(pkg_name, new_pkg_ver)
- if not force then
- if compare_result == -1 or compare_result == 0 then return end
- end
- end
-
- pkg.install_dep_list.each do |l|
- @all_dep_list.push([n, l])
- get_install_dependency_arr(l.package_name, os, force, n+1)
- end
-
- return
- end
-
- private
- def get_install_dependency_arr_with_except(pkg_name, os, force, n, input_list)
-
- pkg_hash = @pkg_hash_os[os]
- pkg = pkg_hash[pkg_name]
-
- if pkg.nil? then
- @log.error "\"#{pkg_name}\" package does not exist in server. please check it"
- return
- end
-
- if !(pkg.install_dep_list.empty?) then
- rem_list = []
- pkg.install_dep_list.each do |i|
- input_list.each do |j|
- if i.package_name.eql? j then
- rem_list.push(i)
- end
- end
- end
- pkg.install_dep_list = pkg.install_dep_list - rem_list
- end
-
- pkg.install_dep_list.each do |l|
- @all_dep_list.push([n, l])
- get_install_dependency_arr_with_except(l.package_name, os, force, n+1, input_list)
- end
-
- return
- end
-
- private
- def get_all_reverse_install_dependency_arr(pkg_name, n)
-
- s = "#{n}:#{pkg_name}"
- installed_pkg_hash_key = get_installed_pkg_list_file_path()
- pkg_hash = @installed_pkg_hash_loc[installed_pkg_hash_key]
- pkg_list = pkg_hash.values
- pkg_list.each do |pkg|
- pkg.install_dep_list.each do |l|
- if l.package_name.eql? pkg_name then
- s = s + "::" + get_all_reverse_install_dependency_arr(pkg.package_name, n+1)
- end
- end
- end
-
- return s
- end
-
- private
- def get_all_reverse_install_dependency_arr_remote(pkg_name, os, n)
-
- s = "#{n}:#{pkg_name}"
- pkg_hash = @pkg_hash_os[os]
- pkg_list = pkg_hash.values
- pkg_list.each do |pkg|
- pkg.install_dep_list.each do |l|
- if l.package_name.eql? pkg_name then
- s = s + "::" + get_all_reverse_install_dependency_arr_remote(pkg.package_name, os, n+1)
- end
- end
- end
-
- return s
- end
-
- public
- def get_pkg_from_list(pkg_name, os)
-
- pkg_hash = @pkg_hash_os[os]
- if pkg_hash.nil? then return nil end
-
- pkg = pkg_hash[pkg_name]
-
- return pkg
- end
-
- private
- def get_installed_pkg_from_list(pkg_name)
-
- installed_pkg_hash_key = get_installed_pkg_list_file_path()
- pkg_hash = @installed_pkg_hash_loc[installed_pkg_hash_key]
- pkg = pkg_hash[pkg_name]
- if pkg.nil? then return nil end
-
- return pkg
- end
-
- private
- def resolve_conflicts_internal(conflicts_pkgs)
- if conflicts_pkgs.nil? then return true end
- conflicts_pkgs.each do |pkg|
- if check_installed_pkg(pkg.package_name) then
- if not uninstall(pkg.package_name, true) then
- @log.error "Failed to uninstall [#{pkg.package_name}] package for resolving"
- return false
- else
- @log.info "Resolved conflict package [#{pkg.package_name}]"
- end
- end
- end
- return true
- end
-
- private
- def resolve_conflicts(pkg_name, os)
- conflicts = get_attr_from_pkg(pkg_name, os, "conflicts")
- return resolve_conflicts_internal(conflicts)
- end
-
- private
- # install a package to @location after uninstalling and downloading
- def install_pkg(pkg_name, os, force)
-
- new_pkg_ver = ""
-
- # install remote server package file
- if not check_remote_pkg(pkg_name, os) then
- @log.error "\"#{pkg_name}\" package does not exist in remote server"
- return false
- end
- path = get_attr_from_pkg(pkg_name, os, "path")
- # type should be binary. type = "binary"
- # below code should be changed
- type = path.split('/')[-2]
- new_pkg_ver = get_attr_from_pkg(pkg_name, os, "version")
-
- # compare version with installed package versiona
- compare_result = compare_version_with_installed_pkg(pkg_name, new_pkg_ver)
- if not force then
- case compare_result
- when -1 then
- @log.warn "Checked \"#{pkg_name}\" package version : it is bigger then remote package version"
- return true
- when 0 then
- @log.warn "Checked \"#{pkg_name}\" package version : it is same with remote package version"
- return true
- end
- end
-
- # if package is already installed, then uninstall it
- if check_installed_pkg(pkg_name) then
- if not uninstall(pkg_name, false) then
- @log.error "Failed to uninstall \"#{pkg_name}\""
- return false
- end
- end
-
- # resolve conflict packages
- if not resolve_conflicts(pkg_name, os) then
- @log.error "Failed to resolve conflicts [#{pkg_name}]"
- return false
- end
-
- # install package
- #download
- tmp_location = nil
- begin
- tmp_location = File.join(@tmp_path,Utils.create_uniq_name)
- filepath = download(pkg_name, os, false, tmp_location)
- if filepath.nil? or filepath[0].nil? then
- return false
- end
-
- #install
- ret = FileInstaller.install(pkg_name, filepath[0], type, @location, @log)
- ensure
- #remove garbage
- FileUtils.rm_rf tmp_location if not tmp_location.nil? and File.exist? tmp_location
- end
-
- return ret
- end
-
- private
- def compare_version_with_installed_pkg(pkg_name, new_pkg_ver)
-
- if check_installed_pkg_list_file() then
- read_installed_pkg_list()
- if check_installed_pkg(pkg_name) then
- installed_pkg_ver = get_attr_from_installed_pkg(pkg_name, "version")
- compare_result = Utils.compare_version(installed_pkg_ver, new_pkg_ver)
- return compare_result
- end
- end
-
- return 2
- end
-
- private
- def remove_pkg_info(pkg_name)
-
- pkg_hash = {}
- installed_pkg_hash_key = get_installed_pkg_list_file_path()
- if @installed_pkg_hash_loc.has_key? installed_pkg_hash_key then
- pkg_hash = @installed_pkg_hash_loc[installed_pkg_hash_key]
- if pkg_hash.include? pkg_name then
- pkg_hash.delete(pkg_name)
- end
- @installed_pkg_hash_loc[installed_pkg_hash_key] = pkg_hash
- else return nil end
-
- @log.info "Removed information for \"#{pkg_name}\" package.. OK"
- return pkg_hash
- end
-
- private
- def add_pkg_info(pkg_name, os)
-
- pkg_hash = {}
- installed_pkg_hash_key = get_installed_pkg_list_file_path()
- if @installed_pkg_hash_loc.has_key? installed_pkg_hash_key then
- pkg_hash = @installed_pkg_hash_loc[installed_pkg_hash_key]
- pkg_hash[pkg_name] = get_pkg_from_list(pkg_name, os)
- else pkg_hash[pkg_name] = get_pkg_from_list(pkg_name, os) end
- @installed_pkg_hash_loc[installed_pkg_hash_key] = pkg_hash
-
- #@log.info "Added information for \"#{pkg_name}\" package.. OK"
- return pkg_hash
- end
-
- private
- # add package manifest info
- def add_local_pkg_info(pkg_name)
-
- config_path = File.join(@location, PACKAGE_INFO_DIR, "#{pkg_name}")
- pkg = read_pkginfo_file(pkg_name, config_path)
-
- if pkg.nil? then
- @log.error "Failed to read pkginfo.manifest file"
- return nil
- end
-
- pkg_hash = {}
- installed_pkg_hash_key = get_installed_pkg_list_file_path()
- if @installed_pkg_hash_loc.has_key? installed_pkg_hash_key then
- pkg_hash = @installed_pkg_hash_loc[installed_pkg_hash_key]
- pkg_hash[pkg_name] = pkg
- else pkg_hash[pkg_name] = pkg end
- @installed_pkg_hash_loc[installed_pkg_hash_key] = pkg_hash
-
- #@log.info "Added information for \"#{pkg_name}\" package.. OK"
- return pkg_hash
- end
-
- private
- # read package manifet info
- def read_pkginfo_file(pkg_name, path)
-
- file_path = File.join(path, "pkginfo.manifest")
- begin
- pkg = Parser.read_single_pkginfo_from file_path
- rescue => e
- @log.error( e.message, Log::LV_USER)
- return nil
- end
-
- if pkg.nil? then
- @log.error "Failed to read manifest file : #{file_path}"
- return nil
- end
-
- @log.info "Read information for \"#{pkg_name}\" package.. OK"
- return pkg
- end
-
- # get the lastest snapshot
- # from_server : if true, update from server
- def get_lastest_snapshot(from_server)
- ssinfo_file = "snapshot.info"
- file_url = File.join(@server_addr, ssinfo_file)
- if from_server then
- if not FileDownLoader.download(file_url, @config_dist_path, @log) then
- @log.error "Server does not have \"#{ssinfo_file}\" file."
- return nil
- end
- else
- if File.exist? file_url then
- FileUtils.cp(file_url, @config_dist_path)
- else
- @log.error "Server does not have \"#{ssinfo_file}\" file."
- return nil
- end
- end
-
- file_path = File.join(@config_dist_path, ssinfo_file)
- if not File.exist? file_path then return nil end
-
- contents = File.open(file_path, "r").read
-
- _list = contents.split("\n\n")
- if _list.nil? or _list == "" or _list.empty? then return nil end
- list = _list[-1].split("\n")
- if list.nil? or list == "" or list.empty? then return nil end
- _path = list[-1].split(":")
- if _path.nil? or _path == "" or _path.length != 2 then return nil end
- path = _path[1].strip
- if path == nil or path == "" then return nil end
-
- return path
- end
-
- def get_pkglist_path()
- return File.join(@config_dist_path, @snapshot_path)
- end
-
- # if url includes snapshot infomation, retuen true
- def is_snapshot_url(addr = nil)
- if addr.nil? then addr = @server_addr end
- addr_arr = addr.split('/')
- if addr_arr[-2].eql? "snapshots" then
- return true
- else
- return false
- end
- end
-
- def split_addr_and_snapshot(addr = nil)
- if addr.nil? then addr = @server_addr end
- addr_arr = addr.split('/')
- if addr_arr[-2].eql? "snapshots" then
- return addr_arr[0..-3].join("/"), "/"+addr_arr[-2..-1].join("/")
- else
- return nil
- end
- end
-
- def is_snapshot_exist(ss_path = nil)
- if ss_path.nil? then ss_path = @snapshot_path
- elsif ss_path == "" then return false end
-
- local_snapshot_path = File.join(@config_dist_path, ss_path)
- if File.directory? local_snapshot_path then return true
- else return false end
- end
-
- def read_remote_pkg_list(list_path)
- @support_os_list.each do |os|
- filename = PKG_LIST_FILE_PREFIX + os
- local_file_path = File.join(list_path, filename)
- if File.exist? local_file_path then
- begin
- pkg_hash = Parser.read_repo_pkg_list_from local_file_path
- @pkg_hash_os[os] = pkg_hash
- @log.info "Get package information for #{os}.. OK"
- rescue => e
- @log.error( e.message, Log::LV_USER)
- @pkg_hash_os[os] = {}
- end
- else
- @log.warn "Failed to read pkg_list_#{os} file"
- @pkg_hash_os[os] = {}
- end
- end
- end
-
- def read_supported_os_list(list_path)
- local_file_path = File.join(list_path, OS_INFO_FILE)
- if File.exist? local_file_path then
- File.open(local_file_path, "r") do |f|
- f.each_line do |l|
- os = l.strip
- if @support_os_list.index(os).nil? then @support_os_list.push(os) end
- end
- end
- @log.info "Get supported os infomation.. OK"
- else
- @log.warn "Failed to get supported os infomation"
- end
- end
-
- def download_os_list(from_server, dist = nil)
- if dist.nil? then dist = get_pkglist_path end
- file_url = File.join(@server_addr, OS_INFO_FILE)
- if from_server then
- if not FileDownLoader.download(file_url, dist, @log) then return false end
- else
- if File.exist? file_url then FileUtils.cp(file_url, dist)
- else return false end
- end
-
- return true
- end
-
- def read_archive_pkg_list(list_path)
- local_file_path = File.join(list_path, ARCHIVE_PKG_LIST_FILE)
- if File.exist? local_file_path then
- File.open(local_file_path, "r") do |f|
- f.each_line do |l|
- pkg = l.strip
- if @archive_pkg_list.index(pkg).nil? then @archive_pkg_list.push(pkg) end
- end
- end
- @log.info "Get archive package infomation.. OK"
- else
- @log.warn "Failed to get archive package infomation"
- end
- end
-
- def download_archive_pkg_list(from_server, dist = nil)
- if dist.nil? then dist = get_pkglist_path end
- file_url = File.join(@server_addr, @snapshot_path, ARCHIVE_PKG_LIST_FILE)
- if from_server then
- if not FileDownLoader.download(file_url, dist, @log) then return false end
- else
- if File.exist? file_url then FileUtils.cp(file_url, dist)
- else return false end
- end
-
- return true
- end
-
- def download_pkg_list(from_server, dist = nil)
- if dist.nil? then dist = get_pkglist_path end
- @support_os_list.each do |os|
- filename = PKG_LIST_FILE_PREFIX + os
- file_url = File.join(@server_addr, @snapshot_path, filename)
- if from_server then
- if not FileDownLoader.download(file_url, dist, @log) then return false end
- else
- if File.exist? file_url then FileUtils.cp(file_url, dist)
- else return false end
- end
- end
-
- return true
- end
-
- private
- # create installed package hash
- def read_installed_pkg_list()
-
- config_path = File.join(@location, PACKAGE_INFO_DIR)
- if not File.directory? config_path then return end
-
- installed_pkg_hash_key = get_installed_pkg_list_file_path()
- if @installed_pkg_hash_loc.has_key? installed_pkg_hash_key then return
- else
- file_path = installed_pkg_hash_key
- if not File.exist? file_path then
- #raise RuntimeError, "#{file_path} file does not exist"
- return
- end
- begin
- pkg_hash = Parser.read_repo_pkg_list_from file_path
- rescue => e
- @log.error( e.message, Log::LV_USER)
- return
- end
- @installed_pkg_hash_loc[installed_pkg_hash_key] = pkg_hash
- end
- end
-
- private
- # check to exist installed package list file
- def check_installed_pkg_list_file()
-
- if @location.nil? then raise RuntimeError, "#{@location} path does not exist" end
- file_path = get_installed_pkg_list_file_path()
- if File.exist? file_path then return true
- else return false end
- end
-
- private
- # get installed package list file path
- def get_installed_pkg_list_file_path()
-
- file_full_path = File.join(@location, PACKAGE_INFO_DIR, INSTALLED_PKG_LIST_FILE)
- return file_full_path
- end
-
- private
- # write package hash to file
- def write_pkg_hash_to_file(pkg_hash)
-
- file_path = get_installed_pkg_list_file_path()
- if pkg_hash.nil? then
- pkg_hash = @installed_pkg_hash_loc[file_path]
- end
- if not pkg_hash.nil? then
- config_path = File.join(@location, PACKAGE_INFO_DIR)
- if not File.exist? config_path then FileUtils.mkdir_p "#{config_path}" end
- if File.exist? file_path then File.delete(file_path) end
- File.open(file_path, "a+") do |file|
- pkg_list = pkg_hash.values
- pkg_list.each do |pkg|
- pkg.print_to_file(file)
- file.puts "\n"
- end
- end
- end
- @log.info "Write package informations to \"#{file_path}\".. OK"
- end
-
- private
- def check_meta_pkg(pkg_name, os)
- if not check_remote_pkg(pkg_name, os) then return false end
-
- attr = get_attr_from_pkg(pkg_name, os, "attribute")
- if attr.nil? or attr.empty? then return false end
- if attr[0].strip.upcase.eql? "ROOT" then return true
- else return false end
- end
-
- public
- def register(address, distribution, pkg_file_path, password)
- # check file exist
- if not File.exist? pkg_file_path then
- puts "The file does not exist!.. #{pkg_file_path}"
- return false
- end
-
- result = Utils.parse_server_addr(address)
- if result.nil? then
- puts "Server address is incorrect. (#{address})"
- puts "Tune as following format."
- puts " <ip>:<port>"
- exit 1
- end
- bs_ip = result[0]
- bs_port = result[1]
-
- pkg_file_path_list = []
- pkg_file_path_list.push(pkg_file_path)
- # set distribution
- @server_addr = distribution
- ret = upload(bs_ip, bs_port, pkg_file_path_list, nil, nil, nil, nil, password)
-
- if ret then @log.info "Snapshot is generated : #{ret}" end
- end
-
- ##Print change log to console.
- public
- def printChangeLog(snapshot1 = nil, snapshot2 = nil)
- snapshotPath = File.join(@config_dist_path, PackageServerConstants::SNAPSHOT_INFO_FILE_NAME)
- @log.info("Read information of snapshot from " + snapshotPath);
-
- ssController = SnapshotController.new(snapshotPath);
- changeLogController = ChangeLogController.new(@server_addr, ssController)
-
- if (snapshot1.nil?()) then
- changeLog = changeLogController.getLatestChangeLog();
- elsif snapshot2.nil?() then
- changeLog = changeLogController.getChangeLog(snapshot1);
- else
- changeLog = changeLogController.getTotalChangeLog(snapshot1, snapshot2);
- end
-
- puts changeLog
- end
-
- ##Print snapshot list to console.
- public
- def printSnapshotList(showAll=false)
- snapshotPath = File.join(@config_dist_path, PackageServerConstants::SNAPSHOT_INFO_FILE_NAME)
- @log.info("Read information of snapshot from " + snapshotPath);
-
- ssController = SnapshotController.new(snapshotPath);
- if showAll then
- result = ssController.getAllSnapshotList;
- else
- result = ssController.getManualSnapshotList ;
- end
-
- result.each() do |snapshot|
- puts PackageServerConstants::SNAPSHOT_NAME_FIELD + ": " + snapshot.getName()
- puts PackageServerConstants::SNAPSHOT_TIME_FIELD + ": " + snapshot.getTime()
- puts
- end
-
- end
-end
+++ /dev/null
-=begin
-
- clientOptParser.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'optparse'
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "utils"
-
-def set_default( options )
- if options[:t].nil? then options[:t] = false end
- if options[:type].nil? then options[:type] = 'all' end
- if options[:f].nil? then options[:f] = false end
- if options[:v].nil? then options[:v] = false end
- if options[:all].nil? then options[:all] = false end
- options[:el] = []
-end
-
-def option_error_check( options )
-
- case options[:cmd]
-
- when "clean" then
-
- when "upgrade" then
- if options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli upgrade -u <package server url> [-l <location>] [-o <os>] [--trace]"
- end
-
- when "check-upgrade" then
- if options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli check-upgrade -u <package server url> [-l <location>] [-o <os>]"
- end
-
- when "download" then
- if options[:pkg].nil? or options[:pkg].empty? or
- options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli download -P <package name> -u <package server url> [-o <os>] [-l <location>] [--trace]"
- end
- when "make-img" then
- if options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli make-img -u <package server url> [-o <os>] [-i <image info>]"
- end
- when "dep-graph" then
- if options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli dep-graph -u <package server url> [-o <os>] [--dep_type <dependency type>]"
- end
- when "install" then
- if options[:pkg].nil? or options[:pkg].empty? or
- options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli install -P <package name> -u <package server url> [-o <os>] [-l <location>] [--trace] [--force]"
- end
-
- when "install-file" then
- if options[:pkg].nil? or options[:pkg].empty? then
- raise ArgumentError, "Usage: pkg-cli install-file -P <package file> [-l <location>] [-u <package server url>] [--trace] [--force]"
- end
-
- when "uninstall" then
- if options[:pkg].nil? or options[:pkg].empty? then
- raise ArgumentError, "Usage: pkg-cli uninstall -P <package name> [-l <location>] [--trace]"
- end
-
- when "show-rpkg" then
- if options[:pkg].nil? or options[:pkg].empty? or
- options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli show-rpkg -P <package name> -u <package server url> [-o <os>]"
- end
-
- when "list-rpkg" then
- if options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli list-rpkg -u <package server url> [-o <os>]"
- end
-
- when "show-lpkg" then
- if options[:pkg].nil? or options[:pkg].empty? then
- raise ArgumentError, "Usage: pkg-cli show-lpkg -P <package name> [-l <location>]"
- end
-
- when "list-lpkg" then
-
- when "build-dep" then
- if options[:pkg].nil? or options[:pkg].empty? or
- options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli build-dep -P <package name> -u <package server url> [-o <os>]"
- end
-
- when "install-dep" then
- if options[:pkg].nil? or options[:pkg].empty? or
- options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli install-dep -P <package name> -u <package server url> [-o <os>]"
- end
-
- when "register"
- if options[:pkg].nil? or options[:pkg].empty? or options[:address].nil? or options[:address].empty? or
- options[:dist].nil? or options[:dist].empty? then
- raise ArgumentError, "Usage: pkg-cli register -P <package file path> -a <server address> -d <distribution name> -w <password>"
- end
- when "snapshotlist"
- if options[:url].nil? or options[:url].empty? then
- raise ArgumentError, "Usage: pkg-cli install-dep -P <package name> -u <package server url> [-o <os>]"
- end
- when "changelog"
-
- else
- raise ArgumentError, "Input is incorrect : #{options[:cmd]}"
- end
-end
-
-def option_parse
- options = {}
- banner = "Requiest service to package-server and control packages service command-line tool." + "\n" \
- + "\n" + "Usage: pkg-cli <SUBCOMMAND> [OPTS] or pkg-cli (-h|-v)" + "\n" \
- + "\n" + "Subcommands:" + "\n" \
- + "\t" + "clean Delete the package in your SDK environment." + "\n" \
- + "\t" + "download Download the package in your SDK environment." + "\n" \
- + "\t" + "make-img Make SDK-Image." + "\n" \
- + "\t" + "install Download the package from package-server and install the package in your SDK environment." + "\n" \
- + "\t" + "install-file Install the package in your SDK environment." + "\n" \
- + "\t" + "uninstall Uninstall the package in your SDK environment." + "\n" \
- + "\t" + "upgrade Upgrade your SDK environment." + "\n" \
- + "\t" + "check-upgrade Check packages to upgrade." + "\n" \
- + "\t" + "show-rpkg Show the package in the package-server." + "\n" \
- + "\t" + "list-rpkg Show the all packages in the package-server." + "\n" \
- + "\t" + "show-lpkg Show the package in your SDK environment." + "\n" \
- + "\t" + "list-lpkg Show the all packages in your SDK environment." + "\n" \
- + "\t" + "snapshotlist Show the snapshot list in your SDK environment." + "\n" \
- + "\t" + "changelog Show the change log in your SDK environment." + "\n" \
- + "\t" + "build-dep Show build-dependency packages" + "\n" \
- + "\t" + "install-dep Show install-dependency packages" + "\n" \
- + "\n" + "Subcommand usage:" + "\n" \
- + "\t" + "pkg-cli clean [-l <location>] [--force]" + "\n" \
- + "\t" + "pkg-cli download -P <package name> -u <package server url> [-o <os>] [-l <location>] [--trace]" + "\n" \
- + "\t" + "pkg-cli make-img -u <package server url> [-o <os>] [-i <image info>] [-x <meta-package list>]" + "\n" \
- + "\t" + "pkg-cli dep-graph -u <package server url> [-o <os>] [--dep_type <dependency type>]" + "\n" \
- + "\t" + "pkg-cli install -P <package name> -u <package server url> [-o <os>] [-l <location>] [--trace] [--force]" + "\n" \
- + "\t" + "pkg-cli install-file -P <package file> [-l <location>] [-u <package server url>] [--trace] [--force]" + "\n" \
- + "\t" + "pkg-cli uninstall -P <package name> [-l <location>] [--trace]" + "\n" \
- + "\t" + "pkg-cli upgrade -u <package server url> [-l <location>] [-o <os>] [--trace]" + "\n" \
- + "\t" + "pkg-cli check-upgrade -u <package server url> [-l <location>] [-o <os>]" + "\n" \
- + "\t" + "pkg-cli show-rpkg -P <package name> -u <package server url> [-o <os>]" + "\n" \
- + "\t" + "pkg-cli list-rpkg -u <package server url> [-o <os>]" + "\n" \
- + "\t" + "pkg-cli show-lpkg -P <package name> [-l <location>]" + "\n" \
- + "\t" + "pkg-cli list-lpkg [-l <location>]" + "\n" \
- + "\t" + "pkg-cli snapshotlist -u <package server url> [--all]" + "\n" \
- + "\t" + "pkg-cli changelog -u <package server url> [-snapshot <snapshot name,snapshot name>]" + "\n" \
- + "\t" + "pkg-cli build-dep -P <package name> -u <package server url> [-o <os>]" + "\n" \
- + "\t" + "pkg-cli install-dep -P <package name> -u <package server url> [-o <os>]" + "\n" \
- + "\t" + "pkg-cli register -P <package file path> -a <server address> -d <distribution name> -w <password>" + "\n" \
- + "\n" + "Options:" + "\n"
-
- optparse = OptionParser.new(nil, 32, ' '*8) do|opts|
- # Set a banner, displayed at the top
- # of the help screen.
-
- opts.banner = banner
-
- opts.on( '-P', '--pkg <package name/file>', 'package name or package file name' ) do |name|
- options[:pkg] = name
- end
-
- opts.on( '-o', '--os <operating system>', 'target operating system: ubuntu-32/ubuntu-64/windows-32/windows-64/macos-64' ) do |os|
- options[:os] = os
- end
-
- opts.on( '-d', '--dist <distribution name>', 'distribution name' ) do |dist|
- options[:dist] = dist
- end
-
- opts.on( '-u', '--url <server url>', 'package server url: http://127.0.0.1/dibs/unstable' ) do |url|
- options[:url] = url
- end
-
- opts.on( '-l', '--loc <location>', 'install/download location' ) do |loc|
- options[:loc] = loc
- end
-
- opts.on( '-w', '--passwd <password>', 'password' ) do |passwd|
- options[:passwd] = passwd
- end
-
- opts.on( '-a', '--address <server address>', 'package server address : 127.0.0.1:2224' ) do |address|
- options[:address] = address
- end
-
- opts.on( '--trace', 'enable trace dependent packages' ) do
- options[:t] = true
- end
-
- opts.on( '--force', 'enable force' ) do
- options[:f] = true
- end
-
- opts.on( '--dep_type <dependency type>', 'all/build/install' ) do |type|
- options[:type] = type
- end
-
- opts.on( '-i', '--info <image info>', 'sdk image information : http://download.tizen.org/sdk/packages/official' ) do |image_info|
- options[:info] = image_info
- end
-
- opts.on( '-x', '--exception <meta-package list>', 'meta-package list : MOBILE-3.0,IVI-1.0' ) do |mpackage|
- if not Utils.multi_argument_test( mpackage, "," ) then
- raise ArgumentError, "meta-package variable parsing error : #{mpackage}"
- end
- options[:el] = mpackage.split(",")
- end
-
- opts.on( '-h', '--help', 'display help' ) do
- puts opts
- exit
- end
-
- opts.on( '-v', '--version', 'display version' ) do
- puts "DIBS(Distributed Intelligent Build System) version " + Utils.get_version()
- exit
- end
-
- opts.on('--all', 'show all information') do
- options[:all] = true
- end
-
- opts.on('-s', '--snapshot snapshotName1,snapshotName2', Array, 'snapshot name') do |snapshotName|
- puts snapshotName[0], snapshotName[1]
- options[:snapshot] = snapshotName
- end
-
- end
-
- cmd = ARGV[0]
- if cmd.eql? "download" or cmd.eql? "make-img" or
- cmd.eql? "install" or cmd.eql? "show-rpkg" or
- cmd.eql? "list-rpkg" or
- cmd.eql? "uninstall" or cmd.eql? "show-lpkg" or
- cmd.eql? "list-lpkg" or cmd.eql? "dep-graph" or
- cmd.eql? "install-file" or cmd.eql? "clean" or
- cmd.eql? "upgrade" or cmd.eql? "check-upgrade" or
- cmd.eql? "build-dep" or cmd.eql? "install-dep" or
- cmd.eql? "register" or
- cmd.eql?("changelog") or
- cmd.eql?("snapshotlist") or
- cmd =~ /(-v)|(--version)/ or
- cmd =~ /(help)|(-h)|(--help)/ then
-
- if cmd.eql? "help" then
- V[0] = "-h"
- end
- options[:cmd] = ARGV[0]
- else
- raise ArgumentError, "Usage: pkg-cli <SUBCOMMAND> [OPTS] or pkg-cli -h"
- end
-
- set_default options
-
- optparse.parse!
-
- # option error check
- option_error_check options
-
- return options
-end
-
+++ /dev/null
-=begin
-
- distribution.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "parser"
-require "installer"
-
-class Distribution
- attr_accessor :name, :location, :server_url, :lock_file_path, :last_sync_changes
-
- # constant
- PKG_LIST_FILE_PREFIX = "pkg_list_"
- ARCHIVE_PKG_FILE = "archive_pkg_list"
- OS_INFO_FILE = "os_info"
- SNAPSHOT_INFO_FILE = "snapshot.info"
- LOCK_FILE = ".lock_file"
- SYNC_LOCK_FILE = ".sync_lock_file"
-
- def initialize( name, location, server_url, pkg_server )
-
- @name = name
- @location = location
- @server_url = server_url
- @log = pkg_server.log
- @integrity = pkg_server.integrity
- @lock_file_path = "#{location}/#{LOCK_FILE}"
- @sync_lock_file_path = "#{location}/#{SYNC_LOCK_FILE}"
- @pkg_hash_os = {}
- @archive_pkg_list = []
- @snapshot_hash = []
- @support_os_list = []
- @last_sync_changes = ""
-
- @log.info "Distribution class[#{name}] initialize "
-
- initialize_pkg_list()
- end
-
- def register (file_path, pkg, internal_flag)
- if pkg.nil? then
- raise RuntimeError, "package file does not contain pkginfo.manifest: [#{file_path}]"
- end
-
- if not @pkg_hash_os.has_key?(pkg.os) then
- raise RuntimeError, "package server does not support package's os : [#{pkg.os}]"
- end
-
- exist_pkg = @pkg_hash_os[pkg.os][pkg.package_name]
-
- # version check and if existing version is higher then upload version?
- if (not exist_pkg.nil?) and (not internal_flag) then
- if Utils.compare_version( exist_pkg.version, pkg.version ) != 1 then
- raise RuntimeError, "existing package's version is higher then register package : [#{pkg.package_name}] in [#{pkg.os}]"
- end
- end
-
- # modified pkg class
- pkg.origin = "local"
- pkg.source = ""
- pkg.path = "/binary/" + File.basename( file_path )
- if pkg.checksum.empty? then
- # TODO: windows and mac : sha256sum
- if Utils.is_unix_like_os( Utils::HOST_OS ) then
- pkg.checksum = `sha256sum #{file_path}`.split(" ")[0]
- end
- end
-
- if pkg.size.empty? then
- pkg.size = `du -b #{file_path}`.split[0].strip
- end
-
- @pkg_hash_os[pkg.os][pkg.package_name] = pkg
-
- return pkg
- end
-
- def register_for_test (file_path, pkg)
- if pkg.nil? then
- raise RuntimeError, "package file does not contain pkginfo.manifest: [#{file_path}]"
- end
-
- # modified pkg class
- pkg.origin = "local"
- pkg.source = ""
- pkg.path = "/temp/" + File.basename( file_path )
- # TODO: windows and mac : sha256sum
- if Utils.is_unix_like_os( Utils::HOST_OS ) then
- pkg.checksum = `sha256sum #{file_path}`.split(" ")[0]
- end
- pkg.size = `du -b #{file_path}`.split[0].strip
-
- return pkg
- end
-
- def register_archive_pkg( archive_pkg )
- if not @archive_pkg_list.include? archive_pkg then
- @archive_pkg_list.push archive_pkg
- else
- @log.error("archive package already exist : [#{archive_pkg}]", Log::LV_USER)
- end
- end
-
- def generate_snapshot(name, base_snapshot, from_cmd, change_log_string)
- # if name is nil or empty then create uniq name
- if name.nil? or name.empty? then
- name = Utils.create_uniq_name
- end
-
- # check base snapshot exist
- if File.exist? "#{@location}/snapshots/#{name}" then
- raise "Snapshot is already exist: #{name}"
- end
-
- FileUtils.mkdir "#{@location}/snapshots/#{name}"
- FileUtils.mkdir "#{@location}/changes" if not File.exists? "#{@location}/changes"
- File.open( "#{@location}/changes/#{name}.log","w") { |f| f.puts change_log_string }
-
- # base_snapshot_path
- if base_snapshot.empty? then
- snapshot_path = @location
- else
- snapshot_path = "#{@location}/snapshots/#{base_snapshot.strip}"
- end
-
- # copy package list
- @support_os_list.each do |os|
- FileUtils.copy_file( "#{snapshot_path}/#{PKG_LIST_FILE_PREFIX}#{os}",
- "#{@location}/snapshots/#{name}/#{PKG_LIST_FILE_PREFIX}#{os}" )
- end
-
- # copy archive package list
- FileUtils.copy_file( "#{snapshot_path}/#{ARCHIVE_PKG_FILE}",
- "#{@location}/snapshots/#{name}/#{ARCHIVE_PKG_FILE}" )
-
- # copy os info file
- FileUtils.copy_file( "#{snapshot_path}/#{OS_INFO_FILE}",
- "#{@location}/snapshots/#{name}/#{OS_INFO_FILE}" )
-
- # generate temp file
- tmp_file_name = ""
- while ( tmp_file_name.empty? )
- tmp_file_name = @location + "/temp/." + Utils.create_uniq_name
-
- if File.exist? tmp_file_name then
- tmp_file_name = ""
- end
- end
-
- FileUtils.copy_file( "#{@location}/#{SNAPSHOT_INFO_FILE}", tmp_file_name )
- File.open( tmp_file_name, "a" ) do |f|
- f.puts "name : #{name}"
- f.puts "time : #{Time.now.strftime("%Y%m%d%H%M%S")}"
- if from_cmd then
- f.puts "type : manual"
- else
- f.puts "type : auto"
- end
- f.puts "path : /snapshots/#{name}"
- f.puts
- end
- FileUtils.mv( tmp_file_name, "#{@location}/#{SNAPSHOT_INFO_FILE}", :force => true )
-
- # snapshot is generated
- @log.output( "snapshot is generated : #{@location}/snapshots/#{name}", Log::LV_USER)
- return name
- end
-
- def sync(force, snapshot = "")
- pkg_list_update_flag = false
- archive_update_flag = false
- distribution_update_flag = false
- changes = []
-
- # lock
- sync_lock_file = Utils.file_lock(@sync_lock_file_path)
-
- # reload pkg list from newest pkg list file
- reload_distribution_information()
-
- # check distribution's server_url
- if @server_url.empty? then
- @log.error("This distribution has not remote server")
- Utils.file_unlock(sync_lock_file)
- raise RuntimeError, "remote server address empty"
- end
-
- # generate client class
- if snapshot.nil? or snapshot.empty? then
- server_url = @server_url
- else
- server_url = "#{@server_url}/snapshots/#{snapshot}"
- end
- client = Client.create( server_url, "#{@location}/binary", @log )
- if client.nil? then
- raise RuntimeError, "Cannot create package client."
- end
-
- snapshot = client.snapshot_path.split("/").pop
-
- # parents package server check
- if client.pkg_hash_os.keys.empty? then
- @log.error("Sync process stopped by error.")
- @log.error("Parents package server does not have [[os_info]] file.")
-
- Utils.file_unlock(sync_lock_file)
- raise RuntimeError, "Parents package server does not have [[os_info]] file."
- end
-
- # update os list
- add_os_list = client.support_os_list - @support_os_list
- add_os_list.each do |os|
- add_os(os)
- changes.push "Add OS #{os}"
- pkg_list_update_flag = true
- end
-
- if force then
- remove_os_list = @support_os_list - client.support_os_list
- remove_os_list.each do |os|
- remove_os(os)
- changes.push "Remove OS #{os}"
- pkg_list_update_flag = true
- end
- end
- update_pkg_list = []
-
- @support_os_list.each do |os|
- # error check
- if client.pkg_hash_os[os].nil? then
- @log.error("os[[#{os}]] is removed in parents package server", Log::LV_USER)
- next
- end
-
- server_pkg_name_list = client.pkg_hash_os[os].keys
- local_pkg_name_list = @pkg_hash_os[os].keys
- full_pkg_name_list = server_pkg_name_list + local_pkg_name_list
- full_pkg_name_list.uniq!
-
- full_pkg_name_list.each do |pkg_name|
- ret = sync_package( pkg_name, client, os, force )
- if not ret.nil? then
- update_pkg_list.push(ret)
- pkg_list_update_flag = true
- end
- end
- end
-
- # sync archive package
- update_archive_list = sync_archive_pkg()
-
- # lock
- lock_file = Utils.file_lock(@lock_file_path)
-
- # reload pkg list from newest pkg list file
- reload_distribution_information()
-
- # update pkg_list hash
- update_pkg_list.each do |update_option, os, pkg|
- # if updated package's os is removed then skip update
- if not @support_os_list.include? os then
- next
- end
-
- case update_option
- when "ADD"
- local_pkg = @pkg_hash_os[os][pkg.package_name]
-
- if (not force) and (not local_pkg.nil?) then
- # if updated package 'local' package then skip
- if local_pkg.origin.eql? "local" then
- next
- end
-
- # if package is update when sync time then skip
- if Utils.compare_version(local_pkg.version, pkg.version) == -1 then
- next
- else
- @log.info( "update package [#{pkg.package_name}] in #{pkg.os}", Log::LV_USER)
- end
- end
-
- @pkg_hash_os[os][pkg.package_name] = pkg
- changes.push "Package: #{pkg.package_name} changes: #{pkg.get_changes}" if pkg.does_change_exist?
- when "REMOVE"
- if not force then
- if @pkg_hash_os[os][pkg.package_name].origin.eql? "local" then
- next
- else
- @log.info( "remove package [#{pkg.package_name}] in #{pkg.os}", Log::LV_USER)
- end
- end
-
- @pkg_hash_os[os].delete(pkg.package_name)
- changes.push "#{pkg.package_name} #{os} removed"
- else
- @log.error("Unsupportd update option : #{update_option}", Log::LV_USER)
- next
- end
- end
-
- update_archive_list.each do |pkg|
- if not @archive_pkg_list.include? pkg then
- @archive_pkg_list.push pkg
- changes.push "Add archive package #{pkg}"
- archive_update_flag = true
- end
- end
-
- # update pkg_list file
- if pkg_list_update_flag then
- write_all_pkg_list()
- distribution_update_flag = true
- end
-
- # update archive list file
- if archive_update_flag then
- write_archive_pkg_list()
- distribution_update_flag = true
- end
-
- # unlock
- Utils.file_unlock(lock_file)
- Utils.file_unlock(sync_lock_file)
-
- if not changes.empty? then
- @last_sync_changes = "SYSTEM: sync parents server \n#{changes.uniq.join("\n\n")}"
- end
-
- return distribution_update_flag, snapshot
- end
-
- def add_os(os)
- if @support_os_list.include? os then
- @log.error("#{os} is already exist ", Log::LV_USER)
- return
- end
-
- # update os information
- @support_os_list.push os
- @pkg_hash_os[os] = {}
- File.open("#{@location}/#{OS_INFO_FILE}", "a") do |f|
- f.puts os
- end
-
- # create pkg_list_#{os} file
- File.open( "#{@location}/#{PKG_LIST_FILE_PREFIX}#{os}", "w" ) do |f| end
- end
-
- def clean( remain_snapshot_list )
- file_list = []
- used_archive_list = []
-
- # collect remaining file's name from current package server version
- @support_os_list.each do |os|
- @pkg_hash_os[os].each_value do |pkg|
- file_list.push(pkg.path.sub("/binary/",""))
-
- pkg.source_dep_list.each do |source_dep|
- if @archive_pkg_list.include? source_dep.package_name then
- used_archive_list.push source_dep.package_name
- else
- @log.error("Can't find dependency source package : #{source_dep.package_name}")
- end
- end
- end
- end
-
- # remain only used archive package
- @archive_pkg_list = used_archive_list.uniq
- write_archive_pkg_list
-
- # collect remaning file's name from snapshot list
- remain_snapshot_list.each do |snapshot|
- os_info = "#{@location}/snapshots/#{snapshot}/#{OS_INFO_FILE}"
- os_list = []
- # if snapshot has os_info file then using that file
- if File.exist? os_info
- File.open( os_info, "r" ) do |f|
- f.each_line do |l|
- os_list.push l.strip
- end
- end
- # if snapshot does not have os_info file then using package server os_info list
- else
- os_list = @support_os_list
- end
-
- os_list.each do |os|
- begin
- info_file = "#{@location}/snapshots/#{snapshot}/#{PKG_LIST_FILE_PREFIX}#{os}"
- if not File.exist? info_file then
- @log.error( "pkg list file does not exist : #{info_file}", Log::LV_USER)
- next
- end
-
- pkg_list = Parser.read_repo_pkg_list_from(info_file)
-
- pkg_list.each_value do |pkg|
- file_list.push(pkg.path.sub("/binary/",""))
- end
- rescue => e
- @log.error( e.message, Log::LV_USER)
- end
- end
-
- used_archive_list = used_archive_list + read_archive_pkg_list( snapshot )
- end
-
- file_list.uniq!
- used_archive_list.uniq!
-
- # remove unused binary file
- Dir.new( @location + "/binary" ).each do |file|
- if file.start_with? "." then next end
-
- if not file_list.include? file then
- FileUtils.rm "#{@location}/binary/#{file}"
- end
- end
-
- # remove unused archive file
- Dir.new( @location + "/source" ).each do |file|
- if file.start_with? "." then next end
-
- if not used_archive_list.include? file then
- FileUtils.rm "#{@location}/source/#{file}"
- end
- end
-
- # remove unused snapshot
- Dir.new( @location + "/snapshots" ).each do |snapshot|
- if snapshot.start_with? "." then next end
-
- if not remain_snapshot_list.include? snapshot then
- FileUtils.rm_rf "#{@location}/snapshots/#{snapshot}"
- end
- end
-
- # remove unused changes
- Dir.new( @location + "/changes" ).each do |change|
- if change.start_with? "." then next end
-
- if not remain_snapshot_list.include? change.sub(/\.log/,'') then
- FileUtils.rm_f "#{@location}/changes/#{change}"
- end
- end
-
- # upate snapshot.info file
- update_snapshot_info_file(remain_snapshot_list)
- end
-
- def write_all_pkg_list
- @support_os_list.each do |os|
- write_pkg_list(os)
- end
- end
-
- def write_pkg_list( os )
- # if input os is empty then return
- if os.nil? or os.empty? then return end
-
- # generate temp file
- tmp_file_name = ""
- while ( tmp_file_name.empty? )
- tmp_file_name = @location + "/temp/." + Utils.create_uniq_name
-
- if File.exist? tmp_file_name then
- tmp_file_name = ""
- end
- end
-
- File.open( tmp_file_name, "w" ) do |f|
- @pkg_hash_os[os].each_value do |pkg|
- # insert package information to file
- pkg.print_to_file(f)
- # insert empty line to file
- f.puts
- end
- end
-
- FileUtils.mv( tmp_file_name, "#{@location}/#{PKG_LIST_FILE_PREFIX}#{os}", :force => true )
- end
-
- # input: package file path(zip file)
- # return: pkg
- def get_package_from_file(file_path)
- tmp_dir = @location + "/" + Utils.create_uniq_name
-
- #if file extension is .zip then check pkginfo.manifest
- if File.extname(file_path).eql? ".zip" then
- FileUtils.mkdir tmp_dir
-
- ret = FileInstaller.extract_a_file(file_path, "pkginfo.manifest", tmp_dir, @log)
- else
- return nil
- end
-
- # if pkginfo.manifest file exist
- if not ret.nil? then
- begin
- pkg = Parser.read_single_pkginfo_from "#{tmp_dir}/pkginfo.manifest"
- rescue => e
- @log.error( e.message, Log::LV_USER)
- return nil
- end
-
- FileUtils.rm_rf tmp_dir
- return pkg
- # if pkginfo.manifest file does not exist
- else
- FileUtils.rm_rf tmp_dir
- return nil
- end
- end
-
- def remove_pkg( pkg_name_list, os )
- if os.eql? "all" then os_list = @support_os_list
- else os_list = [ os ]
- end
-
- pkg_name_list.each do |package_name|
- removed_flag = false
-
- os_list.each do |o|
- if not @support_os_list.include? o then
- @log.error( "package server does not support input os : #{o}")
- next
- end
-
- if @pkg_hash_os[o].key?(package_name) then
- @log.info( "remove package [#{package_name}] in #{o}", Log::LV_USER)
- @pkg_hash_os[o].delete(package_name)
- removed_flag = true
- end
- end
-
- if not removed_flag then
- if @archive_pkg_list.include? package_name then
- @archive_pkg_list.delete package_name
- else
- @log.error( "Can't find package: [#{package_name}]", Log::LV_USER)
- end
- end
- end
-
- # check install dependency integrity
- if @integrity.eql? "YES" then
- @log.info "integrity check"
- check_integrity
- else
- @log.info "skip integrity check"
- end
-
-
- # update pkg_list file
- os_list.each do |o|
- write_pkg_list(o)
- end
- write_archive_pkg_list
- end
-
- def remove_snapshot( snapshot_list )
- remain_snapshot = []
- removed_snapshot = []
-
- # remove unused snapshot
- Dir.new( @location + "/snapshots" ).each do |snapshot|
- if snapshot.start_with? "." then next end
-
- if snapshot_list.include? snapshot then
- FileUtils.rm_rf "#{@location}/snapshots/#{snapshot}"
- snapshot_list.delete snapshot
- removed_snapshot.push snapshot
- else
- remain_snapshot.push snapshot
- end
- end
-
- # remove unused changes
- Dir.new( @location + "/changes" ).each do |change|
- if change.start_with? "." then next end
-
- if removed_snapshot.include? change.sub(/\.log/,'') then
- FileUtils.rm_f "#{@location}/changes/#{change}"
- end
- end
-
- if not snapshot_list.empty? then
- @log.output( "snapshot not exist : #{snapshot_list.join(",")}", Log::LV_USER )
- end
-
- if not removed_snapshot.empty? then
- @log.output( "snapshot removed: #{removed_snapshot.join(",")}", Log::LV_USER )
- end
-
- update_snapshot_info_file(remain_snapshot)
- end
-
- def check_integrity
- @log.info "check server pkg's install dependency integrity"
-
- @support_os_list.each do |os|
- @pkg_hash_os[os].each_value.each do |pkg|
- check_package_integrity(pkg)
- end
- end
- end
-
- def check_package_integrity(pkg)
- error_msg = "[[#{pkg.package_name}] in #{pkg.os}]'s install dependency not matched in "
- os = pkg.os
-
- pkg.install_dep_list.each do |dep|
- if @pkg_hash_os[os].has_key? dep.package_name then
- target_pkg = @pkg_hash_os[os][dep.package_name]
- else
- raise RuntimeError,(error_msg + dep.to_s)
- end
-
- # check package's version
- if not dep.match? target_pkg.version then
- raise RuntimeError,(error_msg + dep.to_s)
- end
-
- end
-
- error_msg = "[[#{pkg.package_name}] in #{pkg.os}]'s build dependency not matched in "
- pkg.build_dep_list.each do |dep|
- if dep.target_os_list.length == 0 then
- build_dep_os = os
- else
- build_dep_os = dep.target_os_list[0]
- end
-
- if @pkg_hash_os[build_dep_os].has_key? dep.package_name then
- target_pkg = @pkg_hash_os[build_dep_os][dep.package_name]
- else
- raise RuntimeError,(error_msg + dep.to_s)
- end
-
- # check package's version
- if not dep.match? target_pkg.version then
- raise RuntimeError,(error_msg + dep.to_s)
- end
- end
-
- error_msg = "[[#{pkg.package_name}] in #{pkg.os}]'s source dependency not matched in "
- pkg.source_dep_list.each do |dep|
- if not @archive_pkg_list.include? dep.package_name then
- raise RuntimeError,(error_msg + dep.to_s)
- end
- end
- end
-
- def read_archive_pkg_list( snapshot_name )
- pkg_list = []
-
- if snapshot_name.empty?
- file_name = @location + "/" + ARCHIVE_PKG_FILE
- else
- file_name = @location + "/snapshots/" + snapshot_name + "/" + ARCHIVE_PKG_FILE
- end
-
- if File.exist? file_name
- File.open(file_name, "r") do |f|
- f.each_line do |l|
- pkg_list.push(l.strip)
- end
- end
- end
-
- return pkg_list
- end
-
- def write_archive_pkg_list()
- File.open( "#{@location}/#{ARCHIVE_PKG_FILE}", "w" ) do |f|
- @archive_pkg_list.each do |pkg|
- f.puts(pkg)
- end
- end
- end
-
- def initialize_pkg_list
- if not File.exist? "#{@location}/#{OS_INFO_FILE}" then
- return
- end
-
- # get support_os_list
- @support_os_list = []
- File.open( "#{@location}/#{OS_INFO_FILE}", "r" ) do |f|
- f.each_line do |l|
- @support_os_list.push l.strip
- end
- end
-
- # read package_list file
- @support_os_list.each do |os|
- @pkg_hash_os[os] = {}
- pkg_list_file = "#{@location}/#{PKG_LIST_FILE_PREFIX}#{os}"
-
- if File.exist? pkg_list_file then
- begin
- @pkg_hash_os[os] = Parser.read_repo_pkg_list_from( pkg_list_file )
- rescue => e
- @log.error( e.message, Log::LV_USER)
- @pkg_hash_os[os] = nil
- end
- end
- end
-
- # read archive package_list file
- @archive_pkg_list = read_archive_pkg_list("")
- end
-
- def get_link_package(pkg, pkg_os)
- pkg.os_list.each do |os|
- # skip in same os for origin package
- if pkg_os.eql? os then next end
- # skip in unsupported os
- if not @support_os_list.include? os then next end
-
- exist_pkg = @pkg_hash_os[os][pkg.package_name]
- if exist_pkg.nil? then next end
-
- compare_version = Utils.compare_version(pkg.version, exist_pkg.version)
- # if version same then compatible package
- if compare_version == 0 then
- return exist_pkg
- end
- end
-
- return nil
- end
-
- # PRIVATE METHODS/VARIABLES
- private
-
- def sync_package( pkg_name, client, os, force )
- server_pkg = client.pkg_hash_os[os][pkg_name]
- local_pkg = @pkg_hash_os[os][pkg_name]
-
- # if server and local has package
- if ( not server_pkg.nil? ) and ( not local_pkg.nil? ) then
- version_cmp = Utils.compare_version( local_pkg.version, server_pkg.version )
- if ( version_cmp == 0 ) then
- # version is same then skip update
- return nil
- end
-
- if ( version_cmp == -1 ) then
- # local package's version is higher than server packages's version then skip update
- return nil
- end
-
- if ( local_pkg.origin.eql? "local" ) and (not force) then
- # local_pkg is generated from local and not force mode then skip update
- return nil
- end
-
- pkg = sync_package2( server_pkg, client, os )
- return ["ADD", os, pkg]
- # if package exist only server
- elsif ( not server_pkg.nil? ) then
- pkg = sync_package2( server_pkg, client, os )
- return ["ADD", os, pkg]
- # if package exist only local
- elsif ( not local_pkg.nil? ) then
- # if local pkg is generated from local then skip
- if local_pkg.origin.eql? "local" and (not force) then
- return nil
- end
-
- # package remove
- return ["REMOVE", os, local_pkg]
- else
- raise RuntimeError,"hash merge error!"
- end
-
- return nil
- end
-
- def sync_package2( pkg, client, os )
- pkg_name = pkg.package_name
-
- # package update
- file_path_list = client.download( pkg_name, os, false )
-
- # file download error check
- if file_path_list.nil? or file_path_list.empty? then
- @log.error("Can't download package file [#{pkg_name}]", Log::LV_USER)
- return nil
- else
- file_path = file_path_list[0]
- end
-
- # update pkg class
- pkg.path = "/binary/#{File.basename(file_path)}"
- pkg.origin = client.server_addr
- return pkg
-
- end
-
- def update_snapshot_info_file(remain_snapshot_list)
- if not File.exist? "#{@location}/#{SNAPSHOT_INFO_FILE}"
- @log.error "Can not find snapshot info file"
- return
- end
-
- # generate temp file
- tmp_file_name = ""
- while ( tmp_file_name.empty? )
- tmp_file_name = @location + "/temp/." + Utils.create_uniq_name
-
- if File.exist? tmp_file_name then
- tmp_file_name = ""
- end
- end
-
- # modify snapshot info File
- info_file = File.readlines("#{@location}/#{SNAPSHOT_INFO_FILE}")
- File.open(tmp_file_name, 'w') do |f|
- save_flag = false
- info_file.each do |line|
- if line =~ /name :/ then
- if remain_snapshot_list.include? line.split(':')[1].strip then
- save_flag = true
- else
- save_flag = false
- end
-
- end
-
- if save_flag then
- f.puts line
- end
- end
- end
-
- FileUtils.mv( tmp_file_name, "#{@location}/#{SNAPSHOT_INFO_FILE}", :force => true )
- end
-
- def get_all_reverse_depends_pkgs(pkg, checked_list)
- depends_list = []
-
- @support_os_list.each do |os|
- @pkg_hash_os[os].each_value do |dpkg|
- if dpkg.install_dep_list.include? pkg or \
- dpkg.build_dep_list.include? pkg then
- depends_list.push opkg
- end
-
- end
- end
-
- depends_list.each do |dpkg|
- checked_list.push dpkg
- rdepends_list = get_all_reverse_depends_pkgs( dpkg, checked_list )
- end
-
- return rdepends_list
- end
-
- def reload_distribution_information
- if not File.exist?("#{@location}/#{OS_INFO_FILE}") then
- return
- end
-
- # get support_os_list
- @support_os_list = []
- File.open( "#{@location}/#{OS_INFO_FILE}", "r" ) do |f|
- f.each_line do |l|
- @support_os_list.push l.strip
- end
- end
-
- # read binary package_list file
- @support_os_list.each do |os|
- @pkg_hash_os[os] = {}
- pkg_list_file = "#{@location}/#{PKG_LIST_FILE_PREFIX}#{os}"
-
- if File.exist? pkg_list_file then
- begin
- @pkg_hash_os[os] = Parser.read_repo_pkg_list_from( pkg_list_file )
- rescue => e
- @log.error( e.message, Log::LV_USER)
- @pkg_hash_os[os] = nil
- end
- end
- end
-
- # read archive package_list file
- @archive_pkg_list = read_archive_pkg_list( "" )
- end
-
- def remove_os(os)
- if not @support_os_list.include? os then
- @log.error("Can't remove os : #{os} does not exist ", Log::LV_USER)
- end
-
- # update os information
- @support_os_list.delete os
- @pkg_hash_os.delete os
-
- # generate temp file
- tmp_file_name = ""
- while ( tmp_file_name.empty? )
- tmp_file_name = @location + "/temp/." + Utils.create_uniq_name
-
- if File.exist? tmp_file_name then
- tmp_file_name = ""
- end
- end
-
- info_file = File.readlines("#{@location}/#{OS_INFO_FILE}")
- File.open(tmp_file_name, "w") do |f|
- info_file.each do |line|
- if not line.strip.eql? os then
- f.puts line
- end
- end
- end
-
- FileUtils.mv( tmp_file_name, "#{@location}/#{OS_INFO_FILE}", :force => true )
-
- # delete pkg_list_#{os} file
- File.delete( "#{@location}/#{PKG_LIST_FILE_PREFIX}#{os}" )
- end
-
- def sync_archive_pkg
- client = Client.create( @server_url, "#{@location}/source", @log )
- if client.nil? then
- raise RuntimeError, "Cannot create package client."
- end
-
- download_list = client.archive_pkg_list - @archive_pkg_list
-
- updated_file_list = []
-
- # if update list is empty then return empty array
- if download_list.empty? then return updated_file_list end
-
- download_list.each do |pkg|
- file = client.download_dep_source(pkg)
- if file.nil?
- @log.error("Can't download archive package [#{pkg}]", Log::LV_USER)
- else
- updated_file_list.push pkg
- end
- end
-
- return updated_file_list
- end
-
-end
+++ /dev/null
-=begin
-
- downloader.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "utils"
-
-class FileDownLoader
-
- def FileDownLoader.download(url, path, logger)
- ret = false
-
- if not File.directory? path then
- logger.error "\"#{path}\" does not exist"
- return ret
- end
-
- is_remote = Utils.is_url_remote(url)
- filename = url.split('/')[-1]
- fullpath = File.join(path, filename)
-
- logger.info "Downloading #{url}"
- if is_remote then
- if logger.path.nil? or logger.path.empty? then
- ret = system "wget --no-cache #{url} -O #{fullpath} -nv --tries=3 --connect-timeout=10"
- else
- pid,status = Utils.execute_shell_with_log( "wget --no-cache #{url} -O #{fullpath} -nv --tries=3 --connect-timeout=10", logger.path )
- if not status.nil? then
- ret = (status.exitstatus != 0) ? false : true
- end
- end
- else
- if not File.exist? url then
- logger.error "\"#{url}\" file does not exist"
- return false
- else
- ret = system "cp #{url} #{fullpath}"
- end
- end
-
- # need verify
- if ret then
- logger.info "Downloaded #{filename}.. OK"
- else
- logger.error "Failed to download #{filename}"
- logger.error " [dist: #{path}]"
- end
- return ret
- end
-end
-
+++ /dev/null
-=begin
-
- installer.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "packageServerConfig"
-require "log"
-require "utils"
-if Utils.is_windows_like_os( Utils::HOST_OS ) then
- require "rubygems"
- require "zip/zip"
-end
-
-class FileInstaller
-
- CONFIG_PATH = "#{PackageServerConfig::CONFIG_ROOT}/client"
- PACKAGE_INFO_DIR = ".info"
- PACKAGE_MANIFEST = "pkginfo.manifest"
-
- def FileInstaller.install(package_name, package_file_path, type, target_path, logger)
-
- if not File.exist? package_file_path then
- logger.error "\"#{package_file_path}\" file does not exist."
- return false
- end
-
- case type
- # install script when binary package
- when "binary" then
- uniq_name = Utils.create_uniq_name
- path = Utils::HOME + "/tmp/#{uniq_name}"
- # windows has limitation for file path length
- if Utils.is_windows_like_os( Utils::HOST_OS ) then
- drive = Utils::HOME.split("/")[0]
- path = "#{drive}/#{uniq_name}"
- end
- if not File.exist? path then FileUtils.mkdir_p "#{path}" end
-
- if File.directory? path then
- log = "## create temporary dir : #{path}\n"
- else
- logger.error "Failed to create temporary dir"
- logger.info " [path: #{path}]"
- return false
- end
-
- begin
- logger.info "Installing \"#{package_name}\" package.."
- logger.info " [file: #{package_file_path}]"
-
- log = log + "## Extract file : #{package_file_path}\n"
- result = extract_file(package_name, package_file_path, path, target_path, logger)
- if result == "" or result.nil? then
- write_log(target_path, package_name, log)
- return false
- else log = log + result end
-
- log = log + "## Move files : \"#{path}\" to \"#{target_path}\"\n"
- result = move_dir(package_name, path, target_path, logger)
- if result.nil? then
- write_log(target_path, package_name, log)
- return false
- else log = log + result end
-
- log = log + "## Execute install script\n"
- result = execute_install_script(package_name, path, target_path, logger)
- if result.nil? then
- write_log(target_path, package_name, log)
- return false
- else log = log + result end
-
- log = log + "## Move remove script\n"
- result = move_remove_script(package_name, path, target_path, logger)
- if result.nil? then
- write_log(target_path, package_name, log)
- return false
- else log = log + result end
-
- log = log + "## Remove temporary dir : #{path} #####\n"
- result = Utils.execute_shell_return("rm -rf #{path}")
- if result.nil? then
- logger.warn "Failed to remove temporary path"
- logger.info " [path: #{path}]"
- end
- rescue Interrupt
- logger.error "FileInstaller: Interrupted.."
- Utils.execute_shell("rm -rf #{path}")
- logger.info "Removed #{path}"
- raise Interrupt
- end
- write_log(target_path, package_name, log)
-=begin
- target_config_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
- if not File.exist? target_config_path then FileUtils.mkdir_p(target_config_path) end
- pkg_inst_log = "#{package_name}_inst.log"
- pkg_inst_log_path = File.join(target_config_path, pkg_inst_log)
-
- File.open(pkg_inst_log_path, "a+") do |f|
- f.puts log
- end
-=end
- when "source" then
- end
-
- # need verify
- logger.info "Installed \"#{package_name}\" package.. OK"
- logger.info " [path: #{target_path}]"
- return true;
- end
-
- def FileInstaller.write_log(target_path, package_name, log)
- target_config_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
- if not File.exist? target_config_path then FileUtils.mkdir_p(target_config_path) end
- pkg_inst_log = "#{package_name}_inst.log"
- pkg_inst_log_path = File.join(target_config_path, pkg_inst_log)
-
- File.open(pkg_inst_log_path, "a+") do |f|
- f.puts log
- end
- end
-
- def FileInstaller.move_remove_script(package_name, path, target_path, logger)
- target_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
- if not File.exist? target_path then FileUtils.mkdir_p(target_path) end
- script_file_prefix = "#{path}/remove.*"
- script_file = Dir.glob(script_file_prefix)[0]
- log = ""
-
- if not script_file.nil? then
- result = Utils.execute_shell_return("mv #{script_file} #{target_path}")
- if result.nil? then
- logger.error "Failed to move a remove script"
- logger.info " [file: #{script_file}]"
- logger.info " [from: #{path}]"
- logger.info " [to: #{target_path}]"
- return nil
- else log = result.join("") end
- logger.info "Moved remove script file.. OK"
- log = log + "[file: #{script_file}]\n"
- log = log + "[from: #{path}]\n"
- log = log + "[to: #{target_path}]\n"
- end
-
- return log
- end
-
-
- # Does not verify that the script execution is successful.
- # Register shortcut should be failed.
- def FileInstaller.execute_install_script(package_name, path, target_path, logger)
- script_file_prefix = "#{path}/install.*"
- script_file = Dir.glob(script_file_prefix)[0]
- log = ""
-
- if not script_file.nil? then
- logger.info "Execute \"#{script_file}\" file"
- if Utils.is_windows_like_os( Utils::HOST_OS ) then
- target_path = target_path.gsub("/","\\")
- cmd = "set INSTALLED_PATH=\"#{target_path}\"& #{script_file}"
- else
- `chmod +x #{script_file}`
- cmd = "INSTALLED_PATH=\"#{target_path}\" #{script_file}"
- end
- logger.info " [cmd: #{cmd}]"
- log = `#{cmd}`
- logger.info "Executed install script file.. OK"
- log = log + "[file: #{script_file}]\n"
- log = log + "[cmd: #{cmd}]\n"
- end
-
- return log
- end
-
- # Does not verify that the script execution is successful.
- # Removing shortcut should be failed.
- def FileInstaller.execute_remove_script(package_name, target_path, logger)
- info_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
- if not File.directory? info_path then
- logger.error "\"#{info_path}\" does not exist."
- return nil
- end
-
- script_file_prefix = "#{info_path}/remove.*"
- script_file = Dir.glob(script_file_prefix)[0]
- log = ""
-
- if not script_file.nil? then
- logger.info "Execute \"#{script_file}\" file"
- if Utils.is_windows_like_os( Utils::HOST_OS ) then
- target_path = target_path.gsub("/","\\")
- cmd = "set INSTALLED_PATH=\"#{target_path}\"& #{script_file}"
- else
- `chmod +x #{script_file}`
- cmd = "INSTALLED_PATH=\"#{target_path}\" #{script_file}"
- end
- logger.info " [cmd: #{cmd}]"
- log = `#{cmd}`
- logger.info "Executed remote script file.. OK"
- log = log + "[file: #{script_file}]\n"
- log = log + "[cmd: #{cmd}]\n"
- end
-
- return log
- end
-
- def FileInstaller.remove_pkg_files(package_name, target_path, logger)
- list_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
-
- if not File.directory? list_path then
- logger.error "\"#{list_path}\" does not exist."
- return false
- end
-
- list_file_name = "#{list_path}/#{package_name}.list"
- list_file = Dir.glob(list_file_name)[0]
- directories = []
-
- if not list_file.nil? then
- File.open(list_file, "r") do |file|
- file.each_line do |f|
- f = f.strip
- if f.nil? or f.empty? then next end
- file_path = File.join(target_path, f)
- if File.directory? file_path then
- if File.symlink? file_path then
- File.unlink file_path
- next
- end
- entries = Dir.entries(file_path)
- if entries.include? "." then entries.delete(".") end
- if entries.include? ".." then entries.delete("..") end
- if entries.empty? or entries.nil? then
- begin
- Dir.rmdir(file_path)
- rescue SystemCallError
- logger.warn "\"#{file_path}\" directory is not empty"
- end
- else directories.push(file_path) end
- elsif File.file? file_path then FileUtils.rm_f(file_path)
- elsif File.symlink? file_path then File.unlink file_path
- # if files are already removed by remove script,
- else logger.warn "\"#{file_path}\" does not exist" end
- end
- end
-
- directories.reverse.each do |path|
- if not File.directory? path then next end
- entries = Dir.entries(path)
- if entries.include? "." then entries.delete(".") end
- if entries.include? ".." then entries.delete("..") end
- if entries.empty? or entries.nil? then
- begin
- Dir.rmdir(path)
- rescue SystemCallError
- logger.warn "\"#{file_path}\" directory is not empty"
- end
- else next end
- end
- end
- Utils.execute_shell("rm -rf #{list_path}")
- return true
- end
-
- def FileInstaller.uninstall(package_name, type, target_path, logger)
- case type
- when "binary" then
- result = execute_remove_script(package_name, target_path, logger)
- if result.nil? then return false end
- if not remove_pkg_files(package_name, target_path, logger) then return false end
- when "source" then
- end
-
- return true
- end
-
- def FileInstaller.move_dir(package_name, source_path, target_path, logger)
- config_path = File.join(target_path, PACKAGE_INFO_DIR, package_name)
- pkginfo_path = File.join(source_path, PACKAGE_MANIFEST)
- data_path = File.join(source_path, "data")
- log = ""
-
- if not File.exist? pkginfo_path then
- logger.error "#{PACKAGE_MANIFEST} file does not exist. Check #{source_path}"
- return nil
- else FileUtils.cp pkginfo_path, config_path end
-
- if File.exist? data_path then
- if Dir.entries(data_path).count > 2 then
- # if os is linux, use cpio. it is faster than cp
- if Utils.is_linux_like_os( Utils::HOST_OS ) then
- absolute_path = `readlink -f #{target_path}`
- result = Utils.execute_shell_return("cd #{data_path}; find . -depth | cpio -pldm #{absolute_path}")
- else
- result = Utils.execute_shell_return("cp -r #{data_path}/* #{target_path}")
- end
- if result.nil? then
- logger.error "Failed to move files"
- logger.info " [from: #{source_path}]"
- logger.info " [to: #{target_path}]"
- return nil
- end
- logger.info "Moved files.. OK"
- log = log + "[from: #{source_path}]\n"
- log = log + "[to: #{target_path}]\n"
- end
- else logger.warn "\"data\" directory does not exist." end
-
- return log
- end
-
- def FileInstaller.extract_file(package_name, package_file_path, path, target_path, logger)
- dirname = File.dirname(package_file_path)
- filename = File.basename(package_file_path)
- ext = File.extname(filename)
-
- target_config_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
- if not File.exist? target_config_path then FileUtils.mkdir_p(target_config_path) end
- pkg_file_list = "#{package_name}.list"
- pkg_file_list_path = File.join(target_config_path, pkg_file_list)
- temp_pkg_file_list = "temp_file_list"
- temp_pkg_file_list_path = File.join(target_config_path, "temp_file_list")
-
- show_file_list_command = nil
- extrach_file_list_command = nil
- log = ""
-
- case ext
- when ".zip" then
- show_file_list_command = "zip -sf #{package_file_path}"
- extract_file_list_command = "unzip -o \"#{package_file_path}\" -d \"#{path}\""
- when ".tar" then
- # path should be unix path if it is used in tar command
- _package_file_path = Utils.get_unix_path(package_file_path)
- _path = Utils.get_unix_path(path)
- show_file_list_command = "tar -tf #{_package_file_path}"
- extract_file_list_command = "tar xf \"#{_package_file_path}\" -C \"#{_path}\""
- else
- logger.error "\"#{filename}\" is not supported."
- return nil
- end
-
- system "#{show_file_list_command} > #{temp_pkg_file_list_path}"
- File.open(pkg_file_list_path, "a+") do |targetfile|
- File.open(temp_pkg_file_list_path, "r") do |sourcefile|
- sourcefile.each_line do |l|
- if l.strip.start_with? "data/" then
- ml = l.strip[5..-1]
- targetfile.puts ml
- else next end
- end
- end
- end
- File.delete(temp_pkg_file_list_path)
-
- case ext
- when ".zip" then
- if Utils.is_windows_like_os( Utils::HOST_OS ) then
- log = unzip_file(package_file_path, path)
- else
- #result = Utils.execute_shell_return(extract_file_list_command)
- #if result.nil? then log = nil
- #else log = result.join("") end
- log = `#{extract_file_list_command}`
- end
- when ".tar" then
- #result = Utils.execute_shell_return(extract_file_list_command)
- #if result.nil? then log = nil
- #else log = result.join("") end
- log = `#{extract_file_list_command}`
- end
-
- if log == "" then log = nil end
- if log.nil? then
- logger.error "Failed to extract \"#{filename}\" file"
- logger.info " [file: #{package_file_path}]"
- logger.info " [from: #{path}]"
- logger.info " [to: #{target_path}]"
- logger.info " [cmd: #{extract_file_list_command}]"
- return nil
- end
-
- logger.info "Extracted \"#{filename}\" file.. OK"
- log = log + "[file: #{package_file_path}]\n"
- log = log + "[from: #{path}]\n"
- log = log + "[to: #{target_path}]\n"
- log = log + "[cmd: #{extract_file_list_command}]\n"
- return log
- end
-
- def FileInstaller.extract_a_file(package_file_path, target_file, path, logger)
- dirname = File.dirname(package_file_path)
- filename = File.basename(package_file_path)
- ext = File.extname(filename)
-
- case ext
- when ".zip" then
- if not path.nil? then
- extract_file_command = "unzip -x #{package_file_path} #{target_file} -d #{path}"
- else
- extract_file_command = "unzip -x #{package_file_path} #{target_file}"
- end
- when ".tar" then
- # path should be unix path if it is used in tar command
- _package_file_path = Utils.get_unix_path(package_file_path)
- _path = Utils.get_unix_path(path)
- if not path.nil? then
- extract_file_command = "tar xf #{_package_file_path} -C #{_path} #{target_file}"
- else
- extract_file_command = "tar xf #{_package_file_path} #{target_file}"
- end
- end
-
- system "#{extract_file_command}"
-
- if not path.nil? then
- target_file_path = File.join(path, target_file)
- else
- target_file_path = target_file
- end
-
- if File.exist? target_file_path then
- logger.info "Extracted \"#{target_file}\" file.."
- return true
- else
- logger.warn "Failed to extracted \"#{target_file}\" file.."
- logger.info " [file: #{package_file_path}]"
- logger.info " [path: #{path}]"
- logger.info " [cmd: #{extract_file_command}]"
- return false
- end
- end
-
- def FileInstaller.unzip_file(zipfile, dest)
- log = ""
- Zip::ZipFile.open(zipfile) do |zip_file|
- zip_file.each do |f|
- f_path = File.join(dest, f.name)
- FileUtils.mkdir_p(File.dirname(f_path))
- if File.exist?(f_path) then
- log = log + "[Warn] Exist file : #{f_path}\n" unless f_path.end_with? "/"
- else
- zip_file.extract(f, f_path)
- if not f_path.end_with? "/" then
- log = log + "[info] Extracted file : #{f_path}\n"
- end
- end
- end
- end
- return log
- end
-
- def FileInstaller.unzip_a_file(zipfile, file, dest)
- Zip::ZipFile.open(zipfile) do |zip_file|
- zip_file.each do |f|
- if f.name.strip == file then
- f_path = File.join(dest, f.name)
- FileUtils.mkdir_p(File.dirname(f_path))
- zip_file.extract(f, f_path) unless File.exist?(f_path)
- break
- end
- end
- end
- end
-end
+++ /dev/null
-
-class Distribution
- attr_accessor :name, :time
-
- def initialize(name, time)
- @name = name
- @time = time
- end
-end
\ No newline at end of file
+++ /dev/null
-
-
-class Snapshot
- attr_accessor :properties
-
- def initialize(properties)
- @properties = properties;
- end
-
- private
- def getValue(key)
- properties.each() do |property|
- if property.key().eql?(key) then
- return property.value()
- end
- end
-
- return nil;
- end
-
- public
- def getName
- return getValue(PackageServerConstants::SNAPSHOT_NAME_FIELD)
- end
-
- public
- def getTime
- return getValue(PackageServerConstants::SNAPSHOT_TIME_FIELD)
- end
-
- public
- def getType
- return getValue(PackageServerConstants::SNAPSHOT_TYPE_FIELD)
- end
-
- public
- def getPath
- return getValue(PackageServerConstants::SNAPSHOT_PATH_FIELD)
- end
-end
\ No newline at end of file
+++ /dev/null
-=begin
-
- packageServer.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-$LOAD_PATH.unshift File.dirname(__FILE__)
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/build_server"
-require "BuildComm"
-require "packageServerConfig"
-require "distribution"
-require "SocketRegisterListener"
-require "client"
-require "utils"
-require "FileUtil"
-require "DistSync"
-require "log"
-
-class PackageServer
- attr_accessor :id, :location, :log, :integrity
- attr_accessor :finish, :port
- attr_accessor :incoming_path
- attr_accessor :distribution_list
- attr_accessor :sync_interval, :passwd
-
- # constant
- SERVER_ROOT = "#{PackageServerConfig::CONFIG_ROOT}/pkg_server"
- DIBS_LOCK_FILE_PATH = "#{SERVER_ROOT}/.server_loc"
-
- # initialize
- def initialize (id)
- @location = ""
- @distribution_list = []
- # distribution name -> server_url hash
- @dist_to_server_url = {}
- @integrity = "YES"
- @auto_sync_flag = "NO"
- @finish = false
- @port = 3333
- @test_time=0 #test time in mili-seconds
- @lock_file= nil
- @sync_interval = 3600
- @passwd = ""
-
- update_config_information(id)
-
- if not File.exist?( SERVER_ROOT )
- FileUtils.mkdir_p( SERVER_ROOT )
- end
- @log = StandardOutLog.new( @log_file_path )
-
- server_information_initialize()
- end
-
- # create
- def create( id, dist_name, server_url, loc = nil )
- update_config_information(id)
-
- if loc.nil? or loc.empty? then
- @location = Dir.pwd + "/" + @id
- else
- if Utils.is_absolute_path(loc) then
- @location = File.join(loc, @id)
- else
- @location = File.expand_path(File.join(Dir.pwd, loc, @id))
- end
- end
-
- # error check : check for already exist in server @id
- if File.exist? @config_dir
- raise RuntimeError, "Server create fail. server id [#{@id}] is already exist"
- end
-
- # name check
- if dist_name.strip.eql? "distribution.info" then
- raise RuntimeError, "id \"distribution.info\" is not available"
- end
-
- # create locking file
- lock_file = Utils.file_lock(DIBS_LOCK_FILE_PATH)
-
- # create server config directory
- FileUtils.mkdir_p @config_dir
- FileUtils.mkdir_p @incoming_path
-
- if (not server_url.empty?) and \
- (not Utils.is_url_remote(server_url)) and \
- (not Utils.is_absolute_path(server_url)) then
- # if server_url is local server address then generate absoulte path
- server_url = File.join(Utils::WORKING_DIR, server_url)
- end
-
- # create server configure file
- File.open( @config_file_path, "w" ) do |f|
- f.puts "location : #{@location}"
- f.puts "integrity check : #{@integrity}"
- f.puts "auto sync : #{@auto_sync_flag}"
- f.puts "sync interval : #{@sync_interval}"
- f.puts "server port : #{@port}"
- f.puts "server_url : #{dist_name} -> #{server_url}"
- end
-
- # create location's directory
- FileUtils.mkdir_p "#{@location}"
-
- create_distribution_struct( dist_name, server_url )
- Utils.file_unlock(lock_file)
-
- @log.output( "package server [#{@id}] created successfully", Log::LV_USER )
- @log.output( " - server location : #{@location}", Log::LV_USER )
- @log.output( " - server configure file : #{@config_file_path}", Log::LV_USER )
- @log.output( " - default server port : #{@port}", Log::LV_USER )
- end
-
- def register( file_path_list, dist_name, snapshot, test_flag, internal_flag = false )
- @log.info "package register in server"
- distribution = get_distribution( dist_name )
-
- # distribution lock
- @lock_file = Utils.file_lock(distribution.lock_file_path)
-
- updated_os_list = []
- registed_package_list = []
- binary_pkg_file_path_list = []
- link_pkg_file_path_list = []
- archive_pkg_file_path_list = []
- snapshot_name = ""
-
- file_path_list.each do |f|
- # error check for file exist
- if not File.exist? f
- raise RuntimeError, "package file does not exist [#{f}]"
- end
-
- pkg = distribution.get_package_from_file(f)
-
- # binary package
- if not pkg.nil? then
-
- # find link package
- pkg_os = Utils.get_os_from_package_file(f)
- link_pkg = distribution.get_link_package(pkg, pkg_os)
- if link_pkg.nil? then
- binary_pkg_file_path_list.push f
- else
- link_pkg_file_path_list.push [link_pkg.path, File.basename(f)]
- pkg.checksum = link_pkg.checksum
- pkg.size = link_pkg.size
- end
-
- # update os information
- if pkg.os_list.include? pkg_os then
- pkg.os = pkg_os
- pkg.os_list = [pkg_os]
- else
- raise RuntimeError, "package file name is incorrect [#{f}]"
- end
-
- updated_pkg = register_package(distribution, pkg, f, test_flag, internal_flag)
-
- updated_os_list.push updated_pkg.os
- registed_package_list.push updated_pkg
- # archive package
- else
- if test_flag then
- @log.error("archive package does not using test mode", Log::LV_USER)
- return
- end
-
- file_name = File.basename(f)
- distribution.register_archive_pkg(file_name)
- archive_pkg_file_path_list.push f
- end
- end
-
- # check install dependency integrity
- if not test_flag and @integrity.eql? "YES" then
- registed_package_list.each do |pkg|
- distribution.check_package_integrity(pkg)
- end
- end
-
- # move file to package server
- binary_pkg_file_path_list.each do |l|
- if test_flag then
- #FileUtils.ln( l, "#{distribution.location}/temp/#{File.basename(l)}", :force => true )
- if not FileUtil.safeLink( l, "#{distribution.location}/temp/#{File.basename(l)}") then
- @log.error("Failed to link file [#{l}] to [#{distribution.location}/temp/#{File.basename(l)}]")
- end
- else
- #FileUtils.ln( l, "#{distribution.location}/binary/#{File.basename(l)}", :force => true )
- if not FileUtil.safeLink( l, "#{distribution.location}/binary/#{File.basename(l)}") then
- @log.error("Failed to link file [#{l}] to [#{distribution.location}/binary/#{File.basename(l)}]")
- end
- end
- end
-
- # link to package server
- link_pkg_file_path_list.each do |l|
- if test_flag then
- src_file = File.join(distribution.location, l[0])
- dest_file = File.join(distribution.location, "temp", l[1])
- #FileUtils.ln( src_file, dest_file, :force => true )
- if not FileUtil.safeLink( src_file, dest_file) then
- @log.error("Failed to link file [#{src_file}] to [#{dest_file}]")
- end
- else
- src_file = File.join(distribution.location, l[0])
- dest_file = File.join(distribution.location, "binary", l[1])
- #FileUtils.ln( src_file, dest_file, :force => true )
- if not FileUtil.safeLink( src_file, dest_file) then
- @log.error("Failed to link file [#{src_file}] to [#{dest_file}]")
- end
- end
- end
-
- archive_pkg_file_path_list.each do |l|
- FileUtils.mv( l, "#{distribution.location}/source/" )
- end
-
- # write package list for updated os
- updated_os_list.uniq!
- updated_os_list.each do |os|
- distribution.write_pkg_list(os)
- end
-
- # register archive pakcage list.
- distribution.write_archive_pkg_list()
-
- # send email
- if test_flag then
- msg_list = []
-
- registed_package_list.each do |p|
- msg_list.push("%-30s: %08s" % [ p.package_name.strip, p.version.strip ] )
- end
- # email just remote package server
- # Mail.send_package_registe_mail( msg_list, @id )
- end
-
- # if snapshot mode is true then generate snapshot
- if snapshot or test_flag then
- @log.info "generaging snapshot"
- snapshot_name = distribution.generate_snapshot("", "", false, "Changed packages: \n" + registed_package_list.map{|x|"- #{x.package_name}"}.uniq.sort.join("\n") + "\n\n" + get_changelog_string(registed_package_list) )
- end
-
- Utils.file_unlock(@lock_file)
- @log.output( "package registed successfully", Log::LV_USER)
-
- return snapshot_name
- end
-
- def get_changelog_string( package_list )
- log_list = {}
- package_list.each do |pkg|
- if not pkg.does_change_exist? then next end
- set = false
- if log_list[[pkg.package_name, pkg.version, pkg.get_changes]].nil? then
- log_list[[pkg.package_name, pkg.version, pkg.get_changes]] = pkg.os_list
- else
- log_list[[pkg.package_name, pkg.version, pkg.get_changes]] = log_list[[pkg.package_name, pkg.version, pkg.get_changes]] + pkg.os_list
- end
- end
- str=""
- log_list.each do |key, os_list|
- str = str + "Package: #{key[0]}\nOS: #{os_list.join(", ")}\nVersion: #{key[1]}\nChanges: \n#{key[2].sub(/^==/,'Uploader:')}\n\n"
- end
- return str
- end
-
- def generate_snapshot( snpashot_name, dist_name, base_snapshot )
- @log.info "generating snapshot"
- distribution = get_distribution( dist_name )
-
- @lock_file = Utils.file_lock(distribution.lock_file_path)
-
- snapshot_name = distribution.generate_snapshot( snpashot_name, base_snapshot, true, "SYSTEM:")
-
- Utils.file_unlock(@lock_file)
-
- return snapshot_name
- end
-
- def sync( dist_name, mode, snapshot = "" )
- @log.info "sync from server"
- distribution = get_distribution( dist_name )
-
- if distribution.server_url.empty? then
- @log.error( "This distribution has not remote server", Log::LV_USER)
- return
- end
-
- begin
- update, snapshot = distribution.sync(mode, snapshot)
- if update then
- snapshotName = nil;
- if snapshot =~ /sync_.*/ then
- snapshotName = snapshot
- else
- snapshotName = "sync_#{snapshot}"
- end
- distribution.generate_snapshot(snapshotName, "", false, distribution.last_sync_changes)
- end
- @log.output( "package server [#{@id}]'s distribution [#{dist_name}] has been synchronized.", Log::LV_USER )
- rescue => e
- @log.error( e.message, Log::LV_USER)
- end
- end
-
- def add_distribution( dist_name, server_url, clone )
- lock_file = Utils.file_lock(@server_lock_file_path)
-
- # error check : check for already exist in server directory
- if @dist_to_server_url.keys.include? dist_name.strip then
- Utils.file_unlock(@lock_file)
- raise RuntimeError, "distribution already exist : #{dist_name}"
- end
-
- # name check
- if dist_name.strip.eql? "distribution.info" then
- Utils.file_unlock(@lock_file)
- raise RuntimeError, "id \"distribution.info\" is not available"
- end
-
- # modify server url
- if (not server_url.empty?) and (not Utils.is_url_remote(server_url))
- # if server_url is local server address then generate absoulte path
- if not Utils.is_absolute_path( server_url ) then
- if server_url.end_with?("/") then
- server_url = Utils::WORKING_DIR + server_url
- else
- server_url = Utils::WORKING_DIR + "/" + server_url
- end
- end
- end
-
- add_dist_for_config_file(dist_name, server_url, clone)
- create_distribution_struct( dist_name, server_url )
-
- Utils.file_unlock(lock_file)
- @log.output( "distribution [#{dist_name}] added successfully", Log::LV_USER )
- end
-
- def add_os(dist_name, os)
- dist = get_distribution(dist_name)
-
- # distribution lock
- @lock_file = Utils.file_lock(dist.lock_file_path)
-
- dist.add_os(os)
-
- @log.info "generaging snapshot"
- dist.generate_snapshot("", "", false, "Add #{os} Package server")
-
- Utils.file_unlock(@lock_file)
- @log.output( "package server add os [#{os}] successfully", Log::LV_USER )
- end
-
- def remove_server()
- @log.info( "Package server [#{@id}] will be removed and all server information delete", Log::LV_USER)
-
- lock_file = Utils.file_lock(DIBS_LOCK_FILE_PATH)
- if File.exist? @config_file_path then
- File.open @config_file_path do |f|
- f.each_line do |l|
- if l.start_with?( "location : ") then
- location= l.split(" : ")[1]
- FileUtils.rm_rf l.split(" : ")[1].strip
- @log.info( "server location removed : #{location}", Log::LV_USER)
- end
- end
- end
- else
- @log.error( "Can't find server information : #{@id}", Log::LV_USER)
- end
-
- FileUtils.rm_rf @config_dir
- FileUtils.rm_rf @log_file_path
-
- Utils.file_unlock(lock_file)
- @log.output( "package server [#{@id}] removed successfully", Log::LV_USER )
- end
-
- def remove_dist( dist_name )
- @log.info "remove distribution in server"
- distribution = get_distribution( dist_name )
-
- lock_file = Utils.file_lock(@server_lock_file_path)
-
- # modify config file
- config_file = File.readlines(@config_file_path)
- File.open(@config_file_path, 'w') do |f|
- config_file.each do |line|
- f.puts(line) if not line =~ /server_url : #{dist_name} ->/
- end
- end
-
- # modify info file
- config_file = File.readlines("#{@location}/distribution.info")
- File.open("#{@location}/distribution.info", 'w') do |f|
- remove_flag = false
- config_file.each do |line|
- if line.start_with? "name :" then
- if line.split(':')[1].strip.eql? dist_name then
- remove_flag = true
- else
- remove_flag = false
- end
-
- end
-
- # rewrite information for not remove distribution
- if not remove_flag then
- f.puts line
- end
- end
- end
-
- # remove distribution directory
- FileUtils.rm_rf distribution.location
-
- # remove distribution struct
- @distribution_list.delete distribution
-
- Utils.file_unlock(lock_file)
- end
-
- def remove_pkg( dist_name, pkg_name_list, os )
- @log.info "package remove in server"
- distribution = get_distribution( dist_name )
-
- lock_file = Utils.file_lock(@server_lock_file_path)
-
- distribution.remove_pkg(pkg_name_list, os)
-
- # generate snapshot
- @log.info "generaging snapshot"
- distribution.generate_snapshot("", "", false, "SYSTEM: Package \"#{pkg_name_list.join(", ")}\" is(are) removed in #{os} server")
-
- Utils.file_unlock(lock_file)
- @log.output( "package removed successfully", Log::LV_USER )
- end
-
- def remove_snapshot( dist_name, snapshot_list )
- @log.info "remove snapshot in server"
- distribution = get_distribution( dist_name )
-
- lock_file = Utils.file_lock(@server_lock_file_path)
-
- distribution.remove_snapshot(snapshot_list)
-
- Utils.file_unlock(lock_file)
- end
-
- def clean( dist_name, snapshot_list )
- @log.info "pakcage server clean"
- distribution = get_distribution( dist_name )
-
- lock_file = Utils.file_lock(@server_lock_file_path)
-
- distribution.clean( snapshot_list )
-
- # remove incoming dir
- FileUtils.rm_rf incoming_path
- FileUtils.mkdir incoming_path
-
- Utils.file_unlock(lock_file)
- end
-
- # start server daemon
- def start( port, passwd )
- @log.info "Package server Start..."
- # if user input exsist, set port number.
- if (port != "") then
- # update server port information
- # config file
- original_string = "server port : #{@port}"
- replacement_string = "server port : #{port}"
- contents = File.read(@config_file_path).gsub("#{original_string}", "#{replacement_string}")
- File.open(@config_file_path, "w") { |f| f.puts contents }
-
- # global variable
- @port = port
- end
-
- # write package server port for server lock
- File.open(@run_file_path, "w") { |f| f.puts @port }
-
- #lock the package server. Do not run the same server at the same time
- if (not lockServer()) then
- printErrorMessage("Server \"#{id}\" is already running.")
- return
- end
-
- #check that the port is open
- if BuildCommServer.port_open? port then
- printErrorMessage("Port \"#{port}\" is already in use.")
- return
- end
-
- # set job request listener
- @log.info "Setting listener..."
- listener = SocketRegisterListener.new(self)
- listener.start
-
- # set auto sync
- if @auto_sync_flag.eql? "YES" then
- @log.info "Setting auto sync..."
- autosync = DistSync.new(self)
- autosync.start
- end
-
- # set password
- @passwd = passwd
-
- # main loop
- @log.info "Entering main loop..."
- if @test_time > 0 then start_time = Time.now end
- while( not @finish )
- # sleep
- if @test_time > 0 then
- curr_time = Time.now
- if (curr_time - start_time).to_i > @test_time then
- puts "Test time is elapsed!"
- break
- end
- else
- sleep 1
- end
- end
- end
-
- # stop server daemon
- def stop( passwd )
- # set port number. default port is 3333
- @finish = false
-
- # read package server port
- if File.exist? @run_file_path
- file = File.open @run_file_path
- @port = file.read.strip
- else
- raise RuntimeError, "Error : Can't find package server port information"
- end
-
- client = BuildCommClient.create("127.0.0.1", @port, @log)
- if client.nil? then
- raise RuntimeError, "Server does not listen in #{@port} port"
- end
-
- client.send("STOP|#{passwd}")
-
- ret = client.receive_data
- if not ret.nil? and ret[0].strip.eql? "SUCC" then
- @log.output( "Package server is stopped", Log::LV_USER)
- else
- @log.output( "Package server return error message! #{ret}", Log::LV_USER)
- if not client.get_error_msg().empty? then
- @log.output( "Error: #{client.get_error_msg()}", Log::LV_USER)
- end
- end
- client.terminate
-
- File.delete(@run_file_path)
- end
-
- def self.list_id
- @@log = StandardOutLog.new("#{SERVER_ROOT}/.log")
-
- d = Dir.new( SERVER_ROOT )
- s = d.select {|f| not f.start_with?(".") }
- s.sort!
- server_list = []
-
- @@log.output( "=== server ID list ===", Log::LV_USER)
- s.each do |id|
- if File.directory?("#{SERVER_ROOT}/#{id}") then
- server_list.push id
- @@log.output( id, Log::LV_USER)
- end
- end
- @@log.close
- FileUtils.rm_rf("#{SERVER_ROOT}/.log")
-
- return server_list
- end
-
- def self.list_dist( id )
- @@log = StandardOutLog.new( "#{SERVER_ROOT}/.log" )
-
- @@log.output( "=== ID [#{id}]'s distribution list ===", Log::LV_USER)
-
- dist_list = []
-
- # read package id information
- config_file_path = "#{SERVER_ROOT}/#{id}/config"
- if not File.exist? config_file_path
- raise RuntimeError, "[#{id}] is not server ID"
- end
-
- File.open config_file_path do |f|
- f.each_line do |l|
- if l.start_with?( "server_url : ") and l.include?( "->" ) then
- dist_name = l.split(" : ")[1].split("->")[0]
-
- dist_list.push dist_name
- @@log.output( dist_name, Log::LV_USER)
- end
- end
- end
- @@log.close
- FileUtils.rm_rf("#{SERVER_ROOT}/.log")
-
- return dist_list
- end
-
- def get_default_dist_name()
- if @distribution_list.empty? then
- raise RuntimeError,"Server [#{@id}] does not have distribution"
- end
- return @distribution_list[0].name
- end
-
- def reload_dist_package()
- # create locking file
- lock_file = Utils.file_lock(@server_lock_file_path)
- @distribution_list.each do |dist|
- dist.initialize_pkg_list
- end
- Utils.file_unlock(lock_file)
- end
-
- def release_lock_file
- if not @lock_file.nil? then
- Utils.file_unlock(@lock_file)
- end
- end
-
- # PRIVATE METHODS/VARIABLES
- private
-
- def server_information_initialize
- # if id is nil or empty then find default id
- if @id.nil? or @id.empty?
- d = Dir.new( SERVER_ROOT )
- s = d.select {|f| not f.start_with?(".") }
- if s.length.eql? 1 then
- @log.info "using default server ID [#{s[0]}]"
- @id = s[0]
- else
- raise RuntimeError, "package server ID is invalid. input server ID using -i option"
- end
- end
-
- # read package id information
- if File.exist? @config_file_path
- File.open @config_file_path do |f|
- f.each_line do |l|
- if l.start_with?( "location :") then
- @location = l.split(" :")[1].strip
- elsif l.start_with?( "integrity check :") then
- @integrity = l.split(" :")[1].strip.upcase
- elsif l.start_with?( "auto sync :" ) then
- @auto_sync_flag = l.split(" :")[1].strip.upcase
- elsif l.start_with?( "sync interval :" ) then
- @sync_interval = l.split(" :")[1].strip.to_i
- elsif l.start_with?( "server port :" ) then
- @port = l.split(" :")[1].strip.to_i
- elsif l.start_with?( "server_url :" ) then
- info = l.split(" :")[1].split("->")
- @dist_to_server_url[info[0].strip] = info[1].strip
- else
- @log.error "server config file has invalid information [#{l}]"
- end
- end
- end
-
- @dist_to_server_url.each do |dist_name, server_url|
- @distribution_list.push Distribution.new( dist_name, "#{@location}/#{dist_name}", server_url, self )
- end
- end
- end
-
- def get_distribution( dist_name )
- if dist_name.nil? or dist_name.empty? then
- dist_name = get_default_dist_name()
- end
- if dist_name.empty? then
- raise RuntimeError,"Can't find distribution information"
- end
-
- @distribution_list.each do |dist|
- if dist.name.eql? dist_name.strip
- return dist
- end
- end
-
- raise RuntimeError, "Can't find distribution [ #{dist_name} ]"
- end
-
- def create_distribution_struct( dist_name, server_url )
- if File.exist? "#{@location}/#{dist_name}"
- raise RuntimeError, "distribution directory already exist [#{@location}/#{dist_name}]"
- end
-
- FileUtils.mkdir "#{@location}/#{dist_name}"
- FileUtils.mkdir "#{@location}/#{dist_name}/binary"
- FileUtils.mkdir "#{@location}/#{dist_name}/source"
- FileUtils.mkdir "#{@location}/#{dist_name}/temp"
- FileUtils.mkdir "#{@location}/#{dist_name}/snapshots"
- File.open("#{@location}/#{dist_name}/#{Distribution::SNAPSHOT_INFO_FILE}", "w") {}
- File.open("#{@location}/#{dist_name}/#{Distribution::OS_INFO_FILE}", "w") {}
- File.open("#{@location}/#{dist_name}/#{Distribution::ARCHIVE_PKG_FILE}", "w") {}
-
- # generate distribution
- distribution = Distribution.new( dist_name, "#{@location}/#{dist_name}", server_url, self )
-
- # add dist
- @distribution_list.push distribution
-
- if not server_url.empty? then
- @log.info "generate package server using remote package server [#{server_url}]"
-
- if Utils.is_url_remote(server_url) then
- @log.info "[#{dist_name}] distribution creation. using remote server [#{server_url}]"
- else
- @log.info "[#{dist_name}] distribution creation. using local server [#{server_url}]"
- end
-
- distribution.sync(false)
- distribution.generate_snapshot("", "", false, distribution.last_sync_changes)
- else
- @log.info "generate package server do not using remote package server"
-
- # write_pkg_list for empty file
- distribution.write_pkg_list(nil)
- distribution.write_archive_pkg_list()
- end
-
- # add dist information to distribution.info file
- File.open("#{@location}/distribution.info", "a") do |f|
- f.puts "name : #{dist_name}"
- f.puts "time : #{Time.now.strftime("%Y%m%d%H%M%S")}"
- f.puts
- end
- end
-
- def register_package(distribution, pkg, file_path, test_flag, internal_flag)
- # get package class using bianry file
- if pkg.nil? or pkg.package_name.empty? then
- raise "[#{file_path}]'s pkginfo.manifest file is incomplete."
- end
-
- if not test_flag then
- # error check
- if pkg.package_name.empty? or pkg.version.empty? \
- or pkg.os.empty? or pkg.maintainer.empty? then
- raise "[#{file_path}]'s pkginfo.manifest file is incomplete."
- end
-
- updated_pkg = distribution.register(file_path, pkg, internal_flag )
- else
- updated_pkg = distribution.register_for_test(file_path, pkg )
- end
-
- return updated_pkg
- end
-
- def add_dist_for_config_file(dist_name, server_url, clone)
- File.open( @config_file_path, "a" ) do |f|
- if clone then
- @log.info "add distribution using [#{server_url}] in clone mode"
- f.puts "server_url : #{dist_name} -> "
- else
- @log.info "add distribution using [#{server_url}]"
- f.puts "server_url : #{dist_name} -> #{server_url}"
- end
- end
- end
-
- def update_config_information(id)
- @id = id
- @config_dir = "#{SERVER_ROOT}/#{@id}"
- @log_file_path = "#{SERVER_ROOT}/#{@id}.log"
- @config_file_path = "#{@config_dir}/config"
- @run_file_path = "#{@config_dir}/run"
- @incoming_path = "#{@config_dir}/incoming"
- @server_lock_file_path = "#{@config_dir}/.server_lock"
- end
-
- #If the 'run' file is already locked, Package server is already running.
- #in this case return false
- private
- def lockServer
- return FileUtil.exclusiveLock(@run_file_path)
- end
-
- private
- def printErrorMessage(errMsg)
- @log.info "Server creation failed"
- @log.error errMsg
-
- puts "Server creation failed"
- puts errMsg
- end
-end
+++ /dev/null
-=begin
-
- serverConfig.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "utils"
-
-class PackageServerConfig
-
- CONFIG_ROOT = "#{Utils::HOME}/.build_tools"
- CONFIG_PATH = "#{PackageServerConfig::CONFIG_ROOT}/client"
-
-end
+++ /dev/null
-=begin
-
- serverOptParser.rb
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'optparse'
-$LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))+"/common"
-require "utils"
-
-def set_default( options )
- options[:id] = ""
- options[:dist] = ""
- options[:url] = ""
- options[:os] = "all"
- options[:pkgs] = []
- options[:snaps] = []
- options[:bsnap] = ""
- options[:port] = ""
- options[:gensnap] = true
- options[:force] = false
- options[:test] = false
- options[:clone] = false
- options[:origin_pkg_name] = ""
- options[:origin_pkg_os] = ""
- options[:passwd] = ""
-end
-
-def option_error_check( options )
-
- case options[:cmd]
- when "create"
- if options[:id].empty? or options[:dist].empty? then
- raise ArgumentError, "Usage: pkg-svr create -n <server name> -d <distribution> [-u <remote server url>] [-l <location>] "
- end
- when "remove"
- if options[:id].empty? then
- raise ArgumentError, "Usage: pkg-svr remove -n <server name> "
- end
- when "remove-pkg"
- if options[:pkgs].empty? then
- raise ArgumentError, "Usage: pkg-svr remove-pkg -n <server name> -d <distribution> -P <package file list> [-o <os>]" + "\n" \
- end
- when "remove-snapshot"
- if options[:snaps].empty? then
- raise ArgumentError, "Usage: pkg-svr remove-snapshot -n <server name> -d <distribution> -s <snapshot list>"
- end
- when "add-dist"
- if options[:id].empty? or options[:dist].empty? then
- raise ArgumentError, "Usage: pkg-svr add-dist -n <server name> -d <distribution> [-u <remote server url>] [--clone] "
- end
- when "add-os"
- if options[:os].empty? then
- raise ArgumentError, "Usage: pkg-svr add-os -n <server name> -d <distribution> -o <os>] "
- end
- when "remove-dist"
- if options[:id].empty? or options[:dist].empty? then
- raise ArgumentError, "Usage: pkg-svr remove-dist -n <server name> -d <distribution> "
- end
- when "register"
- if options[:pkgs].empty? then
- raise ArgumentError, "Usage: pkg-svr register -n <server name> -d <distribution> -P <package file list> [--gen] [--test] "
- end
- when "gen-snapshot"
- if options[:snaps].empty? then
- raise ArgumentError, "Usage: pkg-svr gen-snapshot -n <server name> -d <distribution> -s <snapshot name> [-b <base snapshot name>]"
- end
- when "start"
- when "stop"
- when "sync"
- when "list"
- when "clean"
- else
- raise ArgumentError, "Input is incorrect : #{options[:cmd]}"
- end
-end
-
-def option_parse
- options = {}
- banner = "Package-server administer service command-line tool." + "\n" \
- + "\n" + "Usage: pkg-svr <SUBCOMMAND> [OPTS] or pkg-svr (-h|-v)" + "\n" \
- + "\n" + "Subcommands:" + "\n" \
- + "\t" + "create Create a package-server." + "\n" \
- + "\t" + "add-dist Add a distribution to package-server." + "\n" \
- + "\t" + "add-os Add supported os." + "\n" \
- + "\t" + "register Register a package in package-server." + "\n" \
- + "\t" + "remove Remove a package-server." + "\n" \
- + "\t" + "remove-dist Remove a distribution to package-server." + "\n" \
- + "\t" + "remove-pkg Remove a package in package-server." + "\n" \
- + "\t" + "remove-snapshot Remove a snapshot in package-server." + "\n" \
- + "\t" + "gen-snapshot Generate a snapshot in package-server." + "\n" \
- + "\t" + "sync Synchronize the package-server from parent package server." + "\n" \
- + "\t" + "start Start the package-server." + "\n" \
- + "\t" + "stop Stop the package-server." + "\n" \
- + "\t" + "clean Delete unneeded package files in package-server." + "\n" \
- + "\t" + "list Show all pack" + "\n" \
- + "\n" + "Subcommand usage:" + "\n" \
- + "\t" + "pkg-svr create -n <server name> -d <distribution> [-u <remote server url>] [-l <location>] " + "\n" \
- + "\t" + "pkg-svr add-dist -n <server name> -d <distribution> [-u <remote server url>] [--clone] " + "\n" \
- + "\t" + "pkg-svr add-os -n <server name> -d <distribution> -o <os> " + "\n" \
- + "\t" + "pkg-svr register -n <server name> -d <distribution> -P <package file list> [--gen] [--test] " + "\n" \
- + "\t" + "pkg-svr remove -n <server name> " + "\n" \
- + "\t" + "pkg-svr remove-dist -n <server name> -d <distribution>" + "\n" \
- + "\t" + "pkg-svr remove-pkg -n <server name> -d <distribution> -P <package name list> [-o <os>] " + "\n" \
- + "\t" + "pkg-svr remove-snapshot -n <server name> -d <distribution> -s <snapshot list>" + "\n" \
- + "\t" + "pkg-svr gen-snapshot -n <server name> -d <distribution> -s <snapshot name> [-b <base snapshot name>] " + "\n" \
- + "\t" + "pkg-svr sync -n <server name> -d <distribution> -s <snapshot_name> [--force] " + "\n" \
- + "\t" + "pkg-svr clean -n <server name> -d <distribution> [-s <snapshot list>] " + "\n" \
- + "\t" + "pkg-svr start -n <server name> -p <port> [-w <password>]" + "\n" \
- + "\t" + "pkg-svr stop -n <server name> [-w <password>]" + "\n" \
- + "\t" + "pkg-svr list [-n <server name>] " + "\n" \
- + "\n" + "Options:" + "\n"
-
- optparse = OptionParser.new(nil, 32, ' '*8) do|opts|
- # Set a banner, displayed at the top
- # of the help screen.
-
- opts.banner = banner
-
- opts.on( '-n', '--name <server name>', 'package server name' ) do|name|
- options[:id] = name
- end
-
- opts.on( '-d', '--dist <distribution>', 'package server distribution' ) do|dist|
- options[:dist] = dist
- end
-
- opts.on( '-u', '--url <server url>', 'remote server url: http://127.0.0.1/dibs/unstable' ) do|url|
- options[:url] = url
- end
-
- opts.on( '-o', '--os <operating system>', 'target operating system' ) do|os|
- options[:os] = os
- end
-
- opts.on( '-P', '--pkgs <package file list>', 'package file path list' ) do|pkgs|
- if not Utils.multi_argument_test( pkgs, "," ) then
- raise ArgumentError, "Package variable parsing error : #{pkgs}"
- end
- list = pkgs.tr(" \t","").split(",")
- list.each do |l|
- if l.start_with? "~" then l = Utils::HOME + l.delete("~") end
- options[:pkgs].push l
- end
- end
-
- opts.on( '-s', '--snapshot <snapshot>', 'a snapshot name or snapshot list' ) do|snaplist|
- if not Utils.multi_argument_test( snaplist, "," ) then
- raise ArgumentError, "Snapshot variable parsing error : #{snaplist}"
- end
- options[:snaps] = snaplist.split(",")
- end
-
- opts.on( '-b', '--base <base snapshot>', 'base snapshot name' ) do|bsnap|
- options[:bsnap] = bsnap
- end
-
- opts.on( '-l', '--loc <location>', 'server location' ) do|loc|
- options[:loc] = loc
- end
-
- opts.on( '-p', '--port <port>', 'port number' ) do|port|
- options[:port] = port
- end
-
- opts.on( '-w', '--passwd <password>', 'password for package server' ) do|passwd|
- options[:passwd] = passwd
- end
-
- opts.on( '--clone', 'clone mode' ) do
- options[:clone] = true
- end
-
- opts.on( '--force', 'force update pkg file' ) do
- options[:force] = true
- end
-
- opts.on( '--test', 'upload for test' ) do
- options[:test] = true
- end
-
- opts.on( '--gen', 'generate snapshot' ) do
- options[:gensnap] = true
- end
-
- opts.on( '-h', '--help', 'display help' ) do
- puts opts
- exit
- end
-
- opts.on( '-v', '--version', 'display version' ) do
- puts "DIBS(Distributed Intelligent Build System) version " + Utils.get_version()
- exit
- end
- end
-
- cmd = ARGV[0]
-
- if cmd.eql? "create" or cmd.eql? "sync" \
- or cmd.eql? "register" \
- or cmd.eql? "gen-snapshot" \
- or cmd.eql? "add-dist" or cmd.eql? "add-os" \
- or cmd.eql? "remove" or cmd.eql? "remove-dist" \
- or cmd.eql? "remove-pkg" or cmd.eql? "remove-snapshot" \
- or cmd.eql? "start" or cmd.eql? "stop" or cmd.eql? "clean" \
- or cmd.eql? "list" \
- or cmd =~ /(-v)|(--version)/ \
- or cmd =~ /(help)|(-h)|(--help)/ then
- if cmd.eql? "help" then ARGV[0] = "-h" end
- options[:cmd] = ARGV[0]
- else
- raise ArgumentError, "Usage: pkg-svr <SUBCOMMAND> [OPTS] or pkg-svr -h"
- end
-
- # default value setting
- set_default options
-
- optparse.parse!
-
- # option error check
- option_error_check options
-
- return options
-end
-
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli -h
-#POST-EXEC
-#EXPECT
-Requiest service to build-server command-line tool.
-
-Usage: build-cli <SUBCOMMAND> [OPTS] or build-cli (-h|-v)
-
-Subcommands:
-build Build and create package.
-query Query information about build-server.
-query-system Query system information about build-server.
-query-project Query project information about build-server.
-query-job Query job information about build-server.
-query-log Query log contents about job in build-server.
-cancel Cancel a building project.
-register Register the package to the build-server.
-
-Subcommand usage:
-build-cli build -N <project name> -d <server address> -U <user-id> -w <user-password> [-o <os>] [--async] [-D <distribution name>] [--save]
-build-cli query -d <server address>
-build-cli query-system -d <server address>
-build-cli query-project -d <server address>
-build-cli query-job -d <server address>
-build-cli query-log -d <server address> -j <job number> [--output <output file path>]
-build-cli cancel -j <job number> -d <server address> -U user-id -w <user-password>
-build-cli register -P <package file> -d <server address> -U user-id -w <user-password> [-t <ftp server url>] [-D <distribution name>]
-
-Options:
--N, --project <project name> project name
--d, --address <server address> build server address: 127.0.0.1:2224
--o, --os <operating system> target operating system: ubuntu-32/ubuntu-64/windows-32/windows-64/macos-64
---async asynchronous job
---save save the files built from remote server
--j, --job <job number> job number
--w, --passwd <user-password> user password
--P, --pkg <package file> package file path
--D, --dist <distribution name> distribution name
--t, --ftp <ftp server url> ftp server url: ftp://dibsftp:dibsftp@127.0.0.1
--U, --user <user email> user email
---output <output_path> output file path
--h, --help display help
--v, --version display version
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli query -d 127.0.0.1:2223
-#POST-EXEC
-#EXPECT
-* SYSTEM INFO *
-HOST-OS: ubuntu-32
-MAX_WORKING_JOBS: 2
-
-* FTP *
-FTP_ADDR:
-FTP_USERNAME:
-
-* SUPPORTED OS LIST *
-ubuntu-32
-windows-32
-
-* FRIEND SERVER LIST (WAIT|WORK/MAX) jobs [transfer count] *
-
-
-* PROJECT(S) *
-testa NORMAL
-testa1 NORMAL
-testb NORMAL
-testc NORMAL
-testd NORMAL
-teste REMOTE
-
-* JOB(S) *
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
+++ /dev/null
-#PRE-EXEC
-echo "This is the test case for omitting os"
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P a
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -N non_exist_project -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Error: Project not found!: non_exist_project on unstable
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:11113 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Error: Connection failed!: 127.0.0.1:11113
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -N testa -d 111.11q.111.111:1111 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Error: Connection failed!: 111.11q.111.111:1111
+++ /dev/null
-#PRE-EXEC
-echo "testa project is already built and uploaded in previeous testcase"
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Error: Version must be increased!: 0.0.1 <= 0.0.1
-Error: Job is stopped by ERROR
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-echo "Assume testa project is already built and uploaded in previeous testcase"
-#EXEC
-../../build-cli build -N testb -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: * a
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... b_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testb"
+++ /dev/null
-#PRE-EXEC
-echo "if build-dep package does not exist in server, will show the error"
-echo "Assume testa/testb project is already built and uploaded in previeous testcase"
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P b
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P a
-#EXEC
-../../build-cli build -N testb -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Error: Error: Unmet dependency found!: a(ubuntu-32)
-Error: Job is stopped by ERROR
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-echo "This is the test case for omitting os"
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P a
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
+++ /dev/null
-#PRE-EXEC
-echo "if there doe not exist server to build, error"
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o windows-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Error: No servers supports the "Host-OS"!: windows-32
-Error: Job is stopped by ERROR
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-echo "wrong os name in build command"
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P a
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o wrong_os_name -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Error: Unsupported OS name used!: wrong_os_name... Use a name in (ubuntu-32|windows-32)
+++ /dev/null
-#PRE-EXEC
-echo "wrong os name in resolve command"
-#EXEC
-../../build-cli resolve -N testa -d 127.0.0.1:2223 -o wrong_os_name -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Error: Unsupported OS name used!: wrong_os_name
-Supported OS list.
-* ubuntu-32
-* windows-32
+++ /dev/null
-#PRE-EXEC
-echo "Assume that testc project has the password (1111)"
-echo "Assume that testa,testb which are depended by testc are built and uploaded"
-echo "For, work around solution, removed cache"
-rm -rf buildsvr01/projects/testa/cache
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-../../build-cli build -N testb -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#EXEC
-../../build-cli build -N testc -d 127.0.0.1:2223 -w 1111 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: * a
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: * b
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... c_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testc"
+++ /dev/null
-#PRE-EXEC
-echo "Assume that testc project has the password (1111)"
-echo "Assume that testa,testb which are depended by testc are built and uploaded"
-#EXEC
-../../build-cli build -N testc -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user
-#POST-EXEC
-#EXPECT
-Usage: build-cli build -N <project name> -d <server address> -U <user-id> -w <user-password> [-o <os>] [--async] [-D <distribution name>] [--save]
+++ /dev/null
-#PRE-EXEC
-echo "Assume that testc project has the password (1111)"
-echo "Assume that testa,testb which are depended by testc are built and uploaded"
-#EXEC
-../../build-cli build -N testc -d 127.0.0.1:2223 -w 2222 -o ubuntu-32 -U admin@user -w 1111
-#POST-EXEC
-#EXPECT
-Error: User password not matched!: Email : admin@user && Password : 1111
+++ /dev/null
-#PRE-EXEC
-../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P c
-#EXEC
-../../build-cli build -N testc -d 127.0.0.1:2223 -w 1111 --async -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Above job(s) will be processed asynchronously!
+++ /dev/null
-#PRE-EXEC
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P c
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P b
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable -P a
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 --async -o ubuntu-32 -U admin@user -w 1234
-sleep 1
-../../build-cli build -N testb -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Above job(s) will be processed asynchronously!
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Waiting for finishing following jobs:
-Info: *
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: * a
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... b_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testb"
+++ /dev/null
-#PRE-EXEC
-echo "reverse fail"
-#EXEC
-rm -rf git01/a
-cd git01;tar xf a_v2.tar.gz
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.2_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: * Will check reverse-build for projects:
-Info: * Added new job for reverse-build ... testb
-Info: * Reverse-build FAIL ... testb
-Error: Error: Reverse-build-check failed!
-Error: Job is stopped by ERROR
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli query-system -d 127.0.0.1:2223
-#POST-EXEC
-#EXPECT
-* SYSTEM INFO *
-HOST-OS:
-MAX_WORKING_JOBS:
-
-* FTP *
-FTP_ADDR:
-FTP_USERNAME:
-
-* SUPPORTED OS LIST *
-ubuntu-32
-windows-32
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli query-project -d 127.0.0.1:2223
-#POST-EXEC
-#EXPECT
-* PROJECT(S) *
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli query-job -d 127.0.0.1:2223
-#POST-EXEC
-#EXPECT
-* JOB(S) *
+++ /dev/null
-#PRE-EXEC
-echo "Trying to upload a_0.0.1 with different commit-id is already uploaded"
-rm -rf git01/c
-cd git01;tar xf c_v1_1.tar.gz
-#EXEC
-../../build-cli build -N testc -d 127.0.0.1:2223 -o ubuntu-32 -w 1111 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Error: Source code has been changed without increasing version!: 0.0.1
-Error: Job is stopped by ERROR
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-cd git01;tar xf a_v2.tar.gz
-cd git01;tar xf b_v2.tar.gz
-cd git01;tar xf c_v2.tar.gz
-#EXEC
-../../build-cli build -N testa,testb,testc -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Invoking a thread for MULTI-BUILD Job
-Info: New Job
-Info: Added new job "testa" for ubuntu-32!
-Info: Added new job "testb" for ubuntu-32!
-Info: Added new job "testc" for ubuntu-32!
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
+++ /dev/null
-#PRE-EXEC
-echo "This test case must be execute right after testcase 22"
-#EXEC
-../../build-cli build -N testa,testb,testc -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Error: Failed to initialize sub-job "testa" for
-Error: * Version must be increased!:
-Info: Initializing sub-job
-Error: Failed to initialize sub-job "testb" for
-Error: * Version must be increased!:
-Info: Initializing sub-job
-Error: Failed to initialize sub-job "testc" for
-Error: * Version must be increased!:
-Error: Initializing sub jobs failed!
-Error: Job is stopped by ERROR
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-cd git01;tar xf a_v3.tar.gz
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32,windows-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Invoking a thread for MULTI-BUILD Job
-Info: New Job
-Info: Added new job "testa" for ubuntu-32!
-Info: Added new job "testa" for windows-32!
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
+++ /dev/null
-#PRE-EXEC
-echo "testa, testb: build because of version change"
-echo "testc, testa1, testd: rebuild with same version"
-
-cd git01;tar xf a_v4.tar.gz
-cd git01;tar xf b_v4.tar.gz
-cd git01;tar xf c_v4.tar.gz
-#EXEC
-../../build-cli build -N testa,testb,testc,testa1,testd -o all --rebuild -d 127.0.0.1:2223 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Invoking a thread for MULTI-BUILD Job
-Info: New Job
-Info: Added new job
-Info: Added new job
-Info: Added new job
-Info: Added new job
-Info: Added new job
-Info: Added new job
-Info: Added new job
-Info: Added new job
-Info: Added new job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
+++ /dev/null
-#PRE-EXEC
-cd git01;tar xf c_v5.tar.gz
-#EXEC
-../../build-cli build -N testc -d 127.0.0.1:2223 -o li_* -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Error: Unsupported OS name used!: There is no OS name matched.
+++ /dev/null
-#PRE-EXEC
-echo "wild card"
-#EXEC
-../../build-cli build -N testc -d 127.0.0.1:2223 -o ubuntu-* -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: * a
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: * b
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... c_0.0.5_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testc"
+++ /dev/null
-#PRE-EXEC
-echo "reverse success"
-#EXEC
-rm -rf git01/a
-cd git01;tar xf a_v5.tar.gz
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.5_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: * Will check reverse-build for projects:
-Info: * Added new job for reverse-build ...
-Info: * Added new job for reverse-build ...
-Info: * Reverse-build OK ...
-Info: * Reverse-build OK ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
+++ /dev/null
-#PRE-EXEC
-echo "user check"
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 -U xxuser@user -w 1234
-#POST-EXEC
-#EXPECT
-Error: User account not found!: xxuser@user
+++ /dev/null
-#PRE-EXEC
-echo "query-log"
-#EXEC
-../../build-cli query-log -d 127.0.0.1:2223 -j 1 | grep {2} | cut -d '}' -f2
-#POST-EXEC
-#EXPECT
-Added new job
-Initializing job...
-Checking package version ...
-Invoking a thread for building Job
-New Job
-hecking build dependency ...
-Checking install dependency ...
-Started to build this job...
-JobBuilder
-ownloding client is initializing...
-Installing dependent packages...
-Downloading dependent source packages...
-Make clean...
-Make build...
-Make install...
-eneratiing pkginfo.manifest...
-Zipping...
-Creating package file ... a_0.0.1_ubuntu-32.zip
-Checking reverse build dependency ...
-Uploading ...
-Upload succeeded. Sync local pkg-server again...
-Snapshot:
-Job is completed!
-Job is FINISHED successfully!
-Updating the source info for project "testa"
+++ /dev/null
-#PRE-EXEC
-echo "query-log"
-rm -rf a.txt
-#EXEC
-../../build-cli query-log -d 127.0.0.1:2223 -j 1 --output a.txt
-#POST-EXEC
-rm -rf a.txt
-#EXPECT
-Started query log, writing to the file "a.txt"
-End query log, check file "a.txt"
+++ /dev/null
-#PRE-EXEC
-echo "This case will test --save option"
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 --save --rebuild -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ...
-Info: Checking reverse build dependency ...
-Info: * Will check reverse-build for projects: testb(ubuntu-32), testc(ubuntu-32)
-Info: * Added new job for reverse-build ... testb(ubuntu-32)
-Info: * Added new job for reverse-build ... testc(ubuntu-32)
-Info: * Reverse-build OK ...
-Info: * Reverse-build OK ...
-Info: Copying result files to
-Info: *
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
-Info: Receiving file from remote server :
+++ /dev/null
-#PRE-EXEC
-echo "This case will test --save option for MULTI build job"
-#EXEC
-../../build-cli build -N testa,testb -d 127.0.0.1:2223 -o ubuntu-32 --save --rebuild -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Invoking a thread for MULTI-BUILD Job
-Info: New Job
-Info: Added new job "testa" for ubuntu-32!
-Info: Added new job "testb" for ubuntu-32!
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: Copying result files to
-Info: *
-Info: *
-Info: Job is completed!
-Info: Receiving file from remote server :
-Info: Receiving file from remote server :
+++ /dev/null
-#PRE-EXEC
-echo "This case will test --noreverse option"
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 --rebuild --noreverse -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
+++ /dev/null
-#PRE-EXEC
-echo "This case will check redundent job"
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 --rebuild -U admin@user -w 1234 &
-#EXEC
-sleep 2
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 --rebuild -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Error: There already exists same job.
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-echo "error case when wrong git repository setted"
-../../build-svr add-prj -n testserver3 -N testaErr -g `pwd`/git01/aErr -b master
-#EXEC
-../../build-cli build -N testaErr -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Error: Git clone failed!!: git clone
-Error: Job is stopped by ERROR
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-echo "error case when wrong git branch setted"
-../../build-svr add-prj -n testserver3 -N testbErr -g `pwd`/git01/b -b testError
-#EXEC
-../../build-cli build -N testbErr -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Error: Git checkout failed!!: git checkout
-Error: Job is stopped by ERROR
-Error: Building job on remote server failed!
+++ /dev/null
-#PRE-EXEC
-echo "uselatest build "
-cd git01;tar xf b_v5err.tar.gz
-#EXEC
-../../build-cli build -N testb -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234 --rebuild --uselatest
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Waiting for finishing following jobs:
-Info: *
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder#58 is created
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: * a
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... b_0.0.4_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: * Will check reverse-build for projects: testc
-Info: * Added new job for reverse-build ... testc
-Info: * Reverse-build OK ... testc
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testb"
+++ /dev/null
-#PRE-EXEC
-echo "uselatest build "
-cd git01;tar xf c_v6err.tar.gz
-#EXEC
-../../build-cli build -N testa,testb,testc -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234 --rebuild --uselatest
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Invoking a thread for MULTI-BUILD Job
-Info: New Job
-Info: Added new job "testa"
-Info: Added new job "testb"
-Info: Added new job "testc"
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
+++ /dev/null
-#PRE-EXEC
-echo "Clone distribution"
-#EXEC
-../../build-svr clone-dist -n testserver3 -O unstable -T clone_test -u `pwd`/pkgsvr01/unstable -d 127.0.0.1:3333 -w score
-#POST-EXEC
-#EXPECT
-Distribution is cloned successfully!
+++ /dev/null
-#PRE-EXEC
-echo "uselatest build "
-cd git01;tar xf c_v6err.tar.gz
-#EXEC
-../../build-cli build -N testa,testb,testc -d 127.0.0.1:2223 -D clone_test -o ubuntu-32 -U admin@user -w 1234 --rebuild --uselatest
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Invoking a thread for MULTI-BUILD Job
-Info: New Job
-Info: Added new job "testa"
-Info: Added new job "testb"
-Info: Added new job "testc"
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: * Sub-Job
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
+++ /dev/null
-#PRE-EXEC
-echo "register noreverse "
-cd git01;tar xf binary.tar.gz
-cd git01;tar xf depbinary.tar.gz
-cd git01/binary;../../../../pkg-build -u ../../pkgsvr01/unstable/
-cd git01/binary;mv *.zip ../
-sed -i "s/0.0.1/0.0.2/" git01/binary/package/pkginfo.manifest
-cd git01/binary;../../../../pkg-build -u ../../pkgsvr01/unstable/
-cd git01/binary;mv *.zip ../
-../../build-svr add-prj -n testserver3 -N depbinary -g `pwd`/git01/depbinary -b master
-../../build-svr add-prj -n testserver3 -N binary -P binary
-#EXEC
-../../build-cli register -P `ls ./git01/binary_0.0.1_*.zip` -d 127.0.0.1:2223 -U admin@user -w 1234
-../../build-cli build -N depbinary -d 127.0.0.1:2223 -U admin@user -w 1234
-../../build-cli register -P `ls ./git01/binary_0.0.2_*.zip` -d 127.0.0.1:2223 -U admin@user -w 1234 --noreverse
-#POST-EXEC
-#EXPECT
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for REGISTER Job
-Info: New Job
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "binary"
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder#
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: * binary
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... depbinary_0.0.1_
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "depbinary"
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for REGISTER Job
-Info: New Job
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "binary"
+++ /dev/null
-#PRE-EXEC
-echo "register noreverse "
-cd git01;tar xf newbinary.tar.gz
-../../build-svr add-prj -n testserver3 -N newbinary -g `pwd`/git01/newbinary -b master
-#EXEC
-../../build-cli build -N newbinary -d 127.0.0.1:2223 -U admin@user -w 1234 --uselatest
-#POST-EXEC
-#EXPECT
-Error: Error: no latest commit exists: newbinary
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-
-if [ ! "$DB_PASSWD" ] ; then
- read -p "Insert DB password: " input
- export DB_PASSWD=$input
-else
- echo $DB_PASSWD
-fi
-
-rm -rf buildsvr01
-rm -rf git01
-rm -rf bin
-rm -rf ~/.build_tools/build_server/testserver3
-
-../../build-svr remove -n testserver3
-mkdir buildsvr01
-cd buildsvr01
-${RUBY} ../../../build-svr create -n testserver3
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-${RUBY} ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-rm -f a
-cd ..
-${RUBY} ../../build-svr add-dist -n testserver3 -D unstable -u `pwd`/pkgsvr01/unstable -d 127.0.0.1:3333 -w score
-${RUBY} ../../build-svr add-svr -n testserver3 -d 127.0.0.1:2224
-${RUBY} ../../build-svr add-os -n testserver3 -o ubuntu-32
-${RUBY} ../../build-svr add-os -n testserver3 -o windows-32
-${RUBY} ../../build-svr add-prj -n testserver3 -N testa -g `pwd`/git01/a -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N testb -g `pwd`/git01/b -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N testc -g `pwd`/git01/c -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N testd -g `pwd`/git01/d -b master -o ubuntu-32
-${RUBY} ../../build-svr add-prj -n testserver3 -N teste -P bin
-${RUBY} ../../build-svr add-prj -n testserver3 -N testa1 -g `pwd`/git01/a1 -b master
-
-mkdir -p git01
-cp ../git01/*.tar.gz git01/
-cd git01
-rm -rf a
-rm -rf a1
-rm -rf b
-rm -rf c
-rm -rf d
-tar xvf a_v1.tar.gz
-tar xvf b_v1.tar.gz
-tar xvf c_v1.tar.gz
-tar xvf d_v0.tar.gz
-tar xvf a1_v1.tar.gz
-cd ..
-
-mkdir -p bin
-cp ../bin/* bin/
-
-${RUBY} ../../pkg-svr register -n pkgsvr01 -d unstable -P bin/bin_0.0.0_ubuntu-32.zip
-
-${RUBY} ../../build-svr start -n testserver3 -p 2223 --CHILD
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-rm -rf ~/.build_tools/pkg_server/pkgsvr01
-rm -rf `pwd`/pkgsvr01
-${RUBY} ../../pkg-svr create -n pkgsvr01 -d unstable
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o ubuntu-32
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o windows-32
-${RUBY} ../../pkg-svr start -n pkgsvr01 -p 3333 -w score
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-rm -rf ~/.build_tools/pkg_server/pkgsvr02
-rm -rf `pwd`/pkgsvr02
-${RUBY} ../../pkg-svr create -n pkgsvr02 -d unstable -u ftp://user:password@localhost/`pwd|cut -d/ -f4-`/pkgsvr01/unstable
-${RUBY} ../../pkg-svr add-os -n pkgsvr02 -d unstable -o ubuntu-32
-${RUBY} ../../pkg-svr add-os -n pkgsvr02 -d unstable -o windows-32
-sed -i -e "s/NO/YES/g" -e "s/3600/5/g" ~/.build_tools/pkg_server/pkgsvr02/config
-${RUBY} ../../pkg-svr start -n pkgsvr02 -p 3334 -w score
+++ /dev/null
-build-cli-01.testcase
-build-cli-02.testcase
-build-cli-03.testcase
-build-cli-04.testcase
-build-cli-05.testcase
-build-cli-06.testcase
-build-cli-07.testcase
-build-cli-08.testcase
-build-cli-09.testcase
-build-cli-10.testcase
-build-cli-11.testcase
-build-cli-12.testcase
-build-cli-13.testcase
-build-cli-14.testcase
-build-cli-15.testcase
-build-cli-16.testcase
-build-cli-17.testcase
-build-cli-18.testcase
-build-cli-19.testcase
-build-cli-20.testcase
-build-cli-21.testcase
-build-cli-22.testcase
-build-cli-23.testcase
-build-cli-24.testcase
-build-cli-25.testcase
-build-cli-26.testcase
-build-cli-27.testcase
-build-cli-28.testcase
-build-cli-29.testcase
-build-cli-30.testcase
-build-cli-31.testcase
-build-cli-32.testcase
-build-cli-33.testcase
-build-cli-34.testcase
-build-cli-35.testcase
-build-cli-36.testcase
-build-cli-37.testcase
-build-cli-38.testcase
-build-cli-39.testcase
-build-cli-40.testcase
-build-cli-41.testcase
-build-cli-42.testcase
-build-cli-43.testcase
-build-cli-44.testcase
+++ /dev/null
-#PRE-EXEC
-rm -rf ~/.build_tools/build_server/testserver3
-rm -rf buildsvr01
-mkdir buildsvr01
-#EXEC
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://ftpuser:ftpuser@172.21.111.124
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Created new build server: "testserver3"
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr -h
-#POST-EXEC
-#EXPECT
-Build-server administer service command-line tool.
-
-Usage: build-svr <SUBCOMMAND> [OPTS] or build-svr (-h|-v)
-
-Subcommands:
-create Create the build-server.
-remove Remove the build-server.
-migrate build-server DB migrate.
-start Start the build-server.
-stop Stop the build-server.
-upgrade Upgrade the build-server include friends.
-add-svr Add remote build/package server for support multi-OS or distribute build job.
-remove-svr Remove remote build/package server for support multi-OS or distribute build job.
-add-os Add supported OS.
-remove-os Remove supported OS.
-add-dist Add distribution.
-clone-dist Clone distribution.
-remove-dist Remove distribution.
-lock-dist Lock distribution.
-unlock-dist Unlock distribution.
-add-sync Add package repository URL to synchronize with.
-remove-sync Remove package repository URL.
-add-prj Add project to build.
-remove-prj Remove project.
-register Register the package to the build-server.
-query Show build server configuration.
-set-attr Set build server atribute.
-get-attr Get build server atribute.
-
-Subcommand usage:
-build-svr create -n <server name> [-t <ftp server url>]
-build-svr remove -n <server name>
-build-svr migrate -n <server name> [--dsn <db dsn> [--dbuser <db_user> --dbpassword <db_password>] ]
-build-svr start -n <server name> [-p <port>]
-build-svr stop -n <server name>
-build-svr upgrade -n <server name> [-D <distribution name>] [-u <package server url>]
-build-svr add-svr -n <server name> -d <friend server address>
-build-svr remove-svr -n <server name> -d <friend server address>
-build-svr add-os -n <server name> -o <os>
-build-svr remove-os -n <server name> -o <os>
-build-svr add-dist -n <server name> -D <distribution name> -u <package server url> -d <package server address> [-w <password>]
-build-svr clone-dist -n <server name> -O <origin distribution name> -T <target distribution name> -u <package server url> -d <package server address> [-w <password>]
-build-svr remove-dist -n <server name> -D <distribution name>
-build-svr lock-dist -n <server name> -D <distribution name>
-build-svr unlock-dist -n <server name> -D <distribution name>
-build-svr add-sync -n <server name> -u <remote pkg server url> [--dist <distribution>]
-build-svr remove-sync -n <server name> -u <remote pkg server url> [--dist <distribution>]
-build-svr add-prj -n <server name> -N <project name> (-g <git repository> -b <git branch>|-P <package name>) [-o <os list>] [--dist <distribution>]
-build-svr remove-prj -n <server name> -N <project name> [--dist <distribution>]
-build-svr register -n <server name> -P <package file> [--dist <distribution>]
-build-svr query -n <server name>
-build-svr set-attr -n <server name> -A <attribute> -V <value>
-build-svr get-attr -n <server name> -A <attribute>
-
-Options:
--n, --name <server name> build server name
--u, --url <package server url> package server url: http://127.0.0.1/dibs/unstable
--d, --address <server address> server address: 127.0.0.1:2224
--p, --port <port> server port number: 2224
--P, --pkg <package name/file> package file path or name
--o, --os <target os list> ex) ubuntu-32,windows-32
--N, --pname <project name> project name
--g, --git <git repository> git repository
--b, --branch <git branch> git branch
--D, --dist <distribution name> distribution name
--O <origin distribution name> origin distribution name
---origin-dist
--T <target distribution name> target distribution name
---target-dist
--w, --passwd <password> password for managing project
--t, --ftp <ftp server url> ftp server url: ftp://dibsftp:dibsftp@127.0.0.1:1024
--A, --attr <attribute name> attribute
---dsn <dsn> Data Source Name ex) mysql:host=localhost;database=test
---dbuser <user> DB user id
---dbpassword <password> DB password
--V, --value <value> value
--h, --help display this information
--v, --version display version
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-cd buildsvr01; ../../../build-svr add-dist -n testserver3 -D BASE -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-#EXEC
-../../build-svr add-svr -n testserver3 -d 127.0.0.1:2223
-../../build-svr query -n testserver3
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Friend server is added successfully!
-* REMOTE SERVER(S) *
-* 127.0.0.1:2223
-
-* SUPPORTED OS *
-
-* DISTRIBUTION(S) *
-* BASE
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
+++ /dev/null
-#PRE-EXEC
-rm -rf ~/.build_tools/build_server/testserver3
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-#EXEC
-echo "TEST_TIME=3" >> ~/.build_tools/build_server/testserver3/server.cfg
-../../build-svr start -n testserver3 -p 2223
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
+++ /dev/null
-#PRE-EXEC
-mkdir buildsvr01
-rm -rf ~/.build_tools/build_server/testserver3
-cd buildsvr01; ../../../build-svr create -n testserver3 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-cd buildsvr01; ../../../build-svr add-dist -n testserver3 -D BASE -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-../../build-svr start -n testserver3 -p 2223 &
-#EXEC
-sleep 1
-../../build-svr stop -n testserver3
-sleep 1
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Server will be down!
+++ /dev/null
-#PRE-EXEC
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-#EXEC
-../../build-svr stop -n testserver3
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Server is not running!
+++ /dev/null
-#PRE-EXEC
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-#EXEC
-../../build-svr remove -n testserver3
-#POST-EXEC
-rm -rf buildsvr01
-#EXPECT
-Removed the server
+++ /dev/null
-#PRE-EXEC
-rm -rf ~/.build_tools/build_server/testserver3
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-#EXEC
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Creating server failed. The server id is already exist
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr remove -n testserverxx
-#POST-EXEC
-#EXPECT
-does not exist!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr start -n testserverxx
-#POST-EXEC
-#EXPECT
-does not exist!
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-cd buildsvr01; ../../../build-svr add-dist -n testserver3 -D BASE -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-../../build-svr add-os -n testserver3 -o ubuntu-32
-#EXEC
-../../build-svr add-prj -n testserver3 -N testa -g test_git -b test_branch
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Adding project succeeded!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr add-prj -n testserverxxx -N testa -g test_git -b test_branch
-#POST-EXEC
-#EXPECT
-does not exist!
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-cd buildsvr01; ../../../build-svr add-dist -n testserver3 -D BASE -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-#EXEC
-../../build-svr add-prj -n testserver3 -N testa -g test_git -b test_branch -w 1111
-#POST-EXEC
-#EXPECT
-Adding project succeeded!
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-rm -rf ~/.build_tools/build_server/testserver3
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -t ftp://ftpuser:ftpuser@127.0.0.1
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-cd buildsvr01; ../../../build-svr add-dist -n testserver3 -D BASE -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-../../build-svr add-os -n testserver3 -o ubuntu-32
-#EXEC
-../../build-svr add-prj -n testserver3 -N testx -g test_git -b test_branch -o ubuntu-32
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Adding project succeeded!
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-#EXEC
-../../build-svr register -n testserver3 -P bin/bin_0.0.0_ubuntu-32.zip
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for REGISTER Job
-Info: New Job
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-../../build-svr register -n testserver3 -P bin/bin_0.0.0_ubuntu-32.zip
-#EXEC
-../../build-svr register -n testserver3 -P bin/bin_0.0.0_ubuntu-32.zip
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Info: Initializing job...
-Info: Checking package version ...
-Error: Version must be increased :
-Error: Job is stopped by ERROR
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-cd buildsvr01; ../../../build-svr add-dist -n testserver3 -D BASE -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-#EXEC
-../../build-svr add-os -n testserver3 -o ubuntu-32
-../../build-svr query -n testserver3
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Target OS is added successfully!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* BASE
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-#EXEC
-../../build-svr add-os -n testserver3 -o ubuntu-32
-../../build-svr add-os -n testserver3 -o ubuntu-32
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Target OS is added successfully!
-Target OS already exists in list!
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://dibsftp:coreps2@172.21.111.132
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-../../build-svr add-os -n testserver3 -o ubuntu-32
-../../build-svr add-os -n testserver3 -o windows-32
-#EXEC
-../../build-svr add-prj -n testserver3 -N new_project -g new_git -b new_branch -o wrong_os_name
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Unsupported OS name "wrong_os_name" is used!
-Check the following supported OS list:
- * ubuntu-32
- * windows-32
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -t ftp://ftpuser:ftpuser@172.21.111.124
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-cd buildsvr01; ../../../build-svr add-dist -n testserver3 -D BASE -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-../../build-svr add-os -n testserver3 -o ubuntu-32
-../../build-svr add-prj -n testserver3 -N bin -P bin -o ubuntu-32
-mkdir -p bin
-cp ../bin/bin_0.0.0_ubuntu-32.zip bin/bin_0.0.0_wrongosname.zip
-../../build-svr start -n testserver3 -p 2223 &
-#EXEC
-sleep 1
-../../build-svr register -n testserver3 -P bin/bin_0.0.0_wrongosname.zip
-#POST-EXEC
-../../build-svr stop -n testserver3
-sleep 1
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-rm -rf bin/bin/bin_0.0.0_wrongosname.zip
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Error: Unsupported OS used in package file name!: wrongosname
-Error: Job is stopped by ERROR
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://ftpuser:ftpuser@172.21.111.124
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-#EXEC
-../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 3
-../../build-svr get-attr -n testserver3 -A MAX_WORKING_JOBS
-../../build-svr set-attr -n testserver3 -A XXX
-../../build-svr set-attr -n testserver3 -A XXX -V 1
-../../build-svr get-attr -n testserver3 -A XXX
-
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-3
-Usage: build-svr set-attr -n <server name> -A <attribute> -V <value>
-Wrong attribute name!
-Wrong attribute name!
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://ftpuser:ftpuser@172.21.111.124
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-#EXEC
-../../build-svr add-dist -n testserver3 -D BASE -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-../../build-svr remove-dist -n testserver3 -D BASE
-../../build-svr query -n testserver3
-../../build-svr add-svr -n testserver3 -d 127.0.0.1:2223
-../../build-svr remove-svr -n testserver3 -d 127.0.0.1:2223
-../../build-svr add-os -n testserver3 -o ubuntu-32
-../../build-svr remove-os -n testserver3 -o ubuntu-32
-../../build-svr lock-dist -n testserver3 -D BASE
-../../build-svr unlock-dist -n testserver3 -D BASE
-../../build-svr add-sync -n testserver3 -u `pwd`/../pkgsvr01/unstable
-../../build-svr remove-sync -n testserver3 -u `pwd`/../pkgsvr01/unstable
-../../build-svr add-prj -n testserver3 -N testx -g test_git -b test_branch -o ubuntu-32
-../../build-svr remove-prj -n testserver3 -N testx
-../../build-svr register -n testserver3 -P bin/bin_0.0.0_ubuntu-32.zip
-../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 3
-../../build-svr get-attr -n testserver3 -A MAX_WORKING_JOBS
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-Error: No DB exists and create(migrate) DB first!
-3
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://ftpuser:ftpuser@172.21.111.124
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-#EXEC
-../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 3
-../../build-svr get-attr -n testserver3 -A MAX_WORKING_JOBS
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-3
+++ /dev/null
-#PRE-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-mkdir buildsvr01
-cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://ftpuser:ftpuser@172.21.111.124
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-#EXEC
-../../build-svr get-attr -n testserver3 -A MAX_JOBS
-../../build-svr set-attr -n testserver3 -A MAX_JOBS -V 3
-../../build-svr get-attr -n testserver3 -A MAX_JOBS
-#POST-EXEC
-../../build-svr remove -n testserver3
-rm -rf buildsvr01
-#EXPECT
-4
-3
+++ /dev/null
-build-svr-01.testcase
-build-svr-02.testcase
-build-svr-03.testcase
-build-svr-04.testcase
-build-svr-05.testcase
-build-svr-06.testcase
-build-svr-07.testcase
-build-svr-08.testcase
-build-svr-09.testcase
-build-svr-10.testcase
-build-svr-11.testcase
-build-svr-12.testcase
-build-svr-13.testcase
-build-svr-14.testcase
-build-svr-17.testcase
-build-svr-18.testcase
-build-svr-19.testcase
-build-svr-20.testcase
-build-svr-21.testcase
-build-svr-23.testcase
-build-svr-24.testcase
-build-svr-25.testcase
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 -D unstable -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Started to build this job...
-Info: JobBuilder#
-Info: Start to build on remote server...
-Info: Sending build request to remote server...
-Info: Added new job
-Info: Initializing job...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.1_ubuntu-32.zip
-Info: Copying result files to
-Info: *
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
-Info: Receiving file from remote server : a_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -N testb -d 127.0.0.1:2223 -o ubuntu-32 -D unstable -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Started to build this job...
-Info: JobBuilder
-Info: Start to build on remote server...
-Info: Sending build request to remote server...
-Info: Added new job
-Info: Initializing job...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: * a
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... b_0.0.1_ubuntu-32.zip
-Info: Copying result files to
-Info: *
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testb"
-Info: Receiving file from remote server : b_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testb"
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -N testa,testb -d 127.0.0.1:2223 -o ubuntu-32 -D unstable --rebuild -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Invoking a thread for MULTI-BUILD Job
-Info: New Job
-Info: Added new job "testa" for ubuntu-32!
-Info: Added new job "testb" for ubuntu-32!
-Info: * Sub-Job "testa(ubuntu-32)" has entered "REMOTE_WORKING" state.
-Info: * Sub-Job "testa(ubuntu-32)" has entered "FINISHED" state.
-Info: * Sub-Job "testb(ubuntu-32)" has entered "REMOTE_WORKING" state.
-Info: * Sub-Job "testb(ubuntu-32)" has entered "FINISHED" state.
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli query-system -d localhost:2224
-../../build-svr set-attr -n testserver4 -A MAX_WORKING_JOBS -V 5
-../../build-cli query-system -d localhost:2224
-
-#POST-EXEC
-#EXPECT
-* SYSTEM INFO *
-HOST-OS: ubuntu-32
-MAX_WORKING_JOBS: 2
-
-* FTP *
-FTP_ADDR: NONE
-FTP_USERNAME: NONE
-
-* SUPPORTED OS LIST *
-
-* FRIEND SERVER LIST (WAIT|WORK/MAX) jobs [transfer count] *
-* SYSTEM INFO *
-HOST-OS: ubuntu-32
-MAX_WORKING_JOBS: 5
-
-* FTP *
-FTP_ADDR: NONE
-FTP_USERNAME: NONE
-
-* SUPPORTED OS LIST *
-
-* FRIEND SERVER LIST (WAIT|WORK/MAX) jobs [transfer count] *
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-
-if [ ! "$DB_PASSWD" ] ; then
- echo -n "insert Mysql password : "
- read input
- export DB_PASSWD=$input
-else
- echo $DB_PASSWD
-fi
-
-rm -rf buildsvr01
-rm -rf git01
-rm -rf bin
-rm -rf ~/.build_tools/build_server/testserver3
-
-../../build-svr remove -n testserver3
-mkdir buildsvr01
-cd buildsvr01
-${RUBY} ../../../build-svr create -n testserver3 #-t ftp://ftpuser:ftpuser@127.0.0.1
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-${RUBY} ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-rm -f a
-cd ..
-
-${RUBY} ../../build-svr add-dist -n testserver3 -D unstable -u `pwd`/pkgsvr01/unstable -d 127.0.0.1:3333
-${RUBY} ../../build-svr add-svr -n testserver3 -d 127.0.0.1:2224
-${RUBY} ../../build-svr add-os -n testserver3 -o ubuntu-32
-${RUBY} ../../build-svr add-os -n testserver3 -o windows-32
-${RUBY} ../../build-svr add-prj -n testserver3 -N testa -g `pwd`/git01/a -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N testb -g `pwd`/git01/b -b master
-${RUBY} ../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 0
-
-mkdir -p git01
-cp ../git01/*.tar.gz git01/
-cd git01
-rm -rf a
-rm -rf b
-tar xvf a_v1.tar.gz
-tar xvf b_v1.tar.gz
-cd ..
-
-${RUBY} ../../build-svr start -n testserver3 -p 2223 --CHILD
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-
-rm -rf buildsvr02
-
-../../build-svr remove -n testserver4
-mkdir buildsvr02
-cd buildsvr02
-${RUBY} ../../../build-svr create -n testserver4
-cd ..
-#${RUBY} ../../build-svr add-dist -n testserver4 -D unstable -u `pwd`/pkgsvr01/unstable -d 127.0.0.1:3333
-
-${RUBY} ../../build-svr start -n testserver4 -p 2224 --CHILD
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-rm -rf ~/.build_tools/pkg_server/pkgsvr01
-rm -rf `pwd`/pkgsvr01
-${RUBY} ../../pkg-svr create -n pkgsvr01 -d unstable
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o ubuntu-32
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o windows-32
-${RUBY} ../../pkg-svr start -n pkgsvr01 -p 3333
+++ /dev/null
-01.testcase
-02.testcase
-03.testcase
-04.testcase
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../pkg-svr register -n pkgsvr02 -d unstable -P bin/bin_0.0.1_ubuntu-32.zip
-sleep 50
-../../pkg-cli list-rpkg -P bin -u `pwd`/pkgsvr01/unstable
-#POST-EXEC
-#EXPECT
-Archive: bin/bin_0.0.1_ubuntu-32.zip
-inflating:
-snapshot is generated :
-package registed successfully
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-bin (0.0.1)
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../pkg-svr register -n pkgsvr02 -d unstable -P bin/bin_0.0.2_ubuntu-32.zip
-../../pkg-svr register -n pkgsvr02 -d unstable -P bin/bin_0.0.2_windows-32.zip
-sleep 50
-../../pkg-cli list-rpkg -P bin -u `pwd`/pkgsvr01/unstable -o ubuntu-32
-../../pkg-cli list-rpkg -P bin -u `pwd`/pkgsvr01/unstable -o windows-32
-../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Archive: bin/bin_0.0.2_ubuntu-32.zip
-inflating:
-snapshot is generated :
-package registed successfully
-Archive: bin/bin_0.0.2_windows-32.zip
-inflating:
-snapshot is generated :
-package registed successfully
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-bin (0.0.2)
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-bin (0.0.2)
-Info: Added new job "2" for ubuntu-32!
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job 2
-Info: New Job 2 is started
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder#2 is created
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-
-if [ ! "$DB_PASSWD" ] ; then
- read -p "Insert DB password: " input
- export DB_PASSWD=$input
-else
- echo $DB_PASSWD
-fi
-
-rm -rf buildsvr01
-rm -rf git01
-rm -rf bin
-rm -rf ~/.build_tools/build_server/testserver3
-
-../../build-svr remove -n testserver3
-mkdir buildsvr01
-cd buildsvr01
-${RUBY} ../../../build-svr create -n testserver3 #-t ftp://ftpuser:ftpuser@127.0.0.1
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-${RUBY} ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-rm -f a
-cd ..
-
-${RUBY} ../../build-svr add-dist -n testserver3 -D unstable -u `pwd`/pkgsvr01/unstable -d 127.0.0.1:3333
-${RUBY} ../../build-svr add-os -n testserver3 -o ubuntu-32
-${RUBY} ../../build-svr add-os -n testserver3 -o windows-32
-${RUBY} ../../build-svr add-prj -n testserver3 -N testa -g `pwd`/git01/a -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N teste -P bin -D unstable -o ubuntu-32,windows-32
-${RUBY} ../../build-svr add-sync -n testserver3 -u `pwd`/pkgsvr02/unstable -D unstable
-
-mkdir -p git01
-cp ../git01/*.tar.gz git01/
-cd git01
-rm -rf a
-rm -rf a1
-rm -rf b
-rm -rf c
-rm -rf d
-tar xvf a_v1.tar.gz
-tar xvf b_v1.tar.gz
-tar xvf c_v1.tar.gz
-tar xvf d_v0.tar.gz
-tar xvf a1_v1.tar.gz
-cd ..
-mkdir -p bin
-cp ../bin/*.zip ./bin/
-
-${RUBY} ../../build-svr start -n testserver3 -p 2223 --CHILD
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-rm -rf ~/.build_tools/pkg_server/pkgsvr01
-rm -rf `pwd`/pkgsvr01
-${RUBY} ../../pkg-svr create -n pkgsvr01 -d unstable
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o ubuntu-32
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o windows-32
-${RUBY} ../../pkg-svr start -n pkgsvr01 -p 3333
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-rm -rf ~/.build_tools/pkg_server/pkgsvr02
-rm -rf `pwd`/pkgsvr02
-${RUBY} ../../pkg-svr create -n pkgsvr02 -d unstable
-${RUBY} ../../pkg-svr add-os -n pkgsvr02 -d unstable -o ubuntu-32
-${RUBY} ../../pkg-svr add-os -n pkgsvr02 -d unstable -o windows-32
-${RUBY} ../../pkg-svr start -n pkgsvr02 -p 3334
+++ /dev/null
-01.testcase
+++ /dev/null
-02.testcase
+++ /dev/null
-#PRE-EXEC
-rm -rf buildsvr01
-rm -rf ~/.build_tools/build_server/testserver3
-mkdir buildsvr01
-cd buildsvr01;../../../build-svr create -n testserver3 -t ftp://ftpuser:ftpuser@127.0.0.1
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-cd buildsvr01; ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-../../build-svr add-os -n testserver3 -o ubuntu-32
-../../build-svr add-os -n testserver3 -o ubuntu-64
-#EXEC
-../../build-svr remove-os -n testserver3 -o ubuntu-64
-../../build-svr query -n testserver3
-#POST-EXEC
-#EXPECT
-Target OS is removed successfully!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
+++ /dev/null
-#PRE-EXEC
-echo "no os"
-#EXEC
-../../build-svr remove-os -n testserver3 -o ubuntu-644
-#POST-EXEC
-#EXPECT
-Target OS does not exist in list!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr add-dist -n testserver3 -D unstable -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-../../build-svr query -n testserver3
-#POST-EXEC
-#EXPECT
-Distribution is added successfully!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
+++ /dev/null
-#PRE-EXEC
-../../build-svr add-dist -n testserver3 -D unstable2 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-#EXEC
-../../build-svr remove-dist -n testserver3 -D unstable2
-../../build-svr query -n testserver3
-#POST-EXEC
-#EXPECT
-Distribution is removed successfully!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr remove-dist -n testserver3 -D unstable22
-#POST-EXEC
-#EXPECT
-Distribution does not exist in list!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr add-sync -n testserver3 -u http://xxx
-../../build-svr query -n testserver3
-../../build-svr add-sync -n testserver3 -D unstable -u http://yyy
-../../build-svr query -n testserver3
-../../build-svr remove-sync -n testserver3 -u http://yyy
-../../build-svr query -n testserver3
-../../build-svr remove-sync -n testserver3 -D unstable testserver3 -u http://xxx
-../../build-svr query -n testserver3
-../../build-svr remove-sync -n testserver3 -D unstable testserver3 -u http://xxxyyyy
-#POST-EXEC
-#EXPECT
-Remote package server is added!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-
-* SYNC PACKAGE SERVER(S) *
-* [unstable] http://xxx
-
-* PROJECT(S) *
-Remote package server is added!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-
-* SYNC PACKAGE SERVER(S) *
-* [unstable] http://xxx
-* [unstable] http://yyy
-
-* PROJECT(S) *
-Remote package server is removed!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-
-* SYNC PACKAGE SERVER(S) *
-* [unstable] http://xxx
-
-* PROJECT(S) *
-Remote package server is removed!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
-The server does not exist in list!
+++ /dev/null
-#PRE-EXEC
-../../build-svr add-dist -n testserver3 -D unstable2 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333
-#EXEC
-../../build-svr add-prj -n testserver3 -N test1 -g test1_git -b test1_branch
-../../build-svr query -n testserver3
-../../build-svr add-prj -n testserver3 -D unstable -N test2 -g test1_git -b test1_branch
-../../build-svr add-prj -n testserver3 -D unstable2 -N test1 -g test1_git -b test1_branch
-../../build-svr query -n testserver3
-../../build-svr remove-prj -n testserver3 -N test1
-../../build-svr query -n testserver3
-../../build-svr remove-prj -n testserver3 -D unstable -N test2
-../../build-svr remove-prj -n testserver3 -D unstable2 -N test1
-../../build-svr query -n testserver3
-../../build-svr remove-prj -n testserver3 -D unstable -N testxxx
-#POST-EXEC
-../../build-svr remove-dist -n testserver3 -D unstable2
-#EXPECT
-Adding project succeeded!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-* unstable2
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
-* [unstable] test1
-Adding project succeeded!
-Adding project succeeded!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-* unstable2
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
-* [unstable] test1
-* [unstable] test2
-* [unstable2] test1
-Removing project succeeded!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-* unstable2
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
-* [unstable] test2
-* [unstable2] test1
-Removing project succeeded!
-Removing project succeeded!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-* unstable2
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
-Removing project failed!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr add-prj -n testserver3 -D unstable -N testbin -P bin
-../../build-svr query -n testserver3
-../../build-svr remove-prj -n testserver3 -N testbin -D unstable
-#POST-EXEC
-#EXPECT
-Adding project succeeded!
-* REMOTE SERVER(S) *
-
-* SUPPORTED OS *
-* ubuntu-32
-
-* DISTRIBUTION(S) *
-* unstable
-
-* SYNC PACKAGE SERVER(S) *
-
-* PROJECT(S) *
-* [unstable] testbin
-Removing project succeeded!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr lock-dist -n testserver3 -D unstable
-../../build-svr lock-dist -n testserver3 -D unstable2
-../../build-svr unlock-dist -n testserver3 -D unstable
-../../build-svr unlock-dist -n testserver3 -D unstable2
-#POST-EXEC
-#EXPECT
-Distribution is locked!
-Locking distribution failed!
-Distribution is unlocked!
-Unlocking distribution failed!
+++ /dev/null
-build-svr2-01.testcase
-build-svr2-02.testcase
-build-svr2-03.testcase
-build-svr2-04.testcase
-build-svr2-05.testcase
-build-svr2-06.testcase
-build-svr2-07.testcase
-build-svr2-08.testcase
-build-svr2-09.testcase
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-svr register -n testserver3 -D unstable -P bin/bin_0.0.0_ubuntu-32.zip
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for REGISTER Job
-Info: New Job
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -N testa -d 127.0.0.1:2223 -D unstable -U admin@user -w 1234
-../../build-cli build -N testa -d 127.0.0.1:2223 -D unstable2 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... a_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testa"
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli register -d 127.0.0.1:2223 -P bin/bin_0.0.0_ubuntu-32.zip -D unstable2 -U admin@user -w 1234 #-t ftp://ftpuser:ftpuser@127.0.0.1
-#POST-EXEC
-#EXPECT
-I, [
-I, [
-I, [
-I, [
-I, [
-I, [
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for REGISTER Job
-Info: New Job
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testbin"
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../../build-cli build -d 127.0.0.1:2223 -N testa,testb -o all -D unstable2 --rebuild -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Initializing sub-job
-Info: Initializing sub-job
-Info: Invoking a thread for MULTI-BUILD Job
-Info: New Job
-Info: Added new job "testa" for ubuntu-32!
-Info: Added new job "testb" for ubuntu-32!
-Info: * Sub-Job "testa(ubuntu-32)" has entered "WORKING" state.
-Info: * Sub-Job "testa(ubuntu-32)" has entered "FINISHED" state.
-Info: * Sub-Job "testb(ubuntu-32)" has entered "WORKING" state.
-Info: * Sub-Job "testb(ubuntu-32)" has entered "FINISHED" state.
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed
+++ /dev/null
-#PRE-EXEC
-../../pkg-svr remove-pkg -n pkgsvr01 -d unstable2 -P b
-#EXEC
-echo "=="
-../../build-svr lock-dist -n testserver3 -D unstable2
-echo "=="
-../../build-cli build -N testb -d 127.0.0.1:2223 -D unstable2 -U admin@user -w 1234
-echo "=="
-../../build-svr unlock-dist -n testserver3 -D unstable2
-echo "=="
-../../build-cli build -N testb -d 127.0.0.1:2223 -D unstable2 -U admin@user -w 1234
-#POST-EXEC
-#EXPECT
-==
-Distribution is locked!
-==
-Error: Distribution locked!: unstable2
-==
-Distribution is unlocked!
-==
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Info: Invoking a thread for building Job
-Info: New Job
-Info: Checking build dependency ...
-Info: Checking install dependency ...
-Info: Started to build this job...
-Info: JobBuilder
-Info: Downloding client is initializing...
-Info: Installing dependent packages...
-Info: * a
-Info: Wait for cache sync
-Info: Entering cache sync
-Info: Cache sync done
-Info: Downloading dependent source packages...
-Info: Make clean...
-Info: Make build...
-Info: Make install...
-Info: Generatiing pkginfo.manifest...
-Info: Zipping...
-Info: Creating package file ... b_0.0.1_ubuntu-32.zip
-Info: Checking reverse build dependency ...
-Info: Uploading ...
-Info: Upload succeeded. Sync local pkg-server again...
-Info: Snapshot:
-Info: Job is completed!
-Info: Job is FINISHED successfully!
-Info: Updating the source info for project "testb"
+++ /dev/null
-#PRE-EXEC
-echo "Will check duplicated registration"
-../../build-svr register -n testserver3 -D unstable -P bin/bin_0.0.1_ubuntu-32.zip &
-#EXEC
-sleep 1
-../../build-svr register -n testserver3 -D unstable -P bin/bin_0.0.1_ubuntu-32.zip
-#POST-EXEC
-#EXPECT
-Info: Added new job
-Info: Initializing job...
-Info: Checking package version ...
-Error: There already exists same job.
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-
-if [ ! "$DB_PASSWD" ] ; then
- read -p "Insert DB password: " input
- export DB_PASSWD=$input
-else
- echo $DB_PASSWD
-fi
-
-rm -rf buildsvr01
-rm -rf git01
-rm -rf bin
-rm -rf ~/.build_tools/build_server/testserver3
-
-../../build-svr remove -n testserver3
-mkdir buildsvr01
-cd buildsvr01
-${RUBY} ../../../build-svr create -n testserver3 #-t ftp://ftpuser:ftpuser@127.0.0.1
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-${RUBY} ../../../build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-rm -f a
-cd ..
-
-${RUBY} ../../build-svr add-dist -n testserver3 -D unstable -u `pwd`/pkgsvr01/unstable -d 127.0.0.1:3333
-${RUBY} ../../build-svr add-dist -n testserver3 -D unstable2 -u `pwd`/pkgsvr01/unstable2 -d 127.0.0.1:3333
-${RUBY} ../../build-svr add-os -n testserver3 -o ubuntu-32
-${RUBY} ../../build-svr add-prj -n testserver3 -N testa -g `pwd`/git01/a -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N testb -g `pwd`/git01/b -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N testa -D unstable2 -g `pwd`/git01/a -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N testb -D unstable2 -g `pwd`/git01/b -b master
-${RUBY} ../../build-svr add-prj -n testserver3 -N testbin -D unstable -P bin
-${RUBY} ../../build-svr add-prj -n testserver3 -N testbin -D unstable2 -P bin
-
-mkdir -p git01
-cp ../git01/*.tar.gz git01/
-cd git01
-rm -rf a
-rm -rf b
-tar xf a_v1.tar.gz
-tar xf b_v1.tar.gz
-cd ..
-
-mkdir -p bin
-cp ../bin/* bin/
-
-${RUBY} ../../build-svr start -n testserver3 -p 2223 --CHILD
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-rm -rf ~/.build_tools/pkg_server/pkgsvr01
-rm -rf `pwd`/pkgsvr01
-${RUBY} ../../pkg-svr create -n pkgsvr01 -d unstable
-${RUBY} ../../pkg-svr add-dist -n pkgsvr01 -d unstable2
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o ubuntu-32
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o windows-32
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable2 -o ubuntu-32
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable2 -o windows-32
-${RUBY} ../../pkg-svr start -n pkgsvr01 -p 3333
+++ /dev/null
-build-svr3-01.testcase
-build-svr3-02.testcase
-build-svr3-03.testcase
-build-svr3-04.testcase
-build-svr3-05.testcase
-build-svr3-06.testcase
+++ /dev/null
-packageserver01.testcase
-packageserver02.testcase
-packageserver24.testcase
-packageserver03.testcase
-packageserver04.testcase
-packageserver05.testcase
-packageserver06.testcase
-packageserver07.testcase
-packageserver08.testcase
-packageserver09.testcase
-packageserver11.testcase
-packageserver13.testcase
-packageserver14.testcase
-packageserver15.testcase
-packageserver16.testcase
-packageserver17.testcase
-packageserver18.testcase
-packageserver19.testcase
-packageserver20.testcase
-packageserver21.testcase
-packageserver22.testcase
-packageserver23.testcase
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr -h
-#POST-EXEC
-#EXPECT
-Package-server administer service command-line tool.
-
-Usage: pkg-svr <SUBCOMMAND> [OPTS] or pkg-svr -h
-
-Subcommands:
-create Create a package-server.
-add-dist Add a distribution to package-server.
-register Register a package in package-server.
-remove Remove a package-server.
-remove-dist Remove a distribution to package-server.
-remove-snapshot Remove a snapshot in package-server.
-gen-snapshot Generate a snapshot in package-server.
-sync Synchronize the package-server from parent package server.
-start Start the package-server.
-stop Stop the package-server.
-clean Delete unneeded package files in package-server.
-list Show all pack
-
-Subcommand usage:
-pkg-svr create -n <server name> -d <distribution> [-u <remote server url>] [-l <location>]
-pkg-svr add-dist -n <server name> -d <distribution> [-u <remote_server_url>] [--clone]
-pkg-svr add-os -n <server name> -d <distribution> -o <os>
-pkg-svr register -n <server name> -d <distribution> -P <package file list> [--gen] [--test]
-pkg-svr link -n <server name> -d <distribution> --origin-pkg-name <origin pkg name> --origin-pkg-os <origin pkg os> --link-os-list <link os list>
-pkg-svr remove -n <server name>
-pkg-svr remove-dist -n <server name> -d <distribution>
-pkg-svr remove-pkg -n <server name> -d <distribution> -P <package name list> [-o <os>]
-pkg-svr remove-snapshot -n <server name> -d <distribution> -s <snapshot list>
-pkg-svr gen-snapshot -n <server name> -d <distribution> -s <snapshot name> [-b <base snapshot name>]
-pkg-svr sync -n <server name> -d <distribution> [--force]
-pkg-svr clean -n <server name> -d <distribution> [-s <snapshot list>]
-pkg-svr start -n <server name> -p <port>
-pkg-svr stop -n <server name> -p <port>
-pkg-svr list [-n <server name>]
-
-Options:
--n, --name <server name> package server name
--d, --dist <distribution> package server distribution
--u, --url <server url> remote server url: http://127.0.0.1/dibs/unstable
--o, --os <operating system> target operating system
--P, --pkgs <package file list> package file path list
--s, --snapshot <snapshot> a snapshot name or snapshot list
--b, --base <base snapshot> base snapshot name
--l, --loc <location> server location
--p, --port <port> port number
- --clone clone mode
- --force force update pkg file
- --test upload for test
- --gen generate snapshot
- --origin-pkg-name <origin_pkg_name>
- origin package name
- --origin-pkg-os <origin_pkg_os>
- origin package os
- --link-os-list <link_os_list>
- target os list to link origin file
--h, --help display help
--v, --version display version
+++ /dev/null
-#PRE-EXEC
-../pkg-svr remove -n temp_local --force
-#EXEC
-../pkg-svr create -n temp_local -d unstable
-#POST-EXEC
-#EXPECT
-package server [temp_local] created successfully
+++ /dev/null
-#PRE-EXEC
-../pkg-svr remove -n temp_remote --force
-#EXEC
-../pkg-svr create -n temp_remote -d unstable -u http://172.21.111.177/tmppkgsvr/tmp
-#POST-EXEC
-#EXPECT
-snapshot is generated :
-package server [temp_remote] created successfully
+++ /dev/null
-#PRE-EXEC
-../pkg-svr remove -n temp_remote_dup --force
-#EXEC
-../pkg-svr create -n temp_remote_dup -d unstable -u temp_remote/unstable
-#POST-EXEC
-#EXPECT
-package server [temp_remote_dup] created successfully
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr add-dist -n temp_local -d stable
-#POST-EXEC
-#EXPECT
-distribution [stable] added successfully
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr sync -n temp_remote -d unstable
-#POST-EXEC
-#EXPECT
-package server [temp_remote]'s distribution [unstable] has been synchronized.
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr sync -n temp_remote_dup -d unstable --force
-#POST-EXEC
-#EXPECT
-package server [temp_remote_dup]'s distribution [unstable] has been synchronized.
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr gen-snapshot -n temp_remote -s snap01
-#POST-EXEC
-#EXPECT
-snapshot is generated :
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr gen-snapshot -n temp_remote -d unstable -s snap02
-#POST-EXEC
-#EXPECT
-snapshot is generated :
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr gen-snapshot -n temp_remote -d unstable -s test
-#POST-EXEC
-#EXPECT
-snapshot is generated :
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr gen-snapshot -n temp_remote -d unstable -s snap03 -b snap01
-#POST-EXEC
-#EXPECT
-snapshot is generated :
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr gen-snapshot -n temp_remote -d unstable -s test3
-#POST-EXEC
-#EXPECT
-snapshot is generated :
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr create -n temp_remote_snap -d unstable -u temp_remote/unstable/snapshots/snap01
-#POST-EXEC
-#EXPECT
-package server [temp_remote_snap] created successfully
+++ /dev/null
-#PRE-EXEC
-cp test_server_pkg_file/smart-build-interface* ./
-#EXEC
-../pkg-svr register -n temp_remote -d unstable -P smart-build-interface_1.20.1_linux.zip --gen
-#POST-EXEC
-#EXPECT
-package registed successfully
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr register -n temp_remote -d unstable -P smart-build-interface_1.20.1_linux.zip --gen
-#POST-EXEC
-#EXPECT
-existing package's version is higher than register package
+++ /dev/null
-#PRE-EXEC
-cp test_server_pkg_file/smart-build-interface* ./
-#EXEC
-../pkg-svr register -n temp_remote_dup -d unstable -P ./temp_remote/unstable/binary/smart-build-interface_1.20.1_linux.zip --gen --test
-#POST-EXEC
-#EXPECT
-package registed successfully
+++ /dev/null
-#PRE-EXEC
-cp test_server_pkg_file/smart-build-interface* ./
-#EXEC
-../pkg-svr remove-pkg -n temp_local -d unstable -P smart-build-interface
-#POST-EXEC
-#EXPECT
-package removed successfully
+++ /dev/null
-#PRE-EXEC
-cp test_server_pkg_file/smart-build-interface* ./
-#EXEC
-../pkg-svr list
-#POST-EXEC
-#EXPECT
-temp_remote_snap
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr list -n temp_local
-#POST-EXEC
-rm smart-build-interface_1.20.1*
-#EXPECT
-unstable
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr remove -n temp_local --force
-#POST-EXEC
-YES
-#EXPECT
-package server [temp_local] removed successfully
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr remove -n temp_remote --force
-#POST-EXEC
-YES
-#EXPECT
-package server [temp_remote] removed successfully
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr remove -n temp_remote_dup --force
-#POST-EXEC
-YES
-#EXPECT
-package server [temp_remote_dup] removed successfully
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr remove -n temp_remote_snap --force
-#POST-EXEC
-YES
-#EXPECT
-package server [temp_remote_snap] removed successfully
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr add-os -n temp_local -d unstable -o ubuntu-32
-#POST-EXEC
-../pkg-svr add-os -n temp_local -d unstable -o windows-32
-#EXPECT
-snapshot is generated :
-package server add os [ubuntu-32] successfully
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-svr link -n temp_local -d unstable --origin-pkg-name smart-build-interface --origin-pkg-os ubuntu-10.04-32 --link-os-list windows-7-32
-#POST-EXEC
-#EXPECT
-package linked successfully
+++ /dev/null
-#!/usr/bin/ruby
-
-=begin
-
- performance_analyzer
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'rubygems'
-require 'time'
-require 'optparse'
-require 'dbi'
-
-class CommonJob
- attr_accessor :id, :project, :user, :supported_os, :distribution, :parent_job, :remote_build_server, :jtype, :status, :user_group
- attr_accessor :t_BASE, :t_S, :t_IS, :t_IE, :t_WS, :t_RUS, :t_RUE, :t_RDS, :t_RDE, :t_US, :t_UE, :t_E
- attr_accessor :d_BASE, :d_waitI, :d_INIT, :d_waitW, :d_RU, :d_WORK, :d_RD, :d_waitU, :d_U, :d_FINISH, :d_total, :sub_total, :sub_work_total
- attr_accessor :sub_job
- def initialize(option, projects, supported_os, distributions)
- @id = option['id']
- @project = projects[option['project_id']]
- @project = "" if @project.nil?
- @supported_os = supported_os[option['supported_os_id']]
- @distribution = distributions[option['distribution_id']]
- @parent_job = option['parent_job']
- @remote_build_server = option['remote_build_server']
- @jtype = option['jtype']
- @status = option['status']
- #set time stamp
- @t_BASE = nil
- t = Time.now
- offset = t.getlocal.gmt_offset
- @t_S = Time.parse(option['start_time'].strftime) - offset if not option['start_time'].nil?
- @t_IS = Time.parse(option['INIT_START'].strftime) - offset if not option['INIT_START'].nil?
- @t_IE = Time.parse(option['INIT_END'].strftime) - offset if not option['INIT_END'].nil?
- @t_WS = Time.parse(option['WORK_START'].strftime) - offset if not option['WORK_START'].nil?
- @t_RUS = Time.parse(option['REMOTE_UPLOAD_START'].strftime) - offset if not option['REMOTE_UPLOAD_START'].nil?
- @t_RUE = Time.parse(option['REMOTE_UPLOAD_END'].strftime) - offset if not option['REMOTE_UPLOAD_END'].nil?
- @t_RDS = Time.parse(option['REMOTE_DOWNLOAD_START'].strftime) - offset if not option['REMOTE_DOWNLOAD_START'].nil?
- @t_RDE = Time.parse(option['REMOTE_DOWNLOAD_END'].strftime) - offset if not option['REMOTE_DOWNLOAD_END'].nil?
- @t_US = Time.parse(option['UPLOAD_START'].strftime) - offset if not option['UPLOAD_START'].nil?
- @t_UE = Time.parse(option['UPLOAD_END'].strftime) - offset if not option['UPLOAD_END'].nil?
- @t_E = Time.parse(option['end_time'].strftime) - offset if not option['end_time'].nil?
- @sub_job = []
- @d_BASE = 0
- @d_waitI = 0
- @d_INIT = 0
- @d_waitW = 0
- @d_RU = 0
- @d_RD = 0
- @d_U = 0
- @d_waitU = 0
- @d_WORK = 0
- @d_FINISH = 0
- @d_total = 0
- @sub_total = 0
- @sub_work_total = 0
- end
- def gen_duration
- @sub_job.each {|x| x.gen_duration}
- @d_BASE = @t_S - @t_BASE if not @t_S.nil? and not @t_BASE.nil?
- @d_waitI = @t_IS - @t_S if not @t_IS.nil? and not @t_S.nil?
- @d_INIT = @t_IE - @t_IS if not @t_IE.nil? and not @t_IS.nil?
- @d_waitW = @t_WS - @t_IE if not @t_WS.nil? and not @t_IE.nil?
- @d_RU = @t_RUE - @t_RUS if not @t_RUE.nil? and not @t_RUS.nil?
- @d_RD = @t_RDE - @t_RDS if not @t_RDE.nil? and not @t_RDS.nil?
- @d_U = @t_UE - @t_US if not @t_UE.nil? and not @t_US.nil?
- @d_waitU = @t_US - @t_RDE if not @t_US.nil? and not @t_RDE.nil?
- work_end = [@t_E, @t_US, @t_RDS].compact
- work_start = [@t_WS, @t_RUE].compact
- @d_WORK = work_end.min - work_start.max if not work_end.empty? and not work_start.empty?
- @d_FINISH = @t_E - work_end.max if not work_end.empty? and @t_E.nil?
- @d_total = @t_E - @t_S if not @t_E.nil? and not @t_S.nil?
- @sub_job.each do |x|
- @sub_total = @sub_total + x.d_total if not x.d_total.nil?
- @sub_total = @sub_total + x.sub_total if not x.sub_total.nil?
- end
- @sub_job.each do |x|
- @sub_work_total = @sub_work_total + x.d_WORK if not x.d_WORK.nil?
- @sub_work_total = @sub_work_total + x.sub_work_total if not x.sub_work_total.nil?
- end
- end
- def print_cvs(pre_pending = 0, post_pending = 2)
- result = []
- work = 0
- work = @d_WORK if @jtype != "MULTIBUILD"
- result.push "" + (", " * pre_pending) + @id.to_s + (", " * post_pending) + ", #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [@d_BASE, @d_waitI, @d_INIT, @d_waitW, @d_RU, @d_WORK, @d_RD, @d_waitU, @d_U, @d_FINISH, @d_total, @sub_work_total, @sub_total].map{|x| x.to_s }.join(", ") + ", #{((@d_U + work + @sub_work_total)/(@d_total + @sub_total) * 100).round if (@d_total + @sub_total) > 0}%"
- pre_pending = pre_pending +1
- post_pending = post_pending -1
- result = result + sub_job.map{|x| x.print_cvs pre_pending, post_pending }
- return result
- end
- def print_xml(pre_pending = 1)
- result = []
- result.push "" + ("\t" * pre_pending) + "<testcase classname=\"#{@jtype}\" name=\"#{@id}_#{@project}_#{@supported_os}_total\" time=\"#{@d_total.to_i}\"/>"
- return result
- end
- def print_multi
- puts "#{@t_S.to_s}, #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [ @d_U, @sub_work_total, @d_total, @sub_total].map{|x| x.round.to_s }.join(", ") + ", #{((@d_U + @sub_work_total)/(@d_total + @sub_total) * 100).round if (@d_total + @sub_total) > 0}%"
- end
- def print_single
- puts "#{@t_S.to_s}, #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [@d_WORK, @d_U, @sub_work_total, @d_total, @sub_total].map{|x| x.round.to_s }.join(", ") + ", #{((@d_WORK + @d_U + @sub_work_total)/(@d_total + @sub_total) * 100).round if (@d_total + @sub_total) > 0}%"
- end
- def print_register
- puts "#{@t_S.to_s}, #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [@d_WORK, @sub_work_total, @d_total, @sub_total].map{|x| x.round.to_s }.join(", ") + ", #{((@d_WORK + @sub_work_total)/(@d_total + @sub_total) * 100).round if (@d_total + @sub_total) > 0}%"
- end
-end
-
-def option_parse
- options = {}
- banner = "test"
-
- optparse = OptionParser.new(nil, 32, ' '*8) do |opts|
- opts.banner = banner
- opts.on('-d', '--dsn <database server name>', 'data server name') do |dsn|
- options[:dsn] = dsn
- end
- opts.on('-u', '--user <user name>', 'user name') do |user|
- options[:user] = user
- end
- opts.on('-p', '--password <user password>', 'user password') do |pass|
- options[:pass] = pass
- end
- options[:name] = []
- opts.on('-n', '--name <project name>', 'project name for print seperate by \",\"') do |name|
- options[:name] = name.strip.split(",")
- end
- opts.on('-w', '--where <db where parse>', 'ex) id >= 79000') do |where|
- options[:where] = "WHERE " + where
- end
- opts.on('-c', '--csv <file>', 'save csv file') do |cvs|
- options[:cvs] = cvs
- end
- opts.on('-x', '--xml <file>', 'save xml file') do |xml|
- options[:xml] = xml
- end
- opts.on('-h', '--help', 'print this message') do |help|
- puts "useage: performance_analizer -d \"Mysql:database=<database>;host=<host_ip>;port=<port>\" -u \"<user>\" -p \"<password>\" -w \"start_time >= '2013-07-21'\" -c result.cvs"
- puts opts.help
- exit
- end
- end
- optparse.parse!
- return options
-end
-
-option = option_parse
-
-multiJobs = []
-registerJobs = []
-singleJobs = []
-orphanJobs = []
-
-projects = {}
-supported_os = {}
-distributions = {}
-puts "dsn : #{option[:dsn]}"
-puts "user : #{option[:user]}"
-puts "pass : #{option[:pass]}"
-puts "where : #{option[:where]}"
-conn = DBI.connect "DBI:" + option[:dsn], option[:user], option[:pass]
-
-conn.select_all "SELECT id,name FROM projects ;" do |row|
- projects[row[:id]] = row[:name]
-end
-conn.select_all "SELECT id,name FROM supported_os ;" do |row|
- supported_os[row[:id]] = row[:name]
-end
-conn.select_all "SELECT id,name FROM distributions ;" do |row|
- distributions[row[:id]] = row[:name]
-end
-
-def set_stamp(stamp)
- result = {}
- stamp.each do |x|
- case x[:stamp_name]
- when "INIT_START" then result[:INIT_START] = x[:stamp_time]
- when "INIT_END" then result[:INIT_END] = x[:stamp_time]
- when "WORK_START" then result[:WORK_START] = x[:stamp_time]
- when "REMOTE_UPLOAD_START" then result[:REMOTE_UPLOAD_START] = x[:stamp_time]
- when "REMOTE_UPLOAD_END" then result[:REMOTE_UPLOAD_END] = x[:stamp_time]
- when "REMOTE_DOWNLOAD_START" then result[:REMOTE_DOWNLOAD_START] = x[:stamp_time]
- when "REMOTE_DOWNLOAD_END" then result[:REMOTE_DOWNLOAD_END] = x[:stamp_time]
- when "UPLOAD_START" then result[:UPLOAD_START] = x[:stamp_time]
- when "UPLOAD_END" then result[:UPLOAD_END] = x[:stamp_time]
- end
- puts x
- end
- return result
-end
-puts 'run'
-conn.select_all "SELECT *
-FROM rsa.jobs
-#{option[:where]}
-;" do |row|
- print "."
- r = row.to_h
- conn.select_all("SELECT stamp_name, stamp_time FROM rsa.job_timestamps WHERE job_id = '#{r['id']}'") do |stamp|
- s = stamp.to_h
- r[s['stamp_name'].to_s] = s['stamp_time']
- end
-
- #puts stamp_hash
- new = CommonJob.new(r, projects, supported_os, distributions)
- case r['jtype']
- when "MULTIBUILD" then
- multiJobs.push new
- when "REGISTER"
- registerJobs.push new
- when "BUILD"
- if row['parent_job_id'].nil?
- singleJobs.push new
- else
- set = false
- multiJobs.each do |x|
- if x.id == row['parent_job_id'] then
- new.t_BASE = x.t_S
- x.sub_job.push new
- set = true
- break
- else
- x.sub_job.each do |y|
- if y.id == row['parent_job_id'] then
- new.t_BASE = x.t_S
- y.sub_job.push new
- set = true
- break
- end
- end
- end
- end
- if not set then
- singleJobs.each do |x|
- if x.id == row['parent_job_id'] then
- new.t_BASE = x.t_S
- x.sub_job.push new
- set = true
- break
- end
- end
- end
- if not set then
- registerJobs.each do |x|
- if x.id == row['parent_job_id'] then
- new.t_BASE = x.t_S
- x.sub_job.push new
- set = true
- break
- end
- end
- end
- if not set then
- orphanJobs.each do |x|
- if x.id == row['parent_job_id'] then
- new.t_BASE = x.t_S
- x.sub_job.push new
- set = true
- break
- end
- end
- end
- end
- end
-end
-conn.disconnect if conn
-puts ""
-multiJobs.each do |x|
- x.project = x.sub_job.map{|s| s.project.to_s}.uniq.join(" ")
- x.supported_os = x.sub_job.map{|s| s.supported_os.to_s}.uniq.join(" ")
- x.t_US = x.sub_job.map{|y| y.t_E}.max if x.t_US.nil? and not x.sub_job.map{|y| y.t_E}.include? nil
- x.t_UE = x.t_E if x.t_UE.nil?
- x.gen_duration
-end
-singleJobs.each do |x|
- x.gen_duration
-end
-registerJobs.each do |x|
- x.gen_duration
-end
-
-def name_extractor(jobs, names)
- return jobs if names.empty?
- return jobs.select{|j| (names - j.project.split(" ")).empty? }
-end
-
-if not option[:cvs].nil? then
- File.open(option[:cvs],"w") do |f|
- mjobs = name_extractor(multiJobs,option[:name])
- if not mjobs.empty? then
- f.puts "multi job"
- f.puts "multi, sub, reverse, status, branch, projects, os, start, wait, init, wait, remote upload, work, remote donwload, wait, upload, finish, total, sub work total, sub total, performance (w/t)%"
- mjobs.each do |m|
- f.puts m.print_cvs
- end
- end
- sjobs = name_extractor(singleJobs,option[:name])
- if not sjobs.empty? then
- f.puts "single job"
- f.puts "job, reverse, status, branch, projects, os, start, wait, init, wait, remote upload, work, remote donwload, wait, upload, finish, total, sub work total, sub total, performance (w/t)%"
- sjobs.each do |m|
- f.puts m.print_cvs(0,1)
- end
- end
- rjobs = name_extractor(registerJobs,option[:name])
- if not rjobs.empty? then
- f.puts "register job"
- f.puts "register, reverse, status, branch, projects, os, start, wait, init, wait, remote upload, work, remote donwload, wait, upload, finish, total, sub work total, sub total, performance (w/t)%"
- rjobs.each do |m|
- f.puts m.print_cvs(0,1)
- end
- end
- end
-else
- if not option[:xml].nil? then
- File.open(option[:xml],"w") do |f|
- mjobs = name_extractor(multiJobs,option[:name])
- if not mjobs.empty? then
- f.puts "<testsuite error=\"\" failures=\"\" name=\"Multi Build\" skips=\"\" tests=\"#{mjobs.count}\" time=\"#{(mjobs[-1].t_E - mjobs[0].t_S).to_i}\">"
- mjobs.each do |m|
- f.puts m.print_xml(1)
- end
- f.puts "</testsuite>"
- end
- sjobs = name_extractor(singleJobs,option[:name])
- if not sjobs.empty? then
- f.puts "single job"
- f.puts "job, reverse, status, branch, projects, os, start, wait, init, wait, remote upload, work, remote donwload, wait, upload, finish, total, sub work total, sub total, performance (w/t)%"
- sjobs.each do |m|
- f.puts m.print_xml()
- end
- end
- rjobs = name_extractor(registerJobs,option[:name])
- if not rjobs.empty? then
- f.puts "register job"
- f.puts "register, reverse, status, branch, projects, os, start, wait, init, wait, remote upload, work, remote donwload, wait, upload, finish, total, sub work total, sub total, performance (w/t)%"
- rjobs.each do |m|
- f.puts m.print_xml()
- end
- end
- end
- else
- mjobs = name_extractor(multiJobs,option[:name])
- if not mjobs.empty? then
- puts "multi job"
- puts "time, status, branch, project, os, upload, sub_work, total, sub_total, (upload + sub_work)/(total + sub_total)%"
- mjobs.each do |m|
- m.print_multi
- end
- end
-
- sjobs = name_extractor(singleJobs,option[:name])
- if not sjobs.empty? then
- puts "single job"
- puts "time, status, branch, project, os, work, upload, sub_work, total, sub_total, (work + upload + sub_work)/(total + sub_total)%"
- sjobs.each do |s|
- s.print_single
- end
- end
-
- rjobs = name_extractor(registerJobs,option[:name])
- if not rjobs.empty? then
- puts "register job"
- puts "time, status, branch, project, os, upload, sub_work, total, sub_total, (upload + sub_work)/(total + sub_total)%"
- rjobs.each do |r|
- r.print_register
- end
- end
- end
-end
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p base-ide-product -u http://172.21.111.132/testserver3/unstable -l pkgcli01
-../pkg-cli check-upgrade -l pkgcli01 -u http://172.21.111.132/testserver2/unstable
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-"base-ide-product" package : 0.20.8 ->
-Info: Checked packages for upgrading.. OK
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p nativeapp-eplugin -u http://172.21.111.132/testserver3/unstable -t -l pkgcli01
-../pkg-cli clean -l pkgcli01 -f
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-Info: There is no any package.
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli download -p nativeapp-eplugin -u http://172.21.111.132/testserver3/unstable -t -l pkgcli01
-ls pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-base-ide-product_0.20.8_linux.zip
-common-eplugin_0.20.6_linux.zip
-nativeapp-eplugin_0.20.4_linux.zip
-nativecommon-eplugin_0.20.1_linux.zip
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-cd pkgcli01; ../../pkg-cli download -p base-ide-product -u http://172.21.111.132/testserver3/unstable
-ls pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-base-ide-product_1.0.2_linux.zip
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p base-ide-product -u http://172.21.111.132/testserver2/unstable -l pkgcli01
-../pkg-cli install -p base-ide-product -u http://172.21.111.132/testserver3/unstable -l pkgcli01 -f
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-base-ide-product (0.20.8)
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p nativeapp-eplugin -u http://172.21.111.132/testserver3/unstable -t -l pkgcli01
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-base-ide-product (0.20.8)
-common-eplugin (0.20.6)
-nativeapp-eplugin (0.20.4)
-nativecommon-eplugin (0.20.1)
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p base-ide-product -u http://172.21.111.132/testserver3/unstable -l pkgcli01
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-base-ide-product (0.20.8)
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p base-ide-product -u http://172.21.111.132/testserver2/unstable -l pkgcli01
-../pkg-cli download -p base-ide-product -u http://172.21.111.132/testserver3/unstable
-../pkg-cli install-file -p base-ide-product_0.20.8_linux.zip -l pkgcli01 -f
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -f base-ide-product_0.20.8_linux.zip
-rm -rf pkgcli01
-#EXPECT
-base-ide-product (0.20.8)
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli download -p base-ide-product -u http://172.21.111.132/testserver3/unstable
-../pkg-cli install-file -p base-ide-product_0.20.8_linux.zip -l pkgcli01
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -f base-ide-product_0.20.8_linux.zip
-rm -rf pkgcli01
-#EXPECT
-base-ide-product (0.20.8)
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p base-ide-product -u http://172.21.111.132/testserver3/unstable -l pkgcli01
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-base-ide-product (0.20.8)
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-cli list-rpkg -u http://172.21.111.132/testserver3/unstable
-#POST-EXEC
-#EXPECT
-base-ide-product (1.0.2)
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p base-ide-product -u http://172.21.111.132/testserver3/unstable -l pkgcli01
-../pkg-cli show-lpkg -p base-ide-product -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-Package : base-ide-product
-Version : 0.20.8
-OS : linux
+++ /dev/null
-#PRE-EXEC
-#EXEC
-../pkg-cli show-rpkg -p base-ide-product -u http://172.21.111.132/testserver3/unstable
-#POST-EXEC
-#EXPECT
-Package : base-ide-product
-Version : 1.0.2
-OS : linux
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-cd pkgcli01; ../../pkg-cli source -p base-ide-product -u http://172.21.111.132/testserver3/unstable
-ls pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-product_0.20.8.tar.gz
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p nativeapp-eplugin -u http://172.21.111.132/testserver3/unstable -l pkgcli01 -t
-../pkg-cli uninstall -p base-ide-product -l pkgcli01 -t
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-Info: There is no any package.
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p base-ide-product - http://172.21.111.132/testserver3/unstable -l pkgcli01
-../pkg-cli uninstall -p base-ide-product -l pkgcli01
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-Info: There is no any package.
+++ /dev/null
-#PRE-EXEC
-rm -rf pkgcli01
-mkdir pkgcli01
-#EXEC
-../pkg-cli install -p base-ide-product -u http://172.21.111.132/testserver3/unstable -l pkgcli01
-../pkg-cli upgrade -l pkgcli01 -u http://172.21.111.132/testserver2/unstable
-../pkg-cli list-lpkg -l pkgcli01
-#POST-EXEC
-rm -rf pkgcli01
-#EXPECT
-base-ide-product (0.20.14)
+++ /dev/null
-pkg-cli-listrpkg.testcase
-pkg-cli-showrpkg.testcase
-pkg-cli-download.testcase
-pkg-cli-download-t.testcase
-pkg-cli-source.testcase
-pkg-cli-install.testcase
-pkg-cli-install-t.testcase
-pkg-cli-install-f.testcase
-pkg-cli-uninstall.testcase
-pkg-cli-uninstall-t.testcase
-pkg-cli-installfile.testcase
-pkg-cli-installfile-f.testcase
-pkg-cli-listlpkg.testcase
-pkg-cli-showlpkg.testcase
-pkg-cli-checkupgrade.testcase
-pkg-cli-upgrade.testcase
-pkg-cli-clean-f.testcase
+++ /dev/null
-Source : Origin
-Version : 0.1.0
-Maintainer : taejun.ha <tajun.ha@samsung.com>
-
-Package : A
-OS : linux
-C-test : test
-Build-host-os :linux | windows | darwin
-Path : binary/A_0.1.0_linux.zip
-C-commic : ask
-Origin : remote
-C-origin : kkk
-Description : this is my first
-script
-#Changes : kkk
-#sa;ldfkj
-#alsdkfj
-#lsdkfj
-
-Package: B
-OS : linux
-Build-host-os :linux | windows | darwin
-Install-dependency : C, D, E
-Build-dependency : F (>= 1.0.0.20101221), E (>= 1.0.0.20101221)
-Source-dependency : D, scratchbox-aquila-simulator-rootstrap [ linux |windows ](>= 1.0.0.20101221), scratchbox-core [windows|darwin](>= 1.0.17)
-Path :
-SHA256 : your_checksum
-Description : this is my first
-script
-C-kim : oks
-Change-log :
-* 0.1.0
-test
- ttkk
-* 1.0.8
-Add change log function
- pkginfo.manifest include "change log" section
-* 1.0.7
-dibs document change
- you can read dibs documents in ubuntu using PDF readeranges
+++ /dev/null
-Include : pkg-list
-
-Package : A
-OS : windows
-Build-host-os :linux | windows | darwin
-Path : binary/A_0.1.0_linux.zip
-Origin : remote
-
-Package: B
-OS : windows
-Build-host-os :linux | windows | darwin
-Install-dependency : C, D, E
-Build-dependency : F (>= 1.0.0.20101221), E (>= 1.0.0.20101221)
-Source-dependency : D, scratchbox-aquila-simulator-rootstrap [ linux |windows ](>= 1.0.0.20101221), scratchbox-core [windows|darwin](>= 1.0.17)
-Path :
-SHA256 : your_checksum
-Description : this is my first
+++ /dev/null
-Package : your_package
-Version : your_version
-OS : linux
-Build-host-os:linux | windows | darwin
-Maintainer : your_name <name@domain> name <name@domain>
-Install-dependency : codecoverage, rootstrap-slp-device-1.0, slp-ide
-Build-dependency : scratchbox-aquila-device-rootstrap (>= 1.0.0.20101221), scratchbox-aquila-simulator-rootstrap (>= 1.0.0.20101221), scratchbox-core (>= 1.0.17)
-#Build-src-dependency : scratchbox-aquila-device-rootstrap (>= 1.0.0.20101221) [linux|windows], scratchbox-aquila-simulator-rootstrap [ linux |windows ](>= 1.0.0.20101221), scratchbox-core [windows|darwin](>= 1.0.17)
-Description : this is my first
-project that
-is my
-preciuse
-project :
-descriotion :
-Attribute :
-#Install-script :
-#Remove-script :
-#Category :
-Conflicts :
-Source : origin
-
-Package : your_package
-Version : your_version
-OS : windows
-Build-host-os:linux | windows | darwin
-Maintainer : your_name <name@domain> name <name@domain>
-Install-dependency : codecoverage, rootstrap-slp-device-1.0, slp-ide
-Build-dependency : scratchbox-aquila-device-rootstrap (>= 1.0.0.20101221), scratchbox-aquila-simulator-rootstrap (>= 1.0.0.20101221), scratchbox-core (>= 1.0.17)
-Source-dependency : scratchbox-aquila-simulator-rootstrap [ linux |windows ](>= 1.0.0.20101221), scratchbox-core [windows|darwin](>= 1.0.17)
-Description : this is my first
-hello
-project
-project :
-descriotion :
-Attribute :
-C-ategory :
-#Install-script :
-#Remove-script :
-Conflicts :
-Source : origin
+++ /dev/null
-#!/bin/sh
-rm -rf ~/.build_tools/pkg_server/pkgsvr02
-rm -rf `pwd`/pkgsvr02
-ruby -d ../pkg-svr create -n pkgsvr02 -d unstable
-ruby -d ../pkg-svr add-os -n pkgsvr02 -d unstable -o ubuntu-32
-ruby -d ../pkg-svr add-os -n pkgsvr02 -d unstable -o windows-32
-ruby -d ../pkg-svr start -n pkgsvr02 -p 4444
+++ /dev/null
-#!/usr/bin/ruby
-$success_cases=[]
-$failure_cases=[]
-$testcases=[]
-
-$total_cnt = 0
-
-testCaseName = ""
-resultCheck = ""
-resultFlag = ""
-resultCmdCount = 0
-
-
-class TestCase
- attr_accessor :name, :pre_exec_cmds, :exec_cmds, :post_exec_cmds, :expected_results
- def initialize(name)
- @name = name
- @pre_exec_cmds = []
- @exec_cmds = []
- @post_exec_cmds = []
- @expected_results = []
- end
-
- def is_succeeded?(results)
- i = 0
- @expected_results.each do |e|
- found = false
- if results[i].nil? then
- return false
- end
- if not results[i].include? e then
- return false
- end
- i += 1
- end
-
- return true
- end
-end
-
-
-# parse
-def parse_testcase(file_name)
- # create
- tcase = TestCase.new( file_name )
-
- # parse
- File.open(file_name,"r") do |f|
- status="START"
- f.each_line do |l|
- ln = l.strip
- if ln == "#PRE-EXEC" or ln == "#EXEC" or
- ln == "#POST-EXEC" or ln == "#EXPECT" then
-
- status = ln
- else
- case status
- when "#PRE-EXEC"
- tcase.pre_exec_cmds.push ln
- when "#EXEC"
- tcase.exec_cmds.push ln
- when "#POST-EXEC"
- tcase.post_exec_cmds.push ln
- when "#EXPECT"
- tcase.expected_results.push ln
- else
- # ignore
- end
- end
- end
- end
-
- return tcase
-end
-
-
-# test execution
-def execute( file_name )
- printf("#{file_name} ... ")
- STDOUT.flush
-
- # parse
- tcase = parse_testcase( file_name )
-
- # pre-exec
- tcase.pre_exec_cmds.each do |cmd|
- fork_p = false
- if cmd[-1,1] == "&" then
- cmd = cmd[0..-2]
- fork_p = true
- end
-
- # get result
- if not fork_p then
- IO.popen("#{cmd} 2>&1") { |io|
- # io.each do |line|
- # puts "---> #{line}"
- # end
- }
- else
- IO.popen("#{cmd} 2>&1 &") { |io|
- # io.each do |line|
- # puts "---> #{line}"
- # end
- }
- end
- #`#{cmd}`
- end
-
- # exec
- results = []
- tcase.exec_cmds.each do |cmd|
- fork_p = false
- hidden_p = false
- if cmd[-1,1] == "&" then
- cmd = cmd[0..-2]
- fork_p = true
- end
- if cmd[0,1] == ">" then
- cmd = cmd[1..-1]
- hidden_p = true
- end
- # get result
- if fork_p then
- IO.popen("#{cmd} 2>&1 &") { |io|
- io.each do |line|
- if not hidden_p then
- results.push line.strip
- #puts "---> #{line}"
- end
- end
- }
- else
- IO.popen("#{cmd} 2>&1") { |io|
- io.each do |line|
- if not hidden_p then
- results.push line.strip
- #puts "---> #{line}"
- end
- end
- }
- end
- end
-
- # check expected result
- if tcase.is_succeeded?(results) then
- puts "SUCCESS"
- $success_cases.push file_name
- else
- puts "FAIL"
- $failure_cases.push file_name
- results.each do |l|
- puts ">" + l
- end
- end
-
- # post-exec
- tcase.post_exec_cmds.each do |cmd|
- # get result
- IO.popen("#{cmd} 2>&1") { |io|
- }
- #`#{cmd}`
- end
-end
-
-
-#test_list file open
-if (ARGV.size() == 0)
- testsuite_name = "list.txt"
-else
- testsuite_name = ARGV.shift
-end
-
-# execute testsuite
-puts
-puts "Regression Test Start "
-puts "=================================="
-
-File.open( testsuite_name ) do |f|
- f.each_line do |line|
- $testcases.push("#{line.strip}")
- execute(line.strip)
- end
-end
-
-# print result
-puts
-puts "Regression Test Result"
-puts "----------------------"
-puts "Total Test Case : #{$testcases.count}"
-puts "Test Success : #{$success_cases.count}"
-puts "Test Errors : #{$failure_cases.count}"
-puts
-
-if $failure_cases.count != 0 then
- puts "Test Fail Files"
- puts "---------------"
- $failure_cases.each do |name|
- puts name
- end
- puts
-end
-
+++ /dev/null
-#!/usr/bin/ruby
-
-=begin
-
- statistics
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'time'
-require 'optparse'
-require 'dbi'
-
-class CommonJob
- attr_accessor :id, :project, :user, :supported_os, :distribution, :parent_job, :remote_build_server, :jtype, :status, :user_group
- attr_accessor :t_BASE, :t_S, :t_IS, :t_IE, :t_WS, :t_RUS, :t_RUE, :t_RDS, :t_RDE, :t_US, :t_UE, :t_E, :p_d, :p_w, :p_m
- attr_accessor :d_BASE, :d_waitI, :d_INIT, :d_waitW, :d_RU, :d_WORK, :d_RD, :d_waitU, :d_U, :d_FINISH, :d_total, :sub_total, :sub_work_total
- attr_accessor :sub_job
- def initialize(option, projects, supported_os, distributions, groups)
- @id = option[:id]
- @project = projects[option[:project_id]]
- @supported_os = supported_os[option[:supported_os_id]]
- @distribution = distributions[option[:distribution_id]]
- @user_group = groups[option[:user_id]]
- @parent_job = option[:parent_job]
- @remote_build_server = option[:remote_build_server]
- @jtype = option[:jtype]
- @status = option[:status]
- #set time stamp
- @t_BASE = nil
- t = Time.now
- offset = t.getlocal.gmt_offset
- @t_S = option[:start_time].to_time - offset if not option[:start_time].nil?
- @p_d = @t_S.strftime("%y-%m-%d day") if not @t_S.nil?
- @p_w = @t_S.strftime("%y-%W week") if not @t_S.nil?
- @p_m = @t_S.strftime("%y-%m month") if not @t_S.nil?
- @t_E = option[:end_time].to_time - offset if not option[:end_time].nil?
- @sub_job = []
- @d_BASE = 0
- @d_waitI = 0
- @d_INIT = 0
- @d_waitW = 0
- @d_RU = 0
- @d_RD = 0
- @d_U = 0
- @d_waitU = 0
- @d_WORK = 0
- @d_FINISH = 0
- @d_total = 0
- @sub_total = 0
- @sub_work_total = 0
- end
- def print_csv(pre_pending = 0, post_pending = 2)
- result = []
- work = 0
- work = @d_WORK if @jtype != "MULTIBUILD"
- result.push (", " * pre_pending) + @id.to_s + (", " * post_pending) + ", #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [@d_BASE, @d_waitI, @d_INIT, @d_waitW, @d_RU, @d_WORK, @d_RD, @d_waitU, @d_U, @d_FINISH, @d_total, @sub_work_total, @sub_total].map{|x| x.to_s }.join(", ") + ", #{((@d_U + work + @sub_work_total)/(@d_total + @sub_total) * 100).round 2 if (@d_total + @sub_total) > 0}%"
- pre_pending = pre_pending +1
- post_pending = post_pending -1
- result = result + sub_job.map{|x| x.print_csv pre_pending, post_pending }
- return result
- end
- def print_multi
- puts "#{@t_S.to_s}, #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [ @d_U, @sub_work_total, @d_total, @sub_total].map{|x| x.round.to_s }.join(", ") + ", #{((@d_U + @sub_work_total)/(@d_total + @sub_total) * 100).round 2 if (@d_total + @sub_total) > 0}%"
- end
- def print_single
- puts "#{@t_S.to_s}, #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [@d_WORK, @d_U, @sub_work_total, @d_total, @sub_total].map{|x| x.round.to_s }.join(", ") + ", #{((@d_WORK + @d_U + @sub_work_total)/(@d_total + @sub_total) * 100).round 2 if (@d_total + @sub_total) > 0}%"
- end
- def print_register
- puts "#{@t_S.to_s}, #{@status.to_s}, #{@distribution.to_s}, #{@project.to_s}, #{@supported_os.to_s}, " + [@d_WORK, @sub_work_total, @d_total, @sub_total].map{|x| x.round.to_s }.join(", ") + ", #{((@d_WORK + @sub_work_total)/(@d_total + @sub_total) * 100).round 2 if (@d_total + @sub_total) > 0}%"
- end
-end
-
-def option_parse
- options = {}
- banner = "test"
-
- optparse = OptionParser.new(nil, 32, ' '*8) do |opts|
- opts.banner = banner
- options[:statistics] = false
- opts.on('-s', '--statistics <level>', 'statistics') do |slv|
- options[:statistics] = true
- options[:slv] = slv
- end
- options[:period] = "d"
- opts.on('-P', '--period <period>', 'd/w/m(day/week/month)') do |period|
- if period.strip == "w" or period.strip == "d" or period.strip == "m" then
- options[:period] = period.strip
- else
- puts "ERROR period #{period} is not supported! use d/w/m"
- exit
- end
- end
- opts.on('-d', '--dsn <database server name>', 'data server name') do |dsn|
- options[:dsn] = dsn
- end
- opts.on('-u', '--user <user name>', 'user name') do |name|
- options[:name] = name
- end
- opts.on('-p', '--password <user password>', 'user password') do |pass|
- options[:pass] = pass
- end
- opts.on('-w', '--where <db where parse>', 'ex) id >= 79000') do |where|
- options[:where] = "WHERE " + where
- end
- opts.on('-c', '--csv <file>', 'save csv file') do |csv|
- options[:csv] = csv
- end
- opts.on('-h', '--help', 'print this message') do |help|
- puts "useage: performance_analizer -d \"Mysql:database=<database>;host=<host ip>;port=<port>\" -u \"<user>\" -p \"<password>\" -w \"start_time >= '2013-07-21'\" -c result.csv"
- puts opts.help
- exit
- end
- end
- optparse.parse!
- return options
-end
-
-option = option_parse
-
-multiJobs = []
-registerJobs = []
-singleJobs = []
-orphanJobs = []
-
-projects = {}
-supported_os = {}
-distributions = {}
-groups = {}
-conn = DBI.connect "DBI:" + option[:dsn], option[:name], option[:pass]
-
-conn.select_all "SELECT id,name FROM projects ;" do |row|
- projects[row[:id]] = row[:name]
-end
-conn.select_all "SELECT id,name FROM supported_os ;" do |row|
- supported_os[row[:id]] = row[:name]
-end
-conn.select_all "SELECT id,name FROM distributions ;" do |row|
- distributions[row[:id]] = row[:name]
-end
-conn.select_all "SELECT user_groups.user_id,groups.name FROM user_groups, groups WHERE user_groups.group_id = groups.id;" do |row|
- groups[row[:user_id]] = row[:name]
- #puts "#{row[:user_id]} => #{row[:name]}"
-end
-
-conn.select_all "SELECT *
-FROM rsa.jobs
-#{option[:where]}
-;" do |row|
- new = CommonJob.new(row, projects, supported_os, distributions, groups)
- case row[:jtype]
- when "MULTIBUILD" then
- multiJobs.push new
- when "REGISTER"
- registerJobs.push new
- when "BUILD"
- if row[:parent_job_id].nil?
- singleJobs.push new
- else
- set = false
- multiJobs.each do |x|
- if x.id == row[:parent_job_id] then
- x.sub_job.push new
- set = true
- break
- else
- x.sub_job.each do |y|
- if y.id == row[:parent_job_id] then
- y.sub_job.push new
- set = true
- break
- end
- end
- end
- end
- if not set then
- singleJobs.each do |x|
- if x.id == row[:parent_job_id] then
- x.sub_job.push new
- set = true
- break
- end
- end
- end
- if not set then
- registerJobs.each do |x|
- if x.id == row[:parent_job_id] then
- x.sub_job.push new
- set = true
- break
- end
- end
- end
- if not set then
- orphanJobs.each do |x|
- if x.id == row[:parent_job_id] then
- x.sub_job.push new
- set = true
- break
- end
- end
- end
- end
- end
-end
-
-multiJobs.each do |x|
- x.project = x.sub_job.map{|s| s.project.to_s}.uniq.join(" ")
- x.supported_os = x.sub_job.map{|s| s.supported_os.to_s}.uniq.join(" ")
-end
-def print_array(job_array, lvl, period)
- case period
- when "m" then periods = job_array.map{|x| x.p_m }.uniq
- when "w" then periods = job_array.map{|x| x.p_w }.uniq
- when "d" then periods = job_array.map{|x| x.p_d }.uniq
- end
- periods.each do |p|
- case period
- when "m" then period_job = job_array.select{|x| x.p_m.eql? p }
- when "w" then period_job = job_array.select{|x| x.p_w.eql? p }
- when "d" then period_job = job_array.select{|x| x.p_d.eql? p }
- end
- puts " #{p}: success #{period_job.select{|j| j.status.to_s == "FINISHED"}.count}, fail #{period_job.select{|j| j.status.to_s != "FINISHED"}.count}"
- if lvl != 1.to_s then
- period_job.map{|x| x.user_group}.uniq.each do |u|
- group_job= period_job.select{|j| j.user_group.to_s.eql? u}
- puts " #{u}: success #{group_job.select{|j| j.status.to_s == "FINISHED"}.count}, fail #{group_job.select{|j| j.status.to_s != "FINISHED"}.count}"
- if lvl != 2.to_s then
- group_job.map{|x| "#{x.project}"}.uniq.each do |p|
- project_job = group_job.select{|j| j.project == p}
- puts " #{p}: success #{project_job.select{|j| j.status.to_s == "FINISHED"}.count}, fail #{project_job.select{|j| j.status.to_s != "FINISHED"}.count}"
- end
- puts ""
- end
- end
- puts ""
- end
- end
-end
-
-def print_csv(job_array, period, csv, message)
- case period
- when "m" then periods = job_array.map{|x| x.p_m }.uniq
- when "w" then periods = job_array.map{|x| x.p_w }.uniq
- when "d" then periods = job_array.map{|x| x.p_d }.uniq
- end
- File.open(csv, "a+") do |f|
- case period
- when "m" then pe = 'month'
- when "w" then pe = 'week'
- when "d" then pe = 'day'
- end
- f.puts "message"
- f.puts "#{pe}, group, projects, success, fail"
- periods.each do |p|
- case period
- when "m" then period_job = job_array.select{|x| x.p_m.eql? p }
- when "w" then period_job = job_array.select{|x| x.p_w.eql? p }
- when "d" then period_job = job_array.select{|x| x.p_d.eql? p }
- end
- f.puts "#{p},,,#{period_job.select{|j| j.status.to_s == "FINISHED"}.count},#{period_job.select{|j| j.status.to_s != "FINISHED"}.count}"
- period_job.map{|x| x.user_group}.uniq.each do |u|
- group_job= period_job.select{|j| j.user_group.to_s.eql? u}
- f.puts "#{p},#{u},,#{group_job.select{|j| j.status.to_s == "FINISHED"}.count},#{group_job.select{|j| j.status.to_s != "FINISHED"}.count}"
- group_job.map{|x| "#{x.project}"}.uniq.each do |pro|
- project_job = group_job.select{|j| j.project == pro}
- f.puts "#{p},#{u},#{pro},#{project_job.select{|j| j.status.to_s == "FINISHED"}.count},#{project_job.select{|j| j.status.to_s != "FINISHED"}.count}"
- end
- end
- end
- end
-end
-
-if option[:csv].nil? or option[:csv].empty? then
- puts 'Multi build jobs'
- print_array(multiJobs, option[:slv], option[:period])
- puts 'Single build jobs'
- print_array(singleJobs, option[:slv], option[:period])
- puts 'Register build jobs'
- print_array(registerJobs, option[:slv], option[:period])
-else
- print_csv(multiJobs, option[:period], option[:csv], "Multi build jobs")
- print_csv(singleJobs, option[:period], option[:csv], "Single build jobs")
- print_csv(registerJobs, option[:period], option[:csv], "Register build jobs")
-end
+++ /dev/null
-#!/bin/sh
-./regression.rb pkg-cli.testsuite
-./regression.rb packageserver.testsuite
-./regression.rb buildserver.testsuite
-./regression.rb buildcli.testsuite
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/common/utils"
-require File.dirname(__FILE__) + "/../src/build_server/BuildServerController"
-$SERVER_CONFIG_ROOT = Utils::HOME + "/.tizen_build_server"
-
-BuildServerController.remove_server("mbs_server_temp")
-BuildServerController.create_server("mbs_server_temp", Utils::WORKING_DIR, "http://172.21.111.132/pkgserver/unstable","pkgserver","pkgserver")
-BuildServerController.add_friend_server("mbs_server_temp", "172.21.111.177", 2222)
-=begin
-#case ARGV[0]
-# when "create" then
-# pkg_server.create "temp", "unstable", "http://172.21.111.132/pkgserver/", "unstable"
-# when "register" then
-# #pkg_server.register "/home/taejun/project/sdk-build/test/smart-build-interface_0.19.1_linux.zip", "unstable", "-g"
-# pkg_server.register "/home/taejun/project/sdk-build/test/smart-build-interface_0.19.1_linux.zip", "unstable", ""
-# when "snapshot" then
- pkg_server.snapshot_generate "", "unstable", "", "", ""
- when "sync" then
- # pkg_server.sync "unstable", "force"
- pkg_server.sync "unstable", ""
- when "add_distribution" then
- pkg_server.add_distribution "test_stable", "stable"
- else
- puts "First input error : #{ARGV[0]}"
-end
-=end
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/common/utils"
-require File.dirname(__FILE__) + "/../src/build_server/BuildServerController"
-$SERVER_CONFIG_ROOT = Utils::HOME + "/.tizen_build_server"
-
-File.open("#{$SERVER_CONFIG_ROOT}/temp/.request","w") do |f|
- f.puts("GIT,gerrithost:/slp/sdk/public/native/toolchain/smart-build-interface,master,linux")
- f.puts("GIT,gerrithost:/slp/sdk/public/native/toolchain/sbi-slp-public-plugin,master,linux")
-end
-=begin
-#case ARGV[0]
-# when "create" then
-# pkg_server.create "temp", "unstable", "http://172.21.111.132/pkgserver/", "unstable"
-# when "register" then
-# #pkg_server.register "/home/taejun/project/sdk-build/test/smart-build-interface_0.19.1_linux.zip", "unstable", "-g"
-# pkg_server.register "/home/taejun/project/sdk-build/test/smart-build-interface_0.19.1_linux.zip", "unstable", ""
-# when "snapshot" then
- pkg_server.snapshot_generate "", "unstable", "", "", ""
- when "sync" then
- # pkg_server.sync "unstable", "force"
- pkg_server.sync "unstable", ""
- when "add_distribution" then
- pkg_server.add_distribution "test_stable", "stable"
- else
- puts "First input error : #{ARGV[0]}"
-end
-=end
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/common/utils"
-require File.dirname(__FILE__) + "/../src/build_server/BuildServerController"
-$SERVER_CONFIG_ROOT = Utils::HOME + "/.build_tools/build_server"
-$BUILD_SERVER_HOST_OS = "linux"
-
-obj=BuildServerController.get_server("mbs_server_temp")
-puts obj.friend_servers[0].id
-BuildServerController.start_server("mbs_server_temp")
-=begin
-#case ARGV[0]
-# when "create" then
-# pkg_server.create "temp", "unstable", "http://172.21.111.132/pkgserver/", "unstable"
-# when "register" then
-# #pkg_server.register "/home/taejun/project/sdk-build/test/smart-build-interface_0.19.1_linux.zip", "unstable", "-g"
-# pkg_server.register "/home/taejun/project/sdk-build/test/smart-build-interface_0.19.1_linux.zip", "unstable", ""
-# when "snapshot" then
- pkg_server.snapshot_generate "", "unstable", "", "", ""
- when "sync" then
- # pkg_server.sync "unstable", "force"
- pkg_server.sync "unstable", ""
- when "add_distribution" then
- pkg_server.add_distribution "test_stable", "stable"
- else
- puts "First input error : #{ARGV[0]}"
-end
-=end
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/common/utils"
-require File.dirname(__FILE__) + "/../src/build_server/BuildServerController"
-$SERVER_CONFIG_ROOT = Utils::HOME + "/.tizen_build_server"
-$BUILD_SERVER_HOST_OS = "linux"
-
-obj=BuildServerController.get_server("temp")
-File.open("#{$SERVER_CONFIG_ROOT}/temp/.request","w") do |f|
-# f.puts("LOCAL,/home/bluleo78/git/sbi-slp-public-plugin/toolchains/public/gdb_build,linux,/home/bluleo78/test/test/unstable")
-end
-BuildServerController.start_server("temp")
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/pkg_server/client"
-require File.dirname(__FILE__) + "/../src/pkg_server/serverConfig"
-
-### Client.create("server","dist","snapshot","location")
-
-# local server
-#cl = Client.create("/home/yangttak/test-packageserver")
-
-# remote server
-cl = Client.create("http://172.21.111.132/pkgserver/unstable", "/home/yangttak/build_root")
-#cl.update()
-result = cl.get_install_dependent_packages("cross-arm-gcc-4.5", "linux", true)
-puts "----"
-puts result
-
-result = cl.get_install_dependent_packages("cross-arm-gcc-4.5", "linux", false)
-puts "----"
-puts result
-
-result = cl.get_build_dependent_packages("tizen-image-creator", "linux", true)
-puts "----"
-puts result
-#cl.upload("pkgserver", "first", "unstable", nil, "/home/yangttak/test0208/sdk-build/test/test_downloader.rb")
-#cl.install_local_pkg("/home/yangttak/test0208/sdk-build/smart-build-interface_0.20.0_linux.zip", "linux")
-#cl.show_pkg_info("tizen-ide", "linux")
-
-#cl = Client.create("http://172.21.111.132/pkgserver/unstable/snapshot/snapshot3-linux", "/tmp/client-test")
-#cl.update()
-#result = cl.get_install_dependent_packages("smart-build-interface", "linux")
-#puts result
-
-# if location is nil
-#cl = Client.create("http://172.21.111.132/pkgserver/unstable", nil)
-
-# if server addr is nil
-#cl = Client.create(nil, "/tmp/client-test")
-
-# install package list
-#cl.download("base-toolchain", "windows")
-
-# test install different veriosn package
-#cl = Client.create("http://172.21.111.132/pkgserver/unstable/snapshot/snapshot2-linux", "/tmp/client-test")
-#cl.install("tizen-ide", "linux")
-#cl.install("smart-build-interface", "linux")
-
-
-#cl = Client.create("http://172.21.111.132/pkgserver/unstable", "/tmp/client-test")
-#result = cl.get_build_dependent_packages("mpfr", "linux")
-#puts result
-#result = cl.get_install_dependent_packages("arm-linux-gnueabi-gdb-7.2", "linux")
-#puts result
-#result = cl.get_install_dependent_packages("smart-build-interface", "linux")
-#puts result
-
-
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/pkg_server/downloader"
-require File.dirname(__FILE__) + "/../src/pkg_server/serverConfig"
-
-### FileDownLoader.download(source url, target path)
-
-# download local package
-# FileDownLoader.download("/home/yangttak/gmp-5.0.1.tar.gz", ".")
-
-# download remote package
-FileDownLoader.download("http://172.21.111.132/pkgserver/unstable/source/gmp-5.0.1.tar.gz", $download_temp)
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/pkg_server/downloader"
-require File.dirname(__FILE__) + "/../src/pkg_server/installer"
-require File.dirname(__FILE__) + "/../src/pkg_server/serverConfig"
-
-FileDownLoader.download("http://172.21.111.132/pkgserver/unstable/source/gmp-5.0.1.tar.gz", $download_temp)
-
-### FileInstaller.install(package_name, source_file_path, package_type, target_path)
-FileInstaller.install("gmp","#{$download_temp}/gmp-5.0.1.tar.gz", "binary", $build_root)
+++ /dev/null
-#!/usr/bin/ruby
-require '../src/common/parser'
-require '../src/common/package'
-
-alist = Parser.read_multy_pkginfo_from "pkg-list"
-alist.each do |l|
- l.print
- puts l.change_log_string
- puts ""
-end
+++ /dev/null
-#!/bin/sh
-
-echo "============ remove 1 =============="
-../pkg-svr remove -n temp_local --force
-echo "============ remove 2 =============="
-../pkg-svr remove -n temp_remote --force
-echo "============ remove 3 =============="
-../pkg-svr remove -n temp_remote_dup --force
-echo "============ remove 4 =============="
-../pkg-svr remove -n temp_remote_snap --force
-echo "============ create 1 =============="
-../pkg-svr create -n temp_local -d unstable
-echo "============ create 2 =============="
-../pkg-svr create -n temp_remote -d unstable -u http://172.21.17.55/private/develop
-echo "============ create 3 =============="
-../pkg-svr create -n temp_remote_dup -d unstable -u temp_local/unstable
-echo "============ add dist 1 =============="
-../pkg-svr add-dist -n temp_local -d stable
-echo "============ sync 1 =============="
-../pkg-svr sync -n temp_remote -d unstable
-echo "============ sync 2 =============="
-../pkg-svr sync -n temp_remote_dup -d unstable --force
-echo "============ gen snapshot 1 =============="
-../pkg-svr gen-snapshot -n temp_remote
-echo "============ gen snapshot 2 =============="
-../pkg-svr gen-snapshot -n temp_remote -d unstable
-echo "============ gen snapshot 3 =============="
-../pkg-svr gen-snapshot -n temp_remote -d unstable -s test
-echo "============ gen snapshot 4 =============="
-../pkg-svr gen-snapshot -n temp_remote -d unstable -s test2 -b test
-echo "============ gen snapshot 5 =============="
-../pkg-svr gen-snapshot -n temp_remote -d unstable -o linux
-echo "============ gen snapshot 6 =============="
-../pkg-svr gen-snapshot -n temp_remote -d unstable -o windows
-echo "============ gen snapshot 7 =============="
-../pkg-svr gen-snapshot -n temp_remote -d unstable -o darwin
-echo "============ gen snapshot 8 =============="
-../pkg-svr gen-snapshot -n temp_remote -d unstable -o all
-echo "============ gen snapshot 9 =============="
-../pkg-svr gen-snapshot -n temp_remote -d unstable -o all -P test_server_pkg_file/smart-build-interface_1.20.1_linux.zip -s test3
-echo "============ create 4 =============="
-../pkg-svr create -n temp_remote_snap -d unstable -u temp_remote/unstable/snapshots/test
-echo "============ register 1 =============="
-cp test_server_pkg_file/smart-build-interface_*_linux.zip ./
-../pkg-svr register -n temp_local -d unstable -P smart-build-interface_1.20.1_linux.zip
-echo "============ register 2 =============="
-cp test_server_pkg_file/smart-build-interface_*_linux.zip ./
-../pkg-svr register -n temp_remote -d unstable -P smart-build-interface_1.20.1_linux.zip --gen
-echo "============ register 3 =============="
-cp test_server_pkg_file/smart-build-interface_*_linux.zip ./
-../pkg-svr register -n temp_remote_dup -d unstable -P smart-build-interface_1.20.1_linux.zip --gen --test
-echo "============ register 4 =============="
-cp test_server_pkg_file/archive.zip ./
-../pkg-svr register -n temp_local -d unstable -A archive.zip
-echo "============ remove 3 =============="
-../pkg-svr remove-pkg -n temp_local -d unstable -P smart-build-interface
-echo "============ clean 1 =============="
-../pkg-svr clean -n temp_local -d unstable
-echo "============ clean 2 =============="
-../pkg-svr clean -n temp_remote -d unstable -s test,test2,test3
-echo "============ list 1 =============="
-../pkg-svr list
-echo "============ list 2 =============="
-../pkg-svr list -n temp_local
-#../pkg-svr remove -n temp
-
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/common/utils"
-require File.dirname(__FILE__) + "/../src/pkg_server/packageServer"
-
-pkg_server = PackageServer.new "temp"
-
-case ARGV[0]
- when "create" then
- pkg_server.create "temp", "unstable", "http://172.21.111.132/pkgserver/", "unstable"
- when "register" then
- #pkg_server.register "/home/taejun/project/sdk-build/test/smart-build-interface_0.19.1_linux.zip", "unstable", "-g"
- pkg_server.register "/home/taejun/project/sdk-build/test/smart-build-interface_0.19.1_linux.zip", "unstable", ""
- when "snapshot" then
- pkg_server.snapshot_generate "", "unstable", "", "", ""
- when "sync" then
- # pkg_server.sync "unstable", "force"
- pkg_server.sync "unstable", ""
- when "add_distribution" then
- pkg_server.add_distribution "test_stable", "stable"
- else
- puts "First input error : #{ARGV[0]}"
-end
-
+++ /dev/null
-#!/usr/bin/ruby
-
-require File.dirname(__FILE__) + "/../src/common/utils"
-
-result = Utils.compare_version("5.2", "5.0.1")
-puts result
-
+++ /dev/null
-# Logfile created on Tue Feb 07 04:41:32 +0900 2012 by logger.rb/22285
-I, [2012-02-07T04:41:32.501856 #8938] INFO -- : option parsing start
-I, [2012-02-07T04:41:32.502027 #8938] INFO -- : option is :
-I, [2012-02-07T04:41:32.502149 #8938] INFO -- : option parsing end
-I, [2012-02-07T04:41:58.085604 #8964] INFO -- : option parsing start
-I, [2012-02-07T04:41:58.085807 #8964] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T04:41:58.085997 #8964] INFO -- : option parsing end
-I, [2012-02-07T04:42:23.693462 #9000] INFO -- : option parsing start
-I, [2012-02-07T04:42:23.693562 #9000] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T04:42:23.693652 #9000] INFO -- : option parsing end
-I, [2012-02-07T04:56:31.754070 #10355] INFO -- : option parsing start
-I, [2012-02-07T04:56:31.754269 #10355] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T04:56:31.754475 #10355] INFO -- : option parsing end
-I, [2012-02-07T05:00:28.494119 #10628] INFO -- : option parsing start
-I, [2012-02-07T05:00:28.494318 #10628] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T05:00:28.494519 #10628] INFO -- : option parsing end
-I, [2012-02-07T05:05:54.803965 #11007] INFO -- : option parsing start
-I, [2012-02-07T05:05:54.804057 #11007] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T05:05:54.804147 #11007] INFO -- : option parsing end
-I, [2012-02-07T05:11:20.088453 #11415] INFO -- : option parsing start
-I, [2012-02-07T05:11:20.088549 #11415] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T05:11:20.088641 #11415] INFO -- : option parsing end
-I, [2012-02-07T05:12:13.094058 #11504] INFO -- : option parsing start
-I, [2012-02-07T05:12:13.094152 #11504] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T05:12:13.094241 #11504] INFO -- : option parsing end
-I, [2012-02-07T05:32:29.151717 #12638] INFO -- : option parsing start
-I, [2012-02-07T05:32:29.151917 #12638] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T05:32:29.152123 #12638] INFO -- : option parsing end
-I, [2012-02-07T05:43:03.812225 #12775] INFO -- : option parsing start
-I, [2012-02-07T05:43:03.813711 #12775] INFO -- : option is : -u,http://172.21.111.132/testserver/unstable
-I, [2012-02-07T05:43:03.816670 #12775] INFO -- : option parsing end
+++ /dev/null
-#!/bin/sh -x
-# clean
-clean()
-{
- rm -rf $SRCDIR/*.zip
- rm -rf $SRCDIR/*.tar.gz
- rm -rf $SRCDIR/*.package.linux
-}
-
-# build
-build()
-{
- touch own
- touch two
- touch three
- touch four
-}
-
-# install
-install()
-{
- build
-
- BIN_DIR=$SRCDIR/package
- mkdir -p $BIN_DIR/pkgone.package.linux
- mkdir -p $BIN_DIR/pkgtwo.package.linux
- mkdir -p $BIN_DIR/pkgthree.package.linux
- mkdir -p $BIN_DIR/pkgfour.package.linux
- mv own $BIN_DIR/pkgone.package.linux
- mv two $BIN_DIR/pkgtwo.package.linux
- mv three $BIN_DIR/pkgthree.package.linux
- mv four $BIN_DIR/pkgfour.package.linux
-}
-
-
-
-[ "$1" = "clean" ] && clean
-[ "$1" = "build" ] && build
-[ "$1" = "install" ] && install
-exit 0
+++ /dev/null
-Package : pkgone
-Version : 0.1.0
-OS : linux | windows
-Mintainer : pkgone owner <owner@pkgone>
-Install-dependency : pkgtwo (>= 0.2.0) [linux | windows], pkgthree (<= 0.3.0 ) [linux]
-Build-dependency : pkgtwo (>= 0.2.0) [linux | windows], pkgthree (<= 0.3.0 ) [linux]
-Source-dependency : tpkg
-# this is commant
-Attribute : hi
-Category : my Category
-Conflict : pkgfour
-Install-script : pkgone.install
-Remove-script : pkgone.remove
-Source : tpkg
-Description : first test package
---
-it will increase
-
-Package : pkgtwo
-Version : 0.2.0
-OS : linux | windows
-Mintainer : pkgone owner <owner@pkgone>
-Install-dependency : pkgone (>= 0.1.0) [linux | windows], pkgthree (<= 0.3.0 ) [linux]
-Build-dependency : pkgone (>= 0.1.0) [linux | windows], pkgthree (<= 0.3.0 ) [linux]
-Source-dependency : tpkg
-# this is commant
-Attribute : E
-Category : ouu Category
-Conflict : pkgfour
-Install-script : pkgtwo.install
-Remove-script : pkgtwo.remove
-Source : tpkg
-Description : second test package
---
-it will increase
-
-Package : pkgthree
-Version : 0.3.0
-OS : linux | darwin
-Mintainer : pkgone owner <owner@pkgone>
-Install-dependency : pkgtwo (>= 0.2.0) [linux | windows]
-Build-dependency : pkgtwo (>= 0.2.0) [linux | windows], pkgone (<= 0.1.0 ) [linux]
-Source-dependency : tpkg
-# this is commant
-Attribute : sam
-Category : sam Category
-Conflict : pkgfour
-Install-script : pkgthree.install
-Remove-script : pkgthree.remove
-Source : tpkg
-Description : 3rd test package
---
-it will increase
-
-Package : pkgfour
-Version : 0.4.0
-OS : linux | darwin
-Mintainer : pkgone owner <owner@pkgone>
-Install-dependency : pkgthree (<= 0.3.0 ) [linux]
-Build-dependency : pkgone (>= 0.1.0) [linux | windows], pkgthree (<= 0.3.0 ) [linux]
-Source-dependency : tpkg
-# this is commant
-Attribute : i for
-Category : you Category
-Conflict : pkgfour
-Install-script : pkgfour.install
-Remove-script : pkgfour.remove
-Source : tpkg
-Description : 4th test package
---
-it will increase
+++ /dev/null
-#PRE-EXEC
-./dibs1/build-svr upgrade -n testserver3 -D unstable
-#EXEC
-sleep 3
-ls dibs1/VERSION dibs2/VERSION
-#POST-EXEC
-#EXPECT
-dibs1/VERSION
-dibs2/VERSION
+++ /dev/null
-#!/bin/sh
-CURDIR=`pwd`
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby "
-fi
-
-rm -rf buildsvr01
-rm -rf git01
-rm -rf bin
-rm -rf ~/.build_tools/build_server/testserver3
-rm -rf dibs1
-mkdir dibs1
-cp -r ../../src dibs1/
-cp -r ../../build-svr dibs1/
-cp -r ../../pkg-svr dibs1/
-cp -r ../../upgrade dibs1/
-cd ../../
-./pkg-build -u $CURDIR/pkgsvr01/unstable
-cd $CURDIR
-
-dibs1/build-svr remove -n testserver3
-mkdir buildsvr01
-cd buildsvr01
-${RUBY} ../dibs1/build-svr create -n testserver3
-echo "DROP DATABASE testserver3;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-${RUBY} ../dibs1/build-svr migrate -n testserver3 --dsn Mysql:testserver3:localhost --dbuser root --dbpassword $DB_PASSWD
-cd ..
-
-${RUBY} dibs1/build-svr add-dist -n testserver3 -D unstable -u $CURDIR/pkgsvr01/unstable -d 127.0.0.1:3333
-${RUBY} dibs1/build-svr add-svr -n testserver3 -d 127.0.0.1:2224
-${RUBY} dibs1/build-svr add-os -n testserver3 -o ubuntu-32
-${RUBY} dibs1/pkg-svr register -n pkgsvr01 -d unstable -P ../../dibs_*.zip
-
-${RUBY} dibs1/build-svr start -n testserver3 -p 2223
-
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby "
-fi
-
-rm -rf buildsvr02
-rm -rf dibs2
-mkdir dibs2
-cp -r ../../src dibs2/
-cp -r ../../build-svr dibs2/
-cp -r ../../pkg-svr dibs2/
-cp -r ../../upgrade dibs2/
-
-../../build-svr remove -n testserver4
-mkdir buildsvr02
-cd buildsvr02
-${RUBY} ../dibs2/build-svr create -n testserver4
-echo "DROP DATABASE testserver4;" > a
-mysql -u root -p --password=$DB_PASSWD -h localhost < a
-${RUBY} ../dibs2/build-svr migrate -n testserver4 --dsn Mysql:testserverr4:localhost --dbuser root --dbpassword $DB_PASSWD
-cd ..
-${RUBY} dibs2/build-svr add-dist -n testserver4 -D unstable -u `pwd`/pkgsvr01/unstable -d 127.0.0.1:3333
-
-${RUBY} dibs2/build-svr start -n testserver4 -p 2224
+++ /dev/null
-#!/bin/sh
-if [ "x${RUBY}" = "x" ] ;then
- RUBY="ruby -d"
-fi
-rm -rf ~/.build_tools/pkg_server/pkgsvr01
-rm -rf `pwd`/pkgsvr01
-${RUBY} ../../pkg-svr create -n pkgsvr01 -d unstable
-${RUBY} ../../pkg-svr add-os -n pkgsvr01 -d unstable -o ubuntu-32
-${RUBY} ../../pkg-svr start -n pkgsvr01 -p 3333
+++ /dev/null
-01.testcase
+++ /dev/null
-#!/bin/bash
-
-###############################################################
-## Variables
-###############################################################
-
-START_PATH=~+ ## like `pwd`
-SCRIPT_NAME=$0
-SCRIPT_OPERATION=$1
-ARG1=$2
-ARG2=$3
-ARG3=$4
-GIT_PORT=29419
-CONTINUE=n
-GIT_LIST="
-/sdk/ide/common-eplugin
-/sdk/ide/eventinjector-eplugin
-/sdk/ide/nativecommon-eplugin
-/sdk/ide/nativeappcommon-eplugin
-/sdk/ide/native-eplugin
-/sdk/ide/native-ext-eplugin
-/sdk/ide/native-sample
-/sdk/ide/nativeplatform-eplugin
-/sdk/ide/unittest-eplugin
-/sdk/ide/profiler-eplugin
-/sdk/ide/codecoverage-eplugin
-/sdk/ide/assignmenttracing-eplugin
-/sdk/ide/webapp-eplugin
-/sdk/ide/product
-/sdk/ide/websimulator-eplugin
-/sdk/tools/sdb
-"
-# /sdk/ide/nativeapp-eplugin
-# /sdk/ide/native-gui-builder-eplugin
-# /sdk/gui-builder/native-gui-builder
-# /sdk/ide/telephony-eplugin
-# /sdk/ide/codehiding-eplugin
-
-###############################################################
-## Usage output functions
-###############################################################
-
-function usage() {
- echo "Usage : ${SCRIPT_NAME##*/} <command> [<args>]"; echo
- echo "The most commonly used script commands are :"
- echo " clone Clone git sources about Tizen SDK"
- echo " pull Pull git sources about Tizen SDK"
- echo " checkout checkout git sources about Tizen SDK"; echo
- exit 1
-}
-
-function usage_pull() {
- echo "Usage : ${SCRIPT_NAME##*/} pull : Git pull in current directory";
- echo "Usage : ${SCRIPT_NAME##*/} pull <source directory> : Git pull in source directory";
-
- draw_line
- echo " Ex1) \$ ${SCRIPT_NAME} pull"; echo
- echo " Ex2) \$ ${SCRIPT_NAME} pull $(pwd)/tizen-ide-sources"; echo
- exit 1
-}
-
-function usage_checkout() {
- echo "Usage : ${SCRIPT_NAME##*/} checkout <branch name> : Git checkout in current directory";
- echo "Usage : ${SCRIPT_NAME##*/} checkout <branch name> <source directory> : Git checkout in source directory";
-
- draw_line
- echo " Ex1) \$ ${SCRIPT_NAME} checkout develop"; echo
- echo " Ex2) \$ ${SCRIPT_NAME} checkout develop $(pwd)/tizen-ide-sources"; echo
- exit 1
-}
-
-function usage_clone() {
- draw_line
- echo "Usage : 1) ${SCRIPT_NAME##*/} clone <git branch name> <host> : Git clone in curreut directory"; echo
- echo " 2) ${SCRIPT_NAME##*/} clone <git branch name> <host> <destination directory>: Git clone in destination directory"
- draw_line
- echo " Ex1) \$ ${SCRIPT_NAME} clone develop gerrithost"
- echo " Ex2) \$ ${SCRIPT_NAME} clone release http://develop.tizen.org/git:2039 /home/usr/work/git"
- exit 1
-}
-
-
-###############################################################
-## Processing Functions
-###############################################################
-
-function draw_line() {
- echo; echo "==========================================================================="; echo;
-}
-
-## Error Check Function
-function isError() {
- ERROR_CODE=$?
-
- if [ ${ERROR_CODE} == 0 ]; then
- echo "[ $1 : Done ]";
- else
- echo "[ $1 : Fail (ErrorCode : ${ERROR_CODE}) ]"
- if [ ${CONTINUE} == "n" ]; then
- input=0
- while [ ${input} != "y" -a ${input} != "n" -a ${input} != "a" ]; do
- echo "Continue? y: Yes, n: No, a: Yes to all"
- read input
- if [ ${input} == "n" ]; then
- exit ${ERROR_CODE}
- elif [ ${input} == "a" ]; then
- CONTINUE=y
- echo ${CONTINUE}
- fi
- done
- fi
- fi
-}
-
-## Cloning git
-function git_clone() {
- GIT_PATH=$1
- GIT_NAME=${GIT_PATH##*/}
-
- ## ARG1 : <git branch name>
- ## ARG2 : <host>
- ## ARG3 : <destination directory>
- git clone -b ${ARG1} ${ARG2}:${GIT_PATH} ${ARG3}/${GIT_NAME}
- isError "Cloned ${GIT_NAME}"
- scp -p -P ${GIT_PORT} ${ARG2}:hooks/commit-msg ${ARG3}/${GIT_NAME}/.git/hooks/
- isError "Generate change-id ${GIT_NAME}"
-}
-
-## Cloning git all
-function git_clone_all() {
- draw_line; echo "Git clone sources"; draw_line
-
- for GIT_EACH in ${GIT_LIST}
- do
- git_clone ${GIT_EACH}
- done
-}
-
-## Pulling git
-function git_pull() {
- GIT_PATH=$1
- GIT_NAME=${GIT_PATH##*/}
-
- ## ARG1 : <source directory>
- cd ${ARG1}/${GIT_NAME}
- isError "Found git directory ( ${ARG1}/${GIT_NAME} )"
- git pull
- isError "Pulled ${GIT_NAME}"
-}
-
-## Pulling git all
-function git_pull_all() {
- draw_line; echo "Git pull sources"; draw_line
-
- cd ${ARG1}
- isError "Checked source directory ( ${ARG1} )"
-
- for GIT_EACH in ${GIT_LIST}
- do
- git_pull ${GIT_EACH}
- done
-
- cd ${START_PATH}
-}
-
-## Checking out git
-function git_checkout() {
- GIT_PATH=$1
- GIT_NAME=${GIT_PATH##*/}
-
- ## ARG1 : <source directory>
- cd ${ARG2}/${GIT_NAME}
- isError "Found git directory ( ${ARG2}/${GIT_NAME} )"
- git checkout ${ARG1}
- isError "Checkout ${GIT_NAME}"
-}
-
-## Checking out git all
-function git_checkout_all() {
- draw_line; echo "Git checkout"; draw_line
-
- cd ${ARG2}
- isError "Checked source directory ( ${ARG1} )"
-
- for GIT_EACH in ${GIT_LIST}
- do
- git_checkout ${GIT_EACH}
- done
-
- cd ${START_PATH}
-}
-
-## Command git
-function git_command() {
- GIT_PATH=$1
- GIT_NAME=${GIT_PATH##*/}
-
- ## ARG1 : <source directory>
- cd ${ARG1}/${GIT_NAME}
- isError "Found git directory ( ${ARG1}/${GIT_NAME} )"
- git ${SCRIPT_OPERATION}
- isError "Pulled ${GIT_NAME}"
-}
-
-## Command git all
-function git_command_all() {
- draw_line; echo "Git ${SCRIPT_OPERATION}"; draw_line
-
- cd ${ARG1}
- isError "Checked source directory ( ${ARG1} )"
-
- for GIT_EACH in ${GIT_LIST}
- do
- git_command ${GIT_EACH}
- done
-
- cd ${START_PATH}
-}
-
-###############################################################
-## Begin script
-###############################################################
-
-case ${SCRIPT_OPERATION} in
- ## process "clone" operation
- clone)
- if [ "$#" == 4 ]; then
- git_clone_all
- elif [ "$#" == 3 ]; then
- ARG3=$(pwd)
- git_clone_all
- else
- usage_clone
- fi
- ;;
-
- ## process "pull" operation
- pull)
- if [ "$#" == 2 ]; then
- git_pull_all
- elif [ "$#" == 1 ]; then
- ARG1=$(pwd)
- git_pull_all
- else
- usage_pull
- fi
- ;;
-
- ## process "checkout" operation
- checkout)
- if [ "$#" == 3 ]; then
- git_checkout_all
- elif [ "$#" == 2 ]; then
- ARG2=$(pwd)
- git_checkout_all
- else
- usage_checkout
- fi
- ;;
-
- ## process default
- *)
- if [ "$#" == 1 ]; then
- ARG1=$(pwd)
- git_command_all
- else
- usage
- fi
- ;;
-esac
-
-echo "[ Finished process ]"
-
-###############################################################
-## End script
-###############################################################
+++ /dev/null
-#!/usr/bin/ruby
-=begin
-
- upgrade
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-require 'optparse'
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/build_server"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/pkg_server"
-require "BuildServerController"
-require "utils.rb"
-require "log.rb"
-require "client"
-
-def option_error_check( options )
- if options[:start] then
- if options[:locate].nil? or options[:type].nil? or options[:name].nil? then
- raise ArgumentError, "upgrade -l <dibs path> -S -t <server type> -n <server name> -p <server port> -D <distribution name>" + "\n"
- end
- else
- if options[:locate].nil? or options[:url].nil? then
- raise ArgumentError, "upgrade -u <package server url> [-l <dibs path>]" + "\n"
- end
- end
-end
-
-def option_parse
- options = {}
- banner = "DIBS upgrade service command-line tool." + "\n" \
- + "\n" + "Usage: upgrade -u <package server url> [-l <dibs path>]" + "\n" \
- + "\n" + "Options:" + "\n"
-
- optparse = OptionParser.new(nil, 32, ' '*8) do|opts|
- opts.banner = banner
-
- options[:locate] = File.dirname(__FILE__)
- opts.on( '-l', '--locate <dibs path>', 'located dibs path' ) do|locate|
- options[:locate] = locate
- end
-
- opts.on( '-u', '--url <package server url>', 'package server url: http://127.0.0.1/dibs/unstable' ) do|url|
- options[:url] = url
- end
-
- opts.on( '-I', '--install', 'install, internal option' ) do
- options[:install] = true
- end
-
- opts.on( '-S', '--start', 'start server option' ) do
- options[:start] = true
- end
-
- opts.on( '-t', '--type <server type>', 'sever type : BUILDSERVER or PACKAGESERVER' ) do|type|
- options[:type] = type
- end
-
- opts.on( '-n', '--name <server name>', 'build server name or package server name' ) do|name|
- options[:name] = name
- end
-
- opts.on( '-D', '--distribution <distribution name>', 'build server distribution name' ) do|dist|
- options[:dist] = dist
- end
-
- options[:port] = 2222
- opts.on( '-p', '--port <port>', 'server port number: 2224' ) do|port|
- options[:port] = port.strip.to_i
- end
-
- opts.on( '-h', '--help', 'display this information' ) do
- puts opts.banner
- puts " -l, --locate <dibs path>, located dibs path"
- puts " -u, --url <package server url>, package server url: http://127.0.0.1/dibs/unstable"
- exit
- end
- end
-
- optparse.parse!
-
- option_error_check options
-
- return options
-end
-
-#option parsing
-begin
- option = option_parse
-rescue => e
- puts e.message
- exit 0
-end
-
-# Upgrade DIBS
-begin
- install_opt = option[:install]
- sub_cmd = option[:sub_cmd]
- dibs_path = option[:locate]
- pkg_svr_url= option[:url]
- start_opt = option[:start]
- svr_type = option[:type]
- svr_name = option[:name]
- svr_port = option[:port]
- svr_dist = option[:dist]
-
- DIBS_PKG_NAME = "dibs"
- BACKUP_ROOT = Utils::HOME + "/.build_tools/backup"
- PREV_VER_PATH = BACKUP_ROOT + "/prev_ver"
- NEW_VER_PATH = BACKUP_ROOT + "/new_ver"
- UPGRADE_CMD = "#{PREV_VER_PATH}/upgrade"
- BUILD_CONFIG_ROOT = "#{Utils::HOME}/.build_tools/build_server/#{svr_name}"
-
- if pkg_svr_url.nil? and not svr_dist.nil? then
- build_server = BuildServerController.get_server(svr_name)
- if build_server.has_db? then
- dist = build_server.distmgr.get_distribution(svr_dist)
- else
- dist = nil
- end
- if dist.nil? then
- log.error "Upgrade failed : No distribution name \"#{svr_dist}\" exist!", Log::LV_USER
- cmd = Utils.generate_shell_command("#{dibs_path}/build-svr start -n #{svr_name} -p #{svr_port}")
- Utils.spawn(cmd)
- exit 1
- end
- pkg_svr_url = dist.pkgsvr_url
- end
-
- if not File.exist? BACKUP_ROOT then FileUtils.mkdir_p(BACKUP_ROOT) end
- log = StandardOutLog.new( "#{BUILD_CONFIG_ROOT}/log" )
-
- if not install_opt then
- puts ""
- log.info("Upgrade Start...", Log::LV_USER)
-
- # Backup current dibs
- if File.exist? PREV_VER_PATH then FileUtils.rm_rf(PREV_VER_PATH) end
- if File.exist? NEW_VER_PATH then FileUtils.rm_rf(NEW_VER_PATH) end
- FileUtils.mkdir_p(PREV_VER_PATH)
- FileUtils.mkdir_p(NEW_VER_PATH)
- FileUtils.cp_r("#{dibs_path}/.", PREV_VER_PATH, :preserve => true)
- log.info("Backup DIBS [#{dibs_path}] -> [#{PREV_VER_PATH}]", Log::LV_USER)
-
- # Run Upgrade
- if start_opt and svr_type.eql? "BUILDSERVER" then
- cmd = "#{UPGRADE_CMD} -I -l #{dibs_path} -S -t #{svr_type} -n #{svr_name} -p #{svr_port}"
- else
- cmd = "#{UPGRADE_CMD} -I -l #{dibs_path}"
- end
-
- if not (pkg_svr_url.nil? or pkg_svr_url.empty?) then
- cmd += " -u #{pkg_svr_url}"
- else
- log.error "Upgrade failed : No package server URL!", Log::LV_USER
- exit 1
- end
-
- cmd = Utils.generate_shell_command(cmd)
- Utils.spawn(cmd)
-
- else
- # Get SERVER INFORMATION
- if svr_type.eql? "BUILDSERVER" then
- log.info("Build server : [#{svr_name}][#{svr_port}]", Log::LV_USER)
- end
- log.info("Package Server : [#{pkg_svr_url}]", Log::LV_USER)
- log.info("DIBS Path : [#{dibs_path}]", Log::LV_USER)
-
- # Download DIBS Package
- client = Client.create( pkg_svr_url, NEW_VER_PATH, log)
- if client.nil? then
- log.error("Cannot create package client!", Log::LV_USER)
- exit(1)
- end
- client.update()
- client.install( DIBS_PKG_NAME, Utils::HOST_OS, true, true)
- if not File.exist? "#{NEW_VER_PATH}/tools/dibs" then
- log.error("Not installed package error.", Log::LV_USER)
- exit(1)
- end
-
- # Copy Current path
- if File.exist? "#{dibs_path}" then
- FileUtils.rm_rf("#{dibs_path}")
- #FileUtils.mkdir_p("#{dibs_path}")
- end
-
- FileUtils.cp_r("#{NEW_VER_PATH}/tools/dibs/.", "#{dibs_path}", :preserve => true)
-
- # Execute start command
- if start_opt then
- if svr_type.eql? "BUILDSERVER" then
- # get friends server information
- build_server = BuildServerController.get_server(svr_name)
- if build_server.has_db? then
- build_server.get_remote_servers().each do |svr|
- ip = svr.ip
- port = svr.port
-
- build_client = BuildCommClient.create( ip, port )
- if build_client.nil? then
- log.info("Friend Server #{ip}:#{port} is not running!", Log::LV_USER)
- next
- end
-
- # send request
- log.info("Upgrading Friend Server #{ip}:#{port}...", Log::LV_USER)
- if build_client.send "UPGRADE|#{build_server.password}|#{pkg_svr_url}" then
- # recevie & print
- mismatched = false
- result = build_client.read_lines do |l|
- log.info(l, Log::LV_USER)
- if l.include? "Password mismatched!" then
- mismatched = true
- end
- end
- if not result then
- log.info("Upgrading failed! #{build_client.get_error_msg()}", Log::LV_USER)
- elsif mismatched then
- log.info("Upgrading failed! Password mismatched!", Log::LV_USER)
- end
- else
- log.info("Upgrading failed! #{build_client.get_error_msg()}", Log::LV_USER)
- next
- end
-
- # terminate
- build_client.terminate
- end
- end
-
- # Start Build server
- cmd = Utils.generate_shell_command("#{dibs_path}/build-svr start -n #{svr_name} -p #{svr_port}")
- Utils.spawn(cmd)
-
- log.info("Upgrade Complete", Log::LV_USER)
- log.info("Start Build server [#{cmd}]", Log::LV_USER)
-
- else # PACKAGE SERVER
- # Start Build server
- cmd = Utils.generate_shell_command("#{dibs_path}/pkg-svr start -n #{svr_name} -p #{svr_port}")
- Utils.spawn(cmd)
-
- log.info("Upgrade Complete", Log::LV_USER)
- log.info("Start Package server [#{cmd}]", Log::LV_USER)
- end
- else
- log.info("Upgrade Complete", Log::LV_USER)
- end
- end
-rescue => e
- log.error(e.message, Log::LV_USER)
- #puts e.message
-end
-
+++ /dev/null
-#!/usr/bin/ruby
-=begin
-
- web-svr
-
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact:
-Sungmin Kim <dev.sungmin.kim@samsung.com>
-Taejun Ha <taejun.ha@samsung.com>
-Jiil Hyoun <jiil.hyoun@samsung.com>
-Donghyuk Yang <donghyuk.yang@samsung.com>
-DongHee Yang <donghee.yang@samsung.com>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Contributors:
-- S-Core Co., Ltd
-=end
-
-require 'fileutils'
-require 'optparse'
-require 'yaml'
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
-$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/build_server"
-require "log.rb"
-require 'utils'
-require 'db_utils'
-require "BuildServer"
-require "BuildServerController"
-
-class OptParse
- #Sub command usage
- START = "dibs-web start -n <server name> [-p <port number>] [-m <DB mode>] [-d]"
- STOP = "dibs-web stop -n <server name>"
- CREATE = "dibs-web create -n <server name> [-e <engine name] [-p <port number>] [-m <DB mode>] [-i]"
-
- def self.option_error_check( options )
- case options[:cmd]
- when "start" then
- if options[:name].nil? then
- raise ArgumentError, "Usage: " + START
- end
- when "stop" then
- if options[:name].nil? then
- raise ArgumentError, "Usage: " + STOP
- end
- when "create" then
- if options[:name].nil? then
- raise ArgumentError, "Usage: " + CREATE
- end
- else
- raise ArgumentError, "Input is incorrect : #{options[:cmd]}"
- end
- end
-
- def self.option_parse
- options = {}
- banner = "DIBS web service command-line tool." + "\n" \
- + "\n" + "Usage: dibs-web <SUBCOMMAND> [OPTS] or dibs-web (-h|-v)" + "\n" \
- + "\n" + "SubCommands:" + "\n" \
- + "\t" + "start Start web server." + "\n" \
- + "\t" + "stop Stop web server." + "\n" \
- + "\t" + "create Create web server configuration." + "\n" \
- + "\n" + "Subcommand usage:" + "\n" \
- + "\t" + START+ "\n" \
- + "\t" + STOP+ "\n" \
- + "\t" + CREATE + "\n" \
- + "\n" + "Options:" + "\n"
-
- optparse = OptionParser.new(nil, 32, ' '*8) do|opts|
- opts.banner = banner
-
- options[:locate] = File.dirname(__FILE__)
- opts.on( '-n', '--name <server name>', 'build server name' ) do|name|
- options[:name] = name
- end
-
- options[:engine] = "WEBRick"
- opts.on( '-e', '--engine <engine name>', 'web server engine : WEBrick | Passenger' ) do|engine|
- options[:engine] = engine
- end
-
- options[:port] = 3000
- opts.on( '-p', '--port <port number>', 'default server port' ) do|port|
- options[:port] = port
- end
-
- options[:mode] = "production"
- opts.on( '-m', '--mode <mode>', 'DB mode : production | test | development' ) do|mode|
- options[:mode] = mode.strip
- end
-
- options[:port] = "3000"
- opts.on( '-p', '--port <port>', 'server port number: 3000' ) do|port|
- options[:port] = port.strip.to_i
- end
-
- opts.on( '-i', '--import', 'import configuration from build-server' ) do|import|
- options[:import] = true
- end
-
- opts.on( '-d', '--daemon', 'daemon process' ) do|import|
- options[:daemon] = true
- end
-
- opts.on( '-h', '--help', 'display this information' ) do
- opts.help.split("\n").each {|op| puts op if not op.include? "--noreverse"}
- exit
- end
- end
-
- cmd = ARGV[0]
-
- if cmd.eql? "create" or cmd.eql? "start" or cmd.eql? "stop" or
- cmd =~ /(-v)|(--version)/ or cmd =~ /(help)|(-h)|(--help)/ then
-
- if cmd.eql? "help" then
- ARGV[0] = "-h"
- end
-
- options[:cmd] = ARGV[0]
- else
- raise ArgumentError, "Usage: build-cli <SUBCOMMAND> [OPTS] or build-cli -h"
- end
-
- optparse.parse!
-
- option_error_check options
-
- return options
- end
-end
-
-class ControlWebServer
- CONFIG_ROOT = "#{Utils::HOME}/.build_tools/web_server"
- BUILD_SERVER_CONFIG_ROOT = "#{Utils::HOME}/.build_tools/build_server"
- SERVER_ROOT = File.dirname(__FILE__)+"/dibs-web"
- SERVER_CONFIG = File.dirname(__FILE__)+"/dibs-web/config/database.yml"
-
- def self.check_config_file(svr_name)
- if File.exist? "#{CONFIG_ROOT}/#{svr_name}/server.yml"
- return true
- else
- return false
- end
- end
-
- def self.get_server_config(svr_name)
- config = YAML.load_file("#{CONFIG_ROOT}/#{svr_name}/server.yml")
- end
-
- def self.get_build_server_config(svr_name)
- config_file = "#{ControlWebServer::BUILD_SERVER_CONFIG_ROOT}/#{svr_name}/server.cfg"
- config = {}
-
- #check build-server config-file
- if not File.exist? config_file
- raise RuntimeError, "Creating server failed. The build server is not exist"
- end
-
- #parse build-server config-file
- File.open( config_file, "r" ) do |f|
- f.each_line do |l|
- if l.strip.start_with?("#") then next end
- idx = l.index("=") + 1
- length = l.length - idx
-
- if l.start_with?("DB_DSN=")
- case l[idx,length].strip
- when /^SQLite3:(.*)/i then
- if $1.strip.empty? then db_dsn = "SQLite3:#{BuildServer::CONFIG_ROOT}/#{id}/server.db"
- else config[:db_dsn] = "SQLite3:#{$1.strip}"
- end
- when /^Mysql:(.*)/i then
- config[:db_dsn] = "Mysql:#{$1}"
- else
- config[:db_dsn] = "SQLite3:#{BuildServer::CONFIG_ROOT}/#{id}/server.db"
- end
- elsif l.start_with?("DB_USER=")
- config[:db_user] = l[idx,length].strip if not l[idx,length].strip.empty?
- elsif l.start_with?("DB_PASSWORD=")
- config[:db_passwd] = l[idx,length].strip if not l[idx,length].strip.empty?
- else
- next
- end
- end
- end
-
- #parse dsn
- db = DBUtils.dsn_parser(config[:db_dsn])
-
- config[:database] = db[:database]
- config[:db_name] = db[:name]
- config[:db_host] = db[:host]
- config[:db_port] = db[:port]
- config[:db_socket] = db[:socket]
- config[:db_flag] = db[:flag]
-
- return config
- end
-end
-
-#option parsing
-begin
- option = OptParse.option_parse
-rescue => e
- puts e.message
- exit 0
-end
-
-# main
-begin
- test = {}
- production = {}
- development = {}
-
- case option[:cmd]
- when "create"
- # check configuration directory
- if not File.exist? ControlWebServer::CONFIG_ROOT
- puts "Creating new server configuration... #{ControlWebServer::CONFIG_ROOT}"
- FileUtils.mkdir_p "#{ControlWebServer::CONFIG_ROOT}"
- end
-
- # check config-file
- if ControlWebServer.check_config_file(option[:name])
- raise RuntimeError, "Creating server failed. The server id is already exist"
- else
- FileUtils.mkdir_p "#{ControlWebServer::CONFIG_ROOT}/#{option[:name]}"
- end
-
- # check build-server config-file
- if option[:import]
- db = ControlWebServer.get_build_server_config(option[:name])
-
- if db[:database].upcase == "Mysql".upcase
- db[:adapter] = "mysql2"
- db[:encoding] = "utf8"
- db[:pool] = 5
- db[:timeout] = 5000
- case option[:mode]
- when "production"
- production = db
- when "test"
- test = db
- when "development"
- development = db
- else
- raise RuntimeError, "The mode \"#{option[:mode]}\" is invalid!"
- end
- end
- end
-
- # write config-file
- File.open( "#{ControlWebServer::CONFIG_ROOT}/#{option[:name]}/server.yml", "w" ) do |f|
- f.puts "server: "
- f.puts " engine: #{option[:engine]}"
- f.puts " port: #{option[:port]}"
- f.puts " db_mode: #{option[:mode]}"
- f.puts "database: "
- f.puts " test:"
- f.puts " adapter: #{test[:adapter]}"
- f.puts " encoding: #{test[:encoding]}"
- f.puts " host: #{test[:db_host]}"
- f.puts " port: #{test[:db_port]}"
- f.puts " database: #{test[:db_name]}"
- f.puts " username: #{test[:db_user]}"
- f.puts " password: #{test[:db_passwd]}"
- f.puts " pool: #{test[:pool]}"
- f.puts " timeout: #{test[:timeout]}"
- f.puts ""
- f.puts " production: "
- f.puts " adapter: #{production[:adapter]}"
- f.puts " encoding: #{production[:encoding]}"
- f.puts " host: #{production[:db_host]}"
- f.puts " port: #{production[:db_port]}"
- f.puts " database: #{production[:db_name]}"
- f.puts " username: #{production[:db_user]}"
- f.puts " password: #{production[:db_passwd]}"
- f.puts " pool: #{production[:pool]}"
- f.puts " timeout: #{production[:timeout]}"
- f.puts ""
- f.puts " development: "
- f.puts " adapter: #{development[:adapter]}"
- f.puts " encoding: #{development[:encoding]}"
- f.puts " host: #{development[:db_host]}"
- f.puts " port: #{development[:db_port]}"
- f.puts " database: #{development[:db_name]}"
- f.puts " username: #{development[:db_user]}"
- f.puts " password: #{development[:db_passwd]}"
- f.puts " pool: #{development[:pool]}"
- f.puts " timeout: #{development[:timeout]}"
- end
- when "start"
- # check server config
- if not ControlWebServer.check_config_file(option[:name])
- raise RuntimeError, "The server \"#{option[:name]}\" does not exist!"
- end
-
- # parsing config
- config = ControlWebServer.get_server_config(option[:name])
- server = config['server']
- database = config['database']
-
- # copy config about database
- File.open("#{ControlWebServer::SERVER_CONFIG}", 'w') do |f|
- f.write(YAML.dump(database))
- end
-
- # run web-server
- if option[:daemon]
- daemon = "-d"
- end
-
- case server['engine'].upcase
- when 'WEBRick'.upcase
- cmd = "rails server -p #{server['port']} #{daemon} -e #{server['db_mode']}"
- when 'Passenger'.upcase
- cmd = "passenger start -p #{server['port']} #{daemon} -e #{server['db_mode']}"
- else
- raise RuntimeError, "The engine is not supported. #{server['engine']}"
- end
- Dir.chdir(ControlWebServer::SERVER_ROOT)
-
- system(cmd)
-
- when "stop"
- # check server config
- if not ControlWebServer.check_config_file(option[:name])
- raise RuntimeError, "The server \"#{option[:name]}\" does not exist!"
- end
-
- # parsing config
- config = ControlWebServer.get_server_config(option[:name])
- server = config['server']
-
- # stop web-server
- case server['engine'].upcase
- when 'WEBRick'.upcase
- puts "WEBRick stopping is not support. Try kill process"
- when 'Passenger'.upcase
- cmd = "passenger stop --pid-file #{ControlWebServer::SERVER_ROOT}/tmp/pids/passenger.#{server['port']}.pid"
- system(cmd)
- else
- raise RuntimeError, "The engine is not supported. #{server['engine']}"
- end
- else
- raise RuntimeError, "input option incorrect : #{option[:cmd]}"
- end
-rescue => e
- puts e.message
-end
-
+++ /dev/null
-#!/bin/bash
-################################################################################
-# This Script is rootstrap verify
-# 1. necessary include file test
-# 2. necessary include file dependency test
-# 3. necessary library test
-# 4. necessary library broken test
-# 5. unused library remove
-################################################################################
-SCRIPT_NAME=$(basename $0)
-SCRIPT_VER="0.0.1"
-
-function log()
-{
- printf "[${SCRIPT_NAME}:${BASH_LINENO[0]}] ${@}\n"
-}
-
-################################################################################
-#
-# function
-# check_error()
-# $1 : Error code (integer)
-# $2 : Error Message
-#
-# check_error $? "Fail Messages."
-#
-################################################################################
-function check_error()
-{
- if [ "$1" -ne "0" ]; then
- printf "\n[${SCRIPT_NAME}:${BASH_LINENO[0]}] ERROR : $2 - exit code ($1) \n\n" 1>&2
- exit $1
- fi
-}
-
-function print_usage_exit()
-{
- echo ""
- echo ""
- echo "$SCRIPT_NAME ($SCRIPT_VER) is script to verify rootstrap"
- echo "$SCRIPT_NAME : usage : $SCRIPT_NAME [ infofile ] [rootstrap dir] [-e | -t][--force]"
- echo ""
- echo " >$SCRIPT_NAME info/mobile-2.3-emulator.core.dev.xml mobile-2.3-emulator.core"
- echo " >$SCRIPT_NAME .info/mobile-2.3.1-emulator.core.dev.xml .emulator"
- echo " >$SCRIPT_NAME .info/mobile-2.3.1-emulator.core.dev.xml .emulator -e"
- echo " >$SCRIPT_NAME .info/mobile-2.3.1-device.core.dev.xml .target -t"
- echo " >$SCRIPT_NAME .info/mobile-2.3.1-emulator.core.dev.xml .emulator --force"
- echo ""
- echo ""
- exit $1
-}
-
-
-################################################################################
-# 1. necessary include file test
-# 1.1 get api_header_list
-# 1.2 find header file
-#
-# Input :
-# API_HEADER_LIST_FILELIST
-# Output :
-# ${API_HEADER_LIST_FILEPATH}.result
-# NO_HEADER_COUNT
-################################################################################
-DEF_HEADER_EXT="^(.*)((\.h)|(\.hpp)|(\.x))$"
-
-API_HEADER_LIST_FILELIST=("./NATIVE_api_header_list" "./DALI_api_header_list" "./EFL_api_header_list")
-BAD_API_HEADER_LIST=()
-
-LOCAL_ROOTPATH=".emulator"
-NO_HEADER_COUNT=0;
-
-rm *.result
-
-for API_HEADER_LIST_FILEPATH in ${API_HEADER_LIST_FILELIST[@]}
-do
- echo "Run... $API_HEADER_LIST_FILEPATH"
- if [ ! -e ${API_HEADER_LIST_FILEPATH} ]
- then
- check_error -1 "${API_HEADER_LIST_FILEPATH} is NOT Exist"
- fi
-
- while read line
- do
- if [[ ${line} =~ ^$ ]]
- then
- continue
- fi
-
- line=`echo ${line} | sed -e 's/[[:space:]]//g' | sed -e 's/\"//g'`
-
- if [[ ${line} =~ ${DEF_HEADER_EXT} ]]
- then
- #echo "${line}"
- TEST_FILEPATH=`find ${LOCAL_ROOTPATH} -name "${line}" -print | head -n 1 `
-
- if [[ ! -e ${TEST_FILEPATH[0]} ]]
- then
- #echo "Good : ${line}, ${TEST_FILEPATH}"
- #else
- #echo "BAD : ${line}"
- BAD_API_HEADER_LIST+=("${line}")
- fi
-
- else
- echo "File Name [${line}] is NOT header file format. SKIP..."
- continue;
- #check_error -1 "${line} File Name is NOT header file format."
- fi
-
- done < ${API_HEADER_LIST_FILEPATH}
-
-
- #echo "BAD_API_HEADER_LIST"
- printf '%s\n' "${BAD_API_HEADER_LIST[@]}" >> ${API_HEADER_LIST_FILEPATH}".result" 2>&1
- echo "Error Count ${#BAD_API_HEADER_LIST[@]}"
- let "NO_HEADER_COUNT+=${#BAD_API_HEADER_LIST[@]}"
-done
-
-echo "non-existent file count... Total ${NO_HEADER_COUNT}."
-
-exit 0
+++ /dev/null
-#!/bin/bash
-INPUT_FILE=${1}
-if [[ ! -e ${INPUT_FILE} ]]
-then
- echo "File not Exist..."
- exit -1;
-fi
-
-version_file=${INPUT_FILE}
-PKG_VERSION=`cat $version_file | tr -d " " | grep Version: | sed "s/Version://g" | uniq`
-PKG_MAJOR_VERSION=`echo $PKG_VERSION | awk '{split($0,input,"."); print input[1] "." input[2] "."}'`
-BUILD_NUM=`echo $PKG_VERSION | awk '{split($0,input,"."); print input[3]}'`
-NEW_BUILD_NUM=`echo $(( $BUILD_NUM + 1 ))`
-NEW_PKG_VERSION=${PKG_MAJOR_VERSION}${NEW_BUILD_NUM}
-sed -e "s/Version :.*/Version : ${NEW_PKG_VERSION}/g" $version_file > "${version_file}_temp"
-mv ${version_file}_temp ${version_file}
-
-echo "$NEW_PKG_VERSION"