Commit Graph

71 Commits

Author SHA1 Message Date
Dan McGee cdbb90aceb Show 'Required By' in -Sii output
Just as we do in -Qi, we can compute required by information for sync
database packages. The behavior seems sane; for a given package, the -Sii
required by will show all packages in *any* sync database that require it.

Implements FS#16244.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-23 22:24:14 -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
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 c72b4543b6 Update copyright headers and messages
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 02:08:33 -05:00
Nagy Gabor a783f3fbf1 Introduce -Qlq
With --quiet flag, -Ql doesn't print the package name, just lists the files.
I made --quiet documentation up-to-date (I also added -Sgq/-Qgq).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 21:36:43 -05:00
Nagy Gabor 4da70d800a Rename alpm_get_md5sum to alpm_compute_md5sum and alpm_dep_get_string to alpm_dep_compute_string
This patch introduces the following function name convention:
_compute_ in function name: the return value must be freed.
_get_ in function name: the return value must not be freed.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 23:59:30 -06:00
Xavier Chantry 95ea6fb3c1 Separate targets on -Qi/-Si with a newline.
This fixes FS#11331

The newline was lost with commit 9451b2e4f2.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-08-28 20:55:26 +02:00
Nagy Gabor e27a8c9ae3 Add new list_display_linebreak function
list_display puts several members on the same line, which is not appropriate
for optdepends:

Optdepends: foo: feature1  bar: feature2  baz: feature3

The new list_display_linebreak function puts every member on its own line,
which is much better with optdepends:

Optdepends: foo: feature1
            bar: feature2
            baz: feature3

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xav: implement this new behavior as a new function rather than as a
parameter of list_display]
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:38:18 -05:00
Nagy Gabor 9451b2e4f2 Move the the description parsing logic to string_display()
So dump_pkg_full will indent all strings correctly.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xav: add string_length function]
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:38:11 -05:00
Dan McGee 29bf6814f7 Use access() instead of stat() when possible
We were using the stat() system call in quite a few places when we didn't
actually need anything the stat struct returned- we were simply checking for
file existence. access() will be more efficient in those cases.

Before (strace pacman -Ss pacman):
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 33.16    0.005987           0     19016           stat64

After:
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 34.85    0.003863           0     12633         1 access
  7.95    0.000881           0      6391         7 stat64

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-15 22:52:27 -05:00
Xavier Chantry 5ae02e6ae7 Don't display filename on -Qip operation.
Some previous commits apparently broke the get_filename function for package
loaded with pkg_load (on a -Qip operation) because this field was no longer
filled. Now pkg_load fills it.
But the -Qip operation needs to be run like this : -Qip <filename>, so the
filename is already known. There is no need to display it again.
Besides, on a normal -Qi operation, the filename is not displayed either
because this information is not stored in the local database.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-04 16:25:31 -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 a13bf74979 pacman-side code cleanups
When taking a look at PATH_MAX usage, I found a few small things we can
clean up or fix.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:58:33 -05: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 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 7249c08bdf Improve changelog handling through addition of open/read/close functions
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>
2007-12-09 11:33:08 -06:00
Nagy Gabor c15f7710de Unify dump_pkg_full in pacman [-Si, -Qip, -Qi and -Qii]
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>
2007-12-01 11:58:07 -06:00
Dan McGee 5c21f0f152 Move requiredby computation before any display starts
This should reduce the chances of people thinking pacman hung during the
middle of something.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-29 16:16:13 -06:00
Dan McGee e174865bdc Don't filter package files output based on dir/file status
This caused more problems than it solved, especially with -Qlp output
and files that are new to the new package.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18 12:36:44 -06:00
Dan McGee 2322909703 War on whitespace
Run the kernel's cleanfile script on all of our source files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16 20:18:45 -06:00
Dan McGee 2f55733be3 Ensure -Si and -Qi output show correct dependencies
Because alpm_pkg_get_depends() no longer returns strings as the data, we
need to first convert the returned structures to printable strings before
we can print the list.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 22:52:26 -06:00
Dan McGee 7219326dd4 Remove REQUIREDBY usage from libalpm
Instead of using the often-busted REQUIREDBY entries in the pacman database,
compute them each time they are required. This should help many things:

