Commit Graph

60 Commits

Author SHA1 Message Date
Ivy Foster fa06951d90 Represent bitfields as ints, not enums
Many bitfield variables are declared to be enums, because they are
generated using bitwise operations on enums such. However, their
actual values aren't necessary members of their parent enum, so
declaring them 'int' is more accurate.

Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22 20:50:55 +10:00
Ivy Foster 0d2ba870c9 Do not #define _RESERVED_IDENTIFIERS
Signed-off-by: Ivy Foster <ivy.foster@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25 18:04:57 +10:00
Allan McRae 4742f5929d Update copyright years for 2016
make update-copyright OLD=2015 NEW=2016

Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04 13:27:08 +10:00
Allan McRae 2e48101999 Update copyright notices for 2015
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01 21:19:04 +10:00
Florian Pritz cd2370754a Remove ts and sw from vim modeline when noet is set
Forcing vim users to view files with a tabstop of 2 seems really
unnecessary when noet is set. I find it much easier to read code with
ts=4 and I dislike having to override the modeline by hand.

Command run:
find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} +

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28 20:19:25 +10:00
Allan McRae 3bb3b1555a Update copyright years for 2014
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06 14:38:50 +10:00
Allan McRae 1dd3405813 Update copyright year for 2013
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03 12:03:09 +10:00
Allan McRae 326c6a8eed Update copyright years
Add 2012 to the copyright range for all libalpm and pacman source files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-20 16:54:34 -06:00
Dan McGee 73139ccb3c Refactor _alpm_runscriptlet()
Add an is_archive parameter to reduce the amount of black magic going
on. Rework to use fewer PATH_MAX sized local variables, and simplify
some of the logic where appropriate in both this function and in the
callers where duplicate calls can be replaced by some conditional
parameter code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30 10:55:58 -05:00
Dan McGee 40a264478e Track unresolvable transaction packages
Rather than free them right away, keep the list on the transaction as
we already do with add and remove lists. This is necessary because we
may be manipulating pointers the frontend needs to refer to packages,
and we are breaking our contract as stated in the alpm_add_pkg()
documentation of only freeing packages at the end of a transaction.

