Commit Graph

380 Commits

Author SHA1 Message Date
Dan McGee 8e30a46adb Make debug config messages consistent in capitalization
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 23:16:52 -06:00
Dan McGee 62f5da3779 Fix some more simple conversion "errors"
None of these warn at the normal "-Wall -Werror" level, but casts do occur
that we are fine with. Make them explicit to silence some warnings when
using "-Wconversion".

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:15:47 -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
Allan McRae 351250adb4 Declare all local functions static
All functions that are limited to the local translation unit are
declared static.  This exposed that the _pkg_get_deltas declaration
in be_local.c was being satified by the function in packages.c which
when declared static caused linker failures.

Fixes all warnings with -Wmissing-{declarations,prototypes}.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:39:23 -06:00
Allan McRae e22aa23c8f Add configuration option to control disk space checking
Disk space checking is likely to be an unnecessary bottleneck to
people with reasonable partition sizes so add a configuration option
to allow it to be disabled/enabled as wanted.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:30:05 -06:00
Dan McGee f0051a7678 Remove AC_TYPE_SIGNAL usage
This macro is deemed unnecessary by even the autoconf guys, so we really
don't need to use it.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:30 -06:00
Xavier Chantry abefa23341 alpm/remove.c : respect --dbonly during remove-upgrade
When a -Sk or -Uk operation induced a removal of an existing local
package, --dbonly was not in effect and the files were all removed.

Fixing this behavior was already marked as TODO in database012 pactest
------------
TODO: I honestly think the above should NOT delete the original les, it
hould upgrade the DB entry without touching anything on the file stem.
E.g. this test should be the same as:
   pacman -R --dbonly dummy && pacman -U --dbonly dummy.pkg.tar.gz
------------

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
[Dan: small coding style touchup]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:19:24 -06:00
Xavier Chantry 3a9dec1048 pacman: sort --help output
Example with pacman -Uh :
$ pacman -Uh
options:
  -b, --dbpath <path>  set an alternate database location
  -d, --nodeps         skip dependency checks
  -f, --force          force install, overwrite conflicting files
  -k, --dbonly         only modify database entries, not package files
  -r, --root <path>    set an alternate installation root
  -v, --verbose        be verbose
      --arch <arch>    set an alternate architecture
      --asdeps         install packages as non-explicitly installed
      --asexplicit     install packages as explicitly installed
      --cachedir <dir> set an alternate package cache location
      --config <path>  set an alternate configuration file
      --debug          display debug messages
      --ignore <pkg>   ignore a package upgrade (can be used more than once)
      --ignoregroup <grp>
                       ignore a group upgrade (can be used more than once)
      --logfile <path> set an alternate log file
      --noconfirm      do not ask for any confirmation
      --noprogressbar  do not show a progress bar when downloading files
      --noscriptlet    do not execute the install scriptlet if one exists
      --print          only print the targets instead of performing the operation
      --print-format <string>
                       specify how the targets should be printed

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
[Dan: small coding style touchups]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:17:38 -06:00
Xavier Chantry c78f5fb99a CLI args: update --help and manpage
The three parts (help, manpage and code) are now organized in the same
way and much easier to compare :
- specific options
- install/upgrade options for -S and -U
- transaction options for -S -R and -U
- global options

After this re-organization, it was easy to update and sync the three
components together. Duplication is also avoided.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:15:53 -06:00
Dan McGee 0e39cf9275 Ensure stdin args are correctly terminated
And don't require pm_targets to be empty to read from stdin either.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:01:14 -06:00
Dave Reisner 4fb3cfc48f Support reading package args from stdin
Only occurs if no arguments were provided directly. Arguments can be
separated by any amount of valid whitespace. This allows for piping into
pacman from other programs or from itself, e.g.:

  pacman -Qdtq | pacman -Rs

This is better than using xargs, as xargs will not reconnect stdin to
the terminal. The above operation performed using xargs would require
the --noconfirm flag to be passed to pacman.

Signed-off-by: Dave Reisner <d@falconindy.com>
2010-11-04 21:10:32 -05:00
Jakob Gruber 5fcb005ebd CLI args: stricter/better parsing
In the following, the letters SRUDQ refer to the corresponding pacman
operations.

Most of the work in this commit is about removing as many options as
possible from the global section and moving them to where they actually
belong.

Additionally, --ignore{,group} are added to U and --dbonly is added
to S.

--dbonly added to S
--asdeps moved to S/U/D
--asexplicit moved to S/U/D
--print-format moved to S/U/R
--noprogressbar moved to S/U/R
--noscriptlet moved to S/U/R
--ignorepkg added to U
--ignoregrp added to U
-d moved to S/U/R (--nodeps) and Q (--deps)
-p moved to S/U/R (--print) and Q (--file)
-f moved to S/U

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:57:36 -05:00
Jakob Gruber 827258f32e CLI args: reorganize parsing
Split parsing of CLI arguments into separate functions:

parsearg_op (operations)
parsearg_global (global options)
parsearg_{database,query,remove,sync,deptest,upgrade}

Organization strictly follows the manpage (even where the manpage is
incorrect) - these cases will be fixed in the following commits.

Switch cases are copy/pasted and statements unrelated to chosen
operation are deleted.

Parsing logic adjusted as follows:

1) Parse operation
2) If we can bail out early (duplicate op, help/version requested) do so
3) Parse arguments again:
    foreach arg:
        if arg is operation:
            continue
        tryparse_args_specific_to_op
        if unsuccessful tryparse_args_global
        if unsuccessful print error message and exit

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:57:26 -05:00
Allan McRae 5a3aae02fe Check return value of chdir and getcwd
Prevents compiler warnings when building with -D_FORTIFY_SOURCE=2

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-01 00:14:59 -05:00
Allan McRae 081e6a8360 Do not compare signed and unsigned types
The casting of nread is safe as it is tested to be >0 when it is
initally assigned.  It is also being implicitly cast in the fwrite
call in the line above.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 08:32:11 -05:00
Marc-A. Dahlhaus 5752e276fb Allow to include a path containing wildcards
Dan: line wrapping and man page touchup.

Signed-off-by: Marc-A. Dahlhaus <mad@wol.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:26:22 -05:00
Xavier Chantry 3a85f83840 Allow Include directive in any sections
Fix a regression of 51f9e5e40a that only allowed Include in repo sections.

Thanks to Marc - A. Dahlhaus for reporting the issue.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-17 18:27:01 -05:00
Dan McGee d485c0370f Improve documentation of -k/--dbonly
We had the long option wrong in some places and its behavior wasn't
documented at all with regards to -U/--upgrade.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 11:18:27 -05:00
Nagy Gabor f9fa822ccb Remove unused 'z' option from getopt_long's optstring
In addition, I permuted shortopts to make it more readable.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 10:39:44 -05:00
Nagy Gabor ac9dde072c Introduce -D, --database
The request of FS#12950 is implemented.

On the backend side, I introduced a new function, alpm_db_set_pkgreason(),
to modify the install reason of a package in the local database. On the
front-end side, I introduced a new main operation, -D/--database, which has
two options, --asdeps and --asexplicit. I documented this in pacman manual.
I've created two pactests to test -D: database001.py and database002.py.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 10:37:01 -05:00
Serge Ziryukin 7608dd74d7 check for valid optarg before using strdup
Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-04-26 14:50:31 -05:00
Nagy Gabor 88254d762d Show --print and --print-format options with -Rh, -Sh and -Uh only
http://mailman.archlinux.org/pipermail/pacman-dev/2010-March/010519.html

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:59:27 -05: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 1aa1d00248 fix a few warnings reported by clang
- remove unused variables
- some more sanity checks
- safer printf

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:25:48 -05:00
Xavier Chantry d39b1dbe62 Add new --print operation for all operations
And a new --print-format option to configure the output.

This implements FS#14208

Example usage :
pacman -Sp --print-format "%r/%n-%v : %l [%s]" kdelibs
extra/kdelibs-4.3.2-4 : ftp://mir2.archlinuxfr.org/archlinux/extra/os/i686/kdelibs-4.3.2-4-i686.pkg.tar.gz [0,00]

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:44:40 -05:00
Xavier Chantry b8b8c78627 add some more sanity check for optarg
getopt should already ensure that optarg is not NULL when an argument is
required, but just be extra safe and double check it before using optarg.

To be honest, I only did that to make clang shut up and eliminate the last
warnings it reported.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:21:56 -06:00
Xavier Chantry 51f9e5e40a refactor _parseoptions
This function was quite huge (~230 lines) and difficult to parse, now it is
slightly better.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:20:56 -06:00
Dan McGee d2dbb04a9a download: major refactor to address lingering issues
Sorry for this being such a huge patch, but I believe it is necessary for
quite a few reasons which I will attempt to explain herein. I've been
mulling this over for a while, but wasn't super happy with making the
download interface more complex. Instead, if we carefully order things in
the internal download code, we can actually make the interface simpler.

1. FS#15657 - This involves `name.db.tar.gz.part` files being left around the
filesystem, and then causing all sorts of issues when someone attempts to
rerun the operation they canceled. We need to ensure that if we resume a
download, we are resuming it on exactly the same file; if we cannot be
almost postive of that then we need to start over.

2. http://www.mail-archive.com/pacman-dev@archlinux.org/msg03536.html - Here
we have a lighttpd bug to ruin the day. If we send both a Range: header and
If-Modified-Since: header across the wire in a GET request, lighttpd doesn't
do what we want in several cases. If the file hadn't been modified, it
returns a '304 Not Modified' instead of a '206 Partial Content'. We need to
do a stat (e.g. HEAD in HTTP terms) operation here, and the proceed
accordingly based off the values we get back from it.

