Commit Graph

516 Commits

Author SHA1 Message Date
Dan McGee 5e12d3dec9 Fix display of -Qip output when a package file is given
Too many fields were being shown on -Qip output, and sizes were not always
correct (-Qi and -Qip output on the same package did not agree).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13 00:09:45 -06:00
Dan McGee a0c908dd0d Remove 'Total Package Size'
Having 'Total Installed Size' and 'Total Download Size' makes this size
unnecessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 14:14:07 -06:00
Aaron Griffin 434ea5bf61 Typo fix (sepArately)
Found by Giovanni Scafora <linuxmania@gmail.com>

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-11 09:52:17 -06:00
Aaron Griffin cc15d29db2 Missing quote in output
Found by Giovanni Scafora <linuxmania@gmail.com>

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-11 09:52:07 -06:00
Dan McGee dd0275b759 Add a missing newline in sync confirmation output
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:51:09 -06:00
Dan McGee 6b98599953 pacman: remove leftover help string for -Rh
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:51:08 -06:00
Nathan Jones 8ec27835f4 Implement TotalDownload option.
Setting this option will change the download progress to show the amount
downloaded, download rate, ETA, and download percent of the entire
download list rather than per each individual file.

The progress bar is still based on the completion of the current file
regardless if the TotalDownload option is set.

This closes FS#7205.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:46:13 -06:00
Nathan Jones b206af78e0 Add TotalDownload option.
This will be used in the next commit.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:46:09 -06:00
Nathan Jones 3312de65e6 Implement IgnoreGroup.
This option acts as if IgnorePkg was set on each package in the group.

This closes FS#1592.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:44:30 -06:00
Nathan Jones 5c58b3d500 Add IgnoreGroup and --ignoregroup option.
This will be used in the next commit.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:44:26 -06:00
Dan McGee 7d51882dd0 Simplify callback DONE event handling
Move them all to a single fallthrough case statement since they all print
"done".

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08 23:41:05 -06:00
Dan McGee 4e45e1187d Add missing 'done' printout
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08 23:39:51 -06:00
Dan McGee e6673544b2 Fix some issues with localized dates/epoch usage
Commit 47622eef4d introduced localized times
in the metadata by way of storing the UNIX epoch value instead of a hard
coded date string. However, it missed a few things:
* If we weren't in the C/POSIX/en_US locale, the date parsing would fail
  as it tried to use the abbreviations of the locale being used. Fix this
  by switching the LC_TIME value before we parse a date.
* We used ctime to print the date value, which is always the C locale
  string. Instead, use strftime to print a localized date string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08 23:18:07 -06:00
Dan McGee 11f99e0685 Add LOGFILE as a define at compile time for pacman
It has always been a bit odd that logfile had to be specified in the config
file, but no other paths did. Add LOGFILE as a preprocessor definition, and
make a call to alpm_option_set_logfile() to set the default location so no
logfile parameter is necessary in pacman.conf.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-05 21:10:22 -06:00
Chantry Xavier 0686fec839 Remove the newline automatically added by alpm_logaction.
This way, _alpm_logaction behaves like _alpm_log, and gives more control.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-04 18:04:43 -06:00
Dan McGee 86ca39d15e Clean up usage of extern variables
Instead of declaring the extern variable in every *.c file, include it in
the header file that makes sense. This means handle.h for the handle, and
conf.h for the pacman side config object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 12:05:22 -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 e5be26fb23 Make building of pacman.static optional
Because building of pacman.static fails on some platforms, we should make
it optional. It is enabled by default but can be disabled with the use of
the --disable-pacman-static flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 10:42:08 -06:00
Dan McGee dea9b3bc0f Fix basename usage in pacman and utilities
basename() is a rather untrusty function call on a lot of platforms as it
does some weird and different things. To solve this, I added a mbasename
fuction to pacman to take its place, and simply removed its usage in the
utilities (it isn't worth dealing with there).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 09:50:43 -06:00
Dan McGee 0ea43089e1 Remove final use of the math library from pacman
To round a value, we don't need floorf- we can just cast to an int.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 09:49:30 -06:00
Dan McGee 6aeda5fbff When printing size_t, use %zd
%d was used, which worked for Linux and FreeBSD. Not so for Darwin. The
warning was probably spat out when compiling on x68_64 as well, but no
developers use this architecture as their primary one.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 23:32:58 -05:00
Dan McGee 6af7dbcf72 pacman/query.c: add missing free()
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 23:11:49 -05:00
Dan McGee 3e1b72f4f2 Clean up LDADD usage
We had a lot of unnecessary overstatements of libraries to include on
linking, and autoconf/automake takes care of this for us. This also helps
some compilation issues on other platforms.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 20:40:20 -05:00
Dan McGee a8731ff2f7 Fix mcheck detection and usage
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 20:31:25 -05:00
Nagy Gabor 0cff7c6bdf Add alpm_dep_get_string method
Public alpm_dep_get_string function is introduced, which converts a
pmdepend_t structure to printable string in %DEPENDS% format.  This
function is now used in pacman to print dependency error messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-25 07:10:08 -05:00
Dan McGee 581769b72d Add strndup implemention for environments that are missing it
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-24 00:37:50 -05:00
Dan McGee 8b1fb61df2 Ensure all localization stuff is correctly guarded
Anything dealing with libintl and localization should be correctly guarded
inside an ENABLE_NLS block on both the pacman and libalpm sides.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-22 23:52:55 -05:00
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
Nathan Jones e472e80c08 Download delta files if UseDelta is set.
Delta files will be used if the size is smaller than a percent
(MAX_DELTA_RATIO) of the package size.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:29:17 -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 5d30c5c0b7 pacman/pacman.c : put back root check even if -r is specified.
Root is needed for most install / remove operation, because it's needed
for chrooting, for running scriptlets.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-14 17:56:40 -05:00
Chantry Xavier e03a1f0044 pacman/pacman.c : add --logfile option.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-08 20:46:56 -05:00
Dan McGee 920b0d2049 Update usage of gcc __attribute__ flags
Change the default visibility of libalpm functions to internal instead of
hidden- this allows for slightly better optimization because it tells GCC
that the function can never be called outside of the current module (see
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html).

Also added some attributes to the pacman print functions so that they check
the format strings being passed to them.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 20:46:56 -05:00
Dan McGee 1ff8e7f364 Remove the non-user friendly --ask option
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 20:46:55 -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 b86479cf9b Allow --refresh specified for most -S options
Included options are -g, -i, -s, and -l
All of these will sync the DB if -y is specified and permissions are
appropriate.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -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
Aaron Griffin 50bb16e015 OMG a space!
Yeah, I added a space. It deserves its own commit.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Aaron Griffin 47622eef4d Support for localized times in metadata
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970)
for use in builddate and installdate. This will only affect newly built
packages. Old existing packages with the text format are still supported, but
this is deprecated.

