ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-dev
python-dev
Re: [Python-Dev] Buildbot questions
by Trent Mick other posts by this author
Jan 6 2006 4:12PM messages near this date
Re: [Python-Dev] Buildbot questions | [Python-Dev] Buildbot: doing occasional full builds
>  > To wipe out the build occassionally you could (presumably) add a
>  > starting step to the Python 'builder' (in the build master.cfg) to 
>  >     rm -rf $builddir
>  > every, say, Sunday night.
>  
>  Sure, that would be the idea. How to formulate it?

I think I'm part of the way there with the following. I've subclassed
the "SVN" source build step to add support for new source mode:
"update_and_clobber_occassionally". Basically it (hackily) changes the
source type btwn "update", which we usually want, and "clobber", which
we sometimes want.

The current problem with this is that I don't know if the build step
objects have access to a local data store -- so it could, say, count how
many builds have been done to know to clobber every tenth one. The
current code just chooses to clobber for any build on Sunday. Not a very
satisfying solution.

Brian,
Is there a way for build steps to maintain some state?


    ------------ clipped from the build master's master.cfg -----------------
    ...
    class SVNEx(step.SVN):
        """A SVN Source build step that adds the ability for the Source
        "mode" to be a combination of "update" and "clobber". This is useful if
        your general just want to update the source tree from source code control,
        but occassionally want to clobber and start fresh.

        To use this functionality use mode="update_and_clobber_occassionally".
        To control when "occassionally" is now override the "should_clobber"
        method. The default implementation is currently hardcoded to
        "every Sunday". (This is a HACK. Perhaps there should be constructor
        options to clobber every Nth time or to have cron-like arguments -- see
        "Nightly" in scheduler.py. I don't know if "steps" have access to a local
        data store to be able to do this -- e.g. keep a counter.)

        Ideally this would be an option of the base "Source" class in
        buildbot/process/step.py.
        """
        def __init__(self, **kwargs):
            if kwargs.has_key("mode")                and kwargs["mode"] == "update_and_clobb
er_occassionally":
                self.update_and_clobber_occassionally = True
                kwargs["mode"] = "update"
            else:
                self.update_and_clobber_occassionally = False
            step.SVN.__init__(self, **kwargs)

        def should_clobber(self):
            from datetime import date
            is_sunday = date.today().weekday() == 6 # it is Sunday
            from twisted.python import log
            log.msg("should_clobber? %s", (is_sunday and "yes" or "no"))
            return is_sunday

        def startVC(self, *args, **kwargs):
            if self.update_and_clobber_occassionally:
                if self.should_clobber():
                    self.args["mode"] = "clobber"
                else:
                    self.args["mode"] = "update"
            step.SVN.startVC(self, *args, **kwargs)


    python_factory = factory.GNUAutoconf(
        s(SVNEx, svnurl="http://svn.python.org/projects/python/trunk",
          mode="update_and_clobber_occassionally"),
        test=["make", "test"],  # use `make testall`?
    )

    # Then use python_factory as something like so:
    #c['builders'] = [
    #    {'name': "linux-x86",
    #          'slavename': "...",
    #          'builddir': "python",
    #          'factory': python_factory,
    #          },
    #    ...
    #]
    ------------ clipped from the build master's master.cfg -----------------



Cheers,
Trent

-- 
Trent Mick
trentm@[...].com
_______________________________________________
Python-Dev mailing list
Python-Dev@[...].org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-dev-ml%40activestate.c
om
Thread:
Morel Xavier
Tim Peters
"Martin v. Löwis"
Trent Mick
Brian Warner
John J Lee
Tim Peters
"Martin v. Löwis"
Trent Mick
"Martin v. Löwis"
Trent Mick
Brian Warner
"Martin v. Löwis"
Brian Warner
Trent Mick
"Martin v. Löwis"
skip
Anthony Baxter
"Martin v. Löwis"
Anthony Baxter
John J Lee
"Martin v. Löwis"
skip
Anthony Baxter
"Martin v. Löwis"
Anthony Baxter
"Martin v. Löwis"
Bob Ippolito

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved