Any real call of this function doesn't specify a name or version ahead of
time, so just kill that functionality off. Now to remove those dummy
packages...
Signed-off-by: Dan McGee <dan@archlinux.org>
If we have a package without name and/or version, we are really out of luck.
Speed these functions up by removing unnecessary code. Note that both the
splitname and pkg_load functions, where the name and version of packages are
initially populated for databases and pkg.tar.gz files respectively, enforce
that every new package struct created has a name and version.
Signed-off-by: Dan McGee <dan@archlinux.org>
Commit 0460038447 caused a regression when
rereading the pkgcache after updating the on-disk databases. A rewinddir
call was errantly removed.
Instead of replacing the call to rewindir, clean up this whole mess.
db_scan is used only once and with target == NULL so there was actually half
the code of db_scan which was unused. This is gone now and replaced by a
single new db_populate function.
Dan: add_sorted ended up being 3x slower than one msort at the end, so I
changed back to that. I also made one pointer variable const and merged this
whole patch with my original fix for the rewinddir issue.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This has been around since at least pacman 2.9.8. Frugalware just dumped it
in commit 113ec73bfcfdc, and deleting it here and running pactest shows that
nothing that we have actually tested changes. If someone can pactest the
edge case where this is needed, then show me the money.
Signed-off-by: Dan McGee <dan@archlinux.org>
This patch offers a way to fix FS#9228.
By putting "SyncFirst = pacman" in pacman.conf, the version check will
happen before the transaction really starts, and before any replacements is
made.
Otherwise, no version check is done.
The sync301 pactest was updated to use this SyncFirst option.
Example session with SyncFirst = pacman, and a newer pacman version
available :
$ pacman -Su (or pacman -S <any targets>)
:: the following packages should be upgraded first :
pacman
:: Do you want to cancel the current operation
:: and upgrade these packages now? [Y/n]
resolving dependencies...
looking for inter-conflicts...
Targets: pacman-x.y.z-t
Total Download Size: x.xx MB
Total Installed Size: x.xx MB
Proceed with installation? [Y/n] n
As Nagy previously noted, doing this check on any -S operations might look
intrusive, but it can be required.
For example, the case where you want to install a package with versioned
provisions, using a pacman version which didn't support that feature yet
(and there is already a newer pacman in sync db supporting it).
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
* remove obsolete and unused *_cmp helper functions like deppkg_cmp and
_alpm_grp_cmp
* new alpm_list_remove_str function, used 6 times in handle.c
* remove _alpm_prov_cmp / _alpm_db_whatprovides and replace them by
a more general alpm_find_pkg_satisfiers with a cleaner implementation.
before: alpm_db_whatprovides(db, targ)
after: alpm_find_pkg_satisfiers(alpm_db_getpkgcache(db), targ)
* remove satisfycmp and replace alpm_list_find + satisfycmp usage by
_alpm_find_dep_satisfiers.
before : alpm_list_find(_alpm_db_get_pkgcache(db), dep, satisfycmp)
after : _alpm_find_dep_satisfiers(_alpm_db_get_pkgcache(db), dep)
* remove _alpm_pkgname_pkg_cmp, which was used with alpm_list_remove, and
use _alpm_pkg_find + alpm_list_remove with _alpm_pkg_cmp instead.
This commit actually get rids of all complicated and asymmetric _cmp
functions. I first thought these functions were worth it, be caused it
allowed us to reuse list_find and list_remove. But this was at the detriment
of the clarity and also the ease of use of these functions, dangerous
because of their asymmetricity.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Now the syntax is coherent with alpm_list_find and alpm_sync_find.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
alpm_pkg_load() and parse_descfile() are specific to getting information
from package files, just as other code is specific to getting information
into or out of a package database. Move this code out of package.c, which
should eventually only contain operators on the pmpkg_t struct that do not
depend at all on where the data came from.
Signed-off-by: Dan McGee <dan@archlinux.org>
We have some useless abstractions like an alpm_db_rewind function. I've read
somewhere that readdir() was the worst filesystem function call invented,
and what do we do? Add a wrapper around it. Kill this abstraction and move
some other things into be_files that should be there anyway because they
are so tied to how a files backend works.
Signed-off-by: Dan McGee <dan@archlinux.org>
Tested using many easily generated error conditions. Also added "malloc
failure" (conf.c) and "segmentation fault" (pacman.c) error messages for
translation.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: fix trailing whitespace errors, other compilation issues]
Signed-off-by: Dan McGee <dan@archlinux.org>
It was unclear what "loading the full package" actually did. The
detailed description should clear that up, without having to look at the
code.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The paclist script provides a simple method for monitoring which packages
are installed from a given repo. This is particularly useful when using a
testing or unstable repository.
Thanks to Allan McRae for the idea and an initial bash script. As suggested
by Dan, I tried to rewrite in perl, and this resulted in much better
performance. Then Dan further cleaned up the script.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: add to Makefile & README, minor script cleanups]
Signed-off-by: Dan McGee <dan@archlinux.org>
This rewrite in perl blows the socks off the old shell script version for
large searches:
$ time ./pacsearch.perl ^.*$ >/dev/null
real 0m0.836s
user 0m0.593s
sys 0m0.217s
$ time pacsearch.sh ^.*$ >/dev/null
real 1m53.818s
user 1m16.818s
sys 0m33.694s
Functionality and output is identical to the old version with the exception
of the old version's missing EOL after all the output. It should be a lot
easier to add new things like the --color flag that has been a TODO at the
top of the script for a long time.
Signed-off-by: Dan McGee <dan@archlinux.org>
The start of a few commits to remove some PATH_MAX usage from our code. Use
a dynamically allocated string instead.
Signed-off-by: Dan McGee <dan@archlinux.org>
They are pretty noisy scripts in their normal course of operations, so allow
all messages to be squashed except for warning and error messages with this
new flag.
Signed-off-by: Dan McGee <dan@archlinux.org>
I've always found it odd why the package version is shown at the start but
not the end of the package build. Fix it, and while we are at it, add the
$CARCH variable to the display too.
Signed-off-by: Dan McGee <dan@archlinux.org>
We only need a copy of this string once we know we are going to extract it,
and we don't need a static buffer to copy it into since it is coming from a
known-length string.
Signed-off-by: Dan McGee <dan@archlinux.org>
XySSL 0.9 was released; sync our code with the upstream source. Note that
there weren't any real changes besides renaming of macros, so nothing much
to see here.
The biggest change may be the licence- it is now GPL/BSD software rather
than LGPL/BSD. The license header is changed to reflect this.
Signed-off-by: Dan McGee <dan@archlinux.org>
From http://www.stack.nl/~dimitri/doxygen/config.html#cfg_javadoc_autobrief
JAVADOC_AUTOBRIEF
If the JAVADOC_AUTOBRIEF is set to YES then doxygen will interpret the
first line (until the first dot) of a JavaDoc-style comment as the brief
description. If set to NO (the default), the Javadoc-style will behave just
like regular Qt-style comments (thus requiring an explicit @brief command
for a brief description.)
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
It is hard to decipher what the transaction events actually notify you
of, and what parameters are passed to the callback function, without
looking at the code. This patch adds documentation for the _pmtransevt_t
enum in order to clarify what the event is for and what data is passed
when the callback is called.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Rework to use a single #define for the buffsize, and in the process clean up
some other code and double the default buffer size.
Signed-off-by: Dan McGee <dan@archlinux.org>
We were a bit juryrigged using one call to mkstemp() before rather than
extracting the new files side-by-side and doing our comparisons there. We
were also facing some permissions issues. Instead, make our life easier by
extracting all temp files to a '.paccheck' extension, doing our md5
comparisons, and then taking the correct actions.
Still to be done here- a cleanup of the use of PATH_MAX which should not be
necessary if we use dynamic allocation on the heap.
Signed-off-by: Dan McGee <dan@archlinux.org>
This should allow some future tests to set modes and ensure they are set
after installation. It is also in anticipation of a test for checking
permissions on pacnew files.
Signed-off-by: Dan McGee <dan@archlinux.org>
I'm not sure why these were ever here, as by this point we have already
extracted the file meaning a call to this function is basically a no-op.
Signed-off-by: Dan McGee <dan@archlinux.org>
Inside tidy_install, change the section which strips libraries to use find |
while read rather than for foo in `find`. This should allow whitespaces in
filenames to still be processed correctly.
This fixes FS#10294.
Signed-off-by: Daenyth Blank <Daenyth+git@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
We removed one too many FREELIST() calls when trying to fix some memleaks,
and add a safety/sanity check to ensure filename is set, as packages in old
DBs are likely to not have this field.
Signed-off-by: Dan McGee <dan@archlinux.org>
Reference : FS#9547.
The get_filename function first tries to get the filename field from the
database, and if it doesn't find it, it tries to guess it based on the name,
version and arch.
This field was introduced in 3.0, but there are still many old entries in
the official databases without it. So the databases need to be regenerated
first before this patch can be applied.
There is a second problem with the delta code, which needs the filename for
locally installed packages too, but this field is not present in the local
db. So the delta code needs to be fixed first.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
As Nathan noticed, the new informations in the delta struct allows us to
get rid of this list :
http://www.archlinux.org/pipermail/pacman-dev/2008-February/011163.html
So I rewrote apply_deltas for that. The previous apply_deltas also had a
limitation: it assumed that the initial package and the deltas were in the
first cache dir, which is not necessarily the case. That situation is
supported now.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Using the graph structures that Nagy set up for dependency sorting, we now
do a similar process for deltas. Load up all of the deltas into a graph
object on which we can then apply Dijkstra's algorithm, using the new weight
field of graph struct.
We initialize the nodes weight using the base files that we can use in our
filecache (both filename and md5sum must match). The algorithm then picks
the best path among those that can be resolved.
Note that this algorithm has a few advantages over the old one:
1. It is completely file agnostic. These delta chains do not have to consist
of package files- this could be adopted to do delta-fied DBs.
2. It does not use the local_db anymore, or even care if a package or file
is currently installed. Instead, it only looks in the filecache for files
and packages that match delta chain entries.
Original-work-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Start to move the delta struct away from an assumed package name scheme and
towards something that is package (or even filename) agnostic. This will
allow us much greater flexibility in the usage of deltas (maybe even sync
DBs some day) as well as allowing code outside of delta.h/delta.c to be much
cleaner with less of a need for snprintf() calls.
Signed-off-by: Dan McGee <dan@archlinux.org>
The calls to alpm_trans_init and alpm_trans_release (+ error checking) were
duplicated between remove.c, sync.c and upgrade.c
This patch introduces trans_init and trans_release functions in util.c to
have this code just once.
So instead of having to do the same change 3 times for fixing FS#10273, I
just had to do it once (so I did it too :))
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
In the can_remove_package function, we don't need to compute the whole
requiredby list, we just need to find one member of it that doesn't belong
to the targets list.
That way we get a small speedup and remove the only usage of
alpm_pkg_compute_requiredby in the backend, so that it can be tweaked for
frontend usage.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This should remove the need for any additional patching to run on platforms
that have libfetch available but not libdownload. It isn't the prettiest,
but we have kept our libdownload impact down to just a few files, so it can
be easily done.
Signed-off-by: Dan McGee <dan@archlinux.org>
free() is designed to do nothing if it is passed a NULL pointer, so there is
no need to check for it on our end. Change/fix the macro.
Signed-off-by: Dan McGee <dan@archlinux.org>
Previously, tar was called manually with os.system. This caused one fork per
package/db creation, which is costly, especially on cygwin. Besides, it also
caused some problems with directory with whitespaces (that could also be
fixed with quotes, but well..)
Using tarfile module is cleaner and more efficient, and still easy enough.
Benchmark (time make check) :
- windows / cygwin
prepatch:
real 6m36.360s
user 2m28.914s
sys 2m35.866s
postpatch:
real 5m25.428s
user 1m26.029s
sys 2m0.006s
- linux
prepatch:
real 1m22.629s
user 0m31.498s
sys 0m18.899s
postpatch:
real 1m11.465s
user 0m26.382s
sys 0m12.986s
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Darwin's binary format does support symbols with differing visibilities, but
it does not support the protected or internal visibilities- only hidden. For
Darwin only, we should fall back to this visibility to prevent warnings from
the compiler and because it is close enough for our library purposes.
See http://gcc.gnu.org/viewcvs/*checkout*/trunk/gcc/config/darwin.c, search
for the "darwin_assemble_visibility" function for more details.
Also add pacman.static.exe to gitignore.
Signed-off-by: Dan McGee <dan@archlinux.org>
Linux includes all the gettext stuff in glibc, so there is no need for the
libintl links which we failed to include in our linker variables. Update the
makefiles which should enable NLS support on all platforms, including OS X
and Cygwin.
Signed-off-by: Dan McGee <dan@archlinux.org>
Things must have gotten stricter with GCC 4.3 on the '%zd' printf string and
this is the first I've tried to compile there. Fix the problem by using
size_t instead of int.
Signed-off-by: Dan McGee <dan@archlinux.org>