Commit Graph

628 Commits

Author SHA1 Message Date
Dan McGee c2dbbd60bc Start removing some junk from the function template
I screwed up originally when I accepted the TotalDownload patch,
8ec27835f4. I didn't realize how deeply it
modified libalpm and I probably shouldn't have let it do what it did. This
commit reverts much of what that patch added in order to clean up our
internal function calls. We can find another way to do it right down the
road here but for now it has to go.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-27 18:58:24 -06:00
Dan McGee d75f693155 Merge branch 'maint'
Also bump the devel version on the master branch to 3.2.0devel.
2008-02-25 20:49:59 -06:00
Chantry Xavier c23ecc6160 Remove done and failed msg when loading targets.
This change is similar to the one made in
3017b71cb5.

We had a "loading package data..." message, followed by either "failed" or
"done", but it didn't take into account that other warnings / questions
could be displayed between.

Ref: http://archlinux.org/pipermail/pacman-dev/2008-January/010971.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-25 12:10:34 +01:00
Chantry Xavier 143135e666 Improve yesno function.
Add a preset paramater to yesno function saying which answer should be the
default. Ref:
http://www.archlinux.org/pipermail/pacman-dev/2007-June/008470.html

This allows us to answer no by default to some questions, like the -Scc one
mentioned in the above thread, and implemented by this patch.

Another advantage is that we don't have to repeat the [Y/n] in every
questions. It's only put once in yesno function. This highly reduces the
chances that YES and NO strings are translated, but not some questions,
which lead to obvious confusions.

Finally, the noconfirm variable only needs to be used in that yesno
function. So all other usages of it were removed.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-24 18:17:49 -06:00
Dan McGee 3ad3077d8d Merge branch 'maint'
Conflicts:

	src/pacman/callback.c
2008-02-24 01:22:07 -06:00
Dan McGee 96f7613d15 Add some NULL checks into recently modified output functions
After a merge with master where some strings we print (such as descriptions)
could be NULL, a few segfaults popped up due to strlen() calls on null
pointers. Fix this by doing some preemptive checks and returning from
functions early if the string was null.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24 01:17:17 -06:00
Dan McGee 3a6f62d4c7 Remove all unnecessary snprintf usage
Both alpm_logaction() and yesno() are vararg functions, so we might as well
use this functionality and take advantage of it. Remove all of the
snprintf() calls and the LOG_STR_LEN constant that never seemed quite right.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24 00:54:11 -06:00
Dan McGee 4c14dcc580 A few more wide character output fixes
Fix up the indentprint and list printing functions so they work properly.
This output can be seen in places such as -Ss, -Si, -Qs, and -Qi.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-22 23:47:03 -06:00
Dan McGee a6470956bc Fix wide character output for add/remove/upgrade/conflict progress
Due to the addition of the Chinese translation, our column widths were all
messed up as mentioned in the download progress commit fixing this same
problem there. This is a port of the code and ideas from that fix to the
installation progress bars. Once again, a handful of examples were tested to
ensure we work in all locales and with varying byte and char widths.

English (before & after):
(1/1) checking for file conflicts                   [-----------------] 100%
(1/1) upgrading man-pages                           [-----------------] 100%

German (before & after):
(1/1) Prüfe auf Dateikonflikte                      [-----------------] 100%
(1/1) Aktualisiere man-pages                        [-----------------] 100%

Chinese (before):
(1/1) 正在检查文件冲突                                      [-----------------] 100%
(1/1) 生在升级 man-pages                                [c  o  o  o  o  o ] (1/1) 生在升级 man-pages                                [----------C o  o ] (1/1) 生在升级 man-pages                                [-----------------] 100%

Chinese (after):
(1/1) 正在检查文件冲突                              [-----------------] 100%
(1/1) 生在升级 man-pages                            [-----------------] 100%

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-22 22:00:15 -06:00
Dan McGee 29f55fb7c9 Fix wide character output for download progress
Now that we have a Chinese translation, all of the problems with new
character sets crop up. Assumptions were made in the past that all
characters occupied one column, which is not true with a Chinese character
set. In addition, the download code even failed on such things as 'ö', which
is two bytes wide but only 1 column.

This code will need to also be ported to the add/remove/upgrade/conflicts
progress printouts.

Note that the tests below try to incorporate a number of things:
1. download filenames too long to fit
2. download filenames cut off in the middle of a multibyte sequence
3. download filenames incorporating multicolumn chars
4. download filenames incorporating multibyte, single-column chars
5. 'plain' download filenames that have always worked

Before:
:: 正在同步软件包数据库……
 正在解决倚赖��...    0.0K  199.8K/s 00:00:00 [-----------------] 100%
错误:无法升级正在解决倚赖关系junköëjunköëjunköëäää (未预计的系统错误)
 正在解决倚赖��...    0.0K  308.4K/s 00:00:00 [-----------------] 100%
