Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320270 - [publisher] p2 publisher sets wrong requirements when exporting a product which doesn't contain bundles
Summary: [publisher] p2 publisher sets wrong requirements when exporting a product whi...
Status: CLOSED WONTFIX
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-19 10:23 EDT by Katya Stoycheva CLA
Modified: 2019-09-22 12:38 EDT (History)
9 users (show)

See Also:


Attachments
Sample product which doesn't contain bundles (251 bytes, application/octet-stream)
2010-07-19 10:24 EDT, Katya Stoycheva CLA
no flags Details
Sample repository to install product from (9.37 KB, application/octet-stream)
2010-07-19 10:25 EDT, Katya Stoycheva CLA
no flags Details
tooling.osgi.bundle.default marked as optional (1.39 KB, patch)
2010-08-19 11:05 EDT, Katya Stoycheva CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Katya Stoycheva CLA 2010-07-19 10:23:14 EDT
Build Identifier: I20100603-1500

When publishing a product which contains a single feature with a single binary artifact and no bundles, using the product publisher application, and then trying to install with p2 director, the installation fails with message:
“Missing requirement: tooling.osgi.bundle.default 1.0.0 requires 'org.eclipse.equinox.p2.eclipse.type bundle 0.0.0' but it could not be found”


Reproducible: Always

Steps to Reproduce:
1. Create an empty feature project. Let’s name the feature “ziptest” as a reference for the instructions below.
2. Create a folder inside the feature project and put some files inside.
3. Replace the contents of the build.properties file inside the feature project with the following line:
root=<folder>
where <folder> is the name of the folder created in point 2.
4. Open feature.xml file and modify the <data> XML tag to look like this:
   <data
         id="build.properties"
         download-size="0"
         install-size="0"/>
If <data> XML tag does not exist, add it.
5. Export the feature.
6. Create a product file which contains only the feature. For a feature named “ziptest” it should look like the attached file "ziptest.product ".
7.  Run the product publisher application from the IDE with the following parameters:
-ar file:/<file path to exported repo>
-mr file:/<file path to exported repo>
-productFile <file path to product file>
-append -flavor tooling
-configs win32.win32.x86
After –ar and –mr you should point to the file location where you exported the feature in point 5.
8. Run the p2 director application inside the IDE with the following parameters:
-repository file:/<file path to exported repo>
-installIU <product ID>
-destination <installation location>
-profile <profile name>
-bundlepool <installation location>
Where <file path to exported repo> is the same as in point 7, <product ID> is the ID of the product (specified as value of uid attribute of “product” XML element inside the .product file), <installation location> is file path you wish your product to be installed into and <profile name> is a random String.
9. Notice that installation fails  with a message for a missing requirement.

Sample repository to reproduce from: Attached "ziptest_repo.zip"
Comment 1 Katya Stoycheva CLA 2010-07-19 10:24:28 EDT
Created attachment 174620 [details]
Sample product which doesn't contain bundles
Comment 2 Katya Stoycheva CLA 2010-07-19 10:25:10 EDT
Created attachment 174621 [details]
Sample repository to install product from
Comment 3 Katya Stoycheva CLA 2010-07-19 10:49:29 EDT
Here are some findings which provides additional information about that issue:

The reason for the issue is that "tooling.osgi.bundle.default" IU is always generated as a configuration unit for the existing  repository. Bundles satisfy the requirements of this configuration unit. However, if the repository contains no bundles, as in our case, this requirement cannot be fulfilled.

In the course of the product publishing process, there is a set of default actions generated in ProductActions.createActions() which create the configuration units no matter what is included  in the product. A possible fix could refine the set of actions based on contents of the repository over which the product publisher operates. 

There is a workaround: Add an empty bundle to the feature and republish it again.
Comment 4 Andrew Niefer CLA 2010-07-19 11:16:44 EDT
There may be other IUs that should not be installed in this case.  There is the a.jre IU.
Comment 5 Katya Stoycheva CLA 2010-08-19 11:05:50 EDT
Created attachment 177009 [details]
tooling.osgi.bundle.default marked as optional

There are a few tooling.* configuration units which the Product Publisher always generates in the repository in order to provide touchpoint instructions for the installation of bundles, features and sources for the artifacts of the respective type. The CUs declare requirements which attach them to the IUs of the particular type. However, the requirements for features and source bundles are defined as optional because it is entirely possible that the repository does not contain such kinds of artifacts and the requirements would not be met if mandatory. The bug report gives an example when the repository may not include a standard bundle item too. In the context of the described use case, the proposed patch follows the rationale of the optional features and source bundles requirements and declares the bundle requirement in the default bundle configuration unit (“tooling.osgi.bundle.default”) as optional too
Comment 6 Sébastien Gandon CLA 2010-12-02 12:07:08 EST
I happend to have the same proble with a product including one plugin.
Actually we have a headless pde build to build our features.
I have published p2 metadata and artifacts using 
    org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
and then have tried to publish a product defining one feature that contains 1 plugin and many features.
then i tryed to install that product IU and got the same error message :
     Missing requirement: tooling.osgi.bundle.default 1.0.0 requires 'org.eclipse.equinox.p2.eclipse.type bundle 0.0.0' but it could not

