Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "E4/Git"

< E4
(Submitting for a build)
(Current Repos)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
Some resources:
 +
 +
* Git - http://git-scm.com/
 +
* Pro Git - http://progit.org/book/
 +
* Git tutorial http://www.vogella.de/articles/Git/article.html
 +
* [[Platform-releng/Git Workflows]]
 +
 
== Git in e4 ==
 
== Git in e4 ==
  
Line 5: Line 12:
 
=== Current Repos ===
 
=== Current Repos ===
  
* git://git.eclipse.org/gitroot/e4/org.eclipse.e4.deeplink.git
+
See them at [http://git.eclipse.org/c/e4/ http://git.eclipse.org/c/e4/].
* git://git.eclipse.org/gitroot/e4/org.eclipse.e4.utils.git
+
* git://git.eclipse.org/gitroot/e4/org.eclipse.e4.installer.git
+
  
 
A repo then follows our standard subdir convention:
 
A repo then follows our standard subdir convention:
Line 13: Line 18:
 
* features
 
* features
 
* examples
 
* examples
 +
* releng
 
* tests
 
* tests
  
We build our git repos still using map files, checked into CVS in the '''/cvsroot/eclipse''' ''e4/releng'' module.
+
When creating a repo on the server, follow these steps (Please update them if there are better steps :-)
 +
 
 +
# log into git.eclipse.org
 +
# cd /gitroot/e4
 +
# mkdir component.id.git # ex: mkdir org.eclipse.e4.search.git
 +
# cd component.id.git
 +
# git init --bare
 +
 
 +
This creates a bare repo that can be cloned.  Then on your work machine
 +
 
 +
# git clone ssh://pwebster@git.eclipse.org/gitroot/e4/component.id.git
 +
# cd component.id
 +
# mkdir bundles features examples releng tests
 +
# add a useful .gitignore.  See below
 +
# copy in your plugins into bundles, features into features, test plugins into tests, etc
 +
# add all of your files: git add -A
 +
# commit them with a useful commit message
 +
# add 2 tags.  One will be ''initial-import''.  The other should be a time tag, like v20101124-0800
 +
# I split the next step up into 2:
 +
## git push origin master
 +
## git push --tags origin
 +
 
 +
 
 +
 
 +
Example .gitignore
 +
bin/
 +
*~
 +
*.rej
 +
*.bak
 +
javacore.*
 +
heapdump.*
 +
core.*
 +
Snap.*
 +
 
 +
 
 +
 
 +
Our git repos no longer use the map files.
 +
 
 +
=== Submitting for a build  ===
 +
<blockquote>''Note:'' We have a policy that all commits have the associated bug number. Usually our format is: "Bug &lt;number&gt; - &lt;bug title&gt;" and then any specific comments after the title or on the next line. It's important that we only list 1 bug # per line, and at the beginning of the line. A line with "bug #" or "Bug #" without the title is also acceptable. <br> </blockquote>
 +
 
 +
 
 +
'''This information is now available for legacy information''', as we use "auto-tagging" of the '''master''' branch to submit changes to the build.
 +
 
 +
We have 2 scripts used for submitting for the build. One to update the map files, and one to generate the submission report for our mailing list e4-dev@eclipse.org
 +
 
 +
 
 +
[http://dev.eclipse.org/viewcvs/index.cgi/e4/releng/org.eclipse.e4.builder/scripts/git-map.sh?view=co&content-type=text/plain git-map.sh] is used to update the map files.The output is a set of commands which should be captured, reviewed and then executed to update the map files.<br>
 +
 
 +
[http://dev.eclipse.org/viewcvs/index.cgi/e4/releng/org.eclipse.e4.builder/scripts/git-submission.sh?view=co&content-type=text/plain git-submission.sh] is used to generate a build submission report. The last command output by git-map.sh will be a call to git-submission.sh saving the output to "report.txt".<br>
 +
 
 +
<br> When submitting for a build, the git repository clones should be checked out on the branch you wish to tag.<br>
 +
 
 +
The git-map.sh takes the following arguments:
 +
 
 +
git-map.sh repoRoot relengRoot repoUrl [repoUrl]*
 +
 
 +
*repoRoot: an absolute path to a folder containing cloned git repositories
 +
*relengRoot: an absolute path to the releng project containing the map files
 +
*repoUrl - git repository URLs to tag
  
=== Submitting for a build ===
+
The script performs the following steps:
  
We have 2 scripts used for submitting for the build. One to update the map files, and one to generate the submission report for our mailing list e4-dev@eclipse.org
+
#Find all the map files under '''relengRoot'''
 +
#For each map file, find all entries containing "repo='''repoUrl'''" where repoUrl is one of the passed in git repositories
 +
#For each git map file entry, find the corresponding project under the git repository clone under '''repoRoot'''.  
 +
#Check if the last commit in the project has the current tag from the map file, if not tag and output a command to update the map file
  
[http://dev.eclipse.org/viewcvs/index.cgi/e4/releng/org.eclipse.e4.builder/scripts/git-map.sh?view=co&content-type=text/plain git-map.sh] is used to update the map files.
+
For example, consider a git repository git://git.eclipse.org/gitroot/org.eclipse.e4.deeplink.git. If '''repoRoot=/eclipse/git''' then the script expects a subfolder '''/eclipse/git/org.eclipse.e4.deeplink''' which is a clone of this repository.&nbsp; The releng map files are under '''/eclipse/workspace/e4-releng'''.&nbsp; The command line to invoke git-map.sh would be:<br>
 +
<pre>repoRoot: /eclipse/git
 +
          /eclipse/git/org.eclipse.e4.deeplink  #deeplink clone
 +
          /eclipse/git/org.eclipse.e4.search    #search clone
  
[http://dev.eclipse.org/viewcvs/index.cgi/e4/releng/org.eclipse.e4.builder/scripts/git-submission.sh?view=co&content-type=text/plain git-submission.sh] is used to generate a build submission report.
+
relengRoot: /eclipse/workspace/e4-releng        #project containing map files
 +
            /eclipse/workspace/e4-releng/org.eclipse.e4.deeplink.releng/maps/deeplink.map
 +
            /eclipse/workspace/e4-releng/org.eclipse.e4.search.releng/maps/search.map
  
''Note:'' We have a policy that all commits have the associated bug number.  Usually our format is:
 
Bug <number> - <bug title>
 
and then any specific comments after the title or on the next line.  It's important that we only list 1 bug # per line, and at the beginning.  A line with "bug #" or "Bug #" without the title is also acceptable.
 
  
When ready to submit deeplinking for the build, you have to submit 2 repos, org.eclipse.e4.deeplink and org.eclipse.e4.utils. For each repo:
+
/bin/bash git-map.sh /eclipse/git \
 +
                    /eclipse/workspace/e4-releng \
 +
                    git://git.eclipse.org/gitroot/e4/org.eclipse.e4.deeplink.git \
 +
                    git://git.eclipse.org/gitroot/e4/org.eclipse.e4.search.git &gt; maps.txt 
  
#cd into the repo (make sure it's up to date, you're on the master branch, etc)
+
more maps.txt                                      #examine maps.txt
#tag the repo: git tag v20101022-1030 # we use vDATE-TIME as our tag
+
grep -v ^OK maps.txt | grep -v ^Executed &gt; run.txt #filter out status lines to create a runnable script
#make sure you push the tag back to the public repo
+
/bin/bash run.txt                                  #run the commands, the last command is a call to git-submission.sh
$ /bin/bash git-map.sh v20101022-1030 /opt/pwebster/workspaces/e4/releng/org.eclipse.e4.deeplink.releng/maps/deeplink.map  bundles
+
more report.txt                                    #examine submission report
 +
</pre>
  
You'll have to execute the script for each subdiretory: bundles, examples, features, tests.  Repeat the steps for the second repoThen refresh your workspace and commit.
+
The script does not commit the map file changesThe map files should be reviewed and manually commited.
  
Then when done you can generate your build submission report for the e4-dev list:
+
[[Category:Git]]
$ /bin/bash git-submission.sh >report.txt
+

Latest revision as of 12:25, 20 June 2014

Some resources:

Git in e4

We have a place in e4 for git repositories.

Current Repos

See them at http://git.eclipse.org/c/e4/.

A repo then follows our standard subdir convention:

  • bundles
  • features
  • examples
  • releng
  • tests

When creating a repo on the server, follow these steps (Please update them if there are better steps :-)

  1. log into git.eclipse.org
  2. cd /gitroot/e4
  3. mkdir component.id.git # ex: mkdir org.eclipse.e4.search.git
  4. cd component.id.git
  5. git init --bare

This creates a bare repo that can be cloned. Then on your work machine

  1. git clone ssh://pwebster@git.eclipse.org/gitroot/e4/component.id.git
  2. cd component.id
  3. mkdir bundles features examples releng tests
  4. add a useful .gitignore. See below
  5. copy in your plugins into bundles, features into features, test plugins into tests, etc
  6. add all of your files: git add -A
  7. commit them with a useful commit message
  8. add 2 tags. One will be initial-import. The other should be a time tag, like v20101124-0800
  9. I split the next step up into 2:
    1. git push origin master
    2. git push --tags origin


Example .gitignore

bin/
*~
*.rej
*.bak
javacore.*
heapdump.*
core.*
Snap.*


Our git repos no longer use the map files.

Submitting for a build

Note: We have a policy that all commits have the associated bug number. Usually our format is: "Bug <number> - <bug title>" and then any specific comments after the title or on the next line. It's important that we only list 1 bug # per line, and at the beginning of the line. A line with "bug #" or "Bug #" without the title is also acceptable.


This information is now available for legacy information, as we use "auto-tagging" of the master branch to submit changes to the build.

We have 2 scripts used for submitting for the build. One to update the map files, and one to generate the submission report for our mailing list e4-dev@eclipse.org


git-map.sh is used to update the map files.The output is a set of commands which should be captured, reviewed and then executed to update the map files.

git-submission.sh is used to generate a build submission report. The last command output by git-map.sh will be a call to git-submission.sh saving the output to "report.txt".


When submitting for a build, the git repository clones should be checked out on the branch you wish to tag.

The git-map.sh takes the following arguments:

git-map.sh repoRoot relengRoot repoUrl [repoUrl]*
  • repoRoot: an absolute path to a folder containing cloned git repositories
  • relengRoot: an absolute path to the releng project containing the map files
  • repoUrl - git repository URLs to tag

The script performs the following steps:

  1. Find all the map files under relengRoot
  2. For each map file, find all entries containing "repo=repoUrl" where repoUrl is one of the passed in git repositories
  3. For each git map file entry, find the corresponding project under the git repository clone under repoRoot.
  4. Check if the last commit in the project has the current tag from the map file, if not tag and output a command to update the map file

For example, consider a git repository git://git.eclipse.org/gitroot/org.eclipse.e4.deeplink.git. If repoRoot=/eclipse/git then the script expects a subfolder /eclipse/git/org.eclipse.e4.deeplink which is a clone of this repository.  The releng map files are under /eclipse/workspace/e4-releng.  The command line to invoke git-map.sh would be:

repoRoot: /eclipse/git 
          /eclipse/git/org.eclipse.e4.deeplink  #deeplink clone
          /eclipse/git/org.eclipse.e4.search    #search clone

relengRoot: /eclipse/workspace/e4-releng        #project containing map files
            /eclipse/workspace/e4-releng/org.eclipse.e4.deeplink.releng/maps/deeplink.map
            /eclipse/workspace/e4-releng/org.eclipse.e4.search.releng/maps/search.map


/bin/bash git-map.sh /eclipse/git \
                     /eclipse/workspace/e4-releng \
                     git://git.eclipse.org/gitroot/e4/org.eclipse.e4.deeplink.git \
                     git://git.eclipse.org/gitroot/e4/org.eclipse.e4.search.git > maps.txt   

more maps.txt                                       #examine maps.txt
grep -v ^OK maps.txt | grep -v ^Executed > run.txt  #filter out status lines to create a runnable script
/bin/bash run.txt                                   #run the commands, the last command is a call to git-submission.sh
more report.txt                                     #examine submission report

The script does not commit the map file changes. The map files should be reviewed and manually commited.

Back to the top