Permalink
Browse files

initial commit, won't work at this time. but you're invited to leave …

…your comments!
  • Loading branch information...
1 parent 7ae0cb0 commit 901e57a08d1371b5a79541328d8ed6557a435dbc @nmesstorff committed Jun 28, 2012
Showing with 123 additions and 0 deletions.
  1. +3 −0 TODO
  2. 0 package/testing/SOURCES/package-1.0.tar.gz
  3. 0 package/testing/SPECS/package.spec
  4. +12 −0 schema.txt
  5. +108 −0 svnmock.sh
View
3 TODO
@@ -0,0 +1,3 @@
+ - change schema to package/repo insted of repo/package
+ - catch mock error messages
+ - usage of mock --enable-scm ?
View
0 package/testing/SOURCES/package-1.0.tar.gz
No changes.
View
0 package/testing/SPECS/package.spec
No changes.
View
12 schema.txt
@@ -0,0 +1,12 @@
+package/
+├── stable
+│ ├── SOURCES
+│ │   └── package-1.0.tar.gz
+│ └── SPECS
+│ └── package.spec
+└── testing
+ ├── SOURCES
+ │   └── package-1.0.tar.gz
+ └── SPECS
+ └── package.spec
+
View
108 svnmock.sh
@@ -0,0 +1,108 @@
+#!/bin/bash
+#set -x
+# Startup check
+REPO="$1"
+REV=$2
+RESULTDIR="/data/result"
+
+if [ -z "${REPO}" ]; then
+ REPO=/Users/normes/svn/mocktest.svn/
+ REV=22
+fi
+REPO="${REPO}/"
+TMPDIR=${REPO}tmp
+
+shopt -s nullglob
+
+#
+# local basic functions
+#
+function log {
+ logger -t "$0" "$@"
+ echo "$@"
+}
+
+function die {
+ logger -s -t "$0" "ERROR: $@"
+ echo "$@"
+ exit 1
+}
+
+
+#
+# prepare envireonment
+#
+log starting "$REPO" "$REV"
+
+mkdir -p ${TMPDIR} ${RESULTDIR}
+cd ${TMPDIR} || "Could not cd into ${TMPDIR}"
+# prevent us to NOT delete the whole hdd :)
+if [ ${#TMPDIR} -gt 5 ]; then
+ rm -rf ${TMPDIR}/*
+else
+ die "problems with TMPDIR (${TMPDIR})!"
+fi
+
+
+#
+# check changed repos
+#
+REPOS=()
+for repository in `svnlook dirs-changed --revision ${REV} "${REPO}"`; do
+ currentrepo=${repository%%/*}
+
+ # check duplicate values
+ duplicated=false
+ for dup in ${REPOS[@]}; do
+ if [ "${dup}" == "${currentrepo}" ]; then
+ duplicated=true
+ break;
+ else
+ continue;
+ fi
+ done
+
+ # add value to array
+ if [ $duplicated == false ]; then
+ log " * repo changed: '${currentrepo}'"
+ REPOS=("${REPOS[@]}" "${currentrepo}")
+ fi
+done
+
+
+#
+# working thru changed packages in all repos
+#
+for repository in ${REPOS[@]}; do
+ #
+ # changed packages
+ #
+ PACKAGES=()
+ for package in `svnlook dirs-changed --revision ${REV} "${REPO}"`; do
+ currentpkg=${package##$repository/}
+ currentpkg=${currentpkg%%/*}
+
+ log " * package changed: '${repository}/${currentpkg}'"
+ PACKAGES=("${PACKAGES[@]}" "${currentpkg}")
+ done
+
+ #
+ # svn export into TMPDIR
+ #
+ echo ${PACKAGES}
+ for package in ${PACKAGES[@]}; do
+ svn export -r $REV file:///"$REPO""${repository}/""${package}"/ --force
+ mkdir -p "${package}"/{RPMS,SRPMS}
+ log " . building SRPM '${repository}/${package}'"
+ mock --resultdir="${package}"/SRPMS/ --buildsrpm --spec "${package}"/SPECS/"${package}".spec --source "${package}"/SOURCES/
+ RET=$?
+ log " . [DONE=${RET}] building SRPM '${repository}/${package}'"
+ log " . building binary RPM '${repository}/${package}'"
+ mock --resultdir="${package}"/RPMS/ --rebuild "${package}"/SRPMS/*.src.rpm
+ RET=$?
+ log " . [DONE=${RET}] building binary RPM '${repository}/${package}'"
+ mv "${package}"/{RPMS,SRPMS} ${RESULTDIR}
+ done
+done
+
+exit $?

0 comments on commit 901e57a

Please sign in to comment.