libarchive 0.1.0-mswin32 → 0.1.1-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ The libarchive distribution as a whole is Copyright by Tim Kientzle
2
+ and is subject to the copyright notice reproduced at the bottom of
3
+ this file.
4
+
5
+ Each individual file in this distribution should have a clear
6
+ copyright/licensing statement at the beginning of the file. If any do
7
+ not, please let me know and I will rectify it. The following is
8
+ intended to summarize the copyright status of the individual files;
9
+ the actual statements in the files are controlling.
10
+
11
+ * Except as listed below, all C sources (including .c and .h files)
12
+ and documentation files are subject to the copyright notice reproduced
13
+ at the bottom of this file.
14
+
15
+ * The following source files are also subject in whole or in part to
16
+ a 3-clause UC Regents copyright; please read the individual source
17
+ files for details:
18
+ libarchive/archive_entry.c
19
+ libarchive/archive_read_support_compression_compress.c
20
+ libarchive/archive_write_set_compression_compress.c
21
+ libarchive/mtree.5
22
+ tar/matching.c
23
+
24
+ * The following source files are in the public domain:
25
+ tar/getdate.y
26
+
27
+ * The build files---including Makefiles, configure scripts,
28
+ and auxiliary scripts used as part of the compile process---have
29
+ widely varying licensing terms. Please check individual files before
30
+ distributing them to see if those restrictions apply to you.
31
+
32
+ I intend for all new source code to use the license below and hope over
33
+ time to replace code with other licenses with new implementations that
34
+ do use the license below. The varying licensing of the build scripts
35
+ seems to be an unavoidable mess.
36
+
37
+
38
+ Copyright (c) 2003-2008 <author(s)>
39
+ All rights reserved.
40
+
41
+ Redistribution and use in source and binary forms, with or without
42
+ modification, are permitted provided that the following conditions
43
+ are met:
44
+ 1. Redistributions of source code must retain the above copyright
45
+ notice, this list of conditions and the following disclaimer
46
+ in this position and unchanged.
47
+ 2. Redistributions in binary form must reproduce the above copyright
48
+ notice, this list of conditions and the following disclaimer in the
49
+ documentation and/or other materials provided with the distribution.
50
+
51
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
52
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54
+ IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
55
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,42 @@
1
+
2
+ --------------------------------------------------------------------------
3
+
4
+ This program, "bzip2", the associated library "libbzip2", and all
5
+ documentation, are copyright (C) 1996-2007 Julian R Seward. All
6
+ rights reserved.
7
+
8
+ Redistribution and use in source and binary forms, with or without
9
+ modification, are permitted provided that the following conditions
10
+ are met:
11
+
12
+ 1. Redistributions of source code must retain the above copyright
13
+ notice, this list of conditions and the following disclaimer.
14
+
15
+ 2. The origin of this software must not be misrepresented; you must
16
+ not claim that you wrote the original software. If you use this
17
+ software in a product, an acknowledgment in the product
18
+ documentation would be appreciated but is not required.
19
+
20
+ 3. Altered source versions must be plainly marked as such, and must
21
+ not be misrepresented as being the original software.
22
+
23
+ 4. The name of the author may not be used to endorse or promote
24
+ products derived from this software without specific prior written
25
+ permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
28
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
31
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+
39
+ Julian Seward, jseward@bzip.org
40
+ bzip2/libbzip2 version 1.0.5 of 10 December 2007
41
+
42
+ --------------------------------------------------------------------------
data/README.txt CHANGED
@@ -63,7 +63,7 @@ gem install libarchive
63
63
  === reading archive
64
64
  require 'libarchive_ruby'
65
65
 
66
- Archive::Reader.open_filename('foo.tar.gz') do |ar|
66
+ Archive.read_open_filename('foo.tar.gz') do |ar|
67
67
  while entry = ar.next_header
68
68
  name = entry.pathname
69
69
  data = ar.read_data
@@ -79,9 +79,8 @@ gem install libarchive
79
79
 
80
80
  === creating archive
81
81
  require 'libarchive_ruby'
82
- include Archive
83
82
 
84
- Writer.open_filename('foo.tar.bz2', COMPRESSION_BZIP2, FORMAT_TAR_USTAR) do |ar|
83
+ Archive.write_open_filename('foo.tar.bz2', Archive::COMPRESSION_BZIP2, Archive::FORMAT_TAR_USTAR) do |ar|
85
84
  Dir.glob('*.c').each do |fn|
86
85
  ar.new_entry do |entry|
87
86
  entry.copy_stat(fn)
