Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 282260
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java (-10 / +20 lines)
Lines 934-940 Link Here
934
934
935
		if (BuildDirector.p2Gathering) {
935
		if (BuildDirector.p2Gathering) {
936
			//TODO permissions
936
			//TODO permissions
937
			fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE), false, null, "**/**", null, null, null, productFile != null ? Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) : null, null, null)); //$NON-NLS-1$
937
			FileSet[] permissions = generatePermissions(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE), true);
938
			String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$
939
			fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE), false, null, "**/**", null, toExcludeFromArchive, null, productFile != null ? Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) : null, null, null)); //$NON-NLS-1$
940
			fileSets.addAll(Arrays.asList(permissions));
938
		} else {
941
		} else {
939
			for (int i = 0; i < plugins.length; i++) {
942
			for (int i = 0; i < plugins.length; i++) {
940
				Object[] shape = shapeAdvisor.getFinalShape(plugins[i]);
943
				Object[] shape = shapeAdvisor.getFinalShape(plugins[i]);
Lines 954-960 Link Here
954
						fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + elt.toStringReplacingAny(".", ANY_STRING), false, null, "**/**", null, null, null, elt.toStringReplacingAny(".", ANY_STRING), null, null)); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
957
						fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + elt.toStringReplacingAny(".", ANY_STRING), false, null, "**/**", null, null, null, elt.toStringReplacingAny(".", ANY_STRING), null, null)); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
955
					}
958
					}
956
				} else {
959
				} else {
957
					FileSet[] permissions = generatePermissions(true);
960
					FileSet[] permissions = generatePermissions(rootFolder, true);
958
					String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$
961
					String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$
959
					fileSets.add(new ZipFileSet(rootFolder, false, null, "**/**", null, toExcludeFromArchive, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null)); //$NON-NLS-1$
962
					fileSets.add(new ZipFileSet(rootFolder, false, null, "**/**", null, toExcludeFromArchive, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null)); //$NON-NLS-1$
960
					fileSets.addAll(Arrays.asList(permissions));
963
					fileSets.addAll(Arrays.asList(permissions));
Lines 967-979 Link Here
967
		}
970
		}
968
	}
971
	}