This fixes an issue found when refactoring the package list display
code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28 04:52:37 -05:00
Dan McGee 37da18aee8 Move all callbacks up to the handle level
This was just disgusting before, unnecessary to limit these to only
usage in a transaction. Still a lot of more room for cleanup but we'll
start by attaching them to the handle rather than the transaction we may
or may not even want to use these callbacks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-02 21:45:03 -05:00
Dan McGee 6aa9fdce5a Remove trans is NULL check in QUESTION/EVENT/PROGRESS macros
trans cannot (and better not) be NULL at any point when these are being
called.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-25 16:12:33 -05:00
Allan McRae 925f42e460 Rename pmtransstate_t to alpm_transstate_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae 590a8fcb1e Rename pmtransflag_t to alpm_transflag_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:28:24 +10:00
Allan McRae 6b62508c86 Rename pmtrans_t to alpm_trans_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:27:16 +10:00
Allan McRae 8a04bc25a1 Rename pmpkg_t to alpm_pkg_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 23:26:39 +10:00
Allan McRae 64c1cf7921 Rename pmhandle_t to alpm_handle_t
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28 14:04:00 +10:00
Dan McGee e2aa952689 Move pm_errno onto the handle
This involves some serious changes and a very messy diff, unfortunately.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-13 19:38:38 -05:00
Dan McGee 7fc635fee0 Remove global handle from util.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-03 12:33:18 -05:00
Dan McGee 6735807c0f Remove trans->skip_add
This is old code that has since gone stale; we no longer ever add
anything to this list so no need to keep it around and check the
contents during extraction.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-22 16:48:51 -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 a36ff9404b Bump copyright dates to 2010
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:46:59 -05:00
Xavier Chantry 8ff3b87066 Remove transaction type
This basically started with this change :

 /* Transaction */
 struct __pmtrans_t {
-       pmtranstype_t type;
        pmtransflag_t flags;
        pmtransstate_t state;
-       alpm_list_t *packages;      /* list of (pmpkg_t *) */
+       alpm_list_t *add;      /* list of (pmpkg_t *) */
+       alpm_list_t *remove;      /* list of (pmpkg_t *) */

And then I have to modify all the code accordingly.
2009-09-08 22:17:41 -05:00
Dan McGee c72b4543b6 Update copyright headers and messages
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 02:08:33 -05:00
Nagy Gabor aefb4e0fa5 Remove pmsyncpkg_t
pmsyncpkg_t data sructure was removed:
1. pmpkg_t.reason is used instead of pmsyncpkg_t.newreason. (The target
packages come from sync repos, so we can use this field without any
problems. Upgrade transaction also uses this field to store this info.)
2. pmsyncpkg_t.removes was moved to pmpkg_t.removes.
This step requires careful programming, because we don't duplicate packages
when we add them to trans->packages. So we modify sync pkgcache when we
add this transaction-only info to our package. Hence it is important to
free this list when we remove any package from the target list
(remove_unresolvable, remove_conflicts, trans_free), otherwise this could
confuse the new sync transactions (with non-pacman GUI).

Overall, our code became ~100 line shorter, and we can call our helper
functions directly on trans->packages in sync.c, we don't need to maintain
parallel package lists.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:05:13 -05:00
Nagy Gabor 314b4462d2 -Qu rework
From now on -Qu is an "outdated package" filter on local database.
(This is a behaviour change.)

This patch fixes some memleaks and makes the code cleaner, for details see
my comment on FS#7884.

FS#11868 is implemented.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Nagy Gabor d060e31be3 Remove trans->targets
Its implementation was quite broken:
* add_loadtarget() might have silently filtered out some targets when
  replacing an older version.
* This was used in sync.c to determine whether a target is implicit or not,
  which is incorrect behavior. Before this patch we silently removed user
  confirmed replacements; now we always warn on a replacement.
* remove001.py behavior was quite odd in adding same target 5 times to the
  target list, we can change this behavior to be a failure.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xav: changed remove001 pactest accordingly]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: rewrote commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-10 18:57:36 -05:00
Dan McGee 9781d0d637 Update GNU GPL boilerplate and copyright dates
Update the GPL boilerplate to direct people to the GNU website for a copy of
the license, as well as bump all of Judd's copyrights to 2007.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 22:55:39 -06:00
Dan McGee 2322909703 War on whitespace
Run the kernel's cleanfile script on all of our source files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16 20:18:45 -06:00
Dan McGee 7219326dd4 Remove REQUIREDBY usage from libalpm
Instead of using the often-busted REQUIREDBY entries in the pacman database,
compute them each time they are required. This should help many things:

1. Simplify the codebase
2. Prevent future database corruption
3. Ensure when we do use requiredby, it is always correct
4. Shrink the pmpkg_t memory overhead

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 18:49:50 -06:00
Dan McGee 006387828c Readd scriptlet logging that got lost in an earlier commit
I broke scriptlet logging with ad691001e2.
Readd more or less what was there before, although it still needs a lot of
work including hopefully rewriting it to a new event subsystem and having
it log to a seperate file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 11:27:41 -06:00
Dan McGee fc65a9bcb1 Fix some errors spit out by -Wextra
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16 16:19:06 -04:00
Dan McGee ed13ac2cc8 Remove freespace checking code
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>
2007-06-02 13:17:26 -04:00
Dan McGee 8bbb5dd078 libalpm util.c and util.h cleanup
* 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>
2007-04-29 12:47:02 -04:00
Dan McGee db9e10f142 Remove FREETRANS macro and correctly type _alpm_trans_free
Remove an unnecessary macro, and get rid of the void pointer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27 14:29:23 -04:00
Dan McGee 5baba84397 * Added missing header include guards in md5.h and sha1.h.
* Some header cleanup on the pacman side of things - we had alpm.h instead
  alpm_list.h in a few headers.
