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