This allows us to remove the hack in the frontend where we added a newline
to everything coming out of the pm_printf functions, and instead let the
developer put newlines where they want them. This should be the last hangover
of that auto-newline stuff.
Signed-off-by: Dan McGee <dan@archlinux.org>
A bunch of changes related to my first "real" install of pacman-git into
/usr/local and trying to use it.
* Shift some uses of free -> FREE in libalpm.
* Move stat and sanity checks of config paths into libalpm from the
config and argument parsing in pacman.c.
* Fix issue where dbpath still was not defined early enough due to its
requirement for being used in alpm_db_register. This should be rewritten
so it doesn't have this dependency, but this will work for now.
Signed-off-by: Dan McGee <dan@archlinux.org>
In order to best resolve bug 6404, move some cachedir handling stuff out of
sync.c and into util.c and create two new functions: filecache_find and
filecache_setup. sync.c was rewritten to use these, and alpm_fetch_pkgurl
now also uses these routines.
Signed-off-by: Dan McGee <dan@archlinux.org>
In my opinion, a commiting transaction that failed isn't equivalent
to a prepared transaction.
Some things could have been done in the meantime.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Move alpm md5 functions to lib/libalpm/util.c
* Remove unneeded includes for md5.h
* Replace md5 implementation with one from http://www.xyssl.org
Dan: clean up XySSL code by removing parts we don't use, and add a note
saying what changed.
Dan: fix alpm_get_md5sum, off by one error on the malloc call and other
small things.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
There's no need for a second hashing algorithm. MD5 serves the purpose
of verifying that a package file hasn't been corrupted during download.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
We were using a void *data element in pmpkg_t before, which is unsafe by its
nature of being untyped. Reimplement data as origin_data being a union that
can hold either a path to a package file or a pointer to a cache database,
and make the other necesary updates in the code to reflect this. See package.h
for details.
Signed-off-by: Dan McGee <dan@archlinux.org>
I didn't like the patch proposed by Nagy for the sync1002 pactest here:
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008971.html
So here is another attempt of fixing it.
In case of the DEPENDSONLY flag :
1) pass an empty list to resolvedeps instead of the list of targets
2) empty the trans->packages targets list before adding the resolved deps.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This replaces the former -D operation that was undocumented and rather
hacky. It can be used with add, upgrade, or sync transactions and will affect
all packages installed. Should close FS #7193.
Also tell makepkg to use this new flag.
Signed-off-by: Dan McGee <dan@archlinux.org>
remove _alpm_ldconfig call from _alpm_sync_commit,
since sync operation causes an upgrade transaction,
where ldconfig is already run.
Reference:
http://www.archlinux.org/pipermail/pacman-dev/2007-April/008132.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove versioncmp.c by moving all functions to locations that make sense.
Move replacement functions (for building without glibc) into util.c where
they belong, and do proper checks for them instead of using __sun__, etc.
Signed-off-by: Dan McGee <dan@archlinux.org>
There is no real reason to burden our translators with these messages, as
anyone helping to debug these will probably want them in English.
Signed-off-by: Dan McGee <dan@archlinux.org>
We shouldn't translate log messages to pacman.log so it is consistant and
can be parsed by other tools. Remove all gettext _() around these strings.
Signed-off-by: Dan McGee <dan@archlinux.org>
This function is an absolute disaster, so we'll take it one step at a time
here. This was a quick once-over of the whole thing, trying to straighten
out some of the spaghetti code and fix some mistakes that others found.
We are now down to two failing pactests again: sync300 and upgrade051.
Signed-off-by: Dan McGee <dan@archlinux.org>
This should hopefully allow multiple cache dirs to be specified in
pacman.conf and/or on the command line, and allow pacman to test
each one for the package file. The first one found to be writeable is
used as the download cache.
Signed-off-by: Dan McGee <dan@archlinux.org>
Add some 'const' keywords all over the code to make it a bit more strict on
what you can and can't do with data. This is especially important when we
return pointers to the pacman frontend- ideally this would always be
untouchable data.
Signed-off-by: Dan McGee <dan@archlinux.org>
This code depends on /etc/mtab existance, which is not very reliable in all
cases, especially in a chroot or non-Linux environment. Dump it for now
until we can find a better way.
Signed-off-by: Dan McGee <dan@archlinux.org>
This change allows us to use all autoconf specified paths, most notably
$(localstatedir). It is quite a change and touches a lot of files, as
all references to the DB and cache were done with the ROOTDIR as a prefix.
* add --lock command-line option to pacman to specify the location of the
lockfile (this can now be specified at configure time by setting the
$localstatedir path).
* Rip quite a few settings out of configure.ac as they are now picked by
setting the paths during configure or make.
* Fix bug with /tmp fallback for sync downloads not working correctly
(related to root location, now the system tmp dir is used).
* Simplified the parameters to some libalpm functions, and added get/set
for the new lockfile option.
* Renamed several of the DEFS to names without the PM_ prefix.
Signed-off-by: Dan McGee <dan@archlinux.org>
We had many unnecessary casts, most of them dealing with malloc and
other memory allocations. The variable type should take care of it;
no need to do it explicitly. In addition, I caught a const error while
removing the casts.
Signed-off-by: Dan McGee <dan@archlinux.org>
Allow IgnorePkg (or --ignore) to work for _either_ side of a
replacement. For example, if 'foo' is set to replace 'bar',
ignoring either package will skip this replacement.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* Remove some unnecessary conditional compiling in util.h- move the
functions tha required it to trans.c (along with a bunch of new header
includes).
* Clean up util.h a bit- remove some header includes, remove universal
libarchive include and only put it in the files that need it.
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove inclusion of libintl.h from all files, because we can do it once
in util.c where the _() macro is defined.
Signed-off-by: Dan McGee <dan@archlinux.org>
* --ignore was being ignored (haha) on sysupgrade when a package was listed
as being a force upgrade. This adds a prompt to the user in this case asking
what to do.
Signed-off-by: Dan McGee <dan@archlinux.org>
* More significant error messages when -Qo fails
* Potential fix for reported error that pacman indicates corrupt packages
when space is full on the cache dir
reordering and adding ones that were forgotten (noticed when trying to
compile after reordering).
* Updated the HACKING file to include information on #include usage.
* print -> vprint in "making dir" function in pactest.
specified
* Use db->path when appropriate
* Commented out the FAKEROOT checks in libalpm. This should never ever be done.
TODO test this quite a bit, as this will never cause the transactions to fail
if RW operations are requested... right now it is totally up to the front end
to decide when to fail
* Use realpath() to canonicalize the root path when specified, so
_alpm_makepath() doesn't freak out
* Fixed some output/indent of MDFile and SHAFile algorithms
* More efficient sprintf() usage in MDFile/SHAFile
* Added real error output to _alpm_makepath
* Moved entirely to alpm_pkg_get_* accessors, to read data on demand
* Mostly removed the INFRQ_ parameters from outside the be_files backend (making
the backend more extensible in the long run)
* packages created from _alpm_db_scan now have the db and origin set (making
accessors actually work for these packages)
* removed _alpm_db_ensure_pkgcache
* totally revamped the _alpm_checkconflicts function, making it cleaner and
easier to read (and thus fix in the long run) - maintainable code ftw
NOTE: feel free to rename the functions... I couldn't think of anything better
* removed an extra loop in sync.c:find_replacements - no sense in looping over
an entire DB while strcmp'ing the name, when we have get_pkgfromcache
Other:
* package struct "license" -> "licenses"
* Created _alpm_sync_find (duplicate code in some places, find_pkginsync
* Minor const correctness changes along the way
* fixed a couple extra '/' pathing issues (non-issues really)
* removed a duplicate pkg_cmp function
allows for the same bit operators to be used across the board on pkg_get
operations.
* Changed name of INFRQ_NONE -> INFRQ_BASE to more clearly reflect what it
does (loads pkg name and version).
* Added a few missing things on package functions, such as SYMEXPORT and
ALPM_LOG_FUNC.
* Slight updates to pmenv to print 'pass' and 'fail' instead of 'passed' and
'failed'. Keeps output a bit more concise.
* Fixed a doxygen comment spelling error. :P
* Unified some functions names "package" -> "pkg" for consistency
* Removed the goofy 'faketarget' stuff used for dep testing
* Renamed alpm_pkg_isin -> alpm_pkg_find
* Renamed alpm_db_readpkg -> alpm_db_get_pkg
properly
* Error when re-reading the DB for replacements, wrong info level
* Removed an duplicate debug message "checking for package replacements"
* Check ignorepkg for REAL upgrades...
* Properly check the NOSAVE flag
* some unlink_file (remove.c) cleanup
* fix indent level on handle.c
* Force libalpm paths to end with a '/' char
* Fixed 'target' looping in conflict.c (pmsyncpkg_t, not pmpkg_t)
* Added some debug output to cache and db scanning
** All pactest tests succeed again, yay **
unbelievable amount of strcmp() calls (25 million) due to the list searching.
This has been reimplemented with a set-intersection scheme, due to the fact
that file lists are always ordered. - NEEDS TESTING
* Minor clean up, "globalized" the str_cmp helper to match the alpm comparison
signature, so we can use it elsewhere.
packages to be upgraded in a -Su operation. Much of the code is duplicated from
sync.c.
TODO: move the implementation to upgrades.c, and reimplement the sync_sysupgrade
function in terms of this:
trans->packages = alpm_get_upgrades();