[bob-build-tool] Re: Howto query for source dirs on switched branch

  • From: Jan Klötzke <jan@xxxxxxxxxxxx>
  • To: bob-build-tool@xxxxxxxxxxxxx
  • Date: Fri, 21 Oct 2016 20:19:09 +0200

On Fri, Oct 21, 2016 at 07:13:07PM +0200, Ralf wrote:

I did some tests with the script today. Besides the some performance
problems (it took more than 5 minutes to complete?!) this is only half of
the story as Tom already mentioned.

The obvious problem of the script is to call bob for every SCM to get
the source path of the package. That could certainly be done more
intelligent. This is left as an exercise to the reader... ;-)

Developers probably also need to know if
they have a clean working copy, if they have unpushed commits, if the
commit-Id  / revision / tag from the recipe matches used commitId revision /
tag , ...

All of these cases can be handled by a script, but I like the idea of having
a 'bob status' and 'force checkout'. Maybe I find some time to start working
on this...

The status command and the force checkout make quite a lot of sense. If
you want to implement something the following things could be of help:

 * The SCMs must be extended to query the state of a working copy. I
   guess they should return something like clean/dirty/switched/error.
 * You have to check if the directory holds the current SCM. The logic
   for that is in _cookCheckoutStep(). This method calls
   BobState().getDirectoryState() to get a dict of digests. Only if the
   digest of a directory matches you may let the SCM look into the
   directory.
 * If the force checkout encounters a non-clean directory you should
   move it into the attic. The generated checkout script will do the
   clean checkout then.

There could be a minor problem with sandboxes. Normally the SCM
executable of the sandbox is called. Now, if bob checks the state
directly, the host version will be used. But that is only a minor
problem.

On 21.10.2016 08:59, Thomas Feher wrote:
Hi,

such a feature is very interesting for us, too. At the moment we do have
a script, that goes through each "workspace" directory in dev/src und
performs a "git status". This way we can check if the working copy is in
a dirty state or not. But we can not check if the correct revision is
checked out, because that information is hidden in the recipes, and we
do not want to re-implement parsing them, of course.

So I would like to see something like "bob status <recipe>" that shows
me, which repository has the wrong revision checked out, so I can change
those to my liking. But I see the problem that this could be hard to
make SCM-agnostic.

Tom

Other related posts: