Skip to content

rhauser/ayum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1. Get the software

   git clone https://github.com/rhauser/ayum.git

     or
 
   git clone https://gitlab.cern.ch/rhauser/ayum.git 

   Note:
      This should work out of the box on a 64bit Scientific Linux 6 system.
      If you need it on another binary platform, got to src/rpmext and
         make clean; make
      You will need the rpm-devel package installed for that.

2. Configure ayum

   Run the 'configure.ayum' script in the top level directory.
   Answer the questions about where to put the private RPM database,
   where to locate the yum cachen and where to install the software. 
   The script will update the  yum.conf file used by ayum.

   Alternatively you can modify the yum.conf file by hand:

   You should adapt these variables to reflect
   the current location of the package 
   (these are the standard yum.conf variables):

      persistdir=/work/msu-pc7/rhauser/ayum/var/lib/yum
      reposdir=/work/msu-pc7/rhauser/ayum/etc/yum.repos.d
      pluginpath=/work/msu-pc7/rhauser/ayum/src/yum-plugins
      pluginconfpath=/work/msu-pc7/rhauser/ayum/etc/yum/pluginconf.d
      cachedir=/work/msu-pc7/rhauser/install/cache

   You should modify these non-standard variables to point to the RPM database
   and your software installation area:

     dbpath=/work/msu-pc7/rhauser/install/db
     prefix=/work/msu-pc7/rhauser/install/sw

   You can also specify the 'prefix' variable in a yum repository, it will
   then take priority over the global value for packages from this repository.

3. Source the setup.sh script inside the package.

   It will add an alias 'ayum' and modify your path
   to include the ayum/bin directory with wrapper scripts
   for additional standard tools that will use the custom
   yum and RPM database.

     source ./setup.sh

   If you just need 'ayum' itself, you can also just define
   an alias by hand.

     alias ayum=`pwd`/ayum

   The additional tools all start with an 'a' before their
   normal name. At the moment there are:

      ayum/bin/arpm       - the RPM command with modified database
      ayum/bin/arepoquery - the repoquery command

4. Enjoy

   ayum list
   ayum list available
   ayum shell (quit to exit)
   ayum install -y tdaq-04-00-01_DAQRelease_i686-slc5-gcc43-opt
   ayum update
   ayum list installed

   ...and so on, all yum commands

   ayum remove tdaq-04-00-01-*

5. Licensing

   This software uses source code from yum, it comes with the same GPL2 license
   (see COPYING).

   
##########################################################################################

This patched yum version solves the following problems when installing
RPMs to a private area as non-root user:

   1. yum does not allow a non-root user to execute install,update,erase
   2. yum has no way to specify a different RPM database except
      for installroot, which is not what we want.
   3. yum has no interface for the --prefix or --relocate option of rpm

Problem 1 is solved by having a private version of the yum-cli/yumcommands.py file that
removes the check for non-root user. In addition a private version of the main yum
command is needed to make sure it refers to the local src/yum-cli area first when
loading files. The actual changes are 1 and 3 lines rsp.

Problem 2 is solved by a yum plugin in src/yum-plugins/dbpath.py that defines two new
options (dbpath and prefix). It defines the _dbpath macro internally to refer to the
new RPM db location.

Problem 3 is the hardest, since the rpm python bindings do not forsee the parameters
needed for the relocation. Furthermore the python bindings define extension types
that are completely private to the rpm package and are not visible in any normal
rpm header file.

It is solved in the following way:

    - src/rpmext/install.c defines a new binding to the rpmtsAddInstallElement()
      C function and supports a new parameter (a list of 2-tuples of strings). 
      It passes these parameters as relocation information.

      Access to the internal RPM structures is done by replicating the corresponding
      structures locally and a couragous reinterpret_cast<...>.

   - in src/rpmext/__init__ a new addInstall() function that mimics rpm.TransactionSet.addInstall()
     but supports an additional parameter that can be either a single string (interpreted
     as 'prefix' option), or a list 2-tuples of strings (interpreted as a list of relocation
     options)

   - src/yum/depsolve.py contains a patched local copy of the corresponding yum file that
      - overrides rpm.TransactionSet.addInstall with our own rpmext.addInstall method.
      - checks if the 'prefix' option in yum.conf was set, and if yes,
        passes it to ts.addInstall()
        The changes to depsolve.py are 6 lines.

   - ayum is a simple wrapper that sets PYTHONPATH accordingly and uses the local yum.conf
     as the default configuration file.

The changes are against: yum-3.2.29-40

About

Wrapper around yum to install and relocate user software packages.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages