Skip to content

Commit

Permalink
initial commit, won't work at this time. but you're invited to leave …
Browse files Browse the repository at this point in the history
…your comments!
  • Loading branch information
nmesstorff committed Jun 28, 2012
1 parent 7ae0cb0 commit 901e57a
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 0 deletions.
3 changes: 3 additions & 0 deletions TODO
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
- change schema to package/repo insted of repo/package
- catch mock error messages
- usage of mock --enable-scm ?
Empty file.
Empty file.
12 changes: 12 additions & 0 deletions schema.txt
Original file line number Original file line Diff line number Diff line change
@@ -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

108 changes: 108 additions & 0 deletions svnmock.sh
Original file line number Original file line Diff line number Diff line change
@@ -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.