[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] Whenjobs automating libguestfs development version test & build



Just a note that 'whenjobs'[1] is now automating libguestfs test and
build, along the development branch.

Simply tagging a new release in git will trigger a cycle of packaging,
test, build, updating the website, and performing a new build in
Fedora Rawhide.

At the moment I'm only doing the tests on Fedora, but I will extend it
later so it tests both individual commits and released tarballs on
Debian, Ubuntu & RHEL.

I also want to extend it to build/test/release stable branches.

The current whenjobs script is attached.

Rich.

[1] http://people.redhat.com/~rjones/whenjobs/

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
let from = "rjones redhat com"
let to_addr = from
let mailto = Whentools.mailto ~from ~only_on_failure:true to_addr
let mailto_always = Whentools.mailto ~from to_addr

(* Every few minutes, check git for new commits and a new tag. *)
job "libguestfs: poll" pre (Whentools.one ())
every 5 minutes :
<<
  cd $HOME/d/builder/libguestfs
  git pull
  commit=`git rev-parse HEAD`
  whenjobs --set libguestfs_commit "$commit"
  tag=`git describe --tags --abbrev=0`
  whenjobs --set libguestfs_version "$tag"
>>

(* When there is a new commit. *)
job "libguestfs: make" pre (Whentools.one ()) post (mailto)
when changes libguestfs_commit :
<<
  # Build it in the tmpdir.
  cp -a $HOME/d/builder/libguestfs build-test
  cd build-test
  git reset --hard $libguestfs_commit
  ./localconfigure
  make distclean
  ./localconfigure
  make
  #make check
>>

(* When there is a new version, make a tarball. *)
job "libguestfs: dist" pre (Whentools.one ()) post (mailto)
when changes libguestfs_version :
<<
  # Give up if the tarball already exists.
  dest="$HOME/d/builder/libguestfs-$libguestfs_version.tar.gz"
  if [ -f "$dest" ]; then
    echo "tarball already exists at $dest"
    exit 1
  fi

  # Build it in the tmpdir.
  cp -a $HOME/d/builder/libguestfs dist-test
  cd dist-test
  git reset --hard $libguestfs_version
  ./localconfigure
  make distclean
  ./localconfigure
  make
  make dist
  cp libguestfs-$libguestfs_version.tar.gz $dest
  whenjobs --set libguestfs_dist $libguestfs_version
>>

(* When there is a new tarball. *)
job "libguestfs: test: local" pre (Whentools.one ()) post (mailto)
when changes libguestfs_dist :
<<
  zcat $HOME/d/builder/libguestfs-$libguestfs_dist.tar.gz | tar xf -
  cd libguestfs-$libguestfs_dist
  ./configure
  make
  make check
  whenjobs --set libguestfs_build_local $libguestfs_dist
>>

(*
job "libguestfs: test: builder-debian6" pre (Whentools.one ()) post (mailto)
when changes libguestfs_dist :
<<
  scp $HOME/d/builder/libguestfs-$libguestfs_dist.tar.gz builder-debian6:/tmp
  ssh builder-debian6 ~/d/builder/make_check $libguestfs_dist
  whenjobs --set libguestfs_build_debian6 "$libguestfs_dist"
>>
*)

(* When make check has passed on all systems. *)
job "libguestfs: release" pre (Whentools.one ()) post (mailto_always)
when changes libguestfs_build_local
     (* && libguestfs_build_local == libguestfs_build_debian6 *) :
<<
  tarball=libguestfs-$libguestfs_build_local.tar.gz
  # XXX
  subdir=1.17-development

  # Give up if the tarball already exists on the website.
  dest="$HOME/d/redhat/websites/libguestfs/download/$subdir/$tarball"
  if [ -f "$dest" ]; then
    echo "tarball already exists at $dest"
    exit 1
  fi

  # Update the website.
  cp $HOME/d/builder/$tarball .
  zcat $tarball | tar xf -
  (
  cd libguestfs-$libguestfs_build_local
  ./configure
  make
  make website
  )

  # Copy tarball to website.
  cp $tarball "$dest"

  # Push website.
  cd $HOME/d/redhat/websites/libguestfs/
  cvs add -kb download/$subdir/$tarball
  cvs ci -m "$tarball"

  # (This fails because the rsync command can't set times)
  . .rsync ||:

  whenjobs --set libguestfs_release "$libguestfs_build_local"
>>

(* When the new upstream release has been done. *)
job "libguestfs: rawhide" pre (Whentools.one ()) post (mailto)
when changes libguestfs_release :
<<
  tarball=libguestfs-$libguestfs_release.tar.gz

  cp $HOME/d/builder/$tarball $HOME/d/fedora/libguestfs/master/
  cd $HOME/d/fedora/libguestfs/master
  fedpkg new-sources $tarball

  # Hairy specfile editing ...
  email="Richard W.M. Jones <rjones redhat com>"
  date=`date +"%a %b %d %Y"`
  cp libguestfs.spec libguestfs.spec.old
  sed < libguestfs.spec.old \
    -e "s/^Version:.*/Version:       $libguestfs_release/" \
    -e "s/^Release:.*/Release:       1%{?dist}/" \
    -e "/^%changelog/a \
* $date $email - 1:$libguestfs_release-1\\n\
- New upstream version $libguestfs_release.\\n\
" > libguestfs.spec

  rm libguestfs.spec.old

  fedpkg commit -m "New upstream version $libguestfs_release."

  # Build.
  fedpkg push
  fedpkg build --nowait
>>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]