3. The mtime stuff was rather ugly, and relied on the called function to
write back to a passed in reference, which isn't the greatest. Instead, use
the power of the filesystem to contain this info. Every file downloaded
internally is now carefully timestamped with the remote file time. This
should allow the resume logic to work. In order to guarantee this, we need
to implement a signal handler that catches interrupts, notifies the running
code, and causes it to set the mtimes on the file. It then rethrows the
signal so the pacman signal handler (or any frontend) works as expected.

4. We did a lot of funky stuff in trying to track the DB last modified time.
It is a lot easier to just keep the downloaded DB file around and track the
time on that rather than in a funky dot file. It also kills a lot of code.

5. For GPG verification of the databases down the road, we are going to need
the DB file around for at least a short bit of time anyway, so this gets us
closer to that.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Xav: fixed printf with off_t]
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-11-15 19:47:30 -06:00
Laszlo Papp be266b4364 Refactor do/while cycle and multiple while cycles
* It makes the code clearer to read/understand
* Cppcheck tool doesn't show this anymore: [./util.c:215]: (error) Resource leak: fd

[Dan: don't change the coding style]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:40:56 -06:00
Laszlo Papp f9582c7df2 Replace hardcoded option numbers with enumeration
Pacman's long option parsing used hardcoded numbers to identify them.
This is not good practice, so replace them with enumeration constants.

Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-12 23:42:36 -05:00
Dan McGee 302310c5aa Minor scope/typing cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee 72883e3bcb Fully implement database lazy loading
Commit 34e1413d75 attempted to implement lazy loading of package databases.
Although it took care of my main complaint (creating the database directory
if it didn't exist), it didn't allow sync repos to be registered before
alpm_option_set_dbpath() had been called.

With this patch, we no longer compute the individual repository DB paths
until necessary, allowing full lazy loading to work as intended, and
allowing us to drop the extra setlibpath() calls from the frontend. This
allows the changes introduced in a2cd48960 (but later reverted) to be added
back in again.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20 12:19:57 -05:00
Dan McGee 6bfca2fd14 Merge branch 'maint'
Message updates made this one a bit messy, but nothing too bad.

Conflicts:
	lib/libalpm/add.c
	lib/libalpm/remove.c
2009-09-20 12:09:10 -05:00
Laszlo Papp 6685822e57 Strndup usage and small typo fix
./src/pacman/package.c:
       - small typo fix
   ./src/pacman/pacman.c:
       - strdup is changed to strndup, because it's safer like in
       case of config option

Signed-off-by: Laszlo Papp <djszapi2@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20 11:52:50 -05:00
Dan McGee 44cddb351b Kill -F option for good in option parsing
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-18 18:29:22 -05:00
Xavier Chantry 1df3b91931 String improvements
Add more untranslated strings, improve consistency, etc.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-16 19:36:49 -05:00
Dan McGee bc24c002fe Revert "Fix a memleak involving lazy DB loading"
This doesn't quite work, as can be seen by the pactest results:

Total            = 179
Pass             = 108 ( 60.34%)
Expected Fail    =   5 (  2.79%)
Unexpected Pass  =   0 (  0.00%)
Fail             =  66 ( 36.87%)

If you peek inside '_alpm_db_new' when it gets called for the sync
databases, the base dbpath is still at the default value, causing things
like pactest to fail miserably. We need some further work to do fully lazy
loading, and that belongs on master, not maint.

This reverts commit a2cd48960e.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-14 22:06:28 -05:00
Xavier Chantry 90e3e026d1 Re-add the non-user friendly --ask option
This re-implements the --ask option which was removed in commit
1ff8e7f364.

This option does not have to be exposed to the user (help,doc,etc), but is
very very useful for pactest if we want to have more coverage there.

This was rewritten in a smarter way, without code duplication. And with a
different behavior : this option is now only used to inverse default
behavior to questions.

We still use bit operations based on the following struct :
/* Transaction Conversations (ie, questions) */
typedef enum _pmtransconv_t {
        PM_TRANS_CONV_INSTALL_IGNOREPKG = 0x01,
        PM_TRANS_CONV_REPLACE_PKG = 0x02,
        PM_TRANS_CONV_CONFLICT_PKG = 0x04,
        PM_TRANS_CONV_CORRUPTED_PKG = 0x08,
        PM_TRANS_CONV_LOCAL_NEWER = 0x10,
        PM_TRANS_CONV_REMOVE_PKGS = 0x20,
} pmtransconv_t;

for each conv matched, the default answer is inversed.

--ask 0 : all default answers are preserved
--ask 4 : only conflict question is inversed
--ask 63 : all questions are inversed (63 == 1+2+4+8+16+32)

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-08 22:02:08 -05:00
Xavier Chantry a2cd48960e Fix a memleak involving lazy DB loading
Lazy opening of databases is supported since 34e1413d75.

We don't need that setlibpath call each time we register a database.
Besides this caused a memleak in case setlibpath failed, because setlibpath
exit directly and we did not do the cleanup part (section string was not
freed, and a file descriptor remained open).

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-08 21:43:06 -05:00
Xavier Chantry cb1d4195bf use strreplace in the xfercommand code
this operation was re-implemented using static strings, instead of using the
existing strreplace function

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-07 15:16:47 -05:00
Xavier Chantry 2f19072632 fix small memleak in an error case
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 19:15:12 -05:00
Xavier Chantry c88ac86292 Log commandline in pacman/alpm log
This implements FS#11452.

Original-work-by: silvio <silvio@port1024.net>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 16:17:17 -05:00
Xavier Chantry 65c1f06be5 Allow $arch to be used in Server
similarly to the $repo variable, Server can now contain $arch, which will be
automatically replaced by the appropriate architecture.

This allows us to have one universal mirrorlist file, for both i686 and x86_64,
woohoo!

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:53:54 -05:00
Xavier Chantry 594621cbeb Add Architecture and --arch option
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:50:42 -05:00
Xavier Chantry 7dae79e7b9 dload.c : various fixes
- fix one memleak if get_filename failed

- cleanup according to Joerg's feedback:

"url_for_string: If fetchParseURL returned successful, you should always
have a scheme set. The logic for anonftp should only be needed for very
broken server -- do you know of any such?

download_internal:
Specifying 'p' is now a nop -- it is tried by default first with
fall-back to active FTP."

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: remove from pacman.conf and pacman.conf.5]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-18 20:47:12 -05:00
Dan McGee 2013d06266 Ensure version screen fits in 80 cols
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-26 23:02:20 -05:00
Sebastian Nowicki 30c4d53ce5 Add a fetch callback to allow front-end download support
This allows a frontend to define its own download algorithm so that the
libfetch dependency can be omitted without using an external process.
The callback will be used when if it is defined, otherwise the old
behavior applies.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
[Dan: minor cleanups]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 21:27:46 -05:00
Nagy Gabor 1d19f0896c Introduce -Suu
If the user switches from unstable repo to a stable one, it is quite hard to
sync its system with the new repo (the user will see many "Local is newer
than stable" messages, nothing more). That's why I introduced -Suu, which
treats a sync package like an upgrade, iff the package version doesn't match
with the local one's.

I added a new pactest (sync104.py) to test this, and I updated the
documentation of -Su.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: slight doc reword]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 20:16:52 -05:00
Dan McGee ca6ef852f9 New feature: files verification
This implements FS#13877. Add a new option "-Qk" which checks if all of the
files for a given package (or packages) are really on the system (i.e. not
accidentally deleted). This can be combined with filters and other display
options. It also respects both the --quiet and --verbose flags to give
varying levels of output.

Based on the original patch by Charly Coste <changaco@laposte.net>, thanks
for your work!

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 20:13:53 -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 f4ecc908ec We don't need root with -Sp
FS#8905 is fixed. The front-end passes PM_TRANS_FLAG_NOLOCK to the back-end,
so it doesn't lock the database. That's why we don't need root anymore.

I reworked (and renamed) needs_transaction() accordingly. I also added
missing -Sc check there (for example, -Sci didn't print non-root error, but
pacman wanted to lock the database).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-01 22:01:04 -05:00
Nagy Gabor 1b4135ca5d Change package to package(s) and file to file(s) in documentation
The pacman --help pages and the manual suggested that only one package can
be upgraded/removed per transaction.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-01 21:59:03 -05:00
Nagy Gabor f89f7e136b Query documentation updates
The old documentation didn't emphasize our filtering options at all, and it
was a bit misleading. ("List ALL...")

I also clarified the description of -Qu.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:09:24 -05:00
Nagy Gabor 5fcc9ae7f4 Document --debug
After some irc/forum experiences, I decided to document this option.
However, I left the debug-level undocumented (--debug=2).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-05 21:11:48 -05:00
Nagy Gabor a888f377a5 HoldPkg rework
The HoldPkg feature is even more important when the packages to be held are
pulled automatically by pacman, in a -Rc and -Rs operation. Before, it only
applied when the packages were explicitly requested by the user to be
removed. This patch extends holdpkg to -Rc and -Rs by doing the HoldPkg
check just before trans_commit.

Additionally, the whole HoldPkg stuff was moved to the front-end.

I changed the default behavior to "don't remove", so I modified remove030.py
pactest as well.

See also: FS#9173.

Original-work-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 22:44:00 -06:00
Dan McGee 61c6552862 Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2008-12-02 22:15:02 -06:00
Nagy Gabor a50b067470 Give an error message on alpm_db_register_sync() error
This patch slightly modifies pacman.c/_parseconfig():

See FS#12148. Now pacman prints the following error message in that case:
"error: could not register 'unstable' database (could not open database)"

I also added an error message for alpm_db_setserver() error.

I changed the "return(1);" scheme to "ret = 1; goto cleanup;" to make
sure that we free allocated memory and close open files.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-30 16:38:37 -06: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
Dan McGee fa02a71abd Merge branch 'maint' 2008-10-12 21:36:45 -05:00
Dan McGee 30851a24ff Make interrupt handler async-safe
Calling printf() in a signal handler can be dangerous, so avoid it by
writing directly which is guaranteed to be safe according to signal(7).

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 21:35:30 -05:00
Dan McGee 18452a6c51 Ensure we don't have double slashes when creating frontend paths
Because libalpm always returns a root path with a trailing slash, when we
use it to create our unspecified paths we get double slashes in the result.
Use the fix suggested by Jürgen Hötzel to remedy this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 21:27:52 -05:00
Dan McGee 1c47500ea6 Merge branch 'maint' 2008-08-26 20:11:25 -05:00
Roman Kyrylych ece3d3606a Add missing comma to -S --help message
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-25 17:54:05 -05:00
Nagy Gabor baf5852555 Move -Sp implementation to the front-end
This patch kills one of our hackish pseudo transactions: PRINTURIS.
(The other one is -Sw)

From now on, front-end must not call trans_commit in case of -Sp,
it should print the uris of target packages "by hand" instead.

PRINTURIS flag was removed, NOCONFLICTS flag can be passed to skip
conflict checks.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 09:50:40 -05:00
Xavier Chantry 5b51dbb11e Cleanup of _alpm_pkg_compare_versions.
* Change the return values to be more informative.

It was previously boolean, only indicating if a sync package was newer than
a local package.

Now it is a simple wrapper to vercmp, handling the force flag.

* Remove the verbose output from _alpm_pkg_compare_versions.

The "force" message is not so useful.
The "package : local (v1) is newer than repo (v2)" message can be moved to
-Su operation.
For the -S operation, it is better to have something like :
"downgrading package from v1 to v2"

* Don't display the "up to date -- skipping" and "up to date -- reinstalling"
messages, when the local version is newer than the sync one.

* Fix the behavior of --needed option to not skip a target when the local
version is newer, and clarify its description.

* Add a new alpm_pkg_has_force function

This allows us to access the pkg->force field like any other package fields.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:47:07 -05:00
Xavier Chantry 0969c2e700 pacman : clarify help message.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:38:36 -05:00
Xavier Chantry fb5c5086e1 pacman.c: fix typo s/NoPassiveFTP/NoPassiveFtp
This fixes FS#11203.

The doc has always mentioned NoPassiveFtp, but an inconsistency was
introduced with commit 76f816b9f7 when case
sensitive comparision was introduced, and was only found after commit
b3e6cf652c which dropped the case insensitive
comparison.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-19 18:42:42 -05:00
Nagy Gabor 9a6fd1b021 Remove UseColor from front-end
This option wasn't used.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-29 21:46:42 -05:00
Dan McGee 0fc538fcdb Various updates needed prior to a new release
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-08 13:50:01 -05:00
Dan McGee fe781e4ce4 Reimplement TotalDownload functionality
Add a new totaldlcb callback function to libalpm and make pacman utilize it
when the TotalDownload option is enabled. This callback function is pretty
simple- it is meant to be called once at the beginning of a "list download"
action, and once at the end (with value 0 to indicate the list has been
finished). The frontend is responsible for keeping track of adding
individual file download amounts to the total xfered amount in order to
display some sort of overall progress.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-04 15:38:53 -05:00
Dan McGee 636610432a Allow GIT version to be used in pacman builds
Add a new configure flag, --enable-git-version, that allows the output of
'git describe' to be used in the version string associated with this
package. This could aid in debugging for users that are using a development
version of pacman and we should be able to figure out which cut of code they
are using.

Sample output:
$ pacman --version
Pacman v3.1.4-190-g4cfa-dirty - libalpm v2.3.1

$ makepkg --version
makepkg (pacman) 3.1.4-190-g5861-dirty

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-31 12:06:34 -05:00
Xavier Chantry fb09d35e6a Disable geteuid in cygwin.
This is one of those rare cases where we actually want to code in a
platform-specific #ifdef. Because you don't need to be the root user on a
Windows box, and fakeroot doesn't exist so we can do easy testing, lets
disable any checking of the UID.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14 09:17:02 -05:00
Chantry Xavier d5278ebb3b Add SyncFirst option.
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>
2008-05-13 15:49:02 -05:00
Allan McRae 3c3cb001a4 Make all error messages use pm_fprintf
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>
2008-05-11 20:05:28 -05:00
Dan McGee 57acfced0d Update configure.ac to current code
Remove a few functions and things that were unnecessary, update the help
line calls to the current function name, and make the small change to
pacman.c for the signal handler return type that is defined in config.h.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07 19:27:35 -05:00
Chantry Xavier 3d10d460df Add new CleanMethod option.
As it was already mentioned several times, the new -Sc behavior in 3.1 is
great, but only when the package cache is not shared.

This option has two possible values : KeepInstalled and KeepCurrent
With KeepCurrent, -Sc will clean packages that are no longer available in
any sync db, rather than packages that are no longer in the local db. The
resulting behavior should be better for shared cache.

Ref :
http://www.archlinux.org/pipermail/pacman-dev/2008-February/011140.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23 13:38:23 -05:00
Chantry Xavier 5af076f09f Kill the dependsonly option.
From the man page :
"This is pretty useless and we're not sure why it even exists."

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-22 18:39:15 +01:00
Chantry Xavier b3e6cf652c Drop case insensitive comparisons in the config parsing.
These case insensitive comparisons didn't work in some locales, like tr_TR
where upper(i) != I. So a second case sensitive comparison had to be made
for each directive.
Only keeping case sensitive comparisons make the code cleaner and treat all
locales equally.

Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011445.html

Also fix pactests to use the correct case.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-17 20:58:28 -05:00
Nagy Gabor 35135c0a0c Add -Rss option
* -Rss removes all dependencies (including explicitly installed ones).
* updated documentation
* two pactest files added to test the difference between -Rs and -Rss

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2008-03-10 19:16:01 -05:00
Dan McGee 91b7f288fe Merge branch 'maint'
Conflicts:

	configure.ac
2008-03-09 12:03:54 -05:00
Chantry Xavier 51e0303e84 Use sigaction instead of signal.
From signal man page :
"The behavior of signal() varies across Unix versions, and has also varied
historically across different versions of Linux. Avoid its use: use
sigaction(2) instead. See Portability below."

The code was taken from there :
http://www.gnu.org/software/libtool/manual/libc/Sigaction-Function-Example.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-09 11:35:01 -05:00
Chantry Xavier 2f9f48eddd src/pacman/pacman.c : split cleanup function.
This function was used in two different ways :
- as a signal handler : the argument was the signal number
- called manually for freeing the resources : the argument was the return
  value
So the first part is now handler(int), and the second cleanup(int).
Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011388.html

Remaining problems :
- the return values are messy. for example, 2 can mean both that it was
  interrupted (SIGINT == 2), or that --help or -V was used (returned by
  parseargs).
- apparently signal is not portable and sigaction should be used instead

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-09 11:30:59 -05:00
Dan McGee 3ec45486ff Remove the Add option from the command line
There is still a lot of code that could be cleaned up internally.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-08 14:13:34 -06:00
Nagy Gabor 54af52f87d New alpm_version function
Now pacman frontend uses this function instead of the compile-time libalpm
version number.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix one more spot where LIB_VERSION was used]
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 49197b7492)
2008-03-06 19:05:14 -06:00
Nagy Gabor 49197b7492 New alpm_version function
Now pacman frontend uses this function instead of the compile-time libalpm
version number.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix one more spot where LIB_VERSION was used]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-01 17:02:05 -06:00
Dan McGee 6b07b5d345 Merge branch 'maint'
Conflicts:

	lib/libalpm/be_files.c
	lib/libalpm/package.c