@@ -97,12 +96,12 @@ gem install libarchive
97
96
  end
98
97
  end
99
98
  end
99
+
100
+ === creating archive by extarnal program
101
+ require 'libarchive_ruby'
100
102
 
101
- Reader.open_filename('foo.zip') do |ar|
102
- while entry = ar.next_header
103
- p entry.pathname
104
- p ar.read_data.size
105
- end
103
+ Archive.write_open_filename('foo.tar.lzo', 'lzop', Archive::FORMAT_TAR_USTAR) do |ar|
104
+ ...
106
105
  end
107
106
 
108
107
  == License
@@ -132,7 +131,13 @@ gem install libarchive
132
131
  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
133
132
  DAMAGE.
134
133
 
135
- === Libarchive
136
- Libarchive/Ruby(mswin32) contains Libarchive 2.6.0.
137
- * http://people.freebsd.org/~kientzle/libarchive/
138
- * see {COPYING.libarchive}[link:files/COPYING_libarchive.html]
134
+ === Static link library
135
+ Libarchive/Ruby(mswin32) contains Libarchive(2.6.0) and libbzip2(1.0.5).
136
+
137
+ * Libarchive
138
+ * http://people.freebsd.org/~kientzle/libarchive/
139
+ * see {COPYING.libarchive}[link:files/COPYING_libarchive.html]
140
+
141
+ * libbzip2
142
+ * http://www.bzip.org/
143
+ * see {LICENSE.libbzip2}[link:files/LICENSE_libbzip2.html]
@@ -1208,7 +1208,7 @@ static VALUE rb_libarchive_reader_close(VALUE self) {
1208
1208
  return Qnil;
1209
1209
  }
1210
1210
 
