Commit Graph

5107 Commits

Author SHA1 Message Date
Dave Reisner c8417f3386 makepkg: normalize whitespace in $pkgdesc when writing .PKGINFO
Specifically, we shouldn't allow newlines in the pkgdesc field, as
pacman will ignore the continuation and end the description prematurely
as written to the local DB. Normalize ALL whitespace, replacing it with
single whitespace characters.

Fixes strange errors as seen by FS#32852.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Dave Reisner 5a5e712c74 pkgdelta: avoid use of eval and IFS manipulation
Instead of blindly consuming data from the .PKGINFO file, parse it more
closely and only declare variables as needed.

Should help to avoid nonsensical errors and possibly dangerous command
execution as seen in FS#32852.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 8e736e1c9a Display install status of optdependencies
When a packages (new) optdepends are printed in install (update),
add a note of their current installation status.  Packages currently
installed are labelled with [installed] and packages to be installed
in this transaction are labelled [pending].

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 62f1c590fc Make alpm_pkg_find public
This function is particularly useful, so make it public.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Benedikt Morbach 7a24f909fc Add pactest for "Optional for" output
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae d0e5cd2c7f Add "Optional for" to package information output
Much like packages that require a give package are displayed in the
"Required by" field of its information output, alos display packages
that optionally require the package.

Inspired-by: Benedikt Morbach <benedikt.morbach@googlemail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Benedikt Morbach 9a24f1ffc5 Add pactests for displaying optdep installation status
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 63a2874fe4 Display optdep install status in package query output
Indicate which optional dependencies are installed when viewing
local package information (-Qi).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae eb9e74ecc7 Notify of removed package required as optdepend
When a package is being removed, provide a notification (via a callback)
if any local package requires it as an optdepend.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 0c2edbdd49 It turns out we do care about directories...
This is a bug that has been around since at least 2007.  On a package
upgrade (either by -S or -U) a new directory could overwrite any file.
This is caused by the filelist difference calculation ignoring all
directories and thus no new directories were checked for conflicting
files on the filesystem.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Florian Pritz 4a427dbc1b Add pactests for not detecting directory conflicts with upgrades
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory 5a247ccbd4 Fix overzealous package removal with unmet dependencies
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>

[Allan: Remove expected failure from fixed pactests]
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 927fdc0079 pactest: variant of package removal due to unmet dependencies
Duplicate of sync140.py but with the alphabetical ordering of the
packages changed.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 1c2cfc5bad pactest: removal of packages with unmet dependencies
Provide a package for removing packages with unmet dependencies.
Currently pacman removes too many packages from the transaction
(FS#30649).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory 9cd7ff807d _alpm_filelist_resolve: add useful return code
Return -1 if a path is too long to resolve or we run out of memory.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 948f135a73 Avoid upgrade conflict with unchanged effective path
This applies to a case such as when /lib is a symlink to /usr/lib. If a
package is installed which contains /lib/libfoo.so, pacman will complain
if this package is then "fixed" to contain /usr/lib/libfoo.so. Since
these have the same effective path and it exists within the same
package, ignore the conflict.

Fixes FS#30681.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 88e7ea421e Resolve file paths during inter-package conflict check
File paths are resolved if necessary during inter-package conflict
checks so that packages carrying the same effective file due to
directory symlinks on the filesystem are flagged as conflicting.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory 28d404f16a _alpm_filelist_resolve: use original filenames where possible
If a filename isn't resolved, the original can be used instead of strdup()ing
it.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Andrew Gregory 80bc89c147 Add _alpm_filelist_resolve
The _alpm_filelist_resolve function takes a filelist and creates
a list with any symlinks in directory paths resolved.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 2fad78974d Add resolved_path to alpm_filelist_t
Add an array to hold the resolved paths of the files in alpm_filelist_t.
When the file name and its resolved file name are identical, the pointer
to the original file name is used to avoid duplicate memory allocation.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae c1abfeae1e Detect inter-package conflicts between files and directories
Detect a conflict between a file/symlink in one package and a directory
in another when both are being installed at once.

A side effect is the creation of conflicts between a directory symlink
and a real directory (e.g lib -> usr/lib in pkg1 and /lib in pkg2).
Given we can not guarantee pkg1 is installed before pkg2, this is a
genuine conflict.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 6860e2f703 pactest: Provide a full filelist to the pactests that need it
It turns out when you set the filelist for a package to include
"usr/lib/foo" in the pactest suite, it thinks there is only the
file "usr/lib/foo" in there...  No "usr/" or "usr/lib/" directory.
This makes life difficult when testing code that scrolls through
a filelist looking for directory entries.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14 12:35:34 +10:00
Allan McRae 254329f6fb makepkg: install debug symbol packages if requested
When using "makepkg -i", install the debugging symbol packages too
if present.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae dbbe3e7cb4 makepkg: assign debugging symbol directory to a variable
Simplifies the stripping of files a lot.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 13667fd4b1 makepkg: allow debug package suffix to be configurable
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 7e8d9dfda2 makepkg: create package from stripped debug symbols
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae a5e81f5599 makepkg: output the name of the package being created
Although it should be currently quite obvious what package is being
created when "Creating package..." is printed, it will not be in the
future when a debug package is potentially created too.  Also, given
$pkgname is always correctly set when split packaging now, we no
longer need to pass that around.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae bd4ff4a377 makepkg: strip debugging symbols into separate folder
When using the "debug" option in combination with "strip", move the
debugging symbols into a separate directory ($pkgdir-debug/usr/lib/debug)
suitable for creating a package from.

Create hardlinks between debugging symbols of hardlinked files and add
symlinks in the .build_id directory if the binary has a build ID.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae a53fd79632 makepkg: always use pkg/$pkgname as $pkgdir
Unify split and single packages to always use a folder within pkg/
as thier $pkgdir.  This will allow a folder for storing a package with
stripped debug symbols to be added within pkg/ too.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 6be96e7612 makepkg: move debug symbol stripping to separate function
Move stripping of files to a spearate function that will be expanded
for the handling of creating debug symbol packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 6c22ef2c82 makepkg: add option to include debugging compiler flags
Add a "debug" option that appends the compiler flags specified in the
variables DEBUG_CFLAGS and DEBUG_CXXFLAGS in makepkg.conf to their
counterpart buildflags.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 7199fb3b1a makepkg: always run tidy_install on repackaging
When using "makepkg -R" without a packge function, we should still
run tidy_install as the user might have added other packaging options
such as (e.g.) '!emptydir' to remove empty directories on repackaging.
Of course we can not revert some options when repackaging without a
package function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Andrew Gregory a459156a4e pactree: unindent first limb
Removing the leader for the toplevel package shifted the name left
but not it's limb.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner d9e8197e60 pactree: unify output between utf8 and ascii
Ensure that both output formats have equal spacing, and therefore an
equivalent layout. This change also removes the styling from the
toplevel package being searched for.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner 8054a254cb pactree: fix style violations
Stick to c89 and avoid mixed code and declarations, and always brace
block statements, even if they're only 1 line.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Dave Reisner 1c0c292728 pactree: autodetect and use unicode line drawing characters
Add a compile time check for langinfo.h so that we can possibly use
unicode line drawing characters if the current locale is supportive of
them. This can be explicitly disabled at runtime with the use of a new
switch: -a, --ascii.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Andrew Gregory e1fdcfb145 pactree: style last branch node differently
Also removes the less helpful provides-specific branch tip.

  Old:                        New:
  |--pkg                      |--pkg
     +--dep1 provides dep5       |--dep1 provides dep5
     |  |--dep2                  |  `--dep2
     |--dep3                     `--dep3
        |--dep4                     `--dep4

[dreisner@archlinux.org: switch original suggestion of \-- to `--]

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Andrew Gregory c4c5b8ba1d pactree: fix --sync getopt value
The long --sync options has apparently never worked.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
wgiokas 6b1deedf15 Add --needed option to makepkg
Simply add the option to pass the --needed flag to pacman when using -i
with makepkg. When using makepkg in scripts, particularly for git
packages with the new version functions and not just a date, this can
save disk io and time instead of reinstalling.

This would mostly be useful with the --noconfirm option.

Signed-off-by: wgiokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Jason St. John 3536975bbf Use sentence case in makepkg
Most of makepkg already uses sentence case. This cleans up the last few
stragglers.

Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 3531533c2f makepkg: save path to PACMAN and test availability
After we install dependencies, we source /etc/profile so that new
elements get added to the path. As this can override any local setting
of PATH, we store the full path of the PACMAN variable passed to makepkg.

Also, add a check for PACMAN availability if it is needed to deal with any
dependency operations.

Reported-by: Martin Panter <vadmium à gmail·com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Martin Panter 86233476b0 Remove last traces of handling command arguments in $PACMAN
This resolves an inconsistency with how the $PACMAN variable was interpreted.
Previously “makepkg” would extract the first word from the $PACMAN variable
and check that it existed as a command. This appears to have been happening
ever since the variable was implemented in revision 66c6d28 (makepkg: allow
to specify an alternative pacman command). Thus it looks like command
arguments were originally allowed in the variable.

However the run_pacman() function now quotes $PACMAN, so the whole variable
has to be just the command name. This quoting was introduced more recently,
perhaps in revision 622326b (makepkg: fix sudo/su calling of pacman).

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Christian Hesse 0285c678ab makepkg: fix signing built package
Fixes issue introduced in 9dd42dc0

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 3232c975c6 makepkg: deprecate PKGBUILDs without a package() function
The package() function has been around since pacman-3.3 and has
significant advantages including limited fakeroot usage and correct
repackaging.  The ability to use PKGBUILDs without a package function
will be removed in a future release.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae 93148d0879 makepkg: print "SKIP" for signature checksums
There are valid reasons for a source files PGP signature to be changed
(expired key, expired signature, additional person signing...). Thus
providing a checksum for signature files can potentially cause a
PKGBUILD to require unnecessary updating.

Avoid this issue by using "SKIP" for the signature checksum.
Fixes FS#31590.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae fbf96203ab makepkg: use last match in BUILDENV/OPTIONS array
Using the last match in the BUILDENV and OPTIONS arrays allows the
user to easily override these values without specifying the entire
array. For example add "BUILDENV+=(sign)" in ~/.makepkg.conf.

Fixes FS#26701.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Simon Gomizelj fc35b16fd4 pacman: add -n/--native filter to -Q
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae b1d614a01d doc: PKGBUILD.5 - fix output of bzr command
Add quotes around 'bzr help revisionspec' to make it clearer that
this is a command to be run.

Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Paul Barbu Gheorghe b25dda737b fixed erroneous memory access to newurl in alpm_db_remove_server
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00
Allan McRae fe8bd95092 repo-add: quote filename for consistent output style
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-11-27 15:16:15 +10:00