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

Re: .changes files as first-class objects



"Adam D. Barratt" <adam@adam-barratt.org.uk> writes:

> I had a feeling I might have been over-complicating things. :)
> Something like the following should work, afaics (intentionally only
> creating the new directory if the top-level directory exists and
> therefore stands a chance of being an existing lab):

> --- a/lib/Lab.pm
> +++ b/lib/Lab.pm
> @@ -61,6 +61,11 @@ sub setup {
>         $self->{mode} = 'static';
>         $self->{dir} = $dir;
>         $self->{dist} = $dist;
> +       
> +       if (-d "$dir" && ! -d "$dir/changes") {
> +           mkdir("$dir/changes", 0777)
> +               or fail("cannot create lab directory $dir/changes");
> +       }
>      } else {
>         $self->{mode} = 'temporary';

I would check that $dir/binary exists instead, since that's a slightly
more reliable check that it's a lab, but otherwise, yes, that's the sort
of thing I was thinking of.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: