source: project/wiki/releasing-your-egg @ 33377

Last change on this file since 33377 was 33377, checked in by Mario Domenech Goulart, 5 years ago

releasing-your-egg (wiki): add note about using the CHICKEN SVN repository for _new_ user eggs is deprecated.

File size: 23.4 KB
Line 
1== Releasing your egg
2
3[[toc:]]
4
5Let's say you've been reading the [[eggs tutorial]] and you are almost
6done writing your first egg.  You've tested that it works locally, and
7now you probably want to make it available to others.  If you would
8like people to be able to install your egg using {{chicken-install YOUR-EGG}},
9there are a few steps you need to take.
10
11=== Note for Subversion users
12
13Before going on details on the process for Subversion,
14please note that hosting '''new''' eggs in the '''CHICKEN central
15Subversion repository''' is '''deprecated'''.  We recommend using
16your own code server or one of the hosts available on the Internet
17(e.g., github, bitbucket etc.).
18
19If you host your egg on {{code.call-cc.org}} or you host your own,
20you don't ''have'' to do any of the steps below.  Instead, you can
21use the release generating script at call-cc.org.  It does all the
22steps below automatically.
23
24The URI for an automatically generated release-info for egg YOUR-EGG is
25{{http://code.call-cc.org/release-info?egg=YOUR-EGG}}
26
27This URI can be put in the {{egg-locations}} file as described under
28[[#publishing-your-egg|"Publishing your egg"]].
29
30If you want more control over the process, please read on.
31
32=== Creating a release-info file
33
34First, you must create a so-called "release-info" file and make it
35available on a well-known location via HTTP (discussed below).  This
36is a file which describes where the released versions of your egg can
37be found.
38
39After everything's set up, releasing a new version of your egg is
40simply a matter of tagging your release with your VCS of choice and
41adding a line to this file. See [[#helper-scripts|below]] for some tools
42to automate even this small step.
43
44It looks something like this:
45
46<enscript highlight="scheme">
47(repo git "git://example.com/{egg-name}.git")   ; optional
48
49(uri targz "http://example.com/{egg-name}/releases/{chicken-release}/{egg-name}-{egg-release}.tar.gz")
50(release "0.1")
51(release "0.2")
52(release "1.0")
53</enscript>
54
55This example describes where to find the canonical repository and an URI pattern
56which describes how to find release tarballs.  It then goes on to declare three
57official releases; 0.1, 0.2 and 1.0.
58
59The patterns in the URI enclosed in curly braces are seen as
60substitution patterns to be replaced by values.  {{egg-name}} expands
61to the current egg's name (which is already known when the
62release-info file is being fetched), {{egg-release}} is replaced by
63the string in each {{release}} declaration.  {{chicken-release}} is
64replaced by the major CHICKEN version for which the egg is being
65fetched.  This allows you to supply different packages for each major
66CHICKEN release.
67
68The supported types for {{uri}} are currently {{targz}}, {{tarbz2}}, {{zip}},
69{{meta-file}} and {{files-list}}.  The first three are all archives expected
70to extract to a directory with the egg sources in it (zip files are allowed
71to expand directly into the files, but this is not recommended).  The latter
72two are special and deserves some more explanation; see the next section for that.
73
74Currently {{repo}} is not used by automated tools, but is intended to
75make it easy for users to find the repository.  In preparation for
76when it will be used in the future, it's a good idea to use consistent
77names, so please use the ''short name'' of the tool.  Generally this is
78how it is invoked on the commandline: {{git}}, {{hg}}, {{svn}}, {{fossil}}, {{bzr}}, {{mtn}}, {{darcs}} etc.
79
80==== Meta-file distribution
81
82Sometimes it is impractical to create archives containing your egg's file
83contents.  The egg releasing system has been designed to require as few manual
84steps as possible, so it is easy for people to release early and often.
85
86A core ideal of the release system is to make it possible to release
87simply by tagging your code in a VCS.  Some code hosting sites
88automatically make archives available for each tagged version, thereby
89making the release available immediately when the code is pushed to
90the server.  For those that don't, the meta-file distribution file
91type is a way to release by tagging ''without'' having to manually
92make a tarball, ''as long as there is a way to directly obtain the raw
93sources of a specific release version via HTTP''.
94
95The idea is that each released egg always must have a meta-file to describe
96its dependencies, its author and license and so on.  This meta-file can be
97used to provide a listing of all the files that are part of an egg.  The system
98that manages egg releases automatically will download all these files and put
99them in a directory.  When someone requests your egg with {{chicken-install}},
100these files are all served up.  Just add a {{files}} entry to your meta-file,
101which lists the files (these are resolved relatively to the meta-file itself).
102
103<enscript highlight="scheme">
104((files "uri-common.setup" "uri-common.release-info" "uri-common.meta"
105        "uri-common.scm" "tests/run.scm")
106 (license "BSD")
107 (category web)
108 (depends (uri-generic 2.3) defstruct matchable)
109 (test-depends test)
110 (author "Peter Bex")
111 (synopsis "Parser for common URI schemes"))
112</enscript>
113
114This is a real-world example of the [[/eggref/4/uri-common|uri-common egg]].
115It lists all the files which it consists of, and these will be downloaded by
116chicken-install.  The disadvantage of this approach is that if you forget a
117file, your egg is uninstallable, so if you can please use the archive
118distribution types instead.  Another disadvantage is that every time you add,
119remove or rename a file you need to remember to change the meta-file.
120
121The {{uri}} entry in uri-common's {{release-info}} file looked like this
122before there was an autogenerated one:
123
124<enscript highlight="scheme">
125(uri meta-file "http://anonymous@code.call-cc.org/svn/chicken-eggs/release/{chicken-release}/{egg-name}/tags/{egg-release}/{egg-name}.meta")
126</enscript>
127
128Because this egg uses subversion and each release has a corresponding
129tag, it can simply point to the metafile in the right subdirectory
130under tags and it will simply work.  For other version systems this
131may require some more messing around.
132
133==== files-list
134
135This is an extremely stupid format containing a manifest of files in
136an egg.  It's mostly useful when automatically generating lists of files.
137It starts with a base URI and then lists all the files in the egg.
138Here's the [[http://code.call-cc.org/files-list?egg=uri-generic;egg-release=1.0;chicken-release=4|files-list for version 1.0 of the uri-generic egg for CHICKEN 4]]:
139
140  http://anonymous:@code.call-cc.org/svn/chicken-eggs/release/4/uri-generic/tags/1.0
141  tests/run.scm
142  uri-generic.meta
143  uri-generic.scm
144  uri-generic.setup
145
146The trailing slash after the URI is required.
147
148It's not recommended you use this manually, as this format is subject
149to change and only really intended to be used as a communication system
150between [[/eggref/4/pseudo-meta-egg-info|pseudo-meta-egg-info]] and
151[[/eggref/4/henrietta-cache|henrietta-cache]].
152
153However, if you really need to use this, you can replace the
154{{meta-file}} uri type in the example above by {{files-list}}, like
155the auto-generated
156[[http://code.call-cc.org/release-info?egg=uri-generic|release-info file for uri-generic]],
157which starts like this:
158
159  (uri files-list "http://code.call-cc.org/files-list?egg={egg-name};egg-release={egg-release};chicken-release={chicken-release}")
160  (release "1.0")
161  (release "1.1")
162
163=== Publishing your egg
164
165After creating the release-info file, you need to make it known to the
166chicken-install infrastructure that an egg with the given name has a
167release info file at the location where you published it.  This step finally
168makes it possible for people to say {{chicken-install YOUR-EGG}} and have
169it install your egg, or use {{(depends YOUR-EGG)}} in meta-files of their eggs.
170
171Currently this is done by adding a line to the egg-locations file in
172Subversion, which can be found at
173[[https://code.call-cc.org/svn/chicken-eggs/release/4/egg-locations]]. For security reasons, editing the {{egg-locations}} file requires special permissions.  So, to have an entry for your egg in that file, send a message to the [[http://lists.nongnu.org/mailman/listinfo/chicken-users|chicken-users mailing list]] announcing your egg and requesting the inclusion of its location to {{egg-locations}}.
174
175To keep maintenance to a minimum, it's best to add a release-info
176location which will never change; only the release-info file itself
177should be changed when you make a new release.  This can most easily
178be accomplished by pointing to the "raw file" view of your
179trunk/tip/head/master branch in your canonical repository's web
180interface.  That way, this file is kept under version control
181alongside all the other files in your egg.
182
183If you do have an svn account and don't want to checkout the whole egg
184repository to be able to just edit this file, you can work around svn's
185limitations like this:
186
187 $ cd /tmp
188 $ svn co https://code.call-cc.org/svn/chicken-eggs/release/4 --depth empty
189 $ cd 4
190 $ svn update egg-locations
191
192If you prefer, you can just publish the file separately via HTTP
193somewhere and keep overwriting it.  If your code hoster doesn't
194provide an easy way to point to a raw view on a moving "latest
195version" pointer via HTTP, you could instead opt to store just the
196release-info files of your eggs in the centralised CHICKEN eggs
197subversion repository.  Just contact one of the project maintainers or
198write to the chicken-users mailinglist.
199
200=== Instructions for popular code hosting methods and VCSes
201
202Now we've explained the basic idea, here's an overview of how to figure
203out the correct URIs and how to automate some steps away.
204
205==== Bitbucket (mercurial, git)
206
207===== Location of release-info file
208
209You can use the code browser to figure out the path to your
210release-info file.  First, copy the link that says "raw".  This URI is
211almost correct but will contain a revision ID hash, so it is pinned to
212whatever revision is currently the tip.  However, you can replace it
213with the string "tip" and it will still work, and when you visit it again
214after making changes it will have picked up those changes.  Example:
215
216Clicking "mini-kanren.release-info" and then copying the "raw" link on
217[[https://bitbucket.org/ThatGeoGuy/chicken-minikanren/src]] gives us
218[[https://bitbucket.org/ThatGeoGuy/chicken-minikanren/raw/8af0b51f5efac79c8bc0cfe856185ad06d7aa9d0/mini-kanren.release-info]]
219
220Just change it to
221[[https://bitbucket.org/ThatGeoGuy/chicken-minikanren/raw/master/mini-kanren.release-info]]
222and you have the latest master version.  If you're using Mercurial
223instead of git, use {{tip}} instead of {{master}}.
224
225This link should be registered in the egg-locations list for your egg
226and it will automatically be able to fetch any new releases as they
227are tagged and added to the release-info file.
228
229===== Making releases
230
231The bitbucket code browser also offers a "get source" link that allows
232you to fetch the files in that revision as a tarball.  The same trick
233as with the raw files works here; just replace the link's revision ID
234hash with a symbolic name.  You can use tags and bookmarks as symbolic
235names.
236
237So to make a new release, just tag your release with a well-defined
238name. If you tag your eggs with the version as tag or bookmark name,
239you can use the following release-info file.  Just don't forget to
240substitute your bitbucket username!
241
242<enscript highlight="scheme">
243(repo hg "https://bitbucket.org/YOUR-BITBUCKET-USERNAME/{egg-name}")
244(uri targz "https://bitbucket.org/YOUR-BITBUCKET-USERNAME/{egg-name}/get/{egg-release}.tar.gz")
245(release "0.1")
246</enscript>
247
248==== Gitlab (git)
249
250===== Location of release-info file
251
252Use the code browser ("Files" in the menu) to browse to your master
253branch's release-info file and copy the "Raw" link.  For example, for
254the [[/eggref/4/sdl2|SDL2 egg]] it looks like this:
255
256[[https://gitlab.com/chicken-sdl2/chicken-sdl2/raw/master/sdl2.release-info]]
257
258===== Making releases
259
260Gitlab makes tags available for download as tarballs.  To find the
261location, go to the code browser and switch to a tag at the top left.
262On the right side there's a drop-down menu that offers a download for
263various archive formats.
264
265So to make a new release, just tag your release with a well-defined
266name. If you're using gitlab.com's hosted service and tag your eggs
267with the version as tag name, you can use the following release-info
268file.  Just don't forget to substitute your Gitlab project name!
269
270<enscript highlight="scheme">
271(repo git "https://gitlab.com/PROJECT-NAME/{egg-name}.git")
272(uri targz "https://gitlab.com/PROJECT-NAME/{egg-name}/repository/archive.tar.gz?ref={egg-release}")
273(release "0.1")
274</enscript>
275
276
277==== Github (git)
278
279===== Location of release-info file
280
281Use the code browser ("source" tab) to browse to your release-info
282file and copy the "raw" link.  This link should work as-is, as long as
283you do this while looking at the latest revision of the file in the
284master branch.  For example, for the [[/eggref/4/kalaha|Kalaha egg]]
285it would look like:
286
287[[https://raw.github.com/DerGuteMoritz/kalaha/master/kalaha.release-info]]
288
289===== Making releases
290
291Github makes tags available for download as tarballs.  To find the
292location, click the big "Downloads" button/link in the code browser.
293It will pop up a selection dialog where you can choose between tarball
294and "zipball".  It will also offer downloads for each tag, but those
295are zipballs only.  However, you can copy the link and replace
296"zipball" in the URL by "tarball", or you can first click "switch
297tags" and then open the "Downloads" dialog and it will offer you
298download links for both tar and zip for that specific tag.
299
300So to make a new release, just tag your release with a well-defined
301name. If you tag your eggs with the version as tag name, you can use
302the following release-info file.  Just don't forget to substitute your
303Github username!
304
305<enscript highlight="scheme">
306(repo git "git://github.com/YOUR-GITHUB-USERNAME/{egg-name}.git")
307(uri targz "https://codeload.github.com/YOUR-GITHUB-USERNAME/{egg-name}/tar.gz/{egg-release}")
308(release "0.1")
309</enscript>
310
311==== Gitweb (git)
312
313===== Location of release-info file
314
315Navigate to the "tree" view for the master branch of your project and
316copy the "raw" link for your release-info file. The link will look
317something like this, for an egg "foo":
318
319 http://gitweb/gitweb.cgi?p=foo.git;a=blob_plain;f=foo.release-info
320
321===== Making releases
322
323The download link for a tarball of a specific Git tag is accessible
324through Gitweb with a query string like the following:
325
326 http://gitweb/gitweb.cgi?p={egg-name}.git;a=snapshot;h=refs/tags/{egg-release};sf=tgz
327
328So, if you tag each release and use a release-info file like the
329following, every new tag will be made available as a tarball at that URL
330(make sure to substitute your Git URL and Gitweb host into {{repo}}
331and {{uri}} strings):
332
333<enscript highlight="scheme">
334(repo git "git://gitweb/{egg-name}.git")
335(uri targz "http://gitweb/gitweb.cgi?p={egg-name}.git;a=snapshot;h=refs/tags/{egg-release};sf=tgz")
336(release "0.1")
337</enscript>
338
339==== Cgit (git)
340
341===== Location of release-info file
342
343Navigate to the "tree" view for the master branch of your project and
344copy the "plain" link for your release-info file (it's all the way to
345the right). The link will look something like this, for an egg "foo":
346
347 http://cgit.example.com/foo/plain/foo.release-info
348
349For example, the release info for the [[/eggref/4/hardwood|Hardwood
350egg]] looks like this:
351
352[[http://www.upyum.com/cgit.cgi/hardwood/plain/hardwood.release-info]]
353
354The {{cgit.cgi}} part is optional, depending on how cgit was
355configured.  For example, the release-info for the
356[[/eggref/4/scsh-process|scsh-process egg]] looks like this:
357
358[[http://code.more-magic.net/scsh-process/plain/scsh-process.release-info]]
359
360===== Making releases
361
362The download link for a tarball of a specific Git tag can be found by
363visiting "refs", then the tag, following it to the commit and if
364snapshots are shown there should be a download link, but it links
365directly to the commit hash.  You can simply replace the hash with the
366symbolic tag name.
367
368If snapshots are not shown, it's still possible to construct the link
369manually, and it will work:
370
371 http://cgit.example.com/cgit.cgi/{egg-name}/snapshot/{egg-name}-{egg-release}.tar.gz
372
373So, if you tag each release and use a release-info file like the
374following, every new tag will be made available as a tarball at that
375URL (make sure to substitute your Git URL and Cgit host into
376{{repo}} and {{uri}} strings):
377
378<enscript highlight="scheme">
379(repo git "http://cgit.example.com/cgit.cgi/{egg-name}")
380(uri targz "http://cgit.example.com/{egg-name}/snapshot/{egg-name}-{egg-release}.tar.gz")
381(release "0.1")
382</enscript>
383
384==== hgweb (mercurial) - aka "hg serve"
385
386The built-in web interface for mercurial can be used to serve up eggs,
387usually invoked from hgweb and hgwebdir on a "real" server.
388
389===== Location of release-info file
390
391Use the browser to navigate to the latest revision of the release-info
392file and click the "raw" link on the left.  Then replace the commit ID
393hash with "tip".  Example:
394
395[[http://example.com/my-egg/raw-file/tip/my-egg.release-info]]
396
397===== Making releases
398
399Since this interface doesn't have a way to serve up tarballs, you must
400either create your own tarballs and publish them elsewhere or use the
401manual "meta-file" way.
402
403See [[#meta-file-distribution|the meta-file section]] at the start of
404this wiki page to figure out how to set up a {{files}} section in your
405meta-file.  The URI to your meta file is similar to the release-info
406file, except this time you can replace "tip" with the release's
407tagname.  If you use tagnames that are identical to the release
408version, you can base the release-info file on the following example:
409
410<enscript highlight="scheme">
411(repo hg "http://example.com/{egg-name}")
412(uri meta-file "http://example.com/{egg-name}/raw-file/{egg-release}/{egg-name}.meta")
413(release "0.1")
414</enscript>
415
416This assumes hgwebdir is running on the domain's root URI and the egg
417is available in a repo which has the same name as your egg.
418
419==== Fossil's default web UI
420
421This is the web UI you get when running "fossil serve" or when running
422fossil as a CGI script.
423
424There is one tricky part: by default, this interface disallows almost
425all outside access; you ''must'' log in, even if you just want to
426browse anonymously. To allow everybody to download release zipfiles or
427tarballs without login, add the "z" permission for the user "nobody"
428in the Admin / Users section of the web UI or with the "fossil user
429capabilities" command.
430
431===== Location of release-info file
432
433Fossil's web UI allows serving of documents directly from the
434repository under URLs of the form
435"http://example.com/my-egg/doc/{version}/{file}". If the files have a
436".txt" or ".wiki" extension, they are rendered into HTML, but anything
437else is served as is.
438
439For example you can store the release-info file in the repository and
440always access the latest version of the default branch at a URL like
441"http://example.com/my-egg/doc/trunk/my-egg.release-info".
442
443===== Making releases
444
445Fossil can serve tarballs or zipfiles of repository snapshots. A
446release-info file using zipfile packaging may look like this:
447
448<enscript highlight="scheme">
449(repo fossil "http://example.com/{egg-name}")
450(uri zip "http://example.com/{egg-name}/zip/{egg-name}.zip?uuid=v{egg-release}")
451(release "1.0.0")
452</enscript>
453
454For tarball packaging, the equivalent {{uri}} entry should look like
455this:
456
457<enscript highlight="scheme">
458(uri targz "http://example.com/{egg-name}/tarball/{egg-name}.tar.gz?uuid=v{egg-release}")
459</enscript>
460
461The releases are referenced using symbolic tags of the form
462"v{egg-release}" here. You can add these tags to the changesets
463corresponding to released versions of the egg using the "fossil tag
464add" command.
465
466==== Launchpad (bazaar)
467
468Unfortunately, Launchpad doesn't currently seem very suitable for
469developing eggs in a streamlined way.  Here's a description of one
470possible way to integrate with their way of doing release management though.
471
472===== Location of release-info file
473
474You can browse to the release-info file using Loggerhead (the web
475interface to bazaar), but there doesn't seem to be a reliable way to
476construct a raw download URI for "the latest version of" a file.
477
478A workaround is to create a release series just for the release-info,
479and make an (unused) milestone for that.  Then you can upload a
480release-info file.  The URI that's listed directly on the downloads
481page is stable though (something like
482[[http://launchpad.net/my-project/main/release-info/+download/my-egg.release-info]]
483if you named the milestone "release-info" in the "main" series)
484This link redirects to an unstable URI, so don't paste that one!
485
486When you make a new release you can ''delete'' the file and upload a new
487one manually to the same pseudo-"release".
488
489
490===== Making releases
491
492If you do it through their release management, you just create release
493tarballs which you manually upload into the release milestone.
494
495The only automation here is that you can use {{bzr export --format=tgz}}
496to create it, and the advantage that you're using someone else's site to
497host your code.
498
499You can use this release-info file template if you are consistent in
500your milestone naming.  It assumes you used the name "main" for the
501series from which releases for chicken-install are made.  You could
502alternatively add several {{uri}} entries, one per series, but it's
503still required that your egg's release versions are unique for your
504egg.  Series are probably more suitable for distinguishing between
505major CHICKEN release versions.
506
507<enscript highlight="scheme">
508(repo bzr "lp:MY-PROJECT/main")
509
510(uri targz "http://launchpad.net/MY-PROJECT/main/{egg-release}/+download/{egg-name}.tar.gz")
511(release "0.1")
512(release "0.2")
513</enscript>
514
515
516=== Helper scripts
517
518To make life easier, there are some helper scripts, hooks etcetera
519that could be used.  Please add your own links here.
520
521==== Subversion
522
523There's an [[/eggref/4/svn-egg-author|svn-egg-author egg]] that helps
524you to update the release-info and meta files and tag a release of
525your egg, all with one command.
526
527If you run your own subversion server with Spiffy, you can consider
528using [[/eggref/4/pseudo-meta-egg-info|pseudo-meta-egg-info]] instead.
529If you do, you do not need to use svn-egg-author.  If you're using the
530chicken-eggs repository hosted on call-cc.org, you don't need it either
531because call-cc is already running pseudo-meta-egg-info for all its eggs.
532
533==== Mercurial
534
535There's an
536[[http://code.more-magic.net/hg-egg-author/plain/egg-author.py|egg-author]]
537extension for Mercurial that allows you to say {{hg eggtag 0.1}} and have it
538automatically update the release-info file with the new tag name.
539
540==== Git
541
542There's a [[/eggref/4/git-egg-author|git-egg-author egg]] that helps you
543keep your release-info file up-to-date and tag a release with one command.
544
545==== Bazaar
546
547There's also a [[https://launchpad.net/bzr-egg-author|bzr-egg-author]]
548extension for Bazaar that allows you to say {{bzr eggtag 0.1}} and have it
549automatically update the release-info file with the new tag name.
550
551=== Moving an egg
552
553When you decide to migrate to a different code hosting site, and don't
554want to move all releases, you can define multiple uris:
555
556<enscript highlight="scheme">
557;; Main ("default") repo
558(repo hg "https://bitbucket.org/YOUR-BITBUCKET-USERNAME/{egg-name}")
559(uri targz "https://bitbucket.org/YOUR-BITBUCKET-USERNAME/{egg-name}/get/{egg-release}.tar.gz")
560(release "2.1")
561(release "2.0")
562
563;; Old repo, using "old-svn-repo" alias
564(repo svn "http://anonymous:@code.call-cc.org/svn/chicken-eggs/release/4/{egg-name}")
565(uri files-list "http://code.call-cc.org/files-list?egg={egg-name};egg-release={egg-release};chicken-release={chicken-release}" old-svn-repo)
566(release "1.3" old-svn-repo)
567(release "1.2" old-svn-repo)
568(release "1.1" old-svn-repo)
569(release "1.0" old-svn-repo)
570(release "0.2" old-svn-repo)
571(release "0.1" old-svn-repo)
572</enscript>
Note: See TracBrowser for help on using the repository browser.