summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Source/Functions.pm
AgeCommit message (Collapse)AuthorFilesLines
2018-10-08Dpkg::Source::Functions: Reimplement is_binary() w/o using diff(1)Guillem Jover1-23/+8
The check is very simple, and can be done w/o requiring calling diff(1) for each input file. This makes the code shorter, more portable, and should be faster in the non-binary cases.
2018-08-30Fix some typosGuillem Jover1-1/+1
Thanks-to: Niels Thykier <niels@thykier.net> (for typo in dpkg(1))
2018-08-01Dpkg::Source: Do not change patch permissions if not necessaryGuillem Jover1-0/+13
To be able to build a source tree, a user needs write permisions on it, but not necessarily ownership of those files. We check the existing file permissions and avoid changing them if not necessary, which helps in the case where the user does not have ownership of those files, and they were already present. Closes: #898010 Naming-by: Julian Andres Klode <jak@debian.org>
2017-09-24Dpkg::Source: Use Errno module instead of the slow to import POSIXGuillem Jover1-1/+1
2015-04-18debian: Update my copyright yearsGuillem Jover1-0/+2
2015-04-10Consistently use proper quotation marks all over the placeGuillem Jover1-1/+1
That is "" or '', and not the unbalanced `' pair.
2015-03-31Say directory instead of dir in output messagesGuillem Jover1-1/+1
2015-03-30perl: Rework use and exporter declarationsGuillem Jover1-3/+7
Place 'use' strict and warnings first, then Exporter 'our' declarations, then Test module imports, then system module imports, then Dpkg module imports, then 'use' parent and overload pragmas, separated by a blank line for each block. Split each exported symbol declaration into its own line to ease modifications.
2015-01-28Dpkg: Use shift instead of @_ on single argument unpackingGuillem Jover1-4/+4
2015-01-28scripts: Rename and deprecate _g function with g_Guillem Jover1-6/+6
The old function name was inconsistent with the other gettext family of short aliases which has already caused some code typos, and functions starting with underscore are considered by convention private in Perl.
2014-04-21scripts: Add a space after commaGuillem Jover1-1/+1
2013-12-07Use https:// URLs instead of http:// when possibleGuillem Jover1-1/+1
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-05-08perl: Use the .. operator instead of C-style for loopsGuillem Jover1-5/+5
Fixes ControlStructures::ProhibitCStyleForLoops. Warned-by: perlcritic
2013-05-04Do not use double-quotes on strings that do not need interpolationGuillem Jover1-6/+6
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 initializationsGuillem Jover1-3/+3
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-28Use proper variables instead of barewords for filehandlesGuillem Jover1-2/+2
Fixes InputOutput::ProhibitBarewordFileHandles. Warned-by: perlcritic
2013-04-27scripts: Restrict POSIX imports to :errno_h, :fcntl_h or :sys_wait_hGuillem Jover1-1/+1
This also gets rid of the EOF constant shadowing the EOF member from Dpkg::Compression::FileHandle.
2013-04-19Remove Emacs and vim modelinesGuillem Jover1-1/+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.
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.
2011-03-06dpkg-source: use server-side clock for patched file timestamp on NFSJonathan Nieder1-1/+25
Since 1.13.14~20 (2006-02-10), dpkg-source touches the files it patches when unpacking, with a single date. This way, the order of mtimes does not depend on the order in which the files were patched, which is convenient when e.g. configure.in and configure are patched. More precisely, dpkg-source does something like the following: my $now = time(); foreach my $fn (@patched_files) { utime($now, $now, $fn); } Unfortunately when the filesystem is NFS, "touch" and normal modification set mtime and atime to the current time on the server side, while time() returns the current time on the client side. The two clocks can disagree, producing breakage. So unless a timestamp has been passed explicitly, use utime(undef, undef, $fn) to set mtime for the first file to the server side time and copy it (rounded down to a number of seconds) to all patched files. Reported-by: Stéphane Glondu <glondu@debian.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Improved-by: Raphaël Hertzog <hertzog@debian.org> Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
2010-02-21Dpkg::Source: fix parsing of diff's output to be POSIX-compliantRaphaël Hertzog1-1/+4
While parsing diff's output, accept any sentence that contains the word differ (as specified by POSIX) to identify that binary files could not be compared.
2010-02-21Add $VERSION numbers to all perl modulesRaphaël Hertzog1-0/+2
Modules whose API should be stable have a version 1.00. The modules with version 0.01 are expected to have further API changes in the (near) future or are deemed to be useful mostly for dpkg-dev's internal usage.
2010-02-19libdpkg-perl: Rename Dpkg::IPC::fork_and_exec() to Dpkg::IPC::spawn()Guillem Jover1-1/+1
2009-11-08Add missing license headersGuillem Jover1-0/+13
2009-06-26libdpkg-perl: Import Exporter with ‘use base’Guillem Jover1-2/+1
We don't need to set @ISA now.
2008-12-09Dpkg::ErrorHandling: Replace failure calls with error or syserrGuillem Jover1-1/+1
There's no point in a different failure vs error or syserr function, so let's remove it.
2008-12-09Dpkg::ErrorHandling: Export public functions by defaultGuillem Jover1-1/+1
The remaining non exported functions and variables need to, either disappear, move to some better place, be renamed, or for variables to get hidden through a getter/setter.
2008-11-19dpkg-source: fix to support POSIXLY_CORRECT=1Raphael Hertzog1-2/+2
* scripts/Dpkg/Source/Functions.pm (fixperms): Fix chmod call to also work when POSIXLY_CORRECT is set.
2008-05-08dpkg-source (2.0/3.0 (quilt)): refuse binary files in debian subdirRaphael Hertzog1-1/+27
* scripts/Dpkg/Source/Functions.pm (is_binary): New function to check if a file is binary by using diff against it. * scripts/Dpkg/Source/Package/V2.pm (do_build): Check that all files from the debian sub-directory are non-binary and only allow whitelisted binary files. * man/dpkg-source.1: Document this behaviour.
2008-03-18Allow in-place extraction of a tar archiveRaphael Hertzog1-1/+23
* scripts/Dpkg/Source/Archive.pm: New "in_place" option to extract an archive in the target directory instead of replacing the whole target directory. Replace the logic to fix permissions by fixperms() which is a... * scripts/Dpkg/Source/Functions.pm (fixperms): new function to fix permissions on a given directory so that they match the rights expected through the umask.
2008-02-24Dpkg::Exit and Dpkg::Source::Functions: two new modulesRaphael Hertzog1-0/+31
* scripts/Dpkg/Exit.pm: Enable to register some exit handlers that are called when a script is interrupted by a signal. * scripts/Dpkg/Source/Functions.pm: Contains some generic functions used by other Dpkg::Source::* modules. Only erasedir() for now.