错误:无法升级正在解决倚赖关系 (未预计的系统错误)
 junköëä                 0.0K  390.6K/s 00:00:00 [-----------------] 100%
错误:无法升级junköëä (未预计的系统错误)
 pacman-git                 0.5K    4.3M/s 00:00:00 [-----------------] 100%
本地数据库已是最新的

After:
:: 正在同步软件包数据库……
 正在解决倚赖关系jun...     0.0K   89.7K/s 00:00:00 [-----------------] 100%
错误:无法升级正在解决倚赖关系junköëjunköëjunköëäää (未预计的系统错误)
 正在解决倚赖关系           0.0K  147.7K/s 00:00:00 [-----------------] 100%
错误:无法升级正在解决倚赖关系 (未预计的系统错误)
 junköëä                    0.0K  156.9K/s 00:00:00 [-----------------] 100%
错误:无法升级junköëä (未预计的系统错误)
 pacman-git                 0.5K 1515.9K/s 00:00:00 [-----------------] 100%
本地数据库已是最新的

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-22 21:59:11 -06:00
Chantry Xavier a3e6a6b822 Move -Sy operation into its own transaction
This allows us to remove the sync_only flag, and also do the following
steps in the future :
1) refresh the database (if asked)
2) do other stuff (eg checking if a newer pacman version is available)
3) start the actual transaction

Currently when we detect a newer pacman version, we have to release the
current transaction and start a new one.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-20 18:58:43 -06:00
Dan McGee 4bd52f3fe4 Merge branch 'maint'
Remove gettext() function addition from gensync and updatesync in master as
gettext is no longer used in them anyway.
2008-02-20 18:58:04 -06:00
Chantry Xavier 7879e4bef7 Lock the database on -Sc operation.
This partly fixes FS#9609.

Weird things could happen when running -Sc while another instance was
already running. The cleancache function could delete packages that were
just being downloaded.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-19 22:08:06 -06:00
Chantry Xavier 6f3949e3da Add new sync_trans_init and sync_trans_release.
Factorize these two functions to avoid code duplication, especially since
they could be used for locking the database during -Sc and -Sy operation
too.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-19 22:07:44 -06:00
Dan McGee fc9d12bef0 When cleaning DBs, only look at directories
FS#9609 brought up an interesting issue where a user was prompted to remove
db.lck when running a -Sc operation concurrently with an -Syu operation
during a long download. Although there are other problems here, this fixes
the issue where files other than directories could be considered to be
databases. Fix this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-19 08:47:05 -06:00
Chantry Xavier 2374c81e55 Fix conflict progress bar with UTF-8 chars
This fixes FS#6437. Dan already explained the problem in that bug report.

Instead of letting printf deal with the length of utf8 strings, we can
handle it more explicitly in the case of conflict progress bar, just like we
do for add/remove progress bars. We compute the remaining space left for
displaying the pkgname in case of add/remove, and an empty string in case of
conflict.