* removed an extra slash in path-building snprintf in server.c.
2007-03-06 01:21:41 +00:00
Dan McGee 03f034ef0e * Updated conflict checking one last time. You can finally have a file move
from one package to another seemlessly (knock on wood). This is implemented
  through the use of two skip lists in the trans struct- skip_add and
  skip_remove, which replace the former trans->skiplist.
* Removed an unnecessary function parameter, added a necessary one.
* If a package has no backup files, print '(none)' under the heading so it is
  more obvious.
* Updated my TODO list.
2007-02-20 02:14:27 +00:00
Aaron Griffin 119b3ab043 Moved the update_depends function to trans.c, as it depends on a transaction
object
2007-02-18 22:07:11 +00:00
Aaron Griffin 1b61cc8c69 This mainly deals with code clarity- removing currently unneeded
optimizations in order to make the code much more readable and
type-checkable. Every enum in the library now has it's own type that
should be used instead of the generic 'unsigned char'. In addition,
several #define statements dealing with constants were converted to
enums.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2007-01-24 03:02:53 +00:00
Aaron Griffin 6167017264 Preliminary checkin for alpm_list conversion
* renamed pmlist_t -> alpm_list_t
* made alpm_list_t a public type (alpm_list.h header)
* removed additional storage for registered DBs in pacman source
* some code cleanup
* removed duplicate (pm)list_display functions from pacman source
* misc code cleanup
2007-01-19 09:28:44 +00:00
Aaron Griffin aa1c0ba9f8 * repo-add script - to add entries to a db file directly from package data (no PKGBUILD)
* libalpm api changes - move from a _getinfo(p, WHAT_WE_WANT) scheme to a
  typesafe _get_what_we_want(p) scheme [not 100% complete yet]
* some const correctness changes
* removal of PM_* types in alpm.h in favor of the pm*_t types used throughout
  libalpm
2006-11-20 09:10:23 +00:00
Aaron Griffin 7131b7ac87 A handful of minor changes:
* Removed the PMList typedef, in favor of the same naming scheme other
      structs use 'pmlist_t'
    * Added a time stamp on debug output, to make it more informational
    * Moved alpm_db_register to _alpm_db_register, making the public function
      not take a callback parameter
2006-10-20 06:26:55 +00:00
Aaron Griffin d37ad04873 Merged frugalware changes (too many to list). Also added some config file
handling changes (support [sections] to carry over to included files - this
helps with backwards compatibility with existing pacman config files)
2006-10-15 19:31:03 +00:00
Judd Vinet 54008798ef Patch from FW: Better control over CTRL-C interruptions -- do not leave the DB in an inconsistent state 2006-07-14 23:15:07 +00:00
Judd Vinet 318e233cb3 spelling fix 2006-07-14 23:11:53 +00:00
Aurelien Foret 1bd8f57a18 - changed flags type from char to int
- downloadonly implies FLAG_NOCONFLICTS
2006-03-04 15:33:44 +00:00
Aurelien Foret 16ff7cfa8e improved _alpm_list_free handling 2006-02-22 20:49:33 +00:00
Aurelien Foret be39f49a54 prepend library function names with _alpm (helped with the patch from VMiklos <vmiklos@frugalware.org>)
added log and event callbacks to sync_commit internal transactions
2006-02-17 22:35:26 +00:00
Aurelien Foret 86e5c8bc06 sync_commit can now return conflicting files with a trans_prepare like data structure (patch from VMiklos <vmiklos@frugalware.org>) 2006-01-07 18:42:44 +00:00
Judd Vinet 96de3501ab patch from VMiklos - use PACKAGE_VERSION instead of PACMAN_VERSION 2006-01-02 19:55:35 +00:00