1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-10-31 15:45:03 -04:00
Commit Graph

3440 Commits

Author SHA1 Message Date
Dan McGee
c86ff120c8 Improve splitname memory allocation
We don't need to create a temporary copy of the string if we are smart with
our pointer manipulation and string copying. This saves a bunch of string
duplication during database parsing, both local and sync.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
01c8f39ab8 Improve depends string parsing
Remove the need for an unconditional string duplication by using pointer
arithmetic instead, and strndup() instead of an unspecified-length strdup().
This should reduce memory churn a fair amount as this is called pretty
frequently during database loads.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
aff3e63c45 Add strndup fallback function to libalpm util
The same fallback we are currently using in the pacman frontend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
b40c8e2922 Update valgrind suppressions file
We haven't tweaked this in a while, but some of the old stuff seems to no
longer be necessary and there are a few new things we should add.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:18 -06:00
Dan McGee
c49f198042 Add a pactest for the situation in FS#7524
Confirming the current behavior. And yes, the error message is still no
better than it was when this was reported 3.5 years ago.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:07:12 -06:00
Dan McGee
f65edb7f29 Fix integrity check status when installing from file
When installing packages from a file, the integrity check count
stays at (0/x) complete.  This ensures it is bumped to (x/x) at
the end of the process.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-18 13:19:25 -06:00
Dan McGee
a88cb03a58 makepkg: perform all sanity checks before erroring out
It is pretty annoying to get one, fix it, and then get another. We should be
able to continue on through most of the sanity checks in one go so the user
gets all the error messages at once.

Also ensure $pkgbase is defined by the time we call this function;
previously we printed nothing where a package name should have been due to
this oversight.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-14 00:25:16 -06:00
Dan McGee
665528d7ba repo-add: fix misguided conditional correction
I tried to move things around here when testing and did a bit too much; the
warning message always showed regardless of delta inclusion in the call. Fix
it so we only warn if we have a filename, but the file couldn't be located.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-13 23:43:58 -06:00
Dan McGee
5615b71688 Merge branch 'maint'
Conflicts:
	lib/libalpm/be_files.c
2011-01-12 09:23:24 -06:00
Dan McGee
30f53cfe8d Fix double read issue in maint releases
This is essentially a backport/cherry-pick of commit 33240e87b9 from
master, but has to be done by hand because the DB format has diverged. Read
more in the commit message used there, which follows.

Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-12 09:17:22 -06:00
Dan McGee
cae2bdafec pactest: build the filelist using a set()
This will prevent duplicates, which we had plenty of once I made a few tests
that had a list of files greater than the normal two. The previous logic was
not working quite right.

Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 0d4dd09993)
2011-01-12 09:11:10 -06:00
Dan McGee
8e30a46adb Make debug config messages consistent in capitalization
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 23:16:52 -06:00
Dan McGee
9e8af82c97 Back out anticipated epoch changes
After all the debate as to what to do on maint, we are going to end up just
incorporating epoch into the version string, so we don't need this separate
field at all. Revert commit 5c8083baa4 and also kill the force flag we were
recording here as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 23:15:44 -06:00
Dan McGee
dd26592155 Merge branch 'diskspace-fixes' 2011-01-11 21:20:12 -06:00
Dan McGee
57c5afd69c Merge branch 'fix-double-load' 2011-01-11 21:20:10 -06:00
Dan McGee
0284cf2128 Merge branch 'repo-add-improvements' 2011-01-11 21:20:07 -06:00
Dan McGee
33240e87b9 Fix double filelist issue when upgrading a package
Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

A debug log message was added to upgraderemove as well to match the one
already in the normal remove codepath.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:16:39 -06:00
Dan McGee
25fab402c7 Call archive_read_data_skip() while checking diskspace
libarchive eventually calls it anyway, but backtraces make a lot more sense
if we call it, as well as matching our precedent from alpm_pkg_load().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
6942bba75d Add error message stating which partition is full
This is helpful anyway to the user, and should also be helpful to us if we
see problems cropping up in the check during development.

Also add a missing ->used = 0 initialization in the code path less taken.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
55bff19b76 Unify two free diskspace error messages
Although they won't be the same in the gettext catalog because of the '\n'
we should still use the same text.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
fe6e90c21f Add a progressbar for package integrity checking
This can take a while too, and it is really easy to add the necessary
callback stuff for adding a progressbar.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:10 -06:00
Dan McGee
9a82cb92a4 Small fix to download size lookup and a logger
These were just two small things I came across today and found could be
fixed or helpful, so I've added them and I'm not sure what else to bundle
them with. commit_count++

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:04 -06:00
Dan McGee
d0c327df17 doc: add docs for repo-add -d option
This never got added when the option was brought in, so fix it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 20:30:27 -06:00
PyroPeter
eda4d9ec00 repo-add: Create/modify files databases
Implements FS#11302.