Before :
(1/1) Prüfe auf Dateikonflikte                 [###################] 100%
(1/1) Aktualisiere rxvt-unicode                 [###################] 100%
After :
(1/1) Prüfe auf Dateikonflikte                  [###################] 100%
(1/1) Aktualisiere rxvt-unicode                 [###################] 100%

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-17 20:41:23 -06:00
Dan McGee 273950473e Add gettext call to 2 'failed' messages
Noticed-by: Vojtěch Gondžala <vogo@seznam.cz>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-16 17:44:21 -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
Dan McGee eca30ed66a Merge branch 'maint'
Conflicts:

	contrib/gensync
	contrib/updatesync
2008-02-05 19:31:23 -06:00
Chantry Xavier b29838c825 Don't follow symlinks with -Qo.
Fixes FS#9473 and the issue reported there :
http://www.archlinux.org/pipermail/pacman-dev/2008-February/011061.html

Only the dirname should be resolved, not the basename.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-05 19:19:17 -06:00
Dan McGee 7d7a337912 pacman/util.c: add mdirname function
This function mirrors mbasename and will be used by the 'owns' machinery.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-05 19:18:44 -06:00
Dan McGee 93a3050ed9 Remove "Installed Size" hackeration
Keeping this hack around where installed size is only shown if it is
greater than total download size encourages broken repository databases.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-05 18:34:03 -06:00
Chantry Xavier 96ee1bca24 Clarify the "failed to add target" errors.
Make the error message printed when addtarget fails consistent between
add.c, remove.c and sync.c.

The main problem was that the "failed to add target" in case of a removal
operation could sound confusing.  There was also a little output problem
with -U ("failed" was missing).

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-02 18:55:24 -06:00
Nagy Gabor 1fc83f4af6 pmsyncpkg_t cleanup
Fix for sync044.py and reason001.py.
Rename sync->data to sync->removes (alpm_list_t *)
Replace pmsynctype_t sync->type by pmpkgreason_t sync->newreason

The type field was set to UPGRADE or DEPEND or REPLACE.
Instead of using type = UPGRADE or DEPEND, we now rather use a
"pmpkgreason_t newreason" field directly (= explicit or depend) which allows
a better handling of the install reason.
And the REPLACE type is now deduced implicitly when the sync->removes list
is not empty.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-27 12:05:33 -06:00
Dan McGee 9fbb77c91b Merge branch 'maint' 2008-01-27 11:54:52 -06:00
Chantry Xavier 0775c38e72 Clarify the "cancel current operation" message.
Fixes FS#9295.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: 'new pacman' -> 'new pacman version']
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-27 11:50:30 -06:00
Chantry Xavier bd43a7f155 testdb : add conflicts checking.
Testdb will now scan the local database to check there are no conflicts.
I'm not sure how it's possible to get this situation. At least pacman
doesn't allow installing a package that conflicts with a local one, without
removing the local one. But maybe in a very weird situation, or because of
a bug, it could be possible.  But anyway, this only requires 5 lines of
code.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-23 20:12:50 -06:00
Dan McGee cbcf542ad2 Merge branch 'maint' 2008-01-21 19:42:08 -06: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
Chantry Xavier b2914bf0af Move the deptest code from frontend to backend.
The deptest code (pacman -T) used by makepkg was mostly in the frontend.
There were 2 drawbacks:
1) the public splitdep function returns a pmdepend_t struct, but the
_alpm_dep_free function for freeing it is private. So there was a memleak.
2) there is a helper in the backend (satisfycmp in deps.c) which makes this
function much easier.

So this adds a new public alpm_deptest in libalpm/deps.c, which cleans
pacman_deptest in pacman/deptest.c a lot.
Besides, alpm_splitdep was made private, because the frontend no longer
requires it, and _alpm_dep_free is also private.
Finally the deptest001 pactest was extended.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-21 19:35:43 -06:00
Chantry Xavier bba62655fe two string fixes.
* added a newline to a conflict message in add.c
* removed the trailing dot in a replace message in callback.c.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-20 14:30:33 -06:00
Dan McGee ba7687f58e Remove frontend translation of "debug:" message
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-20 12:32:44 -06:00
Dan McGee 38e981fab3 Merge branch 'maint' 2008-01-14 22:58:44 -06:00
Chantry Xavier 307f4d7301 Revert "Fix case where pacman asks for confirmation when it should not"
yesno function already handles noconfirm. No need to do it twice.

This reverts commit dffa0654f2.
2008-01-14 21:38:36 -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 521de7ceed Merge branch 'maint' 2008-01-13 12:27:17 -06:00
Allan McRae 47e8dd0670 Notify of package replacements when using noconfirm
Fixes FS#5179.  Prints a notification of package replacements
when updating the packages using the --noconfirm flag.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 12:21:36 -06:00
Dan McGee 2630556bde Merge branch 'maint' 2008-01-11 23:19:52 -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 ccc1c73152 Use dynamic string allocation in package structures
This also affects all structures with static strings, such as depmiss,
conflict, etc. This should help a lot with memory usage, and hopefully make
things a bit more "idiot proof".

Currently our pactest pass/fail rate is identical before and after this
patch. This is not to say it is a perfect patch- I have yet to pull valgrind
out. However, this should be quite safe to use in all situations from here
on out, and we can start plugging the memleaks.

Original-work-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11 00:01:58 -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
Chantry Xavier 47761d5aec Move the fallback on providers from backend to frontend.
This reverts commit e28973169d.
This code might fit better in the frontend than in the backend finally.
Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-November/010150.html

I also changed it for fixing FS#8763 :
if there is exactly one provider, pacman will pull it and print a warning.
if there are several providers, pacman will list them and fail. It's up to
the user to pick one. Add sync501 pactest to reflect that.
2008-01-09 18:33:11 -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
Karolina Lindqvist dffa0654f2 Fix case where pacman asks for confirmation when it should not
There is another case where pacman-git asks for confirmation, when it should
not. It is when removing packages. If running with makeworld --noconfirm
--rmdeps the question will come to the log file, and never appear on the
console, so you can wait forever wondering what is happening.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-29 12:42:45 -06:00
Nathan Jones 7fdb2ee48a Check ignored packages in _alpm_sync_addtarget().
This will allow someone to install a group but ignore individual
packages inside the group.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:09:24 -06:00
Chantry Xavier b4a84e4f1d testdb : fix wrong usage of checkdeps.
During last rebase where the checkdeps prototype changed, I messed up the
arguments order (remove list, then upgrade list). That made testdb totally
useless.
Also remove the newline that was manually added by the log callback.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:05:44 -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