Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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 49197b7492d61bf1fc6bef59a708f4f586f32edb)
|
|
* mainly code cosmetics (indent fixes)
* remove debug message "spam"
* print also user friendly result
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: a few more whitespace/linebreak cleanups added]
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This change is similar to the one made in
3017b71cb5cde3aef7e0efb5f49843cccf759956.
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Noticed-by: Vojtěch Gondžala <vogo@seznam.cz>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
This function mirrors mbasename and will be used by the 'owns' machinery.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
* 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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
yesno function already handles noconfirm. No need to do it twice.
This reverts commit dffa0654f2eae1c427a74c647d22f0bbd201ccf7.
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
This reverts commit e28973169d2e5eda8b64ebdda11ece0dc761d978.
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.
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
[Dan: remove unused variable, make parseconfig static]
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Fixes FS#7147. Do not ask about upgrading pacman when -w and -p
flags are used.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Thanks to Allan for inspiring all this work on what was one little TODO item
in the codebase. :)
Change changelog handling so we can now dump a changelog from both installed
packages and package files (fixes FS#7371). We do this by moving all of the
machinery to the backend where it should have been in the first place.
The changelog reading is now done through a open/read/close interface
similar to the fopen/fread/fclose functions (can you guess how it is done?).
It is buffered by the frontend, so programs using the library can read as
much or as little as they want at a time.
Unfortunately, I could not implement a changelog_feof function due to some
shortcomings of libarchive. However, I left the stub code in there,
commented out, in case it becomes possible later or anyone wants to take a
stab at it.
Original-work-by: Allan McRae <mcrae_allan@hotmail.com>
Improved-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This feature (introduced by b118ce55bd01c7ebd42b5b6d4a0f34aa925701d8 as a
part of -Sc) could actually be helpful in the 3.0 -> 3.1 transition, because
all sync dbs will be left in /var/lib/pacman/, while the updated ones will
go to /var/lib/pacman/sync/.
So it'll now clean everything in /var/lib/pacman/, and only the unused
databases in /var/lib/pacman/sync/ (with the exception of local/ and sync/
in both cases).
Note: This feature is undocumented. I wonder if moving it to another option,
something like -S --dbclean, wouldn't help for documenting it.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Also perform the updates in the message files so we don't break
translations.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This fixes the output issue related to the progress bar by delaying the
output. We can decide later (post-release) if we like this method or we want
to switch to something else.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: just some minor cleanups]
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This should simplify our output a bit when it comes to determining whether
or not we need a newline in our output. A "done" message was almost always
immediately followed by another start message anyway (or some other output),
so it really isn't necessary.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
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>
|
|
dump_pkg_sync is now a trivial wrapper for dump_pkg_full
Some smaller changes:
* string_display function added to util.c [prints None in case of empty string]
* Filename field added to -Qip
* rename License to Licenses
* 'Compressed Size' used instead of 'Download Size' for -Qip
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix whitespace errors, spacing issues, const modifiers]
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This should reduce the chances of people thinking pacman hung during the
middle of something.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
I didn't understand why realpath was called on every files of every filelist
in query_fileowner :
ppath = resolve_path(path);
It turns out this is needed for the diverted files. For example, cddb_get
installs /usr/lib/perl5/site_perl/5.8.8/CDDB_get.pm which actually ends in
/usr/lib/perl5/site_perl/current/CDDB_get.pm .
And for making pacman -Qo /usr/lib/perl5/site_perl/current/CDDB_get.pm ,
realpath has to be called on both the target, and the file in the filelist.
However, realpath is costly, and calling it on every single file resulted
in a poor -Qo performance. Worst case :
pacman -Qo /lib/libz.so.1 0.35s user 1.51s system 99% cpu 1.864 total
So I did a little optimization to avoid calling realpath as much as
possible: first compare the basename of each file.
Result:
src/pacman/pacman -Qo /lib/libz.so.1 0.24s user 0.05s system 99% cpu 0.298
total
Obviously, the difference will be even bigger at the first run (no fs
cache), though it's quite scary on my system : 1.7s vs 40s previously.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|