You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
79 B
Perl

General rewrite of the codebase 0. Overview =========== This commit message contains the following sections: * Rationale * Removed features * Changed behaviour * New features * Regressions * Code quality improvements 1. Rationale ============ The old code base suffered from: * The overuse of global variables (80) which were freely used by functions to store their results in as side-effects of their actual computation. * Underdocumented configuration file settings. Some values are only mentioned in the passing while documenting other things in the man page. Some values are not mentioned at all. * Repetition of code snippets. Some functions only differed slightly but were copy-pasted to create new versions. Configuration parsing and dumping copy-pasted value conversion multiple times instead of working with value types. * Abuse of system() and backticks without escaping special shell characters instead of passing an array to system(). * Missing error checks when system() or backticks are used. * Non-existence of unit tests. * rm -rf your whole filesystem with the right configuration parameters This commit *reduces* the lines of code in the main program from 1390 down to FIXME while at the same time *increasing* the ratio of comments to lines of code from 0.06 to FIXME and *adding* additional features and fixing the problems listed above. 2. Removed features =================== * The --source-dir command line option and retainsources configuration variable have been removed as the feature of downloading source packages corresponding to the installed binary packages was deemed out of scope for multistrap * The workarounds for dash not configuring (#546528) and absolute /lib64 symlinks (#553599) were dropped as they are not needed anymore * Removed support for dpkg without multiarch 3. Changed behaviour ==================== * They keyring setting does not accept packages anymore but either keyring files or directories with .gpg files in them. This is so that multistrap does not have to install a package on the host system (which requires superuser privileges) nor is it anymore required that the apt sources of the host system contain the right mirrors to retrieve the desired keyring packages nor is it anymore required that the selected keyring package stores the keyring at the location where sbuild expects them. * Any additional keyring package now has to be manually listed in the packages setting as they are no longer installed automatically. This now also makes it possible to bootstrap a system without the keyring packages that were required to install it. * Die if setupscripts, configscripts or hook produce an error instead of continuing. * Die if the specified debconf seed file does not exist. * Be more unforgiving about problems. Previous to this commit, multistrap would - skip loop iterations with invalid values - print a warning if errors happen but continue anyways Now we die with an appropriate error message immediately. * The component now has to be passed explicitly in each section 4. New features =============== * Configuration files can now be nested arbitrarily deeply. * All configuration variables are documented together with their default values and data types. * Dumping the configuration settings creates another valid configuration file. This can be used to merge multiple configuration files into a single one containing the resulting settings. 5. Regressions ============== * The translations need updating for the new and changed strings. 6. Code quality improvements ============================ 6.1. General ------------ * Replaced 80 global variables by 2 which are only used for reading. * Removed unused variables. * Removed unused or superfluous code. * Functions have no side-effects on variables anymore. Everything they compute is part of their return value. * Instead of using "." and join() to create a whitespace delimitered string which is then split(), push to an array in the first place. * Make file a modulino to let it be used as a program and module at the same time. This allows the unit tests to import functions from it. * Use Getopt::Long for option parsing. * Use Pod::Usage for --help and man output. 6.2. Less dependencies ---------------------- * Drop dependency on Config::Auto for Config::IniFiles. The latter comes with support for all sorts of configuration file formats which we do not need. The later offers features not exposed by the former (like automatically ignoring case) which in turn simplifies the code. * Replace Locale::gettext by Dpkg::Gettext which makes the availability of gettext optional. Dpkg::Gettext is available anyway because we plan to use Dpkg::Index instead of Parse::Debian::Packages. 6.3. Unit tests --------------- Add tests: - t/config.t for the recursive ini file reader - t/critic.t for perlcritic - t/perltidy.t for perltidy
8 years ago
#!/usr/bin/perl
use Test::PerlTidy;
run_tests(perltidyrc => 't/perltidyrc');