Menu

[2275f9]: / interface-spec.xml  Maximize  Restore  History

Download this file

1105 lines (896 with data), 43.8 kB

   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
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
<?xml version='1.0' encoding='utf-8'?>
<html lang="en">
<h2>Feed file format specification</h2>
<p>
This document is a formal description of the XML feed file format. An interface describes a program,
library or other component. A feed provides a list of known implementations of the interface (versions of the program)
and details about how to get them, how to check that they are authentic, how to run them and what other components
they depend on.
</p>
<p>
This class diagram shows how the different concepts are related. Each feed file contributes information to this model:
</p>
<p class='uml'>
<img src='UML/zero-install-feed-classes.png' width='705' height='378' alt='Class diagram for feed files'/>
</p>
<p>
Each <k>Feed</k> lists a number of <k>Implementations</k> (versions). An <k>Identity</k>
is a way to recognise an Implementation (e.g. a cryptographic digest). A
<k>Retrieval method</k> is a way to get an Implementation (e.g. by downloading
from an FTP site). A <k>Command</k> says how to run an Implementation as a
program.A <k>Dependency</k> indicates that one component depends on another
(e.g. Gimp requires the GTK library). A <k>Binding</k> says how to let the
program locate the Implementations when run. A <k>Constraint</k> limits the
choice of a dependency (e.g. Gimp requires a version of GTK >= 2.6).
</p>
<p>
Note on terminology: originally the word 'interface' was used to mean both 'interface' and 'feed', so don't
be confused if you see it used this way.
</p>
<ul>
<li><a href='http://0install.de/schema/injector/interface/schema.xsd'>XSD schema</a></li>
</ul>
<p>
Changes to this document (and to the rest of the web-site) are <a href='https://sourceforge.net/p/zero-install/code/commit_browser'>tracked using Git</a>.
</p>
<h2>Contents</h2>
<toc level='h2'/>
<h2 id='intro'>Introduction</h2>
<p>
Feed files are introduced in the <a href='injector-packagers.html'>packager's guide</a>.
They have the following syntax (? follows optional items, * means zero-or-more, order of elements
is not important, and extension elements can appear anywhere as long as they use a different
namespace):
</p>
<pre>
&lt;?xml version='1.0'?&gt;
&lt;interface xmlns='http://zero-install.sourceforge.net/2004/injector/interface'
min-injector-version='...' ?
uri='...' ? &gt;
&lt;name&gt;...&lt;/name&gt;
&lt;summary&gt;...&lt;/summary&gt;
&lt;description&gt;...&lt;/description&gt; ?
&lt;homepage&gt;...&lt;/homepage&gt; ?
&lt;category type='...' ? &gt;...&lt;/category&gt; *
&lt;needs-terminal/&gt; ?
&lt;icon type='...' href='...'/&gt; *
&lt;feed src='...' langs='...' ? arch='...' ?/&gt; *
&lt;feed-for interface='...'/&gt; *
&lt;replaced-by interface='...'/&gt; ?
[group] *
[implementation] *
[entry-point] *
&lt;/interface&gt;
</pre>
<dl>
<dt>min-injector-version</dt>
<dd>This attribute gives the oldest version of 0install that can read this file. Older versions will
tell the user to upgrade if they are asked to read the file. Versions prior to 0.20 do not perform this check, however.
If the attribute is not present, the file can be read by all versions.
</dd>
<dt>uri</dt>
<dd>This attribute is only needed for remote feeds (fetched via HTTP). The value must exactly match the expected
URL, to prevent an attacker replacing one correctly-signed feed with another (e.g., returning a feed for the
<b>shred</b> program when the user asked for the <b>backup</b> program).
</dd>
<dt>&lt;name&gt;</dt> <dd>a short name to identify the interface (e.g. "Foo")</dd>
<dt>&lt;summary&gt;</dt> <dd>a short one-line description; the first word should
not be upper-case unless it is a proper noun (e.g. "cures all ills")</dd>
<dt>&lt;description&gt;</dt> <dd>a full description, which can be several paragraphs long (optional since 0.32, but recommended)</dd>
<dt>&lt;homepage&gt;</dt> <dd>the URL of a web-page describing this interface in more detail</dd>
<dt>&lt;category&gt;</dt> <dd>a classification for the interface. If no type is given, then the category is one of the
'Main' categories defined by the <a href='http://standards.freedesktop.org/menu-spec/latest/apa.html'>freedesktop.org menu specification</a>. Otherwise, it is a URI giving the namespace for the category.</dd>
<dt>&lt;needs-terminal&gt;</dt> <dd>if present, this element indicates that the program requires a terminal in order to run. Graphical launchers should therefore run this program in a suitable terminal emulator.</dd>
<dt>&lt;icon&gt;</dt> <dd>an icon to use for the program; this is used by programs such as
<a href="http://rox.sourceforge.net/desktop/AddApp">AddApp</a>.</dd>
<dt>&lt;feed&gt;</dt> <dd>the linked feed contains more implementations of this feed's interface. The "langs" and "arch" attributes, if present, indicate that all implementations will fall within
these limits (e.g. arch='*-src' means that there is no point fetching this feed
unless you are looking for source code). See the &lt;implementation&gt; element
for a description of the values of these attributes.</dd>
<dt>&lt;feed-for&gt;</dt> <dd>the implementations in this feed are implementations of the given interface. This is used when adding an optional extra feed to an interface with "0install add-feed" (e.g. a <a href='local-feeds.html'>local feed</a> for a development version).</dd>
<dt id='replaced-by'>&lt;replaced-by&gt;</dt> <dd>this feed's interface (the one in the root element's <b>uri</b> attribute) has been replaced by the given interface. Any references to the old URI should be updated to use the new one.</dd>
</dl>
<h2 id='groups'>Groups</h2>
<p>
A group has this syntax:
</p>
<pre>
&lt;group
version='...' ?
released='...' ?
main='...' ?
self-test='...' ?
doc-dir='...' ?
license='...' ?
released='...' ?
stability='...' ?
langs='...' ?
arch='...' ? &gt;
[requires] *
[group] *
[command] *
[binding] *
[implementation] *
[package-implementation] *
&lt;/group&gt;
</pre>
<p>
All attributes of the group are inherited by any child groups and implementations as defaults, but
can be overridden there. All dependencies ("requires"), bindings and commands are inherited (sub-groups may add more
dependencies and bindings to the list, but cannot remove anything).
</p>
<h2 id='implementations'>Implementations</h2>
<p>
An implementation has this syntax (an unspecified argument is inherited from
the closest ancestor &lt;group&gt; which defines it):
</p>
<pre>
&lt;implementation
[all &lt;group&gt; attributes]
id='...'
local-path='...' ? &gt;
&lt;manifest-digest [digest] * /> *
[command] *
[retrieval-method] *
[binding] *
[requires] *
&lt;/implementation&gt;
</pre>
<p class='uml'>
<img src='UML/zero-install-id.png' width='405' height='205' alt='Identity classes'/>
</p>
<dl>
<dt>id</dt>
<dd>A unique identifier for this implementation. For example, when the user marks a particular
version as buggy this identifier is used to keep track of it, and saving and restoring selections
uses it. However, see the important historical note below.</dd>
<dt>local-path</dt>
<dd>
If the feed file is a local file (the interface 'uri' starts with <b>/</b>)
then the <b>local-path</b> attribute <i>may</i> contain the pathname of a local
directory (either an absolute path or a path relative to the directory
containing the feed file). See the historical note below.</dd>
<dt>version</dt>
<dd>The version number. See the version numbers section below for more details.</dd>
<dt>main (deprecated)</dt>
<dd>The relative path of an executable inside the implementation that should be executed by default
when the interface is run. If an implementation has no <b>main</b> setting, then it cannot be executed
without specifying one manually (with <b>0launch --main=MAIN</b>). This typically means that the interface
is for a library. Note: <b>main</b> is being replaced by the &lt;command&gt; element.</dd>
<dt>self-test (deprecated)</dt>
<dd>The relative path of an executable inside the implementation that can be executed to test the program.
The program must be non-interactive (e.g. it can't open any windows or prompt for input).
It should return with an exit status of zero if the tests pass. Any other status indicates failure. Note: <b>self-test</b> is being replaced by the &lt;command&gt; element.
</dd>
<dt>doc-dir</dt>
<dd>The relative path of a directory inside the implementation that contains the package's documentation.
This is the directory that would end up inside <b>/usr/share/doc</b> on a traditional Linux system.</dd>
<dt>released</dt>
<dd>The date this implementation was made available, in the format YYYY-MM-DD. For development versions checked
out from version control this attribute should not be present.</dd>
<dt>stability</dt>
<dd>The default stability rating for this implementation. If not present, <b>testing</b> is used.
See the stability section below for more details.</dd>
<dt>langs</dt>
<dd>The natural language(s) which this package supports, as a space-separated
list of languages codes (in the same format as used by the $LANG environment
variable). For example, the value "en_GB fr" would be used for a package
supporting British English and French. Supported since 0.48. Note that versions before 0.54
require the region separator to be '_' (underscore), while later versions also allow the use of '-'
for consistency with the xml:lang format.</dd>
<dt>arch</dt>
<dd>For platform-specific binaries, the platform for which this implementation was compiled, in the form <b>os-cpu</b>.
0install knows that certain platforms are backwards-compatible with others, so binaries with <b>arch="Linux-i486"</b>
will still be available on <i>Linux-i686</i> machines, for example. Either the <i>os</i> or <i>cpu</i> part may be <b>*</b>,
which will make it available on any OS or CPU. If missing, the default is <b>*-*</b>. See also: <a href='#archs'>Valid architecture names</a>.</dd>
<dt>license</dt>
<dd>License terms. This is typically a <a href='http://catb.org/~esr/trove/'>Trove</a> category. See <a href='http://pypi.python.org/pypi?%3Aaction=list_classifiers'>the PyPI list</a> for some examples (the leading "License :: " is not included).</dd>
</dl>
<p>
The <b>manifest-digest</b> element is used to give digests of the .manifest file
using various hashing algorithms (but see the historical note below). Having multiple
algorithms allows a smooth upgrade to newer digest algorithms without breaking old
clients. Each non-namespaced attribute gives a digest, with the attribute
name being the algorithm. For example:
</p>
<pre>
&lt;manifest-digest sha256="4f078f9080bd9b3b87e8360f014268886ec653ed077bb3cb6725185c0a07473a"/>
</pre>
<p>
For non-local implementations (those without a local-path attribute), the
&lt;implementation&gt; element contains a set of <i>retrieval methods</i>, each
of which gives a different way of getting the implementation (i.e. of getting a
directory structure whose digest matches the ones given).
</p>
<p>
Currently, 0install always chooses the first of the methods it understands,
but in future it may use other strategies (such as choosing the closest mirror,
or letting the user select one manually). It may also use other methods which
aren't listed, such as searching for the implementation on a peer-to-peer
network.
</p>
<p>Unrecognised elements inside an implementation are ignored.</p>
<h3>Historical note about id</h3>
<p>
0launch >= 0.45 generally treats the ID as a simple identifier, and gets the local path (if any)
from the local-path attribute and the digests from the &lt;manifest-digest&gt;.
</p>
<p>
0launch &lt; 0.45 ignores the local-path attribute and the &lt;manifest-digest&gt; element.
If the ID starts with '.' or '/' then the ID is also the local path; otherwise, it is the
single manifest digest.
</p>
<p>
For backwards compatibility, 0launch >= 0.45 will treat an ID starting with '.' or '/' as a
local path if no local-path attribute is present, and it will treat it as an additional
digest if it contains an '=' character.
</p>
<p>
Therefore, if you want to generate feeds compatible with past and future versions:
</p>
<ul>
<li>If you have a digest, set the ID to "sha1new=..." and put the sha256 digest in the
&lt;manifest-digest&gt;.</li>
<li>If you have a local implementation then set both id and local-path to the pathname.</li>
</ul>
<h2 id='commands'>Commands</h2>
<p>
The <b>main</b> attribute above provides a simple way to say how to run this implementation. The
&lt;command&gt; element (supported since 0.51, released Dec 2010) provides a more flexible alternative.
</p>
<pre>
&lt;command
name='...'
path='...' ? &gt;
[binding] *
[requires] *
[runner] ?
&lt;arg&gt; ... &lt;/arg&gt; *
&lt;for-each item-from='...' separator='...'? &gt; ... &lt;/for-each&gt; *
&lt;/command&gt;
</pre>
<dl>
<dt>name</dt>
<dd>By default, 0launch executes the "run" command, but the <b>--command</b> option can be used to specify a different one.
<a href='0test.html'>0test</a> runs the "test" command (replacing the old <b>self-test</b> attribute) and <a href='0compile.html'>0compile</a> runs the "compile" command (replacing the <b>compile:command</b> attribute).</dd>
<dt>path</dt>
<dd>The relative path of the executable within the implementation (optional if &lt;runner&gt; is used).</dd>
</dl>
<p>
Additional arguments can be passed using the &lt;arg&gt; element. Within an argument, "${name}" is expanded to the value of the corresponding environment variable. These arguments are passed to the program before any arguments specified by the user.
</p>
<p>
If an environment variable should be expanded to multiple arguments, use &lt;for-each&gt;. The variable in the 'item-from' attribute is split using the given separator (which defaults to the OS path separator, ":" on POSIX and ";" on Windows) and the arguments inside the element are added for each item. The current item is available as "${item}". If the variable given in 'item-from' is not set or is empty, no arguments are added. See below for an example. Versions of 0install before 1.15 ignore &lt;for-each&gt; elements and their contents.
</p>
<p>
Command-specific dependencies can be specified for a command by nesting &lt;requires&gt; elements. For example, an interpreter might only depend on libreadline when
used interactively, but not when used as a library, or the "test" command might depend on a test framework.
</p>
<p>
Command-specific bindings (0launch >= 1.3) create a binding from the implementation to itself. For example, the "test" command may want to make the "run" command available in $PATH using &lt;executable-in-path&gt;.
</p>
<p>
The &lt;runner&gt; element introduces a special kind of dependency: the program that is used to run this one. For example, a Python
program might specify Python as its runner. &lt;runner&gt; is a subclass of
&lt;requires&gt; and accepts the same attributes and child elements. In addition, you can specify arguments to pass to the runner by nesting them inside the &lt;runner&gt; element.
These arguments are passed before the path of the executable given by the 'path' attribute.
</p>
<p>For example:</p>
<pre>
&lt;command name='run' path="causeway.e-swt"&gt;
&lt;runner interface='http://repo.roscidus.com/e/e-core'&gt;
&lt;arg&gt;-cpa&lt;/arg&gt;
&lt;arg&gt;$SWT_JAR&lt;/arg&gt;
&lt;for-each item-from="EXTRA_E_OPTIONS" separator=" ">
&lt;arg>${item}&lt;/arg>
&lt;/for-each>
&lt;/runner&gt;
&lt;/command&gt;
</pre>
<p>
In this case, 0install will run the equivalent of <b>/path/to/e-interpreter -cpa /path/to/swt.jar $EXTRA_E_OPTIONS /path/to/causeway.e-swt</b>.
</p>
<h2 id='package-implementation'>Package implementations</h2>
<p>
This element names a distribution-provided package which, if present, is a valid
implementation of this interface. The syntax is:
</p>
<pre>
&lt;package-implementation
package='...'
distributions='...' ?
main='...' ? &gt;
[command] *
[requires] *
&lt;/package-implementation>
</pre>
<p>
If the named package is available then it will be considered as a possible implementation
of the interface. If <b>main</b> is given then it must be an absolute path.
</p>
<p>
If the <b>distributions</b> attribute is present then it is a space-separated list of distribution names
where this element applies. 0launch >= 0.45 ranks the &lt;package-implementation&gt; elements according
to how well they match the host distribution and then only uses the best match (or matches, if several get
the same score). See <a href='distribution-integration.html'>Distribution integration</a> for a list of
supported distributions.
</p>
<p>
Earlier versions of 0launch ignore the <b>distributions</b> attribute and process all of the elements.
</p>
<p>
Note that, unlike a normal implementation, a distribution package does not resolve to a directory.
Any bindings inside &lt;requires&gt; elements for the interface will be ignored; it is assumed that
the requiring component knows how to use the packaged version without further help. Therefore, adding
distribution packages to your interface considerably weakens the guarantees you are making about what
the requester may get.
</p>
<p>
Package implementations still inherit attributes and dependencies from their parent group. The
<b>doc-dir</b> and <b>license</b> attributes may be given, but <b>version</b> and <b>released</b>
are read from the native packaging system.
</p>
<p>
Support for distribution packages was added in version 0.28 of 0install. Earlier versions ignore
this element.
</p>
<h2 id='retrieval-methods'>Retrieval methods</h2>
<p>
A retrieval method is a way of getting an implementation.
</p>
<p class='uml'>
<img src='UML/zero-install-retr.png' width='485' height='415' alt='Retrieval method classes'/>
</p>
<p>
The most common retrieval method is the &lt;archive&gt; element:
</p>
<pre id='retrievalmethods'>
&lt;archive
href='...'
size='...'
extract='...' ?
dest='...' ?
type='...' ?
start-offset='...' ? /&gt;
</pre>
<p>
This states that an archive may be downloaded from the address given in the <b>href</b> attribute. The archive must
have the given <b>size</b> or it will be rejected. When unpacked (either the subdirectory named in the <b>extract</b>
attribute, or the whole archive if it is not present), the resulting tree will generate a manifest with the secure hash
value given as the implementation's <b>id</b>. If <b>dest</b> is given (0install >= 2.1), then the archive is unpacked
to the specified subdirectory. It is an error to specify a target outside of the implementation directory (e.g.
"../foo" or attempting to follow a symlink that points out of the implementation).
</p>
<p>
The type of the archive is given as a MIME type in the <b>type</b> attribute
(since <b>0launch</b> version 0.21). If missing, the type is guessed from the extension on the
<b>href</b> attribute (all versions). Known types and extensions (case insensitive) are:
</p>
<ul>
<li>application/x-rpm (.rpm) - not supported by Windows version</li>
<li>application/x-deb (.deb) - not supported by Windows version</li>
<li>application/x-tar (.tar)</li>
<li>application/x-bzip-compressed-tar (.tar.bz2)</li>
<li>application/x-lzma-compressed-tar (.tar.lzma)</li>
<li>application/x-compressed-tar (.tar.gz or .tgz)</li>
<li>application/zip (.zip)</li>
<li>application/vnd.ms-cab-compressed (.cab)</li>
<li>application/x-xz-compressed-tar (.tar.xz) - since version 0.43, not supported by Windows version</li>
<li>application/x-ruby-gem (.gem) - since version 1.0-rc1, not supported by Windows version</li>
<li>application/x-7z-compressed (.7z) - Windows version only</li>
<li>application/x-msi (.msi) - Windows version only</li>
</ul>
<p>
The <b>start-offset</b> attribute (since version 0.21) gives the number of
bytes at the beginning of the file which should be ignored. This is useful for
some self-extracting archives which are made up of a shell script followed by a
normal archive in a single file. If missing, it defaults to 0. The value in the
<b>size</b> attribute does not include the skipped bytes.
</p>
<p>
You can also fetch individual files (0install >= 2.1). This is useful for e.g. jar files, which are typically not unpacked:
</p>
<pre id='file'>
&lt;file
href='...'
size='...'
dest='...' /&gt;
</pre>
<p>
The file is downloaded from <b>href</b>, must be of the given <b>size</b>, and is placed within the implementation directory as <b>dest</b>.
</p>
<h3 id='recipe'>Recipes</h3>
<p>
An implementation can also be created by following a &lt;recipe&gt;:
</p>
<pre>
&lt;recipe&gt;
( &lt;archive ...&gt; | &lt;file ...&gt; | &lt;rename ...&gt; | &lt;remove ...&gt; | &lt;copy-from ...&gt; ) +
&lt;/recipe&gt;
</pre>
<p>
In this case, each child element of the recipe represents a step. To get an implementation by following a recipe,
a new empty directory is created and then all of the steps are performed in sequence. The resulting directory
must have the digest given in the implementation's &lt;manifest-digest&gt;. A recipe containing only a single archive is equivalent
to just specifying the archive on its own.
If a recipe contains an unrecognised element then the whole recipe must be ignored.
</p>
<dl>
<dt>&lt;archive ...&gt;</dt>
<dd>Causes the named archive to be fetched and unpacked over the top of whatever is currently in the temporary directory. It supports the same attributes as when used outside of a recipe.</dd>
<dt>&lt;file ...&gt;</dt>
<dd>Causes the named file to be fetched and saved over the top of whatever is currently in the temporary directory (0install >= 2.1). It supports the same attributes as when used outside of a recipe.</dd>
<dt>&lt;rename source='...' dest='...'&gt;</dt>
<dd>Renames or moves a file or directory (0install >= 1.10). It is an error if the source or destination are outside the implementation.</dd>
<dt>&lt;remove path='...'&gt;</dt>
<dd>Delete the file or directory from the implementation (0install >= 2.1). It is an error if the path is outside the implementation.</dd>
<dt>&lt;copy-from id='...' source='...' ? dest='...' ?&gt;</dt>
<dd>Copies files or directories from another implementation, e.g., for applying an update to a previous version (0install >= 2.13). The specified id must exactly match the id attribute of another implementation specified elsewhere in the same feed. You can specify the source and destination file or directory to be copied relative to the implementation root. Leave them unset to copy the entire implementation.</dd>
</dl>
<p>
Note: A recipe is generally only useful for patching existing archives without having to host the complete result
yourself. Normally, if your program requires files from several different packages then it is better to use the
&lt;requires&gt; element instead. This allows libraries to be shared between different programs, and lets the user
choose the versions and upgrade them individually.
</p>
<h2 id='dependencies'>Dependencies</h2>
<p>
A &lt;requires&gt; element means that every implementation within the same group (including nested
sub-groups) requires an implementation of the specified interface when run. 0install will choose a
suitable implementation, downloading one if required.
</p>
<pre>
&lt;requires
interface='...'
importance='...' ?
version='...' ?
os='...' ?
distribution='...' ?
source='true|false' ?
use='...' ? &gt;
[ constraints ] *
[ bindings ] *
&lt;/requires&gt;
</pre>
<p>
The constraint elements (if any) limit the set of acceptable versions. The bindings specify how
0install should make its choice known (typically, by setting environment variables).
</p>
<p>
The <b>use</b> attribute can be used to indicate that this dependency is only needed in some cases. By default, 0launch >= 0.43
will skip any &lt;requires&gt; element with this attribute set. Earlier versions process all &lt;requires&gt; elements
whether this attribute is present or not. <a href='0test.html'>0test</a> >= 0.2 will process dependencies where <b>use="testing"</b>, in
addition to the program's normal dependencies. This attribute is deprecated - it's usually better to use a &lt;command&gt; for this.
</p>
<p>
The <b>importance</b> attribute (0install >= 1.1) can be either
"<b>essential</b>" (the default; a version of this dependency must be selected)
or "<b>recommended</b>" (no version is also an option, although selecting a
version is preferable to not selecting one).
</p>
<p>
The <b>version</b> attribute (0install >= 1.13) provides a quick way to specify the permitted versions. See the <a href='#constraints'>Constraints</a> section below.
</p>
<p>
The <b>distribution</b> attribute (0install >= 1.15) can be used to require the selected implementation to be from the given distribution. For example, a Python library available through MacPorts can only be used with a version of Python which is also from MacPorts. The value of this attribute is a space-separated list of distribution names. In addition to the <a href='distribution-integration.html'>official list of distribution names</a>, the special value "0install" may be used to require an implementation provided by 0instal (i.e. one not provided by a &lt;package-implementation&gt;).
</p>
<p>
The <b>os</b> attribute (0install >= 1.12) can be used to indicate that the dependency only applies to the given OS (e.g. <b>os="Windows"</b> for
dependencies only needed on Windows systems).
</p>
<p>
The <b>source</b> attribute (0install >= 2.8) can be used to indicate that a source implementation is needed rather than a binary. This may be useful if you want to get e.g. header files from a source package. Note that if you select both source and binary implementations of an interface, 0install does not automatically force them to be the same version.
</p>
<p>
A &lt;restricts&gt; element (0install >= 1.10) can be used to apply constraints without creating a dependency:
</p>
<pre>
&lt;restricts
interface='...'
version='...' ?
os='...' ?
distribution='...' ? &gt;
[ constraints ] *
&lt;/restricts&gt;
</pre>
<p>
Internally, &lt;restricts&gt; behaves much like &lt;requires importance='recommended'&gt;, except that it doesn't try to cause the interface to be selected at all.
</p>
<h2 id='constraints'>Constraints</h2>
<p>
Constraints appear inside &lt;requires&gt;, &lt;restricts&gt; and &lt;runner&gt; elements. They restrict the set of versions from which
0install may choose an implementation.
</p>
<pre>
&lt;version
not-before='...' ?
before='...' ? &gt;
</pre>
<dl>
<dt>not-before</dt>
<dd>This is the lowest-numbered version that can be chosen.</dd>
<dt>before</dt>
<dd>This version and all later versions are unsuitable.</dd>
</dl>
<p>For example, <b>&lt;version not-before='2.4' before='2.6'&gt;</b> allows any of these
versions: 2.4, 2.4.0, and 2.4.8. It will not select 2.3.9 or 2.6.
</p>
<p>
Since 0install 1.13, it is also possible to use a <b>version</b> attribute on the dependency directly. This provides a shorter and more flexible way to specify versions.
The attribute's value is a list of ranges, separated by "|", any of which may match.
For example:
</p>
<pre>
&lt;restricts interface='http://repo.roscidus.com/python/python'
version='2.6..!3 | 3.2.2..'/>
</pre>
<p>
This allows Python versions 2.6, 2.7 and 3.3, but not 2.5 or 3.
</p>
<p>
Each range is in the form "START..!END". The range matches versions where START &lt;= VERSION &lt; END. The start or end may be omitted. A single version number may be used instead of a range to match only that version, or !VERSION to match everything except that version.
</p>
<p>
Note: to support older versions of 0install, it is preferable to use the &lt;version&gt; element instead where possible.
</p>
<h2 id='bindings'>Bindings</h2>
<p>
Bindings specify how the chosen implementation is made known to the running program. Bindings
can appear in a &lt;requires&gt; element, in which case they tell a component how to find its
dependency, or in an &lt;implementation&gt; (or group), where they tell a component how to find
itself.
</p>
<p class='uml'>
<img src='UML/zero-install-binding.png' width='565' height='225' alt='Binding classes'/>
</p>
<h3 id='environment'>Environment bindings</h3>
<pre>
&lt;environment
name='...'
(insert='...' | value='...')
mode='prepend|append|replace' ?
separator='...' ?
default='...' ? /&gt; *
</pre>
<p>
Details of the chosen implementation are passed to the program by setting environment variables,
as specified by the &lt;environment&gt; elements (typically, there will be exactly one of these in each
&lt;requires&gt; element). Each environment element gives the name of the variable and the relative path
of the item within the implementation to insert into the variable's value.
</p>
<p>
Usually, the (badly-named) <b>insert</b> attribute is used, which adds a path to a file or directory inside the
implementation to the environment variable. For example, &lt;environment
name='PATH' insert='bin'/&gt; would perform something similar to the bash shell
statement <b>export PATH=/path/to/impl/bin:$PATH</b>.
</p>
<p>
Alternatively, you can use the <b>value</b> attribute to use a literal string. For example,
&lt;environment name='GRAPHICAL_MODE' value='TRUE' mode='replace'/&gt;. This requires 0launch >= 0.52.
</p>
<p>
If <b>mode</b> is <b>prepend</b> (or not set), then the absolute path of the
item is prepended to the current value of the variable. The default separator character
is the colon character on POSIX systems, and semi-colon on Windows. This can be overridden
using <b>separator</b> (0install >= 1.1). If the environment variable is not currently
set then the path is prepended to the value of the default attribute. If no
default value is given either then the default for that environment variable is
used, or the environment variable's value is set to the absolute path directly
if there is no default.
</p>
<p>
If <b>mode</b> is <b>append</b> then the same thing happens, except that the new
value is added at the end instead of the beginning. If the mode is <b>replace</b> then
the old value is overwritten, and the <b>default</b> attribute is ignored.
</p>
<p>
The following environment variables have known defaults and therefore the <b>default</b> attribute is not
needed with them:
</p>
<dl>
<dt>PATH</dt><dd>/bin:/usr/bin</dd>
<dt>XDG_CONFIG_DIRS</dt><dd>/etc/xdg</dd>
<dt>XDG_DATA_DIRS</dt><dd>/usr/local/share:/usr/share</dd>
</dl>
<h3 id='executable'>Executable bindings</h3>
<p>
These both require 0install >= 1.2.
</p>
<pre>
&lt;executable-in-var
name='...'
command='...' ? /&gt;
&lt;executable-in-path
name='...'
command='...' ? /&gt;
</pre>
<p>
These are used when the program needs to run another program. <b>command</b> says which of the program's commands to use; the default is "run".
</p>
<p>
&lt;executable-in-var&gt; stores the path of the selected executable
in the named environment variable. For example, if a program uses <b>$MAKE</b> to run make, you can provide the required command
like this:
</p>
<pre>
&lt;requires interface="http://repo.roscidus.com/devel/make"&gt;
&lt;executable-in-var name='MAKE'/&gt;
&lt;/requires&gt;
</pre>
<p>
&lt;executable-in-path&gt; works in a similar way, except that it adds a directory containing the executable to $PATH. For example,
if the program instead just runs the <b>make</b> command, you would use:
</p>
<pre>
&lt;requires interface="http://repo.roscidus.com/devel/make"&gt;
&lt;executable-in-path name='make'/&gt;
&lt;/requires&gt;
</pre>
<p>
It is preferable to use &lt;executable-in-var&gt; where possible, to avoid making $PATH very long.
</p>
<p>
Implementation note: On POSIX systems, 0install will create a shell script under ~/.cache/0install.net/injector/executables and pass the path of this script.
</p>
<h3 id='generic-bindings'>Generic bindings</h3>
<p>
Custom bindings can be specified using the &lt;binding&gt; element (0install >= 2.1). 0install will not know how to run a program using custom bindings itself, but it will include them in any selections documents it creates, which can then be executed by your custom code. The syntax is:
</p>
<pre>
&lt;binding
path='...' ?
command='...' ?
... &gt;
...
&lt;/binding&gt;
</pre>
<p>
If <b>command</b> is given, then 0install will select the given &lt;command&gt; within the implementation (which may cause additional dependencies and bindings to be selected). Otherwise, no command is selected.
</p>
<p>
Any additional attributes and child elements are not processed, but are just passed through. If your binding needs a path within the selected implemention, it is suggested that the <b>path</b> attribute be used for this. Other attributes and child elements should be namespaced to avoid collisions.
</p>
<p>
For example, the <a href='ebox.html'>EBox</a> application launcher allows each code module to specify its dependencies, which are then available in the module's scope as <i>getters</i>. The ebox-edit application depends on the help library like this:
</p>
<pre>
&lt;requires interface="http://0install.net/tests/ebox-help.xml">
&lt;binding e:getter='help'/>
&lt;/requires>
</pre>
<h2 id='versions'>Versions</h2>
<p>
A version number string has the following form:
</p>
<pre>
Version := DottedList ("-" Modifier? DottedList?)*
DottedList := (Integer ("." Integer)*)
Modifier := "pre" | "rc" | "post"
</pre>
<p>
Numerically, the modifiers come in the order "-pre" (pre-release), "-rc" (release candidate),
"-" (no modifier name), "-post" (post-release or patch level). Versions are ordered like this:
</p>
<ul>
<li>0.1</li>
<li>1</li>
<li>1.0</li>
<li>1.1</li>
<li>1.2-pre</li>
<li>1.2-pre1</li>
<li>1.2-rc1</li>
<li>1.2</li>
<li>1.2-0</li>
<li>1.2-post</li>
<li>1.2-post1-pre</li>
<li>1.2-post1</li>
<li>1.2.1-pre</li>
<li>1.2.1.4</li>
<li>1.2.2</li>
<li>1.2.10</li>
<li>3</li>
</ul>
<p>
0install doesn't care about anything other than the sort order (i.e., whether
one version comes before or after another). It is expected that an
implementation can be safely replaced by one with a later version number, but
not necessarily with an earlier one. So, if an application works with version
"1.2.1" of a library then it should also work with version "1.2.2" or "1.3" or
even "5.7", but not "1.2.0". This is a little different to some other systems,
where numbers in different places have different meanings.
</p>
<p>
For example, if the latest version of a library you use is version 5.1, then
you shouldn't add the restriction <b>before='5.2'</b>, because when 5.2 comes
out it should still work with your program. Of course, this might not always work,
and hopefully the problem will be reported while the new library version is marked
as testing (before most users hit the problem). Once you know that 5.2 is a problem,
you can add the <b>before='5.2'</b> restriction to the implementation then.
</p>
<p>
Incompatible changes (where a newer version cannot be used in place of an older
version) to an interface should be handled by creating a new interface URI. Eg:
</p>
<ul>
<li>http://gtk.org/2005/interfaces/GTK-1.2.x (contains 1.2.0, 1.2.1, 1.2.2, ...)</li>
<li>http://gtk.org/2005/interfaces/GTK-2.x (contains 2.0.0, 2.0.1, 2.2.0, 2.4.0, 2.4.1, ...)</li>
</ul>
<p>
Note that version numbers containing dash characters were not supported before version 0.24 of
0install and so a <b>version-modifier</b> attribute was added to allow new-style versions to be added without breaking older versions. This should no longer be used.
</p>
<p>
The integers in version numbers must be representable as 64-bit signed integers.
</p>
<h2 id='stability'>Stability</h2>
<p>
The feed file also gives a stability rating for each implementation. The following
levels are allowed (must be lowercase in the feed files):
</p>
<ul>
<li>stable</li>
<li>testing</li>
<li>developer</li>
<li>buggy</li>
<li>insecure</li>
</ul>
<p>
Stability ratings are expected to change over time. When any new release is
made, its stability should be set to <b>testing</b>. Users who have selected
<b>Help test new versions</b> will then start using it. Other users will
continue with the previous stable release. After a while (days, weeks or
months, depending on the project) with no serious problems found, the
implementation's stability can be changed to <b>stable</b> so that everyone
will use it.
</p>
<p>
If problems are found, it can instead be marked as <b>buggy</b>, or <b>insecure</b>. 0install
won't select either by default, but it is useful to users to see the reason (users may opt to
continue using a buggy version if it seems to work for them, but they should never use an insecure
one). <b>developer</b> is like a more extreme version of <b>testing</b>, where the program is
expected to have bugs.
</p>
<h4>When to use 'buggy'</h4>
<p>
Don't mark old releases as <b>buggy</b> every time you do a new release, just
because a few bugs have been fixed. People who have selected <b>Network
use: Full</b> will automatically upgrade to the new version anyway, so marking an older
version as buggy only affects people who have explicitly stated that they <b>don't</b>
want to use the latest version, but would prefer to use an older release to
save network use.
</p>
<h2 id='entry-points'>Entry points</h2>
<p>(only used on the Windows version currently)</p>
<p>
Entry points allow you to associate additional information with &lt;command&gt; names, such as user-friendly names and descriptions. Entry points are used by the Zero Install GUI to help the user choose a command and by the desktop integration system to generate appropriate menu entries for commands. An entry point is not necessary for a command to work but it makes it more discoverable to end-users.
</p>
<p>
Entry points are top-level elements and, unlike commands, are not associated with any specific implementation or group. One entry point represents all commands in all implementations that carry the same name. An entry point has this syntax:
</p>
<pre>
&lt;entry-point
command='...'
binary-name='...' ? &gt;
&lt;needs-terminal/&gt; ?
&lt;name&gt;...&lt;/name&gt; ?
&lt;summary&gt;...&lt;/summary&gt; ?
&lt;description&gt;...&lt;/description&gt; ?
&lt;icon type='...' href='...'/&gt; *
&lt;/group&gt;
</pre>
<dt>command</dt>
<dd>the name of the command this entry point represents</dd>
<dt>binary-name</dt>
<dd>the canonical name of the binary supplying the command (without file extensions); this is used to suggest suitable alias names.</dd>
<dt>&lt;needs-terminal&gt;</dt>
<dd>if present, this element indicates that the command represented by this entry point requires a terminal in order to run.</dd>
<dt>&lt;name&gt;</dt>
<dd>user-friendly name for the command. If not present, the value of the <b>command</b> attribute is used instead.</dd>
<dt>&lt;summary&gt;</dt>
<dd>a short one-line description; the first word should not be upper-case unless it is a proper noun (e.g. "cures all ills")</dd>
<dt>&lt;description&gt;</dt>
<dd>a full description, which can be several paragraphs long</dd>
<dt>&lt;icon&gt;</dt>
<dd>an icon to represent the command; this is used when creating menu entries.</dd>
<h2 id='metadata'>Metadata</h2>
<p>
All elements can contain extension elements, provided they are not in the Zero
Install namespace used by the elements defined here. 0install does not
currently make use of these elements itself, but other programs may find them
useful. In future, some of these may be used (for example, the GUI may display
the license terms).
</p>
<p>
The use of <a href='http://dublincore.org'>Dublin Core</a> is suggested for the following concepts, which
have the following meanings when found as a direct child of a &lt;group&gt; or &lt;implementation&gt; element:
</p>
<dl>
<dt>dc:creator</dt>
<dd>The primary author of the program.</dd>
<dt>dc:publisher</dt>
<dd>The person who created this implementation. For a binary, this is the person who
compiled it.</dd>
</dl>
<p>
Other Dublin Core terms that may be useful include contributor,
dateCopyrighted, language, rights and rightsHolder.
</p>
<p>
These terms are not required as they are duplicated by the core Zero Install terms: identifier (id),
available (released) and requires (requires).
</p>
<p>
The source element may be used in future to record the source used to build this implementation.
</p>
<h2 id='signatures'>Digital signatures</h2>
<p>
When a feed is downloaded from the web, it must contain a digital signature.
A feed is signed by appending an XML comment block of the form:</p>
<pre><![CDATA[
<!-- Base64 Signature
iD8DBQBEXM/qrgeCgFmlPMERArNSAKDBuNz5SQMZ8rwJmW2fhNHJwor6KwCgwx7XEfY+6gUC90rJ
b5eCY+I8HNA=
-->]]></pre>
<p>
This block <b>must</b> go at the end of the file, and contains a Base64-encoded version of
the file that would be created by using <b>gpg --detach-sign</b> on the original feed.
The signature block must start on a new line, may not contain anything except valid base64
characters, and nothing may follow the signature block. XML signature blocks are supported
from version 0.18 of 0install and may be generated easily using the
<a href='0publish.html'>0publish</a> command.
</p>
<p>
Local interfaces are plain XML, although having an XML signature block is no problem as it
will be ignored as a normal XML comment.
</p>
<h2 id='arch-names'>Valid architecture names</h2>
<p id='archs'>The <b>arch</b> attribute is a value in the form "OS-CPU". The values come from the <b>uname</b> system call, but
there is some normalisation (e.g. because Windows doesn't report the same CPU names as Linux). Valid values for OS include:</p>
<ul>
<li>*</li>
<li>Cygwin (a Unix-compatibility layer for Windows)</li>
<li>Darwin (MacOSX, without the proprietary bits)</li>
<li>FreeBSD</li>
<li>Linux</li>
<li>MacOSX</li>
<li>Windows</li>
</ul>
Valid values for CPU include:
<ul>
<li>*</li>
<li>src</li>
<li>i386</li>
<li>i486</li>
<li>i586</li>
<li>i686</li>
<li>ppc</li>
<li>ppc64</li>
<li>x86_64</li>
<li>armv6l</li>
<li>armv7l</li>
</ul>
<h2 id='if-0install-version'>The if-0install-version attribute</h2>
<p>
To make it possible to use newer features in a feed without breaking older versions of 0install, the <b>if-0install-version</b> attribute may
be placed on any element to indicate that the element should only be processed by the specified versions of 0install. For example:
</p>
<pre>
&lt;group&gt;
&lt;new-element if-0install-version='1.14..'/>
&lt;fallback if-0install-version='..!1.14'/>
&lt;/group&gt;
</pre>
<p>
In this example, 0install 1.14 and later will see &lt;new-element>, while older versions see &lt;fallback>. The syntax is as described in <a href='#constraints'>Constraints</a>.</p>
<p>However, 0install versions before 1.13 ignore this attribute and process all elements.
</p>
<h2 id='future'>Future plans</h2>
<ul>
<li>The extra meta-data elements need to be better specified.</li>
<li>As well as before and not-before, we should support after and not-after.</li>
<li>It should be possible to give a delta (binary patch) against a previous version, to make upgrading
quicker.</li>
<li>It should be possible to scope bindings. For example, when a DTP package requires a clipart package, the
clipart package should not be allowed to affect the DTP package's environment.</li>
</ul>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.