Bug 402384 - Create a default CONTRIBUTING file for eclipse.org Git repos
Summary: Create a default CONTRIBUTING file for eclipse.org Git repos
Status: RESOLVED FIXED
Alias: None
Product: Community
Classification: Eclipse Foundation
Component: Git (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eclipse Webmaster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 389215
  Show dependency tree
 
Reported: 2013-03-04 16:07 EST by Wayne Beaton CLA
Modified: 2017-03-02 18:57 EST (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wayne Beaton CLA 2013-03-04 16:07:28 EST
There seems to be an evolving standard of having a "CONTRIBUTING" file in the root of a git repository (I've seen this sort of thing in repos on GitHub [1], for example). Naturally, the file describes how to contribute to the project, including a brief overview of the IP process (with links), how to use Gerrit, CLAs (when we get to that point), etc.

We should endeavor to keep the content concise.

Is there any means of creating this file automatically when a new Git repo is provisioned?

Creating this in the wiki is probably the most accessible means. Thoughts?

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=391473#c8
Comment 1 Wayne Beaton CLA 2013-03-12 20:39:52 EDT
Include discussion of supported mirrors (e.g. GitHub or Google Source), including whether or not the project can accept GitHub pull requests.
Comment 2 Denis Roy CLA 2014-05-07 16:18:54 EDT
I think this is super important.

Is there anything the CBI project can do to help?  Do we need to scan each of our repos to see if a CONTRIBUTING file is present and if not, open individual bugs against them?
Comment 3 Wayne Beaton CLA 2014-05-08 14:55:50 EDT
I wrote a little script that automatically generates content.

https://wiki.eclipse.org/Architecture_Council/Contributor_Guide_Recommendation#Automagic_Generation

If we could automatically generate pull requests (or Gerrit review requests), that'd be awesome.
Comment 4 Denis Roy CLA 2014-05-08 15:42:24 EDT
I could perhaps leverage Genie to file a bug...  Not sure about a code review.

This one-liner will scan the repos and count the CONTRIBUTING files:

for i in $(find /home/data/git -maxdepth 3 -name '*.git' -type d | sort | sed -e 's#/home/data/git##'); do echo -n $i: ; ./wget -q -O - http://git.eclipse.org/c/$i/tree/ | grep -oci "CONTRIBUTING"; done
Comment 5 Thanh Ha CLA 2014-05-08 15:44:32 EDT
(In reply to Denis Roy from comment #4)
> I could perhaps leverage Genie to file a bug...  Not sure about a code
> review.
> 
> This one-liner will scan the repos and count the CONTRIBUTING files:
> 
> for i in $(find /home/data/git -maxdepth 3 -name '*.git' -type d | sort |
> sed -e 's#/home/data/git##'); do echo -n $i: ; ./wget -q -O -
> http://git.eclipse.org/c/$i/tree/ | grep -oci "CONTRIBUTING"; done


They might have CONTRIBUTING.md files too so maybe have to account for both.
Comment 6 Denis Roy CLA 2014-05-08 15:47:25 EDT
> They might have CONTRIBUTING.md files too so maybe have to account for both.

Yup, regexp "CONTRIBUTING" will match that.
Comment 7 Denis Roy CLA 2014-05-08 15:59:53 EDT
If I only scan Gerrit repos, I guess I could clone those who have nothing, add the automated file from PMI then commit+push the change request...

for i in $(find /home/data/git/gerrit/ -maxdepth 3 -name '*.git' | sort | sed -e 's#/home/data/git/gerrit##' | egrep -v "^/www.eclipse.org"); do COUNT=$(./wget -q -O - http://git.eclipse.org/c/$i/tree/ | grep -ci "CONTRIBUTING"); if [ $COUNT -eq 0 ]; then echo "$i HAS NOTHING"; fi;  done

Do we have a mechanism to map a project's short name to its full name so I can call PMI?  All I have is "e4" and "equinox"...
Comment 8 Denis Roy CLA 2014-05-09 08:57:13 EDT
Adding a dependency on bug 434494

If I can get just a list of projects, I can grep through it and find the full project name and hence get the Gerrit project (Gerrit does provide a list of projects in plaintext, but I'd need to use SSH).
Comment 9 Denis Roy CLA 2014-05-14 13:36:32 EDT
> If I can get just a list of projects

egrep and sed to the rescue:
wget -qO - https://projects.eclipse.org/list-of-projects | egrep "<a href=\"/projects/" | sed -e 's#.*<a href="/projects/##' | sed -e 's#">.*##'
Comment 10 Denis Roy CLA 2014-05-14 14:31:20 EDT
https://git.eclipse.org/r/#/c/26543/

Before I do them all, how does that look?
Comment 11 Wayne Beaton CLA 2014-05-14 16:48:53 EDT
(In reply to Denis Roy from comment #10)
> https://git.eclipse.org/r/#/c/26543/
> 
> Before I do them all, how does that look?

It looks about right.

Are you addressing projects with multiple Git repositories?
Comment 12 Denis Roy CLA 2014-05-15 09:06:53 EDT
I am crawling Gerrit repos which do not contain a file called CONTRIBUTING*
Comment 13 Denis Roy CLA 2014-05-15 10:07:19 EDT
For documentation's sake, here is the one-liner I used:

~/wget -qO - https://projects.eclipse.org/list-of-projects | egrep "<a href=\"/projects/" | sed -e 's#.*<a href="/projects/##' | sed -e 's#">.*##' > projectlist; for i in $(find /home/data/git/gerrit/ -maxdepth 3 -name '*.git' | sort | sed -e 's#/home/data/git/gerrit##' | egrep -v "^/www.eclipse.org" | egrep -v "exclusion_list_here"); do COUNT=$(~/wget -q -O - http://git.eclipse.org/c/$i/tree/ | grep -ci "CONTRIBUTING"); if [ $COUNT -eq 0 ]; then PROJECT=$(echo $i | egrep -o "^/[a-zA-Z0-9_-]+" | sed -e 's#/##'); PROJECTFULL=$(egrep "$PROJECT" projectlist | head -n 1); echo "Project $PROJECT ($PROJECTFULL) in $i HAS NOTHING"; if [ -n "$PROJECTFULL" ]; then ~/wget -qO CONTRIBUTING http://www.eclipse.org/projects/tools/default_contributing_file.php?id=$PROJECTFULL; if [ -s CONTRIBUTING ]; then echo "We have a CONTRIBUTING file for $PROJECTFULL - cloning code"; git clone ssh://droy@git.eclipse.org:29418$i project; cd project; cp ../CONTRIBUTING .; git add CONTRIBUTING; git commit -s -m "Bug: 402384 Add CONTRIBUTING file" CONTRIBUTING; git push origin HEAD:refs/for/master; echo "Done.. Press any key"; read; cd ~/git; rm -rf project/; fi fi; fi;  done


I've submitted changes 26593 ~ 26663 using this. It was not successful on all repos, as some had additional restrictions that caused the change to fail (Hudson voted -1, change-id was required). I don't intend on performing something similar to the pure Git repos as I don't feel opening a bug and attaching a patch will yield reasonable results.

From here I'll close this as FIXED.
Comment 14 Denis Roy CLA 2014-05-15 10:07:29 EDT
.
Comment 15 Eclipse Genie CLA 2017-02-28 13:41:47 EST
New Gerrit change created: https://git.eclipse.org/r/92034