summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Source
AgeCommit message (Collapse)AuthorFilesLines
2013-11-24Dpkg::Source::Package: Deprecate public package variablesGuillem Jover1-1/+35
Replace direct usage of $diff_ignore_default_regexp and @tar_ignore_default_pattern with accessor functions. Addresses Variables::ProhibitPackageVars. Warned-by: perlcritic
2013-11-24Consistently use regex instead of regexp when possibleGuillem Jover7-22/+25
All changed instances are documentation or private code interfaces. The only remaining variable instance with a regexp name is a publicly exposed variable, which will eventually disappear once it has gone through the deprecation process.
2013-11-24Dpkg::Exit: Expose proper functions instead of variablesGuillem Jover6-27/+27
Add new functions to interact with the exit handlers. Mark @handlers as deprecated and to stop exporting it on VERSION 2.00. Addresses Variables::ProhibitPackageVars. Warned-by: perlcritic
2013-11-24Dpkg::Compression: Add new compression_get_file_extension_regex() functionGuillem Jover4-8/+12
Replace all direct accesses to $compression_re_file_ext with calls to the new function, and mark the variable as deprecated to be removed on VERSION 2.00. Addresses Variables::ProhibitPackageVars. Warned-by: perlcritic
2013-10-26Dpkg::Source::Package: Check subprocess exit codesGuillem Jover2-0/+3
Make sure to error out if one of the subprocesses exits with an error. Spotted-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2013-09-19Decapitalize error and warning messagesGuillem Jover1-2/+2
2013-07-26Dpkg::Source::Package: Do not scan control file twice for PGP signatureGuillem Jover1-9/+1
The code was pre-scanning the control file looking for a PGP signature, and the parser was doing a more thorough check later on. Just remove the double parsing, and rely on the more accurate one from the parser.
2013-07-26scripts: Use () instead of qw() for empty importsGuillem Jover1-1/+1
2013-07-26Dpkg::Source::Quilt: Fix chmod() arguments orderPablo Oliveira1-1/+1
In the restore_quilt_backup_files() function, the chmod() call has the arguments swapped. This prevents restoring quilt patches that remove files. Closes: #710265 Signed-off-by: Guillem Jover <guillem@debian.org>
2013-07-18scripts: Use Dpkg::Util list functions instead of grepGuillem Jover1-1/+2
This avoids using the grep builtin on scalar context, which is suboptimal as it does not short-circuit on first match, and it's intended to produce an output array. Ideally we'd directly use the functions from List::MoreUtils, because they might be more performant, but not being a core module is a show stopper. Addresses BuiltinFunctions::ProhibitBooleanGrep.
2013-07-18scripts: Do not mix boolean operatorsGuillem Jover1-3/+3
Fixes ValuesAndExpressions::ProhibitMixedBooleanOperators.
2013-07-18scripts: Do not use negative expression in unless and until conditionsGuillem Jover1-1/+2
These are double negations which are hard to grasp at a first glance. Fixes ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions.
2013-07-08Dpkg::Source::Package: Do not return an error message if we can buildGuillem Jover5-7/+15
2013-07-08Dpkg: Catch mismatches between version strings and format versionsBernhard R. Link2-0/+12
Ensure that a 3.0 (quilt) package has a non-native version and that a 3.0 (native) package has a native version. To get the information, extend Dpkg::Version with a is_native method to check whether a version has a revision or not. [guillem@debian.org: - Add is_native to history of changes. - Do not return an error string when returning a true result. ] Closes: #700177 Signed-off-by: Guillem Jover <guillem@debian.org>
2013-07-08Dpkg: Move epoch-less or revision-less output logic to Dpkg::VersionGuillem Jover1-5/+2
Instead of doing the magic of generating a version string without epoch and revision and a version string without epoch in Dpkg::Source::Package, extend Dpkg::Version's as_string function to support generating that string. Based-on-patch-by: Bernhard R. Link <brlink@debian.org> Signed-off-by: Guillem Jover <guillem@debian.org>
2013-07-08Dpkg::Source::Patch: Sort files inside new diff lexicographicallyGuillem Jover1-0/+2
The files inside the diff were being sorted correctly for existing patches, but not for new ones. Closes: #689193
2013-06-22scripts: Inherit from parent instead of baseGuillem Jover9-9/+9
Use the lightweight parent instead of the bloated base.
2013-06-22scripts: Do not inherit from Exporter just import its importGuillem Jover1-1/+1
Do not use base which is bloated, and we don't need any other of Exporter's inherited methods anyway.
2013-06-22Dpkg::Source::Package: Capitalize variant module namesGuillem Jover7-10/+16
Lowercase module names are reserved by convention for pragmas, and there's really no need to diverge here from the general dpkg project naming convention. Also make sure source package format variant names are always in lowercase, to not allow names that would not work with previous dpkg-source versions. Fixes NamingConventions::Capitalization.
2013-06-22Dpkg: Deprecate lowercase exported by default variablesGuillem Jover1-2/+2
Rename, uppercase and do not export new variables by default, to avoid cluttering the caller namespace, and to give them consistent names. We'll keep the old variables for a while, to not break uses from external modules. Addresses Variables::ProhibitPackageVars.
2013-05-08Dpkg::Source::Patch: Use number separator to ease readabilityGuillem Jover1-2/+2
Fixes ValuesAndExpressions::RequireNumberSeparators. Warned-by: perlcritic
2013-05-08perl: Use correct comparison operator for each typeGuillem Jover1-1/+1
Fixes ValuesAndExpressions::ProhibitMismatchedOperators. Warned-by: perlcritic
2013-05-08perl: Slurp files more efficientlyGuillem Jover1-1/+2
Do not read each line to then join it, just switch on slurp mode and do it in one go. Use the newly created function file_slurp. Fixes InputOutput::ProhibitJoinedReadline. Warned-by: perlcritic
2013-05-08perl: Use the .. operator instead of C-style for loopsGuillem Jover1-5/+5
Fixes ControlStructures::ProhibitCStyleForLoops. Warned-by: perlcritic
2013-05-08perl: Remove unused variablesGuillem Jover2-2/+1
Fixes Variables::ProhibitUnusedVariables. Warned-by: perlcritic
2013-05-04Do not use double-quotes on strings that do not need interpolationGuillem Jover12-385/+385
Using double-quotes imposes a small performance penalty as the perl parser needs to check if any interpolation is needed. Use double-quotes only when the string contains single-quotes. Ideally we'd use double-quotes too for escaped meta-characters that might otherwise be confusing to immediately see if they need interpolation or not, but the policy does not (currently) allow to ignore these. Fixes ValuesAndExpressions::ProhibitInterpolationOfLiterals. Warned-by: perlcritic
2013-04-30Do not quote simple identifier hash keys in element accessesGuillem Jover11-366/+366
Addresses ValuesAndExpressions::ProhibitInterpolationOfLiterals. Warned-by: perlcritic
2013-04-30Do not quote simple identifier hash keys in initializationsGuillem Jover8-31/+31
Do not quote the keys for any hash which will always use simple identifiers, as that is taken care of by the => operator. So this does not apply to overload pragmas, version operators, field names, substvars, command line options or filenames. Addresses ValuesAndExpressions::ProhibitInterpolationOfLiterals. Warned-by: perlcritic
2013-04-29Dpkg: Use identifiers as key names whenever possibleGuillem Jover3-23/+23
The fixed key names are either inside unstable modules, internal to them or for keys in code never released, so should not cause much of an issue.
2013-04-29scripts: Use // operator instead of an explicit defined checkGuillem Jover5-12/+12
2013-04-29scripts: Do not use sort directly on the return keywordGuillem Jover1-1/+2
Fixes Subroutines::ProhibitReturnSort. Warned-by: perlcritic
2013-04-29scripts: Do not use "nested" functions as they are globalGuillem Jover3-90/+104
Even if these functions are defined inside another function, they are still global, make them proper global functions by moving the definition outside of the outter function and mark them explicitly as being private by using an underscore prefix. There's no point in making these anonymous nested functions, as they do not need to access any variable from the outter functions. Fixes Subroutines::ProhibitNestedSubs. Warned-by: perlcritic
2013-04-28Use proper variables instead of barewords for filehandlesGuillem Jover8-74/+81
Fixes InputOutput::ProhibitBarewordFileHandles. Warned-by: perlcritic
2013-04-27scripts: Restrict POSIX imports to :errno_h, :fcntl_h or :sys_wait_hGuillem Jover5-5/+5
This also gets rid of the EOF constant shadowing the EOF member from Dpkg::Compression::FileHandle.
2013-04-27scripts: Use getcwd from Cwd instead of POSIXGuillem Jover3-3/+5
2013-04-19Use just 'return' instead of 'return undef' in perl codeGuillem Jover1-4/+4
This makes sure the functions always return the appropriate value independent of the context. Fixes Subroutines::ProhibitExplicitReturnUndef. Warned-by: perlcritic
2013-04-19test: Add new perl critic test caseGuillem Jover1-1/+1
Mark false positives in the perl code so that perlcritic ignores them, and so that they are documented in-place.
2013-04-19Remove Emacs and vim modelinesGuillem Jover9-9/+0
These just clutter the code base, as adding modelines for each possible editor out there does not scale, and they are currently not exhaustive anyway.
2013-03-18scripts: Remove unused POSIX module usageGuillem Jover1-1/+0
In addition to avoiding imports from unneeded modules, this fixes a perl warning due to redefinition of getcwd() exported by both the POSIX and Cwd modules, affecting any program executed with «perl -w» and including the Dpkg::Source::Archive module. Closes: #700978 Reported-by: Niels Thykier <niels@thykier.net> Analysis-by: Raphaël Hertzog <hertzog@debian.org>
2013-03-18Dpkg: Fix OpenPGP armored signature parsingGuillem Jover1-1/+1
Change parsing code to honour RFC4880. Handle whitespaces at EOL, and correctly expect five trailing dashes on the Armor Header Lines. Closes: #695919 Reported-by: Ansgar Burchardt <ansgar@debian.org>
2012-08-03Dpkg::Source::Quilt: ensure the target directory exist before copying filesRaphaël Hertzog1-0/+3
When we restore files in the pop operation, the target directory is usually pre-existing, but in the case where the patch is removing all the files in the directory, the usage of patch's --remove-empty-files lead to the removal of the parent directories which are empty. This caused a regression in dpkg-source's handling of "3.0 (quilt)" source package since we switched "3.0 (quilt)" to restore the quilt backup files to unapply patches. Formerly we were using "patch -R" which was creating the required directories by itself. Reported-by: Thomas Koch <thomas@koch.ro> Closes: #683547
2012-06-30Avoid full stop and double newline at the end of errors and warningsJonathan Nieder3-6/+7
Error messages like "couldn't parse control information from foo.deb" are not full sentences, so don't punctuate them like one. The main purpose of this patch is stylistic consistency, but perhaps it can also make copy-and-paste from messages like dpkg-query: no path found matching pattern /usr/bin/agrep. a little easier. Most actual full sentences should remain untouched. A few full sentences are error messages at heart, so this patch converts those to lower-case sentence fragment form, too. [guillem@debian.org: - Add missed strings. - Minor tweaks to strings. ] Closes: #624000 Requested-by: Jari Aalto <jari.aalto@cante.net> Signed-off-by: Guillem Jover <guillem@debian.org>
2012-06-30Dpkg::Source::Package: Do not assume $ENV{'HOME'} is definedNiels Thykier1-1/+1
Closes: #677631 Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Guillem Jover <guillem@debian.org>
2012-06-29dpkg-source: support new option --no-unapply-patchesRaphaël Hertzog2-6/+12
This option is supported by formats "2.0" and "3.0 (quilt)". It disables the patch unapplication that can happen in the --after-build hook.
2012-06-29Extract Dpkg::Source::Quilt out of Dpkg::Source::Package::V3::quiltRaphaël Hertzog2-229/+377
This new Dpkg::Source::Quilt object handles all the traditional quilt operations of applying/unapplying patches and the associated handling of the quilt database (the .pc directory). This commit should not introduce any user-visible changes.
2012-06-27dpkg-source: enhance --commit to auto-whitelist modified binary filesRaphaël Hertzog1-1/+10
That way the same command can be used whatever kind of upstream files has been modified. Reported-by: Cyril Brulebois <kibi@debian.org>
2012-06-27Dpkg::Source::Package::V2: refactor the handling of binary filesRaphaël Hertzog1-46/+97
Move the code handling debian/source/include-binaries in a dedicated object.
2012-06-27Dpkg::Source::Functions::is_binary(): localize $_ to avoid side-effectsRaphaël Hertzog1-0/+1
Without this local($_) the function could modify the $_ variable as used by the caller.
2012-06-25Dpkg::Source::Package: enable exit handlers for the commit operationRaphaël Hertzog2-1/+10
The commit function already uses various exit handlers to clean up in case of failures. Unfortunately those handlers were never triggered because there was no global eval intercepting the failures. This commit adds the required logic.
2012-06-13dpkg-source: keep the current patch header when regenerating the automatic patchRaphaël Hertzog1-1/+9
When dpkg-source regenerates the automatic patch (with formats "2.0" or "3.0 (quilt)") it will keep the current patch header to avoid losing changes made by the maintainer. Reported-by: Cyril Brulebois <kibi@debian.org>