1. Simplify the codebase
2. Prevent future database corruption
3. Ensure when we do use requiredby, it is always correct
4. Shrink the pmpkg_t memory overhead

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14 18:49:50 -06:00
Dan McGee 5e12d3dec9 Fix display of -Qip output when a package file is given
Too many fields were being shown on -Qip output, and sizes were not always
correct (-Qi and -Qip output on the same package did not agree).

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

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08 23:18:07 -06:00
Aaron Griffin 47622eef4d Support for localized times in metadata
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970)
for use in builddate and installdate. This will only affect newly built
packages. Old existing packages with the text format are still supported, but
this is deprecated.

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

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Dan McGee fc0e83f05b Preliminary support for optdepends
Add some alpm functions for getting optdepends, have makepkg include them
in the PKGINFO file, and have a pacman -Qi operation display the raw string
as stored by libalpm.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-25 23:02:30 -05:00
Andrew Fyfe ba67fdae63 Remove support for SHA1 from pacman.
There's no need for a second hashing algorithm. MD5 serves the purpose
of verifying that a package file hasn't been corrupted during download.

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16 11:30:38 -04:00
Dan McGee 653fb8fe03 Remove 'buildtype' from libalpm and pacman
Remove unused buildtype field from pmpkg_t struct and anything associated
with it, as it is unused at the moment. If we need to readd it, it is an
easy revert of this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-11 23:36:13 -04:00
Chantry Xavier 89ed15c9c2 pacman/packages.c : print an error for files that can't be stated.
The -Ql operation is supposed to print all files but directories.
stat was used for detecting directories. However, when stat failed,
(because the file doesn't exist or is not readable), the files
were still displayed just like the others.

Now, these files are printed on stderr, with the corresponding error message.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-01 22:32:18 -04:00
Dan McGee 2bcecbd62c Remove unnecessary casts on malloc and elsewhere
We had many unnecessary casts, most of them dealing with malloc and
other memory allocations. The variable type should take care of it;
no need to do it explicitly. In addition, I caught a const error while
removing the casts.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14 03:16:55 -04:00
Dan McGee eeb38ef677 Remove 'removes' array from libalpm
We don't use this functionality for now, so get rid of it and the
functions associated with it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28 19:56:29 -04:00
Dan McGee 63588aff19 Remove output.c and output.h
One function was left in this set of files after the earlier cleansing, so
I moved yesno to util.c.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 19:20:46 -04:00
Dan McGee 8d46cf6651 Remove ERR calls from the code
All ERR() calls have been replaced with fprintf(stderr, ...).

Still to be done- fix all the newline issues that are sure to pop up. What fun!

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

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

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-25 11:07:48 -04:00
Dan McGee b65a81b8af Add replaces output to -Qi operation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-04 23:19:14 -04:00
Dan McGee 2f4c1fe647 * Updated Italian translation
Giovanni Scafora <linuxmania@gmail.com>
* long -> float conversion for package size output (which still may be the
  wrong size, this needs to be looked at)
2007-03-10 20:36:20 +00:00
Dan McGee 869e81e1cf This commit looks much more monumental than it is. Almost all just #include
reordering and adding ones that were forgotten (noticed when trying to
compile after reordering).

* Updated the HACKING file to include information on #include usage.
* print -> vprint in "making dir" function in pactest.
2007-03-05 22:13:33 +00:00
Dan McGee af5cbf3084 * Updated Italian translation
Giovanni Scafora <linuxmania@gmail.com>
* Fixed FS #6442 - don't list directories in -Ql output.
2007-03-01 04:51:24 +00:00
Dan McGee 03f034ef0e * Updated conflict checking one last time. You can finally have a file move
from one package to another seemlessly (knock on wood). This is implemented
  through the use of two skip lists in the trans struct- skip_add and
  skip_remove, which replace the former trans->skiplist.
* Removed an unnecessary function parameter, added a necessary one.
* If a package has no backup files, print '(none)' under the heading so it is
  more obvious.
* Updated my TODO list.
2007-02-20 02:14:27 +00:00
Dan McGee cd34ced4ad * strlen -> mbstowcs (multibyte str to wide char str) conversion where we
want the actual number of characters, not the number of bytes.
* Added a TODO to take care of later in scriptlet processing.
2007-02-14 15:54:35 +00:00
Dan McGee 8cb0758beb * Fixed an i18n bug; length of description string was hardcoded previously;
now uses an strlen call.
* Updates of the *.pot files.
2007-02-12 15:39:29 +00:00
Dan McGee 306914793c Fix newlines for real, and add a missing _() gettext wrapper. 2007-02-08 01:12:48 +00:00
Dan McGee 4de804d157 * Makepkg updates, and small bugfix on man page compression.
* Change libtool default to makepkg2 behavior.
* Other small changes.
2007-02-06 22:36:13 +00:00
Aaron Griffin 2e35d8c187 -Ql needs the 'root' prepended to each file 2007-02-01 02:16:13 +00:00
Dan McGee e668b47142 * Modified info query so it doesn't show more than available when querying a
package file.
2007-01-30 04:15:14 +00:00
Aaron Griffin e22336673a Dan McGee <dpmcgee@gmail.com>
* Lots of code cleanup, and type fixes
* Make 'makeworld' a bit more in-line with the other stuff
* Make -Si and -Qi operations appear the same
2007-01-26 02:13:16 +00:00
Aaron Griffin e1bad6ef84 * Dan McGee <dpmcgee@gmail.com>
Newlines were included in both setting the string
    variable and in the printf, remove the extra ones.
2007-01-22 08:52:18 +00:00
Aaron Griffin eb03fe80e8 Removed list.h 2007-01-22 08:46:12 +00:00