aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorknu <knu@FreeBSD.org>2002-10-13 02:31:45 +0800
committerknu <knu@FreeBSD.org>2002-10-13 02:31:45 +0800
commit4b2079f8498b5aa5b575598b45677a8ff507d179 (patch)
tree3b96c69810c938e9626b50e8eb0a7ac4423a0a71
parent382333ea56637a40a541b4c5bbea8d00819a37af (diff)
downloadfreebsd-ports-gnome-4b2079f8498b5aa5b575598b45677a8ff507d179.tar.gz
freebsd-ports-gnome-4b2079f8498b5aa5b575598b45677a8ff507d179.tar.zst
freebsd-ports-gnome-4b2079f8498b5aa5b575598b45677a8ff507d179.zip
Update to 0.4, with a couple of patches applied. (which were submitted
to the author already) There were some (rather small) API changes. Read the bundled documents for details.
-rw-r--r--audio/ruby-freedb/Makefile6
-rw-r--r--audio/ruby-freedb/distinfo2
-rw-r--r--audio/ruby-freedb/files/patch-freedb_cdrom.c48
-rw-r--r--audio/ruby-freedb/files/patch-lib::freedb.rb80
-rw-r--r--audio/ruby-freedb/pkg-plist9
5 files changed, 138 insertions, 7 deletions
diff --git a/audio/ruby-freedb/Makefile b/audio/ruby-freedb/Makefile
index 7cfd994b77df..144681215812 100644
--- a/audio/ruby-freedb/Makefile
+++ b/audio/ruby-freedb/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= freedb
-PORTVERSION= 0.3.1
+PORTVERSION= 0.4
CATEGORIES= audio net ruby
MASTER_SITES= http://davedd.free.fr/%SUBDIR%/
MASTER_SITE_SUBDIR= ruby-${PORTNAME}
@@ -21,8 +21,8 @@ USE_RUBY_EXTCONF= yes
INSTALL_TARGET= site-install
-DOCS= README
-EXAMPLES= test.rb
+DOCS= CHANGELOG CONTRIBUTORS README
+EXAMPLES= examples/*.rb
post-install:
.if !defined(NOPORTDOCS)
diff --git a/audio/ruby-freedb/distinfo b/audio/ruby-freedb/distinfo
index 1c5e18af8e05..99f4823bad50 100644
--- a/audio/ruby-freedb/distinfo
+++ b/audio/ruby-freedb/distinfo
@@ -1 +1 @@
-MD5 (ruby/ruby-freedb-0.3.1.tar.gz) = 6c1c67dfbc9403faa7b44f097c2e307f
+MD5 (ruby/ruby-freedb-0.4.tar.gz) = 4942fc0fe69284482e7f8b15f042e7cb
diff --git a/audio/ruby-freedb/files/patch-freedb_cdrom.c b/audio/ruby-freedb/files/patch-freedb_cdrom.c
new file mode 100644
index 000000000000..14f69a388d7f
--- /dev/null
+++ b/audio/ruby-freedb/files/patch-freedb_cdrom.c
@@ -0,0 +1,48 @@
+--- freedb_cdrom.c.orig Wed Sep 25 15:05:37 2002
++++ freedb_cdrom.c Sun Oct 13 03:13:25 2002
+@@ -93,17 +93,18 @@
+
+
+ char offsets[1089] = "", buff[255];
+-
+- Check_Type(device, T_STRING);
+- drive = open(STR2CSTR(device), O_RDONLY | O_NONBLOCK);
++
++ Check_SafeStr(device);
++ drive = open(RSTRING(device)->ptr, O_RDONLY | O_NONBLOCK);
+
+ if (drive < 0) {
+- close(drive);
+- rb_sys_fail("Failed to open device");
++ rb_sys_fail(RSTRING(device)->ptr);
+ }
+
+- if (ioctl(drive,CDROMREADTOCHDR,&hdr) < 0)
+- rb_sys_fail("Failed to read TOC");
++ if (ioctl(drive,CDROMREADTOCHDR,&hdr) < 0) {
++ close(drive);
++ rb_sys_fail("Failed to read TOC entry");
++ }
+
+ first=hdr.cdth_trk0;
+ last=hdr.cdth_trk1;
+@@ -126,6 +127,7 @@
+ t.data = TocEntry;
+
+ if (ioctl(drive, CDIOREADTOCENTRYS, (char *) &t) < 0)
++ free(TocEntry);
+ close(drive);
+ rb_sys_fail("Failed to read TOC entry");
+ }
+@@ -157,9 +159,11 @@
+ TocEntry[last].cdte_format = CDROM_LBA;
+ if (ioctl(drive, CDROMREADTOCENTRY, &TocEntry[i]) < 0) {
+ free(TocEntry);
++ close(drive);
+ rb_sys_fail("Failed to read TOC entry");
+ }
+ #endif
++ close(drive);
+
+ #if defined(OS_FREEBSD)
+ TocEntry[i].cdte_addr.lba = ntohl(TocEntry[i].cdte_addr.lba);
diff --git a/audio/ruby-freedb/files/patch-lib::freedb.rb b/audio/ruby-freedb/files/patch-lib::freedb.rb
new file mode 100644
index 000000000000..6f3e4562d2e7
--- /dev/null
+++ b/audio/ruby-freedb/files/patch-lib::freedb.rb
@@ -0,0 +1,80 @@
+--- lib/freedb.rb.orig Wed Sep 25 15:05:37 2002
++++ lib/freedb.rb Sat Oct 5 00:04:31 2002
+@@ -58,34 +58,53 @@
+ # @tracks.clear
+ @results[index] =~ /\S+ \S+/
+ @handler.send_cmd("read", $&)
++
++ # swallow the whole response into a hash
++ response = Hash.new
++
+ @handler.each_line { |line|
+ case line
+- when /^4\d\d (.+)/
+- raise(FreedbError, $1)
+- when /^210 (\S+)/
+- @genre = $1
+- # #or
+- when /^DGENRE=(.+)/
+- @exact_genre = $1
+- when /^DYEAR=(\d+)/
+- @year = $1.to_i
+- when /^DTITLE=(.*)/
+- @artist, @title = $1.split(" / ")
+- @title ||= @artist
+- when /^TTITLE(\d+)=(.*)/
+- h = @tracks_ext[$1.to_i]
+- h["title"] = $2
+- @tracks[$1.to_i] = $2
+- when /^EXTD=(.*)/
+- @ext_infos ||= ""
+- @ext_infos += $1
+- when /^EXTT(\d+)=(.*)/
+- h = @tracks_ext[$1.to_i]
+- h["ext"] = $2
+- #@tracks << md[1]
+- #when /^TTITLE\d+=/
++ when /^(\d+) (\S+)/, /^([A-Za-z0-9_]+)=(.*)/
++ key = $1.upcase
++
++ val = $2.gsub(/\\(.)/) {
++ case $1
++ when "t"
++ "\t"
++ when "n"
++ "\n"
++ else
++ $1
++ end
++ }
++
++ (response[key] ||= '') << val
+ end
+ }
++
++ @genre = response['210']
++ @exact_genre = response['DGENRE']
++ @year = response['DYEAR'].to_i
++ @ext_infos = response['EXTD']
++
++ # %r is to avoid ruby >= 1.7 warning
++ @artist, @title = response['DTITLE'].split(%r" / ", 2)
++ # A self-titled album may not have a title part
++ @title ||= @artist
++
++ response.each { |key, val|
++ case key
++ when /^4\d\d$/
++ raise(FreedbError, val)
++ when /^TTITLE(\d+)$/
++ i = $1.to_i
++ @tracks_ext[i]["title"] = @tracks[i] = val
++ when /^EXTT(\d+)$/
++ i = $1.to_i
++ @tracks_ext[i]["ext"] = val
++ end
++ }
++
+ self
+ end
+
diff --git a/audio/ruby-freedb/pkg-plist b/audio/ruby-freedb/pkg-plist
index 9168e061f530..6dd394754033 100644
--- a/audio/ruby-freedb/pkg-plist
+++ b/audio/ruby-freedb/pkg-plist
@@ -1,6 +1,9 @@
-%%RUBY_SITEARCHLIBDIR%%/freedb.so
-%%RUBY_SITELIBDIR%%/freedb_misc.rb
-%%PORTDOCS%%%%RUBY_MODEXAMPLESDIR%%/test.rb
+%%RUBY_SITEARCHLIBDIR%%/freedb_cdrom.so
+%%RUBY_SITELIBDIR%%/freedb.rb
+%%PORTDOCS%%%%RUBY_MODEXAMPLESDIR%%/cd-disc.rb
+%%PORTDOCS%%%%RUBY_MODEXAMPLESDIR%%/cdinfo.rb
%%PORTDOCS%%@dirrm %%RUBY_MODEXAMPLESDIR%%
+%%PORTDOCS%%%%RUBY_MODDOCDIR%%/CHANGELOG
+%%PORTDOCS%%%%RUBY_MODDOCDIR%%/CONTRIBUTORS
%%PORTDOCS%%%%RUBY_MODDOCDIR%%/README
%%PORTDOCS%%@dirrm %%RUBY_MODDOCDIR%%