1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00
Commit Graph

1165 Commits

Author SHA1 Message Date
Dan McGee
6f9ab22fd8 testdb: check local database for duplicate files
This adds an additional check step to find files in the local database
that claim to be owned by more than one package at once, which is
definitely not a supported setup.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-07 11:28:37 -06:00
Dan McGee
2ce4f85f1e Convert get_update_timediff to integer return value
We don't need absolute floating point precision at all here; we can
stick to integer land and use milliseconds which are precise enough for
our purposes. This also removes most floating point math out of the
non-update code path.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-02 12:55:59 -06:00
Dan McGee
c34b69b5c7 Convert strtrim/strlen paired calls to only strtrim
This utilizes the new return value so we don't have to find the length
of the string again.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:47:30 -06:00
Dan McGee
38143770a9 Merge branch 'maint' 2011-12-23 14:40:59 -06:00
Dave Reisner
e28f321a48 pactree: cleanup register_syncs
- take advantage of the new strtrim return value
- tighten scope on line pointer

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-23 14:37:03 -06:00
Dave Reisner
bec0b0c823 pactree: update with new strtrim function
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-23 14:37:03 -06:00
Dave Reisner
92216c5864 pacman/util: return size_t from strtrim
Instead of returning the same value as the parameter to this function,
return the length of the string, which can be useful to the caller when
its non-zero (e.g. to find the end of the string).

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-23 14:37:03 -06:00
Allan McRae
d95c04945f Allow comments after repo section header in pacman.conf
Pacman assumes that the final character of a line specifing a repo
in pacman.conf is a "]".  But it did not clean whitespace from the
line after removing any comments.  So lines like:

[allanbrokeit]  # could break system

caused pacman not to recognize the repo.  Adjust config parsing to
strip comments before trimming whitespace from the end of the string.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-23 14:36:25 -06:00
Dave Reisner
d6ccd44390 include config.h via Makefiles
Ensures that config.h is always ordered correctly (first) in the
includes. Also means that new source files get this for free without
having to remember to add it.

We opt for -imacros over -include as its more portable, and the
added constraint by -imacros doesn't bother us for config.h.

This also touches the HACKING file to remove the explicit mention of
config.h as part of the includes.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-21 18:13:17 -06:00
Dave Reisner
3d4656c020 code syntax cleanup
As per HACKING file, we use 'CTRL(' rather than 'CTRL ('

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:51:59 -06:00
Dan McGee
1a1f5540a4 pacman: process all sync targets before exiting on error
If someone specifies a bogus line such as

    pacman -S baz adsf/boo base-devel

we are better off trying to process all targets and showing all relevant
errors before exiting. This is easier in -U and -R operations where we
aren't dealing with groups, but here we attempt to skip group selection
once we know a target has errored to avoid cluttering the output and
hiding the real problem.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Dan McGee
074cf4cb95 pacman: process all targets on upgrade operation
If an early target fails, we stopped processing the rest of the list. We
should continue all the way through and show relevant errors for each
target if possible, and error out only at the end.

We do process all targets to check for URLs first and will error out if
some could not be processed; we then do a second loop and try to load
each target specified on the command line.

This mirrors a patch by Allan to do the same for removal operations.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Allan McRae
62fa0c7d8d pacman: list all unknown targets on removal operation
On a removal operation, pacman currently reports an error for the
package that is not found in the database and then exists.  Adjust
so that all unknown packages are reported.

Before:
> pacman -R foo bar
error: 'foo': target not found

After:
> pacman -R foo bar
error: 'foo': target not found
error: 'bar': target not found

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12 12:45:40 -06:00
Dan McGee
1d98c6347c Merge branch 'maint' 2011-11-30 22:34:25 -06:00
Dan McGee
f5820c8bd6 Miscellaneous post-4.0.1 updates
Some late-arriving translation updates and add the correct dates to the
index.txt releases table.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30 22:28:13 -06:00
Dan McGee
96b3ba3470 Merge branch 'maint' 2011-11-20 21:40:50 -06:00
Florian Pritz
2141b7112d add key algo to import msg
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:40:19 -06:00
Florian Pritz
2f96067fe7 change gpg import message to resemble gpg --list-keys
Dan: const pointers, don't worry about bitfields.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:39:33 -06:00
Dan McGee
507a2d15e6 Final changes before 4.0.1 release
* Add last-minute changes to NEWS
* Don't treat '_' or '_n' special in scripts when finding translatable
  strings; this breaks with one use of `read` and a dummy _ variable

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20 21:29:46 -06:00
Dan McGee
919b604c29 Merge branch 'maint' 2011-11-16 14:51:17 -06:00
Dan McGee
c79c068fe9 Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16 14:45:25 -06:00
Dan McGee
f1ec3b9b10 Remove unnecessary casts in callback code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15 09:11:03 -06:00
Jonathan Conder
a3f9399295 create a typedef for enum _alpm_errno_t
This is consistent with the other enums and structs, and should be
slightly more readable.

