Skip to main content
summaryrefslogtreecommitdiffstats
blob: d280182d9c6413abb41f9223a1ef329d0196e2e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (c) 2016 IBM Corporation and others.
  All rights reserved. This program and the accompanying materials
  are made available under the terms of the Eclipse Public License v1.0
  which accompanies this distribution, and is available at
  http://www.eclipse.org/legal/epl-v10.html

  Contributors:
  David Williams - initial API and implementation
-->

<project
  name="Remove one (packed) IU from repository"
  default="removeIU"
  basedir=".">
  <target name="init">

    <!--
      The repository directory and IU name can be set here,
      or passed in as a -D parameter.
    -->
    <property
      name="repoDir"
      value="/data/httpd/download.eclipse.org/rt/ecf/3.13.1/site.p2" />
    <property
      name="iuName"
      value="org.apache.hadoop.zookeeper" />

    <!-- eol to write better messages -->
    <property
      name="eol"
      value="${line.separator}" />

    <!-- The remaining part of 'init' are some sanity checks that proper input provided -->
    <condition property="repoExists">
      <available
        type="dir"
        file="${repoDir}" />
    </condition>
    <fail unless="repoExists" />

    <!--
      We check only one file, artifacts.jar (or artifacts.xml), to make sure is is a simple repo,
      and that it is writeable. If both exist, this step will fail, but that is an ill-formed repository,
      so should be corrected in any case.
    -->
    <condition property="isWriteable">
      <resourcecount
        when="equal"
        count="1">
        <fileset dir="${repoDir}">
          <include name="artifacts.jar" />
          <include name="artifacts.xml" />
          <writable />
        </fileset>
      </resourcecount>
    </condition>
    <fail
      unless="isWriteable"
      message=":${eol}${eol}[ERROR]: The repository provided, ${eol}         '${repoDir}',${eol}         is not writeable or is not a simple p2 repository." />
  </target>
  <target
    name="removeIU"
    description="Remove one (packed) IU from repository"
    depends="init">
    <fail
      unless="iuName"
      message=":${eol}${eol}[ERROR]: iuName must be provided." />
    <fail
      unless="repoDir"
      message="${eol}${eol}[ERROR]: repoDir must be provided." />
    <echo
      message="${eol}${eol}[INFO]: Removing the pack200 IU of${eol}       ${iuName} from the p2 repository at${eol}       '${repoDir}'${eol}       " />


    <p2.remove.iu>
      <repository location="file://${repoDir}" />
      <!--
           Without a version specification,
           this will remove all versions of packed artifact,
           which may not be desired.
      -->
      <iu
        id="${iuName}"
        artifacts="(format=packed)" />
    </p2.remove.iu>
  </target>
</project>

Back to the top