2008-02-15 19:40:22 -06:00
Dan McGee 8068a14c52 setlibpaths(): remove a stray set_option line
For some reason, we set our dbpath to the logfile path, which was completely
broken, and we didn't even check the return value coming back (which of
course was -1 meaning the set failed). Add some comments so people can
understand what is going on here now too.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-11 20:40:44 -06:00
Nagy Gabor e63366ae5e New remove option : -u / --unneeded (FS#6505).
With --unneeded option 'pacman -R' doesn't stop in case of dependency error;
it removes the needed-dependency targets from the target-list instead.  See
also: http://archlinux.org/pipermail/pacman-dev/2007-October/009653.html .

The patch also adds a new causingpkg field to pmdepmissing_t which indicates
the to-be-removed package which would cause a dependency break. This is
needed, because miss->depend.name may be a provision. miss->causingpkg will
be useful in -R dependency error messages too.

[Xavier: renamed inducer to causingpkg, removed the _alpm_pkgname_pkg_cmp
helper function as requested by Aaron. This might be added by a further
commit.  Other small cleanups, updated manpage and bash completion.]

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-06 08:46:15 +01:00
Nagy Gabor 2a7101c049 New --asexplicit option
This is the symmetric of --asdeps, install packages explicitly.
Documentation and completion files were updated accordingly.
Added sync301.py and upgrade032.py pactest files to test this.

I also made a little modification in ALLDEPS handling too.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-21 19:39:26 -06:00
Dan McGee 549c2878f9 Disallow a NULL section in _parseconfig
If we allow _parseconfig to continue processing when section is not defined,
then we have the potential to segfault during strcmp calls. This is no good.
For some reason, we had existing logic that tested this case but only if it
was processing and 'Include' directive. Expand the check to check for a NULL
section in all cases, and print an error message if this is the case.

Reported here:
http://bbs.archlinux.org/viewtopic.php?id=42235

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 18:42:00 -06:00
Dan McGee 318d5c4ba8 Make the user-agent string a bit less verbose
We shouldn't pass things like the kernel version in the user agent string,
as it may be a bit too revealing and is not really necessary.

Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=57555

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11 19:29:44 -06:00
Dan McGee 0a65de10b1 Output a single newline on receipt of a SIGINT
Fixes FS#9147, where issuing a ctrl-C at a prompt puts the users prompt on
the same line as our question. This can also occur during download bars.
Although we might end up putting one too many newlines to the screen now, it
is better than not putting one at all.

Also update the copyright in pacman.c.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-10 23:07:52 -06:00
Chantry Xavier aec7c13648 Rename -t --orphans to -t --unrequired (FS#9144).
It turns out the orphan name was misleading. Real orphans are packages
installed as dependency no longer required by any others (-Qtd).
The -t option only shows package not required by any others, so --unrequired
describes it better.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-10 22:58:19 -06:00
Dan McGee 9dd016001e Remove upgradedelay and all code associated with it
It wasn't even implemented correctly, and it really doesn't have a use if
packagers just do their job correctly anyway for a distro. Let's not try to
solve a problem with the wrong solution now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-08 15:49:52 -06:00
Aaron Griffin a4b8138797 Allow unreadable Include files to be non-fatal
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
[Dan: remove unused variable, make parseconfig static]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-17 20:56:35 -06: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 874f3379ff Update some errors in messages found during localization
Also perform the updates in the message files so we don't break
translations.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-04 09:56:28 -06:00
Dan McGee d6354ff248 Oops- forgot to ever set init to 1 in setlibpaths()
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03 22:17:19 -06:00
Dan McGee 32e625db14 parseconfig: refactor duplicate code out into a function
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 15:10:18 -06:00
Dan McGee 8a474e8735 Fixes for the ineptitude of libalpm DB registration
When a DB is "registered" in libalpm, it goes and tries to create paths and
other BS which is stupid, but a pain in the butt to fix. For now, work
around this terrible behavior by ensuring our paths are always set before we
call any alpm_db_register function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 12:56:57 -06:00
Dan McGee 4845207fd4 Make pacman path handling (hopefully) a bit more intuitive
I made pacman path handling a bit odd with my rootdir changes a while back
in order to increase flexability. However, it had a bit of a drawback in
that dbpath/logfile/etc. would not default to being under the rootdir if
that was the only parameter you specified in the config file or on the
command line. (Note: logfile handling was always broken due to the explicit
logfile line required in config files)

Pacman now works as follows:
if a rootdir is specified but not dbpath or logfile:
  attempt to place the logfile and dbpath in their default locations under
  root
if an explicit dbpath/logfile is specified:
  interpret these as absolute paths, regardless of the rootdir setting
if nothing is specified:
  fall back to configured defaults

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 12:20:55 -06:00
Chantry Xavier 250331a636 Add new --needed option for -S.
During a pacman operation such as a group install, pacman can ask several
questions such as "local version is up to date. Upgrade anyway?". They are
usually all answered either by yes or by no:
* yes when you want to reinstall all the targets.
* no when you only want to install the missing ones (either because you are
installing a group, or because you are copying a pacman -S line from wiki or
whatever).

So instead of asking this question for each target, it is now now configured
with a flag.  Yes will be the default -S behavior, No will be achieved with
the --needed flag.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02 11:14:13 -06:00
Chantry Xavier 11133da587 Move mbasename from pacman.c to util.c
This function can be useful in other places.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 16:13:30 -06:00
Artyom 1e9a1a0292 Add -q/--quiet option for controlling output.
Currently this only affects -Ss, -Sl, and -Q to output less information (only
package names).

In the future, we can reuse this flag for other things as well.

[Aaron: rewritten as a front-end flag]
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
[Dan: squashed commits together]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25 14:33:32 -06:00
Dan McGee f5d2150e9d Remove -F/--freshen operation
This operation made sense in the days before sync DBs existed, but it no
longer has the same usefulness it once did.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-21 11:51:17 -06:00
Nathan Jones 46ec9e3548 Make it easier to ignore multiple packages.
This makes --ignore and --ignoregroup able to accept multiple
packages/groups by separating each with a comma.

For instance: pacman -Su --ignore kernel26,udev,glibc

This was requested in the comments of FS#8054.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13 20:59:02 -06:00
Nathan Jones 70a91cbb22 Add help for --ignoregroup.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
[Dan: split usage line into two lines for clarity]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13 20:58:45 -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 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 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 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
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 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 a8731ff2f7 Fix mcheck detection and usage
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 20:31:25 -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
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
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 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 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
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
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
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
Travis Willard b6f89f03af separate local from sync dbs on filesystem
Introduce two new methods into the API - alpm_db_register_sync and
alpm_db_register_local, which replace the functionality of
alpm_db_register. db_register_local always returns the local DB, and
db_register_sync will always try to register a sync DB. This conceptually
separates the local DB from sync DBs in the code. Also updated the pacman
frontend to use the new functions. In addition, this changes the location
of all sync DBs in the filesystem from $DBPATH/$REPO to $DBPATH/sync/$REPO,
This removes the silly limitation that a sync DB couldn't be named 'local',
along with structurally separating sync DBs and the local DB in the
filesystem.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-26 23:44:32 -04:00
Dan McGee 10c3f335d0 pacman.c: clarify reason for doing 2 strcmp operations
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-22 14:02:14 -04:00
Dan McGee 515754faac Various valgrind mem leak fixes
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21 23:29:10 -04:00
Dan McGee d09d114e99 Add a default cachedir if one wasn't specified
Use the default cachedir (specified at compile time) if one wasn't specified
on the command line or in the config file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21 21:53:38 -04:00
Dan McGee c22e381a8b Post trial install changes, round one
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>
2007-08-21 21:28:05 -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
Dan McGee 47cada81a0 pacman.c: Alphabetize listing of query options
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16 11:04:58 -04:00
Chantry Xavier 0f539832f4 new query options : explicit (-Qe) and deps (-Qd).
The t shortcut for --test was removed,
the orphan option (previously -Qe) was renamed to -Qt,
-Qe lists all packages installed explictly,
and -Qd lists all packages installed as dependencies.

Besides, t can be combined with either e or d.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-15 20:21:43 -04:00
Dan McGee 178c1d228d Cleanup of pacman.c and addition of default paths to frontend
Instead of barfing when the root path and db path haven't been defined,
have pacman set them to some sane defaults when they aren't specified on
either the command line or the config file.

Also do some cleaning of error output and Doxygen comments.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-23 16:58:04 -04:00
Dan McGee a1e57cbec8 Add --asdeps option to pacman
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>
2007-07-15 12:46:02 -04:00
Dan McGee ea1fef69ad Remove gettext calls from all PM_LOG_DEBUG messages
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>
2007-07-10 14:24:58 -04:00
Dan McGee 7daa6708d2 Remove lockfile configuration from frontend, make it job of libalpm
I previously introduced some patches to make just about every path in
pacman/libalpm configurable; doing this with the lockfile seemed a bit too
far and we really should just place the lockfile where it belongs- with the
DB that needs locking.

More details in this thread:
http://archlinux.org/pipermail/pacman-dev/2007-June/008499.html

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-27 23:34:38 -04:00
Dan McGee 7bdb904af5 pacman.c: make parseconfig a bit more robust
Don't let parseconfig overwrite settings that parseargs already made.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-27 22:58:21 -04:00
Dan McGee da6b175d01 pacman.c: Refine error messages used by parseconfig
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 13:38:14 -04:00
Dan McGee 35a794c2ed Allow multiple CacheDirs to be specified
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>
2007-06-09 13:03:25 -04:00
Dan McGee b6f3fe6957 Implement a -Qt operation in frontend to test the database
After adding a alpm_db_check() operation in the back end, we can call it
in the front end and present a user-friendly interface to it.

Inspired-by: VMiklos <vmiklos@frugalware.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 12:58:12 -04:00
Dan McGee 25c5b39d05 Fix up things after the last few changes
* Readd default logmask of ERROR and WARNING
* Remove DOWNLOAD log level as it no longer applies
* Add 'no targets' logic back in where it applies
* Switch some prints in parseconfig to ERROR

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 12:57:50 -04:00
Dan McGee fc93601b98 Revamp pacman.c main function ordering, switch some output to pm_printf
Reorder some of the initilization stuff in pacman.c, as well as remove
some code that should be reimplemented elsewhere- checking the target
list to see if it is NULL.

Change the temp printf statements in parseconfig to pm_printf as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 12:57:50 -04:00
Dan McGee 466b79bf8f Fix up outstanding parseconfig issues
The db variable was left unset when calling alpm_db_register, leading
to a failure to ever register a sync db. Also added a check to ensure
DBPath was set when trying to register a database.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 23:10:49 -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 6949ab9761 Move three config options out of the backend
Move chomp, usecolor, and showsize out of the backend and into the
pacman frontend as they are pacman-specific options and not related
to the behavior of libalpm.

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
Dan McGee d9ff7bbcd2 Remove hardcoded defines from libalpm
Remove any use of the former path variables defined by the Makefiles or
config.h. These are now runtime configurable only with pacman.conf (or by
using flags on the command line).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 17:00:30 -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