Created
September 4, 2014 09:59
-
-
Save maxandersen/5b256eeb2dc8856f5a0b to your computer and use it in GitHub Desktop.
Creates a p2 update repo from content.jars piped to this command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: | |
cd <dir with p2 repos under it> | |
find . -name content.jar | python gencomposite.py | |
It will generate the necessary xml files for a composite repo and you | |
can now use the directory as an updatesite. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml import etree | |
import fileinput | |
repos = [] | |
for line in fileinput.input(): | |
repos.append(line) | |
repository = etree.Element("repository", name="Auto-generated repo", type="org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository", version="1.0.0") | |
properties = etree.SubElement(repository,"properties") | |
children = etree.SubElement(repository, "children") | |
for rep in repos: | |
etree.SubElement(children,"child", location=rep.replace("content.jar\n",'')) | |
children.attrib["size"]=str(len(repos)) | |
s = etree.tostring(repository, pretty_print=True) | |
print "Writing compositeContent.xml" | |
file = open("compositeContent.xml", "w") | |
file.write(s) | |
file.close() | |
repository.attrib["type"] = "org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository" | |
s = etree.tostring(repository, pretty_print=True) | |
print "Writing compositeArtifacts.xml" | |
file = open("compositeArtifacts.xml", "w") | |
file.write(s) | |
file.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment