You are not logged in.
After recently deleting my /usr folder by mistake I am back in archlinux again and I thought it was about time that I built some ruby packages... however ruby packages tend to use their own installation script and there is no way of passing the installation directory to the script because it searches for the existing ruby location. When I try to run makepkg the installation script tries to install the package directly to the root of the file system.
What should I do? Would I be cheating if I just saw which files were copied and I did it by hand in the build() section?
Offline
ruby packages?
you mean packages of ruby programs, like ruby gems?
for a sec there I thought you meant ruby "the package"..and I was thinking....what?
heh..
hmm..maybe arch could have a package for the ruby gems installer (supposed to be like cpan, but hopefully better)...
ps..I love ruby!
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Actually rubygems is the package that I am trying to build!
Offline
:shock:
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
I assume then that there is no official stance on how to deal with these situations? I will "fudge" a package then and see how it goes...
Offline
I'm also very interested in having the ruby gems package available. Did you have any luck with it ??
Also, have you been able to generate the rdoc documentation for ruby using the standard package that is available in arch ? If so, how did you do it ? Here it just keeps a really looong time
generating it and then there are some weird errors, I'll try it again later to see if I can paste them here.
Offline
Normally you would either a) do everything the install script does inside the build() function or b) patch the install script.
Method a is annoying and error prone. Method b is the preferred method.
I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal
Offline
I have *almost* built a package, but there are still some problems when I run makepkg. I have patched the installation script so that it puts the installation files in a place where makepkg can use them, but then at the end of the installation script it tries to install a 'gem' and fails because the rubygem library hasn't been installed yet.
I would like to call a custom ruby script after the package has been installed (perhaps in a post_install method) but where do I place these files that I need? I mean, I cannot put them directly in the pkg directory can I?
Offline
I would like to call a custom ruby script after the package has been installed (perhaps in a post_install method) but where do I place these files that I need? I mean, I cannot put them directly in the pkg directory can I?
Place your script (and the files it needs) in the same directory than your PKGBUILD file. In your PKGBUILD, use the install field:
install= ruby.install
where ruby.install is the name of the script.
Offline
Place your script (and the files it needs) in the same directory than your PKGBUILD file. In your PKGBUILD, use the install field:
install= ruby.install
where ruby.install is the name of the script.
I tried but the script is being ignored...
The PKGBUILD is
pkgname=rubygems
pkgver=0.8.1
pkgrel=1
pkgdesc="A package management framework for the Ruby programming language"
url="http://rubygems.rubyforge.org/wiki/wiki.pl?RubyGems"
depends=('ruby')
makedepends=()
source=(http://rubyforge.org/frs/download.php/1399/rubygems-$pkgver.tgz rubygems.patch)
md5sums=('6276d268b420c0d61796cdbf6d28dae4')
install=install_gem.rb
build() {
cd $startdir/src/rubygems-$pkgver
patch -p1 -i ../rubygems.patch
ruby install.rb
}
The install_gem.rb is
#!/usr/bin/ruby
# Install the 'sources' package bundled with RubyGems.
Dir.chdir("packages/sources")
load("sources.gemspec")
spec = Gem.sources_spec
Gem::manage_gems
gem_file = Gem::Builder.new(spec).build
Gem::Installer.new(gem_file).install(true, Gem.dir, false)
Dir.chdir("../..")
What am I doing wrong?
Offline
The install field expects a structured script. See the makepkg man pages for an example. There might be a prototype in /var/abs. In that script, there is a post_install function where you can call your install_gem.rb script
Offline
if you install abs, there is a install.proto in the /var/abs directory.
# This is a default template for a post-install scriptlet. You can
# remove any functions you don't need (and this header).
# arg 1: the new package version
pre_install() {
/bin/true
}
# arg 1: the new package version
post_install() {
/bin/true
}
# arg 1: the new package version
# arg 2: the old package version
pre_upgrade() {
/bin/true
}
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
/bin/true
}
# arg 1: the old package version
pre_remove() {
/bin/true
}
# arg 1: the old package version
post_remove() {
/bin/true
}
op=$1
shift
$op $*
You can remove the target functions that you will not be using. Something like this should probably work.
# arg 1: the new package version
post_install() {
/usr/bin/env ruby -w install_gem.rb
}
op=$1
shift
$op $*
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
(Sorry about this, but it is my first package that I am building!)
I have created the install file and one of the functions is called, but the file doesn't exist. Now I know that I could add the ruby script to the source field of the PKGBUILD file but the problem is that there is more than one file:
# tree
.
|-- PKGBUILD
|-- install_gem.rb
|-- packages
| `-- sources
| |-- lib
| | `-- sources.rb
| |-- sources-0.0.1.gem
| `-- sources.gemspec
|-- rubygems.install
`-- rubygems.patch
The install_gem.rb script should install the ruby gem that is inside the packages tree so is there anyway of forcing this tree to exist inside the package? I tried editing the filelist file but that did nothing.
So should I gzip that folder and also provide it with the package? It seems a bit messy though...
Offline
Okay, I have just chatted to jdrago on IRC and I have decided to copy the necessary files to the tmp directory, so I am closing this topic and opening a new one with the pkgbuild.
Offline