1*537f9df8SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*537f9df8SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*537f9df8SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*537f9df8SAndrew Rist * distributed with this work for additional information
6*537f9df8SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*537f9df8SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*537f9df8SAndrew Rist * "License"); you may not use this file except in compliance
9*537f9df8SAndrew Rist * with the License.  You may obtain a copy of the License at
10*537f9df8SAndrew Rist *
11*537f9df8SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*537f9df8SAndrew Rist *
13*537f9df8SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*537f9df8SAndrew Rist * software distributed under the License is distributed on an
15*537f9df8SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*537f9df8SAndrew Rist * KIND, either express or implied.  See the License for the
17*537f9df8SAndrew Rist * specific language governing permissions and limitations
18*537f9df8SAndrew Rist * under the License.
19*537f9df8SAndrew Rist *
20*537f9df8SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweirThere are three extensions in various versions:
23cdf0e10cSrcweir
24cdf0e10cSrcweir1  version_XXX/plain.oxt has no dependencies and no license.
25cdf0e10cSrcweir2a version_XXX/dependency.oxt has an unsatisfied dependency and no license.
26cdf0e10cSrcweir2b version_nodependencies_XXX/dependency.oxt is identical to 2a but without the
27cdf0e10cSrcweir   dependency.
28cdf0e10cSrcweir3  version_XXX/license.oxt has no dependencies and a license.
29cdf0e10cSrcweir
30cdf0e10cSrcweirThe different versions are:
31cdf0e10cSrcweir
32cdf0e10cSrcweirA  version_none contains no version element (treated as version "0").
33cdf0e10cSrcweirB  version_badelement contains a bad <version val="1"/> (not allowed by the
34cdf0e10cSrcweir   specification, but treated by the current implementation as version "0").
35cdf0e10cSrcweirC  version_badvalue contains a bad <version value="1.a"/> (not allowed by the
36cdf0e10cSrcweir   specification, but treated by the current implementation as version "1").
37cdf0e10cSrcweirD  version_0.0 contains <version value="0.0"/> (same as version "0").
38cdf0e10cSrcweirE  version_1.2.3 contains <version value="1.2.3"/>.
39cdf0e10cSrcweirF  version_1.2.4.7 contains <version value="1.2.4.7"/>.
40cdf0e10cSrcweirG  version_1.02.4.7.0 contains <version value="1.02.4.7.0"/> (same as version
41cdf0e10cSrcweir   "1.2.4.7").
42cdf0e10cSrcweirH  version_1.2.15.3 contains <version value="1.2.15.3"/>.
43cdf0e10cSrcweir
44cdf0e10cSrcweirThe total order among the various versions is thus
45cdf0e10cSrcweir
46cdf0e10cSrcweir  A = B = D < C < E < F = G < H.
47cdf0e10cSrcweir
48cdf0e10cSrcweirThings to watch for:
49cdf0e10cSrcweir
50cdf0e10cSrcweir- If version y of extension e is to be installed and version x < y of
51cdf0e10cSrcweir  extension e is already installed, then
52cdf0e10cSrcweir   unopkg add e
53cdf0e10cSrcweir  will replace x with y.
54cdf0e10cSrcweir
55cdf0e10cSrcweir- If version y of extension e is to be installed and version x >= y of
56cdf0e10cSrcweir  extension e is already installed, then
57cdf0e10cSrcweir   unopkg add e
58cdf0e10cSrcweir  will fail with an error message.
59cdf0e10cSrcweir
60cdf0e10cSrcweir- If version y of extension e is to be installed and any version x of
61cdf0e10cSrcweir  extension e is already installed, then
62cdf0e10cSrcweir   unopkg add -f e
63cdf0e10cSrcweir  will replace x with y.
64cdf0e10cSrcweir
65cdf0e10cSrcweir- If version y of extension e is to be installed and any version x of
66cdf0e10cSrcweir  extension e is already installed, then
67cdf0e10cSrcweir   unopkg gui "Add..."
68cdf0e10cSrcweir  and
69cdf0e10cSrcweir   soffice "Tools - Package Manager... - Add..."
70cdf0e10cSrcweir  will query with a dialog whether to replace x with y.  The dialog will have
71cdf0e10cSrcweir  "OK" (replace) preselected if x < y, and "Cancel" otherwise.
72cdf0e10cSrcweir
73cdf0e10cSrcweir- If replacing an installed version x of an extension e with a version y fails
74cdf0e10cSrcweir  because y has unsatisfied dependencies, or because y has a license to wich the
75cdf0e10cSrcweir  user does not agree, version x is left installed afterwards.
76cdf0e10cSrcweir
77cdf0e10cSrcweir- Checking for already installed versions of an extension is only done within a
78cdf0e10cSrcweir  single layer (unopkg versus unopkg --shared; "My Packages" versus
79cdf0e10cSrcweir  "OpenOffice Packages" in unopkg gui/soffice), not across layers.
80