1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir
28*cdf0e10cSrcweirThere are three extensions in various versions:
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir1  version_XXX/plain.oxt has no dependencies and no license.
31*cdf0e10cSrcweir2a version_XXX/dependency.oxt has an unsatisfied dependency and no license.
32*cdf0e10cSrcweir2b version_nodependencies_XXX/dependency.oxt is identical to 2a but without the
33*cdf0e10cSrcweir   dependency.
34*cdf0e10cSrcweir3  version_XXX/license.oxt has no dependencies and a license.
35*cdf0e10cSrcweir
36*cdf0e10cSrcweirThe different versions are:
37*cdf0e10cSrcweir
38*cdf0e10cSrcweirA  version_none contains no version element (treated as version "0").
39*cdf0e10cSrcweirB  version_badelement contains a bad <version val="1"/> (not allowed by the
40*cdf0e10cSrcweir   specification, but treated by the current implementation as version "0").
41*cdf0e10cSrcweirC  version_badvalue contains a bad <version value="1.a"/> (not allowed by the
42*cdf0e10cSrcweir   specification, but treated by the current implementation as version "1").
43*cdf0e10cSrcweirD  version_0.0 contains <version value="0.0"/> (same as version "0").
44*cdf0e10cSrcweirE  version_1.2.3 contains <version value="1.2.3"/>.
45*cdf0e10cSrcweirF  version_1.2.4.7 contains <version value="1.2.4.7"/>.
46*cdf0e10cSrcweirG  version_1.02.4.7.0 contains <version value="1.02.4.7.0"/> (same as version
47*cdf0e10cSrcweir   "1.2.4.7").
48*cdf0e10cSrcweirH  version_1.2.15.3 contains <version value="1.2.15.3"/>.
49*cdf0e10cSrcweir
50*cdf0e10cSrcweirThe total order among the various versions is thus
51*cdf0e10cSrcweir
52*cdf0e10cSrcweir  A = B = D < C < E < F = G < H.
53*cdf0e10cSrcweir
54*cdf0e10cSrcweirThings to watch for:
55*cdf0e10cSrcweir
56*cdf0e10cSrcweir- If version y of extension e is to be installed and version x < y of
57*cdf0e10cSrcweir  extension e is already installed, then
58*cdf0e10cSrcweir   unopkg add e
59*cdf0e10cSrcweir  will replace x with y.
60*cdf0e10cSrcweir
61*cdf0e10cSrcweir- If version y of extension e is to be installed and version x >= y of
62*cdf0e10cSrcweir  extension e is already installed, then
63*cdf0e10cSrcweir   unopkg add e
64*cdf0e10cSrcweir  will fail with an error message.
65*cdf0e10cSrcweir
66*cdf0e10cSrcweir- If version y of extension e is to be installed and any version x of
67*cdf0e10cSrcweir  extension e is already installed, then
68*cdf0e10cSrcweir   unopkg add -f e
69*cdf0e10cSrcweir  will replace x with y.
70*cdf0e10cSrcweir
71*cdf0e10cSrcweir- If version y of extension e is to be installed and any version x of
72*cdf0e10cSrcweir  extension e is already installed, then
73*cdf0e10cSrcweir   unopkg gui "Add..."
74*cdf0e10cSrcweir  and
75*cdf0e10cSrcweir   soffice "Tools - Package Manager... - Add..."
76*cdf0e10cSrcweir  will query with a dialog whether to replace x with y.  The dialog will have
77*cdf0e10cSrcweir  "OK" (replace) preselected if x < y, and "Cancel" otherwise.
78*cdf0e10cSrcweir
79*cdf0e10cSrcweir- If replacing an installed version x of an extension e with a version y fails
80*cdf0e10cSrcweir  because y has unsatisfied dependencies, or because y has a license to wich the
81*cdf0e10cSrcweir  user does not agree, version x is left installed afterwards.
82*cdf0e10cSrcweir
83*cdf0e10cSrcweir- Checking for already installed versions of an extension is only done within a
84*cdf0e10cSrcweir  single layer (unopkg versus unopkg --shared; "My Packages" versus
85*cdf0e10cSrcweir  "OpenOffice Packages" in unopkg gui/soffice), not across layers.
86