Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345669 - Ensure Copyright Checker/Updater works with Git
Summary: Ensure Copyright Checker/Updater works with Git
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 3.7   Edit
Hardware: PC All
: P2 normal (vote)
Target Milestone: 3.8 M7   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 349243 (view as bug list)
Depends on:
Blocks: 345479 354496
  Show dependency tree
 
Reported: 2011-05-12 16:51 EDT by DJ Houghton CLA
Modified: 2012-05-31 09:33 EDT (History)
17 users (show)

See Also:
john.arthorne: review+


Attachments
GitCopyrightAdapter (7.45 KB, patch)
2012-03-06 10:56 EST, Tomasz Zarna CLA
no flags Details | Diff
GitCopyrightAdapter - tests (9.28 KB, patch)
2012-03-06 10:58 EST, Tomasz Zarna CLA
no flags Details | Diff
GitCopyrightAdapter v02 (7.60 KB, patch)
2012-03-06 11:47 EST, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (63.14 KB, application/octet-stream)
2012-03-06 11:47 EST, Tomasz Zarna CLA
no flags Details
GitCopyrightAdapter - tests v02 (9.63 KB, patch)
2012-03-06 11:48 EST, Tomasz Zarna CLA
no flags Details | Diff
GitCopyrightAdapter v03 (7.67 KB, patch)
2012-04-23 05:33 EDT, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2011-05-12 16:51:05 EDT
As part of the work to move from CVS to Git (bug 345479) we need to ensure the RelEng Tools Copyright Updater works correctly against a Git repository.
Comment 1 John Arthorne CLA 2011-05-13 09:25:54 EDT
I can verify that the copyright checker works ok against Git projects. The only missing thing is that it doesn't check the commit history to determine the appropriate year to write in the copyright. It instead gracefully falls back to the current year. Obviously computing the correct year from the Git history would be useful.
Comment 2 John Arthorne CLA 2011-05-13 09:28:47 EDT
(In reply to comment #1)
> I can verify that ...

I meant to say, I *have* verified that...
Comment 3 John Arthorne CLA 2011-06-13 17:31:19 EDT
*** Bug 349243 has been marked as a duplicate of this bug. ***
Comment 4 Martin Oberhuber CLA 2011-07-13 15:54:09 EDT
I'd assume that it also doesn't check whether the last commit comment had the
String "copyright" in it indicating that a manual fixup was made and thus no
change of copyright is needed.
Comment 5 Dani Megert CLA 2011-07-14 02:36:36 EDT
(In reply to comment #4)
> I'd assume that it also doesn't check whether the last commit comment had the
> String "copyright" in it indicating that a manual fixup was made and thus no
> change of copyright is needed.

John, did you test that? This one is a must fix for me.
Comment 6 John Arthorne CLA 2011-07-18 15:25:57 EDT
(In reply to comment #4)
> I'd assume that it also doesn't check whether the last commit comment had the
> String "copyright" in it indicating that a manual fixup was made and thus no
> change of copyright is needed.

Right. Since it is not git-aware it doesn't search commit comments like this yet.
Comment 7 Kim Moir CLA 2012-01-24 15:04:09 EST
Tomasz, are you still working on this, if so the target milestone needs to be moved.
Comment 8 Szymon Brandys CLA 2012-01-25 04:24:41 EST
(In reply to comment #7)
> Tomasz, are you still working on this, if so the target milestone needs to be
> moved.

Tomek planned to start working on it late in M5 and continue in M6. So the feature should be added during M6. Changing the target.
Comment 9 Tomasz Zarna CLA 2012-03-02 09:38:14 EST
A fix and tests have been pushed to Gerrit as https://git.eclipse.org/r/#/c/5223/ and https://git.eclipse.org/r/#/c/5224/ respectively.
Comment 10 Tomasz Zarna CLA 2012-03-06 10:56:06 EST
Created attachment 212139 [details]
GitCopyrightAdapter

The fix adds dependencies on org.eclipse.jgit and org.eclipse.egit.core
Comment 11 Tomasz Zarna CLA 2012-03-06 10:58:18 EST
Created attachment 212140 [details]
GitCopyrightAdapter - tests

This one also adds deps on JGit/EGit but also bumps Java to 1.5. Not sure if this is ok.
Comment 12 Tomasz Zarna CLA 2012-03-06 11:02:43 EST
These are basically the same patches as in https://git.eclipse.org/r/#/c/5223/ and https://git.eclipse.org/r/#/c/5224/ from EGit/PDE. I'm a Platform/Releng committer, but still would like to have +1 from someone else.
Comment 13 Tomasz Zarna CLA 2012-03-06 11:13:08 EST
Hold your horses! Even though the test pass, when I ran the action on eclipse.platform.team it touched all the files. So there is obviously something wrong with it. Investigating...
Comment 14 John Arthorne CLA 2012-03-06 11:15:05 EST
(In reply to comment #10)
> 
> The fix adds dependencies on org.eclipse.jgit and org.eclipse.egit.core

I think the new dependency makes sense. But there will likely need to be a builder change to make sure the required eGit bundles are fetched at build-time. If it helps here is the map entry from Orion's build:

plugin@org.eclipse.jgit=p2IU,id=org.eclipse.jgit,repository=http://download.eclipse.org/egit/updates

plugin@org.eclipse.egit.core=p2IU,id=org.eclipse.egit.core,repository=http://download.eclipse.org/egit/updates

This pulls from eGit's release update site. I think we should avoid using eGit nightly builds and using unreleased API if possible.
Comment 15 Tomasz Zarna CLA 2012-03-06 11:22:35 EST
(In reply to comment #14)
> I think we should avoid using eGit
> nightly builds and using unreleased API if possible.

Totally agree, I sticked to stable 1.3.0 in both patches.
Comment 16 Tomasz Zarna CLA 2012-03-06 11:47:37 EST
Created attachment 212145 [details]
GitCopyrightAdapter v02
Comment 17 Tomasz Zarna CLA 2012-03-06 11:47:41 EST
Created attachment 212146 [details]
mylyn/context/zip
Comment 18 Tomasz Zarna CLA 2012-03-06 11:48:21 EST
Created attachment 212147 [details]
GitCopyrightAdapter - tests v02
Comment 19 Tomasz Zarna CLA 2012-03-06 11:49:52 EST
Now, this time the updater will work as expected.
Comment 20 John Arthorne CLA 2012-03-07 17:18:06 EST
Looks good Tomasz. I think you can go ahead and release. I tried it out on a couple of projects and manually verified the results. I think we should let people on the team know it is available, but suggest they carefully check the results at first to make sure it looks reasonable. Since this change only affects the date calculation logic, and not the code that actually modifies the files, the worst case is that it inserts the wrong date rather than mangling files.
Comment 21 Tomasz Zarna CLA 2012-03-09 07:42:38 EST
Thanks for looking at this. The only missing bit now is the required builder change due to the new dep on JGit and EGit/Core (comment 14). 

I know that Kim is extremely busy right now, so if she doesn't find time to comment how to update the builder I will have a look at it next week.
Comment 22 Tomasz Zarna CLA 2012-03-19 09:31:50 EDT
David, could you please comment on the required builder change to make sure it doesn't blow up missing new dependencies on JGit/EGit bundles.
Comment 23 John Arthorne CLA 2012-03-20 17:01:49 EDT
Let's worry about this one after EclipseCon. We're having enough trouble just getting our builds going right now.
Comment 24 Szymon Brandys CLA 2012-04-06 07:51:25 EDT
I made a pass on core.resources and core.tests.resources. I couldn't find any false positives or undiscovered changes. It works good.
Comment 25 Tomasz Zarna CLA 2012-04-06 10:12:40 EDT
I ran it against all projects from eclipse.platform.compare. It resulted in 200 changes:
* 1 valid fix for /org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/WorkbenchHistoryPageSite.java
* 2 suggested fixes with new copyright sections and year 2012. I don't think 2012 is the best choice here.
** /org.eclipse.core.net/natives/unix/gnomeproxy.h
** /org.eclipse.core.net/natives/win32/jWinHttp.h
* 2 suggested fixes with new copyright sections and year 2012 for dummy files in tests.
** /org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.c
** /org.eclipse.team.tests.cvs.core/resources/CommandTest/project3/src/file.h
* 195 changes for the f0e53ee2640b02d1f95f87dfcfa88331c3336845 move made as part of bug 359032.

What do you think about ignoring the last two (dummy files and compare move)?

Other than that looks good.
Comment 26 Tomasz Zarna CLA 2012-04-18 06:17:16 EDT
David any news on the required builder change (comment 21)? Can I be of any help?
Comment 27 David Williams CLA 2012-04-18 15:45:59 EDT
(In reply to comment #26)
> David any news on the required builder change (comment 21)? Can I be of any
> help?

Well, now as comment 21 says, "Kim" is still very busy  Where Kim is me. :) My first priorities are getting the builds running and then unit tests running ... but, while I'm waiting for a test build to finish ... 

You can help by spelling out to me some of the "big picture" ...

This copyright tool used to be in "org.eclipse.releng.tools" bundle, right? 

The patches appear to be in a git repository? I've heard this "releng tool" is supposed to "move back" to platform ... has that happened yet? Or, am I way off base? 

Second, does/is Eclipse SDK making egit/jgit available as part of the "Eclipse SDK"? Like they do CVS? I seem to recall hearing they would, but ... don't see them included, so just wondering what/why the conclusion was? 

Depending on the answers to those questions, would lead to the next one ... are you looking to _package_ egit/jgit with the tool? Or, just have it available during the build, but not specifically not "included" with the tool itself. 

Thanks,,
Comment 28 John Arthorne CLA 2012-04-18 16:10:21 EDT
(In reply to comment #27)
> This copyright tool used to be in "org.eclipse.releng.tools" bundle, right? 

Yes.

> The patches appear to be in a git repository? I've heard this "releng tool" is
> supposed to "move back" to platform ... has that happened yet? Or, am I way off
> base? 

The plan is to commit the patch to org.eclipse.releng.tools in the platform releng repository.

> Second, does/is Eclipse SDK making egit/jgit available as part of the "Eclipse
> SDK"? Like they do CVS? I seem to recall hearing they would, but ... don't see
> them included, so just wondering what/why the conclusion was? 

No. We are not including EGit in the SDK or any of our zips. See discussion in 

http://wiki.eclipse.org/Platform-releng/Juno_Git_Migration#Including_eGit_in_Eclipse_SDK

> Depending on the answers to those questions, would lead to the next one ... are
> you looking to _package_ egit/jgit with the tool? Or, just have it available
> during the build, but not specifically not "included" with the tool itself. 

No. The releng tools bundle would simply require JGit. You would need to either install JGit or p2 could install the JGit bundle at the time the releng tools plugin is installed.  The only releng issue here is that there is now a build-time dependency on JGit. So, the builder needs to fetch JGit and have it available in the target at build time. We would not include JGit in any feature, zip, or p2 repo coming out of the build.
Comment 29 David Williams CLA 2012-04-20 23:13:17 EDT
Ok, I've made the initial changes to the builder so egit and jgit will be present during the build ... and, I'd say there's a fair chance of it working!


But, reviewing the patch in comment 16, I can make the following observations: 

1) You essentially "require bundle" in the manifest.mf file

org.eclipse.jgit;bundle-version="1.3.0",
org.eclipse.egit.core;bundle-version="1.3.0"

I think you'd need those "optional", in order to NOT "pull them in" to the releng tool repo. I suspect conceptually it makes sense to have them optional ... if someone was using the tool with only CVS, say, then they would not need the git bundles? If they can't be optional, I don't think there is any great harm (perhaps some advantage) ... if someone already had them installed, or had something higher installed, it would not use the ones from our little repo ... there is no "tight coupling", we just happen to have a version there handy. 

2) Also, you have 

Export-Package: ...
org.eclipse.releng.tools.git,

You'd know better than I, but is that really an "API package" we want to expose to the world to use? 

I hope these review comments are helpful. 

I set up the build to use the repo at 
http://download.eclipse.org/egit/updates/

And simply get the "latest", which is currently

org.eclipse.egit.core_1.3.0.201202151440-r.jar
org.eclipse.jgit_1.3.0.201202151440-r.jar

Have I read this right ... that you, Thomas, will apply the patch? (And, be around to revert it, if something goes wrong :)
Comment 30 Tomasz Zarna CLA 2012-04-23 05:33:20 EDT
Created attachment 214376 [details]
GitCopyrightAdapter v03

(In reply to comment #29)
> 1) You essentially "require bundle" in the manifest.mf file
> 
> org.eclipse.jgit;bundle-version="1.3.0",
> org.eclipse.egit.core;bundle-version="1.3.0"
> 
> I think you'd need those "optional", in order to NOT "pull them in" to the
> releng tool repo. I suspect conceptually it makes sense to have them optional

AFAIK, a missing, "optional" dependency doesn't prevent the plug-in to run. Not sure what you meant by '"pull them in" to the releng tool repo'.

> ... if someone was using the tool with only CVS, say, then they would not need
> the git bundles? If they can't be optional, I don't think there is any great
> harm (perhaps some advantage) ... 

That would be a fair argument if CVS repos were majority. I would flip your comment and suggest to consider making the CVS dep optional ;)

> if someone already had them installed, or had
> something higher installed, it would not use the ones from our little repo ...

Please correct me if I'm wrong, but a higher version will be used, no matter if the dependency is marked as "optional" or not.

I did apply your suggestion to the newest patch though.

> 2) Also, you have
> 
> Export-Package: ...
> org.eclipse.releng.tools.git,
> 
> You'd know better than I, but is that really an "API package" we want to expose
> to the world to use?

I thought that all packages from the releng tool should be exported. You're right, it doesn't make much sense to make the "git" package visible. I would keep it exported but hidden (internal) at the same time.
 
> Have I read this right ... that you, Thomas, will apply the patch? (And, be
> around to revert it, if something goes wrong :)

Yes, that's going to be me. Does it mean I have the green light and can push the change?

PS. Any comments on tests (comment 18)? Dependency on org.eclipse.jgit.junit seems to be an issue there.
Comment 31 David Williams CLA 2012-04-23 09:59:34 EDT
(In reply to comment #30)

> AFAIK, a missing, "optional" dependency doesn't prevent the plug-in to run. 
> Not sure what you meant by '"pull them in" to the releng tool repo'.

At some point in the build process, we "say" "now that things are compiled and made into bundles, let's put them into a p2 repo" (and those one big one of course, but even smaller ones, sometimes, that we zip up and make available for download, as we do the releng tool. And those repos are part of our "deliverables"). So, if not optional, the "make a repo" step will pick them up both for our main big repo and the little "releng tool only" archived repo; in the optional case not picked up for the repos (well, usually, guess that is controllable by exactly how we make the repo, with I'd say I'm only 90% sure of. 

I think either case is not so bad. Just wanted to be sure we were explicit one way or the other. 

And having them non-optional, and exist also in our repo (as well as the normal, original EGit repo) might make the testing part go easier :) ... I have not looked at that part, and not sure what else would have to change, but it's pretty normal to have a "git all prereqs" sort of step in the tests which is where we'd add the "get git" part. 

But, I'd suggest you add them today, we'll see if things blow up, and we'll figure out the tests later. (at worst, the tests would fail ... and right now, lots of them are :( [when they run at all, which is just starting to get working again.]. 


> That would be a fair argument if CVS repos were majority. I would flip your
> comment and suggest to consider making the CVS dep optional ;)
> 

True, I guess each should be optional (but, not sure I'd rock the existing boat, at least right now).  
 
> I thought that all packages from the releng tool should be exported. You're
> right, it doesn't make much sense to make the "git" package visible. I would
> keep it exported but hidden (internal) at the same time.

I believe that is "the platforms" normal policy (to make all visible, but mark internal if not API (but, if it was me, I might be a radical and deviate from that rule :) especially since the tool as a whole (as far as I know) is not meant to provide API. But your approach does sounds fine. 

> Yes, that's going to be me. Does it mean I have the green light and can push
> the change?

I can't wait! :)  Seriously. Green light. release today ... I suspect I'll be doing some "test builds" during the day so we'll get an early look if it needs to be reverted before the I build in the morning. (That is, if I haven't really fixed the build right ... but 95% sure). 

> PS. Any comments on tests (comment 18)? Dependency on org.eclipse.jgit.junit
> seems to be an issue there.

Appreciate the reminder. I suspect I (we?) have to change something somewhere, but still learning a lot about the tests. As I mentioned, above, in the worst case, the test will fail, and that will remind me/us to fix the scripts that run the tests :) I'd go ahead and commit the tests, let the tests fail, if they do, and if it looks like it will "be a while" before I can fix that part, we'll open a separate bug, and disable the unit tests for M7 or something.
Comment 32 Tomasz Zarna CLA 2012-04-23 11:06:36 EDT
Thanks for the quick comment David. I've pushed both patches:
* GitCopyrightAdapter as 9a580bf2137e0e71608a0951959092d51cf22692. Kept deps optional, changed the x-internal directive for o.e.releng.tools.git to x-friends:="org.eclipse.releng.tests". Tests require the package in order to run, that is why I exported it, now I remember :)
* Tests for the copyright adapter as 1580002ad6b1358e26366718f8d5415a7686fd33. As in the patch, may fail: J2SE-1.5, dep on org.eclipse.jgit.junit...

Decided to go with two commits in case the latter needs to be reverted. Feel free to ping me / file a bug and assign/CC me if needed.

Keeping my fingers crossed.
Comment 33 David Williams CLA 2012-04-23 18:57:19 EDT
What feature/repository is the bundle in? I tried a test N build, and its seemed like it was getting to "old" version ... I'm wondering if this is one of that that has to be "released" to both 'integration' and R4_HEAD? 

(Or, could be a problem with the N build, for all I know).
Comment 34 Tomasz Zarna CLA 2012-04-24 07:07:16 EDT
(In reply to comment #33)
> What feature/repository is the bundle in? 

The bundle is in ssh://{user}@git.eclipse.org/gitroot/platform/eclipse.platform.releng.git. I install it by adding/updating "org.eclipse.releng.tools.feature.group" IU to my profile. The latest in the n-build repo is 3.4.101.N20120321-2000-xxxx, but it gives me an error saying there is no adapter for GitProvider when run against a git project.

> I'm wondering if this is one of that that has to be "released" to both 'integration' and R4_HEAD?

I've pushed both changes to the forementioned repo which currently has a single branch called "master".
Comment 35 David Williams CLA 2012-04-24 10:43:27 EDT
Thomas, can  you revert the "unit test" part? 

I was mistaken. It did cause the build to fail, not just a failed test. 

generateScript:
[eclipse.buildScript] Some inter-plug-in dependencies have not been satisfied.
[eclipse.buildScript] Bundle org.eclipse.releng.tests:
[eclipse.buildScript] 		 Missing required plug-in org.eclipse.jgit.junit_1.3.0.

I'd leave in the code part. 

I am not sure where the org.eclipse.jgit.junit is? I didn't seem to see it in the egit release repo.
Comment 36 Tomasz Zarna CLA 2012-04-24 11:34:45 EDT
(In reply to comment #35)
> Thomas, can  you revert the "unit test" part?

Done, see a7f02501b9f9e5f0ae1febc52f02904da9f35125.
 
> I was mistaken. It did cause the build to fail, not just a failed test.

Sorry to hear that.

> I am not sure where the org.eclipse.jgit.junit is? I didn't seem to see it in
> the egit release repo.

Neither do I. I guess it's one of the test plug-ins which are not part of the o.e.jgit.feature.group.
Comment 37 David Williams CLA 2012-04-26 23:55:41 EDT
(In reply to comment #36)
> (In reply to comment #35)

> 
> > I am not sure where the org.eclipse.jgit.junit is? I didn't seem to see it in
> > the egit release repo.
> 
> Neither do I. I guess it's one of the test plug-ins which are not part of the
> o.e.jgit.feature.group.

I suggest you confirm the releng tool being produced by I-builds works as you expect it to, and if so, let's close this one as fixed, then open a new one (or clone this one) to add unit test at a later time. 

It'll take some study to figure out what/where org.eclipse.jgit.junit is and how to get it into our build and tests. (Just in case, is that bundle _essential_ to your tests? Is there a possibility you could copy a class or two into your unit test bundles to suffice? I think that's allowable, as long as the original copyright header is left intact and you just add a comment "This originally came from xyz package from abc bundle". Just thought I'd mention it, since I've seen other cases (on other projects) where people had funny unit test dependencies for some fairly minor reasons. If minor, we should avoid them. If they really provide some complex service you just plugin into then that's a different matter and we should track in a longer term bug.). 

Thanks.
Comment 38 Tomasz Zarna CLA 2012-04-30 05:19:40 EDT
(In reply to comment #37)

> I suggest you confirm the releng tool being produced by I-builds works as you
> expect it to, and if so, let's close this one as fixed

Works fine in I20120429-2000 + RelEng 3.6.100.v20120423-1453.

> , then open a new one (or
> clone this one) to add unit test at a later time.

It's bug 378047.

> It'll take some study to figure out what/where org.eclipse.jgit.junit is and
> how to get it into our build and tests. (Just in case, is that bundle
> _essential_ to your tests? Is there a possibility you could copy a class or two
> into your unit test bundles to suffice?

Yes, it can work out. I moved the discussion to bug 378047, I'm closing this one  as fixed since we have the updater in place.
Comment 39 Carolyn MacLeod CLA 2012-05-31 08:09:08 EDT
Tomasz, the tool doesn't quite work for SWT (way too many changes).
I have opened bug 381176 for this.
Comment 40 Dani Megert CLA 2012-05-31 09:33:15 EDT
FYI: The tool also has bug 215224, but that was also present in the CVS version.