1211
- static VALUE rb_libarchive_reader_s_open0(int (*archive_open)(struct rb_libarchive_archive_container *, void *), void *arg, int compression, int format) {
1211
+ static VALUE rb_libarchive_reader_s_open0(int (*archive_open)(struct rb_libarchive_archive_container *, void *), void *arg, int compression, int format, const char *cmd) {
1212
1212
  VALUE reader;
1213
1213
  struct rb_libarchive_archive_container *p;
1214
1214
  int r;
@@ -1219,7 +1219,9 @@ static VALUE rb_libarchive_reader_s_open0(int (*archive_open)(struct rb_libarchi
1219
1219
  rb_raise(rb_eArchiveError, "Open reader failed: %s", strerror(errno));
1220
1220
  }
1221
1221
 
1222
- if (compression != -1) {
1222
+ if (cmd != NULL) {
1223
+ r = archive_read_support_compression_program(p->ar, cmd);
1224
+ } else if (compression != -1) {
1223
1225
  r = archive_read_support_compression(p->ar, compression);
1224
1226
  } else {
1225
1227
  r = archive_read_support_compression_all(p->ar);
@@ -1288,11 +1290,15 @@ static VALUE rb_libarchive_reader_s_open_filename(int argc, VALUE *argv, VALUE s
1288
1290
  VALUE v_filename, v_compression, v_format;
1289
1291
  const char *filename = NULL;
1290
1292
  int compression = -1, format = -1;
1293
+ const char *cmd = NULL;
1291
1294
  rb_scan_args(argc, argv, "12", &v_filename, &v_compression, &v_format);
1292
1295
  Check_Type(v_filename, T_STRING);
1293
1296
  filename = RSTRING_PTR(v_filename);
1294
1297
 
1295
- if (!NIL_P(v_compression)) {
1298
+ if (T_STRING == TYPE(v_compression)) {
1299
+ compression = -1;
1300
+ cmd = RSTRING_PTR(v_compression);
1301
+ } else if (!NIL_P(v_compression)) {
1296
1302
  compression = NUM2INT(v_compression);
1297
1303
  }
1298
1304
 
@@ -1300,7 +1306,7 @@ static VALUE rb_libarchive_reader_s_open_filename(int argc, VALUE *argv, VALUE s
1300
1306
  format = NUM2INT(v_format);
1301
1307
  }
1302
1308
 
1303
- return rb_libarchive_reader_s_open0(rb_libarchive_reader_s_open_filename0, (void *) filename, compression, format);
1309
+ return rb_libarchive_reader_s_open0(rb_libarchive_reader_s_open_filename0, (void *) filename, compression, format, cmd);
1304
1310
  }
1305
1311
 
1306
1312
  static int rb_libarchive_reader_s_open_memory0(struct rb_libarchive_archive_container *p, void *arg) {
@@ -1312,10 +1318,14 @@ static int rb_libarchive_reader_s_open_memory0(struct rb_libarchive_archive_cont
1312
1318
  static VALUE rb_libarchive_reader_s_open_memory(int argc, VALUE *argv, VALUE self) {
1313
1319
  VALUE v_memory, v_compression, v_format;
1314
1320
  int compression = -1, format = -1;
1321
+ const char *cmd = NULL;
1315
1322
  rb_scan_args(argc, argv, "12", &v_memory, &v_compression, &v_format);
1316
1323
  Check_Type(v_memory, T_STRING);
1317
1324
 
1318
- if (!NIL_P(v_compression)) {
1325
+ if (T_STRING == TYPE(v_compression)) {
1326
+ compression = -1;
1327
+ cmd = RSTRING_PTR(v_compression);
1328
+ } else if (!NIL_P(v_compression)) {
1319
1329
  compression = NUM2INT(v_compression);
1320
1330
  }
1321
1331
 
@@ -1323,7 +1333,7 @@ static VALUE rb_libarchive_reader_s_open_memory(int argc, VALUE *argv, VALUE sel
1323
1333
  format = NUM2INT(v_format);
1324
1334
  }
1325
1335
 
1326
- return rb_libarchive_reader_s_open0(rb_libarchive_reader_s_open_memory0, (void *) v_memory, compression, format);
1336
+ return rb_libarchive_reader_s_open0(rb_libarchive_reader_s_open_memory0, (void *) v_memory, compression, format, cmd);
1327
1337
  }
1328
1338
 
1329
1339
  /* */
@@ -1494,7 +1504,9 @@ void Init_libarchive_reader() {
1494
1504
  rb_define_alloc_func(rb_cArchiveReader, rb_libarchive_archive_alloc);
1495
1505
  rb_funcall(rb_cArchiveReader, rb_intern("private_class_method"), 1, ID2SYM(rb_intern("new")));
1496
1506
  rb_define_singleton_method(rb_cArchiveReader, "open_filename", rb_libarchive_reader_s_open_filename, -1);
1507
+ rb_define_module_function(rb_mArchive, "read_open_filename", rb_libarchive_reader_s_open_filename, -1);
1497
1508
  rb_define_singleton_method(rb_cArchiveReader, "open_memory", rb_libarchive_reader_s_open_memory, -1);
1509
+ rb_define_module_function(rb_mArchive, "read_open_memory", rb_libarchive_reader_s_open_memory, -1);
1498
1510
  rb_define_method(rb_cArchiveReader, "close", rb_libarchive_reader_close, 0);
1499
1511
  rb_define_method(rb_cArchiveReader, "next_header", rb_libarchive_reader_next_header, 0);
1500
1512
  rb_define_method(rb_cArchiveReader, "header_position", rb_libarchive_reader_header_position, 0);
@@ -1524,9 +1536,10 @@ static VALUE rb_libarchive_writer_close(VALUE self) {
1524
1536
  return Qnil;
1525
1537
  }
1526
1538
 
1527
- static VALUE rb_libarchive_writer_s_open0(int (*archive_open)(struct rb_libarchive_archive_container *, void *), void *arg, int compression, int format) {
1539
+ static VALUE rb_libarchive_writer_s_open0(int (*archive_open)(struct rb_libarchive_archive_container *, void *), void *arg, int compression, int format, const char *cmd) {
1528
1540
  VALUE writer;
1529
1541
  struct rb_libarchive_archive_container *p;
1542
+ int r;
1530
1543
  writer = rb_funcall(rb_cArchiveWriter, rb_intern("new"), 0);
1531
1544
  Data_Get_Struct(writer, struct rb_libarchive_archive_container, p);
1532
1545
 
@@ -1534,7 +1547,13 @@ static VALUE rb_libarchive_writer_s_open0(int (*archive_open)(struct rb_libarchi
1534
1547
  rb_raise(rb_eArchiveError, "Open writer failed: %s", strerror(errno));
1535
1548
  }
1536
1549
 
1537
- if (archive_write_set_compression(p->ar, compression) != ARCHIVE_OK) {
1550
+ if (cmd != NULL) {
1551
+ r = archive_write_set_compression_program(p->ar, cmd);
1552
+ } else {
1553
+ r = archive_write_set_compression(p->ar, compression);
1554
+ }
1555
+
1556
+ if (r != ARCHIVE_OK) {
1538
1557
  char error_string[BUFSIZ];
1539
1558
  archive_copy_error_string(p->ar, error_string, BUFSIZ);
1540
1559
  rb_libarchive_writer_close0(p);
@@ -1580,6 +1599,7 @@ static int rb_libarchive_writer_s_open_filename0(struct rb_libarchive_archive_co
1580
1599
  static VALUE rb_libarchive_writer_s_open_filename(VALUE self, VALUE v_filename, VALUE v_compression, VALUE v_format) {
1581
1600
  const char *filename = NULL;
1582
1601
  int compression, format;
1602
+ const char *cmd = NULL;
1583
1603
  Check_Type(v_filename, T_STRING);
1584
1604
 
1585
1605
  if (RSTRING_LEN(v_filename) < 1) {
@@ -1587,9 +1607,17 @@ static VALUE rb_libarchive_writer_s_open_filename(VALUE self, VALUE v_filename,
1587
1607
  }
1588
1608
 
1589
1609
  filename = RSTRING_PTR(v_filename);
1590
- compression = NUM2INT(v_compression);
1610
+
1611
+ if (T_STRING == TYPE(v_compression)) {
1612
+ compression = -1;
1613
+ cmd = RSTRING_PTR(v_compression);
1614
+ } else {
1615
+ compression = NUM2INT(v_compression);
1616
+ }
1617
+
1618
+
1591
1619
  format = NUM2INT(v_format);
1592
- return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_filename0, (void *) filename, compression, format);
1620
+ return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_filename0, (void *) filename, compression, format, cmd);
1593
1621
  }
1594
1622
 
1595
1623
  static int rb_libarchive_writer_s_open_memory0(struct rb_libarchive_archive_container *p, void *arg) {
@@ -1601,10 +1629,18 @@ static int rb_libarchive_writer_s_open_memory0(struct rb_libarchive_archive_cont
1601
1629
  /* */
1602
1630
  static VALUE rb_libarchive_writer_s_open_memory(VALUE self, VALUE v_memory, VALUE v_compression, VALUE v_format) {
1603
1631
  int compression, format;
1632
+ const char *cmd = NULL;
1604
1633
  Check_Type(v_memory, T_STRING);
1605
- compression = NUM2INT(v_compression);
1634
+
1635
+ if (T_STRING == TYPE(v_compression)) {
1636
+ compression = -1;
1637
+ cmd = RSTRING_PTR(v_compression);
1638
+ } else {
1639
+ compression = NUM2INT(v_compression);
1640
+ }
1641
+
1606
1642
  format = NUM2INT(v_format);
1607
- return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_memory0, (void *) v_memory, compression, format);
1643
+ return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_memory0, (void *) v_memory, compression, format, cmd);
1608
1644
  }
1609
1645
 
1610
1646
  /* */
@@ -1716,7 +1752,9 @@ void Init_libarchive_writer() {
1716
1752
  rb_define_alloc_func(rb_cArchiveWriter, rb_libarchive_archive_alloc);
1717
1753
  rb_funcall(rb_cArchiveWriter, rb_intern("private_class_method"), 1, ID2SYM(rb_intern("new")));
1718
1754
  rb_define_singleton_method(rb_cArchiveWriter, "open_filename", rb_libarchive_writer_s_open_filename, 3);
1755
+ rb_define_singleton_method(rb_mArchive, "write_open_filename", rb_libarchive_writer_s_open_filename, 3);
1719
1756
  rb_define_singleton_method(rb_cArchiveWriter, "open_memory", rb_libarchive_writer_s_open_memory, 3);
1757
+ rb_define_singleton_method(rb_mArchive, "write_open_memory", rb_libarchive_writer_s_open_memory, 3);
1720
1758
  rb_define_method(rb_cArchiveWriter, "close", rb_libarchive_writer_close, 0);
1721
1759
  rb_define_method(rb_cArchiveWriter, "new_entry", rb_libarchive_writer_new_entry, 0);
1722
1760
  rb_define_method(rb_cArchiveWriter, "write_header", rb_libarchive_writer_write_header, 1);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libarchive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: mswin32
6
6
  authors:
7
7
  - winebarrel
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-06 00:00:00 -05:00
12
+ date: 2009-01-30 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,10 +22,14 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.txt
24
24
  - libarchive.c
25
+ - COPYING.libarchive
26
+ - LICENSE.libbzip2
25
27
  files:
26
28
  - lib/i386-mswin32/libarchive_ruby.so
27
29
  - README.txt
28
30
  - libarchive.c
31
+ - COPYING.libarchive
32
+ - LICENSE.libbzip2
29
33
  has_rdoc: true
30
34
  homepage: http://libarchive.rubyforge.org
31
35
  post_install_message: