Commit Graph

5421 Commits

Author SHA1 Message Date
Simon Gomizelj 51276f1ac5 remove the duplicate strnlen and strndup
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
Dave Reisner 08a1244f4e libalpm/sync: remove useless intermediate variable
This also rearranges some code to ensure that declarations and code
aren't mixed.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10 09:01:56 +10:00
William Giokas d90641a894 contrib: Add color to paccache
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:40 +10:00
William Giokas 6e0c47d22f contrib: Add color to bacman
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:40 +10:00
William Giokas f8ed8620d0 contrib: Make pacdiff colors the same as makepkg
Added an `ask` message function that emulates pacman's appearance.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:40 +10:00
William Giokas 5a67eee78c scripts: Add color to repo-add
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas 79d60f0f42 scripts: Add color to pkgdelta
Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas 81f945e2a5 scripts: Add color to pacman-optimize
Color enabled by default, use --nocolor to disable colored output.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas 9d99914a18 scripts: Add color to pacman-key
Use --nocolor to suppress colored output from pacman-key, otherwise
output will be in color.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas 2c91b991ee scripts: Add color to pacman-db-upgrade
Color enabled by default, use --nocolor to turn off colors.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
William Giokas 65650f2cdb scripts: Add color to library/output_format.sh
Use the same colors as makepkg in messages. Add in the 'plain' function
as well.

To use the colors, you need to include the term_colors.sh file, or add
definitions for the colors explicitly.

Signed-off-by: William Giokas <1007380@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-08 17:04:39 +10:00
Simon Gomizelj e292b1b5a2 update documentation and config files
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj 32f3b4304c colourize -Q
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj 7dd1a5a58d colourize -Sl/-Ql
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj 326345b378 colourize -Ss/-Qs
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj 46c10c5bf3 colourize the output of -Qi/Si
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj ce06e6f9b9 colourize table output
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj 5dada13a1a colourize warnings and errors
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj e8130b8f2c colourize colon_printf and question
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj 6582f68c9d introduce colstr for colourizing
colstr_t colstr will hold the colourizing agents.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj c8c7a51374 add a config settings and flag for colours
Colours can be enabled in two ways:

- Add Color to pacman.conf. This enables colours automatically.
- Use --color=WHEN where WHEN is none/auto/always.

WHEN as 'never' disables colours (overrides config file), as 'auto'
enables colours when stdout is a tty, and 'always' enables colours no
matter what.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:04 +10:00
Simon Gomizelj ea42d03ea1 standardize format functions
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Simon Gomizelj ce5ee8a065 remove format from statistic messages
Remove the format component of the "Total Download Size" and related
messages. The heading will be colourized, the size won't.

However since the length of these messages can vary by language, we need
a pretty printer to format them nicely.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Simon Gomizelj b4459f1e04 split "Packages (%zd):" message
Basically all translation messages that need colouring but _also_ happen
to be format strings need to be split up.

This makes it easy to conditionally embed colour codes into the output
at runtime.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Simon Gomizelj ef5feb15a7 remove :: prefix from all message
This will substantially simplify the logic to add colours to messages.

Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Simon Gomizelj 098cfe516d refactor common code in query_search/sync_search
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:55:03 +10:00
Neer Sighted 8b03b1a877 makepkg: Use a recursive git clone.
Make makepkg use a recursive clone when creating the working directory.
This will initialize submodules

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:48 +10:00
Sébastien Luttringer 6831a5f4b1 makepkg: Avoid find to fork for each rm call
Reported-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:48 +10:00
Sébastien Luttringer a03f5f55cd Add staticlibs option in PKGBUILD
This option helps to removes static library files in packages.

Related to the thread:
https://mailman.archlinux.org/pipermail/arch-dev-public/2013-March/024552.html

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:48 +10:00
Olivier Brunel 017184fab5 libalpm: Search for replacers before literals
Since 882bff36 literals would be searched before replacers, resulting in a
package being replaced by another not actually being replaced under certain
conditions (e.g. they're both in the same repo).

This change effectively reversed the expectations in test sync132. This patch
switches the order back to replacers first, thus making sure if a package is
replacing another one, the change will always happen, even if both are in the
same repo.

Note that a package replacing another one in a repo with higher priority will
not be done, see FS#11737 and test sync1105

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:47 +10:00
Olivier Brunel 1b39653e96 libalpm: Fix installing update of a replaced package
During a sysupgrade, if a package is replaced by another, and an update for the
former package is found (on another repo) the replaced package would be
re-installed.

Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:47 +10:00
Andrew Gregory a98bb96b43 fix typos in pacman tests
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:47 +10:00
Allan McRae e6b8d5189f Do not resolve every local package filelist on remove
Although technically correct, this results in my system taking ~30 seconds
to resolve all filelists when removing a package that has a directory not
owned by any package.  The check for if any package own the empty directory
is a rare enough occurance, and it will be even rarer when that directory
has a directory symlink in its path, so just revert this at this stage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-07 15:38:47 +10:00
Andrew Gregory 8e2648bf02 add SYMEXPORT to alpm_filelist_contains
alpm_filelist_contains is listed in alpm.h and should be public but was
not exported.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Dave Reisner 3d142fe8ef dload: don't download sig if package is found in cache
Avoids the segfault seen in FS#33911.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Richard Pougnet 63baba13ec Provide full path names in warning messages
Fix FS#31556 by printing filename instead of entryname. Thus,
removing a lot of confusion from the output.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Dave Reisner 972528c021 paccache: use xargs to execute mv/rm commands
This removes the restriction on the length of the command line, as xargs
will work around by running multiple instances of the command for us.

As seen: https://bbs.archlinux.org/viewtopic.php?pid=1232959

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Allan McRae 34749e177d Perform limited conflict checking with --force
Pacman currently bails when trying to extract a file over a directory
when using --force.  Instead of ignoring all conflict, perform the
check and skip any file-file conflicts. Conflicts between directories
and files are still flagged and cause the transation to abort.

As a bonus, we now know about files changing packages when using
--force, so we can skip removing them fixing upgrade046.

Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory 19754b34a3 use resolved_path for filelist_contains
alpm_filelist_contains was being used to search for resolved paths, but
searching in the unresolved paths, causing it to miss matches.  We
always search unresolved paths and search the resolved paths if
available because _alpm_filelist_resolve is not public and requires
a context handle, so it can't be called from alpm_filelist_contains.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory 083ac51816 return resolved paths from filelist_difference
We were comparing files based on resolved paths but returning the
original file_t structures, which were not necessarily in the same
order.  The extra file_t information was only being used to determine if
the file was a directory which can be accomplished by testing for
a trailing slash, so just return the resolved path.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory 9995510dc8 return resolved paths from filelist_intersection
We were comparing files based on resolved paths but returning the
original file_t structures, which were not necessarily in the same
order.  The additional file_t information was never used, so just return
the resolved path.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory 4a1d93b92c add fileconflict tests for cases with symlinks
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory 0bbc406ee8 use alpm_list_free on filelist intersection
alpm_filelist_intersection returns a list of pointers to internal file_t
struct's, so only the list itself should be freed.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-24 13:11:54 +10:00
Andrew Gregory 8803ae3b4d pmtest: install filesystem entries before packages
Installing filesystem entries first allows the filesystem to provide
a symlink to a directory.  Packages will then be able to use the symlink
as if it were a directory instead of causing an error.

For example:

self.filesystem = ["dir/", "link -> dir/"]
pkg = pmpkg("pkg1")
pkg.files = ["link/file"]
self.addpkg2db("local", pkg)

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:44 +10:00
Andrew Gregory bc747fbfbf fix off-by-one error in _alpm_filelist_resolve
'/' should not be appended to the resolved root when root is "/".

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Andrew Gregory d5a5a6b512 fix style violations
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Andrew Gregory 578dfcd977 fix alpm_validation_t comment
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Andrew Gregory 158a249a77 add alpm_logaction to API updates
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Andrew Gregory c1a84c03b2 find_fileconflicts: reduce path resolution calls
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00
Dave Reisner 0a5b79e133 makepkg: add support for .pkg.tar.lzo
Supported by libarchive as of version 3.1.0 when compiled against lzo2
or in the presence of the lzop binary.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-16 11:06:43 +10:00