Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
metamod:adding_dependencies [2011-09-23 07:51:46] oysteint |
metamod:adding_dependencies [2022-05-31 09:29:32] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Adding Perl module dependencies ====== | ====== Adding Perl module dependencies ====== | ||
- | To deal with Perl module dependencies in a safe way the METAMOD project has developed its own dependencies handler that at all times keeps track of a dependency graph. The dependency graph contains information on which modules depend on each other and what version is needed. The dependency handler was mainly created to solve the following problems: | + | Deprecated since 2.13, which now uses [[http://search.cpan.org/~miyagawa/carton-v0.9.15/lib/Carton.pm|Carton]]. |
- | + | ||
- | * If installing Perl modules from an OS repository (like the Ubuntu repo) you are dependent on the version used by the OS version. | + | |
- | * This modules can often be out-dated. | + | |
- | * You are not guaranteed that the version X and version Y of the OS use compatible versions of the same module. | + | |
- | * The module might not be available. | + | |
- | * If installing Perl modules via a CPAN client you will always get the lastest version of a module. The module version will therefore depend on the time of installation and different machines will get different configurations. This often leads to bugs that are hard to track down and are a complete waste of time. | + | |
- | + | ||
- | The dependency handler used in METAMOD is one possible approach to this problem. The rest of the document describes how a new module can be added to graph. | + | |
- | + | ||
- | ===== Checking out dependency handler with graphs ===== | + | |
- | + | ||
- | < | + | |
- | svn checkout https://svn.met.no/dependency_handler/trunk | + | |
- | </ | + | |
- | + | ||
- | ===== Check what is required for adding the module to the graph ===== | + | |
- | + | ||
- | Before adding a module to the graph is recommended to check what this will required of module upgrades and adding of new modules. | + | |
- | + | ||
- | < | + | |
- | $ perl dependency_handler.pl --config deps-config.json --check POE | + | |
- | The following modules needs to be added: | + | |
- | Module: IO Required for phase(s): runtime | + | |
- | Module: IO::Handle Required for phase(s): runtime | + | |
- | Module: IO::Tty Required for phase(s): runtime | + | |
- | Module: JSON::PP Required for phase(s): runtime | + | |
- | Module: Version:: | + | |
- | Module: CPAN::Meta Required for phase(s): runtime | + | |
- | Module: POE:: | + | |
- | Module: POE Required for phase(s): configure, | + | |
- | The following modules needs to be updated: | + | |
- | Module: Parse:: | + | |
- | </code> | + | |
- | + | ||
- | This output tells you the list of modules that will be added and that we need to upgrade ' | + | |
- | + | ||
- | ===== Upgrade necessary modules ===== | + | |
- | + | ||
- | If you want to update a module or are required to upgrade a module before adding a new dependency do as follows. Note that modules will NEVER be auto-update to a new version. This is prevent nasty surprises that can arise when modules are updated to a new version. | + | |
- | + | ||
- | < | + | |
- | $ dependency_handler.pl --config deps-config.json --update Parse:: | + | |
- | [INFO] Starting download of Parse-CPAN-Meta-1.4401 | + | |
- | [INFO] Download complete for Parse-CPAN-Meta-1.4401 | + | |
- | </code> | + | |
- | + | ||
- | ===== Add a new module ===== | + | |
- | + | ||
- | Now we can add the module that we wanted. Adding a module will also automatically add all dependencies. | + | |
- | + | ||
- | < | + | |
- | $ dependency_handler.pl --config deps-config.json --add POE | + | |
- | [INFO] Skipping download of ExtUtils-MakeMaker-6.56, | + | |
- | [INFO] Skipping download of PathTools-3.33, already in repository | + | |
- | + | ||
- | ... | + | |
- | + | ||
- | [INFO] Starting download of POE-1.311 | + | |
- | [INFO] Download complete for POE-1.311 | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Build all modules in the graph ===== | + | |
- | + | ||
- | Now that we have added a new module to the graph it is recommended to re-build all the dependencies in the graph. Depending on the size of your graph this will take quite a lot of time. | + | |
- | + | ||
- | < | + | |
- | $ dependency_handler.pl --config deps-config.json --install <install dir> | + | |
- | </ | + | |
- | + | ||
- | Please note that is not un-common that the install step fails on the first try. When it fails check the cpanminus log and try to discover what the problems is. Also try to build the failing module in isolation. Often a failing tests is the problem and in that case you can set the dependency handler to force install the module in the config file. | + | |
- | + | ||
- | ===== Check-in the graph to the repository ===== | + | |
- | + | ||
- | Since you have now have changed the dependencies graph you also need to update the changelog for the debian. Open ''' | + | |
- | + | ||
- | Check you changes into the repository. | + | |
- | + | ||
- | ===== Build Debian packages ===== | + | |
- | + | ||
- | As the build process takes a long time it is recommended to build Debian packages for targeted platforms. For METAMOD that is currently: | + | |
- | + | ||
- | * Lucid 32-bit (dev-vm129) | + | |
- | * Lucid 64-bit (dev-vm130) | + | |
- | * Hardy 32-bit (dev-vm131) | + | |
- | * Hardy 64-bit (dev-vm132) | + | |
- | + | ||
- | Log in to the development machine | + | |
- | + | ||
- | < | + | |
- | $ ssh root@dev-vm129 | + | |
- | </ | + | |
- | + | ||
- | Enter the dependency handler directory and update it with the latest changes. | + | |
- | + | ||
- | < | + | |
- | $ cd dependency-handler | + | |
- | $ git pull | + | |
- | </ | + | |
- | + | ||
- | Build the debian package. | + | |
- | + | ||
- | < | + | |
- | $ cd dep-graphs/ | + | |
- | $ make create_package | + | |
- | </ | + | |
- | + | ||
- | I everything works you should now have a brand new debian package that you can upload the repository. | + | |
- | + | ||
- | < | + | |
- | dupload --to < | + | |
- | </ | + |