Commit Graph

57 Commits

Author SHA1 Message Date
Dan McGee 0c4f7d821c Fix broken or missing includes
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-22 23:37:38 -05:00
Nathan Jones f5b77eb989 Add download size to target list.
This displays the download size, taking into account delta files and
cached files.

This closes FS#4182.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:30:06 -05:00
Dan McGee 619bf56e66 Remove rounding on package size totals
We print the total to two decimal places, so there is no real need for
rounding of the values. Remove the rounding and switch all output to two
decimal places.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-16 08:41:37 -05:00
Chantry Xavier 98bcd1f5b1 Fix -Sy and -Sp operations.
When the -Sy operation failed, the lock wasn't removed because
alpm_trans_release wasn't called. This is fixed now.

Also, after my last change in commit 52e7e6d747 ,
Sp didn't do anything anymore.
That's because needs_transaction returned false for -Sp, so the sync transaction
wasn't run. However, the current implementation of -Sp requires a sync transaction.

Also, since a transaction creates the lock file at the beginning, and releases it
at the end, this mean that -Sp requires root access anyway..

I think I understand now why Aaron found that the current -Sp implementation is hackish :)

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-04 18:13:09 -05:00
Chantry Xavier 52e7e6d747 needs_transaction adjustments
I just moved the root path check out of needs_transaction, and put it directly
in pacman.c . I think this part is alright.

For the other problems, I thought about doing the transaction first, in a new
sync trans function, which will init and release a transaction.  And then doing
the commands like -Ss / -Sl / -Sg / -Si.

The problem is that for commands like -Sys / -Syl / etc, only the refresh part
of the transaction should be done.  So I had to introduce an ugly sync_only
hack.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-03 21:02:36 -05:00
Aaron Griffin 4942d21632 Break out transaction test to a separate function
Added needs_transaction, putting out "hey do we need root?" tests in one place.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Dan McGee 9cceb3d9c4 Add a few missing includes, caught while compiling on cygwin
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-06 19:03:38 -05:00
Dan McGee 5c9eec5570 libalpm: add newlines to all strings passed to log callback
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>
2007-08-23 22:26:55 -04: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
Sergej Pupykin 1646fcc5bd Use mbstowcs instead of strlen where applicable
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10 23:36:15 -04:00
Dan McGee d317acaee8 Add a series of pm_printf functions to pacman frontend
Add pm_printf, pm_fprintf, and pm_vfprintf to the pacman frontend for use by
debug printing and other output messages from pacman. These will be
incorporated into the log callback functions in the next iteration of
changes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 12:57:49 -04:00
Dan McGee f7912e9dc6 Const correctness!
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>
2007-06-05 17:34:33 -04:00
Dan McGee 358cc5804a Rip alpm_parse_config out of libalpm
Switch over to the new frontend parseconfig.

* Fix a few issues in parseconfig
* Remove unused callback upon database registration
* Remove conf file related errors from error.c/alpm.h

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 23:10:49 -04:00
Dan McGee 65662315b6 Add a parseconfig to the pacman frontend that compiles
Warning: this compiles but may not work as intended quite yet. :)

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 23:10:49 -04:00
Nathan Jones 80237630af Change -z|--showsize flag to ShowSize pacman.conf option
Also cleaned up some duplicate printf lines related to the ShowSize option.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-01 11:00:39 -04:00
Dan McGee 7bd2ff6851 Move DB and cache dirs away from there dependence on ROOTDIR
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>
2007-05-31 02:51:28 -04:00
Dan McGee 2bcecbd62c Remove unnecessary casts on malloc and elsewhere
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>
2007-05-14 03:16:55 -04:00
Nathan Jones 5c930c318e Display size for packages
This patch adds a -z|--showsize option to the -Q and -S commands. The
option displays the size of individual packages. This is something that
I have wanted for a while, and there is a feature request for it.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14 01:22:15 -04:00
Dan McGee 63588aff19 Remove output.c and output.h
One function was left in this set of files after the earlier cleansing, so
I moved yesno to util.c.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 19:20:46 -04:00
Dan McGee b39aba99f9 Start of the newline fixes after switching over the output
* A few quick newline fixes, mostly related to sync operations.
* Moved get_update_timediff to callback.c as it is not used outside of
  that file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 19:03:24 -04:00
