develooper Front page | perl.qa | Postings from November 2007

Re: Running CPAN as an irregular user, and then stow

From:
Eric Wilhelm
Date:
November 9, 2007 01:16
Subject:
Re: Running CPAN as an irregular user, and then stow
Message ID:
200711090118.35687.ewilhelm@cpan.org
# from Eric Wilhelm
# on Thursday 18 October 2007 16:32:

># from Michael:
>>The install step is configurable and I don't think there's anything
>>stopping you from saying... "make install DESTDIR=/usr/local/stow &&
>>stow ..."  
>
>And `sudo stow` (or xstow) might actually be safe.

Yay, I now have the sudoers line reduced to this:

  stowpan  ALL=(ALL)  NOPASSWD: /usr/bin/stow -d /usr/local/stow cpan

The following is not for the faint of heart.  The process of setting-up 
on an existing box is pretty tricky and involves trolling through 
the .packlists (which are incomplete for e.g. XML::SAX.)  See the 
utils/ directory in the repository (make a backup!)  It's not strictly 
necessary to clean-out your /usr/local[bin|man|lib|share], but mine is 
now entirely symlinks :-)

A further challenge for making this consumer-friendly is that the 
default CPAN.pm with many distributions doesn't have support for the 
make|build_install_make|build_command options.  So, making an 
out-of-the-box setup scheme requires possibly shipping a CPAN.pm 
upgrade in-the-box?

I'm not pleased with the dirty DESTDIR trick being played by the 
wrapper, but `make install PREFIX=...` is ignored, which means 
PREFIX/--prefix would have to be in the make|build_install_arg of the 
cpan config and the wrapper would then be really thin.  (Yes, it needs 
to be 'prefix' and not install_base -- stow is *all about* the prefix 
thing.)

The wrapper is:

  http://scratchcomputing.com/svn/stowpan/trunk/bin/stowpin

Notes

  adduser --disabled-password --gecos '' stowpan
  mkdir /usr/local/stow/cpan/
  chown stowpan:stowpan /usr/local/stow/cpan/
  chmod g+w /usr/local/stow/cpan/

The g+w is optional, but you might want a maintainers group to be able 
to install by hand (though they will have to set PREFIX/--prefix.)

$ grep 'install\|stow\|MB' ~stowpan/.cpan/CPAN/MyConfig.pm
  'build_dir' => q[/home/stowpan/build],
  'cpan_home' => q[/home/stowpan/cpan],
  'histfile' => q[/home/stowpan/cpan/histfile],
  'keep_source_where' => q[/home/stowpan/sources],
  'make_install_arg' => q[],
  'make_install_make_command' => q[/usr/local/bin/stowpin make],
  'mbuild_install_arg' => q[],
  'mbuild_install_build_command' => q[/usr/local/bin/stowpin Build],
  'prefer_installer' => q[MB],

Then (assuming proper permissions for your user)
  su - stowpan /usr/bin/cpan Foo::Bar

--Eric
-- 
The reasonable man adapts himself to the world; the unreasonable man
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.
--George Bernard Shaw
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About