Dan: updated docs to not reference pkgfile.

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 20:30:27 -06:00
Dan McGee
b04a56dbe9 Add two pactests with non-trivial file counts
These are probably useful anyway, but also exposed the double file list bug
that will be fixed in a later commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 18:44:26 -06:00
Dan McGee
0d4dd09993 pactest: build the filelist using a set()
This will prevent duplicates, which we had plenty of once I made a few tests
that had a list of files greater than the normal two. The previous logic was
not working quite right.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 18:43:28 -06:00
Dan McGee
7ce90bb135 repo-add: use pushd/popd
Rather than explicit cd calls, we can use the directory stack to our
advantage. This also removes the need to store and restore $startdir, so
kill the variable entirely.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 17:18:46 -06:00
Dan McGee
a9cbd15260 pactest: correctly write epoch and force as necessary
We were missing this in a few places; also add the ability to check the
outcome via a new rule type.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:51:35 -06:00
Dan McGee
3e1bdfa93c Use double rather than float everywhere
No real need to use the smaller floating point types here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
5f140a62de Progress callback cleanups and fixes
* Remove a stale comment
* Fix a logic error- the conditional disagreed with the comments
* Remove some unnecessary floating point casts

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
842cbc9ea4 Ensure we use local package when calculating removed size
We were checking if a package existed locally, but then using the
incoming package to calculate removed size rather than the currently
installed package.

Also adjust the local variable in the replaces loop to make it more
clear that we are always dealing with local packages here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
d03b57f459 Remove need for floating point division in backend
All of these can be done with integer division; the only slightly
interesting part is ensuring we round up like before with calling the
ceil() function.

We can also remove the math library from requirements; now that the only
ceil() calls are gone, we don't need this anymore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:49:55 -06:00
Xavier Chantry
281a4c0a4f libalpm/be_package.c: fix small memleak
file_pkg_ops can be a static struct like in other backends, we just need
to initialize it at some point.

Dan: add initialization flag.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:27:39 -06:00
Dan McGee
62f5da3779 Fix some more simple conversion "errors"
None of these warn at the normal "-Wall -Werror" level, but casts do occur
that we are fine with. Make them explicit to silence some warnings when
using "-Wconversion".

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:15:47 -06:00
Allan McRae
f966f3a834 Use size_t for alpm_list sizes
There is a lot of swtiching between size_t and int for alpm_list sizes
in the codebase.   Start converting these to all be size_t by adjusting
the return type of alpm_list_count and fixing all additional warnings
given by -Wconversion that are generated by this change.

Dan: a few more small changes to ensure things compile, adjusting some
printf format string characters to accommodate the larger size on x86_64.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:15:46 -06:00
Dan McGee
4bc6ed56aa Refactor old date parsing into single method
We've managed to duplicate this four times at this point, so make it a
method in util.c instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 20:55:05 -06:00
Allan McRae
d288240426 Update copyright years for 2011
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 18:47:37 -06:00
Dan McGee
04dc87e012 vercmp: always return 0 if we perform a compare
And change the wording slightly to indicate we *print* a value, not *return*
it. You can't return negative values (they get coerced to 255), so it isn't
worth it to try and cram the result into the return code.

Acked-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 21:17:30 -06:00
Dan McGee
26652768d6 Remove FORCE reading from local DB
We never wrote it here, so no need to read it in either.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:56:06 -06:00
Dan McGee
46eda12c1b pactest: Use booleans where it makes sense
No need to use 0/1 when we can use False/True for the force option.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:55:57 -06:00
Dan McGee
e57c3efeaa pactest: remove dead function
Stopped being used after commit fa933df65b.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:55:13 -06:00
Dan McGee
c41edf49be Fix function indentation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-02 12:25:33 -06:00
Dan McGee
08d885fda5 Merge branch 'maint'
Conflicts:
	lib/libalpm/sync.c
	test/pacman/tests/ignore007.py
2010-12-30 09:41:46 -06:00
Allan McRae
351250adb4 Declare all local functions static
All functions that are limited to the local translation unit are
declared static.  This exposed that the _pkg_get_deltas declaration
in be_local.c was being satified by the function in packages.c which
when declared static caused linker failures.

Fixes all warnings with -Wmissing-{declarations,prototypes}.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:39:23 -06:00
Jakob Gruber
6ddc115c7f Respect Ignore{Pkg,Group} for group members
Fixes FS#19854.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:35:03 -06:00
Jakob Gruber
df360b791d Move group code to separate function
This makes the following commits more readable.
No logic was changed in this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:35:03 -06:00
Jakob Gruber
58ee249c86 Tests: Sync group which includes ignored pkgs
* FS#19854 (--ignore is ignored with groups)

* http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html
  (operation aborts when a package from a group is ignored/and user chooses
  not to install it)

If a group member is ignored, we expect
a) a question whether to install
b) after saying 'no' to a), the ignored member not to be installed
c) all other group members to be installed
d) pacman to execute successfully

Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 9d0b33fd33)
2010-12-30 09:35:03 -06:00
Jakob Gruber
cb7ba4e4e5 Add const to some ALPM function signatures
char * -> const char *.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:25:16 -06:00
Dan McGee
e0d327462c doc: add website zip to clean files
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 20:06:40 -06:00
Dan McGee
619c165d36 Merge branch 'maint' 2010-12-29 19:28:46 -06:00