Dan McGee 961be77c93 Remove MSG output macro (#define and in code)
This is the first step of converting output to standard functions such as printf, and
eventually allowing compiliation with the -pedantic flag as is done on the libalpm
side.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 15:28:54 -04:00
Dan McGee f0304168ee Move log.c/h -> output.c/h to properly reflect what is contained
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 14:34:47 -04:00
Dan McGee dc05cd107c Pacman side code consolidation- unify callback functions to one file
Some more major code reorginization here. The download progress callback
function has been renamed and moved to callback.c, which is the former
trans.c with the download and log callbacks added. In addition, this allows
util.c to be cleaned up as fill_progress can now be static in callback.c.
We've also cut two more source files out.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 14:34:41 -04:00
Dan McGee 97313ba316 More pacman side cleanup
* Cleaned up more of the header #includes, and got rid of a lot of stuff
  that was due to trying to make it compile on BSD/Darwin/CYGWIN. We can
  add it later but lets keep it simple for now and do it in seperate files
  if possible later.
* Removed a lot of #define MACROS. Some were not even used, and others were
  only used a few times.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 14:34:41 -04:00
Dan McGee 7760f5fe60 Remove more unnecessary stuff
* Remove libintl.h from most files, as we only need to include it once in
  util.h where _() is defined.
* Remove other unnecessary header inclusions.
* Remove a macro that was only used once and replaced it with actual code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-25 11:07:48 -04:00
Dan McGee 6e05ad1d24 * Resizing terminal while progress bars were displayed caused some weird
issues, this should fix it. Progress bars now go from displaying, to showing
  percent only, to not displaying at all. Changed unsigned -> signed to
  prevent wraparound errors in integer comparison.
2007-03-13 16:15:38 +00:00
Dan McGee 869e81e1cf This commit looks much more monumental than it is. Almost all just #include
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.
2007-03-05 22:13:33 +00:00
Aaron Griffin 4dd6c92228 * pacman hidden arguments: removed -Y and -D. -T is the only hidden arg now, to
be used in place of -Y.  Also, -D was rather silly, as it does mostly what -S
  does.
* Cleaned up pacman_deptest - removed the goofy faketarget stuff (NEEDS testing
  still)
* libalpm function renames
2007-02-26 08:43:02 +00:00
Aaron Griffin a382d33d45 Cleaned up some more output
* Questions no longer start with "error:"
* downloaded size is output as a float now
2007-02-10 09:34:59 +00:00
Dan McGee b67e10d6b3 * Hopefully fixed the download progres bar for real. We should no longer
have issues with crazy speeds being displayed.
* Minor string updates to remove unnecessary 1-off translations.
2007-02-08 20:44:47 +00:00
Aaron Griffin 63000584b6 Implemented a crappy version of -Qu (query upgrades). This simply outputs the
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();
2007-02-04 08:26:52 +00:00
Aaron Griffin e3c7e92f10 * unified the progress bars (fill_progress function)
* fixed progress output (needs an fflush to move cursor properly)
* broke display_targets function out, to display a list of syncpkgs in
  preparation for a -Qu option
* added get_update_time function to deal with progress functions that shouldn't
  update too fast due to output redraw speeds
2007-02-04 01:36:45 +00:00
Dan McGee cdaed9221d * Tried to clean up newline display a bit in the frontend.
* Removed useless buildstring function from util.h; replaced all calls of it
  with list_display.
* Made list_display output 2 spaces instead of 1 between each item.
2007-02-01 06:35:30 +00:00
Aaron Griffin e22336673a Dan McGee <dpmcgee@gmail.com>
* Lots of code cleanup, and type fixes
* Make 'makeworld' a bit more in-line with the other stuff
* Make -Si and -Qi operations appear the same
2007-01-26 02:13:16 +00:00
Aaron Griffin 7f465320e4 Cleanup 'neednl' usage - make it static 2007-01-24 16:57:19 +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 86b136bb59 Dan McGee <dpmcgee@gmail.com>
* Removed some unnecessary headers and library links
* Made things static if possible
* Cleaned up makefiles a bit
* Fixed some old comments in the code
* Fixed some errors the static code checker splint pointed out
* Backwards arguments in a memset call in _alpm_db_read (could have been worse)
* Other various small fixes

Other:
* Default to 80 columns when getcols cannot determine display width
* Removal of ._install as a valid install file in packages
2007-01-18 16:52:57 +00:00
Aaron Griffin d59585c24f Column fix when stdout is redirected. Default to 80. 2006-12-28 17:20:41 +00:00
Aaron Griffin 5469177183 Removed global maxcols - it is looked up on the fly now, so the progress bar is
resized.  Also used ioctl in place of the COLUMNS env variable
2006-11-22 04:53:10 +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 3f27542156 Merged frugalware changes. Added a few other minor things too, but there's alot
to list.  The diff should show you 8)
2006-10-15 19:34:52 +00:00
Judd Vinet bb787e26ee first stage of i18n stuff from VMiklos 2006-05-15 02:19:57 +00:00
Aurelien Foret 039e6d9ee4 - removed pacman.h
- removed unuseful extern declarations
- set pacman.c internal functions as static
2006-03-13 20:34:47 +00:00
Aurelien Foret 07e46d2fc0 better use ERR than fprintf for error messages 2006-02-14 18:30:23 +00:00
Aurelien Foret 633c89b532 - moved yesno() from util.c to log.c
- fixed a missing line feed in yesno when printing the message
2006-02-04 10:34:27 +00:00
Aurelien Foret cdc97dd6f2 added line feeds when needed (patch from VMiklos <vmiklos@frugalware.org>) 2006-02-01 18:20:13 +00:00
Aurelien Foret fce68beaaf code cleanup 2006-01-07 18:11:37 +00:00
Aurelien Foret f3a4197e34 code cleanup (mainly removed line spaces at the beginning of lines by tabulations) 2006-01-07 09:42:48 +00:00
Judd Vinet 96de3501ab patch from VMiklos - use PACKAGE_VERSION instead of PACMAN_VERSION 2006-01-02 19:55:35 +00:00
Judd Vinet 953e7e5d3e VMiklos: --noconfirm fix 2005-12-20 23:58:27 +00:00