Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365944

Summary: [fetchFactory] issues with qualifier expansion
Product: [Technology] EGit Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, david_williams, kim.moir, Michal.Tkacz, pwebster
Version: 0.12   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
proposed fix
none
improved fix none

Description Stephan Herrmann CLA 2011-12-07 13:41:44 EST
While migrating a custom PDE/Build to Git I can't get the the expansion
of version qualifiers to work as expected. I'm using
org.eclipse.egit.fetchfactory_0.12.0.201108111757.jar


fetchTag=GIT=HEAD
=> I'd expect versions like 2.1.0.201112071932 (current timestamp)
=> I get versions like 2.1.0.HEAD


fetchTag=GIT=master
=> I'd expect versions like 2.1.0.201112071932 (current timestamp)
=> I get versions like 2.1.0.master


using a tag inside the map file I'd say, e.g., tag=builds/201105161939
=> I'd love to see it build version 2.1.0.201105161939
=> build fails because 2.1.0.builds/201105161939 is not a legal version


I might be doing one or two things wrong, but it looks like there's
room for improvement :)


Question 1: Is my expectation wrong to get a timestamp qualifier for
  nightly builds?

Question 2: Any tricks that I should apply to get it to work as desired?

Question 3: Anybody currently working on the fetch factory or should I
  prepare a patch with proposed changes?
Comment 1 Stephan Herrmann CLA 2011-12-07 19:38:44 EST
Created attachment 208083 [details]
proposed fix

Without much ado here's the version that is just now driving my first
git-based PDE-build.

Changes:

(1) distinguish two entries in entryInfos:
  KEY_CHECKOUT_TAG: used only locally for the git checkout command
  IFetchFactory.KEY_ELEMENT_TAG: this value is used by PDE/Build for
     qualifier replacement

(2) Set KEY_CHECKOUT_TAG to what's found in map or override, except:
  if nothing is found use "master"
  => let's you omit the tag field in the map file for all plugins that
     should be built from HEAD/master

(3) If tag is "master" or "HEAD" leave IFetchFactory.KEY_ELEMENT_TAG unset,
  to allow PDE/Build to use the current timestamp as the qualifier.

(4) If tag contains slashes, use only the last segment (after the last slash)
  as the value for IFetchFactory.KEY_ELEMENT_TAG, to avoid that PDE/Build
  creates illegal version qualifier containing '/'.
Comment 2 Stephan Herrmann CLA 2011-12-09 13:46:46 EST
Created attachment 208190 [details]
improved fix

Slight improvements:

Always use "origin/master" rather than "master" to ensure pulling from origin
during checkout.

Create patch using git cli (rather than EGit) to get a better patch.