Signed-off-by: Jonathan Conder <jonno.conder@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-14 08:54:03 -06:00
Dan McGee
c0ce10397a Update translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-13 22:21:02 -06:00
Dan McGee
fcf0a8b203 Updates in preparation for 4.0.1 release
Bump the version, update the translation template files, and fill in
NEWS with relevant commits and changes since 4.0.0.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-13 21:55:52 -06:00
Dave Reisner
10241a6d76 add fnmatch support for HoldPkg
Adds test remove031.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-13 14:19:16 -05:00
Dan McGee
1a994bf180 Merge branch 'maint' 2011-11-07 09:16:10 -06:00
Dan McGee
601c808b8d Fix download progress rounding edge case
Allan's original message: Occasionally when the download rate showed
100.0 the output got messed up. This was caused by the rounding of a
number between 99.95 and 100.  Adjust the threshold to avoid this
rounding issue.

Dan: make this fix, but also show values between 0 and 9.995 with two
decimal places since we have the room.

Original-fix-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-03 09:54:33 -05:00
Dan McGee
ba7a056d58 Add OPEN() and CLOSE() util macros
These wrap the normal open() and close() low-level I/O calls and ensure
EINTR is handled correctly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:27:31 -05:00
Dan McGee
a4ce3edf95 Merge branch 'maint' 2011-11-01 10:26:45 -05:00
Dave Reisner
d98ff04cc9 src/util: link vercmp against .lo, not the .o
This seems to fix FS#26652.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01 10:25:15 -05:00
Dan McGee
90ddcbe71d Merge branch 'maint'
Conflicts:
	src/pacman/package.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 19:29:47 -05:00
Dan McGee
33bb7dbd35 Hide empty columns in table package list display
On -R operations, the "New Version" column is always empty, taking up
space and not really showing the user anything valuable. The same is
true on -S or -U operations for the "Old Version" column when packages
are only being installed and not upgraded.

Remove this column so we get a few screen columns back, especially now
that we show repo/packagename style output. This also makes some
adjustment to the padding logic. We no longer include padding in column
widths but it is included in the total table width. We also ensure the
last displayed column is always right aligned, even if this is not the
actual rightmost column.

Example output, before:
    $ sudo pacman -R eclipse
    checking dependencies...

    Targets (1):

    Name     Old Version  New Version   Net Change

    eclipse  3.7-1                     -194.02 MiB

    Total Removed Size:     194.02 MiB

And after:
    $ sudo pacman -R eclipse
    checking dependencies...

    Targets (1):

    Name     Old Version   Net Change

    eclipse  3.7-1        -194.02 MiB

    Total Removed Size:     194.02 MiB

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 19:29:31 -05:00
Dave Reisner
32327dc8c9 pacman: show repo name in download prompt
This only applies to the VerbosePkgLists option. Lessens the
deficiencies created by earlier work to separate download records by
repository.

