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>
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>
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>
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>
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>
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>
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>
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>
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
* 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)