From djberg96 at gmail.com Mon Nov 6 11:20:18 2006 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 6 Nov 2006 09:20:18 -0700 Subject: [Rake-devel] Specifying a tar command for a GemPackageTask Message-ID: <6037b70c0611060820r3c020258jef37291996c3f4bd@mail.gmail.com> Hi, Ruby 1.8.5 Rake 0.7.1 Solaris 10 One of the issues I noticed for Rake::GemPackageTask is that it assumes GNU tar. If I do 'need_tar_gz = true' and try to run 'rake package' it will fail because Solaris' tar doesn't support the -z option: tar zcvf solaris-kstat-0.2.2.tar.gz solaris-kstat-0.2.2 tar: z: unknown function modifier Usage: tar {c|r|t|u|x}[BDeEFhilmnopPqvw@[0-7]][bfk][X...] [blocksize] [tarfile] [size] [exclude-file...] {file | -I include-file | -C directory file}... rake aborted! Command failed with status (1): [tar zcvf solaris-kstat-0.2.2.tar.gzsolari...] (See full trace by running task with --trace) I do have gtar installed on this system, but I need a way to tell the GemPackageTask to use it. Is there a way to do that? If not, can we add it? Thanks, Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061106/a8c985b5/attachment.html From jim at weirichhouse.org Mon Nov 6 14:00:42 2006 From: jim at weirichhouse.org (Jim Weirich) Date: Mon, 6 Nov 2006 19:00:42 -0000 (UTC) Subject: [Rake-devel] Specifying a tar command for a GemPackageTask In-Reply-To: <6037b70c0611060820r3c020258jef37291996c3f4bd@mail.gmail.com> References: <6037b70c0611060820r3c020258jef37291996c3f4bd@mail.gmail.com> Message-ID: <46145.198.177.158.254.1162839642.squirrel@onestepback.org> Daniel Berger said: > I do have gtar installed on this system, but I need a way to tell the > GemPackageTask to use it. Is there a way to do that? If not, can we add > it? This is a reasonable request. Got a patch? (else wait for me to get around to it). -- -- Jim Weirich jim at weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) From djberg96 at gmail.com Tue Nov 7 14:10:22 2006 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 7 Nov 2006 12:10:22 -0700 Subject: [Rake-devel] Specifying a tar command for a GemPackageTask In-Reply-To: <46145.198.177.158.254.1162839642.squirrel@onestepback.org> References: <6037b70c0611060820r3c020258jef37291996c3f4bd@mail.gmail.com> <46145.198.177.158.254.1162839642.squirrel@onestepback.org> Message-ID: <6037b70c0611071110g7d58e40x9ae8c24984958b1d@mail.gmail.com> On 11/6/06, Jim Weirich wrote: > > > Daniel Berger said: > > I do have gtar installed on this system, but I need a way to tell the > > GemPackageTask to use it. Is there a way to do that? If not, can we > add > > it? > > This is a reasonable request. Got a patch? Yep: --- packagetask.orig Mon Nov 6 12:28:05 2006 +++ packagetask.rb Tue Nov 7 12:02:37 2006 @@ -68,6 +68,9 @@ # List of files to be included in the package. attr_accessor :package_files + # Tar command used for gzipped or bzip2'd archives. The default is 'tar'. + attr_accessor :tar_command + # Create a Package Task with the given name and version. def initialize(name=nil, version=nil) init(name, version) @@ -85,6 +88,7 @@ @need_tar_gz = false @need_tar_bz2 = false @need_zip = false + @tar_command = 'tar' end # Create the tasks defined by this task library. @@ -114,7 +118,7 @@ task :package => ["#{package_dir}/#{file}"] file "#{package_dir}/#{file}" => [package_dir_path] + package_files do chdir(package_dir) do - sh %{tar #{flag}cvf #{file} #{package_name}} + sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}} end end end That's against 0.7.1, not CVS. Let me know if that's a problem and I'll resubmit it. Thanks, Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061107/0080738c/attachment-0001.html From djberg96 at gmail.com Tue Nov 7 14:54:05 2006 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 7 Nov 2006 12:54:05 -0700 Subject: [Rake-devel] A wafer thin change to gempackagetask.rb - add a desc Message-ID: <6037b70c0611071154h3e2b59dfv349d9bddd4c5c56d@mail.gmail.com> Hi Jim, This adds a 'desc' to the gempackagetask.rb file. That way "rake gem" shows up as an option when a user runs "rake -T". This diff is against svn trunk. Regards, Dan --- gempackagetask.orig Tue Nov 7 12:43:10 2006 +++ gempackagetask.rb Tue Nov 7 12:45:59 2006 @@ -77,6 +77,7 @@ def define super task :package => [:gem] + desc "Build the gem" task :gem => ["#{package_dir}/#{gem_file}"] file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do when_writing("Creating GEM") { -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061107/1ef5a01b/attachment.html From jim at weirichhouse.org Wed Nov 8 01:20:56 2006 From: jim at weirichhouse.org (Jim Weirich) Date: Wed, 08 Nov 2006 01:20:56 -0500 Subject: [Rake-devel] Specifying a tar command for a GemPackageTask In-Reply-To: <6037b70c0611071110g7d58e40x9ae8c24984958b1d@mail.gmail.com> References: <6037b70c0611060820r3c020258jef37291996c3f4bd@mail.gmail.com> <46145.198.177.158.254.1162839642.squirrel@onestepback.org> <6037b70c0611071110g7d58e40x9ae8c24984958b1d@mail.gmail.com> Message-ID: <45517748.1090400@weirichhouse.org> Daniel Berger wrote: > > > On 11/6/06, *Jim Weirich* > wrote: > > > Daniel Berger said: > > I do have gtar installed on this system, but I need a way to tell the > > GemPackageTask to use it. Is there a way to do that? If not, > can we add > > it? > > This is a reasonable request. Got a patch? > > > Yep: > > --- packagetask.orig Mon Nov 6 12:28:05 2006 > +++ packagetask.rb Tue Nov 7 12:02:37 2006 > @@ -68,6 +68,9 @@ > # List of files to be included in the package. > attr_accessor :package_files > > + # Tar command used for gzipped or bzip2'd archives. The default is > 'tar'. > + attr_accessor :tar_command > + > # Create a Package Task with the given name and version. > def initialize(name=nil, version=nil) > init(name, version) > @@ -85,6 +88,7 @@ > @need_tar_gz = false > @need_tar_bz2 = false > @need_zip = false > + @tar_command = 'tar' > end > > # Create the tasks defined by this task library. > @@ -114,7 +118,7 @@ > task :package => ["#{package_dir}/#{file}"] > file "#{package_dir}/#{file}" => [package_dir_path] + > package_files do > chdir(package_dir) do > - sh %{tar #{flag}cvf #{file} #{package_name}} > + sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}} > end > end > end > > That's against 0.7.1, not CVS. Let me know if that's a problem and I'll > resubmit it. I've applied this and the gem task description changes to my local working copy. I also included a zip_command in the package task. I'll commit these when I finish some other changes that are in progress. -- Jim Weirich From djberg96 at gmail.com Wed Nov 8 09:01:19 2006 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 8 Nov 2006 07:01:19 -0700 Subject: [Rake-devel] Specifying a tar command for a GemPackageTask In-Reply-To: <45517748.1090400@weirichhouse.org> References: <6037b70c0611060820r3c020258jef37291996c3f4bd@mail.gmail.com> <46145.198.177.158.254.1162839642.squirrel@onestepback.org> <6037b70c0611071110g7d58e40x9ae8c24984958b1d@mail.gmail.com> <45517748.1090400@weirichhouse.org> Message-ID: <6037b70c0611080601o12ba5c25jf1a437ce6ebb3795@mail.gmail.com> On 11/7/06, Jim Weirich wrote: > > Daniel Berger wrote: > > > > > > On 11/6/06, *Jim Weirich* > > wrote: > > > > > > Daniel Berger said: > > > I do have gtar installed on this system, but I need a way to tell > the > > > GemPackageTask to use it. Is there a way to do that? If not, > > can we add > > > it? > > > > This is a reasonable request. Got a patch? > > > > > > Yep: > > > > --- packagetask.orig Mon Nov 6 12:28:05 2006 > > +++ packagetask.rb Tue Nov 7 12:02:37 2006 > > @@ -68,6 +68,9 @@ > > # List of files to be included in the package. > > attr_accessor :package_files > > > > + # Tar command used for gzipped or bzip2'd archives. The default is > > 'tar'. > > + attr_accessor :tar_command > > + > > # Create a Package Task with the given name and version. > > def initialize(name=nil, version=nil) > > init(name, version) > > @@ -85,6 +88,7 @@ > > @need_tar_gz = false > > @need_tar_bz2 = false > > @need_zip = false > > + @tar_command = 'tar' > > end > > > > # Create the tasks defined by this task library. > > @@ -114,7 +118,7 @@ > > task :package => ["#{package_dir}/#{file}"] > > file "#{package_dir}/#{file}" => [package_dir_path] + > > package_files do > > chdir(package_dir) do > > - sh %{tar #{flag}cvf #{file} #{package_name}} > > + sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}} > > end > > end > > end > > > > That's against 0.7.1, not CVS. Let me know if that's a problem and I'll > > resubmit it. > > I've applied this and the gem task description changes to my local > working copy. I also included a zip_command in the package task. I'll > commit these when I finish some other changes that are in progress. Thanks Jim. Ideally, Rake should use a bonafide wrapper around libtar since there may come a point where someone on Solaris (or some other commerical UNIX platform) may not have the luxury of using GNU tar. Unfortunately, the project that set out to do this ('archive') appears to be on the backburner while Austin prepares for his wedding. I did create a project called archive-tar-external a while back that might be useful in the interim, but I'm not sure how you feel about 3rd party packages being used within Rake. If you're interested, I could refactor that bit of code. If not, I understand. Regards, Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061108/70a24a54/attachment.html From djberg96 at gmail.com Wed Nov 8 10:36:40 2006 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 8 Nov 2006 08:36:40 -0700 Subject: [Rake-devel] Setting the description using a constructor Message-ID: <6037b70c0611080736i3b91db4ev1aa2eadca2eabbaa@mail.gmail.com> Hi, I noticed that if I create a task using a constructor, the description doesn't seem to get picked up: desc "This is Dan's test" Rake::TestTask.new do |t| # stuff here end If I run "rake -T" it just shows "rake test # Run tests" Is there a way to set the description using this style? I tried putting the desc() call inside the block but that didn't seem to help. Thanks, Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061108/da0aa935/attachment.html From jim at weirichhouse.org Wed Nov 8 11:31:37 2006 From: jim at weirichhouse.org (Jim Weirich) Date: Wed, 8 Nov 2006 16:31:37 -0000 (UTC) Subject: [Rake-devel] Specifying a tar command for a GemPackageTask In-Reply-To: <6037b70c0611080601o12ba5c25jf1a437ce6ebb3795@mail.gmail.com> References: <6037b70c0611060820r3c020258jef37291996c3f4bd@mail.gmail.com><46145.198.177.158.254.1162839642.squirrel@onestepback.org><6037b70c0611071110g7d58e40x9ae8c24984958b1d@mail.gmail.com><45517748.1090400@weirichhouse.org> <6037b70c0611080601o12ba5c25jf1a437ce6ebb3795@mail.gmail.com> Message-ID: <21905.198.177.158.254.1163003497.squirrel@onestepback.org> Daniel Berger said: > Ideally, Rake should use a bonafide wrapper around libtar since there may > come a point where someone on Solaris (or some other commerical UNIX > platform) may not have the luxury of using GNU tar. [...] I strongly agree. > I did create a project called archive-tar-external a while back that might > be useful in the interim, but I'm not sure how you feel about 3rd party > packages being used within Rake. If you're interested, I could refactor > that bit of code. If not, I understand. I don't mind if it is configurable. Perhaps what would be best if there was a "tar" object that the package used. The default tar object could continue to use the shell tar command to do the work, but it would allow an alternate tar object to use a pure ruby library. -- -- Jim Weirich jim at weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) From dsisnero at gmail.com Wed Nov 8 13:45:26 2006 From: dsisnero at gmail.com (Dominic Sisneros) Date: Wed, 8 Nov 2006 11:45:26 -0700 Subject: [Rake-devel] Specifying a tar command for a GemPackageTask In-Reply-To: <6037b70c0611071110g7d58e40x9ae8c24984958b1d@mail.gmail.com> References: <6037b70c0611060820r3c020258jef37291996c3f4bd@mail.gmail.com> <46145.198.177.158.254.1162839642.squirrel@onestepback.org> <6037b70c0611071110g7d58e40x9ae8c24984958b1d@mail.gmail.com> Message-ID: On windows, I use the GnuWin32 tar package. When I try to use the package task it gave me an error that windows cannot fork. Looking online, I find this blog post http://blog.labnotes.org/2005/11/03/creating-zip-and-tar-packages-with-rake-on-windows/which has the following Creating a zip package worked on the first try, but tar complained that it *'Cannot fork: Function not implemented'*. It turns out that Cygwin's tar can't run gzip. So once again, it's time to fix the Rake source code. This time we're talking about *rake/packagetask.rb*, line 117 that calls tar with the z option. I replaced that one line with a separate call to tar and gzip: sh %{tar cvf #{package_name}.tar #{package_name}} if flag == 'z' sh %{gzip #{package_name}.tar} end You'll need to be a bit more fancy if you want to support both .tar.gz and .tgz suffixes, but this little fix will allow you to create .tar.gz. I did this and the package task worked. On 11/7/06, Daniel Berger wrote: > > > > On 11/6/06, Jim Weirich wrote: > > > > > > Daniel Berger said: > > > I do have gtar installed on this system, but I need a way to tell the > > > GemPackageTask to use it. Is there a way to do that? If not, can we > > add > > > it? > > > > This is a reasonable request. Got a patch? > > > Yep: > > --- packagetask.orig Mon Nov 6 12:28:05 2006 > +++ packagetask.rb Tue Nov 7 12:02:37 2006 > @@ -68,6 +68,9 @@ > # List of files to be included in the package. > attr_accessor :package_files > > + # Tar command used for gzipped or bzip2'd archives. The default is > 'tar'. > + attr_accessor :tar_command > + > # Create a Package Task with the given name and version. > def initialize(name=nil, version=nil) > init(name, version) > @@ -85,6 +88,7 @@ > @need_tar_gz = false > @need_tar_bz2 = false > @need_zip = false > + @tar_command = 'tar' > end > > # Create the tasks defined by this task library. > @@ -114,7 +118,7 @@ > task :package => ["#{package_dir}/#{file}"] > file "#{package_dir}/#{file}" => [package_dir_path] + > package_files do > chdir(package_dir) do > - sh %{tar #{flag}cvf #{file} #{package_name}} > + sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}} > end > end > end > > That's against 0.7.1, not CVS. Let me know if that's a problem and I'll > resubmit it. > > Thanks, > > Dan > > _______________________________________________ > Rake-devel mailing list > Rake-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/rake-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061108/40edd8cc/attachment-0001.html From jim at weirichhouse.org Wed Nov 8 16:22:24 2006 From: jim at weirichhouse.org (Jim Weirich) Date: Wed, 8 Nov 2006 21:22:24 -0000 (UTC) Subject: [Rake-devel] Setting the description using a constructor In-Reply-To: <6037b70c0611080736i3b91db4ev1aa2eadca2eabbaa@mail.gmail.com> References: <6037b70c0611080736i3b91db4ev1aa2eadca2eabbaa@mail.gmail.com> Message-ID: <43324.198.177.158.254.1163020944.squirrel@onestepback.org> Daniel Berger said: > Hi, > > I noticed that if I create a task using a constructor, the description > doesn't seem to get picked up: > > desc "This is Dan's test" > Rake::TestTask.new do |t| > # stuff here > end Ahh, that is because TestTask, despite its name, is not really a task object. Rather it is a suite of tasks that are created under the control of the TestTask object. You can think of it as a macro that creates a bunch of tasks with related dependencies. I've been wanting to rename it for some time, but haven't found quite the right terminology yet (suite is one contender). So the desc lines are defined within the TestTask object and aren't exposed to the end user unless the author took explicit action to make it so. -- Jim Weirich -- -- Jim Weirich jim at weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) From djberg96 at gmail.com Thu Nov 9 10:09:08 2006 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 9 Nov 2006 08:09:08 -0700 Subject: [Rake-devel] Setting the description using a constructor In-Reply-To: <43324.198.177.158.254.1163020944.squirrel@onestepback.org> References: <6037b70c0611080736i3b91db4ev1aa2eadca2eabbaa@mail.gmail.com> <43324.198.177.158.254.1163020944.squirrel@onestepback.org> Message-ID: <6037b70c0611090709y9ec347fn9b07fa6d202bdc2e@mail.gmail.com> On 11/8/06, Jim Weirich wrote: > > > Daniel Berger said: > > Hi, > > > > I noticed that if I create a task using a constructor, the description > > doesn't seem to get picked up: > > > > desc "This is Dan's test" > > Rake::TestTask.new do |t| > > # stuff here > > end > > Ahh, that is because TestTask, despite its name, is not really a task > object. Rather it is a suite of tasks that are created under the control > of the TestTask object. You can think of it as a macro that creates a > bunch of tasks with related dependencies. I've been wanting to rename it > for some time, but haven't found quite the right terminology yet (suite is > one contender). > > So the desc lines are defined within the TestTask object and aren't > exposed to the end user unless the author took explicit action to make it > so. TestSuiteTask sounds better. :) The reason I ask is that sometimes I want to setup two different test tasks, with each task passing slightly different parameters or running a different test case. But, each test case would have the same general setup that a TestTask creates, i.e push the "test" directory on the $LOAD_PATH, etc. I'm trying to think how this would look. Here's one idea: TestSuiteTask.new do |ts| ts.libs << "test" ts.test.new(:test_18) do |tc| tc.desc "Tests for the 1.8 branch" tc.files = FileList["test/tc_18*"] end ts.test.new(:test_19) do |tc| tc.desc "Tests for the 1.9 branch" tc.files = FileList["test/tc_19*"] end end How does something like that look? Regards, Dan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061109/8d4c1f2a/attachment.html From dsisnero at gmail.com Thu Nov 9 17:12:21 2006 From: dsisnero at gmail.com (Dominic Sisneros) Date: Thu, 9 Nov 2006 15:12:21 -0700 Subject: [Rake-devel] windows xp package task Message-ID: On windows, I use the GnuWin32 tar package. When I try to use the package task it gave me an error that windows cannot fork. Looking online, I find this blog post http://blog.labnotes.org/2005/11/03/creating-zip-and-tar-packages-with-rake-on-windows/which has the following Creating a zip package worked on the first try, but tar complained that it *'Cannot fork: Function not implemented' *. It turns out that Cygwin's tar can't run gzip. So once again, it's time to fix the Rake source code. This time we're talking about *rake/packagetask.rb*, line 117 that calls tar with the z option. I replaced that one line with a separate call to tar and gzip: sh %{tar cvf #{package_name}.tar #{package_name}} if flag == 'z' sh %{gzip #{package_name}.tar} end You'll need to be a bit more fancy if you want to support both .tar.gz and .tgz suffixes, but this little fix will allow you to create .tar.gz. I did this and the package task worked. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061109/dd04217a/attachment.html From dsisnero at gmail.com Tue Nov 14 20:28:37 2006 From: dsisnero at gmail.com (Dominic Sisneros) Date: Tue, 14 Nov 2006 18:28:37 -0700 Subject: [Rake-devel] Windows package task, windows cannot fork Message-ID: ---------- Forwarded message ---------- From: Dominic Sisneros Date: Nov 9, 2006 3:12 PM Subject: windows xp package task To: Rake Development and Discussion On windows, I use the GnuWin32 tar package. When I try to use the package task it gave me an error that windows cannot fork. Looking online, I find this blog post http://blog.labnotes.org/2005/11/03/creating-zip-and-tar-packages-with-rake-on-windows/which has the following Creating a zip package worked on the first try, but tar complained that it *'Cannot fork: Function not implemented' *. It turns out that Cygwin's tar can't run gzip. So once again, it's time to fix the Rake source code. This time we're talking about *rake/packagetask.rb*, line 117 that calls tar with the z option. I replaced that one line with a separate call to tar and gzip: sh %{tar cvf #{package_name}.tar #{package_name}} if flag == 'z' sh %{gzip #{package_name}.tar} end You'll need to be a bit more fancy if you want to support both .tar.gz and .tgz suffixes, but this little fix will allow you to create .tar.gz. I did this and the package task worked. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061114/8936c1e2/attachment.html