Satisfies FS#26334.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 19:29:31 -05:00
Dave Reisner
6f2faf16ba sync: dont group sync records by repository
Break out the logic of finding payloads into a separate static function
to avoid nesting mayhem. After gathering all the records, download them
all at once.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 11:12:00 -05:00
Dan McGee
20a47aba8e Remove remaining usages of fprintf() from frontend
These can either be replaced with pm_printf() if they are error related,
or in the fprintf(stdout, ...) case a bare printf() will do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:51:49 -05:00
Dan McGee
9e9ecf2183 Remove pm_fprintf() in favor of pm_printf()
Now that pm_printf() always prints to stderr, we don't need this second
function that was always used with stderr as the first argument. Thus,
this patch removes the function and makes the following sed replacement:

    sed -i -e 's#pm_fprintf(stderr, #pm_printf(#g' src/pacman/*.c

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:45:18 -05:00
Dan McGee
45f86ca1ca Use stderr as output stream for pm_printf()
This matches what we now do in our backend callback function- all
debug/info/warning/error/etc. messages should be on stderr. These are
all the messages with a "warning:" or other type prefix, so does not
affect general pacman output.

This should fix the output confusion noted in FS#26555.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21 10:38:02 -05:00
Dan McGee
842c4422ed Table display: print message with warning: prefix
Use the normal error functions here rather than a bare fprintf().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17 08:28:57 -05:00
Dan McGee
a33424f879 Merge branch 'maint' 2011-10-14 08:16:18 -05:00
Dan McGee
dbd54c0cb9 Use fputs and putchar in callback progress display
When we have fixed strings or output, printf overhead is unnecessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 08:14:44 -05:00
Dan McGee
0d2600c575 Remove -f short option for --force
This is not something that should be used on a frequent basis, and
giving it a short option encourages use without making the drawbacks
obvious. For the 1% of situations that require it, the 5 extra
keystrokes are a fair price to pay.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14 08:13:38 -05:00
Dan McGee
8605284e0d Use puts() instead of no-op printf() where applicable
This replaces several printf calls of the following styles:
   printf("%s", ...);
   printf("some fixed string");
   printf("x");

We can use either fputs() or putchar() here to do the same thing
without incurring the overhead of the printf format parser.

The biggest gain here comes when we are calling the print function in a
loop repeatedly; notably when printing local package files.

    $ /usr/bin/time ./pacman-before -Ql | md5sum
      0.25user 0.04system 0:00.30elapsed 98%CPU
    $ /usr/bin/time ./pacman-after -Ql | md5sum
      0.17user 0.06system 0:00.25elapsed 94%CPU

    $ /usr/bin/time ./pacman-before -Qlq | md5sum
      0.20user 0.05system 0:00.26elapsed 98%CPU
    $ /usr/bin/time ./pacman-after -Qlq | md5sum
      0.15user 0.05system 0:00.23elapsed 93%CPU

So '-Ql' shows a 17% improvement while '-Qlq' shows a 13% improvement on
382456 total files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 20:59:16 -05:00
Dan McGee
9934052b54 Remove mcheck.h support
When was the last time anyone used this? That's what I thought.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 20:49:24 -05:00
Dan McGee
53e525c4f3 Fix some strict 32-bit gcc warnings
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 16:25:21 -05:00
Dan McGee
5b5b250443 Coding style cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13 15:16:59 -05:00
Dan McGee
ff87046354 Merge branch 'maint'
Conflicts:
	src/pacman/util.c
2011-10-13 11:25:50 -05:00
Dan McGee
6be492d2f7 Remove alpm_list_getdata wrapper function
This one is pretty darn useless. Just derefence the ->data attribute
since the type is public anyway and save yourself the function call.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:22:49 -05:00
Dan McGee
61c6ae01b3 VerbosePkgLists: format table lines in i18n-compatible way
This had the unfortunate implementation detail that depended on the
strings having 1 byte == 1 column hold true. As we know, this is not at
all the case once you move past the base ASCII character set.

Reimplement this whole thing so it doesn't depend on format strings at
all. Instead, simply calculate the max column widths, and then when
displaying each row add the correct amount of padding using UTF-8 safe
string length functions.

Before:

名字        旧版本新版本  净变化 下载大小

libgee                0.6.2.1-1  0.60 MiB    0.10 MiB
libsocialweb          0.25.19-2  1.92 MiB    0.23 MiB
folks                 0.6.3.2-1  1.38 MiB    0.25 MiB

After:

名字          旧版本  新版本     净变化    下载大小

libgee                0.6.2.1-1  0.60 MiB  0.10 MiB
libsocialweb          0.25.19-2  1.92 MiB  0.23 MiB
folks                 0.6.3.2-1  1.38 MiB  0.25 MiB

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:18:38 -05:00
Dan McGee
5f3629bea0 Introduce alpm_time_t type
This will always be a 64-bit signed integer rather than the variable length
time_t type. Dates beyond 2038 should be fully supported in the library; the
frontend still lags behind because 32-bit platforms provide no localtime64()
or equivalent function to convert from an epoch value to a broken down time
structure.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12 14:01:25 -05:00