I there any workaround or should I install the patch ?
Comment 7 Shenol Yousouf CLA 2010-12-03 11:23:00 EST
(In reply to comment #6)
> I happend to have the same proble with a product including one plugin.
> ...
> I there any workaround or should I install the patch ?

Did you try the workaround suggested at the end of comment #3 ?
Comment 8 Sébastien Gandon CLA 2010-12-03 11:40:01 EST
I you read my first comment you'll notice I am already in the comment #3 workaround configuration which suggest to have at least one plugin in the feature which is my case.
Comment 9 Tobias Oberlies CLA 2011-06-07 07:36:41 EDT
Making the dependency to tooling.osgi.bundle.default optional, as proposed in Kaja's patch, could in fact solve the problem.

Nevertheless, I would like to see an automated test verifying this. This test would require chaining the ProductAction with a planner. However I haven't seen this done elsewhere in the p2 test suite. Are there any reasons that speak against this approach?
Comment 10 Pascal Rapicault CLA 2011-06-07 20:19:03 EDT
> Nevertheless, I would like to see an automated test verifying this. This test
> would require chaining the ProductAction with a planner. However I haven't seen
> this done elsewhere in the p2 test suite. Are there any reasons that speak
> against this approach?
  The only reason is we tried to keep the tests isolated. The planner has plenty of tests on optional dependencies, and we have the publisher test. In this case I think that a test that validates the behaviour of BundlesAction should suffice. But if you want to write something more complex, I don't see any issue. Just persist your IU, create a profile and plan (there are plenty of example of this latter part in the planner tests).
Comment 11 Tobias Oberlies CLA 2011-06-08 10:52:23 EDT
(In reply to comment #10)
> The only reason is we tried to keep the tests isolated. The planner has plenty
> of tests on optional dependencies, and we have the publisher test. In this case
> I think that a test that validates the behaviour of BundlesAction should
> suffice. 
Is there a test for an optional dependency on an IU fragment? I think this is quite a tricky case, and we should verify that the patch doesn't break the product publisher alltogether.

> But if you want to write something more complex, I don't see any issue.
> Just persist your IU, create a profile and plan (there are plenty of example of
> this latter part in the planner tests).
@Katja: Could you please provide a test that creates a provisioning plan from the publisher result of the ProductAction?
Comment 12 Thomas Watson CLA 2011-06-08 11:31:01 EDT
Move all 3.8 bugs to Juno.
Comment 13 Arturo Diaz Arevalo CLA 2012-04-17 00:40:58 EDT
Guys, I'm trying to adopt Eclipse 38 M6, but I'm having a similar issue with my app. In my case I do have always bundles; although I've tried your workaroung but I did not have success. Here's my log file:

While I run product with the following command I got a problem during the P2
installation:

!SESSION 2012-03-27 12:03:10.308
-----------------------------------------------
eclipse.buildId=I20120314-1800
java.fullversion=J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223ifx-20110203 (JIT
enabled)
J9VM - 20110202_74536_lHdSMr
JIT  - 20100623_16197ifx3_r8
GC   - 20100211_AA
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -application org.eclipse.equinox.p2.director
-metadataRepository
file:/build/root/metadata/ies/38/T/T38I20120327_20120327_1153/p2/repository/linux.gtk.x86
-artifactRepository
file:/build/root/metadata/ies/38/T/T38I20120327_20120327_1153/p2/repository/linux.gtk.x86
-installIU bootstrap/1.3.1.38I20120327 -destination
/build/root/metadata/ies/38/T/T38I20120327_20120327_1153/p2/bootstrap.gtk.linux.x86
-profile bootProfile -profileProperties
org.eclipse.update.install.features=true -p2.os linux -p2.ws gtk -p2.arch x86
Command-line arguments:  -application org.eclipse.equinox.p2.director
-metadataRepository
file:/build/root/metadata/ies/38/T/T38I20120327_20120327_1153/p2/repository/linux.gtk.x86
-artifactRepository
file:/build/root/metadata/ies/38/T/T38I20120327_20120327_1153/p2/repository/linux.gtk.x86
-installIU bootstrap/1.3.1.38I20120327 -destination
/build/root/metadata/ies/38/T/T38I20120327_20120327_1153/p2/bootstrap.gtk.linux.x86
-profile bootProfile -profileProperties
org.eclipse.update.install.features=true -p2.os linux -p2.ws gtk -p2.arch x86

!ENTRY org.eclipse.equinox.p2.director 4 1 2012-03-27 12:03:16.667
!MESSAGE Cannot complete the install because one or more required items could
not be found.
!SUBENTRY 1 org.eclipse.equinox.p2.director 4 0 2012-03-27 12:03:16.667
!MESSAGE Software being installed: bootstrap 1.3.1.38I20120327 (bootstrap
1.3.1.38I20120327)
!SUBENTRY 1 org.eclipse.equinox.p2.director 4 0 2012-03-27 12:03:16.667
!MESSAGE Missing requirement: tooling.osgi.bundle.default 1.0.0 requires
'org.eclipse.equinox.p2.eclipse.type bundle 0.0.0' but it could not be found
!SUBENTRY 1 org.eclipse.equinox.p2.director 4 1 2012-03-27 12:03:16.667
!MESSAGE Cannot satisfy dependency:
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 0 2012-03-27 12:03:16.668
!MESSAGE From: bootstrap 1.3.1.38I20120327 (bootstrap 1.3.1.38I20120327)
!SUBENTRY 2 org.eclipse.equinox.p2.director 4 0 2012-03-27 12:03:16.668
!MESSAGE To: tooling.osgi.bundle.default [1.0.0]
-----------------------

NOTE: My application worked fine adopting Eclipse 38 M5.

Any help would be greatly appreciated.
Comment 14 Tobias Oberlies CLA 2012-10-01 09:00:21 EDT
(In reply to comment #11)
> Could you please provide a test that creates a provisioning plan from
> the publisher result of the ProductAction?
I didn't receive the requested test case. Returning to inbox.
Comment 15 Eclipse Genie CLA 2019-09-22 12:38:58 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.