develooper Front page | | Postings from November 2007

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

Eric Wilhelm
November 9, 2007 01:16
Re: Running CPAN as an irregular user, and then stow
Message ID:
# 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 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 
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 

The wrapper is:


  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/
  '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

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
--------------------------------------------------- Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About