atool-0.31.0.tar.gz
[atool.git] / TODO
blobc43cbfd27ea3e48327825a4fb0133832688b7f0c
1 add AUTHORS file
2 improve messages printed from arepack.
3 ---
4 rewrite atool implement extract_archive  that is sensitive or not
5 ---
7 add option to assume format with -F in some situations (like tar.gz)?
8 add option to always assume -e? and add some option for the reverse (-s, --single)
9 assume -e when passing a single directory as argument?
11 change back error messages to:
12    cannot foo `bar': No such file or directory
13   make function to format error message?
15 have autoconf generate files in debian subdir as well?
17 in readconfig, add datatype checking to options (bool/str/int/..)
19 add 'atest': test archive integrity
20 add compression level control arguments: store (0) or 1-9
21 make sure atool has non-zero rc when acat can't find a file (.arc files and possibly other)
23 improve error message when some program doesn't exist (now gets unnecessary lines)
25 complete arepack!!
26 arepack to repack archives?
27   arepack existing.tar existing.zip?                    OK done
28   arepack SOURCE DEST                                   OK done
29   arepack -F DESTFORMAT -e SOURCE1 SOURCE2..            dest format
30   arepack -e FORMAT SOURCE DEST                         source format? ??
32   arepack -F.tar.bz2 foo.tar.gz   would only gunzip then bzip2. tar not involved!
34 tests:
35   does gzip support --?
36   does tar support -z?
37   does tar support -I?
38   does tar support --?
39   does zip treat *?[]\ chars in filenames specially?
41 use "--" with gzip and others?
43 Reasons to rewrite in C:
44   - use manual ZIP code so that we can extract archive with '../foo' files too!
45     tar fails entirely when the archive contains '../xxx' members.
46   - the option --save-outdir in extract-to mode could be implemented
47     easier.
48   - multiple commands per action more easily (same with perl tho)
49   - always identify format using magic values, ignoring extension (fast!)
50   - i18n much easier (and faster)
52 Bugs
53   implement list command for single compressed archives? only gzip supports -l
54   consider:
55       apack dummy.tar.gz /etc/hostname
56       mkdir etc
57       aunpack dummy.tar.gz
58     Archive is now extracted with file as dummy/etc/hostname
59     Should it be dummy/hostname or etc-1/hostname instead?
61 Other formats
62   add support for SEA arc.
63   add support for szip (hard because its interface is different from gzip)
64   make an ACE archive (using winace stuff), test ACE extraction!
65   add support for DEB files
66      list:      dpkg-deb -c FILE.deb
67      extract:   dpkg-deb -x FILE.deb $outdir/CONTENTS
68                 dpkg-deb -e FILE.deb $outdir/DEBIAN
69   JAR/ZIP:
70     Implement 'use_jar_for_zip' - use jar for zip archives (fastjar) - test
71     Rename 'use_zip_for_jar' - use zip for jar archives - test
72     Enable add command for jar archives!
75 Other features
76   make a script to detect system settings and configure atool appropriately
77   Make it possible to send additional arguments to RAR etc. engine configurable via command line?
78     especially adiff diff -ruN (note the N) option
80 --------------------------------------------------------------------------------
82 libarchive:
83   OpenArchive(fd)->archive
84   CloseArchive(archive)
85   GetType(archive)
87   BeginJob(archive)->job
88   PerformJob(job)
89   EndJob(job)
90   
91   GetError(job)
92   ErrorManger(job,callback)
93   ProgressManager(job,callback)
95   CreateArchive(file)->archive
97   FileDescriptor
98     close()
99     read(data,amount)
100     write(data,amount)
101     seek(pos,whence)
102   
103   FileIterator(job,fileselector,filecallback)
104   
105   DeleteFile(job,fh)
106   ExtractFile(job,fh,outfd)
107   ReplaceFile(job,fh,infile)
108   
109   AddFile(job,filename,extfile)
113 verbosity levels:
114   0 default, quiet
115   1 verbose, print filenames
116   2 very verbose, print long list format
118 extract: what to when local file exists, only when archive contains one file
119 (and not in interactive mode)
120   * (m)ove to subdirectory
121   * (r)ename
122   * move files to subdir, rename directory
123   * for interactive mode only: (o)verwrite
125 how to extract single compressed file
126   * delete original file afterwards
127   * keep original file
128   * don't extract at all (refuse)               
130 add:
131   * apack: create new archive (refuse if existing exists)
132   * apack -a: add to existing archives (create if necessary)
136 MAJOR options:
138   aunpack       -X      -x [DIR]        extract to dir
139   apack         -A      -a              add files to archive (or create)
140   apack         -C      -c              create only
141   als           -L      -l              list files in archive
142   acat          -P      -c/-p           print file (to standard out) in archive
144   adiff         -D      -d              print difference between two archives
145   afind         -F      -f              find files in archive (emulate find)            [?]
147   arepack       -R      -r              extract and pack archives
151 als ARCHIVE1..
152   -l            -l (long) like ls
153   -f            -f (classify) like ls
154   -m[TYPE]      from all archives, list only files matching (remaining args are matches)
156 prev: als -e *.tar              now:  als *.tar
157 prev: als foo.tar f*            now:  als foo.tar -m f*
159 aunpack ARCHIVE1..
160   -X DIR        where to extract to (otherwise be smart)
161   -m[TYPE]      from all archives, extract only files matching (remaining args are matches)
163 apack ARCHIVE FILE1..
164   -a            add files if archive already exists (without -a, refuse to overwrite existing)
165   -e            all arguments are files (or dirs) to compress individually
166   -F FORMAT     force file format
168   -f            allow overwriting of archives (clobber). NOTE: for safety, this implies
171 --------------------------------------------------------------------------------
173 New rules format:
175 # This document shows how a future rules file format for atool could look. It
176 # was written to outline what was necessary for such a format. It is quite
177 # possible this format will never become a reality due to its complexity.
179 # use ; to separate commands!
181 # rules and configuration files are the same
183 noinclude               # don't include default rules/configuration file!
184                         # (otherwise /etc/atool.rules will be included first)
185                         # useful if you want to make your own rules completely
187 set path_zip "foobar"   # example of variable set in a configuration file
188                         # (can only be done after option declared in format)
190 # the extract command defined here also handles extract-in (only outdir changes)
191 # the create command refuses to create an existing archive
192 # the add command will turn into a create command if the archive doesn't exist
193 # the print command outputs a file in the archive to standard out
195 # variable namespace:
196 #   read-only variables - $outdir, $archive, $args
197 #   format-local variables - declared with 'variable'
198 #   options - declared with option
200 # FIXME: what about about special exit codes (zip)? CHECK atool
202 format {
203   name { zip jar }              # a name for users to use in -F option (force format)
204   extension { .zip .jar }       # possible file extensions (ignored?)
205   magic     { PK\003\004 }      # magic bytes (kinda regex?)
206   option string path_zip "zip"
207   option string path_unzip "unzip"
208   command extract    { $path_unzip "-d" $outdir $archive $args }
209   command add,create { $path_zip "-r" $archive $args }
210   command print      { $path_unzip "-p" $archive $args }
211   command list       { $path_unzip "-l" $archive $args }
212   command common  {
213     [ $verbosity >  1 ] "-v"            # this format means: add "-v" only if $verbosity > 1
214     [ $verbosity <  0 ] "-qq"           # (the first string after [] applies, or block if { } )
215     [ $verbosity == 0 ] "-q"
216   }
217   multiarchive true     # specifies that this archive may contain multiple files
218   needs_cwd false       # specifies that this archive doesn't need to cwd to outdir on extract
219                         # (technically we could autodetect this by seeing of $outdir is referenced
220                         # in the extract command)
223 format {
224   name          { lha lzh }
225   extension     { .lha .lzh }
226   magic         { "..-lh[01234567 d]-" "..-lz[45s]-" }  # what about >20 byte x ; 2 string -lh6-
227   option string path_lha "lha"
228   command common { $path_lha }
229   command extract { "x" $archive $args $outdirslash }   # outdirslash = outdir that ends in slash
230   command add,create { "a" $archive $args }
231   command print { "p" $archive $args }
232   command list {
233     "a"
234     [ $verbosity >= 3 ] "v"
235     [ $verbosity =  2 ] "l"
236     [ $verbosity <= 1 ] "lq"
237   }
238   multiarchive true
239   needs_cwd false
242 format {
243   name          { tar[+.]gz(ip)? }
244   extension     { .tgz .tar.gz }
245   option string path_tar "tar"                          # this one assume tar supports -z
246   variable string opts
247   command common { $path_tar [ $verbosity >= 1 ] [ $opts = "v" ] }      # a conditional
248   command print { xO ++ $opts ++ zf }                   # ++ means concatenate
249   command extract { x ++ $opts ++ zf -C $outdir }       # -C works on Sun too
250   command list { t ++ $opts ++ zf }
251   command create { c ++ $opts ++ zf }                   # tar can append (-r), but not tar+gz
252   command common { $archive $args }
253   multiarchive true
254   needs_cwd false
257 format {
258   disabled                                              # do not use this format at all
259   name          { tar[+.]gz(ip)? }
260   extension     { .tgz .tar.gz }
261   option string path_tar "tar"                          # this one does NOT assume tar supports -z
262   option string path_gzip "gzip"
263   variable string opts
264   command common { [ $verbosity >= 1 ] [ $opts = "v" ] }
265   command print { $path_gzip -cd $archive | $path_tar xO ++ $opts $args }
266   command extract { $path_gzip -cd $archive | $path_tar x ++ $opts $args }
267   command list { $path_gzip -cd $archive | $path_tar t ++ $opts $args }
268   command create { $path_tar c ++ $opts $args | $path_gzip > $archive }
269   multiarchive true
270   needs_cwd false
271   create_only true                                      # FIXME: maybe not necessary? (see create/add above)
275 --------
277 TODO.v2:
279 better extraction semantics, cleaner code
281  * always use change to directory for extraction, never specify dir on cmd command-line?
282    use ../for instead of absolute dir
283    merges extract-to and extract
285  * core support for multiple commands per mode (think debian)
287  * better control of user arguments to external command (@args)
289  * better solution than multiarchivecmd - cleaned up
291  * more general commands:
292      test
294  * more general options
295      compression level
297  * stripext only based on format! (e.g. unpack gz then strip .gz, not .tar.gz)
299 want aunpack -e to be default!