Re: Groups in cgit



On Sat, 2009-04-18 at 17:53 -0400, Owen Taylor wrote:
> On Sat, 2009-04-18 at 15:12 -0500, Shaun McCance wrote:
> > Owen and I discussed doing repository groups in cgit using
> > the category property in each module's doap file.  Attached
> > is a patch to make this happen on the server.
> > 
> > Categories in doap are resources, which means they're given
> > using URLs.  To have a simple controlled vocabulary, this
> > uses resources defined in our doap-extensionsd file.
> > 
> > If we do this we should:
> > 
> > 1) Update doap-extensiosn on api.gnome.org.  Attached.
> > (Aside: Should we have a git repo for the contents of
> > api.gnome.org?)
> > 
> > 2) Have Pulse put the category in the template files.  It
> > should be reasonably reliable for our "core" modules.
> 
> Looking through the changes:
> 
>                  elif attrname == (RDF, "resource"):
> -                    resource = attrname
> +                    resource = attrname + (attributes.getValue(attrname),)
> 
> I'm pretty sure that the original use of attrname is just a bug/typo and
> can be replaced attributes.getValue(attrname).
> 
> Which would make:
> 
> +    group = node.find_property((DOAP, "category"))
> +    if isinstance(group, tuple) and len(group) == 3:
> +        group = group[2]
> +        group = groups.get(group, 'Other')
> 
> Simpler.

Fair enough.  I wasn't sure how general-purpose semi_rdf.py
was supposed to be.  Technically, there's a huge difference
between a text property and a property that refers to some
resource defined by some URL.  This would treat them as
exactly the same.

But if that's OK, then that's certainly much simpler.

> +               if test -f $r/gnome_group; then
> +                   group=$(cat $r/gnome_group)
> +               fi;
>                 test -z "$group" || echo repo.group=$group
> 
> Unfortunately, I don't think cgit isn't going to handle this right; I don't
> see any code in cgit to sort the repos by group - it just inserts a header
> between adjacent repos in different groups.
> 
> Of course, having to sort isn't fun in shell. Something along the untested lines of:
> 
> ===
> for $r in $dirs ; do
>     if test -f $r/gnome_group; then
>         echo $r $(cat $r/gnome_group) 
>     else
>         echo $r "Other" 
>     fi
> done | sort -k 2 -k 1,1 |
> while read r group ; do
>     # Output information for $r and $group
> done
> ===
> 
> Probably works. (And gets you into the "just because you *can* do it in
> shell, should you do it in shell?" land.)

Uh huh.  I left it in shell because just sticking in the
extra group slurping was easy enough in shell.  I didn't
realize cgit doesn't handle that.  In that case, I'd be
inclined to rewrite find-cgit-repos in Python.

--
Shaun




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