In the case of removal of text time support, this code will fail gracefully,
returning the start of the epoch for broken packages.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Dan McGee 219808714f Add 'full' parameter to alpm_pkg_load
In most cases, we want to fully scan a package when we load it, which serves
as a integrity verification check. However, there are times when it is only
desired to read the metadata and nothing else, so allow the caller of pkg_load
to choose the behavior they need.

This pays big dividends in speeding up pacman cache cleaning functionality.
Old (729 packages):
real    1m43.717s
user    1m20.785s
sys     0m2.993s
New (729 packages):
real    0m25.607s
user    0m19.389s
sys     0m0.543s

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Dan McGee d2edcb58e2 Update comments dealing with pkgext/dbext stripping
pacman/callback.c already did the work I set out to do with this commit, so
update the comments accordingly in the frontend and backend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Dan McGee 16cb8e6e61 Reimplement pacman cache cleaning the right way
Partial cache cleaning was eliminated in a previous commit because it relied
on package naming conventions. Re-add it the correct way- we actually open
up each package in the cache and get a name and version out of it. If the
name and version match that of an installed package, keep it. If the package
is not installed or the version does not match the locally-installed version,
get rid of it.

This can easily be modified if some other heuristic of keeping and removing
packages is desired, or if we should clean out the cache dir of any files
that are not packages, etc.

The biggest current problem with this new approach- speed. Here is one run
on my local machine, going from 1643 to 729 packages in the cache (753 in
the local DB):
real    4m25.829s
user    3m22.527s
sys     0m6.713s

This is likely best addressed by the package loading scheme, which may be
loading the entirety of each package archive, which is a waste when we only
need the .PKGINFO file read.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Dan McGee f7bbfe4052 Remove package name dependency from libalpm
Previously, package names must match a specified scheme or they will cause
pacman add operations to fail. This is not a very intelligent or necessary
way to act, so remove the dependency on the name of the package to be
installed and read all relevant information from the metadata instead.

This does have one causality to be addressed later- pacman cache cleaning
functionality, which has never been phenomenal, just lost most capability.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Chantry Xavier a6b58638d1 document the -Qii option.
I suppose -Qii could be used for other things than displaying
the list of backup files, but currently, it's the only one,
so that's how I documented it..

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-27 22:00:57 -05:00
Dan McGee fc0e83f05b Preliminary support for optdepends
Add some alpm functions for getting optdepends, have makepkg include them
in the PKGINFO file, and have a pacman -Qi operation display the raw string
as stored by libalpm.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-25 23:02:30 -05:00
Chantry Xavier b0aa510592 trans.c : reworking of transaction interruptions
My two previous hacks related to this part
(8038190c7c and
b15a5194d1) were caused by the lack of
understanding of a feature introduced a while ago:
Better control over CTRL-C interruptions -- do not leave the DB in an
inconsistent state (54008798ef).

Now I have been looking at this commit, and the added feature is indeed
interesting. The main problem I had with it is that it does a rather
unusual use of alpm_trans_release, which caused a few problems that I tried
to fix in a weird way. I think these problems were caused by the fact that
there weren't any difference between "interrupt transaction" and "release a
transaction which failed" actions from the alpm_trans_release POV.  So I
decided to add a new function instead, alpm_trans_interrupt, which is
called on Ctrl+C, and which only sets trans->state to STATE_INTERRUPTED so
that remove_commit and add_commit can exit cleanly at a safe moment. This
allowed me to revert my two previous hacks as well.

Also ensure we handle SIGINT correctly in all cases- if a transaction is
not ongoing, then we can free the transaction and exit quickly.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16 20:17:44 -05:00
Chantry Xavier 046c8a6819 Remove the DB consistency check from pacman and libalpm.
This reverts commit dfc85cb5f5
and b6f3fe6957.
This DB check is already in testdb (among others).

Also testdb now uses the db path set at make time by default,
so specifying the db path is optional.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16 20:10:18 -05:00
Stefano Esposito 27acdc2c94 make alpm_strerror binding friendly
I'm currently working on python bindings for alpm written in pyrex. While
working i found that declaring alpm_strerror as
	char * alpm_strerror (void)
instead of
	char * alpm_strerror (int err)

and then using pm_errno in the implementation instead of err, could make it
more bindings-friendly.

Dan: cleaned up and added void to declaration. Instead of replacing existing
function, add a new function called 'alpm_strerrorlast(void)'.

Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-11 20:58:27 -05:00