969
972
970
	protected FileSet[] generatePermissions(boolean zip) {
973
	protected Collection getArchiveRootFileProviders() {
974
		return rootFileProviders != null ? rootFileProviders : Collections.EMPTY_LIST;
975
	}
976
977
	protected FileSet[] generatePermissions(String root, boolean zip) {
971
		String configInfix = configInfo.toString("."); //$NON-NLS-1$
978
		String configInfix = configInfo.toString("."); //$NON-NLS-1$
972
		String prefixPermissions = ROOT_PREFIX + configInfix + '.' + PERMISSIONS + '.';
979
		String prefixPermissions = ROOT_PREFIX + configInfix + '.' + PERMISSIONS + '.';
973
		String commonPermissions = ROOT_PREFIX + PERMISSIONS + '.';
980
		String commonPermissions = ROOT_PREFIX + PERMISSIONS + '.';
974
		ArrayList fileSets = new ArrayList();
981
		ArrayList fileSets = new ArrayList();
975
982
976
		for (Iterator iter = rootFileProviders.iterator(); iter.hasNext();) {
983
		for (Iterator iter = getArchiveRootFileProviders().iterator(); iter.hasNext();) {
977
			Properties featureProperties = getFeatureBuildProperties((BuildTimeFeature) iter.next());
984
			Properties featureProperties = getFeatureBuildProperties((BuildTimeFeature) iter.next());
978
			for (Iterator iter2 = featureProperties.entrySet().iterator(); iter2.hasNext();) {
985
			for (Iterator iter2 = featureProperties.entrySet().iterator(); iter2.hasNext();) {
979
				Map.Entry permission = (Map.Entry) iter2.next();
986
				Map.Entry permission = (Map.Entry) iter2.next();
Lines 985-1001 Link Here
985
					if (instruction.startsWith(prefixPermissions)) {
992
					if (instruction.startsWith(prefixPermissions)) {
986
						addedByPermissions.add(values[i]);
993
						addedByPermissions.add(values[i]);
987
						if (zip)
994
						if (zip)
988
							fileSets.add(new ZipFileSet(rootFolder + (isFile ? '/' + values[i] : ""), isFile, null, isFile ? null : values[i] + "/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) + (isFile ? '/' + values[i] : ""), null, instruction.substring(prefixPermissions.length()))); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
995
							fileSets.add(new ZipFileSet(root + (isFile ? '/' + values[i] : ""), isFile, null, isFile ? null : values[i] + "/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) + (isFile ? '/' + values[i] : ""), null, instruction.substring(prefixPermissions.length()))); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
989
						else
996
						else
990
							fileSets.add(new TarFileSet(rootFolder + (isFile ? '/' + values[i] : ""), isFile, null, isFile ? null : values[i] + "/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) + (isFile ? '/' + values[i] : ""), null, instruction.substring(prefixPermissions.length()))); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
997
							fileSets.add(new TarFileSet(root + (isFile ? '/' + values[i] : ""), isFile, null, isFile ? null : values[i] + "/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) + (isFile ? '/' + values[i] : ""), null, instruction.substring(prefixPermissions.length()))); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
991
						continue;
998
						continue;
992
					}
999
					}
993
					if (instruction.startsWith(commonPermissions)) {
1000
					if (instruction.startsWith(commonPermissions)) {
994
						addedByPermissions.add(values[i]);
1001
						addedByPermissions.add(values[i]);
995
						if (zip)
1002
						if (zip)
996
							fileSets.add(new ZipFileSet(rootFolder + (isFile ? '/' + values[i] : ""), isFile, null, isFile ? null : values[i] + "/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) + (isFile ? '/' + values[i] : ""), null, instruction.substring(commonPermissions.length()))); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
1003
							fileSets.add(new ZipFileSet(root + (isFile ? '/' + values[i] : ""), isFile, null, isFile ? null : values[i] + "/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) + (isFile ? '/' + values[i] : ""), null, instruction.substring(commonPermissions.length()))); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
997
						else
1004
						else
998
							fileSets.add(new TarFileSet(rootFolder + (isFile ? '/' + values[i] : ""), isFile, null, isFile ? null : values[i] + "/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) + (isFile ? '/' + values[i] : ""), null, instruction.substring(commonPermissions.length()))); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
1005
							fileSets.add(new TarFileSet(root + (isFile ? '/' + values[i] : ""), isFile, null, isFile ? null : values[i] + "/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) + (isFile ? '/' + values[i] : ""), null, instruction.substring(commonPermissions.length()))); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
999
						continue;
1006
						continue;
1000
					}
1007
					}
1001
				}
1008
				}
Lines 1009-1015 Link Here
1009
		List fileSets = new ArrayList();
1016
		List fileSets = new ArrayList();
1010
1017
1011
		if (BuildDirector.p2Gathering) {
1018
		if (BuildDirector.p2Gathering) {
1012
			fileSets.add(new TarFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE), false, null, "**/**", null, null, null, productFile != null ? Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) : null, null, null)); //$NON-NLS-1$
1019
			FileSet[] permissions = generatePermissions(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE), false);
1020
			String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$
1021
			fileSets.add(new TarFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE), false, null, "**/**", null, toExcludeFromArchive, null, productFile != null ? Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX) : null, null, null)); //$NON-NLS-1$
1022
			fileSets.addAll(Arrays.asList(permissions));
1013
		} else {
1023
		} else {
1014
			//FileSet[] filesPlugins = new FileSet[plugins.length];
1024
			//FileSet[] filesPlugins = new FileSet[plugins.length];
1015
			for (int i = 0; i < plugins.length; i++) {
1025
			for (int i = 0; i < plugins.length; i++) {
Lines 1023-1029 Link Here
1023
			}
1033
			}
1024
1034
1025
			if (rootFileProviders.size() > 0) {
1035
			if (rootFileProviders.size() > 0) {
1026
				FileSet[] permissionSets = generatePermissions(false);
1036
				FileSet[] permissionSets = generatePermissions(rootFolder, false);
1027
				fileSets.add(new TarFileSet(rootFolder, false, null, "**/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null)); //$NON-NLS-1$
1037
				fileSets.add(new TarFileSet(rootFolder, false, null, "**/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null)); //$NON-NLS-1$
1028
				fileSets.add(Arrays.asList(permissionSets));
1038
				fileSets.add(Arrays.asList(permissionSets));
1029
			}
1039
			}
(-)src/org/eclipse/pde/internal/build/packager/PackageConfigScriptGenerator.java (-2 / +13 lines)
Lines 11-18 Link Here
11
package org.eclipse.pde.internal.build.packager;
11
package org.eclipse.pde.internal.build.packager;
12
12
13
import java.io.*;
13
import java.io.*;
14
import java.util.ArrayList;
14
import java.util.*;
15
import java.util.Properties;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.*;
17
import org.eclipse.osgi.service.resolver.BundleDescription;
16
import org.eclipse.osgi.service.resolver.BundleDescription;
18
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.osgi.util.NLS;
Lines 25-30 Link Here
25
public class PackageConfigScriptGenerator extends AssembleConfigScriptGenerator {
24
public class PackageConfigScriptGenerator extends AssembleConfigScriptGenerator {
26
25
27
	private Properties packagingProperties;
26
	private Properties packagingProperties;
27
	private Collection archiveRootProviders = Collections.EMPTY_LIST;
28
29
	public void initialize(String directoryName, String feature, Config configurationInformation, Collection elementList, Collection featureList, Collection allFeaturesList, Collection rootProviders) throws CoreException {
30
		/* package scripts require the root file providers for creating the file archive, but don't want them for other rootfile
31
		 * stuff done by the assembly scripts, so keep them separate here */
32
		super.initialize(directoryName, feature, configurationInformation, elementList, featureList, allFeaturesList, Collections.EMPTY_SET);
33
		archiveRootProviders = rootProviders != null ? rootProviders : Collections.EMPTY_LIST;
34
	}
35
36
	protected Collection getArchiveRootFileProviders() {
37
		return archiveRootProviders;
38
	}
28
39
29
	private String getFinalName(BundleDescription bundle, String shape) {
40
	private String getFinalName(BundleDescription bundle, String shape) {
30
		final String JAR = "jar"; //$NON-NLS-1$
41
		final String JAR = "jar"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/build/packager/PackageScriptGenerator.java (-1 / +1 lines)
Lines 45-51 Link Here
45
	}
45
	}
46
46
47
	protected Collection[] getConfigInfos(Config aConfig) {
47
	protected Collection[] getConfigInfos(Config aConfig) {
48
		return new Collection[] {assemblageInformation.getBinaryPlugins(aConfig), assemblageInformation.getBinaryFeatures(aConfig), assemblageInformation.getFeatures(aConfig), new HashSet(0)};
48
		return new Collection[] {assemblageInformation.getBinaryPlugins(aConfig), assemblageInformation.getBinaryFeatures(aConfig), assemblageInformation.getFeatures(aConfig), BuildDirector.p2Gathering ? assemblageInformation.getRootFileProviders(aConfig) : new HashSet(0)};
49
	}
49
	}
50
50
51
	protected void generateP2ConfigFileTargetCall() {
51
	protected void generateP2ConfigFileTargetCall() {
(-)src/org/eclipse/pde/build/internal/tests/p2/PublishingTests.java (-3 / +24 lines)
Lines 9-16 Link Here
9
9
10
package org.eclipse.pde.build.internal.tests.p2;
10
package org.eclipse.pde.build.internal.tests.p2;
11
11
12
import java.io.File;
12
import java.io.*;
13
import java.io.FilenameFilter;
14
import java.net.URI;
13
import java.net.URI;
15
import java.net.URL;
14
import java.net.URL;
16
import java.util.*;
15
import java.util.*;
Lines 1569-1576 Link Here
1569
		runProductBuild(buildFolder);
1568
		runProductBuild(buildFolder);
1570
1569
1571
		IFile ini = buildFolder.getFile("eclipse.ini");
1570
		IFile ini = buildFolder.getFile("eclipse.ini");
1572
		if (!Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.carbon.ppc.zip", "eclipse/eclipse.app/Contents/MacOS/eclipse.ini", ini))
1571
		boolean lowerCase = true;
1572
		if (!Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.carbon.ppc.zip", "eclipse/eclipse.app/Contents/MacOS/eclipse.ini", ini)) {
1573
			lowerCase = false;
1573
			Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.carbon.ppc.zip", "eclipse/Eclipse.app/Contents/MacOS/eclipse.ini", ini);
1574
			Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.carbon.ppc.zip", "eclipse/Eclipse.app/Contents/MacOS/eclipse.ini", ini);
1575
		}
1576
1577
		if (Platform.getOS().equals("linux")) {
1578
			IFile zip = buildFolder.getFile("I.TestBuild/eclipse-macosx.carbon.ppc.zip");
1579
1580
			String exeString = (lowerCase ? "eclipse/eclipse.app/" : "eclipse/Eclipse.app/") + "Contents/MacOS/eclipse";
1581
			String[] command = new String[] {"unzip", "-qq", zip.getLocation().toOSString(), exeString, "-d", buildFolder.getLocation().toOSString()};
1582
			Process proc = Runtime.getRuntime().exec(command);
1583
			proc.waitFor();
1584
1585
			IFile executable = buildFolder.getFile(exeString);
1586
			assertResourceFile(executable);
1587
1588
			command = new String[] {"ls", "-la", executable.getLocation().toOSString()};
1589
			proc = Runtime.getRuntime().exec(command);
1590
			Utils.transferStreams(proc.getInputStream(), new FileOutputStream(buildFolder.getFile("ls.out").getLocation().toFile()));
1591
			proc.waitFor();
1592
1593
			assertLogContainsLine(buildFolder.getFile("ls.out"), "-rwxr-xr-x");
1594
		}
1574
1595
1575
		assertLogContainsLines(ini, new String[] {"-vm", "myVm"});
1596
		assertLogContainsLines(ini, new String[] {"-vm", "myVm"});
1576
		boolean duplicate = false;
1597
		boolean duplicate = false;

Return to bug 282260