tcl-hacks

Check-in [89f27f96a9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:requirements for a simple package manager
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:89f27f96a9cb6ab1dc52545ea3f4c10322b2d89e
User & Date: aspect 2018-05-30 04:10:43
Context
2018-05-30
04:11
oops, wrong dir check-in: 2da473003c user: aspect tags: trunk
04:10
requirements for a simple package manager check-in: 89f27f96a9 user: aspect tags: trunk
04:10
some todos in tclish, but it works for now check-in: 66c776ae7e user: aspect tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added hacks/tipple/README.md.





































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
## A simple no-magic Tcl package installer

Goals:

 * easy for newbie adoption
  * download one script and use it on 8.6+ to set up an env
  * no reliance on any packages not shipped with the core.  `sqlite3` only possible exception
 * access packages from git/fossil repos and teapot
 * use a simple requirements txt format
 * easily consume sensibly-structured source repos without further work on the author's part

Requirements:

 * a unix-like environment
 * Tcl 8.6+
 * any of `curl`, `wget`, `fetch`
 * for installing from repos, `git`, `fossil`

Non-goals:

 * building extensions from source.  Those can come from a teapot
 * doing more than the 80% necessary to bootstrap newbies


## Synopsis

    ./tipple init DIR

Create a new environment in DIR

    . DIR/bin/activate

Set up your environment for working in DIR

    tipple install PKG ?VERSION? ?ARCH?
    tipple install repo-url

Add packages to repo


## Filesystem

Tipple creates a project directory consisting of:

    bin/        -- executables
    lib/        -- pkgIndex.tcl style packages
    modules/    -- .tm style modules
    bin/activate    -- source-able script that sets up the environment
    bin/tipple      -- tipple itself
    bin/tclsh       -- wrapper for system tclsh that sources activate first

Also:

    src/        -- where source repos/archives get downloaded and unpacked.  Do Not put this in starpacks.


## Environment

`activate` sets up these environment vars, creating new ones or *prefixing* existing ones

    TCL_8.6_TM_PATH     DIR/modules
    TCLLIBPATH          DIR/lib
    PATH                DIR/bin


## Package sources

Packages can be fetched from:

 * teapot:  one of the urls specified in ???
 * tarball:  local or remote path to archive, which must be *well-behaved*
 * filesystem path:  local path to directory, which must be *well-behaved*
 * git repo:  git+$url, must be *well-behaved*
 * fossil repo:  fossil+$url, must be *well-behaved*

A *well-behaved* package source is expected to Install Correctly by the following means:

    cp -a lib/*     DIR/lib/
    cp -a modules/* DIR/modules/
    cp -a bin/*     DIR/bin/

It must *not*:

 * rely at runtime on anything not in these directories
 * require path-dependent preprocessing


## Metadata

It's useful for tipple to:

 * track what packages it has already installed in a repo
 * recursively install requirements of a given package

This is done with a simple text format `tipple.txt`, which is found in:

 * the root of the tipple environment (DIR)
 * the root of a "well-behaved" package

tipple maintains DIR/tipple.txt by appending to it, and will look for tipple.txt in any packages it's asked to install.

The format is as simple as can be:

    # this is a comment, as you might expect
    
    # empty lines are allowed, and ignored
    
    # require from teapot, latest version
    require package-name
    
    # require from teapot, specific version
    require package-name version
    
    # require from git, latest master or specific checkout
    require git+https://github.com/somebody/somepackage
    require git+https://github.com/somebody/somepackage branch-or-tag-or-commit-id
    
    # require from fossil, latest trunk or specific checkout
    require fossil+https://chiselapp.com/user/somebody/repository/somepackage
    require fossil+https://chiselapp.com/user/somebody/repository/somepackage branch-or-tag-or-commit-id


## Inspiration / see also

 * https://teaparty.rkeene.org/ - `teapot-client` from here is used
 * https://github.com/wduquette/tcl-quill/
 * https://github.com/AngryLawyer/mug/
 * python's pip + virtualenv
 * https://chiselapp.com/user/aspect/repository/sdx/