From e058ca5e71f170bc0bccaecec663c3d03fdc9d5a Mon Sep 17 00:00:00 2001 From: spartak-radchenko Date: Fri, 31 May 2013 19:00:17 +0400 Subject: [PATCH 1/3] Update import-packages.sh Added Source: field parsing in the .changes file, fixed Description: field parsing --- reprepro/import-packages.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/reprepro/import-packages.sh b/reprepro/import-packages.sh index 5f4710d..8152aa4 100755 --- a/reprepro/import-packages.sh +++ b/reprepro/import-packages.sh @@ -45,7 +45,15 @@ function removepkg() { #accepts path to .changes file, parses it and removes according packages local i pkglist CHANGESFILE CHANGESFILE="$1" - pkglist=$(sed '/Changes/,$d' < "${CHANGESFILE}"|sed '1,/Description:/d'|awk '{print $1}') + pkglist=$(awk ' + /^Source:/{print $2} + /^Description:/{ + while (1) { + if (getline <= 0) { break } + if (substr($0,1,1) != " ") { break } + print $1 + } + } ' < "${CHANGESFILE}" | sort | uniq) for i in $pkglist do mylog "removing package $i" From 949e560ad81339e59fc5f283a0229f0a5eda2d32 Mon Sep 17 00:00:00 2001 From: spartak-radchenko Date: Fri, 31 May 2013 19:02:12 +0400 Subject: [PATCH 2/3] Update import-packages.sh --- reprepro/import-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reprepro/import-packages.sh b/reprepro/import-packages.sh index 8152aa4..28ab0d6 100755 --- a/reprepro/import-packages.sh +++ b/reprepro/import-packages.sh @@ -53,7 +53,7 @@ function removepkg() { if (substr($0,1,1) != " ") { break } print $1 } - } ' < "${CHANGESFILE}" | sort | uniq) + }' "${CHANGESFILE}" | sort | uniq) for i in $pkglist do mylog "removing package $i" From 7788cc23cfba817fa8261e52db935ce87d33981a Mon Sep 17 00:00:00 2001 From: spartak-radchenko Date: Fri, 31 May 2013 19:15:17 +0400 Subject: [PATCH 3/3] Create create-python-pypi-pkg.revs.sh Python pypi package build and upload --- jenkins/create-python-pypi-pkg.revs.sh | 102 +++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 jenkins/create-python-pypi-pkg.revs.sh diff --git a/jenkins/create-python-pypi-pkg.revs.sh b/jenkins/create-python-pypi-pkg.revs.sh new file mode 100644 index 0000000..c00a1cf --- /dev/null +++ b/jenkins/create-python-pypi-pkg.revs.sh @@ -0,0 +1,102 @@ +#!/bin/bash + +#this script should build pypi pkg from specified branch and revision + +#common debian reqs: +#devscripts fakeroot build-essential debhelper + +#in params: +# [revisionid] [reposerver] + +PROGNAME=$(basename $0) + +#PRJNAME="frontend.2.0" + +function print_usage(){ + echo "this script may accept next params" + echo "-P projectname - name of the project we are building, like frontend2.0, search, tornado and such. should be the same as github repo name." + echo "-B branch - branch to checkout" + echo "-R revision id - revision to check out" + echo "-S reposerver - ssh servername in format user@host, like git@github.com" + echo "-E environment" + echo "" + echo "example:" + echo "$PROGNAME -P apilib -B master -R fcd3d2c172d244bf3355efff86ee7800702ce69f -S git@github.com -E dev" +} +print_help() { + echo "" + print_usage + echo "" +} + +if [ -z $2 ];then + print_usage; + exit 1 +fi + +# parsing arguments + +while getopts ":hP:B:R:S:L:E:" Option; do + case $Option in + h) + print_help + exit 0 + ;; + P) + PRJNAME="${OPTARG}" + ;; + B) + BRANCH="${OPTARG}" + ;; + R) + REVID_PARAM="${OPTARG}" + ;; + S) + REPOSERVER_PARAM="${OPTARG}" + ;; + E) + ENVIRONMENT="${OPTARG}" + ;; + *) + print_help + exit 1 + ;; + esac +done +shift $(($OPTIND - 1)) + +REVID=${REVID_PARAM:-NONE} +REPOSERVER=${REPOSERVER_PARAM:-github-${PRJNAME}} +REPOURL="${REPOSERVER}:kupishoes/${PRJNAME}.git" +ENVIRONMENT=${ENVIRONMENT:-dev} + +BUILDDIR=$(mktemp -d -p . -t ${PRJNAME}-XXXXXX) +pushd -n $PWD +cd ${BUILDDIR} +bdir="$PWD" +( +git clone "${REPOURL}" "${PRJNAME}" && \ +cd "${PRJNAME}" && \ +BRANCHCUR=$(git branch|grep '^*'|cut -f 2 -d ' ') && \ +if [ $BRANCH != "$BRANCHCUR" ];then + git checkout -b $BRANCH origin/$BRANCH +else + echo "branch is specified as $BRANCH, skipping additional checkout" +fi && \ +if [ "$REVID" != "NONE" ];then + git reset --hard "$REVID" +fi +) +if [ $? -ne 0 ];then + echo "git operations failed, exiting" + exit 1 +fi + +pwd && ls -la +#--suppress-packaging-version=True +cd "${PRJNAME}" &&\ +python setup.py sdist || exit 1 + +ssh pypi.moda.local mkdir /data/pypi/local/${ENVIRONMENT}/${PRJNAME} +scp dist/*.tar.gz pypi.moda.local:/data/pypi/local/${ENVIRONMENT}/${PRJNAME}/ || exit 1 +cat ${PRJNAME}.egg-info/PKG-INFO