Bug 1196167

Summary: tycho-extras: One of setGitDir or setWorkTree must be called
Product: [Fedora] Fedora Reporter: Mikolaj Izdebski <mizdebsk>
Component: tycho-extrasAssignee: Roland Grunberg <rgrunber>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: eclipse-sig, julius.schwartzenberg, mizdebsk, rgrunber
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-20 13:17:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mikolaj Izdebski 2015-02-25 12:22:53 UTC
Description of problem:
It looks like tycho-sourceref-jgit is not compatible with jgit used in Fedora.
When trying to use tycho-sourceref-jgit from tycho-packaging-plugin,
an IllegalArgumentException is thrown.

Version-Release number of selected component (if applicable):
0.22.0-2

Reproducer:

      <plugin>
	<groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-packaging-plugin</artifactId>
        <version>${tycho-version}</version>
        <configuration>
          <format>yyyyMMdd-HHmm</format>
          <sourceReferences>
            <generate>true</generate>
          </sourceReferences>
        </configuration>
       <dependencies>
          <dependency>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-sourceref-jgit</artifactId>
            <version>${tycho-extras-version}</version>
          </dependency>
       </dependencies>
      </plugin>

Result:
Caused by: java.lang.IllegalArgumentException: One of setGitDir or setWorkTree must be called.
        at org.eclipse.jgit.lib.BaseRepositoryBuilder.requireGitDirOrWorkTree(BaseRepositoryBuilder.java:587)
        at org.eclipse.jgit.lib.BaseRepositoryBuilder.setup(BaseRepositoryBuilder.java:554)
        at org.eclipse.jgit.storage.file.FileRepositoryBuilder.build(FileRepositoryBuilder.java:92)
        at org.eclipse.tycho.extras.sourceref.jgit.JGitSourceReferencesProvider.getSourceReferencesHeader(JGitSourceReferencesProvider.java:41)
        at org.eclipse.tycho.packaging.sourceref.SourceReferenceComputer.addSourceReferenceHeader(SourceReferenceComputer.java:50)
        at org.eclipse.tycho.packaging.PackagePluginMojo.updateManifest(PackagePluginMojo.java:253)
        at org.eclipse.tycho.packaging.PackagePluginMojo.createPluginJar(PackagePluginMojo.java:210)
        at org.eclipse.tycho.packaging.PackagePluginMojo.execute(PackagePluginMojo.java:138)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)

Comment 1 Mikolaj Izdebski 2015-02-25 12:53:27 UTC
This seems to be caused by missing git repo in build directory.
Creating git repo "fixes" the issue.

Comment 2 Roland Grunberg 2015-02-25 15:04:22 UTC
I don't think this is a bug, although the error is a little cryptic. tycho-sourceref-jgit is meant to find the git repository and generate the artifact build qualifiers based on the last commit to that subproject. If there isn't git repository to be found, this will fail (See http://dev.eclipse.org/mhonarc/lists/tycho-user/msg04214.html). Upstream probably builds directly off the git repo so this works for them, but the sources shipped (git archive) have the repository stripped away.

One solution is to recreate the sources using a git shallow clone. Another is to just remove the jgit provider (http://pkgs.fedoraproject.org/cgit/eclipse.git/tree/eclipse-remove-jgit-provider.patch), which can be done now with macros (either %pom_remove_dep, or %pom_xpath_remove depending on whether the former supports dependencies defined within a plugin).

Comment 3 Roland Grunberg 2015-02-27 22:01:02 UTC
I've added a section at https://fedoraproject.org/wiki/Tycho#Build_Qualifiers to describe this issue.

While I could imagine a modification to tycho-extras jgit timestamp provider that defaults to regular timestamps if a git repository isn't found, I'm not sure if we should really be working around this problem on behalf of users. I can keep this bug open for a while in case we decide to add such a feature.

Comment 4 Jan Kurik 2015-07-15 14:29:46 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 5 Fedora End Of Life 2016-11-24 11:29:19 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2016-12-20 13:17:13 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.