1
0
forked from mirrors/pacman

Compare commits

..

711 Commits

Author SHA1 Message Date
Dan McGee
92630c6607 Bump pacman versions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 10:40:05 -05:00
Dan McGee
656b470163 contrib/Makefile.am: don't simplify what you don't understand
This was totally screwed under a 'make distcheck' invocation. Bring it
inline with what we have (and what works!) in scripts/Makefile.am. This
was broken/introduced in commit 05f0a28932.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 10:38:35 -05:00
Dan McGee
9ae6ee0f09 Updated translations for 3.5.0 from Transifex
Thanks to all translators that contributed!

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16 10:30:02 -05:00
Dan McGee
36c570712a Fix value of ngettext() count parameter in callback
I was awesome and ran alpm_list_count() on an empty list. Fail.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 15:34:30 -06:00
Allan McRae
36df611203 Update NEWS for pacman-3.5 release
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 13:59:34 -06:00
Allan McRae
21f16fa7ab Document API changes for pacman-3.5 release
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 13:55:15 -06:00
Allan McRae
f2023176f6 Do not print warning with files entry in sync db
repo-add can add a "files" entry into the sync db.  Currently we
do nothing with this file, so explicitly skip it to prevent
unknown database file warnings.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07 13:54:38 -06:00
Dan McGee
0b6aa428cf Fix gettext plural detection
Our keywords were all screwed up in this regard. Fix it so our
ngettext() shortcut calls are actually recognized and respected.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-03 11:10:14 -06:00
Xavier Chantry
79f8cfb529 libalpm/diskspace.c: remove bogus parenthesis
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-01 18:16:52 -06:00
Dan McGee
d68635e7c2 pactest: use actual regexes in OUTPUT rules
I managed to just make deptest001.py fail by changing a DEBUG-level
logger in commit b12be99c89. This should not be this fickle. Enhance the
OUTPUT rule to use an actual Python re object when looking for matches,
and make a lot of the rules use stronger patterns to match with.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-01 14:24:13 -06:00
Dan McGee
b12be99c89 Ensure d_type is not DT_UNKNOWN before relying on it
Fixes FS#23090, a rather serious problem where the user was completely
unable to read the local database. Even if entry->d_type is available,
the given filesystem providing it may not fill the contents, in which
case we should fall back to a stat() as we did before. In this case, the
filesystem was XFS but there may be others.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-01 13:39:43 -06:00
Dan McGee
09ce8b446c Fix some easy to find double translations
A lot of these were places that should have used the same message but
didn't, or were very easy to convert to using the same message and
letting some of the burden off of the translators.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 17:50:23 -06:00
Dan McGee
07538b948a Update translation template files
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 11:11:19 -06:00
Dan McGee
aafb387455 Merge branch 'maint' 2011-02-28 11:08:08 -06:00
Dan McGee
23451e7fa4 Update translation instructions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 11:08:01 -06:00
Jakob Gruber
dcd234ea27 --print-format displays size in bytes
Printing the exact size seems to make more sense for scripting contexts.

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
[Dan: adjust for master before VerbosePkgLists patches, fix type]
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:54:33 -06:00
Jakob Gruber
1a524fa8b8 A couple of minor manpage adjustments
Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:48:51 -06:00
Dan McGee
f45369800a Check local DB version before continuing transaction
Ensure we have a local DB version that is up to par with what we expect
before we go down any road that might modify it. This should prevent
stupid mistakes with the 3.5.X upgrade and people not running
pacman-db-upgrade after the transaction as they will need to.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:46:00 -06:00
Dan McGee
5ea4706f57 Move locking functions to where they are needed
We only call these from the transaction init and teardown, so move them
to that file, mark them static, and push more of the logic of handle
manipulation into these functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:43:36 -06:00
Dan McGee
1eccae3d93 Fix trans no-argument function definitions
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28 10:41:32 -06:00
Dan McGee
2d25993d2d Add base transifex client configuration
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 14:01:26 -06:00
Jonathan Conder
acd9269478 Fix double close of the lock file
According to FOPEN(3), using fclose on an fdopen'd file stream also
closes the underlying file descriptor. This happened in _alpm_lckmk
(util.c), which meant that when alpm_trans_release closed it again, the
log file (which reused the original file descriptor) was closed instead.

Signed-off-by: Jonathan Conder <jonno.conder@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 13:32:41 -06:00
Allan McRae
e8f799ba83 pactest for removing a required empty directory
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-27 13:26:56 -06:00
Dan McGee
3149a45bfb Add directory name to ownership error message
If you were doing a -Qo via xargs, it is at least nice to see what input
caused the error message to occur rather than having a bunch of plain
messages. This matches the style when we can't find the owner of a file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 09:48:20 -06:00
Dave Reisner
1fcc496756 alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcache
This avoids needless breakage of the public API.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 09:46:36 -06:00
Dave Reisner
eefe8c8364 alpm: remove public visibility of pmpkghash_t
There's no API functions exposed which allow manipulation of this type,
so remove it from public view. Also, rename the public and private
alpm_db_get_pkgcache symbol to alpm_db_get_pkgcache_has.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 09:45:13 -06:00
Dan McGee
ab49bf6fa9 Add test case for util-linux/util-linux-ng name switch and deps
This case currently fails, but highlights a failure in our install
process I experienced the other day. Because we don't do replacement
uninstalls inline with the rest of the upgrade uninstalls, we can have a
time on our system where a critical package is not installed.

I hope no one ever renames glibc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 07:57:41 -06:00
Dan McGee
2f96764058 Continue resolving dependencies rather than bailing on first error
This allows error messages emitted by the frontend to be a bit more
descriptive and not have the annoying "well why didn't you tell me that
the first time" problem. If a package had multiple missing deps, we
would bail on the first one before rather than finish processing all
missing dependencies, and only print one error message. Instead,
continue through this entire set of missing deps and append all eventual
errors.

The added pactest tests this case, as the to be installed package has
two missing dependencies. However, pactest does not actually test or see
the difference in output from before and after, so it passes in both
cases, but it is clearly visible in the logs.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 07:55:16 -06:00
Dan McGee
d4d304cdb7 Various small spelling fixes and small tweaks
Nothing that changes behavior here. Spelling fixes and pushing a
variable down to the scope it is used.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25 07:53:11 -06:00
Dan McGee
7c14e48776 Mark log callback format string const
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-24 09:38:59 -06:00
Dan McGee
6735807c0f Remove trans->skip_add
This is old code that has since gone stale; we no longer ever add
anything to this list so no need to keep it around and check the
contents during extraction.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-22 16:48:51 -06:00
Dan McGee
cfa7602032 Don't generate filelist unless we are going to use it
We throw it away if !full, so no need to waste time creating the list in the
first place.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-16 20:57:07 -06:00
Dan McGee
00c393d49f Conflict checking code cleanup
* Make conflict_isin() static; it is used nowhere else.
* Remove does_conflict(): it turns out to be replaceable by a single call to
  _alpm_depcmp(). By pushing it up, we can reduce calls to _alpm_splitdep()
  from 60,368 to 16,940 during one test -Su operation I ran.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-16 20:57:07 -06:00
Dan McGee
d1cc1ef6c3 Fix some database size estimation problems
* Use stat() and not lstat(); we don't care for the size of the symlink if
  it is one, we want the size of the reference file.
* FS#22896, fix local database estimation on platforms that don't abide by
  the nlink assumption for number of children.
* Fix a missing newline on an error message.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-15 16:58:08 -06:00
Pang Yan Han
62a2e45b12 Use CALLOC for _alpm_graph_new()
Change _alpm_graph_new() to use CALLOC to avoid explicit zeroing out of fields
in pmgraph_t.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-15 16:23:36 -06:00
Dan McGee
30f338cce6 diskspace: allow used flag to be toggled for both remove and install
Turn it into an enum rather than a boolean, and use a bitmask like we do for
reading DB entries. The relevant flag is turned on in our two calculate
loops, and anything reading the used flag later can decided which flag (or
either) is relevant.

This will allow the read-only partition code to be triggered on a
remove-only operation, e.g. if /boot was read-only and one tried to remove
grub in a sync transaction. Of course, right now, we don't actually run the
diskspace check code in the '-R' codepath.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:51:59 -06:00
Dan McGee
3afe3b6dfb Check mountpoint read-only status when checking space
This is a bit of a stopgap solution for the problem, but an easier one than
revamping the file conflict checking code to support the same stuff. Using
some more gross autoconf magic, figure out which struct field we need to
look at to determine read-only status and store that on our mountpoint
struct. If we find out we needed this partition after calculating size
requirements, then toss an error.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:38:58 -06:00
Dan McGee
1358a4a80f diskspace: use calloc instead of malloc
Prevents us from having to manually zero out several of our fields.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:36:41 -06:00
Dan McGee
0eac60cd9d Fix mount dir length calculation
In the getmntinfo() section, the local variable mnt doesn't exist; this
would have caused a compile error if I had tested the code on such a
platform. Unify both codepaths to just run strlen() on the already copied
mount path instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:34:37 -06:00
Dan McGee
06cbb516c3 Avoid a memmove by advancing value pointer
In packages, our description file contains:
key = value is here
type entries, and we passed "key " and " value is here" to our strtrim
function, causing us to always memmove the value portion to remove the
space. Since this is a throwaway buffer, do the advancing on our own before
trimming to save the need to shift memory around; "value is here" will now
be passed and strtrim will be responsible for trailing whitespace.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:23:43 -06:00
Dan McGee
56721c12ce Fix fileconflict progress with only one package
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:23:43 -06:00
Dan McGee
62fc966882 Ensure pkgbase/epoch are defined before doing anything
When generating integrity sums, we could get some weird output before due to
epoch being uninitialized:

    /usr/bin/makepkg: line 234: [[: 2.6.37: syntax error: invalid arithmetic operator (error token is ".6.37")

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-11 10:23:43 -06:00
Dan McGee
942bb9e64a Skip diskspace checking for symlinks and directories in all cases
We did this in some but not all cases, assuming the 0 value coming out of
libarchive would not be a problem. However, this does not work for "fake"
filesystems such as rpc_pipefs, which reports a free block and total block
count of zero.

Fix this by not ever counting symlinks or directories, and adding a note
explaining that if we someday do count directories, their size needs to be
attributed to the proper place.

This patch also includes a few cleanups/performance tweaks- avoid calling
strlen() on the mountpoint directory string as much by storing this size in
our mountpoint struct, and push the snprintf() call up to the calculate
functions since we were already doing it here in the remove case.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-08 09:28:24 -06:00
Pang Yan Han
da3b934602 Refactor out common code in pkghash add functions
The overlapping code in _alpm_pkghash_add() and _alpm_pkghash_add_sorted()
are now in a new static function pkghash_add_pkg(). This function has a
third flag parameter which determines whether the package should be added in
sorted order.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-07 20:26:11 -06:00
Pang Yan Han
be9a60a338 Handle null pkgcache for local/sync db_populate()
In sync_db_populate() and local_db_populate(), a NULL db->pkgcache is not
caught, allowing the functions to continue instead of exiting.

A later alpm_list_msort() call which uses alpm_list_nth() will thus traverse
invalid pointers in a non-existent db->pkgcache->list.

pm_errno is set to PM_ERR_MEMORY as _alpm_pkghash_create() will only return
NULL when we run out of memory / exceed max hash table size. The local/sync
db_populate() functions are also exited.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-07 20:21:34 -06:00
Allan McRae
bb071f4eb2 makepkg: more bash-3.2 compatibility
Adding the "|| true" to the subshell prevents bash-3.2 setting off the
error_trap but requires changing the if statement.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-06 12:52:59 -06:00
Dan McGee
3cf870eda5 Merge branch 'maint' 2011-02-06 12:52:20 -06:00
Pang Yan Han
3865352d23 Remove redundant _alpm_strtrim() in be_local.c
When reading the "desc" file in _alpm_local_db_read(), some
strings are trimmed and checked for length > 0 before their
use/duplication subsequently. They are then trimmed again
when there is no need to.

The following code snippet should illustrate it clearly:

while(fgets(line, sizeof(line), fp) &&
	strlen(_alpm_strtrim(line))) {

	char *linedup;
	STRDUP(linedup, _alpm_strtrim(line), goto error);
	info->groups = alpm_list_add(info->groups, linedup);
}

This patch removes the redundant _alpm_strtrim() calls in
_alpm_local_db_read() such as the one inside the STRDUP shown
above.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-06 12:50:46 -06:00
Pang Yan Han
30bb969ace Handle PM_ERR_WRITE in alpm_strerror()
PM_ERR_WRITE is defined in alpm.h but not handled in
alpm_strerror(). This patch corrects that.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 14:21:43 -06:00
Dan McGee
e17c4fe611 Add new translations from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 14:20:02 -06:00
Dan McGee
15e143bdfb Add updated Kazakh translation from Transifex
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 14:20:02 -06:00
Dan McGee
fafa909a2d Update translation file indexes and Makevars
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:15:51 -06:00
Dan McGee
7664a58d4e Add comment about download file resolution
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:15:22 -06:00
Dan McGee
e34fc4eddf Merge remote-tracking branch 'allan/hash' 2011-02-04 09:10:25 -06:00
Dan McGee
c12ccbfb2c Add more error checking and logging
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:00:47 -06:00
Dan McGee
7467fb9e76 Ensure found files are actually files
We located files in a few places but didn't check if they were files or
directories. Ensure they are actually files using stat() and S_ISREG(); this
showed itself when trying to download to the directory name itself in
FS#22645.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 08:42:55 -06:00
Dan McGee
6b0d4674bb Improve pkghash_remove algorithm
Rather than potentially move every item to the next NULL, attempt to move at
most one item at a time by iterating backwards from the NULL location in the
hash array. If we move an item, we repeat the process on the now shorter
"chain" until no more items need moving.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 10:03:04 +10:00
Dan McGee
1f145bcd1a Use alpm_list_remove_item in pkghash_remove
Removes the code that was duplicated and has now been refactored into a
separate method.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:46 +10:00
Dan McGee
14fd1e63a2 Add new alpm_list_remove_item() function
This takes in the list and a list item, and does the pointer dance necessary
to remove it from the list regardless of whether it is first, last, or
somewhere in the middle. It is useful for callers that already know what
item needs to be removed and have a pointer to it rather than doing a search
by data that the plain alpm_list_remove() does.

Refactor alpm_list_remove() to use this function as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:46 +10:00
Dan McGee
09e582b411 Add a new removal smoke test
Hint: this will really stress hash table removal.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:46 +10:00
Allan McRae
01c3c7e4f2 Actually remove packages from pkghash on removal
Fully removes a package from the hash.  Also unify prototype with
removal from an alpm_list_t, fixing issues when removing a package
from the pkgcache.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
11e5e86151 Refactor finding position for new hash entry
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
9320786349 Rehash efficiently
Rehash without recreating the hash table list or reallocating the
memory for holding the list nodes.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
c9820ec97b Slightly more efficient rehash size selection
While probably still not optimal in terms of everyday usage in
pacman, this reduces the absolute size increase to "more reasonable"
levels.  For databases greater than 5000 in size, the minimum size
increase is used which is still on the order of a 10% increase.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
d843c86b7b Error handling for maximum database size
Check that the requested size of a pkghash is not beyond the maximum
prime.  Also check for successful creation of a new hash before
rehashing.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Dan McGee
021085624e Change default sync hash table sizing to 66% full
Since the sync database never changes size once we initialize it, we
allow it to be filled a bit more. This reduces the overall memory
footprint needed by the hash table.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:45 +10:00
Dan McGee
ce54715112 Implement a quick and dirty rehash function
This allows us to get through the rehash required by smoke001 and pass
all pactests. It is by no means the best or most efficient
implementation but it does do the job.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
f8fdce6cb0 Read pkgcache into hash
Read the package information for sync/local databases into a pmpkghash_t
structure.

Provide a alpm_db_get_pkgcache_list() method that returns the list from
the hash object.  Most usages of alpm_db_get_pkgcache are converted to
this at this stage for ease of implementation.  Review whether these are
better accessing the hash table directly at a later stage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Dan McGee
5dae577a87 Get estimated package count when populating databases
This works for both local and sync databases in slightly different ways. For
the local database, we can use the directory hard link count on the local/
folder. For sync databases, we use the archive size coupled with some
computed average per-package sizes to determine an estimate.

This is currently a dead assignment once calculated, but could be used to
set the initial size of a hash table.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
e17b0446bd Add a hash table for holding packages
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-02-04 09:55:45 +10:00
Allan McRae
f892775366 makepkg: initialize local arrays to empty
Fixes bash-3.2 compatibility.

Thanks-to: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 20:47:08 -06:00
Allan McRae
35a8cf134b makepkg: error on invalid optdepends
Missed in commit a88cb03a.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:47 -06:00
Cedric Staniewski
d8c4b12c66 makepkg: make SRCPKGDEST default to $startdir
The current behaviour, which is placing source packages in PKGDEST if
SRCPKGDEST is not set, is inconsistent with {SRC,PKG}DEST handling and
there is no real advantage in doing so.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:39 -06:00
Nezmer
332dd86912 makepkg: Fix the check for references to srcdir/pkgdir
At least in FreeBSD, find always returns 0 if it finds stuff
(imagine that). It doesn't care about the exit status of whatever is
passed to -exec.

This patch makes the checks compatible with this behaviour.

Using xargs and not using grep directly because packages with too many
files would cause grep to complain about argument list being too long.

This should also fix the false positive in packages with no files.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-02 18:46:23 -06:00
Cedric Staniewski
3444146b48 makepkg: fix indention to follow style guide
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-01 10:04:44 -06:00
Dan McGee
87240dae6d Fix locale.h/setlocale inclusion with --disable-nls
Noted in FS#22697. When I factored out _alpm_parsedate() into a common
function, I didn't move the <locale.h> include properly, causing a build
failure when NLS is disabled and this header isn't automatically included
everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-01 09:59:12 -06:00
Florian Pritz
111e07d0be make -d less strict; add -dd option
-d skips checking the version of a dependency.

-dd skips the whole dependency check.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 10:49:53 -06:00
Xavier Chantry
b6ec9019d7 alpm/depcmp: new NODEPVERSION flag
This flag allows to disable version checking in dependency resolving
code.

depcmp_tolerant respects the NODEPVERSION flag but we still keep the
original strict depcmp. The idea is to reduce the impact of the
NODEPVERSION flag by using it in fewer places.

I replaced almost all depcmp calls by depcmp_tolerant in deps.c (except
in the public find_satisfier used by deptest / pacman -T), but I kept
depcmp in sync.c and conflict.c

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 10:49:39 -06:00
Xavier Chantry
b8d01dace8 add pactests for -Sdd
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 10:45:36 -06:00
Dan McGee
09f9f24331 Allow both cleanmethod values to be specified at the same time
No reason to disallow this- it allows keeping even more packages around in
the cache. Test cases included for this case and to ensure the default
behavior is preserved.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:38:14 -06:00
Dan McGee
986edb8bd4 Style cleanups in clean cache code
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:37:20 -06:00
Dan McGee
d6a9436143 Add three clean cache tests
The first two are rather standard tests of our two available clean options,
and the third is attempting to test a reported bug (and failing to make the
given case fail).

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:37:20 -06:00
Dan McGee
2d5ec02d7c pactest: allow checking for cache file existence
This will allow some tests to be added for cache cleaning.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:37:20 -06:00
Xavier Chantry
ed1aef7bc5 libalpm: fix db_update documentation
return codes were mixed up

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31 09:36:30 -06:00
Dan McGee
2e1b5c96a6 Call count() once in callback
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29 13:34:51 -06:00
Xavier Chantry
e263cf7231 alpm: drop old target interfaces
It's likely that these interfaces will break sooner or later, now that
pacman no longer uses them.

So better force the two people who use them to migrate their code to the
new add_pkg/remove_pkg interface, which is very easy anyway.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:08 +01:00
Xavier Chantry
05f2abfba9 select_display: per-database output
This function is used both for provision and group selection. Now the
database name will be displayed.

$ pacman  -S base-devel
:: There are 11 members in group base-devel:
:: Repository testing
   1) make
:: Repository core
   2) autoconf  3) automake  4) bison  5) fakeroot  6) flex  7) gcc  8) libtool  9) m4  10) patch  11) pkg-config
Which ones do you want to install?
Enter a number (default=all):

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:08 +01:00
Xavier Chantry
2dd53e50de pacman: improve select-question
Make use of parseindex like in multiselect, and loop until we get a
valid answer like in multiselect.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:07 +01:00
Xavier Chantry
00fec5e250 pacman/sync: implement interactive group selection
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:40:07 +01:00
Xavier Chantry
2a90dbe3a8 alpm: deprecate old interface
Old interface is marked as deprecated:
int alpm_sync_target(char *target);
int alpm_sync_dbtarget(char *db, char *target);
int alpm_add_target(char *target);
int alpm_remove_target(char *target);

New recommended interface:
int alpm_add_pkg(pmpkg_t *pkg);
int alpm_remove_pkg(pmpkg_t *pkg);

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:39:06 +01:00
Xavier Chantry
eed7ba92e8 pacman/remove: switch to new alpm_remove_pkg interface
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:39:05 +01:00
Xavier Chantry
4a72c0964a pacman/upgrade: switch to new interface
Note that there is a behavior change here : if the same package name
appeared several times in the target list, the alpm_add_target interface
chooses the new package, while alpm_add_pkg returns PKG_DUP.

I don't see why we cannot unify the behavior of -S and -U, and just
choose one behavior that applies to both.

Otherwise, it's always possible to handle these different behaviors in
the frontend, it just requires more work.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:16 +01:00
Xavier Chantry
953e0d48d7 alpm: new alpm_remove_pkg interface
For consistency with alpm_add_pkg.

The new recommended interface is alpm_add_pkg / alpm_remove_pkg, all
others interfaces are deprecated.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:16 +01:00
Xavier Chantry
f2fcf7eeb1 pacman/sync: rewrite target handling
This uses the new public functions to handle targets from the frontend,
like it used to be :
1) alpm_find_dbs_satisfier to find (optionally versioned) package or
provision
2) alpm_find_grp_pkgs to find members for a groups
3) alpm_add_pkg to finally add the pmpkg_t from 1 or 2

Of course, this adds more code to the frontend, but it completely
deprecates sync_target and sync_dbtarget interfaces.

This all-in-one interfaces felt wrong and left no control to the
frontend. A good frontend should just use alpm_add_pkg, with pkg coming
from alpm_db_get_pkg (for normal targets), alpm_find_dbs_satisfier (for
versioned provisions) or alpm_find_grp_pkgs (for groups).

This also opens the way to provide a better group handling in pacman
without constraint from libalpm and callbacks.

In ignore006, only the retcode changes, because no package was found to
satisfy the target (the only possible package is ignored).

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:16 +01:00
Xavier Chantry
1767a569c6 alpm: add alpm_find_grp_pkgs
This group function is meant to help group handling from frontend : it
scans all dbs, handling ignored packages and duplicate members (the
first repo where a member is found has the priority).

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:16 +01:00
Xavier Chantry
fb7e1b4b9b alpm: new alpm_add_pkg interface
This new function is meant to deprecate all existing
sync/add target functions :
int alpm_sync_target(char *target);
int alpm_sync_dbtarget(char *db, char *target);
int alpm_add_target(char *target);

Rather than dropping these 3 interfaces, it might be better to rewrite
them using alpm_add_pkg for now.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:15 +01:00
Xavier Chantry
b8590ed634 alpm/dep: add alpm_find_dbs_satisfier
This is a public interface for resolvedep. It looks nicer to expose it
this way rather than through sync_target.

This function can also be helpful for external tools as it should give
good results close to how pacman select a package for satisfying a given
dep.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:15 +01:00
Xavier Chantry
4097c98c1e Add interactive provider selection
If there are multiple providers in one db, pacman used to just stop at
the first one (both during dependency resolution or for pacman -S
'provision' which uses the same code).

This adds a new conversation callback so that the user can choose which
provider to install. By default (user press enter or --noconfirm), the
first provider is still chosen, so for example the behavior of sync402
and 403 is preserved. But at least the user now has the possibility to
make the right choice in a manual run.

If one of the provider is already installed, it is picked for
reinstall/upgrade, so that provision 002/003 pactest now pass.

$ pacman -S community/smtp-server
:: There are 3 providers available for smtp-server:
   1) courier-mta  2) esmtp  3) exim

Which one do you want to install?
Enter a number (default=1):

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29 19:33:15 +01:00
Dan McGee
ba97a22ce1 Merge branch 'maint' 2011-01-29 12:16:11 -06:00
Dan McGee
ce089e1b97 pactest: pass entire test to rule.check()
We were piecemeal passing fields from the test object in and it was getting
out of hand, and future work would have added yet another argument. Instead,
just pass the entire test object and entrust the rule to get what it needs.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29 12:15:15 -06:00
Dan McGee
ef86da97f5 Remove need to explicitly register the local DB
Perform the cheap struct and string setup of the local DB at handle
initialization time to match the teardown we do when releasing the handle.
If the local DB is not needed, all real initialization is done lazily after
DB paths and other things have been configured anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29 12:13:56 -06:00
Dan McGee
9b876fff09 Ignore known but unused package descfile fields
We explicitly place 'pkgbase' (and used to place 'force') fields inside
PKGINFO files, so ignore them silently instead of printing an error for
them. Also make the error message for unknown keys actually contain the key.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 17:34:06 -06:00
Thomas Bächler
272f7cf25e libalpm: Fix a missing "nicht" (not) in German translation.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 16:41:21 -06:00
Dan McGee
f95080884c Enable failure on server error for curl download command
This will make a 404 a silent failure that returns an error code rather than
0 as was previously done, screwing up the logic used by pacman/libalpm to
allow moving onto the next server on a failed download. Fixes FS#22630.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 12:00:00 -06:00
Dan McGee
7f93f0620c Fix libtool performance regression with many arguments
Reported and fixed upstream, patching our version for now until a future
release fixes it:

* http://lists.gnu.org/archive/html/bug-libtool/2011-01/msg00007.html
* http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=286e87b1030c353d9cfc89dbb72d59e0391cb693

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-28 11:42:35 -06:00
Dan McGee
fe76c353af Fix memory leak and error code in DB reading
We were returning a package error code rather than a DB one, and we
would leak the archive memory if the database file didn't exist.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-24 21:46:42 -06:00
Dan McGee
0f24390fe8 pkgsearch: handle non-matching lines gracefully
Before any non-matching line would trigger some perl warnings about
undefined variables. If a line doesn't match, just show it to the user
unprocessed; this is seen with warning and error messages pacman not so
helpfully emits on stdout rather than stderr.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-24 15:20:10 -06:00
Dan McGee
d6a997ee38 Update contrib/ Makefile
We didn't have the proper dependencies specified for our scripts after
the move to *.in extensions, so a change to a file didn't trigger a
rebuild. Also remove old stuff from .gitignore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-24 15:19:14 -06:00
Dan McGee
27e8f06e03 Query fileowner performance improvements
Clean up some of the code by doing less string copying and printing. This is
accomplished by either doing it after we know we need it, or taking
advantage of the fact that some strings never change such as the root
directory prefix. Also, fix an issue where a file at the root level (e.g.
/foobar) could not be queried.

End result is a much faster user experience when combined with the
mbasename() changes. These timings are for looking up 113 files in /etc/,
some of which are owned and some which are not.

	$ find /etc -maxdepth 1 -type f | xargs time pacman -Qo >/dev/null
	6.10user 0.05system 0:06.17elapsed 99%CPU (0avgtext+0avgdata 131040maxresident)k
	0inputs+0outputs (0major+9436minor)pagefaults 0swaps

	$ find /etc -maxdepth 1 -type f | xargs time ./src/pacman/.libs/lt-pacman -Qo >/dev/null
	0.86user 0.04system 0:00.92elapsed 99%CPU (0avgtext+0avgdata 131120maxresident)k
	0inputs+0outputs (0major+9436minor)pagefaults 0swaps

I'll take a 600% increase in speed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:34:42 -06:00
Dan McGee
4d291508c2 Improve mbasename performance
Rather than roll our own, use strrchr() instead, which glibc may have a
better implementation than the simple iteration method we were using.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:34:42 -06:00
Dan McGee
d16a5ae7dd Merge branch 'backup-status' 2011-01-22 16:32:34 -06:00
Dan McGee
6e71922e6c Add a few new provides tests
These deal with already-installed packages and how they should be the
preferred provider in cases where provider selection now occurs. A few
involve multiple sync repos.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
a99e7272b8 pactest: sort repos by alpha order in config file
The order was non-deterministic before, and just happened to work for
sync023.py as it was written. Ensure there is some sort of predictable
ordering.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
b3d71bf7d0 pactest: use new-style python classes
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 16:29:32 -06:00
Dan McGee
cda7d7847f Be smarter about failure to read backup file contents
Instead of always printing MISSING, we can switch on the errno value set by
access() and print a more useful string. In this case, handle files we can't
read by printing UNREADABLE, print MISSING on ENOENT, and print UNKNOWN for
anything else. Fixes FS#22546.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:38:34 -06:00
Dan McGee
c91bd3dda9 Mark backup status strings as untranslated
And also change "Not Modified" -> "UNMODIFIED" for consistency. This makes
it a lot easier to machine-parse this and not worry about locale
differences.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:25:45 -06:00
Dan McGee
61864e1f6f Refactor backup file status check into separate function
This will make it a lot easier to use this stuff elsewhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:25:21 -06:00
Dan McGee
32727efc38 pactest: revamp modified logic
Remove all logic dealing with PKG_MODIFIED as this rule no longer exists.
This removes a bunch of unnecessary stat and checksum logic that most of the
time we were never even using. Also update the file modified checks to mark
every file created using mkfile() with an older time so any modified checks
will just work without hacks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:19:21 -06:00
Dan McGee
5699f2c94c Modify all pactests to not use PKG_MODIFIED
All conditions that this particular rule tested are better served by using a
more specific rule, whether that be checking a package version or whether
files inside the package have changed or still exist.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:19:17 -06:00
Dan McGee
2a3b5e40bc pactest: pylint changes for pmdb
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
8f711a7181 pactest: pylint changes for util
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
ff96649eeb pactest: pylint changes for pmtest
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
d94346ede2 pactest: pylint changes for pmpkg
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
946f4af7f3 pactest: pylint changes for pmrule
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
2c6be06bba pactest: pylint changes for pmenv
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
505ad87e67 pactest: pylint changes for pactest
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
0de314205f pactest: pylint changes for pmfile
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:14:42 -06:00
Dan McGee
36ea02cc48 Compute download size for sync packages only
Neither packages from files nor packages from the local database will ever
have a download size.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 11:11:29 -06:00
Dan McGee
c4332c8091 Merge branch 'maint' 2011-01-22 10:12:46 -06:00
Dan McGee
a97e28205a Update 3.4.3 release date
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:07:46 -06:00
Dan McGee
51175f31c4 Merge branch 'epoch-work' 2011-01-22 10:03:51 -06:00
Xavier Chantry
e277e838d7 Makefile: Use git describe --dirty for GIT VERSION
dirty indicates if the repo has uncommited changes or not when building,
so dont hardcode this info.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:57 -06:00
Allan McRae
b947db040c repo-add: only attempt to create deltas when asked
repo-add should only attempt to create the delta file when using the -d
option.

Also adjust a couple of tests to use the "double bracket" syntax.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:51 -06:00
Dan McGee
859bdb5b1d doc: update current list of authors
Allan, I had no idea you were not listed here. I think you count as an
active developer at the moment. Also, move Aaron to the past contributors
section.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:15 -06:00
Dan McGee
01403f423a doc: add a vercmp manpage
This includes info on version comparison that is very similar to the stuff
in the pacman manpage, but also a few vercmp examples, the return values,
and other fun stuff.

Also update the version comparison stuff in the pacman manpage.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:15 -06:00
Dan McGee
b8ab96a270 makepkg: encode epoch in version specifier if > 0
This makes things consistent with everywhere else we are incorporating the
new optional epoch field. Add a helper function that forms the version
string for you and use it in makepkg where I found 'pkgver.*-.*pkgrel'.

This exposes a few shortcomings in a previous "Override pkgver" patch
(2020e629) in the install package and check if built functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22 10:02:09 -06:00
Dan McGee
bf46e04614 Remove epoch as an independent field
Instead, go the same route we have always taken with version-release in
libalpm and treat it all as one piece of information. Makepkg is the only
script that knows about epoch as a distinct value; from there on out we will
parse out the components as necessary.

This makes the code a lot simpler as far as epoch handling goes. The
downside here is that we are tossing some compatibility to the wind;
packages using force will have to be rebuilt with an incremented epoch to
keep their special status.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee
5c46ba14f7 Allow version comparison to contain epoch specifier
Adapting from RPM, follow the [epoch:]version[-release] syntax. We can also
borrow some of their parsing code for our purposes (thanks!).  Add some new
tests to our vercmp shell script tester for epoch comparisons, and then make
the code work with these newfangled epoch specifiers.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee
e068b58507 pactest: add more testing for epoch
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee
50f446886b pactest: Rename epoch pactests
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 19:30:45 -06:00
Dan McGee
76735e6519 Copy new backend translation over from frontend translation
Since it is the same string. Done with some bash looping and sed magic.

    for src in po/*.po; do
        echo $src
        newtrans=$(grep -A1 "msgid.*$1" $src | tail -n1)
        newtrans=${newtrans//\\/\\\\}
        echo "$newtrans"
        fname=${src##*/}
        dest=lib/libalpm/po/$fname
        sed -i -e "/msgid.*$1/{N; s/msgstr.*$/$newtrans/}" $dest
    done

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 11:04:52 -06:00
Dan McGee
85d0111da8 3.4.3 release preparation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 10:36:51 -06:00
Dan McGee
3863e48788 Add a likely_pkg hint argument to sync_db_read
In most (all?) cases, we will process all files for a given sync database
entry sequentially. The code currently does an _alpm_pkg_find() for every
file in the database, but we had the "current" package readily available.
Shift some local variables around a bit to expose this to sync_db_read() and
use it if the package is the correct one.

On my system, this cuts calls to _alpm_pkg_find() from 20,769 to 10,349
calls during a -Qu operation, and results in a ~30% speedup of the same
operation (0.35 sec -> 0.27 sec). This benefit should be apparent anywhere
we read in the full contents of the sync databases.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 10:11:59 -06:00
Dan McGee
c86ff120c8 Improve splitname memory allocation
We don't need to create a temporary copy of the string if we are smart with
our pointer manipulation and string copying. This saves a bunch of string
duplication during database parsing, both local and sync.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
01c8f39ab8 Improve depends string parsing
Remove the need for an unconditional string duplication by using pointer
arithmetic instead, and strndup() instead of an unspecified-length strdup().
This should reduce memory churn a fair amount as this is called pretty
frequently during database loads.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
aff3e63c45 Add strndup fallback function to libalpm util
The same fallback we are currently using in the pacman frontend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:47 -06:00
Dan McGee
b40c8e2922 Update valgrind suppressions file
We haven't tweaked this in a while, but some of the old stuff seems to no
longer be necessary and there are a few new things we should add.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:14:18 -06:00
Dan McGee
c49f198042 Add a pactest for the situation in FS#7524
Confirming the current behavior. And yes, the error message is still no
better than it was when this was reported 3.5 years ago.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-21 09:07:12 -06:00
Dan McGee
f65edb7f29 Fix integrity check status when installing from file
When installing packages from a file, the integrity check count
stays at (0/x) complete.  This ensures it is bumped to (x/x) at
the end of the process.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-18 13:19:25 -06:00
Dan McGee
a88cb03a58 makepkg: perform all sanity checks before erroring out
It is pretty annoying to get one, fix it, and then get another. We should be
able to continue on through most of the sanity checks in one go so the user
gets all the error messages at once.

Also ensure $pkgbase is defined by the time we call this function;
previously we printed nothing where a package name should have been due to
this oversight.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-14 00:25:16 -06:00
Dan McGee
665528d7ba repo-add: fix misguided conditional correction
I tried to move things around here when testing and did a bit too much; the
warning message always showed regardless of delta inclusion in the call. Fix
it so we only warn if we have a filename, but the file couldn't be located.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-13 23:43:58 -06:00
Dan McGee
5615b71688 Merge branch 'maint'
Conflicts:
	lib/libalpm/be_files.c
2011-01-12 09:23:24 -06:00
Dan McGee
30f53cfe8d Fix double read issue in maint releases
This is essentially a backport/cherry-pick of commit 33240e87b9 from
master, but has to be done by hand because the DB format has diverged. Read
more in the commit message used there, which follows.

Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-12 09:17:22 -06:00
Dan McGee
cae2bdafec pactest: build the filelist using a set()
This will prevent duplicates, which we had plenty of once I made a few tests
that had a list of files greater than the normal two. The previous logic was
not working quite right.

Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 0d4dd09993)
2011-01-12 09:11:10 -06:00
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
9e8af82c97 Back out anticipated epoch changes
After all the debate as to what to do on maint, we are going to end up just
incorporating epoch into the version string, so we don't need this separate
field at all. Revert commit 5c8083baa4 and also kill the force flag we were
recording here as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 23:15:44 -06:00
Dan McGee
dd26592155 Merge branch 'diskspace-fixes' 2011-01-11 21:20:12 -06:00
Dan McGee
57c5afd69c Merge branch 'fix-double-load' 2011-01-11 21:20:10 -06:00
Dan McGee
0284cf2128 Merge branch 'repo-add-improvements' 2011-01-11 21:20:07 -06:00
Dan McGee
33240e87b9 Fix double filelist issue when upgrading a package
Due to the way we funk around with package data loading, we had a condition
where the filelist got doubled up because it was loaded twice.

Packages are originally loaded with INFRQ_BASE. In an upgrade/sync, the
package is checked for file conflicts next, leaving us in an "INFRQ_BASE |
INFRQ_FILES" state. Later, when committing a single package, we have an
explicit call to _alpm_local_db_read() with INFRQ_ALL as the level. Because
the package's level did not match this, we skipped over our previous "does
the incoming level match where I'm at" shortcut, and continued to load
things again, because of a lack of fine-grained checking for each of DESC,
FILES, and INSTALL.

The end result is we loaded the filelist twice, causing our remove logic to
iterate twice over the installed files, spewing a bunch of "cannot find file
X" messages.

Fix the problem by doing a bit more bitmasking logic throughout the load
method, and also fix the sanity check at the beginning of the function- this
should *only* be used for local packages as opposed to the "not a package"
check that was there before.

A debug log message was added to upgraderemove as well to match the one
already in the normal remove codepath.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:16:39 -06:00
Dan McGee
25fab402c7 Call archive_read_data_skip() while checking diskspace
libarchive eventually calls it anyway, but backtraces make a lot more sense
if we call it, as well as matching our precedent from alpm_pkg_load().

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
6942bba75d Add error message stating which partition is full
This is helpful anyway to the user, and should also be helpful to us if we
see problems cropping up in the check during development.

Also add a missing ->used = 0 initialization in the code path less taken.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
55bff19b76 Unify two free diskspace error messages
Although they won't be the same in the gettext catalog because of the '\n'
we should still use the same text.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:24 -06:00
Dan McGee
fe6e90c21f Add a progressbar for package integrity checking
This can take a while too, and it is really easy to add the necessary
callback stuff for adding a progressbar.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:10 -06:00
Dan McGee
9a82cb92a4 Small fix to download size lookup and a logger
These were just two small things I came across today and found could be
fixed or helpful, so I've added them and I'm not sure what else to bundle
them with. commit_count++

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 21:15:04 -06:00
Dan McGee
d0c327df17 doc: add docs for repo-add -d option
This never got added when the option was brought in, so fix it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 20:30:27 -06:00
PyroPeter
eda4d9ec00 repo-add: Create/modify files databases
Implements FS#11302.

Dan: updated docs to not reference pkgfile.

Signed-off-by: PyroPeter <abi1789@googlemail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 20:30:27 -06:00
Dan McGee
b04a56dbe9 Add two pactests with non-trivial file counts
These are probably useful anyway, but also exposed the double file list bug
that will be fixed in a later commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 18:44:26 -06:00
Dan McGee
0d4dd09993 pactest: build the filelist using a set()
This will prevent duplicates, which we had plenty of once I made a few tests
that had a list of files greater than the normal two. The previous logic was
not working quite right.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 18:43:28 -06:00
Dan McGee
7ce90bb135 repo-add: use pushd/popd
Rather than explicit cd calls, we can use the directory stack to our
advantage. This also removes the need to store and restore $startdir, so
kill the variable entirely.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11 17:18:46 -06:00
Dan McGee
a9cbd15260 pactest: correctly write epoch and force as necessary
We were missing this in a few places; also add the ability to check the
outcome via a new rule type.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:51:35 -06:00
Dan McGee
3e1bdfa93c Use double rather than float everywhere
No real need to use the smaller floating point types here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
5f140a62de Progress callback cleanups and fixes
* Remove a stale comment
* Fix a logic error- the conditional disagreed with the comments
* Remove some unnecessary floating point casts

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
842cbc9ea4 Ensure we use local package when calculating removed size
We were checking if a package existed locally, but then using the
incoming package to calculate removed size rather than the currently
installed package.

Also adjust the local variable in the replaces loop to make it more
clear that we are always dealing with local packages here.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:50:03 -06:00
Dan McGee
d03b57f459 Remove need for floating point division in backend
All of these can be done with integer division; the only slightly
interesting part is ensuring we round up like before with calling the
ceil() function.

We can also remove the math library from requirements; now that the only
ceil() calls are gone, we don't need this anymore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10 10:49:55 -06:00
Xavier Chantry
281a4c0a4f libalpm/be_package.c: fix small memleak
file_pkg_ops can be a static struct like in other backends, we just need
to initialize it at some point.

Dan: add initialization flag.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:27:39 -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
f966f3a834 Use size_t for alpm_list sizes
There is a lot of swtiching between size_t and int for alpm_list sizes
in the codebase.   Start converting these to all be size_t by adjusting
the return type of alpm_list_count and fixing all additional warnings
given by -Wconversion that are generated by this change.

Dan: a few more small changes to ensure things compile, adjusting some
printf format string characters to accommodate the larger size on x86_64.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 21:15:46 -06:00
Dan McGee
4bc6ed56aa Refactor old date parsing into single method
We've managed to duplicate this four times at this point, so make it a
method in util.c instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07 20:55:05 -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
Dan McGee
04dc87e012 vercmp: always return 0 if we perform a compare
And change the wording slightly to indicate we *print* a value, not *return*
it. You can't return negative values (they get coerced to 255), so it isn't
worth it to try and cram the result into the return code.

Acked-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 21:17:30 -06:00
Dan McGee
26652768d6 Remove FORCE reading from local DB
We never wrote it here, so no need to read it in either.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:56:06 -06:00
Dan McGee
46eda12c1b pactest: Use booleans where it makes sense
No need to use 0/1 when we can use False/True for the force option.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:55:57 -06:00
Dan McGee
e57c3efeaa pactest: remove dead function
Stopped being used after commit fa933df65b.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-05 20:55:13 -06:00
Dan McGee
c41edf49be Fix function indentation
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-02 12:25:33 -06:00
Dan McGee
08d885fda5 Merge branch 'maint'
Conflicts:
	lib/libalpm/sync.c
	test/pacman/tests/ignore007.py
2010-12-30 09:41:46 -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
Jakob Gruber
6ddc115c7f Respect Ignore{Pkg,Group} for group members
Fixes FS#19854.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:35:03 -06:00
Jakob Gruber
df360b791d Move group code to separate function
This makes the following commits more readable.
No logic was changed in this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:35:03 -06:00
Jakob Gruber
58ee249c86 Tests: Sync group which includes ignored pkgs
* FS#19854 (--ignore is ignored with groups)

* http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html
  (operation aborts when a package from a group is ignored/and user chooses
  not to install it)

If a group member is ignored, we expect
a) a question whether to install
b) after saying 'no' to a), the ignored member not to be installed
c) all other group members to be installed
d) pacman to execute successfully

Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 9d0b33fd33)
2010-12-30 09:35:03 -06:00
Jakob Gruber
cb7ba4e4e5 Add const to some ALPM function signatures
char * -> const char *.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30 09:25:16 -06:00
Dan McGee
e0d327462c doc: add website zip to clean files
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 20:06:40 -06:00
Dan McGee
619c165d36 Merge branch 'maint' 2010-12-29 19:28:46 -06:00
Allan McRae
2052f29cdb makepkg: add option to clear buildflags
Add the "buildflags" option, which is useful in its negative form
for disabling CFLAGS, CXXFLAGS and LDFLAGS when building a package.
This is useful when determining of one of these flags is causing
an issue with a package.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:28:33 -06:00
Allan McRae
0c29eb431a makepkg: Add check() function for running test suites
A PKGBUILD can have an option check() function for running test suites
between the build() and package() stages.  This function is run by
default but can be disabled globally in with "!check" in BUILDENV in
makepkg.conf. This setting can be controlled on an individual package
basis using makepkg's --check and --nocheck flags. Addition dependencies
needed for running the test suite can be specified in the checkdepends
array and are only checked when running the check() function.

Original-work-by: Jeff C <jeff@kcaccess.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:28:00 -06:00
Allan McRae
d227771464 Use limits.h for PATH_MAX
We use PATH_MAX everywhere by including limits.h so there is no
point in doing a check for it in a different header when dealing
with FreeBSD's libfetch.

Also, remove autoconf check for strings.h header as it is not used
anywhere.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:26:21 -06:00
Allan McRae
81dd9d3ebc Detect undefined PATH_MAX
POSIX does not require PATH_MAX be defined when there is not actual
limit to its value.  This affects HURD based systems.  Work around
this by defining PATH_MAX to 4096 (as on Linux) when this is not
defined.

Also, clean up inclusions of limits.h and remove autoconf check for
this header as we do not use macro shields for its inclusion anyway.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:24:13 -06:00
Allan McRae
fcc09bd7e3 Correct type for hash value storage
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:10:49 -06:00
Dan McGee
c002567d96 Various documentation updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 19:07:30 -06:00
Dave Reisner
bd98b93a6e makepkg: escape closing bash array paren for awk
The closing parenthesis of bash arrays needs to be escaped in the ending
address of awk expressions in order to play nicely with implementations
of awk other than gawk. This change provides compatibility with gawk,
nawk and mawk.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 18:44:46 -06:00
Allan McRae
eb93955477 makepkg: allow pkgname usage in split package functions
Currently, using $pkgname in a split package package_*() function
always returns the first value in the pkgname array rather than the
name of tha package being packaged.  Fix this so $pkgname gives the
expected value.

Fixes FS#22174

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29 18:44:32 -06:00
Dan McGee
a7972625e3 Merge branch 'depcmp-perf' 2010-12-29 18:43:47 -06:00
Dan McGee
a58083459b Merge branch 'fgets-perf' 2010-12-29 18:43:44 -06:00
Dan McGee
735a197fc2 Use name hashes in depends to avoid strcmp calls
Just like we did for package name comparsions, if we add a depend name_hash
field on depend struct initialization, we can use it instead of doing a
string name comparison, saving us a lot of checks in the depcmp code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 17:25:34 -06:00
Dan McGee
34a78d935a Remove need for memory allocation in _alpm_depcmp
Noticed when tweaking testdb, when we run _alpm_depcmp in loops and call it
seven million times, the strdup()/free() combo can add up. Remove the need
for any string duplication by some pointer manipulation and use of strncmp
instead of strcmp. Also kill the function logger and add an escape so we
don't needlessly retrieve the list of provides.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 17:25:02 -06:00
Dan McGee
e3c19569cf Add pactest to test long archive reads
This creates two packages with extremely long description lines (500KB and
600 KB), causing our archive read code to perform reallocation to store the
whole contents. One of the packages will successfully read while the other
will fail for the time being.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 14:58:17 -06:00
Dan McGee
fbcc427754 pactest: allow testing of package description
And modify the code to not print the full rule string if it is more than 40
characters long; truncate it instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 14:58:17 -06:00
Dan McGee
f2dff08600 Overhaul archive fgets function
The old function was written in a time before we relied on it for nearly
every operation. Since then, we have switched to the archive backend and now
fast parsing is a big deal.

The former function made a per-character call to the libarchive
archive_read_data() function, which resulted in some 21 million calls in a
typical "load all sync dbs" operation. If we instead do some buffering of
our own and read the blocks directly, and then find our newlines from there,
we can cut out the multiple layers of overhead and go from archive to parsed
data much quicker.

Both users of the former function are switched over to the new signature,
made easier by the macros now in place in the sync backend parsing code.

Performance: for a `pacman -Su` (no upgrades available),
_alpm_archive_fgets() goes from being 29% of the total time to 12% The time
spent on the libarchive function being called dropped from 24% to 6%.

This pushes _alpm_pkg_find back to the title of slowest low-level function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21 14:58:17 -06:00
Dan McGee
126f50ab0b testdb: update for new database format
Sync DB's no longer have an extracted directory, so remove the files check
for those. Local databases no longer have a 'depends' file, so kill that
check as well. Finally, do a little other cleanup and remove the need for
PATH_MAX.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 19:54:33 -06:00
Allan McRae
c78a808c49 Only check diskspace availability if needs more than zero
The amount of diskspace needed for a transaction can be less than
zero.  Only test this against the available disk space if it is
positive, which avoids a comparison being made between signed and
unsigned types (-Wsign-compare).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:34 -06:00
Allan McRae
a611879318 Always specify arguement type in function delcarations
Always declare a function with (void) rather than () when we expect
no arguements.  Fixes all warnings with -Wstrict-prototypes.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:21 -06:00
Allan McRae
5776090055 makepkg: remove last inappropriate PKGBUILD usage
We should always use $BUILDSCRIPT instead of PKGBUILD.  The only
remaining uses of PKGBUILD in makekg are in comments.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:03:01 -06:00
Dan McGee
8ac7f7e6e5 Use macros in sync DB parsing
This simplifies a lot of the repetative code and makes it obvious where the
tricky or different ones are (e.g. depends, dates). It also makes it
significantly easier to change the way this code works in the future.

There should be no functional change with this patch.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20 18:02:47 -06:00
Dan McGee
45146dccbb Merge branch 'maint' 2010-12-15 00:41:59 -06:00
Dan McGee
ab9c0814d2 Add a cushion for diskspace checking
It is the minimum of 5% of disk capacity or 20 MiB on a per-partition basis.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-15 00:41:41 -06:00
Allan McRae
6605637b53 Document PKGEXT and SRCEXT
Add some basic documentation for the PKGEXT and SRCEXT options in
makepkg.conf.  Fixes FS#21302.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-15 00:36:16 -06:00
Dan McGee
c7d332a26a Reorganize fields in package struct
Saves a few bytes due to padding (256 -> 248 bytes), especially on x86_64,
so we get the overhead of our new hash field right back.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 17:46:02 -06:00
Dan McGee
919bb6c9e0 Used hashed package name in _alpm_pkg_find
This results in huge gains to a lot of our codepaths since this is the most
frequent method of random access to packages in a list. The gains are seen
in both profiling and real life.

    $ pacman -Sii zvbi
    real: 0.41 sec -> 0.32 sec
    strcmp: 16,669,760 calls -> 473,942 calls
    _alpm_pkg_find: 52.73% -> 26.31% of time

    $ pacman -Su (no upgrades found)
    real: 0.40 sec -> 0.50 sec
    strcmp: 19,497,226 calls -> 524,097 calls
    _alpm_pkg_find: 52.36% -> 26.15% of time

There is some minor risk with this patch, but most of it should be avoided
by falling back to strcmp() if we encounter a package with a '0' hash value
(which we should not via any existing code path). We also do a strcmp once
hash values match to ensure against hash collisions. The risk left is that a
package name is modified once it was originally set, but the hash value is
left alone. That would probably result in a lot of other problems anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 12:36:02 -06:00
Dan McGee
c2a73ba989 When setting package name, set hash value as well
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 12:06:31 -06:00
Dan McGee
dbf59a6b14 Add hash_sdbm function
This is prepping for the addition of a hash field to each package to greatly
speed up the string comparisons we frequently do on package name in
_alpm_pkg_find.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 11:56:32 -06:00
Dan McGee
d1d163c5a3 Use _alpm_pkg_find in deps search
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14 11:50:50 -06:00
Dan McGee
ba45cb4590 doc/PKGBUILD: document that functions run in -e mode
Caught this noted on the forums, but it is definitely worth a note in the
manpage as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 22:36:10 -06:00
Dan McGee
c5f6995aeb Fix manpage wrap not at 80 characters
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 22:35:24 -06:00
Dan McGee
a5e43b1605 Correctly force load of package reason
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:25:14 -06:00
Dan McGee
580fe21065 Abstract has_scriptlet() to package ops struct
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:25:14 -06:00
Dan McGee
c00e05992e Remove non-public functions from header
And rename accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:16:47 -06:00
Dan McGee
94d3d665f0 Mark sync_db_read() as static
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 21:14:03 -06:00
Bruno Widmann
5f36523af9 Abort db_populate if dbpath is not set
Rather than segfault. Fixes FS#21345.

Signed-off-by: Bruno Widmann <bruno.widmann@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13 16:45:22 -06:00
Dan McGee
8f18798d10 Update news and bump versions
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 23:07:54 -06:00
Dan McGee
ed367fe96d Update scripts/ .gitignore
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 22:42:22 -06:00
Dan McGee
1ff8118212 Create sync/ DB directory if it does not exist
Rather than error out, this is easy enough. Looks quite similar to the code
in be_local for creating the local directory.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 22:41:02 -06:00
Dan McGee
13a2847aa1 pacman-optimize: ensure database directory contains local/
And also default dbpath to the one we may find in pacman.conf.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:54 -06:00
Allan McRae
d98bacd4ec Add script to update pacman database format
The pacman-db-upgrade script was added to detect old pacman database
formats and upgrade them.

Currently performs the merging of depends files into desc files in
the local database.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Allan McRae
8f3b485517 Update pactest suite for change in db structure
Merging desc and depends files in sync and local db.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Allan McRae
21833d90e2 Merge desc and depends files in local db
Whenever depends is needed from the local db, so is desc.  The only
disadvantage to merging them is the additional time taken to read the
depends entries when they are not needed.  As depends is in general
relatively small, the additional time taken to read it in will be
negligable.  Also, merging these files will speed up local database
access due to less file seeks.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee
209d0643e5 Attempt to stop installation when we encounter problems
This should hopefully address some of the concerns raised in FS#11639 with
regards to continuing after filling the disk up.

Add some more checks and passing of error conditions between our functions.
When a libarchive warning is encountered, check if it is due to lack of disk
space and if so upgrade it to an error condition.  A review of other
libarchive warnings suggests that these are less critical and can remain as
informative warning messages at this stage.

Note the presence of errors after extraction of an entire package is complete.
If so, we abort the transaction to be on the safe side and keep damage to a
minimum.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: make ENOSPC warning into an error]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee
b276a76dc9 Turn libarchive warnings into libalpm warnings
Rather than hiding these warnings, show them to the user as they happen.
This will prevent things such as hiding full filesystem errors (ENOSPC) from
the user as seen in FS#11639.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: adjust warning wording and add gettext calls]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 21:42:41 -06:00
Dan McGee
3030542d10 Make reading from any file possible in sync DB
Whether it be "desc", "depends", or "deltas", it really doesn't matter-
treat them all the same and have the ability to read any data from any file
in that list. This continues the work in a44c7b8956.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:38:20 -06:00
Allan McRae
9f96c5433a Explicitly test time difference is greater than zero
We are comparing a floating point number so should use an inequality
rather than implicitly testing != 0.

Prevents warning given by -Wfloat-equal.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:32:32 -06:00
Allan McRae
ef977865a1 makepkg: perform sanity checks on variables in package functions
Check the over-ridden entries for provides, backup, optdepends and
options for illegal entries.  Partially fixes FS#16004.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:32:13 -06:00
Dan McGee
b7015af0fc diskspace style cleanups and small fixes
* Use our normal return() function syntax
* Rework a few things to reduce number of casts
* Fix void function argument declaration
* Add missing gettext _() call
* Remove need for seperate malloc() of statvfs/statfs structure
* Unify argument order of static functions- mountpoints now always
  passed first
* Count all files that start with '.' in a package against the DB
* Rename db to db_local in check_diskspace to clarify some code
* Fix some line wrapping to respect 80 characters

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:32:05 -06:00
Dan McGee
ec136784d4 Refactor statfs/statvfs type check
Turn it into a configure-type typedef, which allows us to reduce the
amount of duplicated code and clean up some #ifdef magic in the code
itself. Adjust some of the other defined checks to look at the headers
available rather than trying to pull in the right ones based on
configure checks.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12 20:31:51 -06:00
Allan McRae
24684a616e Display progress bar for disk space checking
Checking disk space needed for a transaction can take a while so add
an informative progress bar.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:30:11 -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
Allan McRae
3f0d98c124 Implement disk space checking
Pull together the work of the previous commits to implement a check
for enough free space before performing an install transaction. Abort
if there is not enough free space with an appropriate pm_errno..

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:59 -06:00
Allan McRae
e527699ddd Add functions to calculate approximate disk usage by packages
Two helper function are added to calculate the disk usage from packages
that are either currently installed on the system or from a package
archive.

Some minor approximations have been made:

1. Size for directories is not considered when removing a package from the
   filesystem to avoid multiple counting across packages. Also, these are
   reported to take zero size while installing.

2. Symlinks are reported to contribute zero size towards removal as
   libarchive reports them to have zero size for install.

3. Package data files (.PKGINFO, .INSTALL, .CHANGELOG) are counted towards
   usage on dbpath on install, but their size is not counted on package
   removal.

4. No handling of extra size needed for .pacsave/.pacnew files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:54 -06:00
Allan McRae
695656d252 Add function to match file to mount point
For a given file, determine which mount point it is on or will be
installed to.  Take into account that we might be using an alternative
installation root.

Add additional helper function added to sort mount point list for easier
matching.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:49 -06:00
Allan McRae
f4e9deb6d7 Add function for listing system mount points
Add a mount_point_list() function that attempts to portably obtain
a list of system mount points and a struct to hold needed mount point
information.

Abort the transaction if we are unable to determine the mount points.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:43 -06:00
Allan McRae
adb10c3ab2 Prototype disk space checking functionality
Very basic prototyping for adding functionality to check free disk
space before performing package installs.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:37 -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
Dan McGee
fc74ef93b6 dirent usage cleanup
We were including the header in a lot of places it is no longer used.
Additionally, use the correct autoconf macro for determining whether
d_type is available as a member: HAVE_STRUCT_DIRENT_D_TYPE.

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:20 -06:00
Allan McRae
8e9a69e8f6 Move MAX_DELTA_RATIO definition
This is a delta specific definition so it makes more sense to put
it in the delta specific header file.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:29:05 -06:00
Allan McRae
a44c7b8956 Combine reading from depends and desc in sync db
This will allow us to eventually combine the depends and desc entries
within the sync database.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:25:35 -06:00
Andres P
889c260cbf makepkg: remove dead code from handle_deps
The error message that has been removed never gets to print because, given the
same condition, handle_deps throws the same error and then immediately exits
makepkg.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:25:09 -06:00
Andres P
579533d1a0 makepkg: do not ignore errors from pacman when checking deps
As check_deps is run in a subshell, exit had the same meaning as return.
Since the intention is to halt makepkg when pacman throws an error other than
127, the enclosing function has to handle error control instead.

Fixes FS#19840

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:24:59 -06:00
Carlos Diaz
330951200c makepkg: use portable escape sequence for terminal escapes
The escape string isn't necesarily \033; it's determined by what the
particular termcap/info entry for that terminal contains.

Bash uses ncurses functions to expand \e to the _correct_ terminal
escape.

Signed-off-by: Carlos Diaz <839273@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:24:46 -06:00
Allan McRae
970ffbb4c7 Add epoch to PKGBUILD prototypes
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:24:26 -06:00
Dan McGee
d4bab6f8fc src/util: update .gitignore
Add pactree and sort entries.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:23:25 -06:00
Xavier Chantry
622e7fdd4f contrib: remove bash pactree
This has been rewitten in C which is much much faster.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2010-12-12 20:21:48 -06:00
Xavier Chantry
65a96e900d pactree: use variables for color and tree output
This allows to very easily support non-color and linear mode, by just
setting the variables to an empty string, very much like it was done in
the bash script.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2010-12-12 20:21:40 -06:00
Xavier Chantry
6b928fc0bf pactree: separate dependency and print logic
The deps walking code simply calls print_start, print, print_end, and
all the printing logic is handled there.

The unresolvable printing is disabled for now because it does not handle
linear mode, and the linear and color output will be re-written.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2010-12-12 20:21:27 -06:00
Dave Reisner
7c06e66c24 pactree: rewrite in C
Use the bash script in contrib as the basis for a C rewrite using
libalpm. The speedup can go from dozens of seconds to less than one
second.

Colorized output is preserved.

The --graph option generates output that graphviz's `dot' utility will
understand to draw us a graph. Output is written to stdout and it is
left up to the user to pipe the data and determine the output
characteristics.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2010-12-12 20:21:15 -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
Xavier Chantry
d0d8f605d5 alpm: don't expose alpm_depcmp
Either we expose all low levels function dealing with pmdepend_t
(splitdep and depfree come to mind), or we don't.

Since none of the tools use depcmp, I chose to remove it. In the future,
we might want to expose higher level functions such as
alpm_find_satisfier, or just lower level functions like splitdep and
depfree together with depcmp.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:08:54 -06:00
Xavier Chantry
d5a7dc67d9 alpm: kill alpm_deptest
This has been replaced by the more flexible alpm_find_satisfier
function, and alpm_deptest was completely unsused now.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:08:27 -06:00
Xavier Chantry
8791ae0fda pacman/deptest: reimplement with alpm_find_satisfier
It's very easy to re-implement the -T feature with the more generic
alpm_find_satisfier rather then the more specific and less useful
alpm_deptest.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:08:16 -06:00
Xavier Chantry
a03daad073 alpm: add new alpm_find_satisfier function
whatprovides and splitdep were removed, so depcmp alone is quite useless
now without splitdep, and deptest is not flexible enough.

Introduce a new alpm_find_satisfier which is hopefully more flexible,
this should make implementation of deptest very easy, and also help alpm
tools such as pactree.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:07:58 -06:00
Xavier Chantry
c2cce1f46a Fix a few problems reported by clang-analyzer
One missing NULL-check and 3 dead assignments.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 20:07:15 -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
Dan McGee
a35610beba Merge branch 'maint'
Conflicts:
	lib/libalpm/be_local.c
	lib/libalpm/trans.c
2010-12-12 19:53:20 -06:00
Xavier Chantry
5c8083baa4 be_files: write EPOCH instead of FORCE
This patch is only meant for 3.4.x. It prepares the place for the future
epoch-aware release.

All force packages that get reinstalled or upgraded will get an EPOCH
entry in the local database, and thus the new pacman with epoch won't
reinstall them by mistake on the first -Su.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12 19:45:04 -06:00
Dan McGee
eedf4f4e63 Fix possible null pointer deref in check_arch
If we have a corrupted database, a package can come through without an arch,
causing the code to blow up when making strcmp() calls. It might even be
possible with perfectly valid database entries lacking an 'arch =' line.
This behavior was seen as at least one of the problems in FS#21668.

Ensure pkgarch is not null before doing anything further.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-10 19:45:14 -06:00
Sergey Tereschenko
bd08581d2e Small update to Russian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-11-08 06:56:04 -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
Dan McGee
a91250b7bb Add initial 3.4.2 NEWS draft
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-28 10:13:18 -05:00
Tobias Eriksson
a08638edc8 Update Swedish translation
442 translated strings, no fuzzies, no untranslated.

	modified:   po/sv.po

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-28 10:13:18 -05:00
Xavier Chantry
592211b6dc PKGBUILD.vim: add special licenses BSD MIT ZLIB Python
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-28 09:31:22 -05:00
Ricardo Pérez
d901646f7a Small updates to Spanish translation
Also addresses FS#21373.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-28 09:13:24 -05:00
Dan McGee
0f3957ab48 Merge branch 'maint' 2010-10-18 16:52:57 -05:00
Xavier Chantry
ce96f39ac9 pactest: use valgrind.supp file
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:51:38 -05:00
Jakob Gruber
8f2eaa51c2 Tests: '-S repo/group' syntax
when calling '-S repo/group', only group members in <repo> should should
be installed (group members in other repos are ignored)

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:51:38 -05:00
Jakob Gruber
9d0b33fd33 Tests: Sync group which includes ignored pkgs
* FS#19854 (--ignore is ignored with groups)

* http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html
  (operation aborts when a package from a group is ignored/and user chooses
  not to install it)

If a group member is ignored, we expect
a) a question whether to install
b) after saying 'no' to a), the ignored member not to be installed
c) all other group members to be installed
d) pacman to execute successfully

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:51:38 -05:00
Xavier Chantry
30734c9a4a alpm/sync: very small memleak fix
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:50:32 -05:00
Xavier Chantry
a2d7f6f206 libalpm/remove: fix funny progress bar problem with empty packages
$ pacman -Rd kde-meta

Remove (15): kde-meta-kdewebdev-4.5-1 [0.00 MB]  kde-meta-kdeutils-4.5-1 [0.00 MB]
             kde-meta-kdetoys-4.5-1 [0.00 MB]  kde-meta-kdesdk-4.5-1 [0.00 MB]
             kde-meta-kdeplasma-addons-4.5-1 [0.00 MB]  kde-meta-kdepim-4.5-1 [0.00 MB]
             kde-meta-kdenetwork-4.5-1 [0.00 MB]  kde-meta-kdemultimedia-4.5-1 [0.00 MB]
             kde-meta-kdegraphics-4.5-1 [0.00 MB]  kde-meta-kdegames-4.5-1 [0.00 MB]
             kde-meta-kdeedu-4.5-1 [0.00 MB]  kde-meta-kdebase-4.5-1 [0.00 MB]
             kde-meta-kdeartwork-4.5-1 [0.00 MB]  kde-meta-kdeadmin-4.5-1 [0.00 MB]
             kde-meta-kdeaccessibility-4.5-1 [0.00 MB]

Total Removed Size:   0.06 MB

Do you want to remove these packages? [Y/n]
( 1/15) removing kde-meta-kdewebdev      [------------------------] 100%
$ it stopped here..

On one side, libalpm did not initialize the progress bar at 0 percent.
So with meta-packages that have 0 files, there was only one progress bar
call with percent == 100.

On the other side, pacman callback kept track of the last percent that
it received. When there are only meta-packages, we always received only
100, so pacman believed the progress bar needed not update. Thus only
the first package was actually displayed.

A proper fix for the callback would be to keep track of last package
name to make sure the recorded prev percent applies.

But since we now specify that both Add and Remove should at least send
percent=0 at beginning and percent=100 at the end, there is no need
for that.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-18 16:46:41 -05:00
Xavier Chantry
7237903c66 be_package: read force entry and convert to epoch
We still need to read force entry in epoch-aware pacman, so that when we
install an old force package, EPOCH gets written to the local db.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14 20:23:13 -05:00
Carlos Diaz
f5059038f2 bash_completion: remove upstream deprecated functions
Populate $cur and $prev with the new bash-completion 1.2 function,
_get_comp_words_by_ref.

_get_cword and _get_pword have been deprecated.

Signed-off-by: Carlos Diaz <839273@gmail.com>
2010-10-14 06:53:12 -05:00
Dan McGee
de5f438aef Merge branch 'maint' 2010-10-13 23:42:35 -05:00
Dan McGee
73886504d7 Add several pactests for epoch code
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:27 -05:00
Dan McGee
93718046d7 Add epoch verification to makepkg
If defined, it must be an integer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:27 -05:00
Dan McGee
0d5fa576b3 Update contrib/ for epoch
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:27 -05:00
Dan McGee
8aa7ed5a7e Add epoch support to pactest
This adds epoch support to pactest, while still producing packages and
database entries the same way makepkg and repo-add currently do in a
backward compatible fashion (still including the 'force' option).

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee
6f37ba61ed Make repo-add and makepkg epoch-aware
Allow it to be a variable in the PKGBUILD as well as propagating it through
to the built package and the package database. We leave some backward
compatibility in place by placing the '%FORCE%' option in the database if
the package contains an epoch; this will be used by older versions of pacman
and more or less ignored by versions that use epoch.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee
42893e7165 Update documentation to reflect new epoch package variable
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee
feb9889f22 Add epoch support to pacman/libalpm
This will allow for better control of what was previously the 'force' option
in a PKGBUILD and transferred into the built package.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:29:26 -05:00
Dan McGee
ef32aa0219 Small tweaks after backend merge
Just a few small things I noticed looking through the code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:09:20 -05:00
Dan McGee
68b50c81c7 Merge remote branch 'allan/backend' 2010-10-13 22:46:04 -05:00
Allan McRae
24d77291da Only write to local repos
We do not write to sync repos so kill the code for that.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
5b17d8f27d Clean-up parsing sync database
Remove unnecessary parsing of fields not found in sync desc file.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
fbcadebcab Clean-up parsing local database
Remove unnecessary parsing of fields not found in local desc files.
Leave %FORCE% parsing as this likely will make an appearance in desc
files in the future.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
d39248120e Remove lazy loading of deltas
Local packages do not have deltas so remove lazy loading of delta
information.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
e464339e3b Move and rename splitname
The splitname function is a general utility function and so is better
suited to util.h.  Rename it to _alpm_splitname to indicate it is an
internal libalpm function as was the case prior to splitting local and
sync db handling.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:40 +10:00
Allan McRae
448f78c067 Restrict visibility of checkdbdir and get_pkgpath
These functions are only needed by be_local and were only promoted
to db.{h,c} as part of the splitting of handling the local and sync
dbs.  Move them into be_local.c and make them static again.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
5717c7d508 Clean up all old database files and directories
Clean-up the previous download location of the sync database and
any old extracted sync database directories which are unneeded
with the tar-db backend.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
149ab6b272 Only download sync databases
As the sync databases are read directly from the tarball, we no
longer need to extract them.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
4a8e396a58 Parse sync database
Read in package information for a tar based sync database. Do not
use lazy loading for sync db.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
5e61f07735 Populate sync db from archive
Read in list of packages for sync db from tar archive.

Breaks reading in _alpm_sync_db_read and a lot of pactests (which
is expected as they do not handle sync db in archives...).

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
fc32faaa6a Completely separate local and sync db handling
Put the db_operations struct to use and completely split the handling
of the sync and local databases.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:39 +10:00
Allan McRae
5b2de3d8ec Separate be_files into be_sync and be_local
The file be_files.c is "split" to be_local.c and be_sync.c in order
to achieve separate handling of sync and local databases.

Some basic clean-up of functions that are only of use for local or
sync databases has been performed and some rough function renaming
in duplicated code has been performed to prevent compilation errors.
However, most of the clean-up and final separation of sync and local
db handling occurs in following patches.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14 13:17:38 +10:00
Dan McGee
6eedf06fcc Fix bash shell location check
BASH is defined when you are actually using bash during configure, which
sucks because it ends up being '/bin/sh', messing up all of our scripts.
Change the name of the variable we use in configure, and also ensure we get
a full path to the executable by using AC_PATH_PROGS rather than
AC_CHECK_PROGS. Finally, change the variable name everywhere we use it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 17:50:54 -05:00
Allan McRae
96e277cfd9 Move db cache handling functions
These will be needed for the handling of both local and sync database
caches, so put them in a common location.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Allan McRae
0909a72000 Move database handling utility functions
Move splitname, checkdbdir, get_pkgpath into db.{h,c} as these will be
needed to parse both the local and sync databases during the initial
splitting.  They will be moved out of db.{h,c} at to more appropriate
locations at a later stage.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Allan McRae
c56b576f6f Fix documentation syntax and typo
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
efbae3cfcb Initial hack at a DB operations struct
It doesn't do a whole lot yet, but these type of operations will
potentially be different for the DBs we load.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
522ef5e981 Move the cache stuff where it should be
Cache bullshit only has relevance to be_files, so move it there.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: BIG rebase]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
b9a531c2d7 Move changelog functions to callback struct
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
6cebd4e602 Complete rework of package accessor logic
Hopefully we've finally arrived at package handling nirvana, or at least
this commit will get us a heck of a lot closer. The former method of getting
the depends list for a package was the following:

1. call alpm_pkg_get_depends()
2. this method would check if the package came from the cache
3. if so, ensure our cache level is correct, otherwise call db_load
4. finally return the depends list

Why did this suck? Because getting the depends list from the package
shouldn't care about whether the package was loaded from a file, from the
'package cache', or some other system which we can't even use because the
damn thing is so complicated. It should just return the depends list.

So what does this commit change? It adds a pointer to a struct of function
pointers to every package for all of these 'package operations'  as I've
decided to call them (I know, sounds completely straightforward, right?). So
now when we call an alpm_pkg_get-* function, we don't do any of the cache
logic or anything else there- we let the actual backend handle it by
delegating all work to the method at pkg->ops->get_depends.

Now that be_package has achieved equal status with be_files, we can treat
packages from these completely different load points differently. We know a
package loaded from a zip file will have all of its fields populated, so
we can set up all its accessor functions to be direct accessors. On the
other hand, the packages loaded from the local and sync DBs are not always
fully-loaded, so their accessor functions are routed through the same logic
as before.

Net result? More code. However, this code now make it roughly 52 times
easier to open the door to something like a read-only tar.gz database
backend.

Are you still reading? I'm impressed. Looking at the patch will probably be
clearer than this long-winded explanation.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: rebase and adjust]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
d1126db128 Allow local and sync db to be treated separately
Implement this seemingly simple change in package.h:

 typedef enum _pmpkgfrom_t {
-       PKG_FROM_CACHE = 1,
-       PKG_FROM_FILE
+       PKG_FROM_FILE = 1,
+       PKG_FROM_LOCALDB,
+       PKG_FROM_SYNCDB
 } pmpkgfrom_t;

which requires flushing out several assumptions from around the codebase
with regards to usage of the PKG_FROM_CACHE value. Make some changes where
required to allow the switch, and now the correct value should be set (via a
crude hack) depending on whether a package was loaded as an entry in a local
db or a sync db.

This patch underwent some big rebasing from Allan and Dan.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
Dan McGee
49176461a6 Unify caching concerns in package accessors
Move almost all of the caching related stuff into a single #define
(which should maybe even just be a static function) so we don't
duplicate logic all over the place. This also makes the code a heck of a
lot shorter and means further changes to this stuff don't have to touch
each and every getter function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 23:53:17 +10:00
Dan McGee
a7dc3875f1 contrib/ follow-up work
* Add a .gitignore file
* Use the same 'GEN' output we have in the scripts/ Makefile when doing our
  edits on the .in files
* Remove PKGBUILD.vim and vimprojects from our edit list, they have no need
  to be in the list

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-12 08:26:50 -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
Dan McGee
0ff2a91497 util: fall cleaning on single file programs
* Add a bunch of static declarations where possible
* Fix void functions to be proper syntax, e.g. void func(void)
* Consistency fixes (such as argv references)
* Remove dead str_cmp() function from testdb
* Remove unneeded config.h header includes
* vercmp: remove completely unnecessary string copying

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Nezmer
05f0a28932 Use sysconfdir, localstatedir, BASH instead of hardcoded values
This applies to contrib/ files, our scripts, and the documentation.

Dan: fix 'make clean' in contrib/ directory.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Nezmer
bce3c8efc7 Add .in extension to files in contrib
This is needed If we want to use sysconfdir,localstatedir and other variables.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Xavier Chantry
7d93777231 repo-add: more informative delta messages
- Print an error if database entry was not found and delta entry cannot
  be added
- More informative line when delta entry is added (oldfile -> newfile)

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:29:22 -05:00
Xavier Chantry
c9179b09db repo-add: add delta generation
This allows deltas to be generated at repo-add invocation time as opposed to
just added to the database. It will generate the delta from the package
version currently in the database.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 20:28:43 -05:00
Dan McGee
3a06a9fa9f Read 'force' entry from packages
We weren't reading this in from our packages, thus causing us not to write
it out to our local database. Adding this now will help ease the upgrade
path for epoch later and not require reinstallation of all force packages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 17:48:11 -05:00
Xavier Chantry
53b41afbe8 pactest: fix typo in ignore001
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 17:02:03 -05:00
Nezmer
fb79d58109 makepkg: Use mkfifo instead of GNU-only 'mknod <file> p'
'mknod <file> p' is apparently GNU-only. Looking at coreutils' source
code, It just calls mkfifo.

This one line patch should fix makepkg logging in non-GNU systems.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 17:01:55 -05:00
Jakob Gruber
46ffd342a4 CLI args: add pactest with an invalid combination
Pacman should catch cases in which the passed arguments don't apply to the
current operation (sync/query/...).

Also see FS#20950.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Xavier Chantry
fa933df65b pactest: fix gensync
gensync generated a sync.db file with PKGINFO syntax, this is not quite what
pacman expects.

Also the file was only added to the Server path:
	root/var/pub/sync/sync.db
but it was not available in the normal sync db path:
	root/var/lib/pacman/sync/sync.db

Change gensync() to generate var/lib/pacman/sync/sync.db and then copy it to
var/pub/sync/sync.db (this is used by sync200 -Sy test).

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Xavier Chantry
67068b64b9 pactest: use simpler method to create tar
Just like in 24fc623e1a8bf905cf0367f9bd40bc5bd6034378, apply to pmdb
gensync as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Dan McGee
73442a7e03 Only check for function if we are using libfetch
We did this check unconditionally, rather than only doing it if we were
actually going to build and run with libfetch. This is safe because we would
have already bailed if libfetch was explicitly requested but not found.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Dan McGee
1e0e5b2a02 Remove use of seq in pactree
This is not a bash builtin, so can potentially cause portability issues.
Additionally, the use of it is completely unnecessary as it can all be done
within bash (and done faster).

$ time pactree xfwm4 >/dev/null (old version)
real	0m3.245s

$ time ./contrib/pactree xfwm4 >/dev/null (new version)
real	0m3.042s

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:57 -05:00
Dan McGee
dff73a2a69 Avoid stat call to determine is_directory if possible
On Linux and OS X, we can determine if an entry obtained through a readdir()
call is a directory without also having to stat it. This can save a
significant number of syscalls. The performance increase isn't dramatic, but
it could be on some platforms (e.g. Cygwin) so it shouldn't hurt to use this
unconditionally where supported.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11 10:06:03 -05:00
Dan McGee
bef19a266b Merge branch 'maint' 2010-10-05 11:15:56 -05:00
Allan McRae
283ef6519a Check for python-2.7
Add python-2.7 to the list of checked versions of python and add a
check for a python2 binary before resorting to the unversioned
python binary.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 11:14:31 -05:00
Rémy Oudompheng
302188b169 Make testsuite python-2.7 compatible
os.walk(".") adds a prefix of "./" to filenames in python-2.7 which
causes libalpm not to like archives generated in the testsuite resulting
in widespread failure.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 11:14:24 -05:00
Allan McRae
c0f58ea9a2 makepkg: canonicalize paths from environmental variables
This prevents circular symlinks and weird final package locations
when using commands like  'PKGDEST="." makepkg'.

Fixes FS#20922.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 11:03:28 -05:00
Allan McRae
960c2cdcf7 makepkg: compare paths using bash test
Compare paths using bash's "-ef" rather than by string tests as this
takes symlinks into account.  This will prevent issues similar to those
in FS#20922 if (e.g.) $PKGDEST is a symlink to $startdir.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 11:03:06 -05:00
Allan McRae
f2296aab89 makepkg: improve srcdir check and add pkgdir
The checking of the package for $srcdir references was overly
sensitive and gave a lot of what appear to be false positives with
binary files (in particular with debugging symbols kept).

Restrict the search for $srcdir to non-binary files as this should
still catch the majority of configuration issues the check was
initially designed to catch. Also, add a similar check for $pkgdir.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 10:58:21 -05:00
Allan McRae
022ec3dbb7 makepkg: remove STRIP_DIRS
For binary packages, the majority of the time used in the debugs symbol
stripping process is the actual stripping of the binaries/libraries and
not the testing of which files to strip.  This allows more complete
stripping of packages that install to "non-standard" paths that would
not be generally included in makepkg.conf.

Any performance hit that may be apparent for (_large_) "arch=('any')"
packages can readily be avoided by disabling stripping in the PKGBUILD
options array.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-05 10:58:05 -05:00
Sebastian Nowicki
821ff061b1 Set pm_errno on libarchive errors while reading
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-27 10:53:48 -05:00
Dan McGee
f7895cc188 Merge branch 'maint' 2010-09-27 09:24:28 -05:00
Dan McGee
dff06a8170 Merge branch 'build-system' 2010-09-27 09:21:02 -05:00
Allan McRae
900605912b Add FORTIFY_SOURCE support
Adds a check for the minimum mainline GCC version for FORTIFY_SOURCE
support and enables -D_FORTIFY_SOURCE=2 by default when building with
--enable-debug.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-09-27 16:06:52 +10:00
Allan McRae
28c662e7a4 Add wrapper around asprintf calls
Not checking the return value of asprintf calls reuslts in a warning
when using -D_FORTIRFY_SOURCE=2.  This adds a simple wrapper around
asprintf calls which checks the return value.

Currently the check does nothing more than outputing a message to stderr
on failure, but that is at least an improvement over silent failures.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-09-27 16:06:51 +10:00
Allan McRae
879fed5098 repo-add: make --quiet output more quiet
Fixes FS#20403.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-09-27 15:06:59 +10:00
Dan McGee
f489e969f0 Update build system (automake, autoconf, libtool)
Unfortunately this patch is hard to split up into smaller chunks. Our build
system and the associated automake/autoconf/libtool macros has been left
untouched for a while, and could use a refresher.

* Upgrade ltmain.sh to the latest version
* Move away from a huge acinclude.m4 directory to using individual files in
  the m4/ subdirectory, suggested by upstream automake documentation
* Update all macros to their latest available version
* Adjust Makefile.am and autogen.sh to accommodate m4/ subdirectory

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 09:10:53 -05:00
Dan McGee
413508c6fa Update more supplementary build scripts
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 09:08:30 -05:00
Dan McGee
af31fd6494 Update config.guess and config.sub
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 08:20:50 -05:00
Dan McGee
541f183cd6 Clean up root .gitignore
We had a few files listed in here that we have checked in to our repo, which
doesn't make a whole lot of sense. Also alphabetize the list while we are at
it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 08:17:06 -05:00
Dan McGee
d2ff8f4b96 Update gettext Makefiles to 0.18
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-23 08:17:06 -05:00
Allan McRae
fd38319106 bacman: unify package creation with makepkg
Currently bacman always compresses with gzip now matter what PKGEXT is
set to.  Rework the entire package creation process to be similar to
that in makepkg.  This also make the explicit assumption that PKGEXT is
defined in makepkg.conf.

Thanks to Nelson Chan <khcha.n.el@gmail.com> for the original patch to
fix the incorrect package compression.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-15 08:54:34 -05:00
Dan McGee
d201d1f312 Merge branch 'maint' 2010-09-15 07:31:37 -05:00
Gaspar Santos
c2993197ea Update Portuguese translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-15 07:30:15 -05:00
Lukas Fleischer
79541193f7 PKGBUILD-example.txt: Remove superfluous "|| return 1".
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-15 07:20:20 -05:00
Baurzhan Muftakhidinov
e29dde9157 Update Kazakh translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-15 07:19:51 -05:00
Dan McGee
31aed1243e Remove quotes in remaining bash regexes
After a8dcfeccfc, Allan noted that one more regular exprssion inside makepkg
also contained quotes; these should not be there for the same reason as that
commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-07 08:27:25 -05:00
Dan McGee
e344fab3b1 Restore trimming of db and pkg extensions
These keep having to change because we are getting really good at changing
the downloaded filename. Shorten the match sequences to just .db and .pkg
and trim everything after and including these strings.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-07 08:24:36 -05:00
Dan McGee
fe788ee4a6 Fix libfetch configure checking
I don't know what I tested in commit 3e7b90ff69, but it definitely wasn't
working as advertised. Fix the checks in the source code itself to match the
right define (HAVE_LIBFETCH), as well as make sure the configure check
defaults to looking for the library but not bailing if it could not be
found.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-06 11:20:51 -05:00
Dan McGee
6d41da4086 Minor translation file updates after make distcheck
It touched up these a bit after it ran, so might as well check the changes
in so we don't have to deal with them again later.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-03 20:10:10 -05:00
Dan McGee
df15a8c432 Retroactive additions to 3.4.1 changes
Forgot to mention things involving the translation changes we had.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-03 20:09:08 -05:00
Dan McGee
881bf5c90f Merge branch 'maint' 2010-09-03 20:06:08 -05:00
Tobias Eriksson
3739e2c10c libalpm Swedish translation update
Signed-off by: Tobias Eriksson <tobier@tobier.se>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-03 19:55:22 -05:00
Dan McGee
3e7b90ff69 Clean up libfetch checking in configure
Model it after the new OpenSSL check, and have it be a bit more useful. If
you do not explicitly pass a command line option, it will be linked if
available but will not error out if it is missing. Also bump the version to
that where connection caching was introduced as we use these new features in
the codebase.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 12:30:36 -05:00
Dan McGee
eba521913d Use OpenSSL MD5 crypto functions if available
I've noticed my Atom-powered laptop is dog-slow when doing integrity checks
on packages, and it turns out our MD5 implementation isn't near as good as
that provided by OpenSSL. Using their routines instead provided anywhere
from a 1.4x up to a 1.8x performance benefit over our built-in MD5 function.

This does not remove the MD5 code from our codebase, but it does enable
linking against OpenSSL to get their much faster implementation if it is
available on whatever platform you are using. At configure-time, we will
default to using it if it is available, but this can be easily changed by
using the `--with-openssl` or `--without-openssl` arguments to configure.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 12:05:23 -05:00
Dan McGee
24d8a15308 libalpm md5: use larger and dynamic buffer
This gave at least a 10% improvement on a few tested platforms due to the
reduced number of read calls from files when computing the md5sum. It really
is just a precursor to another patch to come which is to use MD5 functions
that do the job a lot better than anything we can do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 10:33:21 -05:00
Matthias Gorissen
1cbc3c5c90 German translation updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-02 08:00:14 -05:00
Baurzhan Muftakhidinov
4e3bd7c137 Small fixes to Kazakh translation 2010-09-01 22:46:16 -05:00
Dan McGee
5a25f54757 Merge branch 'maint' 2010-09-01 21:19:06 -05:00
Dan McGee
9d3a8efb7b 3.4.1 version bump
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-01 21:16:49 -05:00
Gaspar Santos
a7c4159b16 Add new European Portuguese translation
This is being checked in as 'pt' rather than 'pt_PT' as that is what
Transifex seems to want, and it is also the dominant choice of packages
already installed on my system when doing a count of the files located in
the /usr/share/locale translation directories.

Thanks for the new translation!

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-01 21:15:07 -05:00
Dan McGee
54b63de098 Add dir missing from autoclean.sh
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-01 21:13:17 -05:00
Jürgen Hötzel
38a60f49bd Use pipe to create compressed package instead of an intermediate tar file
A pipe between tar and compression command is used. This improves
performance by running tar and the compression command simultaneously.

Using a pipe also reduces IO by not writing an intermediate tar file
to disk.

Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 13:07:57 -05:00
Jonathan Conder
693ebbd16b use execv to avoid using sh just to run ldconfig
Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:19:15 -05:00
Jonathan Conder
0223a028e0 redirect scriptlet stderr synchronously through alpm
Fixes FS#18770, and hopefully an occasional deadlock in my frontend as well.
For simplicity it redirects all scriptlet output through SCRIPTLET_INFO, and
all callbacks in the child process have been replaced for thread-safety.

Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:19:09 -05:00
Dan McGee
d14a98db25 Merge branch 'maint' 2010-08-27 11:19:05 -05:00
Dan McGee
a8dcfeccfc makepkg: remove trailing quote mark in regex
Regular expressions in bash should not be quoted. Glad this was in the
documentation and I didn't have to go to #bash to ask...

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 11:04:21 -05:00
Jonathan Conder
90c45f7bbe pactest: add shell to fake root environment
Adds a shell to the fake root set up for pactests, which was not needed
previously due to a bug (debian #582847) in fakechroot.

Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
2010-08-27 10:58:08 -05:00
甘露(Gan Lu)
9fbf5d9336 Update Chinese translation
Submitted through Transifex on 2010-07-02.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-25 14:29:44 -05:00
Dan McGee
8d88f0c897 Merge branch 'maint' 2010-08-23 21:53:06 -05:00
Allan McRae
a28868eeae makepkg: error out on empty optdepends entries
If optdepends was defined with empty members, then makepkg would
abort late in the package building process.  Detect such cases
in the check_sanity() function.

Fix-provided-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:51:45 -05:00
Allan McRae
08e1d4764c makepkg: use less local variables in check_sanity
Instead of declaring a new local variable for each loop in the
check_sanity() function, just reuse $i.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:51:12 -05:00
Allan McRae
f04530eb61 makepkg: remove unnecessary variable presence check
It is unnecessary to check for a variables existence before
looping over it.

Extracted from patch supplied by Andres P <aepd87@gmail.com>

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:50:57 -05:00
Allan McRae
68d8bfa0b5 makepkg: clarify invalid backup entry errors
"Invalid backup entry" was not a particular helpful error message,
especially when it was due to the file not being in the final package.
Clarify these two messages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:50:46 -05:00
Andres P
3de32a0812 PKGBUILD.5: document illegal variable contents
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:50:20 -05:00
Andres P
f27fed14b1 makepkg: less code duplication in create_package
Combine changelog and install file creation in create_package().

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:49:55 -05:00
Allan McRae
298cbf2cb1 makepkg: use regex to match options for privilege escalation
Eases maintanence if we need to add further options in the future.

Extracted from a patch supplied by Andres P <aepd87@gmail.com>

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-08-23 21:49:44 -05:00
Allan McRae
48589ccc64 Fix some whitespace issues
The combination of tabs and spaces is annoying in any editor that
does not use a tab width of 2 spaces.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:49:05 -05:00
Dan McGee
d896527d21 fgets invocation cleanup
From the fgets manpage:

	fgets() reads in at most one less than size characters from stream and
	stores them into the buffer pointed to by s. Reading stops after an EOF
	or a newline. If a newline is read, it is stored into the buffer. A
	'\0' is stored after the last character in the buffer.

This means there is no need at all to do 'size - 1' math. Remove all of that
and just use sizeof() for simplicity on the buffer we plan on reading into.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:48:28 -05:00
Dan McGee
71660f55b2 Update translation files for 3.4.1 freeze
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:47:04 -05:00
Dan McGee
4a487346c5 Update NEWS for 3.4.1 release
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:45:54 -05:00
Jozef Riha
0478dfa1a5 Add Slovak translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 21:45:54 -05:00
Dan McGee
ce3f4e7800 Enable libfetch connection caching
This will allow downloads to reuse connections if possible, which could make
big differences on perceived FTP speed as the connection won't have to be
reestablished each time. For the most part, HTTP requests wouldn't be using
keep alive anyway so this won't have an effect there.

I'm not enthused about having to do this with the library initialization,
but there isn't a much better place due to the fact that the loop over
databases occurs on the frontend and not the backend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23 17:42:22 -05:00
Dan McGee
281bc72534 repo-add: create relative DB symlinks
As noted in FS#20498, if an absolute path is used for specifying the
database when invoking repo-add, the symlink generated will point to the
absolute path instead of being relative to the directory. Fix this for
the two linking cases, but leave the copy untouched so that will still
work.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-18 13:17:46 -05:00
Allan McRae
5908992e47 makepkg: add file to the list of needed utilities
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-18 13:11:55 -05:00
Mateusz Herych
c3f5375380 Updates for Polish translations
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-18 13:11:28 -05:00
Allan McRae
b02bda75f1 makepkg: check tput support before using
Prevent makepkg aborting whe colors are enabled and the terminal
does not support setting colors by tput.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-18 13:10:03 -05:00
Thomas Bächler
8155571183 makepkg: Allow creation of uncompressed packages
When performing local testing, it may be useful to add PKGEXT='.pkg.tar'
to the PKGBUILD to save time, especially with big packages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-08 10:24:24 -05:00
Dan McGee
e7d5803f07 Use the plural features of gettext
Gettext has this whole 'Plural-Form' thing that until now we haven't taken
advantage of. Given that not all languages have the same plural form rules
as English, take advantage of it by defining a new _n() macro which will
normally define to ngettext(), and adjust a few messages as an example of
how to use.

There are surely other places where we do singular/plural logic without me
having noticed, so further patches are welcome to fix those up too.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 15:50:43 -05:00
Dan McGee
ddc4130c97 Merge branch 'maint' 2010-07-27 10:18:35 -05:00
Baurzhan Muftakhidinov
0d6efb35ce Small fix to Kazakh translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:14:35 -05:00
Dave Reisner
52118bf0f0 bash_completion: negate expression inside brackets
Avoids letting the shell evaluate ! as something else (e.g. an alias).

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:11:04 -05:00
Dan McGee
ff689b6a38 Fix compile error in certain cases
I'm not sure why it doesn't happen everywhere, but we need <sys/stat.h> for
umask and mkdir in this file. I hit this today:

cc1: warnings being treated as errors
util.c: In function ‘makepath’:
util.c:128:2: error: implicit declaration of function ‘umask’
util.c:141:5: error: implicit declaration of function ‘mkdir’
make[2]: *** [util.o] Error 1

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:10:55 -05:00
Dan McGee
fa4f25626c Mark sync_pkg and sync_target as static functions
We no longer use these anywhere outside of sync.c, so do the rename and add
static to their definition to meet our coding standards.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:10:55 -05:00
Dan McGee
f8d7cd6b26 Maintain a list of seen packages when installing a group
As reported in FS#20221, we don't always do the right thing when installing
a group and using the --needed option. This was due to the code pulling
packages based on what was already in the transaction's add list, but
completely ignoring the fact that we may have already seen and skipped this
same package in an earlier repository.

Add a list to the private _alpm_sync_pkg() function that allows us to have
this extra information so we don't mistakenly downgrade a package when using
--needed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:10:55 -05:00
Dan McGee
e702f56ea6 Add two pactests for group and --needed interaction
The first step for resolving FS#20221. sync023 is the case from the bug
report; sync022 is already working fine but we have no tests at all that
test the --needed option in any form.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:10:55 -05:00
Dave Reisner
7f5c486666 Always treat PKGLIST as an array.
Fixes repackaging issues when multiple package names are passed to the
--pkg option.

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27 10:10:55 -05:00
Allan McRae
a835599496 Download sync db into DBPath/sync
The sync db should be stored in the sync/ folder.  This cleans up
DBPath to only have local/ and sync/ directories in it.

A nice side effect is that the db are now in the right place so we
can implement directly reading from them.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:26:04 -05:00
Allan McRae
68dcabdfbe Remove DBEXT usage
With commit 5dffef78, the repo database always has a symlink
of the form reponame.db.  Use that filename and let libarchive
determine the compression type.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:25:55 -05:00
Allan McRae
60de8ec932 Check return value of fgets calls
Prevents compiler warnings with -D_FORTIFY_SOURCE=2

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-07 07:24:57 -05:00
Dan McGee
686b8c1463 Merge branch 'maint'
Conflicts:
	scripts/makepkg.sh.in
2010-07-02 18:29:37 -05:00
Andres P
1a9db4cac7 makepkg: undeclared local variables
Variables that are only meaningful within the function they are declared in are
now prefixed by "local".

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: fix whitespace]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 18:27:27 -05:00
Nico Schottelius
9ebb596805 manpage: add real world examples
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 18:27:12 -05:00
Dan McGee
fcb4f0264f docs: Add a 'website' target
This will allow me to be not quite as lazy in getting website changes out
to the Arch Linux server by making it trivial to get everything packaged up
and working correctly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 18:23:20 -05:00
Dan McGee
3d8be4291c Fix some incorrect asciidoc syntax
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-02 18:23:20 -05:00
Allan McRae
622326bb37 makepkg: fix sudo/su calling of pacman
This fixes two issues:

1) using "sudo -l" results in excess password asking under certian
configurations.  Revert to the pre 3.4 behaviour of always using
sudo if it is installed.

2) Properly escape the command so that that versioned dependencies,
such as "foo>4", do not get treated as output redirection when using
su.  This also unifies the generation of the pacman line and its
privilege escalation.

Based on patches supplied by Andres P <aepd87@gmail.com> with minor
adjustments for suitability for the maint branch.

Original-work-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-07-01 00:23:20 -05:00
甘露(Gan Lu)
68dff73463 Update Chinese translation to fix gettext positional params
Because the shell gettext doesn't allow for positional gettext substitution,
be more careful about where we use it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-01 00:21:08 -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
41724cbcde Check return value of fwrite when copying files
Check that writing to destination file actually occurs in
_alpm_copyfile.  Required adding a new error (PM_ERR_WRITE)
as none of the others appeared appropriate.

Prevents compiler warning when using -D_FORTIFY_SOURCE=2.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 23:49:48 -05:00
Dan McGee
96a1255ead Merge branch 'maint' 2010-06-30 08:41:43 -05:00
Allan McRae
c11bf581a3 makepkg: clarify aborting on packaging failure
When makepkg catches a command failure it currently prints "Aborting..."
and exits.  Clarify the reason for aborting from packaging is a failure
during one of the PKGBUILDs functions.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30 08:32:34 -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
Allan McRae
0ea52e3a4f makepkg: try standard paths for coreutils du
Attempt to find "du" from coreutils in the standard paths and if
not revert to the version in the users PATH.  Using the full path
prevents issues such as FS#19932, where a different and incompatible
version of du is put earlier in the users path.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-30 08:27:29 -05:00
Andres P
8b23aa172f makepkg: remove bash4-only parameter expansion in check_sanity
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-30 08:27:29 -05:00
Thomas Bächler
d7c98d4e45 makepkg: Only check regular files in $srcdir check
The 'grep -R' in the $srcdir check would not only grep regular files,
but also devices, symlinks (that might potentially point outside of
$pkgdir), pipes and so on. Use find to ensure only regular files are
examined.

This should fix https://bugs.archlinux.org/task/19975

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-30 08:27:29 -05:00
Dan McGee
21d5dedfdd repo-add: try symlink, then hardlink, then copy for DB file
We were seeing some issues when trying to create our new database alias
using symlinks on certain filesystems (see FS#19907). Have a fallback method
in place where we first try a symlink, then a hard link, then just copy the
database if all else fails.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-24 10:06:36 -05:00
Dan McGee
630e7508ee Merge branch 'maint' 2010-06-24 08:32:33 -05:00
Eric Bélanger
71330a4310 makepkg: Place source packages symlinks in build dir when SRCPKGDEST is used
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-24 08:22:55 -05:00
Andres P
c6a94a8d22 makepkg: fix regression in split package function checking
Commit 13748ca052 inversed the nature of one test wherein the if clause would
throw a fatal error if a legitimate package function was defined in PKGBUILD.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-24 08:22:15 -05:00
Andres P
6f4f9c1b66 bash_completion: fix bash 3.2 incompatibility
To avoid errors with bash 3.2, compopt will be skipped if it's not a
shell builtin.

compopt is needed to not append slashes to package names that
coincide with directories in PWD.

This is currently not possible to fix in bash versions that do not support
compopt, so these users will have to bear that regression.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-23 13:32:21 +10:00
Allan McRae
07a9effdd0 makepkg: prevent error trap activation in bash-3.2
Running "pacman -T foo" is expected to return a non-zero value when
"foo" is not installed.  This sets of the error trap in bash-3.2 but
not bash 4.x.  Work around this by disabling the error trap around
this pacman call as we are manually checking the return value anyway.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-23 13:32:21 +10:00
Andres P
708f186f98 rankmirrors: pipe errors to stderr
If this is to be scripted with AIF or another tool, it needs to respect stderr.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-23 13:32:21 +10:00
Andres P
226c137245 rankmirrors: fix bogus pacman configuration parsing
Valid pacman configuration files do not have to start with a hash for that line
to be a comment, neither do directives need to be in column 0.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-23 13:32:21 +10:00
Andres P
2222e9f8df rankmirrors: fix bogus variable assignment
$replacedurl was being built from an expansion of itself. But at the time it
happened, it was empty.

Fixes FS#19911

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-23 13:32:21 +10:00
Dan McGee
67d71ea932 Merge branch 'maint' 2010-06-20 21:01:32 -05:00
Allan McRae
c2cf6a14cf makepkg: revert bash4-ism
Commit 3d67d9b1 introduced multiple bash4 string manipulations.
Revert those in order retain compatibility with bash-3.2 which
is still widely used.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-20 21:00:49 -05:00
Dan McGee
6c00ca8f23 Handle sync target + ignore properly
Rather than say we can't find the target after saying "No, I guess I don't
want to install this", we should make sure the ignored status gets passed
all the way through. This fixes FS#19866.

Pactest is also included that failed before due to the fact that we normally
treat an unfound package as a reason to exit with a non-zero status.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-20 15:19:19 -05:00
Allan McRae
59c47aaf52 Clarify testing within conditional statements
Follow the HACKING guidelines and always use != 0 or == 0 rather
than negation within conditional statements to improve clarity.
Most of these are !strcmp usages which is the example of what not
to do in the HACKING document.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:58 +10:00
Andres P
d7dccd5419 makepkg: remove unnecessary use of sort
pacman -Qq output is sorted according to the users LC_COLLATE
setting as is needed for comm.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: adjust commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:58 +10:00
Andres P
3e4d2c3aa6 libalpm: compare pkgname with strcoll
Use strcoll to compare package names to provide output sorted
according to a users LC_COLLATE settings.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: added commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
f5f107674b makepkg: use parameter expansion instead of basename
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
1b93a116e7 makepkg: fix inconsistent output when checking dependencies
Instead of writing:
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Installing missing dependencies...

Just make it homogeneous:
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
70418e48f6 makepkg: merge in-line splitpkg handling logic
Ease maintainace; the two parts that have been combined into a function were
identical.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: rename function]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
c7a37d039b makepkg: add to variables without expanding them
Use foo+=" bar" instead of foo="${foo} bar"

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
cd042640c6 makepkg: less code repetition for empty variable checking
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
13748ca052 makepkg: use "declare -f" to test for function presence
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Andres P
34229c5625 makepkg: fix variable checks when writing pkginfo
Regression caused by c71fe7db. Was checking for "optdepend" and "conflict"
rather than "optdepends" and "conflicts" when populating .PKGINFO.

Signed-off-by: Andres P <aepd87@gmail.com>
[Allan: adjust commit message]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-21 01:04:57 +10:00
Dan McGee
7fc50d7950 Revert disabling of make in doc/ dir by default
This is a partial revert of commit d44e5099. By making disabling docs the
default, it presents all sorts of problems- namely anyone who builds from a
tarball and isn't careful enough to include '--enable-doc' will get an
install without any manpages at all. Remember that make includes both
'build' and 'install' steps.

The warning introduced by the commit is kept, so we do not lose all its
benefits, but I am not happy to see regressions introduced in packaging and
installing of this piece of software.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-17 00:01:23 -05:00
Allan McRae
dc817a2061 makepkg: fallback to sane defaults for library stripping
If the library stripping variables are not defined in makepkg.conf,
libraries will be fully stripped and become broken.  Fallback to a
sane default stripping level.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-16 23:54:33 -05:00
Nezmer
09aae4b7a5 makepkg: Extract from any file bsdtar can recognize
If "file -bizL" does not return a supported type, check if the file is
recognized by bsdtar and if yes extract from it.

Dan: use '-q' option to prevent needing to seek the entire archive.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P
c71fe7db42 makepkg: use printf when writing pkginfo
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P
0e96532096 makepkg: use single redirection when writing PKGINFO
Instead of specifying the output file on every echo, leave it to the
caller of write_pkginfo to specify the target.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P
f258ffab25 makepkg: use double brackets
Change all instances of the (test) [ builtin to the [[ keyword.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Andres P
95145d4c52 makepkg: use type -p's return value for PATH checks
Rely on type -p's return value instead of a string check.

And gettext was previously being checked with type -t, which was
inconsistent with the rest of the tests pertaining commands that aren't
expected to be functions nor builtins.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:34:57 +10:00
Allan McRae
3c8816f74b makepkg: fallback to sane defaults for library stripping
If the library stripping variables are not defined in makepkg.conf,
libraries will be fully stripped and become broken.  Fallback to a
sane default stripping level.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-17 14:32:08 +10:00
Dan McGee
892266277e Fix distcheck invocation in doc/ directory
Commit 5fe41df8 broke `make distcheck` pretty badly for the doc directory.
Looking at what this commit was trying to accomplish, it make sense to
revert a lot of the build system changes and just simplify what we are
showing in the man page anyway- an example, not exactly how it is configured
on your system.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-16 21:01:09 -05:00
Dan McGee
2ee186506c Add test/util directory as necessary to build files
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-16 21:00:44 -05:00
Dan McGee
1c59b9e881 Update website with 3.4.0 release
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-16 20:10:47 -05:00
甘露(Gan Lu)
2e5e3739a1 Fix issue in Chinese translation
Fixes FS#19777.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-16 10:19:44 -05:00
Dan McGee
84b999823b Add a .mailmap file
This helps out `git shortlog` by mapping our various mismatched authors and
email addresses. The number of authors reported by shortlog goes from 131 to
98 after this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-15 19:56:47 -05:00
Ionuț Bîru
c355d2a3b7 Update Romanian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 12:18:01 -05:00
Leandro Inácio
6e31ddf42e Revise Portuguese (Brazil) translation
Fix the '\t' characters that got introduced by the last update of this
translation that should not have been there.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 12:08:28 -05:00
Manuel Tortosa
8fbc91e693 Updating Catalan translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 12:02:07 -05:00
Juan Pablo González T
fe7b77cd8a Update Spanish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 11:00:20 -05:00
Roman Kyrylych
ea7696b441 Update Ukrainian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-14 10:29:57 -05:00
Leandro Inácio
6297248087 Update Portuguese (Brazil) translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-11 19:01:46 -05:00
Dan McGee
5f5b6f16af translations: rename Norwegian translation from nb_NO to nb
This puts us more in line with other projects that don't attach the country
code to the language code.

$ du -sh /usr/share/locale/nb*/LC_MESSAGES
3.5M    /usr/share/locale/nb/LC_MESSAGES
132K    /usr/share/locale/nb_NO/LC_MESSAGES

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-11 10:05:45 -05:00
Dan McGee
f9c70d3140 translations: rename Swedish translation from sv_SE to sv
This puts us more in line with other projects that don't attach the country
code to the language code.

$ du -sh /usr/share/locale/sv*/LC_MESSAGES
7.2M    /usr/share/locale/sv/LC_MESSAGES
60K     /usr/share/locale/sv_SE/LC_MESSAGES

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-11 09:57:12 -05:00
Christos Nouskas
d978039cf0 Revise Greek translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-09 15:16:59 -05:00
Allan McRae
d73d055c6f makepkg: use BUILDFILE rather than BUILDSCRIPT
In check_sanity, BUILDFILE needs to be checked rather than
BUILDSCRIPT.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-09 16:52:49 +10:00
Allan McRae
b886362282 makepkg: fix errors with multiple install or changelog files
Another issue caused by fe1e3471.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-09 15:58:05 +10:00
Allan McRae
ac5c2fd09b Fix creation of source packages
Source packages were getting created with only links to local source
files.  Caused by commit 5cddcc90.

Also, fix dangling symlinks to install and changelog files. Caused
by commit fe1e3471.

Thanks to Christopher Rogers <slaxemulator@gmail.com> for pointing
out areas that were failing.

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-09 15:58:05 +10:00
Dan McGee
8163beb622 Update English (British) translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 20:17:14 -05:00
Nagy Gabor
88f139ab4e API changes between 3.3 and 3.4
Updates for README file.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 18:18:34 -05:00
Matthias Gorissen
b00d911331 Update German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 15:08:43 -05:00
Sergey Tereschenko
982018bf74 Update Russian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 12:24:48 -05:00
Dan McGee
93def410b8 Add note about XySSL/PolarSSL name change
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 10:35:08 -05:00
Baurzhan Muftakhidinov
9a56830164 Update Kazakh translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-07 09:30:39 -05:00
Xavier Chantry
3012c0e091 Update French translation
Thanks to CalimeroTeknik <calimeroteknik@free.fr> for providing many
corrections !

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-06 16:42:01 -05:00
Christos Nouskas
b79193a37e Update Greek translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-06 16:41:35 -05:00
Dan McGee
a338778028 Remove unnecessary gettext call
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:42:46 -05:00
Vojtěch Gondžala
d58f398312 Update Czech translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:40:42 -05:00
Nagy Gabor
c80e04a151 Update Hungarian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:34:31 -05:00
Giovanni Scafora
a3b1585b7b Update Italian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:30:51 -05:00
甘露(Gan Lu)
a66f8dbbb1 Update Chinese translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05 11:27:45 -05:00
Samed Beyribey
10aba2fd53 Update Turkish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-04 19:44:33 -05:00
Dan McGee
46b170a26e Bump configure.ac versions for 3.4.0 release
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-04 17:02:24 -05:00
Dan McGee
5bf3ba1ca8 NEWS: add some flyspray bug numbers
Also add a note about bash completion improvements.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-04 16:49:48 -05:00
Dan McGee
f60db581a7 translation: update pot/po files for libalpm in prep for release
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-04 13:36:38 -05:00
Dan McGee
a8a6eed9e8 translation: update pot/po files for pacman in prep for release
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-04 13:35:57 -05:00
Allan McRae
d8d5d48270 NEWS update for pacman-3.4
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-03 18:14:56 -05:00
Cedric Staniewski
5cddcc901b makepkg: refactor absolute filename detection
Move the absolute filename detection to a new function to reduce code
duplication.

This patch also fixes the --allsource option that did not include remote
source files if they reside in $startdir instead of $SRCDEST.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-06-03 18:14:25 -05:00
Cedric Staniewski
3739fe9913 makepkg: print only base filename of install/changelog files
The complete file path of a temporary symlink is really useless
information.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-03 14:15:50 -05:00
Dan McGee
756e49259d contrib: kill gensync/updatesync
These are old and have outlived their usefulness at this point. Kill them.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-03 14:07:48 -05:00
Dan McGee
0ac96d94ec Move vercmp tests into util/ testing directory
Now that not everything is in 'pactest/', we can separate out the parts a
bit more and leave the pacman/ directory to be just pactest.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-02 13:24:22 -05:00
Allan McRae
844d82fad8 Move pacman test suite
Move the test suite to test/pacman in order to make a logical
location for a future makepkg test suite.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-02 13:14:51 -05:00
Allan McRae
ccea1b5576 Fix typo in pactest
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-02 13:14:41 -05:00
Allan McRae
2710b256cc Remove unnecessary error catching from PKGBUILD protos
The use of "|| return 1" is no longer necessary in PKGBUILDs.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-02 13:14:34 -05:00
Allan McRae
5dffef787d repo-add: symlink to db file to reponame.db
This is a small step towards allowing pacman to handle databases
with variable compression types.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-27 09:19:13 -05:00
Andres P
fe1e3471f4 makepkg: remove code duplication in buildscript parsing
Merges code in two almost identical chunks in create_srcpackage and
check_sanity.

Also discards the space kept by regex in ae73d75660 and earlier, since
the for loop discards it later on.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-27 09:18:52 -05:00
Dan McGee
3064f8d08d Update pacsearch to work with new Qs/Ss output
Now that we have the '[installed]' text, update pacsearch to look for it and
highlight it instead of the former '***' prefix.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-27 09:18:20 -05:00
Andres P
80f7c1707c bash_completion : full rewrite with many improvements
* Undeclared local vars with common enough names to warrant breakage
* Performance issues with _pacman trying to replicate /usr/bin/pacman
  with find and other slow tools.
* Performance issues with expanding an array (with sometimes hundreds of
  items) over three times.
* Expanding said array to remove already completed entries had the side
  effect of braking filenames with spaces and or \n.
* add -D --database options and --print
* fix dirs showing up when they shouldn't in completions
* completions regarding database entries shouldn't trigger filename
  completion.

This is now down to 106 lines. The original one (master) is 365 lines
long, yet this one retains all functionality.

The work is documented in FS#16630.

Signed-off-by: Andres P <stderr@mail.com>
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-24 21:24:48 -05:00
Andres P
ae73d75660 makepkg: replace unnecessary uses of grep
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-24 21:23:55 -05:00
Allan McRae
3cd237dec3 makepkg: fix permissions on install and changelog files
The .INSTALL and .CHANGELOG files in a package retained the permissions
that they had in $startdir.   Do a chmod after copying to ensure
that the permissions are sane.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-24 21:23:47 -05:00
Andres P
52c3f871db makepkg: don't decompress when stripping binaries
f569c4a042 wrongly relied on file's output.

The fix is to not decompress files in the first place.

Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-24 21:18:57 -05:00
Allan McRae
f948cb25bb Change directory in package function in PKGBUILD.proto
makepkg goes back to the $startdir between the build() and
package() functions so we need to change directory at the
start of the package function.

TODO: fix makepkg to make this unnecessary

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-05-19 20:33:35 +10:00
Jonathan Conder
9ab6bfad22 fix memory leak in _alpm_sync_commit
Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:51:31 -05:00
Daenyth
ac722c9327 rankmirrors: Add a --repo option to target a specific repo
Signed-off-by: Daenyth <Daenyth+Arch@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:43:17 -05:00
Allan McRae
c1fc00508e makepkg: allow skipping integrity checks when making source package
Extends the use of the --skipinteg option to creating a source
package. Fixes FS#15984.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:35:55 -05:00
Nagy Gabor
0e7ba6bddd New pactest: unresolvable001.py
To test the regression of commit eada558e12.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:33:56 -05:00
Nagy Gabor
eada558e12 Partial fix for the phonon/qt issue
This patch fixes the phonon/qt issue, if all to-be-upgraded packages are
explicit targets (ie. only not-yet-installed packages are pulled by
resolvedeps). This condition covers the most common situations, for example
it should hold with every -Su operation.

After this patch sync405.py passes, but sync406.py doesn't.

The work is inspired by the patch of Henning Garus, thanks for his work:
http://mailman.archlinux.org/pipermail/pacman-dev/2010-February/010429.html
(I moved the alpm_list_diff computation to sync.c in order to compute it
only once.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:33:00 -05:00
Nezmer
c6f0fc27ed Resolve dependencies whenever --syncdeps is passed and --nodeps is not
With this patch, dependencies will be resolved and not silently ignored
when running:

makepkg --nobuild --syncdeps
makepkg --repackage --syncdeps

Also, a warning is displayed when repackaging and dependencies are not
being resolved.

Thank you Allan for the feedback.

Signed-off-by: Nezmer <git@nezmer.info>
[Allan: Only warn when repackaging with a package function]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:31:59 -05:00
Xavier Chantry
d44e509933 configure.ac : disable doc by default and check for asciidoc
This is a complaint that has been reported many many times. By default, docs
are enabled and there is no check for asciidoc, so anyone building from git
will see their build fail.

We cannot do a strict check for asciidoc because released source tarballs
have man pages already built, and it should be possible to install them
without having asciidoc.

This patch attempts to improve the situation in two ways :
1) disable doc by default
2) print a warning if docs are enabled but asciidoc is not installed

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:30:29 -05:00
Dieter Plaetinck
d32f6daa66 fix for incorrect checking of return code, which causes syntax errors
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18 11:29:05 -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
Dan McGee
a6ace987a9 Add some machinery to test the Include directive
After the previous patch that re-enabled its use outside of sync repository
sections which we had unintentionally disabled.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-17 18:47:30 -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
df842e11cf pactest: remove cargo-cult option reset
This doesn't need to be here. We don't even support non-CamelCase options
anymore.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-17 18:23:07 -05:00
Nagy Gabor
25cd6c2e8d Fix a serious bug in the download code
After commit df99495b82 pacman downloaded files from the first repo only,
and reported corrupted packages for all files from other repos.

The download_size was set to 0 for _all_ transaction packages after
downloading some files from the first repo. This code-block was moved to its
correct place.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-14 15:03:21 -05:00
Dan McGee
f03f09011f doc: fix up description of where example PKGBUILD is located
As Allan pointed out, this actually ships with pacman (at least with Arch)
and not necessarily with ABS or any other package. Also fix the language
dealing with the prototype install files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-13 19:14:16 -05:00
Dan McGee
10b0acfc20 PKGBUILD.vim: only allow hex characters in checksums
Of course, we still have only md5 and sha1 hardcoded here but I resisted the
urge to copy paste for the rest of our supported checksums in hope that
someone knows how to do it a better way.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-13 17:46:30 -05:00
Dan McGee
07b2ba251f Add 'pkgbase' highlighting to vim syntax file
Simple change and probably a bit too copy/paste, but works for now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-13 17:26:54 -05:00
Xavier Chantry
df833f6c64 PKGBUILD.vim : update valid licenses
Updated list with :
echo $(pacman -Ql licenses | grep "/usr/share/licenses/common/.*/$" | cut
-d'/' -f6 )

Maybe PKGBUILD.vim could do this at runtime ?

Dan: you forgot the symlinks; readded FDL, GPL, LGPL.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-13 17:11:25 -05:00
Allan McRae
7f02f7cb9f Allow -Qo to perform a functional 'which'
When pacman queries the ownership of an object that is not a path, it will
check in the users PATH for a match. Implements FS#8798.

Dan: did some small refactoring and error message changes when PATH is
searched and nothing is found.

Original-patch-by: Shankar <jatheendra@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-11 12:09:43 -05:00
David Campbell
364ebf4e16 Switch Contributor line with Maintainer line.
When someone is creating a new PKGBUILD he will most likely be the maintainer
not a contributor.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-06 11:38:08 -05:00
Allan McRae
2ce444ee10 makepkg: rework --skipinteg
The current --skipinteg is a bit weird.  It does not skip integrity
checks, but instead does them and prints a warning. Change this
behaviour to actually skipping the checks.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 19:31:58 -05:00
Xavier Chantry
79987c92cb makepkg -g: use checksums defined in the pkgbuild
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Allan: amend documentation]
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 19:28:49 -05:00
Allan McRae
64c3255b0e makepkg: handle multiple install and changelog files
The presence of all install and changelog files (multiple files may
be used with package splitting) is checked for in check_sanity().

All install and changelog files are copied to the source location
when using --source.  The check for install and changelog file presence
is removed in create_srcpackage() as this is redundant to the checks
performed in check_sanity().

Moved install and changelog handling in create_srcpackage() to after
source array files, as this is more logical and readily allows for the
following.

A check is made when creating a source package that a symlink to an
install file has not already been added.  This can occur if the
install file is used multiple times or if it is listed in the source
array.

Fixes FS#18831, FS#18394 and partially fixes FS#16004

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-05-05 19:27:55 -05:00
Ray Kohler
590606a5d7 makepkg: fall back to su if sudo is not available
Signed-off-by: Ray Kohler <ataraxia937@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 19:26:56 -05:00
Allan McRae
ccbef232c9 makepkg: improve removal of installed dependencies
Compare a list of packages on the system before and after dependency
resolution in order to get a complete list of packages to remove.  This
allows makepkg to remove packages installed due to provides.

Bail in cases where packages that were on the system originally have been
removed as there is a risk of breaking the system when removing the new
packages.

Fixes FS#15144.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 19:26:06 -05:00
Jonathan Conder
df99495b82 Compute package download size outside _alpm_sync_prepare
And add a new info level for this piece of data.

Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 18:15:52 -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
Dan McGee
9528c36452 Add two new pactests for --dbonly
It caught me by surprise that:
1. These weren't being tested at all
2. The --dbonly combined with -U not only "works" but is also completely
   undocumented. It also has some weird behavior on install vs. upgrade that
   may need addressing.

Add some tests which will hopefully provoke some discussion.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05 11:11:20 -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
Dan McGee
6b6eb6345b Fix up the cross-compilation patch library lookup
Don't explicitly add things to the list that might not need to be there, and
get the fallback list of libraries correct.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04 23:43:43 -05:00
Dan McGee
eb6af031ec Build vercmp without needing link to libalpm
Include the object file directly from the libalpm version comparison code as
it is the only thing we need. This drops the dependency of vercmp on
libalpm and all of the stuff we know it drags in.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04 23:42:01 -05:00
Dan McGee
4f80993933 Remove call to function logger
It isn't really necessary here and it helps us get rid of some link
pollution so we can have a slim vercmp binary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04 23:38:52 -05:00
Dan McGee
2a6f3f0652 Move vercmp code into a separate file
This will facilitate using this object file on its own in the vercmp tool
which will be done in a future commit. The net impact on the generated
binaries should not be noticeable after this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04 23:32:13 -05:00
Dan McGee
8a6bbed98e Update PKGBUILD.proto to include a package() function
Relevant after we deprecated `makepkg -R` without a package() function being
present in the PKGBUILD.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-04-27 13:08:09 -05:00
Allan McRae
90aca75cb9 makepkg: BSD find compatibility fix
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-04-26 18:49:28 -05:00
Christophe Chapuis
753599b504 contrib/pactree: generate reverse dependency trees
Add an option to show the tree of packages which depend on a given
package

Signed-off-by: Allan McRae <allan@archlinux.org>
2010-04-26 18:49:11 -05:00
Nagy Gabor
652762488a New pactests for the phonon/qt issue
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>
2010-04-26 18:47:56 -05:00
Allan McRae
6995aed9ae makepkg: deprecate repackaging without a package function
File permissions are not guaranteed to stay the same on exit from fakeroot,
so repackaging may result in files with different permissions. This is
avoided when using a package() function (or split packages) as the
packaging step is rerun.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: touched up message for translation purposes]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-04-26 18:46:41 -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
Xavier Chantry
7965345d43 More consistent printing of off_t and time_t
time_t : %ld
off_t : %jd and cast to intmax_t

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:58:35 -05:00
Dan McGee
21abae98cb Update -Si docs to reflect new -Sii operation
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:36:30 -05:00
Allan McRae
98ee520907 Sort and avoid duplicates in -Sii output
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:32:48 -05:00
Allan McRae
526806e7ac alpm_list_diff_sorted - make some arguments const
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:31:37 -05:00
Matthias Lanzinger
bf7c3eb17f Fix cross-compilation issues with git and libfetch
This patch fixes 2 issues I encountered when cross-compiling pacman.
First is the test for libfetch which requires explicit linking to all
libraries libfetch depends on.

The other problem results from the AC_CHECK_PROGS test for git. This
test will stop configure with an error when cross-compiling.
The fix moves the call to AC_CHECK_PROG so that is only called of
--enable-git is actually set.

Signed-off-by: Matthias Lanzinger <mlaenz@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25 21:28:01 -05:00
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
ad4efa539d Strip extension off all package compression types
Since we were searching for '.pkg.tar.gz' before, we now have started to
show extensions during the download when we have a '.pkg.tar.xz' package.
Just look for '.pkg.tar.' (or '.db.tar.') instead and suppress anything
found from that point on.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-18 21:46:03 -05:00
Dan McGee
f6c7de77ed Unbreak the database partial extraction code
Basically I'm the idiot that thought I could make it better and completely
forgot how freeing the contents of the original lists would screw up our
nice little diff extraction lists. This caused segfaults among other
problems. Last time I try to do that...

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff627ce26 in strcmp () from /lib/libc.so.6
(gdb) bt

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15 23:06:22 -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
Dan McGee
be2f43191d Reduce duplicate code in DB extraction
Follow-up to the previous "Only extract new DB entries" patch; move the
partial extraction code inside one side of the loop so we can use the same
code for actually doing file extraction.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:16:26 -05:00
Xavier Chantry
2f4ee4341d Only extract new DB entries
This implements FS#15198. The idea apparently came from Csaba Henk
<csaba-ml <at> creo.hu> which submitted a patch to Frugalware, so thanks to
him, even though I did not look at the code :)

The idea is to only extract folders for new packages into the package
database and clean up the old directories. This is essentially implementing
Xyne's "rebase" script within pacman.

If using -Syy, just remove and extract everything.

If using -Sy :
1. Generate list of directories in DB
2. Generate list of directories in archive
3. Compare both
4. Clean up old directories
5. Extract new directories

Original-work-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: fix compile error, s/int/size_t/]
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 19:12:24 -05:00
Dan McGee
69b3a811a1 Mark two functions static
These were just introduced in the `--print` patch, and don't need to be
exposed outside of util.c.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:47:40 -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
67700b926a print installed packages
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:41:38 -05:00
Xavier Chantry
e4be3e06af callback: use variable length for progressbar text
This fixes FS#17523

We always used a fixed value of 50 for textlen, which is often not enough
for download progress bar. At least we can use a bigger width on large
terminal (e.g. 60% of width) and keep 50 as minimum.

before:
 nautilus-2.28.4-1-x...     5.7M  789.2K/s 00:00:07 [####################################] 100%
after:
 nautilus-2.28.4-1-x86_64         5.7M  770.7K/s 00:00:08 [##############################] 100%

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:39:43 -05:00
Xavier Chantry
e5dce888c0 callback.c : less magic progress bars
1 - Explain magic numbers

2 - There was a weird off by 1 mess in the progress bar. The code supposedly
shared the width between 50 chars for text (textlen) and the rest for the
progress bar (proglen = getcols() - textlen).
But the code actually used textlen + 1 for the text and proglen - 1 for the
progress bar (with haslen=1, the progress bar was actually empty), which was
a bit confusing so I changed it.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:39:26 -05:00
Xavier Chantry
087be2f1fb delta : add external cleanup script
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:34:42 -05:00
Allan McRae
6f0ffb2386 makepkg: always update symlinks to compressed man pages
When a man page has both symbolic and hard links, any symlink pointing
to other than the alphabetically first hardlink was not "compressed"
and left dangling towards the uncompressed man page. Fixes FS#18569.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:34:27 -05:00
Cedric Staniewski
5fe41df8a9 makepkg: make strip options configurable
The newly added variables STRIP_BINARIES, STRIP_SHARED and STRIP_STATIC,
that are set in makepkg.conf, specify the strip options used on binaries
and shared and static libraries.
In addition, files are now stripped more aggressively by default.

Implements FS#13592 the way it was suggested by Allan in the comments.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:34:16 -05:00
Dan McGee
22331fdadb makepkg: Remove setgid bit on srcdir/pkgdir creation
It was noted in FS#17533 that setgid bits are carried down into any created
subdirectories, and thus could end up being in a built package if the
original package directory was marked g+s. When we create src/ and pkg/,
explicitly chmod them to remove any sticky bits.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-03-14 18:32:44 -05:00
Allan McRae
65d43fbb84 makepkg: abort on missing or non-writable PKGDEST
When PKGDEST pointed to a non-writable location, makepkg would fail
after completing the build process. This patch makes it abort as
soon as PKGDEST is parsed.

Also, move the SRCDEST check to the same point rather than right
before downloading sources (which was after dependency checks).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:30:35 -05:00
Allan McRae
a4e3fd1847 makepkg: only strip files that are writable
TODO: http://mailman.archlinux.org/pipermail/pacman-dev/2010-January/010390.html

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14 18:30:23 -05:00
Nezmer
de5473c026 makepkg: Add documentation for the new SRCPKGDEST variable
Add SRCPKGDEST documentation to the makepkg.conf man page

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28 23:25:13 -06:00
Cedric Staniewski
eee61a0bbc makepkg: document environment variables PKGDEST and SRCDEST
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28 23:25:08 -06:00
Allan McRae
7ea0a115db makepkg: update required programs
Remove getopt, add xz.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28 23:23:04 -06:00
Cedric Staniewski
1a00ee5c27 bash_completion: remove absolute utility paths again
The location of the used utilities may and does differ between various
distributions and therefore absolute paths do not work well. Since the
main purpose of its introduction was to avoid side-effects caused by
aliases, it is sufficient to disable possible aliases temporarily by
preceding the commands with a backslash.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28 23:19:03 -06:00
Pierre Schmitz
d85421ec62 contrib/*_completion: match *.pkg.tar.*
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-28 23:17:54 -06:00
Allan McRae
afb61bb22a Do not print installed size when only downloading
When using --downloadonly the "Total Installed Size" message is not
needed and perhaps misleading.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 23:39:22 -06:00
Nagy Gabor
27bc2f7eb8 Print "there is nothing to do" with NOOP transactions
The "local database is up to date" message has been replaced with "there
is nothing to do" message. This used with "empty" -S, -R, -U operations too.
(Examples: pacman -S ignored_pkg, pacman -Ru needed_pkg.)

See FS#17859.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 22:14:12 -06:00
Dan McGee
0eadc99240 Merge branch 'maint'
Just a slight touchup in makepkg due to the [ -> [[ conversion, so nothing
to see here.

Conflicts:
	scripts/makepkg.sh.in
2010-01-19 22:03:54 -06:00
Dan McGee
8b3f5f0ce6 bash_completion: use absolute paths to utilities
Fixes issues noted in FS#16630.

Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 03f35b1432)

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 21:58:01 -06:00
Cedric Staniewski
ce9bb994f8 makepkg: fix abortion after sourcing /etc/profile
The source command triggers / might trigger the ERR trap which makes
makepkg abort right after a successful installation of missing
dependencies.

Thanks to Xavier Chantry <shiningxc@gmail.com> for finding this
solution.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 77e84bea71)

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 21:56:36 -06:00
Allan McRae
0c3f502064 contrib/bacman: fix checking if file has been added
Fixes FS#17140.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 0199a7ee71)

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 21:56:00 -06:00
Dan McGee
a12ed63545 NULL out handle after release
We free'd the handle but didn't NULL out the global variable, leading to
problems if you try to reinitialize the library. Make sure we clean up after
ourselves.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 21:52:54 -06:00
Nezmer
afc37c58c7 makepkg: Introduce $SRCPKGDEST
Introduce $SRCPKGDEST to define a destination dir for source packages
instead of saving them in $PKGDEST with binary packages.

The simple patch doesn't break old behavior.

Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-19 21:51:51 -06:00
Cedric Staniewski
335627d72d makepkg: check for non-empty pkgbase instead of pkgname
pkgbase is used in the following rm calls, and since pkgname can be
present when pkgbase is not, it is safer to check for pkgbase.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-14 21:39:24 -06:00
Cedric Staniewski
a6cca6e456 makepkg: remove srclinks directory on error exit
When makepkg exits in create_srcpackage(), the (temporary) srclinks
directory is left behind.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:31:06 -06:00
Nezmer
9fe27b068a makepkg: skip devel_check() when repackaging
Currently, "makepkg -R" creates a package with a wrong updated $pkgver.

Signed-off-by: Nezmer <Nezmer@allurelinux.org>
[Allan: adjusted comment]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:30:58 -06:00
Cedric Staniewski
05ff276eef makepkg: limit sudo usage to allowed pacman commands
This is particularly useful when using pacman wrappers which call sudo
by themselves and therefore should not be run as root.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:28:43 -06:00
Cedric Staniewski
66c6d288fd makepkg: allow to specify an alternative pacman command
If PACMAN environment variable is set, makepkg will try to use this
command to check for installed dependencies and to install or remove
packages. Otherwise, makepkg will fall back to pacman.

Implements FS#13028.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: move envvar section in manpage]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:26:54 -06:00
Allan McRae
b805fe58ae makepkg: check for references to build root in package
Add a check that the package does not contain references to the
folder it was built in.

Fixes FS#14751

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:22:34 -06:00
Xavier Chantry
a2c9cbdbdc improve download_internal error messages
download_internal is supposed to always set pm_errno but did not in many
cases.

The most important (and tested) change is the one concerning fetchStat. This
is typically where the code will fail when the network is down for example.

Before commit d2dbb04a9a, this fetchStat call did not exist and the
same kind of errors would be encountered in the fetchXGet call that follows.
I just copied the error printing to restore the old behavior.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:22:16 -06: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
Nagy Gabor
444ff95641 Print error on duplicated database entries
Some users reported duplicated database entries in /var/lib/pacman/local/,
for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus
3rd-party scripts, backup?) In this case pacman reported no error and its
behaviour was mysterious.

From now on, pacman detects this situation and prints an error message.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:18:58 -06:00
Dan McGee
e612eb6ba2 Remove trailing whitespace on all lines in list_display
This ensures we never have trailing whitespace. Take the following text,
with line numbers added for clarity:

1. Title   : item1 item2 item3 item4
2.           item5 item6 item7 item8
3.           item9 itemA itemB itemC

Laszlo Papp helpfully pointed out we would have two trailing spaces on line
three after the last item. However, we also had these trailing spaces on
lines one and two, which the initial patch didn't take care of. This can be
seen on something like `pacman -Qi glibc`.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-13 23:12:44 -06:00
Dan McGee
926dfe5827 Fix requiredby output
This is a bit embarrassing. For example:
$ pacman -Qi mesa
...
Required By    : mesa  mesa  mesa  mesa  mesa  mesa

Something is clearly not right, and the problem was introduced in commit
0bc961. Fix the issue by getting the package name off the correct variable.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-07 22:48:59 -06:00
Dan McGee
03f35b1432 bash_completion: use absolute paths to utilities
Fixes issues noted in FS#16630.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 23:01:12 -06:00
Allan McRae
f2c9e51eb0 makepkg: allow specifying subsets of packages to build
This allows makepkg to only build a specified subset of packages
from a split PKGBUILD.  This is very useful in combination with the
-R flag or when bumping the pkgrel of a single package.

Fixes FS#15956.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 21:22:52 -06:00
Cedric Staniewski
82443e0059 makepkg: move pacman calls to a function
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 21:19:54 -06:00
Eric Bélanger
93862bd7cb makepkg: Place packages symlinks in build dir when PKGDEST is used
When PKGDEST is used, symlinks to the packages will be put in the build
directory.  This combines the convenience of a global package cache with
the ease of having a package (i.e. a symlink) in the build directory for
testing and installation purpose.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
[Allan: add comment documenting clean-up addition]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 21:12:27 -06:00
Isaac Good
6c8f817040 Replace an ugly while [ with a for (( loop
Signed-off-by: Isaac Good <pacman@isaac.otherinbox.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-30 21:06:17 -06:00
Dan McGee
96b34308fe Fix syntax error in new translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 21:22:01 -06:00
Dan McGee
8a8dfc9d55 HACKING: add some notes about valgrind/gdb usage
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 20:21:50 -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
Eric Bélanger
120cd312e4 makepkg: Fixed logging for split packages
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:34:09 -06:00
Cedric Staniewski
4d2ec3751c makepkg: allow the use of only a package() function
For some packages, generally the 'any' arch ones, a build step is not
required and therefore can be skipped. In these cases, a package()
function without a build() one is sufficient.

As a side effect, this commit makes meta packages without any function
at all in the PKGBUILD possible.

Fixes FS#15147.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:33:03 -06:00
Cedric Staniewski
564352c4a2 makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames
Since commit fb97d32, which brought in this test, support for split
PKGBUILDs was added, and therefore, all values of pkgname and also
pkgbase have to be checked now.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:30:23 -06:00
Allan McRae
9c34dfd908 makepkg: Add fallback to package function
makepkg looks for a package() function when building a single package
but package_$pkgname() style package functions when building a split
package.  This patch allows the use of a package_$pkgname() function
when building a single package for consistency.  This is achieved by
having makepkg consider a non-split package with a package_$pkgname()
function as a split package (creating just the one package).

Fixes FS#16622.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:29:24 -06:00
Isaac Good
c2999619d2 makepkg: use bash test operators, part two
* FS#16623, second half of makepkg
* Includes stuff like -o to ||, -a to &&, etc.
* if [ $(type ... preserved due to a bash bug with [[ and set -e and ERR traps

Signed-off-by: Isaac Good <pacman@isaac.otherinbox.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:26:56 -06:00
Isaac Good
966c815881 makepkg: use bash test operators, part one
* FS#16623, first half of makepkg
* Includes stuff like -o to ||, -a to &&, etc.
* if [ $(type ... preserved due to a bash bug with [[ and set -e and ERR traps

Signed-off-by: Isaac Good <pacman@isaac.otherinbox.com>
[Dan: made commit message useful]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:23:06 -06:00
Cedric Staniewski
5d5070f47d scripts: replace test builtin [ with shell keywords [[ and ((
FS#16623 suggested this change for makepkg; this patch applies it to the
remaining files in the scripts directory.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:22:54 -06:00
Xavier Chantry
fb310fc01e pacman.conf : enable resuming for curl
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:20:21 -06:00
Eric Bélanger
77023978c5 makepkg: Clarified error message when a sourceball exist already
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:19:21 -06:00
Cedric Staniewski
77e84bea71 makepkg: fix abortion after sourcing /etc/profile
The source command triggers / might trigger the ERR trap which makes
makepkg abort right after a successful installation of missing
dependencies.

Thanks to Xavier Chantry <shiningxc@gmail.com> for finding this
solution.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:19:11 -06:00
Allan McRae
0199a7ee71 contrib/bacman: fix checking if file has been added
Fixes FS#17140.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:18:56 -06:00
Manuel Tortosa
88706168f2 Add Catalan translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15 19:09:58 -06:00
Dan McGee
7ae15768e5 Merge branch 'maint' 2009-11-10 18:21:19 -06:00
Dan McGee
e09253d15b Necessary updates for 3.3.3 release
Should cover everything worth mentioning in NEWS, plus the version number
bumps as usual.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-10 16:18:05 -06:00
Cedric Staniewski
db756ed931 makepkg: quote arrays in order to preserve spaces in array items
Fixes FS#16871 and makes the pkgdesc workaround obsolete.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-10 11:24:20 -06:00
Dan McGee
133a39e2bb Fix opendir error condition checks
Thanks to Laszlo Papp <djszapi@archlinux.us> for the following catch:
  opendir(path)) == (DIR *)-1;
is maybe the result of misunderstanding the manpage. If an opendir() call
isn't successful it returns NULL rather than '(DIR *)-1'.

Noticed-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-27 21:11:29 -05:00
Dan McGee
3f7cc83e0d Merge branch 'maint' 2009-10-26 21:07:29 -05:00
Laszlo Papp
361a25c086 Fix a small typo in alpm_list.c
Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:27:48 -05:00
Allan McRae
fff6d9dc2e makepkg: allow passing arguments with spaces
Currently makepkg takes the commandline arguments, assigns them to a
variable and passes that variable to the next makepkg call (within
fakeroot).

Use a comination of quotes and arrays in this process to ensure any
arguments passed within quotes and containing spaces stay as a single
argument during the second makepkg call.

Thanks to Dan for figuring out how to get this working.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:22:34 -05:00
Dan McGee
7f0f319a3e Merge branch 'maint' 2009-10-24 10:10:15 -05:00
Dan McGee
0bc961a8be Reduce unnecessary get_name() function calls
alpm_pkg_get_name() gives us little benefit in backend code besides a NULL
check on the package passed in; we could do that ourself if necessary. By
changing to direct references in the cases where we are sure we have a valid
package, we save a function call each time we need a package name. This
function can't be inlined because it is externally accessible.

This cuts the calls to get_name() from 1.3 million times in a
pacman -Qu operation to around 2400.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:10:12 -05:00
Cedric Staniewski
21caf8730f makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:05:41 -05:00
Cedric Staniewski
748bc8ebd4 makepkg: use tput for terminal-safe colored and bold text
Suggested-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 10:00:52 -05:00
Cedric Staniewski
013fc9a795 makepkg: define escape sequences globally
In doing so, it is possible to get rid of all the tests for colored
messages except for one global one.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 09:59:03 -05:00
Cedric Staniewski
1000c0bd2e makepkg: check for non-empty pkgbase instead of pkgname
pkgbase is used in the following rm calls, and since pkgname can be
present when pkgbase is not, it is safer to check for pkgbase.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 09:56:07 -05:00
Heiko Baums
6ed7d001f6 pacdiff : add diffsearchpath option
Xav: added doc
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 09:55:50 -05:00
Cedric Staniewski
c6095e1032 makepkg: remove empty .part files after a failed download
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24 09:54:57 -05:00
Allan McRae
3758ccbb52 makepkg: fix testing for built package presence
Commit c7e4d10d introduced a small error in the testing of whether
a package is already built.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 23:32:50 -05:00
Dan McGee
6c635d76a0 Merge branch 'maint' 2009-10-20 22:29:20 -05:00
Allan McRae
c7e4d10df3 makepkg: allow overriding arch in split packages
This allows building a mixture of binary and arch=any packages.
Fixes FS#15955.

The value of CARCH is no longer overridden to "any" in when arch=any
is used and the assigning of the "any" arch is delayed to during the
packaging stage. Adjustments were required to fix installing and
checking for pre-built packages of varing arches.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:29:08 -05:00
Allan McRae
2020e6297b makepkg: allow overriding pkgver and pkgrel in split packages
Fixing a single package within a split package requires the overriding
or pkgrel.  In very rare (but existing) cases, it is useful to
override pkgver.  Partial fix for FS#15955.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:29:02 -05:00
Xavier Chantry
2c2596177d dload.c : clear sigaction flag to make valgrind happy
This fixes the following valgrind warning :

==26831== Syscall param rt_sigaction(act->sa_flags) points to uninitialised
byte(s)
==26831==    at 0x4282547: __libc_sigaction (in /lib/libc-2.10.1.so)
==26831==    by 0x403C693: download_internal (dload.c:152)
==26831==    by 0x403D0E4: _alpm_download_single_file (dload.c:311)
==26831==    by 0x4033B72: alpm_db_update (be_files.c:319)
==26831==    by 0x805205E: pacman_sync (sync.c:257)
==26831==    by 0x804EE54: main (pacman.c:1120)
==26831==  Address 0xbec6cc04 is on thread 1's stack
==26831==
==26831== Syscall param rt_sigaction(act->sa_restorer) points to
uninitialised byte(s)
==26831==    at 0x4282547: __libc_sigaction (in /lib/libc-2.10.1.so)
==26831==    by 0x403C693: download_internal (dload.c:152)
==26831==    by 0x403D0E4: _alpm_download_single_file (dload.c:311)
==26831==    by 0x4033B72: alpm_db_update (be_files.c:319)
==26831==    by 0x805205E: pacman_sync (sync.c:257)
==26831==    by 0x804EE54: main (pacman.c:1120)
==26831==  Address 0xbec6cc08 is on thread 1's stack
==26831==

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:25:39 -05:00
Cedric Staniewski
3d67d9b16c makepkg, repo-add: replace external commands with bash substitutions where possible
This also removes the awk dependency from makepkg and repo-add.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:24:36 -05:00
Gan Lu
5ffc1ad3cd fix for zh_CN
bash is not able to handle positional parameters

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20 22:22:05 -05:00
Laszlo Papp
4281a1a7f2 Size handling was changed in fgets() functions
Pacman's fgets function in the API used hardcoded numbers to identify the size.
This is not good practice, so replace them with sizeof handling.

Signed-off-by: Laszlo Papp <djszapi@archlinux.us>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-19 07:37:53 -05: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
Cedric Staniewski
2cabe336eb Introduce new PKGBUILD variable changelog
Currently, a changelog is added to a package if a specific file with a
hardcoded name exists in the PKGBUILD's directory. This approach is not
pretty and also inconsistent with the handling of install files, but it
works.

With the introduction of split PKGBUILDs, however, a drawback in this
old behavior has arisen: you only have the possibility to include one
specific changelog file in either every package defined in the PKGBUILD
or in none.

The use of an additional variable, `changelog`, works around this issue
and makes it possible to include a changelog in only some of the
packages, and besides, each package of the PKGBUILD can have its own
changelog file.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 22:35:20 -05:00
Allan McRae
da5fb3ee4f Fix Greek short Y/N translation
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 22:34:43 -05:00
solsTiCe d'Hiver
e3ac806262 use bitwise shift operator in enum "bit field"
This offers a cleaner way to deal with constant in enum and allow easy
maintainance

Signed-off-by: solsTiCe d'Hiver <solstice.dhiver@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 22:13:49 -05:00
Cedric Staniewski
c7d8601e12 Fix stderr redirection
When redirecting both stderr and stdout and using the 2>&1 construct,
you have to redirect stdout first. Otherwise stderr will be redirected to
the 'old' stdout and not to the new resource.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 16:34:47 -05:00
Laszlo Papp
ab3c6f01f5 Remove makepath function from frontend
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:52:12 -05:00
Nagy Gabor
72bc947cbb Fix "-Sd conflict_pkg" bug
If the -d switch was invoked with -S (or -U), the removes list was simply
lost, because trans->remove was computed in an
"if(!(trans->flags & PM_TRANS_FLAG_NODEPS))" block.

I've added a new pactest file, sync045.py (derived from sync043.py) to test
this.

Additionally, I did some other minor cleanups in sync_prepare:
 * preferred list is not needed anymore
 * I removed a needless alpm_list_remove_dupes line (the target list should
   not contain dupes at all)
 * I moved alpm_list_free(remove); to cleanup part to eliminate a possible
   memleak

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:30:52 -05:00
Xavier Chantry
3dc87851cc alpm_list : add new alpm_list_diff_sorted function
This is more efficient than alpm_list_diff since it assumes the two lists
are sorted. And also we get the two sides of the diff.

Even sorting should more efficient than the current list_diff. Sorting the
two lists should be O(n*log(n)+m*log(m)) while the current list_diff is
O(n*m). So I also reimplemented list_diff using list_diff_sorted.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:28:10 -05:00
Xavier Chantry
14ab02e289 Rework the alpm_unpack functions
Add support to extract a list of entries

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:18:47 -05:00
Xavier Chantry
471b1fa543 update sync200 pactest
update download -> fetch

This just meant that we used XferCommand even if internal download was
available, no big deal.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:12:44 -05:00
Xavier Chantry
caea098c21 cygwin fix : use unsigned char for ctype function
See http://www.nabble.com/-PATCH-RFA--Distinguish-between-EOF-and-character-with-value-0xff-td23161772.html#a23188494

cygwin 1.7 actually displays a warning when using signed char with the ctype
function, so that compilation fails when using -Wall -Werror.

So we just cast all arguments to unsigned char.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 15:12:20 -05:00
Xavier Chantry
35bbc96b99 replace rankmirrors by bash clone
This removes python optdepends in pacman package

This bash clone is a courtesy of
Matthew Bruenig <matthewbruenig@gmail.com>

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-10-11 15:08:06 -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
4828d9ef7c libalpm: clean up lock function
We were doing a lot of manual work; leverage the standard library a bit to
do more for us.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee
6e312220ec Reduce calls to list_count() in removing package
We don't need to count the number of packages left once per file when
removing; we only need to do it once per package. Also move a variable into
the correct scope.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee
3bc8c28ce3 Add missing get_usedelta() method
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:42:04 -05:00
Dan McGee
145103aacc typing: a few more fixes for special int types
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 14:41:59 -05:00
Dan McGee
35dc9b0314 int typing: s/unsigned short/int/ in libalpm
After our recent screwup with size_t and ssize_t in the download code, I
found the `-Wsign-conversion` flag to GCC to see if we were doing anything
else boneheaded. I didn't find anything quite as bad, but we did have some
goofups- most of our public unsigned methods would return -1 on error, which
is a bit odd in an unsigned context.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 13:51:47 -05:00
Dan McGee
cf0d619670 Merge branch 'maint' 2009-10-11 12:57:57 -05:00
Xavier Chantry
5e03941ee5 alpm_list : fix a bug in alpm_list_remove
A NULL list element triggered an infinite loop. Not cool :)

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 12:55:55 -05:00
Christos Nouskas
f15c8d4616 Minor fix to Greek translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 12:55:33 -05:00
甘露(Lu.Gan)
aea22ac2fd Update Chinese translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11 12:55:17 -05:00
Dan McGee
8e7652f1af Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2009-09-29 21:08:06 -05:00
Dan McGee
2071286770 repo-add: clean up options parsing
-f/--force has been dead for a while, so kill it off. In addition, the
check for > 2 args is pretty useless when you do something like:
  repo-add -q -q
or a more legit:
  repo-add -q /path/to/mine.db.tar.gz

So instead make repo-add just return 1 when it doesn't do anything with
the database which seems to make more sense.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-23 22:46:38 -05:00
Dan McGee
86d4b8a3aa Merge branch 'maint' 2009-09-22 21:38:16 -05:00
Allan McRae
5bea2c08a3 makepkg: tidy usage output
Various tidying to the usage output
 - change "--config <config>" to "--config <file>" to prevent wrapping in a 80 character wide terminal
 - re-alphabetise options, including moving all long only opts to the end
 - use same indentation for additional pacman options
 - remove useless comment

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-22 19:01:05 -05:00
Xavier Chantry
0f834c93c7 testdb : fix many memleaks
Yes, it was that bad :P

We still have memleaks left because we cannot free the error data returned
by libalpm, but pacman has the same issue.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-22 18:46:32 -05:00
Dan McGee
03470c51ca Allow cache cleaning to process all cache directories
Previously we only looked at the first cache directory returned by the
library. This allows us to look at all cache directories for cleaning.

In addition, change the way we do a full (-Scc) cache cleaning operation.
Instead of removing the parent directory, remove each package one-by-one as
in the -Sc case. This would be ideal for someone mounting a cache directory
over NFS, as it ensures we don't wipe out the mountpoint from underneath the
directory.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-21 08:12:10 -05:00
Dan McGee
ece8f6fb0b Propagate return status up in DB cleaning code
We didn't look at the return status of sync_cleandb() in sync_cleandb_all().
Make it do so and return it up the call chain.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-21 08:09:00 -05:00
Dan McGee
e6efd1932b Add missing closedir calls in cache cleanup
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-21 08:03:07 -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
Nagy Gabor
ef37168770 Ask user confirmation for -R operation, too
After commit 0da96abc, pacman always asks user confirmation for -U, so it is
more coherent to doing that for -R, too.

Btw, most users use -Rs always, so they won't notice any change. In the old
code the -Ru operation was forgotten: Though it is a not "dangerous" operation,
but the target list can be changed by that, too.

Non-interactive scripts should always use --noconfirm (unexpected questions can
be asked by all transactions). [That's why we should always default to the
safest answers.]

I've also added a pkglist != NULL sanity check (because -Ru can empty target
list in trans_prepare part).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20 12:01:25 -05:00
Xavier Chantry
481014e944 delta : simple code refactoring
This will make the code re-usable for other purpose.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20 11:57:12 -05:00
Xavier Chantry
f4809dcc9c sync.c : duplicate the target before modifying it
It was probably a bad idea to modify the target directly in case of
repo/pkg syntax.

Duplicating it also allows us to keep the original target string, which
is more informative when printing errors.

Also remove a duplicated error message from libalpm, and improve the
message already returned to the frontend.

$ pacman -S foo/bar

before
error: repository 'foo' not found
error: 'bar': no such repository

after
error: 'foo/bar': could not find repository for target

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20 11:56:46 -05:00
Dan McGee
95cb4b6874 Merge branch 'maint' 2009-09-14 22:10:20 -05:00
Xavier Chantry
b4317a740a Change the interface for target loading
-int alpm_trans_sysupgrade(int enable_downgrade);
-int alpm_trans_sync(char *target);
-int alpm_trans_add(char *target);
-int alpm_trans_remove(char *target);
+int alpm_sync_sysupgrade(int enable_downgrade);
+int alpm_sync_target(char *target);
+int alpm_sync_dbtarget(char *db, char *target);
+int alpm_add_target(char *target);
+int alpm_remove_target(char *target);

* functions renaming
* add new sync_dbtarget which allows to specify the db
* repo/ syntax handling is moved to frontend
( should implement FS#15141)
* group handling is moved to backend
( see http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html )
2009-09-12 13:06:43 +02:00
Nagy Gabor
19e07eb8e8 Re-enable REMOVE_PKGS test in pactest suite
With the help of --ask switch it is possible to test remove_unresolvable
feature, so I reverted the change of commit f2061c5f on ignore005.py with
--ask=32 added.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-08 22:18:13 -05:00
Xavier Chantry
8ff3b87066 Remove transaction type
This basically started with this change :

 /* Transaction */
 struct __pmtrans_t {
-       pmtranstype_t type;
        pmtransflag_t flags;
        pmtransstate_t state;
-       alpm_list_t *packages;      /* list of (pmpkg_t *) */
+       alpm_list_t *add;      /* list of (pmpkg_t *) */
+       alpm_list_t *remove;      /* list of (pmpkg_t *) */

And then I have to modify all the code accordingly.
2009-09-08 22:17:41 -05:00
Nagy Gabor
0da96abc90 Use sync.c for upgrade transaction prepare and commit
This patch utilizes the power of sync.c to fix FS#3492 and FS#5798.
Now an upgrade transaction is just a sync transaction internally (in alpm),
so all sync features are available with -U as well:
* conflict resolving
* sync dependencies from sync repos
* remove unresolvable targets

See http://www.archlinux.org/pipermail/pacman-dev/2009-June/008725.html
for the concept.

We use "mixed" target list, where PKG_FROM_FILE origin indicates local
package file, PKG_FROM_CACHE indicates sync package. The front-end can add
only one type of packages (depending on transaction type) atm, but if alpm
resolves dependencies for -U, we may get a real mixed trans->packages list.

_alpm_pkg_free_trans() was modified so that it can handle both target types
_alpm_add_prepare() was removed, we use _alpm_sync_prepare() instead
_alpm_add_commit() was renamed to _alpm_upgrade_targets()

sync.c (and deps.c) was modified slightly to handle mixed target lists,
the modifications are straightforward. There is one notable change here: We
don't create new upgrade trans in sync.c, we replace the pkgcache entries
with the loaded package files in the target list (this is a bit hackish) and
call _alpm_upgrade_targets(). This implies a TODO (pkg->origin_data.db is
not accessible anymore), but it doesn't hurt anything with pacman front-end,
so it will be fixed later (otherwise this patch would be huge).

I updated the documentation of -U and I added a new pactest, upgrade090.py,
to test the syncdeps feature of -U.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-08 22:04:14 -05:00
Nagy Gabor
b7db46d610 Do not remove conflict by default
When a conflict is detected, pacman asks if the user wants to remove
the conflicting package.  In many cases this is a bad idea.  e.g.

udev conflicts with initscripts (initscripts<2009.07).
Remove initscripts [Y/n]

This changes the query to [y/N].

The --noconfirm behavior has been also changed, because it chooses the
default answer. Since the yes answer is more interesting in our pactests
dealing with conflicts, I inserted '--ask=4' to all of them with one
exception: sync042.py tests the no answer.

(I also fixed a typo in sync043.py)

Original-work-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2009-09-08 22:03:24 -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
Nagy Gabor
12b55958d8 Add a new reason field to pmconflict_t struct
Sometimes "foo conflicts with bar" information is not enough, see this
thread: http://bbs.archlinux.org/viewtopic.php?id=77647. That's why I added
a new reason field to our pmconflict_t struct that stores the packager-
defined conflict that induced the fact that package1 conflicts with
package2.

I modified the front-end (in callback.c, sync.c, upgrade.c) to print this
new information as well.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2009-09-08 21:58:52 -05:00
Nagy Gabor
902dfe5900 Change Y/n to y/N with REMOVE_PKGS (remove_unresolvable) callback
The main reason for this change is that scripts could not catch the removed
targets with -S --noconfirm (the return value was 0). So the effect of a
pacman command may have differed from the expected one. Moreover, for my
taste the default no answer is better (I wanted to install the specified
targets, not a subset of them).

I had to change some pactest files as well, because now the default behavior
is not to remove unresolvable targets. In fact, the only pactest file that
tested this feature was ignore005.py.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-08 21:54:51 -05:00
Xavier Chantry
f53d9bab0e Allow '-Su foo' operation
This implements FS#15581

'-Su foo' should be more or less equivalent do '-Su ; -S foo'

Note : I moved a block of code to a new process_target function

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-08 21:45:17 -05:00
Dan McGee
cd5b029e93 Merge branch 'maint' 2009-09-07 15:17:47 -05:00
Xavier Chantry
43e16b373b rewrite strreplace
* just do one malloc call

* p = realloc(p, new_size) was not good
(see http://www.iso-9899.info/wiki/Why_not_realloc)

* use more efficient strncpy instead of strncat

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-07 15:16:50 -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
845f21207c libalpm/util.c : remove _alpm_strreplace
This function is unused since commit
358cc5804a.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: also kill from util.h]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 19:09:45 -05:00
Xavier Chantry
0845b2f13c sanity check for optdepends syntax
only allow optdepends like:
pkgname: description

some (real) examples of invalid optdepends:
 'tcl, python and/or ruby: to use corresponding binding'
 'xorg-fonts-75dpi : X bitmap fonts needed for the interface'
 'ruby-htmlentities (AUR): for one provider named Deastore'
 'xpdf - for pdf'

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Allan: rebase off de39a1f6 and adjust man page]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 16:52:47 -05:00
Oleg Finkelshteyn
5dbd00faf7 Don't wrap lines when we don't have a column size
For example when we are not in a tty, there is no point in wrapping the
output. This actually makes the job harder for scripts.

$ pacman -Si binutils | grep Desc
Description           : A set of programs to assemble and manipulate binary and

The description was cut because the rest was on the following line.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: use printf everywhere]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 16:50:20 -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
6e1b1aea59 Add pactest for 'any' architecture
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 16:04:05 -05:00
Xavier Chantry
b53aa87ea9 makepkg : check for invalid backup entry
This implements FS#13551

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:57:30 -05:00
Xavier Chantry
cb07265851 makepkg : refactor run_build and run_package
These two functions were very similar.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:57:14 -05:00
Henning Garus
545eac145d makepkg: exit on error during build() or package()
Set the ERR trap to abort upon encountering an error during the execution
of a build or package function.

Activate set -E, which lets functions inherit the ERR trap.

Signed-off-by: Henning Garus <henning.garus@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:56:58 -05:00
Dan McGee
b9dd8ce233 Merge branch 'maint' 2009-09-06 15:54:11 -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
5b27e78ba0 Check package arch before installing
This implements FS#15622

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-06 15:51:25 -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
Dan McGee
92f0775e76 Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2009-08-18 20:49:25 -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
7bb9c4098b Merge branch 'maint' 2009-08-08 11:23:38 -05:00
Dan McGee
e8806748ec Fix nonsensical replace
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:23:27 -05:00
Dan McGee
619d1fcf7f Pass all xsltproc-opts in one argument
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:22:52 -05:00
Xavier Chantry
3cf0ee98c0 dload.c : only call fwrite once
I assume the loop was never iterated more than once, because the write
location was not updated at each loop iteration (buffer instead of buffer +
nwritten), yet we never had reports of corrupted download.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:17:24 -05:00
Allan McRae
68200676d2 Be consistent with naming of handle_deps function
All other "dep" functions (check_deps, resolve_deps, remove_deps)
have underscores separating words.

Being consistent, convert handledeps to handle_deps.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:13:48 -05:00
Xavier Chantry
d7675e393f dload.c : change the way to check for mtimes
libfetch supports checking mtime so we do not need to do it manually.

when the databases are already up-to-date, initiating a connection with
fetchXGet and closing it right after with fetchIO_close took a very long
time (up to 10min!) on some network.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08 11:13:33 -05:00
457 changed files with 56697 additions and 26572 deletions

27
.gitignore vendored
View File

@@ -1,30 +1,21 @@
Makefile
Makefile.in
mkinstalldirs
*~
*.o
aclocal.m4
autom4te.cache
config.guess
config.h
config.h.in
config.log
config.status
config.status.lineno
config.rpath
config.sub
configure
configure.lineno
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1
*.o
*~
root
tags
cscope.out
cscope.in.out
cscope.out
cscope.po.out
libtool
Makefile
Makefile.in
pacman-*.tar.gz
root
stamp-h1
tags

28
.mailmap Normal file
View File

@@ -0,0 +1,28 @@
Aaron Griffin <aaron@archlinux.org> <aaronmgriffin@gmail.com>
Allan McRae <allan@archlinux.org> <mcrae_allan@hotmail.com>
Allan McRae <allan@archlinux.org> <mcrae_allan at hotmail.com>
Allan McRae <allan@archlinux.org> <allan.mcrae@qimr.edu.au>
Andres P <aepd87@gmail.com> <stderr@mail.com>
Bryan Ischo <bryan@ischo.com> <bji-keyword-pacman.3644cb@www.ischo.com>
Christos Nouskas <nous@archlinux.us> <nouskas@gmail.com>
Daenyth Blank <daenyth+arch@gmail.com> <Daenyth+Arch@gmail.com>
Daenyth Blank <Daenyth+Arch@gmail.com> <Daenyth+git@gmail.com>
甘露(Gan Lu) <rhythm.gan@gmail.com>
Giovanni Scafora <giovanni@archlinux.org> <linuxmania@gmail.com>
Jaroslaw Swierczynski <swiergot@gmail.com> <swiergot@juvepoland.com>
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar>
Juan Pablo González Tognarelli <lord_jotape@yahoo.com.ar> <jotapesan@gmail.com>
Manuel Tortosa <manutortosa@chakra-project.org> <manutortosa@gmail.com>
Marc - A. Dahlhaus <mad@wol.de>
Matthias Gorissen <matthias@archlinux.de> <siquame@web.de>
Laszlo Papp <djszapi@archlinux.us> <djszapi2@gmail.com>
Nagy Gabor <ngaba@bibl.u-szeged.hu> <ngaba@petra.hos.u-szeged.hu>
Nagy Gabor <ngaba@bibl.u-szeged.hu> <ngaba at bibl.u-szeged.hu>
Nezmer <git@nezmer.info> <Nezmer@allurelinux.org>
Roman Kyrylych <roman@archlinux.org> <roman.kyrylych@gmail.com>
Sebastian Nowicki <sebnow@gmail.com> <xilonmu@gmail.com>
Vojtěch Gondžala <vojtech.gondzala@gmail.com> <vogo@seznam.cz>
Vojtěch Gondžala <vojtech.gondzala@gmail.com> Vojtech Gondzala <vojtech.gondzala@gmail.com>
Xavier Chantry <shiningxc@gmail.com>
Xavier Chantry <shiningxc@gmail.com> <chantry.xavier@gmail.com>
Xavier Chantry <shiningxc@gmail.com> <xav@chantry.homelinux.org>

13
.tx/config Normal file
View File

@@ -0,0 +1,13 @@
[main]
host = https://www.transifex.net
[archlinux-pacman.libalpm-pot]
file_filter = lib/libalpm/po/<lang>.po
source_file = lib/libalpm/po/libalpm.pot
source_lang = en
[archlinux-pacman.pacman-pot]
file_filter = po/<lang>.po
source_file = po/pacman.pot
source_lang = en

49
HACKING
View File

@@ -12,10 +12,10 @@ Coding style
1. All code should be indented with tabs. (Ignore the use of only spaces in
this file) By default, source files contain the following VIM modeline:
+
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[source,C]
-------------------------------------------
/* vim: set ts=2 sw=2 noet: */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------------------------
2. When opening new blocks such as 'while', 'if', or 'for', leave the opening
brace on the same line as the beginning of the codeblock. The closing brace
@@ -24,8 +24,8 @@ Coding style
braces, even if it's just a one-line block. This reduces future error when
blocks are expanded beyond one line.
+
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[source,C]
-------------------------------------------
for(lp = list; lp; lp = lp->next) {
newlist = _alpm_list_add(newlist, strdup(lp->data));
}
@@ -40,14 +40,14 @@ while(it) {
free(it);
it = ptr;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------------------------
3. When declaring a new function, put the opening and closing braces on their
own line. Also, when declaring a pointer, do not put a space between the
asterisk and the variable name.
+
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[source,C]
-------------------------------------------
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
{
alpm_list_t *ptr, *lp;
@@ -58,7 +58,7 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
}
...
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------------------------
4. Comments should be ANSI-C89 compliant. That means no `// Comment` style;
use only `/* Comment */` style.
@@ -101,37 +101,50 @@ Currently our #include usage is in messy shape, but this is no reason to
continue down this messy path. When adding an include to a file, follow this
general pattern, including blank lines:
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[source,C]
-------------------------------------------
#include "config.h"
#include <standardheader.h>
#include <another.h>
#include <...>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------------------------
Follow this with some more headers, depending on whether the file is in libalpm
or pacman proper. For libalpm:
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[source,C]
-------------------------------------------
/* libalpm */
#include "yourfile.h"
#include "alpm_list.h"
#include "anythingelse.h"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------------------------
For pacman:
[code,C]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[source,C]
-------------------------------------------
#include <alpm.h>
#include <alpm_list.h>
/* pacman */
#include "yourfile.h"
#include "anythingelse.h"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------------------------------------
GDB and Valgrind Usage
~~~~~~~~~~~~~~~~~~~~~~
When using GDB or valgrind on pacman, you will want to run it on the actual
binary rather than the shell script wrapper produced by libtool. The actual
binary lives at `src/pacman/.libs/lt-pacman`, and will exist after running
`./src/pacman/pacman` at least once.
For example, to run valgrind:
./src/pacman/pacman
valgrind --leak-check=full -- src/pacman/.libs/lt-pacman -Syu
/////
vim: set ts=2 sw=2 syntax=asciidoc et:

View File

@@ -1,8 +1,10 @@
SUBDIRS = lib/libalpm src/util src/pacman scripts etc po pactest contrib
SUBDIRS = lib/libalpm src/util src/pacman scripts etc po test/pacman test/util contrib
if WANT_DOC
SUBDIRS += doc
endif
ACLOCAL_AMFLAGS = -I m4 --install
# Make sure we test and build manpages when doing distcheck
DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
@@ -15,12 +17,12 @@ pkgdatadir = ${datadir}/${PACKAGE}
dist_pkgdata_DATA = PKGBUILD.proto PKGBUILD-split.proto proto.install ChangeLog.proto
# run the pactest test suite and vercmp tests
check-local: pactest src/pacman src/util
$(PYTHON) $(top_srcdir)/pactest/pactest.py --debug=1 \
--test $(top_srcdir)/pactest/tests/*.py \
check-local: test/pacman test/util src/pacman src/util
$(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
--test $(top_srcdir)/test/pacman/tests/*.py \
-p $(top_builddir)/src/pacman/pacman
rm -rf $(top_builddir)/root
$(SH) $(top_srcdir)/pactest/vercmptest.sh \
$(SH) $(top_srcdir)/test/util/vercmptest.sh \
$(top_builddir)/src/util/vercmp
# create the pacman DB and cache directories upon install

117
NEWS
View File

@@ -1,5 +1,122 @@
VERSION DESCRIPTION
-----------------------------------------------------------------------------
3.5.0 - sync DBs read directly from the database tarball
(FS#8586, FS#20233)
- local DB "depends" file has been merged into the "desc" file
- pacman-db-upgrade script provided to update the local
database format
- sync database extension is .db (without compression suffix)
- requires repo-add from pacman-3.4+
- package versions can have an 'epoch' value defined that will
overrule any version comparison
- this replaces the use of the "force" option in allowing for
package updates with versions that do not conform to the
default version comparison operations
- package versions have the format [epoch:]pkgver-pkgrel
- check available disk space before installing packages (FS#11639)
- enabled by the "CheckSpace" option in pacman.conf
- attempt to stop install if we hit an extraction issue
(FS#7692, FS#22034)
- improved interactive selection for groups/provides
(FS#19704, FS#19853)
- finer grained control of ignoring dependency resolution
- -Sd to ignore dependency versions only
- -Sdd to ignore all dependency information
- clean-up of --help output (FS#19526)
- CleanMethod for package cache cleaning can use both
KeepInstalled and KeepCurrent simultaneously
- various speed-ups:
- improved internal storage of the package cache
- faster pkgname/depends searches
- use OpenSSL crypto functions if available
- makepkg:
- add support for running testsuites in a check() function
(FS#15145)
- controlled by BUILDENV option 'check' in makepkg.conf
which may be overridden by --check/--nocheck on the
command-line
- extract any file bsdtar recognizes
- STRIP_DIRS has been removed in favor of stripping all
recognized files
- improve $srcdir/$pkgdir check to reduce false positives
- $pkgname can be used in split package() functions (FS#22174)
- added '!buildflags' option to allow unsetting of CFLAGS,
CXXFLAGS and LDFLAGS
- repo-add: added -f/--files to create files database (FS#11302)
- pactree: rewritten in C using libalpm
3.4.3 - fix attempted double remove of all files issue during upgrades
- respect IgnorePkg/IgnoreGroup for group members (FS#19854)
- back out epoch changes; 3.5.X will handle them differently
3.4.2 - fix progress bar display with empty packages
- make pactest testsuite Python 2.7 compatible
- write epoch values in preparation for 3.5.X releases
- fix null pointer dereference in architecture check (FS#21668)
- documentation: remove unnecessary "|| return 1"
- contrib/bacman: update package compression selection
- contrib/PKGBUILD.vim: add a few more license options
- translations: es, kk, sv, pt, ru updated
3.4.1 - fix interaction of --needed and multiple repo groups (FS#20221)
- bash completion: small fixes to prevent alias problems
- rankmirrors: fix bogus/empty variable assignment (FS#19911)
- repo-add: ensure bare DB symlinks are relative (FS#20498)
- repo-add: fallback to copy if symlink not permitted (FS#19907)
- makepkg:
- use absolute path to 'du' to exclude wrapper progs (FS#19932)
- ensure $startdir check doesn't stall indefinitely (FS#19975)
- fix repackaging with multiple passed packages (FS#20272)
- translations:
- zh_CN: fix crash when using during install (FS#20188)
- sk: new Slovak translation
- pt: new European Portuguese translation
- other small updates to various translations
3.4.0 - new "Architecture" option that will restrict pacman to
installing only packages from the given architecture. Can be
set to "auto" in which case the output of "uname -m" is used
- use "$arch" when specifying a mirror url to automatically
select the correct architecture
- Installing packages with -U can handle installing
dependencies, conflict resolution and replacing packages
(FS#3492, FS#5798)
- can upgrade the system and install a new package using
"pacman -Syu <pkg>" (FS#15581)
- new -D/--database operation for modifying package install
reasons (FS#12950)
- new --print and --print-format options to output information
in suitable format for wrapper scripts (FS#14208)
- only extract new entries when updating a repo database
- show "Required by" in -Sii output (FS#16244)
- -U and -R options always ask for confirmation
- allow -Qo to perform a functional 'which' (FS#8798)
- cache cleaning cleans all directories, not just first
- cleanupdelta: new utility to help remove unused deltas from
a repo database
- bash completion: rewrite for size and performance (FS#16630)
- repo-add: handle removing the final package from a repo
- rankmirrors: rewrite using bash
- vercmp: does not link to libalpm to prevent upgrade issues
- makepkg:
- automatically aborts on any errors during packaging
- changelogs are now included via the "changelog" variable
- override pkgver, pkgrel and arch in split packages (FS#15955)
- repackaging without a package() function is deprecated
- stricter syntax checking for backup and optdepends entries
- file stripping options are configurable
- New --pkg flag to allow building specific package(s) from
split PKGBUILDs (FS#15956)
- build() function is now optional (FS#15147)
- warn about reference to build root in a package (FS#14751)
- configure source package destination with SRCPKGDEST
- major internal refactoring of handling tests ("[" to "[[")
- contrib/pactree: print reverse dependency tree
3.3.3 - correctly check the return code from opendir()
- fix possible infinite loop in alpm_list_remove()
- makepkg:
- quote arrays to preserve spaces in arrays (FS#16871)
- allow passing arguments with spaces
- adjust preselected option for clearing cache
- translations:
- zh_CN: fix positional parameter usage in makepkg (FS#16983)
- el: fix Y/N response translation (FS#16568)
3.3.2 - fix infinite filesize download issue (FS#16359)
- fix bogus download size on TotalDownload
- documentation updates

View File

@@ -3,11 +3,12 @@
# see 'man PKGBUILD'. NOTE: Please fill out the license field for your package!
# If it is unknown, then please put 'unknown'.
# Contributor: Your Name <youremail@domain.com>
# Maintainer: Your Name <youremail@domain.com>
pkgname=('pkg1' 'pkg2')
pkgbase=""
pkgbase=BASE
pkgver=VERSION
pkgrel=1
epoch=
pkgdesc=""
arch=()
url=""
@@ -15,12 +16,14 @@ license=('GPL')
groups=()
depends=()
makedepends=()
checkdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=($pkgbase-$pkgver.tar.gz)
noextract=()
md5sums=() #generate with 'makepkg -g'
@@ -28,12 +31,20 @@ md5sums=() #generate with 'makepkg -g'
build() {
cd "$srcdir/$pkgbase-$pkgver"
./configure --prefix=/usr
make || return 1
make
}
check() {
cd "$srcdir/$pkgname-$pkgver"
make -k check
}
package_pkg1() {
# options and directives that can be overridden
pkgver=
pkgrel=
pkgdesc=""
arch=()
license=()
groups=()
depends=()
@@ -44,6 +55,7 @@ package_pkg1() {
backup=()
options=()
install=
changelog=
cd "$srcdir/$pkgbase-$pkgver"
make DESTDIR="$pkgdir/" install-pkg1

View File

@@ -3,10 +3,11 @@
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.
# Contributor: Your Name <youremail@domain.com>
# Maintainer: Your Name <youremail@domain.com>
pkgname=NAME
pkgver=VERSION
pkgrel=1
epoch=
pkgdesc=""
arch=()
url=""
@@ -14,6 +15,7 @@ license=('GPL')
groups=()
depends=()
makedepends=()
checkdepends=()
optdepends=()
provides=()
conflicts=()
@@ -21,15 +23,24 @@ replaces=()
backup=()
options=()
install=
changelog=
source=($pkgname-$pkgver.tar.gz)
noextract=()
md5sums=() #generate with 'makepkg -g'
build() {
cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr
make || return 1
make
}
check() {
cd "$srcdir/$pkgname-$pkgver"
make -k check
}
package() {
cd "$srcdir/$pkgname-$pkgver"
make DESTDIR="$pkgdir/" install
}

71
README
View File

@@ -57,7 +57,6 @@ library is initialized.
* dbpath: The toplevel database directory (Default: /var/lib/pacman)
* logfile: The base path to pacman's log file (Default: /var/log/pacman.log)
* usesyslog: Log to syslog instead of `logfile` for file-base logging.
* nopassiveftp: Do not use passive FTP commands for ftp connections.
The following options also have `alpm_option_{add,remove}_*` functions, as the
values are list structures.
@@ -296,3 +295,73 @@ API CHANGES BETWEEN 3.2 AND 3.3
- error codes:
PM_ERR_SERVER_NONE, PM_ERR_TRANS_NOT_LOCKED, PM_ERR_PKG_IGNORED and
PM_ERR_LIBFETCH
API CHANGES BETWEEN 3.3 AND 3.4
===============================
[REMOVED]
- pmtranstype_t struct (transaction type), alpm_trans_get_type()
- alpm_option_get_nopassiveftp(), alpm_option_set_nopassiveftp()
[CHANGED]
- interface for target loading:
- alpm_trans_addtarget() and alpm_trans_sysupgrade() were removed
- alpm_sync_target() and alpm_sync_dbtarget() can be used to add a sync target
- alpm_sync_sysupgrade() can be used to add outdated packages (for sysupgrade)
- alpm_add_target() can be used to add an add/upgrade target
- alpm_remove_target() can be used to add a remove target
- interface for target listing:
- alpm_trans_get_pkgs() was removed
- alpm_pkg_get_removes() was removed
- alpm_trans_get_add() can be used to list add/upgrade/sync targets
- alpm_trans_get_remove() can be used to list to-be-removed packages
- the type parameter of alpm_trans_init() was removed
- the type of alpm_db_fetch callback function: mtimeold and mtimenew parameters
were replaced by force parameter
- unsigned short -> int changes for Boolean variables
[ADDED]
- alpm_db_set_pkgreason()
- alpm_option_get_arch(), alpm_option_set_arch()
- alpm_option_get_usedelta()
- alpm_pkg_unused_deltas()
- alpm_conflict_get_reason()
- error code: PM_ERR_PKG_INVALID_ARCH
API CHANGES BETWEEN 3.4 AND 3.5
===============================
[REMOVED]
- alpm_db_register_local()
- alpm_pkg_has_force()
- alpm_depcmp()
[CHANGED]
- alpm_trans_cb_progress type had some types changed from int to size_t
- alpm_cb_log format string is now const char *
- the interface to add/remove targets:
- functions take pmpkg_t * rather than char *.
- alpm_sync_target() and alpm_sync_dbtarget() are replaced by alpm_add_pkg()
- alpm_add_target() is replaced by alpm_add_pkg()
- alpm_remove_target() is replaced by alpm_remove_pkg()
- packages can come from:
- alpm_db_get_pkg() for normal targets
- alpm_find_dbs_satisfier() for versioned provisions
- alpm_find_grp_pkgs() for groups
- alpm_deptest() is replaced by the more flexibile alpm_find_satisfier()
- size_t used for alpm_list_t sizes
- return type for alpm_list_count()
- parameter type in alpm_list_msort() and alpm_list_nth()
[ADDED]
- alpm_option_get_checkspace(), alpm_option_set_checkspace()
- alpm_find_grp_pkgs()
- alpm_trans_get_flags()
- error codes:
PM_ERR_DISK_SPACE, PM_ERR_WRITE
- flags
PM_TRANS_FLAG_NODEPVERSION, PM_TRANS_EVT_DISKSPACE_START,
PM_TRANS_EVT_DISKSPACE_DONE, PM_TRANS_CONV_SELECT_PROVIDER,
PM_TRANS_PROGRESS_DISKSPACE_START, PM_TRANS_PROGRESS_INTEGRITY_START

View File

@@ -10,6 +10,8 @@ If your language is not listed here and you wish it was, let the pacman mailing
list know you are interested in making a translation. We will be happy to add
your language to the mix.
Catalan (ca):
Manuel Tortosa <manutortosa@chakra-project.org>
Czech (cs):
Vojtěch Gondžala <vojtech.gondzala@gmail.com>
German (de):
@@ -30,7 +32,7 @@ Italian (it):
Giovanni Scafora <giovanni@archlinux.org>
Kazakh (kk):
Baurzhan Muftakhidinov <baurthefirst@gmail.com>
Norwegian (nb_NO):
Norwegian (nb):
Hans-Kristian Arntzen <maister@archlinux.us>
Polish (pl):
Mateusz Herych <heniekk@gmail.com>
@@ -47,7 +49,7 @@ Russian (ru):
Vitaly Dolgov <ferhiord@gmail.com>
Oleg Finkelshteyn <olegfink@gmail.com>
Vladimir Bayrakovskiy <4rayven@gmail.com>
Swedish (sv_SE):
Swedish (sv):
Christian Larsson <congacx@gmail.com>
Turkish (tr):
Samed Beyribey <ras0ir@eventualis.org>

File diff suppressed because it is too large Load Diff

View File

@@ -18,11 +18,11 @@ rm -f scripts/{Makefile.in,Makefile}
rm -f etc/{Makefile.in,Makefile}
rm -f etc/pacman.d/{Makefile.in,Makefile}
rm -f etc/abs/{Makefile.in,Makefile}
rm -f pactest{,/tests}/{Makefile.in,Makefile}
rm -f test/{pacman,util}{,/tests}/{Makefile.in,Makefile}
rm -f contrib/{Makefile.in,Makefile}
rm -f doc/{Makefile.in,Makefile}
rm -f pactest/*.pyc
rm -f test/pacman/*.pyc
rm -f doc/html/*.html
rm -f doc/man3/*.3

View File

@@ -1,6 +1,6 @@
#!/bin/sh -xu
aclocal
aclocal -I m4 --install
autoheader
automake --foreign
autoconf

255
config.guess vendored
View File

@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
timestamp='2008-01-23'
timestamp='2010-08-21'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2008-01-23'
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit build system type.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -56,8 +56,9 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -91,7 +92,7 @@ if test $# != 0; then
exit 1
fi
trap 'exit 1' 1 2 15
trap 'exit 1' HUP INT TERM
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
@@ -105,7 +106,7 @@ trap 'exit 1' 1 2 15
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
@@ -170,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -324,14 +325,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -532,7 +552,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[456])
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -640,7 +660,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep __LP64__ >/dev/null
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
@@ -791,12 +811,12 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:[3456]*)
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -806,6 +826,9 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -835,6 +858,20 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -857,6 +894,17 @@ EOF
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
@@ -866,74 +914,33 @@ EOF
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:*)
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips
#undef mipsel
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
@@ -943,8 +950,11 @@ EOF
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
@@ -958,6 +968,9 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-tilera-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
@@ -965,71 +978,8 @@ EOF
echo x86_64-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
# Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^LIBC/{
s: ::g
p
}'`"
test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit
}
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
@@ -1058,7 +1008,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1102,8 +1052,11 @@ EOF
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
@@ -1141,6 +1094,16 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1153,7 +1116,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1216,6 +1179,9 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1243,6 +1209,16 @@ EOF
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1324,6 +1300,9 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2

159
config.sub vendored
View File

@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
timestamp='2008-01-16'
timestamp='2010-09-11'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2008-01-16'
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
# diff and a properly formatted GNU ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
@@ -72,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -120,8 +124,10 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -148,10 +154,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray)
-apple | -axis | -knuth | -cray | -microblaze)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -249,13 +258,16 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep \
| maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64vr | mips64vrel \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
@@ -268,28 +280,41 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 \
| ns16k | ns32k \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| rx \
| score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
os=-none
@@ -320,7 +345,7 @@ case $basic_machine in
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
@@ -329,14 +354,17 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
@@ -351,27 +379,30 @@ case $basic_machine in
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile-* | tilegx-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
@@ -439,6 +470,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -455,10 +490,27 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@@ -526,6 +578,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
@@ -699,6 +755,9 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
microblaze)
basic_machine=microblaze-xilinx
;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@@ -803,6 +862,12 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -1037,17 +1102,10 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
# This must be matched before tile*.
tilegx*)
basic_machine=tilegx-unknown
os=-linux-gnu
;;
tile*)
basic_machine=tile-unknown
@@ -1128,6 +1186,10 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
@@ -1166,7 +1228,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1216,6 +1278,9 @@ case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
@@ -1236,10 +1301,11 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1248,9 +1314,10 @@ case $os in
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -mingw32* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1258,7 +1325,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1388,6 +1455,11 @@ case $os in
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-none)
;;
*)
@@ -1428,6 +1500,15 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@@ -1585,7 +1666,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
-aix*)
-cnk*|-aix*)
vendor=ibm
;;
-beos*)

View File

@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Minimum version of autoconf required
AC_PREREQ(2.60)
AC_PREREQ(2.62)
# UPDATING VERSION NUMBERS FOR RELEASES
#
@@ -41,13 +41,13 @@ AC_PREREQ(2.60)
# Bugfix releases:
# pacman_version_micro += 1
m4_define([lib_current], [4])
m4_define([lib_revision], [2])
m4_define([lib_current], [6])
m4_define([lib_revision], [0])
m4_define([lib_age], [0])
m4_define([pacman_version_major], [3])
m4_define([pacman_version_minor], [3])
m4_define([pacman_version_micro], [2])
m4_define([pacman_version_minor], [5])
m4_define([pacman_version_micro], [0])
m4_define([pacman_version],
[pacman_version_major.pacman_version_minor.pacman_version_micro])
@@ -70,7 +70,7 @@ AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])
# Help line for root directory
AC_ARG_WITH(root-dir,
AS_HELP_STRING([--with-root-dir=path], [set the location of pacman's root operating directory]),
AS_HELP_STRING([--with-root-dir=path], [set the location of the root operating directory]),
[ROOTDIR=$withval], [ROOTDIR=/])
# Help line for package extension
@@ -83,20 +83,20 @@ AC_ARG_WITH(src-ext,
AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
[SRCEXT=$withval], [SRCEXT=.src.tar.gz])
# Help line for database extension
AC_ARG_WITH(db-ext,
AS_HELP_STRING([--with-db-ext=ext], [set the file extension used by the database]),
[DBEXT=$withval], [DBEXT=.db.tar.gz])
# Help line for buildscript filename
AC_ARG_WITH(buildscript,
AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
# Help line for using OpenSSL
AC_ARG_WITH(openssl,
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
[], [with_openssl=check])
# Help line for libfetch
AC_ARG_ENABLE(internal-download,
AS_HELP_STRING([--disable-internal-download], [do not build with libfetch support]),
[internaldownload=$enableval], [internaldownload=yes])
AC_ARG_WITH(fetch,
AS_HELP_STRING([--with-fetch], [use libfetch as an internal downloader]),
[], [with_fetch=check])
# Help line for documentation
AC_ARG_ENABLE(doc,
@@ -126,7 +126,8 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_CHECK_PROGS([PYTHON], [python2.6 python2.5 python], [false])
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
AC_PATH_PROGS([BASH_SHELL], [bash bash4 bash3], [false])
# find installed gettext
AM_GNU_GETTEXT([external])
@@ -136,26 +137,41 @@ AM_GNU_GETTEXT_VERSION(0.13.1)
AC_CHECK_LIB([archive], [archive_read_data], ,
AC_MSG_ERROR([libarchive is needed to compile pacman!]))
# Check for OpenSSL
AC_MSG_CHECKING(whether to link with libssl)
AS_IF([test "x$with_openssl" != "xno"],
[AC_MSG_RESULT(yes)
AC_CHECK_LIB([ssl], [MD5_Final], ,
[if test "x$with_openssl" != "xcheck"; then
AC_MSG_FAILURE([--with-openssl was given, but -lssl was not found])
fi],
[-lcrypto])],
AC_MSG_RESULT(no))
AM_CONDITIONAL([HAVE_LIBSSL], [test "x$ac_cv_lib_ssl_MD5_Final" = "xyes"])
# Enable or disable usage of libfetch
AC_MSG_CHECKING(whether to link with libfetch)
if test "x$internaldownload" = "xyes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE([INTERNAL_DOWNLOAD], , [Use internal download library])
# Check for a download library if it was actually requested
AS_IF([test "x$with_fetch" != "xno"],
[AC_MSG_RESULT(yes)
AC_CHECK_LIB([fetch], [fetchParseURL], ,
AC_MSG_ERROR([libfetch is needed to compile with internal download support]) )
# Check if libfetch supports conditional GET
# (version >=2.21, struct url has member last_modified)
AC_CHECK_MEMBER(struct url.last_modified, ,
AC_MSG_ERROR([libfetch must be version 2.21 or greater]),
[#include <fetch.h>] )
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(INTERNAL_DOWNLOAD, test "x$internaldownload" = "xyes")
[if test "x$with_fetch" != "xcheck"; then
AC_MSG_FAILURE([--with-fetch was given, but -lfetch was not found])
fi],
[-lcrypto -ldl])
# Check if libfetch supports connnection caching which we use
AS_IF([test "x$ac_cv_lib_fetch_fetchParseURL" = "xyes"],
[AC_CHECK_DECL(fetchConnectionCacheInit, ,
AC_MSG_ERROR([libfetch must be version 2.28 or greater]),
[#include <fetch.h>])
])
],
AC_MSG_RESULT(no))
AM_CONDITIONAL([HAVE_LIBFETCH], [test "x$ac_cv_lib_fetch_fetchParseURL" = "xyes"])
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h string.h strings.h sys/ioctl.h sys/param.h sys/statvfs.h sys/syslimits.h sys/time.h syslog.h wchar.h])
AC_CHECK_HEADERS([fcntl.h glob.h libintl.h locale.h mntent.h string.h \
sys/ioctl.h sys/mount.h sys/param.h sys/statvfs.h \
sys/time.h sys/types.h sys/ucred.h syslog.h wchar.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
@@ -165,15 +181,22 @@ AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_TYPE_UID_T
AC_STRUCT_DIRENT_D_TYPE
PATH_MAX_DEFINED
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_GETMNTENT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MKTIME
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([geteuid realpath regcomp strcasecmp \
AC_CHECK_FUNCS([geteuid getmntinfo realpath regcomp strcasecmp \
strndup strrchr strsep swprintf \
wcwidth uname])
# For the diskspace code
FS_STATS_TYPE
AC_CHECK_MEMBERS([struct statvfs.f_flag],,,[[#include <sys/statvfs.h>]])
AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include <sys/param.h>
#include <sys/mount.h>]])
# Enable large file support if available
AC_SYS_LARGEFILE
@@ -186,6 +209,9 @@ GCC_GNU89_INLINE_CC
# Host-dependant definitions
SIZECMD="stat -L -c %s"
SEDINPLACE="sed -i"
STRIP_BINARIES="--strip-all"
STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
case "${host_os}" in
*bsd*)
SIZECMD="stat -L -f %z"
@@ -199,13 +225,20 @@ case "${host_os}" in
host_os_darwin=yes
SIZECMD="/usr/bin/stat -L -f %z"
SEDINPLACE="/usr/bin/sed -i ''"
STRIP_BINARIES=""
STRIP_SHARED="-S"
STRIP_STATIC="-S"
;;
esac
AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
AC_SUBST(SIZECMD)
AC_SUBST(SEDINPLACE)
AC_SUBST(STRIP_BINARIES)
AC_SUBST(STRIP_SHARED)
AC_SUBST(STRIP_STATIC)
# Check for architecture, used in default makepkg.conf
# (Note single space left after CARCHFLAGS)
@@ -252,9 +285,15 @@ AC_SUBST(CARCHFLAGS)
AC_SUBST(CHOST)
# Check for documentation support and status
AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
AC_MSG_CHECKING([for building documentation])
if test "x$wantdoc" = "xyes" ; then
AC_MSG_RESULT([yes])
if test $ASCIIDOC ; then
AC_MSG_RESULT([yes, enabled by configure])
else
asciidoc="(warning : asciidoc not installed)"
AC_MSG_RESULT([yes $asciidoc])
fi
wantdoc=yes
else
AC_MSG_RESULT([no, disabled by configure])
@@ -289,6 +328,7 @@ if test "x$debug" = "xyes" ; then
# Check for -fstack-protector availability
GCC_STACK_PROTECT_LIB
GCC_STACK_PROTECT_CC
GCC_FORTIFY_SOURCE_CC
CFLAGS="$CFLAGS -g -Wall -Werror"
else
AC_MSG_RESULT(no)
@@ -296,10 +336,10 @@ else
fi
# Enable or disable use of git version in pacman version string
AC_CHECK_PROGS([GIT], [git])
AC_CHECK_FILE([.git/], hasgitdir=yes)
AC_MSG_CHECKING(whether to use git version if available)
if test "x$wantgitver" = "xyes" ; then
AC_CHECK_PROGS([GIT], [git])
AC_CHECK_FILE([.git/], hasgitdir=yes)
if test $GIT -a "x$hasgitdir" = "xyes"; then
AC_MSG_RESULT([yes])
usegitver=yes
@@ -322,9 +362,6 @@ AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packa
# Set source package file extension
AC_SUBST(SRCEXT)
AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
# Set database file extension
AC_SUBST(DBEXT)
AC_DEFINE_UNQUOTED([DBEXT], "$DBEXT", [The file extension used by pacman databases])
# Set makepkg build script name
AC_SUBST(BUILDSCRIPT)
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
@@ -339,8 +376,9 @@ scripts/Makefile
doc/Makefile
etc/Makefile
po/Makefile.in
pactest/Makefile
pactest/tests/Makefile
test/pacman/Makefile
test/pacman/tests/Makefile
test/util/Makefile
contrib/Makefile
Makefile
])
@@ -376,12 +414,10 @@ ${PACKAGE_NAME}:
root working directory : ${ROOTDIR}
package extension : ${PKGEXT}
source pkg extension : ${SRCEXT}
database extension : ${DBEXT}
build script name : ${BUILDSCRIPT}
Compilation options:
Run make in doc/ dir : ${wantdoc}
Use download library : ${internaldownload}
Run make in doc/ dir : ${wantdoc} ${asciidoc}
Doxygen support : ${usedoxygen}
debug support : ${debug}
"

8
contrib/.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
bacman
bash_completion
pacdiff
paclist
pacscripts
pacsearch
wget-xdelta.sh
zsh_completion

View File

@@ -1,17 +1,61 @@
EXTRA_DIST = \
PKGBUILD.vim \
OURSCRIPTS = \
bacman \
bash_completion \
gensync \
pacdiff \
paclist \
pacscripts \
pacsearch \
pactree \
updatesync \
wget-xdelta.sh
OURFILES = \
bash_completion \
zsh_completion
EXTRA_DIST = \
PKGBUILD.vim \
bacman.in \
bash_completion.in \
pacdiff.in \
paclist.in \
pacscripts.in \
pacsearch.in \
vimprojects \
wget-xdelta.sh \
zsh_completion \
wget-xdelta.sh.in \
zsh_completion.in \
README
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp
edit = sed \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@BASH_SHELL[@]|$(BASH_SHELL)|g'
$(OURSCRIPTS): Makefile
@echo ' ' GEN $@;
@rm -f $@ $@.tmp
@$(edit) $(srcdir)/$@.in >$@.tmp
@chmod +x $@.tmp
@chmod a-w $@.tmp
@mv $@.tmp $@
$(OURFILES): Makefile
@echo ' ' GEN $@;
@rm -f $@ $@.tmp
@$(edit) $(srcdir)/$@.in >$@.tmp
@chmod a-w $@.tmp
@mv $@.tmp $@
all-am: $(OURSCRIPTS) $(OURFILES)
bacman: $(srcdir)/bacman.in
bash_completion: $(srcdir)/bash_completion.in
pacdiff: $(srcdir)/pacdiff.in
paclist: $(srcdir)/paclist.in
pacscripts: $(srcdir)/pacscripts.in
pacsearch: $(srcdir)/pacsearch.in
pactree: $(srcdir)/pactree.in
wget-xdelta.sh: $(srcdir)/wget-xdelta.sh.in
zsh_completion: $(srcdir)/zsh_completion.in
# vim:set ts=2 sw=2 noet:

View File

@@ -25,6 +25,13 @@ syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIl
syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
" pkgbase
" FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '='
syn keyword pb_k_pkgbase pkgbase contained
syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase
syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote
" pkgver
syn keyword pb_k_pkgver pkgver contained
syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
@@ -33,7 +40,7 @@ syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k
" pkgrel
syn keyword pb_k_pkgrel pkgrel contained
syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgver
syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgrel
syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
@@ -45,6 +52,12 @@ syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
syn match pbPkgdescSign /[='"]/ contained
" epoch
syn keyword pb_k_epoch epoch contained
syn match pbValidEpoch /[[:digit:]]*/ contained contains=pbIllegalEpoch
syn match pbIllegalEpoch /[^[:digit:]=]\|=.*=/ contained
syn match pbEpochGroup /^epoch=.*/ contains=pbIllegalEpoch,pbValidEpoch,pb_k_epoch,shDoubleQuote,shSingleQuote
" url
syn keyword pb_k_url url contained
syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
@@ -54,10 +67,13 @@ syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubl
" license
syn keyword pb_k_license license contained
syn keyword pbLicense APACHE CDDL EPL FDL GPL LGPL MPL PHP RUBY ZLIB ISC MIT BSD contained
" echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
syn keyword pbLicense APACHE CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL PerlArtistic PHP PSF RALINK RUBY ZPL contained
" special cases from http://wiki.archlinux.org/index.php/Arch_Packaging_Standards
syn keyword pbLicenseSpecial BSD MIT ZLIB Python contained
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicense
syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicense,pbIllegalLicense
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense
syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicenseSpecial,pbLicense,pbIllegalLicense
" backup
syn keyword pb_k_backup backup contained
@@ -115,6 +131,12 @@ syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
" changelog
syn keyword pb_k_changelog changelog contained
syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained
syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog
syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote
" source:
" XXX remove source from shStatement, fix strange bug
syn clear shStatement
@@ -127,13 +149,12 @@ syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained
hi def link pbDerefEmulation PreProc
" md5sums
syn keyword pb_k_md5sums md5sums contained
syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
syn match pbValidMd5sums /[[:alnum:]]\{32\}/ contained
syn match pbValidMd5sums /\x\{32\}/ contained
syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend
syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
syn match pbMd5Hash /[[:alnum:]]\+/ contained contains=pbValidMd5sums
syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums
hi def link pbMd5Quotes Keyword
hi def link pbMd5Hash Error
hi def link pbValidMd5sums Number
@@ -141,17 +162,17 @@ hi def link pbValidMd5sums Number
" sha1sums
syn keyword pb_k_sha1sums sha1sums contained
syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
syn match pbValidSha1sums /[[:alnum:]]\{40\}/ contained
syn match pbValidSha1sums /\x\{40\}/ contained
syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend
syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
syn match pbSha1Hash /[[:alnum:]]\+/ contained contains=pbValidSha1sums
syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums
hi def link pbSha1Quotes Keyword
hi def link pbSha1Hash Error
hi def link pbValidSha1sums Number
" options
syn keyword pb_k_options options contained
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|force\)/ contained
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|ccache\|distcc\|makeflags\|buildflags\)/ contained
syn match pbOptionsNeg /\!/ contained
syn match pbOptionsDeprec /no/ contained
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption,shDoubleQuote,shSingleQuote
@@ -181,6 +202,9 @@ hi def link pbTodo Todo
hi def link pbIllegalPkgname Error
hi def link pb_k_pkgname pbKeywords
hi def link pbIllegalPkgbase Error
hi def link pb_k_pkgbase pbKeywords
hi def link pbIllegalPkgver Error
hi def link pb_k_pkgver pbKeywords
@@ -212,6 +236,9 @@ hi def link pb_k_provides pbKeywords
hi def link pbIllegalInstall Error
hi def link pb_k_install pbKeywords
hi def link pbIllegalChangelog Error
hi def link pb_k_changelog pbKeywords
hi def link pb_k_source pbKeywords
hi def link pbIllegalSource Error

View File

@@ -23,9 +23,6 @@ pacsearch - a colorized search combining both -Ss and -Qs output. Installed
packages are easily identified with a *** and local-only packages are also
listed.
pactree - generate a dependency tree of an installed package in textual or
graphical form (using graphviz).
bacman - regenerate a pacman package based on installed files and the pacman
database entries. Useful for reuse, or possible config file extension.
@@ -34,7 +31,3 @@ vimprojects - a project file for the vim project plugin.
wget-xdelta.sh - A download script for pacman which allows binary deltas
generated with makepkg to be used instead of downloading full binary packages.
This should cut download sizes for some package upgrades significantly.
gensync, updatesync - The former repository management scripts that have since
been superseded by repo-add and repo-remove. They are here for posterity's
sake, and to show how repo-add and repo-remove can be wrapped in other scripts.

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!@BASH_SHELL@
#
# bacman: recreate a package from a running system
# This script rebuilds an already installed package using metadata
@@ -21,7 +21,7 @@
#
readonly progname="bacman"
readonly progver="0.2.0"
readonly progver="0.2.1"
#
# User Friendliness
@@ -67,27 +67,26 @@ fi
#
# Setting environmental variables
#
if [ ! -r /etc/pacman.conf ]; then
echo "ERROR: unable to read /etc/pacman.conf"
if [ ! -r @sysconfdir@/pacman.conf ]; then
echo "ERROR: unable to read @sysconfdir@/pacman.conf"
exit 1
fi
eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
pac_db="${DBPath:-/var/lib/pacman/}/local"
eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
pac_db="${DBPath:-@localstatedir@/lib/pacman/}/local"
if [ ! -r /etc/makepkg.conf ]; then
echo "ERROR: unable to read /etc/makepkg.conf"
if [ ! -r @sysconfdir@/makepkg.conf ]; then
echo "ERROR: unable to read @sysconfdir@/makepkg.conf"
exit 1
fi
source "/etc/makepkg.conf"
source "@sysconfdir@/makepkg.conf"
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
pkg_arch=${CARCH:-'unknown'}
pkg_dest="${PKGDEST:-$PWD}"
pkg_ext=${PKGEXT:-'.pkg.tar.gz'}
pkg_pkger=${PACKAGER:-'Unknown Packager'}
pkg_name="$1"
@@ -137,7 +136,7 @@ while read i; do
bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf -
# Workaround to bsdtar not reporting a missing file as an error
if [ ! -e "$work_dir/$i" ] && [ -L "$work_dir/$i"]; then
if [ ! -e "$work_dir/$i" -a ! -L "$work_dir/$i" ]; then
echo ""
echo "ERROR: unable to add /$i to the package"
echo " If your user does not have permssion to read this file then"
@@ -164,13 +163,6 @@ fi
pkg_size=$(du -sk | awk '{print $1 * 1024}')
if [ -f "$pkg_dir/install" ] ; then
cp "$pkg_dir/install" "$work_dir/.INSTALL"
fi
if [ -f $pkg_dir/changelog ] ; then
cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
fi
#
# .PKGINFO stuff
#
@@ -228,9 +220,6 @@ while read i; do
%REPLACES%)
echo "replaces = $i" >> .PKGINFO
;;
%FORCE%)
echo "force = true" >> .PKGINFO
;;
# files
%BACKUP%)
@@ -254,6 +243,17 @@ while read i; do
esac
done
comp_files=".PKGINFO"
if [ -f "$pkg_dir/install" ] ; then
cp "$pkg_dir/install" "$work_dir/.INSTALL"
comp_files+=" .INSTALL"
fi
if [ -f $pkg_dir/changelog ] ; then
cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
comp_files+=" .CHANGELOG"
fi
#
# Fixes owner:group and permissions for .PKGINFO, .CHANGELOG, .INSTALL
#
@@ -265,8 +265,31 @@ chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
#
echo "Generating the package..."
case "$PKGEXT" in
*tar.gz) EXT=${PKGEXT%.gz} ;;
*tar.bz2) EXT=${PKGEXT%.bz2} ;;
*tar.xz) EXT=${PKGEXT%.xz} ;;
*tar) EXT=${PKGEXT} ;;
*) echo "WARNING: '%s' is not a valid archive extension." \
"$PKGEXT" ; EXT=$PKGEXT ;;
esac
pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}"
ret=0
bsdtar -czf "$pkg_dest/$pkg_namver-$pkg_arch$pkg_ext" $(ls -A) || ret=$?
# when fileglobbing, we want * in an empty directory to expand to
# the null string rather than itself
shopt -s nullglob
# TODO: Maybe this can be set globally for robustness
shopt -s -o pipefail
bsdtar -cf - $comp_files * |
case "$PKGEXT" in
*tar.gz) gzip -c -f -n ;;
*tar.bz2) bzip2 -c -f ;;
*tar.xz) xz -c -z - ;;
*tar) cat ;;
esac > ${pkg_file} || ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: unable to write package to $pkg_dest"
echo " Maybe the disk is full or you do not have write access"

View File

@@ -1,365 +0,0 @@
# vim: set ft=sh ts=2 sw=2 et:
# file: /etc/bash_completion.d/pacman
# Bash completion for pacman
# Original: Manolis Tzanidakis <mtzanidakis@freemail.gr>
#
# Distributed under the terms of the GNU General Public License, v2 or later.
#
## initial functions
rem_selected ()
{
# (Adapted from bash_completion by Ian Macdonald <ian@caliban.org>)
# This removes any options from the list of completions that have
# already been specified on the command line.
COMPREPLY=($(echo "${COMP_WORDS[@]}" | \
(while read -d ' ' i; do
[ "${i}" == "" ] && continue
# flatten array with spaces on either side,
# otherwise we cannot grep on word boundaries of
# first and last word
COMPREPLY=" ${COMPREPLY[@]} "
# remove word from list of completions
COMPREPLY=(${COMPREPLY/ ${i%% *} / })
done
echo ${COMPREPLY[@]})))
return 0
}
_available_repos ()
{
COMPREPLY=( $( compgen -W "$(grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )" -- $cur ) )
}
_installed_pkgs ()
{
local installed_pkgs
installed_pkgs=$( ls /var/lib/pacman/local/ )
COMPREPLY=( $( compgen -W "$( for i in $installed_pkgs; do echo ${i%-*-*}; done )" -- $cur ) )
}
_available_pkgs ()
{
#find balks easilly on a find /foo/*/* type dir, especially one like
# /var/lib/pacman/*/*
# This little change-up removes the find *and* only uses enabled repos
local available_pkgs
local enabled_repos
enabled_repos=$( grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )
available_pkgs=$( for r in $enabled_repos; do echo /var/lib/pacman/sync/$r/*; done )
COMPREPLY=( $( compgen -W "$( for i in $available_pkgs; do j=${i##*/}; echo ${j%-*-*}; done )" -- $cur ) )
}
_installed_groups ()
{
local installed_groups
installed_groups=$( find /var/lib/pacman/local -name desc -exec sed -ne '/%GROUPS%/,/^$/{//d; p}' {} \; | sort -u )
COMPREPLY=( $( compgen -W "$( for i in $installed_groups; do echo ${i%-*-*}; done )" -- $cur ) )
}
_available_groups ()
{
#find balks easilly on a find /foo/*/* type dir, especially one like
# /var/lib/pacman/*/*
# This little change-up removes the find *and* only uses enabled repos
local available_groups
local enabled_repos
enabled_repos=$( grep '\[' /etc/pacman.conf | grep -v -e 'options' -e '^#' | tr -d '[]' )
available_groups=$( for r in $enabled_repos; do sed '/%GROUPS%/,/^$/{//d; p}' /var/lib/pacman/sync/$r/*/desc | sort -u; done )
COMPREPLY=( $( compgen -W "$( for i in $available_groups; do echo ${i%-*-*}; done )" -- $cur ) )
}
## makepkg completion
_makepkg ()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-p)
_filedir
return 0
;;
--help|--cleancache)
COMPREPLY=''
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '\
-A --ignorearch \
-b --builddeps \
-c --clean \
-C --cleancache \
-d --nodeps \
-e --noextract \
-f --force \
-g --geninteg \
-h --help \
-i --install \
-L --log \
-m --nocolor \
-o --nobuild \
-p \
-r --rmdeps \
-s --syncdeps \
--asroot \
--source \
--noconfirm \
--noprogressbar' -- $cur ) )
fi
rem_selected
}
complete -o default -F _makepkg makepkg
## pacman completion
_instring ()
{
str="${1}"
shift 1
for c in "${@}"; do
if [ $(expr index "${str}" "${c}") -gt 0 ]; then
return 0
fi
done
return 1
}
_pacman ()
{
local a arg toparse op mod cur
COMPREPLY=()
# This argument parsing is done so we can check for flag existance later
# right now it's a tad crappy, but does the job
for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
a=${COMP_WORDS[i]}
arg="${a:0:2}"
toparse="${a:2}"
case "${arg}" in
-@(U|R|S|Q|h|V))
op="${arg/-}"
mod="${mod}${a:2}"
;;
--)
arg="${a:2}"
case "${arg}" in
remove) op="R" ;;
upgrade) op="U" ;;
query) op="Q" ;;
sync) op="S" ;;
help) op="h" ;;
version) op="V" ;;
verbose) mod="${mod}v" ;;
root) mod="${mod}r" ;;
dbpath) mod="${mod}b" ;;
nodeps) mod="${mod}d" ;;
force) mod="${mod}f" ;;
groups) mod="${mod}g" ;;
info) mod="${mod}i" ;;
list) mod="${mod}l" ;;
print-uris) mod="${mod}p" ;;
search) mod="${mod}s" ;;
sysupgrade) mod="${mod}u" ;;
upgrades) mod="${mod}u" ;;
downloadonly) mod="${mod}w" ;;
refresh) mod="${mod}y" ;;
changelog) mod="${mod}c" ;;
deps) mod="${mod}d" ;;
explicit) mod="${mod}e" ;;
unrequired) mod="${mod}t" ;;
foreign) mod="${mod}m" ;;
owns) mod="${mod}o" ;;
file) mod="${mod}p" ;;
search) mod="${mod}s" ;;
upgrades) mod="${mod}u" ;;
cascade) mod="${mod}c" ;;
check) mod="${mod}k" ;;
dbonly) mod="${mod}k" ;;
nosave) mod="${mod}n" ;;
recursive) mod="${mod}s" ;;
unneeded) mod="${mod}u" ;;
esac ;;
*) toparse="${a}" ;;
esac
arglen=$(( ${#toparse}-1 ))
for c in $(seq 0 "${arglen}"); do
arg=${toparse:$c:1}
[ "${arg}" != "-" ] && mod="${mod}${arg}"
done
done
cur=${COMP_WORDS[COMP_CWORD]}
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '\
-h --help \
-Q --query \
-R --remove \
-S --sync \
-U --upgrade \
-V --version \
' -- $cur ) )
rem_selected
return 0
fi
if [[ "$cur" == -* ]]; then
case "${op}" in
U)
COMPREPLY=( $( compgen -W '\
--asdeps \
--asexplicit \
-d --nodeps \
-f --force \
-h --help \
--config \
--logfile \
--noconfirm \
--noprogressbar \
--noscriptlet \
-v --verbose \
-r --root \
-b --dbpath \
--cachedir \
' -- $cur ) )
return 0
;;
R)
COMPREPLY=( $( compgen -W '\
-c --cascade \
-d --nodeps \
-h --help \
-k --dbonly \
-n --nosave \
-s --recursive \
-u --unneeded \
--config \
--logfile \
--noconfirm \
--noprogressbar \
--noscriptlet \
-v --verbose \
-r --root \
-b --dbpath \
--cachedir \
' -- $cur ) )
return 0
;;
S)
COMPREPLY=( $( compgen -W '\
--asdeps \
--asexplicit \
-c --clean \
-d --nodeps \
-f --force \
-g --groups \
-h --help \
-i --info \
-l --list \
-p --print-uris \
-s --search \
-u --sysupgrade \
-w --downloadonly \
-y --refresh \
--needed \
--ignore \
--ignoregroup \
--config \
--logfile \
--noconfirm \
--noprogressbar \
--noscriptlet \
-v --verbose \
-r --root \
-b --dbpath \
--cachedir \
' -- $cur ) )
return 0
;;
Q)
COMPREPLY=( $( compgen -W '\
-c --changelog \
-d --deps \
-e --explicit \
-g --groups \
-h --help \
-i --info \
-k --check \
-l --list \
-m --foreign \
-o --owns \
-p --file \
-s --search \
-t --unrequired \
-u --upgrades \
--config \
--logfile \
--noconfirm \
--noprogressbar \
--noscriptlet \
-v --verbose \
-r --root \
-b --dbpath \
--cachedir \
' -- $cur ) )
return 0
;;
esac
rem_selected
else
case "${op}" in
U)
COMPREPLY=( $( compgen -d -- "$cur" ) \
$( compgen -f -X '!*.pkg.tar.gz' -- "$cur" ) )
return 0
;;
h|V)
COMPREPLY=''
return 0
;;
Q)
if _instring $mod g; then
_installed_groups
elif _instring $mod o; then
COMPREPLY=( $( compgen -d -- "$cur" ) \
$( compgen -f -- "$cur" ) )
elif _instring $mod p; then
COMPREPLY=( $( compgen -d -- "$cur" ) \
$( compgen -f -X '!*.pkg.tar.gz' -- "$cur" ) )
elif _instring $mod u; then
COMPREPLY=''
return 0
else
_installed_pkgs
fi
return 0
;;
R)
_installed_pkgs
return 0
;;
S)
if _instring $mod l; then
_available_repos
else
_available_pkgs
fi
return 0
;;
esac
fi
rem_selected
}
complete -o filenames -F _pacman pacman

113
contrib/bash_completion.in Normal file
View File

@@ -0,0 +1,113 @@
# This file is in the public domain.
_arch_compgen() {
local i r
COMPREPLY=($(compgen -W '$*' -- "$cur"))
for ((i=1; i < ${#COMP_WORDS[@]}-1; i++)); do
for r in ${!COMPREPLY[@]}; do
if [[ ${COMP_WORDS[i]} = ${COMPREPLY[r]} ]]; then
unset 'COMPREPLY[r]'; break
fi
done
done
}
_arch_ptr2comp() {
local list= x y
for x; do
for y in '0 --' '1 -'; do
eval 'set -- ${'$x'[${y% *}]}'
list+=\ ${@/#/${y#* }}
done
done
_arch_compgen $list
}
_arch_incomp() {
local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
}
_makepkg() {
local cur opts prev
COMPREPLY=()
_get_comp_words_by_ref cur prev
if [[ $cur = -* && ! $prev =~ ^-(-(cleancache|config|help)$|\w*[Chp]) ]]; then
opts=('allsource asroot clean cleancache config force geninteg help holdver
ignorearch install log nobuild nocolor noconfirm nodeps noextract
noprogressbar pkg repackage rmdeps skipinteg source syncdeps'
'A C L R c d e f g h i m o p r s')
_arch_ptr2comp opts
fi
true
}
_pacman_pkg() {
_arch_compgen "$(
if [[ $2 ]]; then
\pacman -$1 | \cut -d' ' -f1 | \sort -u
else
\pacman -$1
fi
)"
}
_pacman() {
local common core cur database prev query remove sync upgrade o
COMPREPLY=()
_get_comp_words_by_ref cur prev
database=('asdeps asexplicit')
query=('changelog check deps explicit file foreign groups info list owns
search unrequired upgrades' 'c e g i k l m o p s t u')
remove=('cascade dbonly nodeps nosave print recursive unneeded' 'c k n p s u')
sync=('asdeps asexplicit clean downloadonly force groups ignore ignoregroup
info list needed nodeps print refresh search sysupgrade'
'c f g i l p s u w y')
upgrade=('asdeps asexplicit force nodeps print' 'f p')
common=('arch cachedir config dbpath debug help logfile noconfirm
noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
core=('database help query remove sync upgrade version' 'D Q R S U V h')
for o in 'D database' 'Q query' 'R remove' 'S sync' 'U upgrade'; do
_arch_incomp "$o" && break
done
if [[ $? != 0 ]]; then
_arch_ptr2comp core
elif [[ ! $prev =~ ^-\w*[Vbhr] &&
! $prev = --@(cachedir|config|dbpath|help|logfile|root|version) ]]
then
[[ $cur = -* ]] && _arch_ptr2comp ${o#* } common ||
case ${o% *} in
D|R)
_pacman_pkg Qq;;
Q)
{ _arch_incomp 'g groups' && _pacman_pkg Qg sort; } ||
{ _arch_incomp 'p file' && _pacman_file; } ||
_arch_incomp 'o owns' || _arch_incomp 'u upgrades' ||
_pacman_pkg Qq;;
S)
{ _arch_incomp 'g groups' && _pacman_pkg Sg; } ||
{ _arch_incomp 'l list' && _pacman_pkg Sl sort; } ||
_pacman_pkg Slq;;
U)
_pacman_file;;
esac
fi
true
}
if [[ $(type -t compopt) = "builtin" ]]; then
_pacman_file() {
compopt -o filenames; _filedir 'pkg.tar.*'
}
complete -F _pacman -o default pacman
else
_pacman_file() {
_filedir 'pkg.tar.*'
}
complete -F _pacman -o filenames -o default pacman
fi
complete -F _makepkg -o default makepkg
# ex:et ts=2 sw=2 ft=sh

View File

@@ -1,134 +0,0 @@
#!/bin/bash
#
# gensync
#
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
myver='3.1.1'
# functions
usage() {
printf "gensync (pacman) %s\n\n" "$myver"
printf "Usage: %s <root> <destfile> [package_directory]\n\n" "$0"
printf "\
gensync will generate a sync database by reading all PKGBUILD files\n\
from <root>. gensync builds the database in a temporary directory\n\
and then compresses it to <destfile>.\n\n"
printf "\
gensync will calculate md5sums of packages in the same directory as\n\
<destfile>, unless an alternate [package_directory] is specified.\n\n"
printf "\
note: The <destfile> name is important. It must be of the form\n\
{treename}.db.tar.gz where {treename} is the name of the custom\n\
package repository you configured in /etc/pacman.conf. The\n\
generated database must reside in the same directory as your\n\
custom packages (also configured in /etc/pacman.conf)\n\n"
echo "Example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz"
}
version() {
printf "gensync (pacman) %s\n" "$myver"
printf "\
Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n"
}
error () {
local mesg=$1; shift
printf "==> ERROR: ${mesg}\n" "$@" >&2
}
die () {
error $*
exit 1
}
# PROGRAM START
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage
exit 0
fi
if [ "$1" = "-V" -o "$1" = "--version" ]; then
version
exit 0
fi
if [ $# -lt 2 ]; then
usage
exit 1
fi
# source system and user makepkg.conf
if [ -r /etc/makepkg.conf ]; then
source /etc/makepkg.conf
else
die "/etc/makepkg.conf not found. Cannot continue."
fi
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
d=$(dirname $1)
rootdir="$(cd $d && pwd)/$(basename $1)"
d="$(dirname $2)"
destdir="$(cd $d && pwd)"
destfile="$destdir/$(basename $2)"
pkgdir=""
if [ "$3" != "" ]; then
pkgdir="$3"
fi
[ ! -d "$rootdir" ] && die "invalid root dir: $rootdir"
echo "gensync: building database entries, generating md5sums..." >&2
cd "$destdir"
pkgs=""
for file in $(find "$rootdir"/* -name "$BUILDSCRIPT"); do
unset pkgname pkgver pkgrel options
source $file || die "failed to parse $file"
if [ "$arch" = 'any' ]; then
CARCH='any'
fi
if [ "$pkgdir" != "" ]; then
pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}"
else
pkgfile="$destdir/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}"
fi
if [ ! -f "$pkgfile" ]; then
error "could not find %s-%s-%s-%s%s - skipping" $pkgname $pkgver $pkgrel $CARCH $PKGEXT
else
pkgs="$pkgs $pkgfile"
fi
done
echo "creating repo DB..."
# we'll trim the output just a tad, as gensync may be used on large repos
repo-add $destfile $pkgs \
| grep -e "package" -e "database"
# vim: set ts=2 sw=2 noet:

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!@BASH_SHELL@
# pacdiff : a simple pacnew/pacorig/pacsave updater
#
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
@@ -18,19 +18,23 @@
#
diffprog=${DIFFPROG:-vimdiff}
diffsearchpath=${DIFFSEARCHPATH:-/etc}
locate=0
usage() {
echo "pacdiff : a simple pacnew/pacorig/pacsave updater"
echo "Usage : pacdiff [-l]"
echo "The -l/--locate flag makes pacdiff use locate rather than find"
echo " -l/--locate makes pacdiff use locate rather than find"
echo " DIFFPROG variable allows to override the default vimdiff"
echo " DIFFSEARCHPATH allows to override the default /etc path"
echo "Example : DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" pacdiff"
}
cmd() {
if [ $locate -eq 1 ]; then
locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave
else
find /etc/ \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave \) -print0
find $diffsearchpath \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave \) -print0
fi
}

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!@BASH_SHELL@
#
# pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
# scripts of a given package
@@ -27,7 +27,7 @@ set -o errexit
progname=$(basename $0)
progver="0.4"
conf="/etc/pacman.conf"
conf="@sysconfdir@/pacman.conf"
if [ ! -r "$conf" ]; then
echo "ERROR: unable to read $conf"
@@ -36,8 +36,8 @@ fi
eval $(awk '/DBPath/ {print $1$2$3}' "$conf")
eval $(awk '/CacheDir/ {print $1$2$3}' "$conf")
pac_db="${DBPath:-/var/lib/pacman}/local"
pac_cache="${CacheDir:-/var/cache/pacman/pkg}"
pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
pac_cache="${CacheDir:-@localstatedir@/cache/pacman/pkg}"
error() {
local mesg=$1; shift

View File

@@ -1,10 +1,10 @@
#!/usr/bin/perl
# pacsearch - Adds color and install information to a 'pacman -Ss' search
#
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
# Copyright (C) 2008-2011 Dan McGee <dan@archlinux.org>
#
# Based off original shell script version:
# Copyright (C) 2006-2007 Dan McGee <dpmcgee@gmail.com>
# Copyright (C) 2006-2007 Dan McGee <dan@archlinux.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -39,7 +39,7 @@ if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-v") {
print "$progname version $version\n";
print "Copyright (C) 2006-2008 Dan McGee\n";
print "Copyright (C) 2006-2011 Dan McGee\n";
exit 0;
}
@@ -53,17 +53,19 @@ my $CLR6 = "\e[0;33m";
my $CLR7 = "\e[1;36m";
my $INST = "\e[1;31m";
my $BASE = "\e[0m";
my $INSTMARK = $INST."***";
# color a "repo/pkgname pkgver" line based on the respository name
# color a "repo/pkgname pkgver" line based on the repository name
sub to_color {
my $line = shift;
# get the installed text colored first
$line =~ s/(\[.*\]$)/$INST$1$BASE/;
# and now the repo and dealings
$line =~ s/(^core\/.*)/$CLR1$1$BASE/;
$line =~ s/(^extra\/.*)/$CLR2$1$BASE/;
$line =~ s/(^community\/.*)/$CLR3$1$BASE/;
$line =~ s/(^testing\/.*)/$CLR4$1$BASE/;
$line =~ s/(^unstable\/.*)/$CLR5$1$BASE/;
$line =~ s/(^custom\/.*)/$CLR6$1$BASE/;
$line =~ s/(^community-testing\/.*)/$CLR5$1$BASE/;
$line =~ s/(^multilib\/.*)/$CLR6$1$BASE/;
$line =~ s/(^local\/.*)/$CLR7$1$BASE/;
# any other unknown repository
$line =~ s/(^[\w-]*\/.*)/$CLR6$1$BASE/;
@@ -83,10 +85,15 @@ if ($#syncpkgs >= 0) {
# counter var for packages, used here and in the query loop too
my $cnt = 0;
foreach $_ (@syncpkgs) {
# we grab 3 fields here: repo, name/ver, and desc
my @pkgfields = /^(.*?)\/(.*?)\n(.*)$/s;
# add a fourth field that will indicate install status
push (@pkgfields, "");
# we grab 4 fields here: repo, name/ver, installed, and desc
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
if(not @pkgfields) {
# skip any non-matching line and just print it for the user
print $_, "\n";
next;
}
# since installed is optional, we should fill it in if necessary
$pkgfields[2] = "" if not defined $pkgfields[2];
# add a fifth field that indicates original order
push (@pkgfields, $cnt++);
# add each sync pkg by name/ver to a hash table for quick lookup
@@ -102,16 +109,13 @@ if ($#querypkgs >= 0) {
}
foreach $_ (@querypkgs) {
# we grab 3 fields here: repo, name/ver, and desc
my @pkgfields = /^(.*?)\/(.*?)\n(.*)$/s;
# we grab 4 fields here: repo, name/ver, installed, and desc
my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
# since installed is optional, we should fill it in if necessary
$pkgfields[2] = "" if not defined $pkgfields[2];
# check if the package was listed in the sync out
# if it is we want to mark it with a *** marker
if (exists $allpkgs{$pkgfields[1]}) {
# mark it in our fourth field as installed
@{ $allpkgs{$pkgfields[1]} }[3] = $INSTMARK;
} else {
# add a fourth field that will indicate install status
push (@pkgfields, $INSTMARK);
if (not exists $allpkgs{$pkgfields[1]}) {
$pkgfields[2] = "[installed]";
# add a fifth field that indicates original order (after sync)
push (@pkgfields, $cnt++);
# add our local-only package to the hash
@@ -122,11 +126,11 @@ foreach $_ (@querypkgs) {
# sort by original order (the fifth field) and print
foreach $_ ( sort{ @{$allpkgs{$a}}[4] <=> @{$allpkgs{$b}}[4] } keys %allpkgs) {
my @v = @{$allpkgs{$_}};
my $line = "$v[0]/$v[1]";
my $line = "$v[0]/$v[1] $v[2]";
$line = to_color($line);
# print install marker + colorized "repo/pkgname pkgver" string
print "$v[3]$line\n";
print "$v[2]\n";
# print colorized "repo/pkgname pkgver" string with possible installed text
print "$line\n";
print "$v[3]\n";
}
#vim: set noet:

View File

@@ -1,300 +0,0 @@
#!/bin/bash
# pactree : a simple dependency tree viewer
#
# Copyright (C) 2008 Carlo "carlocci" Bersani <carlocci@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Original http://carlocci.ngi.it/arch/pactree
# Credit to scj for the graphviz idea
# set the colors
branch1_color="\033[0;33m" #Brown
branch2_color="\033[0;37m" #Gray
leaf_color="\033[1;32m" #Light green
leaf2_color="\033[0;32m" #Green
# set the separators
separator=" "
branch_tip1="|--"
branch_tip2="+--"
provides="provides "
# set the graphviz options
# http://www.graphviz.org/doc/info/output.html for available output formats
# http://www.graphviz.org/doc/info/colors.html for available colors
gformat="png" #output format
start_color="red" #START color
nodes_color="green" #color of the nodes
arrow1_color="chocolate4" #color of the normal arrow
arrow2_color="grey" #color of the "provided by" headless arrow
readonly prog_name="pactree"
readonly prog_ver="0.2"
_usage(){
echo "This program generates the dependency tree of an installed package"
echo "Usage: $prog_name [OPTIONS] <installed packages>"
echo
echo " OPTIONS:"
echo " -c, --color Enable color output"
echo " -d, --depth INT Limit the shown dependencies depth"
echo " -g, --graph Use graphviz to make an image of the tree"
echo " -l, --linear Enable linear output"
echo " -s, --silent Shh, let me hear those errors!"
echo " -u, --unique Print the dependency list with no duplicates"
echo
echo " -h, --help Print this help message"
echo " -v, --version Print the program name and version"
echo
echo "Example: $prog_name -c -d 2 readline"
}
_version(){
echo "$prog_name version $prog_ver"
echo "Copyright (C) 2008 Carlo \"carlocci\" Bersani <carlocci@gmail.com>"
}
# end of the friendliness
# grab a field from the database: $1=path/to/file, $2=field to grab
_grabfield(){
for line in $(cat "$1" 2>/dev/null ); do
if [ -z "$line" ]; then
continue;
fi;
if [[ "$line" =~ %[A-Z]*% ]]; then
current="$line"
continue;
fi;
if [ "$current" = "$2" ]; then
echo "$line"
fi;
done
}
# find a dep in the db: $1=dep, $2=field, $3=dbfile, ret=file list
_finddep(){
for line in $(awk 'BEGIN{RS=""}
{
if ($1=="'"$2"'"){
for (i=2 ; i<=NF ; ++i){
if ($i ~ /^'"$1"'([<>=]+.*|)$/ ){
print FILENAME}
}
}
}' $(find $pac_db -name $3)); do
echo "${line%/*}"
done
}
# Recursive function: does all of the work, pays all of the taxes #
_tree(){
pkg_name="$1"
pkg_dirs="$(echo $pac_db/$pkg_name-[0-9]*)"
# Is $pkg_name real or provided?
[ ! -d "$pkg_dirs" ] && pkg_dirs="$(_finddep $pkg_name %PROVIDES% depends)"
for pkg_dir in $pkg_dirs ; do
spaces="$2"
unset provided
branch_tip="$branch_tip1"
branch_color="$branch1_color"
pkg_name="$(_grabfield "$pkg_dir/desc" %NAME%)"
if [ ! "$pkg_name" = "$1" ]; then
provided="$leaf2_color $provides$leaf_color$1"
branch_tip="$branch_tip2"
branch_color="$branch2_color"
if [ $graphviz -eq 1 ] && [[ ! "${dep_list[@]}" =~ _$1_ ]] && [ $spaces -ne $((max_depth+1)) ]; then
echo "\"$1\" -> \"$pkg_name\" [arrowhead=none, color=$arrow2_color];"
dep_list=( "${dep_list[@]}" "_$1_" )
_tree "$pkg_name" $((spaces+1))
continue
fi
fi
# Generate the spacer
spacer=""
for each in $(seq 1 $spaces); do
spacer="$spacer$separator"
done
spacer="$spacer$branch_tip"
[ $silent -ne 1 ] && echo -e "$branch_color$spacer$leaf_color$pkg_name$provided"
[ ! -d "$pkg_dir" ] && echo "No $pkg_name in the database (inconsistent database?)" >&2
if [[ ! " ${dep_list[@]} " =~ " $pkg_name " ]] && [ $spaces -ne $max_depth ]; then
dep_list=( "${dep_list[@]}" "$pkg_name" )
for dep_pkg in $(_grabfield "$pkg_dir/depends" %DEPENDS%); do
spaces=$2 #Bash scoping ;_;
if [ $graphviz -eq 1 ]; then
echo "\"$1\" -> \"${dep_pkg%%[<>=]*}\" [color=$arrow1_color];"
fi
_tree "${dep_pkg%%[<>=]*}" $((spaces+1))
done
fi
done
}
# Main program: gets all of the money, pays none of the taxes
# Command line parameters parser
if [ $# -eq 0 ]; then
_usage
exit 1
fi
options=( "$@" )
len_options=${#options[@]}
for (( n=0 ; n < $len_options ; n++ )); do
if [ "${options[$n]}" = "--" ]; then
unset options[$n]
break
fi
if [ "${options[$n]}" = "-h" -o "${options[$n]}" = "--help" ]; then
_usage
exit 0
fi
if [ "${options[$n]}" = "-v" -o "${options[$n]}" = "--version" ]; then
_version
exit 0
fi
if [ "${options[$n]}" = "-l" -o "${options[$n]}" = "--linear" ]; then
unset options[$n]
linear=1
continue
fi
if [ "${options[$n]}" = "-s" -o "${options[$n]}" = "--silent" ]; then
unset options[$n]
silent=1
continue
fi
if [ "${options[$n]}" = "-u" -o "${options[$n]}" = "--unique" ]; then
unset options[$n]
silent=1
nodup=1
continue
fi
if [ "${options[$n]}" = "-g" -o "${options[$n]}" = "--graph" ]; then
unset options[$n]
graphviz=1
continue
fi
if [ "${options[$n]}" = "-c" -o "${options[$n]}" = "--color" ]; then
unset options[$n]
colored=1
continue
fi
if [[ "${options[$n]}" =~ -d[[:digit:]]+ || "${options[$n]}" == "--depth" ]]; then
if [[ "${options[$n]#-d}" =~ [[:digit:]]+ ]]; then
max_depth="${options[$n]#-d}"
elif [[ ${options[$((n+1))]} =~ [[:digit:]]+ ]]; then
max_depth="${options[$((n+1))]}"
unset options[$((n+1))]
((++n))
fi
unset options[$n]
continue
fi
done
# End of the dumb command line parser
# Env
colored=${colored:-0}
max_depth=${max_depth:--10}
linear=${linear:-0}
silent=${silent:-0}
nodup=${nodup:-0}
graphviz=${graphviz:-0}
if [ $colored -ne 1 ]; then
unset branch1_color
unset leaf_color
unset leaf2_color
unset branch2_color
fi
if [ $linear -eq 1 ]; then
unset separator
unset branch_tip1
unset branch_tip2
unset provides
fi
if [ $graphviz -eq 1 ]; then
silent=1
nodup=0
if [ ! -f /usr/bin/dot ]; then
echo "ERROR: package graphviz is not installed"
echo " Run pacman -S graphviz to install it"
exit 1
fi
fi
if [ ! -r /etc/pacman.conf ]; then
echo "ERROR: unable to read /etc/pacman.conf"
exit 1
else
eval $(awk '/DBPath/ {print $1$2$3}' /etc/pacman.conf)
fi
pac_db="${DBPath:-/var/lib/pacman}/local"
if [ ! -d "$pac_db" ] ; then
echo "ERROR: pacman database directory ${pac_db} not found"
exit 1
fi
# Env End
# Program starts
_main(){
for pkg_name in ${options[@]} ; do
[ $graphviz -eq 1 ] && echo -e "\"START\" -> \"$pkg_name\" ;"
_tree "$pkg_name" 0
if [ $nodup -eq 1 ]; then
for pkg_tree in ${dep_list[@]} ; do
echo "$pkg_tree"
done
fi
done
if [ $silent -eq 0 ]; then
echo -ne '\033[0m' # return colors to normal?
echo -ne '\033[?25h' #return cursor to normal?
fi
}
if [ $graphviz -eq 1 ]; then
root_pkgs="${options[@]}"
# Uncomment for the "generated by pactree" node in graphviz
#advert="xyz [height=0.07, fontsize=8.0, label=\"GENERATED WITH PACTREE\",shape=box,color="black",style=filled,fontcolor="white"];\n"
echo -e "digraph G { START [color=$start_color, style=filled];\n node [style=filled, color=$nodes_color];\n$(_main)\n$advert}" | dot -T$gformat -o "${root_pkgs// /_}.deps.$gformat"
else _main
fi
# vim: set ts=2 sw=2 noet:

View File

@@ -1,137 +0,0 @@
#!/bin/bash
#
# updatesync
#
# Copyright (c) 2004 by Jason Chu <jason@archlinux.org>
# Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
myver='3.1.1'
# functions
usage() {
printf "updatesync (pacman) %s\n\n" "$myver"
printf "Usage: %s <action> <destfile> <option> [package_directory]\n\n" "$0"
printf "\
updatesync will update a sync database by reading a PKGBUILD and\n\
modifying the destfile. updatesync updates the database in a temporary\n\
directory and then compresses it to <destfile>.\n\n"
printf "There are two types of actions:\n\n"
printf "upd - Will update a package's entry or create it if it doesn't exist.\n It takes the package's PKGBUILD as an option.\n"
printf "del - Will remove a package's entry from the db. It takes the package's\n name as an option.\n"
echo
printf "\
updatesync will calculate md5sums of packages in the same directory as\n\
<destfile>, unless an alternate [package_directory] is specified.\n\n"
echo "Example: updatesync upd /home/mypkgs/custom.db.tar.gz PKGBUILD"
}
version() {
printf "updatesync (pacman) %s\n" "$myver"
printf "\
Copyright (C) 2004 Jason Chu <jason@archlinux.org>.\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n"
}
error () {
local mesg=$1; shift
printf "==> ERROR: ${mesg}\n" "$@" >&2
}
die () {
error $*
exit 1
}
# PROGRAM START
if [ "$1" = "-h" -o "$1" = "--help" ]; then
usage
exit 0
fi
if [ "$1" = "-V" -o "$1" = "--version" ]; then
version
exit 0
fi
if [ $# -lt 3 ]; then
usage
exit 1
fi
# source system and user makepkg.conf
if [ -r /etc/makepkg.conf ]; then
source /etc/makepkg.conf
else
die "/etc/makepkg.conf not found. Cannot continue."
fi
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
fi
if [ "$1" != "upd" -a "$1" != "del" ]; then
usage
exit 1
fi
action=$1
pkgdb=$2
option=$3
pkgdir="$(pwd)"
if [ "$4" != "" ]; then
pkgdir="$4"
fi
if [ "$action" = "upd" ]; then # INSERT / UPDATE
if [ ! -f "$option" ]; then
die "$option not found"
fi
unset pkgname pkgver pkgrel options
source $option || die "failed to parse $option"
if [ "$arch" = 'any' ]; then
CARCH='any'
fi
pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}"
if [ ! -f "$pkgfile" ]; then
die "could not find %s-%s-%s-%s%s - aborting" $pkgname $pkgver $pkgrel $CARCH $PKGEXT
fi
repo-add "$pkgdb" "$pkgfile"
else # DELETE
fname="$(basename $option)"
if [ "$fname" = "PKGBUILD" ]; then
if [ ! -f "$option" ]; then
die "%s not found" $option
fi
unset pkgname pkgver pkgrel options
source $option
else
pkgname=$option
fi
repo-remove "$pkgdb" "$pkgname"
fi
exit 0
# vim: set ts=2 sw=2 noet:

View File

@@ -1,7 +1,7 @@
#!/bin/bash
#!@BASH_SHELL@
if [ -r "/etc/makepkg.conf" ]; then
source /etc/makepkg.conf
if [ -r "@sysconfdir@/makepkg.conf" ]; then
source @sysconfdir@/makepkg.conf
else
echo "wget-xdelta: Unable to find makepkg.conf"
exit 1
@@ -30,11 +30,11 @@ new_version=$(echo $pkg_data | cut -d ' ' -f 2)
base_url=${file_url%/*}
# Look for the last version
for file in $(ls -r /var/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
for file in $(ls -r @localstatedir@/cache/pacman/pkg/${pkgname}-*-*{,-$CARCH}$PKGEXT 2>/dev/null); do
[[ "$file" =~ "$CARCH" ]] && arch="-$CARCH" || arch=""
check_version=$(echo $file | \
sed "s|^.*/${pkgname}-\([[:alnum:]_\.]*-[[:alnum:]_\.]*\)${arch}$PKGEXT$|\1|" | \
grep -v "^/var/cache/pacman/pkg")
grep -v "^@localstatedir@/cache/pacman/pkg")
[ "$check_version" = "" ] && continue

View File

@@ -26,13 +26,14 @@ _pacman_opts_common=(
'--noconfirm[Do not ask for 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]'
)
# options for passing to _arguments: options for --upgrade commands
_pacman_opts_pkgfile=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'*:package file:_files -g "*.pkg.tar.gz(.)"'
'*:package file:_files -g "*.pkg.tar.*(.)"'
)
# options for passing to _arguments: subactions for --query command
@@ -120,7 +121,7 @@ _pacman_action_query() {
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar.gz"'
'*:package file:_files -g "*.pkg.tar.*"'
;;
query_group)
_arguments -s : \
@@ -221,20 +222,20 @@ _pacman_completions_all_groups() {
_pacman_completions_all_packages() {
local -a cmd packages repositories packages_long
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
packages_long=(/var/lib/pacman/sync/${^repositories}/*(/))
packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
packages_long=(@localstatedir@/lib/pacman/sync/${^repositories}/*(/))
packages=(${(o)${${packages_long#@localstatedir@/lib/pacman/sync/}#*/}%-*-*} )
typeset -U packages
_wanted packages expl "packages" compadd - "${(@)packages}"
if [[ $PREFIX != */* ]] ; then
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
else
compset -P '*/'
packages_long=(/var/lib/pacman/sync/$IPREFIX*(/))
packages=(${(o)${${packages_long/\/var\/lib\/pacman\/sync\//}#*/}%-*-*} )
packages_long=(@localstatedir@/lib/pacman/sync/$IPREFIX*(/))
packages=(${(o)${${packages_long#@localstatedir@/lib/pacman/sync/}#*/}%-*-*} )
typeset -U packages
_wanted repo_packages expl "repository/package" compadd ${(@)packages}
fi
@@ -252,15 +253,15 @@ _pacman_completions_installed_groups() {
# provides completions for installed packages
_pacman_completions_installed_packages() {
local -a cmd packages packages_long
packages_long=(/var/lib/pacman/local/*(/))
packages=( ${${packages_long/\/var\/lib\/pacman\/local\//}%-*-*} )
packages_long=(@localstatedir@/lib/pacman/local/*(/))
packages=( ${${packages_long#@localstatedir@/lib/pacman/local/}%-*-*} )
compadd "$@" -a packages
}
# provides completions for repository names
_pacman_completions_repositories() {
local -a cmd repositories
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
# Uniq the array
typeset -U repositories
compadd "$@" -a repositories
@@ -295,11 +296,11 @@ _pacman() {
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files'
;;
-Q*p*) # file *.pkg.tar.gz
-Q*p*) # file *.pkg.tar.*
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar.gz"'
'*:package file:_files -g "*.pkg.tar.*"'
;;
-Q*) _pacman_action_query ;;
-R*) _pacman_action_remove ;;

116
depcomp
View File

@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2006-10-15.18
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ scriptversion=2006-10-15.18
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@@ -192,14 +199,14 @@ sgi)
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -215,34 +222,39 @@ aix)
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -323,7 +335,12 @@ hp2)
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@@ -399,7 +416,7 @@ dashmstdout)
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@@ -450,32 +467,39 @@ makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
@@ -495,7 +519,7 @@ cpp)
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@@ -533,13 +557,27 @@ cpp)
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
@@ -552,16 +590,23 @@ msvisualcpp)
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
@@ -580,5 +625,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

2
doc/.gitignore vendored
View File

@@ -6,7 +6,9 @@ pacman.8
pacman.conf.5
repo-add.8
repo-remove.8
vercmp.8
*.css
*.html
*.xml
man3
website.tar.gz

View File

@@ -7,6 +7,7 @@ ASCIIDOC_MANS = \
pacman.8 \
makepkg.8 \
repo-add.8 \
vercmp.8 \
PKGBUILD.5 \
makepkg.conf.5 \
pacman.conf.5 \
@@ -18,6 +19,7 @@ HTML_MANPAGES = \
pacman.8.html \
makepkg.8.html \
repo-add.8.html \
vercmp.8.html \
PKGBUILD.5.html \
makepkg.conf.5.html \
pacman.conf.5.html \
@@ -38,6 +40,7 @@ EXTRA_DIST = \
pacman.8.txt \
makepkg.8.txt \
repo-add.8.txt \
vercmp.8.txt \
PKGBUILD.5.txt \
PKGBUILD-example.txt \
makepkg.conf.5.txt \
@@ -52,7 +55,7 @@ EXTRA_DIST = \
$(DOXYGEN_MANS)
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS) $(HTML_DOCS) repo-remove.8
MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS) $(HTML_DOCS) repo-remove.8 website.tar.gz
# Ensure manpages are fresh when building a dist tarball
dist-hook:
@@ -60,7 +63,7 @@ dist-hook:
$(MAKE) $(AM_MAKEFLAGS) all
if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 | sed s/^v//')-dirty
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
REAL_PACKAGE_VERSION = $(GIT_VERSION)
else
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
@@ -80,33 +83,47 @@ endif
html: $(HTML_DOCS)
website: html
bsdtar czf website.tar.gz $(HTML_DOCS) \
-C /etc/asciidoc/stylesheets/ \
xhtml11.css xhtml11-manpage.css xhtml11-quirks.css \
-C /etc/asciidoc/javascripts/ \
asciidoc-xhtml11.js \
-C /etc/asciidoc/ \
images
pkgdatadir = ${datadir}/${PACKAGE}
ASCIIDOC_OPTS = \
-f asciidoc.conf \
-a pacman_version="$(REAL_PACKAGE_VERSION)" \
-a pacman_date="`date +%Y-%m-%d`" \
-a pkgdatadir=$(pkgdatadir) \
-a localstatedir=$(localstatedir) \
-a sysconfdir=$(sysconfdir)
A2X_OPTS = \
--no-xmllint \
-d manpage \
-f manpage \
--xsltproc-opts='-param man.endnotes.list.enabled 0' \
--xsltproc-opts='-param man.endnotes.are.numbered 0'
--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0'
# These rules are due to the includes and files of the asciidoc text
$(ASCIIDOC_MANS): asciidoc.conf footer.txt
a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS)" $@.txt
%.html: %.txt
asciidoc $(ASCIIDOC_OPTS) -a linkcss $*.txt
asciidoc $(ASCIIDOC_OPTS) $*.txt
dos2unix $@
HACKING.html: ../HACKING
asciidoc $(ASCIIDOC_OPTS) -a linkcss -o $@ ../HACKING
asciidoc $(ASCIIDOC_OPTS) -o $@ ../HACKING
dos2unix $@
# Customizations for certain HTML docs
$(HTML_MANPAGES): asciidoc.conf footer.txt
$(HTML_OTHER): asciidoc.conf
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons
%.8.html: ASCIIDOC_OPTS += -d manpage
%.5.html: ASCIIDOC_OPTS += -d manpage
%.3.html: ASCIIDOC_OPTS += -d manpage
@@ -115,6 +132,7 @@ $(HTML_OTHER): asciidoc.conf
pacman.8 pacman.8.html: pacman.8.txt
makepkg.8 makepkg.8.html: makepkg.8.txt
repo-add.8 repo-add.8.html: repo-add.8.txt
vercmp.8 vercmp.8.html: vercmp.8.txt
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.txt PKGBUILD-example.txt
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.txt
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.txt

View File

@@ -15,6 +15,6 @@ md5sums=('ee5ae84d115f051d87fcaaef3b4ae782')
build() {
cd $srcdir/$pkgname-$pkgver
./configure --prefix=/usr
make || return 1
make
make prefix=$pkgdir/usr install
}

View File

@@ -20,12 +20,10 @@ This manual page is meant to describe general rules about PKGBUILDs. Once a
PKGBUILD is written, the actual package is built using makepkg and installed
with pacman.
NOTE: If you are using Arch Linux and have a local copy of the Arch Build
System (ABS) tree on your computer, or are using another distribution that
provides a similar tree of build files, you can copy the provided
PKGBUILD.proto file to a new package build directory and make customizations to
suit your needs. An up to date prototype file can also be found in the source
distribution of this package.
NOTE: An example PKGBUILD, useful for reference, is located in '{pkgdatadir}'.
Also located there are other example files such as a ChangeLog and an install
script. You can copy the provided PKGBUILD.proto file to a new package build
directory and make customizations to suit your needs.
Options and Directives
@@ -40,23 +38,35 @@ This will prevent any possible name clashes with internal makepkg variables.
For example, to store the base kernel version in a variable, use something
similar to `$_basekernver`.
*pkgname*::
*pkgname (array)*::
The name of the package. This has be a unix-friendly name as it will be
used in the package filename.
used in the package filename. Members of the array are not allowed to start
with hyphens.
*pkgver*::
The version of the software as released from the author (e.g. '2.7.1').
The variable is not allowed to contain colons or hyphens.
*pkgrel*::
This is the release number specific to the Arch Linux release. This
allows package maintainers to make updates to the package's configure
flags, for example. A pkgrel of 1 is typically used for each upstream
software release and is incremented for intermediate PKGBUILD updates.
flags, for example. A pkgrel of '1' is typically used for each upstream
software release and is incremented for intermediate PKGBUILD updates. The
variable is not allowed to contain hyphens.
*pkgdesc*::
This should be a brief description of the package and its functionality.
Try to keep the description to one line of text.
*epoch*::
Used to force the package to be seen as newer than any previous versions
with a lower epoch, even if the version number would normally not trigger
such an upgrade. This value is required to be a positive integer; the
default value if left unspecified is '0'. This is useful when the version
numbering scheme of a package changes (or is alphanumeric), breaking normal
version comparison logic. See linkman:pacman[8] for more information on
version comparisons.
*url*::
This field contains a URL that is associated with the software being
packaged. This is typically the project's website.
@@ -79,6 +89,12 @@ similar to `$_basekernver`.
be copied into the package by makepkg. It does not need to be included
in the source array (e.g. `install=pkgname.install`).
*changelog*::
Specifies a changelog file that is to be included in the package.
This file should reside in the same directory as the PKGBUILD, and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g. `changelog=$pkgname.changelog`).
*source (array)*::
An array of source files required to build the package. Source files
must either reside in the same directory as the PKGBUILD file, or be a
@@ -140,12 +156,18 @@ name. The syntax is: `source=('filename::url')`.
needed at runtime. Packages in this list follow the same format as
depends.
*checkdepends (array)*::
An array of packages that this package depends on to run its test suite,
but are not needed at runtime. Packages in this list follow the same
format as depends. These dependencies are only considered when the
check() function is present and is to be run by makepkg.
*optdepends (array)*::
An array of packages (and accompanying reasons) that are not essential for
base functionality, but may be necessary to make full use of the contents
of this package. optdepends are currently for informational purposes only
and are not utilized by pacman during dependency resolution. The format
should be similar to the following:
for specifying optdepends is:
optdepends=('fakeroot: for makepkg usage as normal user')
@@ -179,8 +201,8 @@ name. The syntax is: `source=('filename::url')`.
in the options array. To reverse the default behavior, place an ``!'' at
the front of the option. Only specify the options you specifically want
to override, the rest will be taken from linkman:makepkg.conf[5].
*NOTE:* 'force' is a special option only used in a linkman:PKGBUILD[5],
do not use it unless you know what you are doing.
*NOTE:* 'force' is a now-removed option in favor of the top level 'epoch'
variable.
*strip*;;
Strip symbols from binaries and libraries. If you frequently
@@ -211,26 +233,27 @@ name. The syntax is: `source=('filename::url')`.
form `!distcc` with select packages that have problems building
with distcc.
*buildflags*;;
Allow the use of user-specific buildflags (CFLAGS, CXXFLAGS, LDFLAGS)
during build as specified in linkman:makepkg.conf[5]. More useful in
its negative form `!buildflags` with select packages that have problems
building with custom buildflags.
*makeflags*;;
Allow the use of user-specific makeflags during build as specified
in linkman:makepkg.conf[5]. More useful in its negative form
`!makeflags` with select packages that have problems building with
custom makeflags such as `-j2` (or higher).
*force*;;
Force the package to be upgraded by a pacman system upgrade
operation, even if the version number would normally not trigger
such an upgrade. This is useful when the version numbering scheme
of a package changes (or is alphanumeric). See linkman:pacman[8] for
more information on version comparisons.
build() Function
----------------
In addition to the above directives, the build() bash function comprises the
remainder of the PKGBUILD. This is directly sourced and executed by makepkg, so
anything that bash or the system has available is available for use here. Be
sure any exotic commands used are covered by `makedepends`.
In addition to the above directives, the optional build() bash function usually
comprises the remainder of the PKGBUILD. This is directly sourced and executed
by makepkg, so anything that bash or the system has available is available for
use here. The function is run in `bash -e` mode, meaning any command that exits
with a non-zero status will cause the function to exit. Be sure any exotic
commands used are covered by `makedepends`.
All of the above variables such as `pkgname` and `pkgver` are available for use
in the build function. In addition, makepkg defines three variables for your
@@ -252,33 +275,45 @@ If you create any variables of your own in the build function, it is
recommended to use the bash `local` keyword to scope the variable to inside
the build function.
check() Function
----------------
An optional check() function can be specified in which a packages test-suite
may be run. This function is run between the build() and package() functions.
The function is run in `bash -e` mode, meaning any command that exits with a
non-zero status will cause the function to exit. Be sure any exotic commands
used are covered by `checkdepends`.
package() Function
------------------
An optional package() function can be specified in addition to the build() function.
This function is run immediately after the build() function. When specified in
combination with the fakeroot BUILDENV option in linkman:makepkg.conf[5], fakeroot
usage will be limited to running the packaging stage. The build() function will be
run as the user calling makepkg.
An optional package() function can be specified in addition to the build()
function. This function is run after the build() and check() functions. The
function is run in `bash -e` mode, meaning any command that exits with a
non-zero status will cause the function to exit. When specified in combination
with the fakeroot BUILDENV option in linkman:makepkg.conf[5], fakeroot usage
will be limited to running the packaging stage. An existing build() function
will be run as the user calling makepkg.
Package Splitting
-----------------
makepkg supports building multiple packages from a single PKGBUILD. This is achieved
by assigning an array of package names to the `pkgname` directive. Each split package
uses a corresponding packaging function with name `package_foo()`, where `foo` is the
name of the split package.
makepkg supports building multiple packages from a single PKGBUILD. This is
achieved by assigning an array of package names to the `pkgname` directive.
Each split package uses a corresponding packaging function with name
`package_foo()`, where `foo` is the name of the split package.
All options and directives for the split packages default to the global values given
within the PKGBUILD. However, some of these can be overridden within each split
package's packaging function. The following variables can be overridden: `pkgdesc`,
`license`, `groups`, `depends`, `optdepends`, `provides`, `conflicts`, `replaces`,
`backup`, `options` and `install`.
All options and directives for the split packages default to the global values
given within the PKGBUILD. However, some of these can be overridden within each
split package's packaging function. The following variables can be overridden:
`pkgver`, `pkgrel`, `pkgdesc`, `arch`, `license`, `groups`, `depends`,
`optdepends`, `provides`, `conflicts`, `replaces`, `backup`, `options`,
`install` and `changelog`.
An optional global directive is available when building a split package:
*pkgbase*::
The name used to refer to the group of packages in the output of makepkg
and in the naming of source-only tarballs. If not specified, the first
element in the `pkgname` array is used.
element in the `pkgname` array is used. The variable is not allowed to
begin with a hyphen.
Install/Upgrade/Remove Scripting
--------------------------------
@@ -318,9 +353,8 @@ same directory as the PKGBUILD script. Then use the install directive:
install=pkgname.install
The install script does not need to be specified in the source array. A
template install file is available with the source distribution of this
program, or one may be provided by your distribution. For example, Arch Linux
provides prototype install files in the ABS tree.
template install file is available in '{pkgdatadir}' as 'proto.install' for
reference with all of the available functions defined.
Development Directives

View File

@@ -18,13 +18,14 @@ Authors
Current maintainers:
* Allan McRae <allan@archlinux.org>
* Dan McGee <dan@archlinux.org>
* Xavier Chantry <shiningxc@gmail.com>
* Aaron Griffin <aaron@archlinux.org>
Past contributors:
* Judd Vinet <jvinet@zeroflux.org>
* Aurelien Foret <aurelien@archlinux.org>
* Aaron Griffin <aaron@archlinux.org>
See the 'AUTHORS' file for additional contributors.

View File

@@ -43,15 +43,16 @@ configuration files dealing with pacman.
* linkman:pacman[8]
* linkman:pacman.conf[5]
* linkman:repo-add[8]
* linkman:vercmp[8]
Changelog
~~~~~~~~~
For a good idea of what is going on in pacman development, take a look at the
link:http://projects.archlinux.org/?p=pacman.git[Gitweb] summary
page for the project.
link:http://projects.archlinux.org/pacman.git/[Git summary page] for the
project.
See the most recent
link:http://projects.archlinux.org/?p=pacman.git;a=blob_plain;f=NEWS;hb=HEAD[NEWS]
link:http://projects.archlinux.org/pacman.git/tree/NEWS[NEWS]
file for a not-as-frequently-updated list of changes. However, this should
contain the biggest changes in a format more concise than the commit log.
@@ -62,6 +63,11 @@ Releases
`------------`-------
Date Version
---------------------
2011-01-22 v3.4.3
2010-12-29 v3.4.2
2010-09-03 v3.4.1
2010-06-16 v3.4.0
2009-11-10 v3.3.3
2009-10-05 v3.3.2
2009-09-22 v3.3.1
2009-08-02 v3.3.0
@@ -109,8 +115,8 @@ Development
Mailing List
~~~~~~~~~~~~
There is a mailing list devoted to pacman development, hosted by Arch Linux.
link:http://www.archlinux.org/mailman/listinfo/pacman-dev/[Subscribe] or
link:http://www.archlinux.org/pipermail/pacman-dev/[view the archives].
link:http://mailman.archlinux.org/mailman/listinfo/pacman-dev/[Subscribe] or
link:http://mailman.archlinux.org/pipermail/pacman-dev/[view the archives].
Source Code
~~~~~~~~~~~
@@ -125,7 +131,8 @@ The current development tree can be fetched with the following command:
which will fetch the full development history into a directory named pacman.
You can browse the source as well using
link:http://projects.archlinux.org/?p=pacman.git[Gitweb].
link:http://projects.archlinux.org/pacman.git/[cgit]. HTTP/HTTPS URLs are also
available for cloning purposes; these URLs are listed at the above page.
If you are interested in hacking on pacman, it is highly recommended you join
the mailing list mentioned above, as well as take a quick glance at our
@@ -141,17 +148,17 @@ Other Utilities
~~~~~~~~~~~~~~~
Although the package manager itself is quite simple, many scripts have been
developed that help automate building and installing packages. These are used
extensively in link:http://archlinux.org[Arch Linux]. Most of these utilities
extensively in link:http://archlinux.org/[Arch Linux]. Most of these utilities
are available in the Arch Linux projects
link:http://projects.archlinux.org/[Gitweb browser].
link:http://projects.archlinux.org/[code browser].
Utilities available:
* link:http://projects.archlinux.org/?p=abs.git[abs] - ABS (Arch Build System), scripts to download & use the Arch Linux PKGBUILD tree
* link:http://projects.archlinux.org/?p=devtools.git[devtools] - tools to assist in packaging and dependency checking
* link:http://projects.archlinux.org/?p=namcap.git[namcap] - a package analysis utility written in python
* link:http://projects.archlinux.org/?p=pacbuild.git[pacbuild] - a package building system utilizing a daemon
* link:http://projects.archlinux.org/?p=srcpac.git[srcpac] - a bash build-from-source pacman wrapper
* link:http://projects.archlinux.org/abs.git/[abs] - ABS (Arch Build System), scripts to download & use the Arch Linux PKGBUILD tree
* link:http://projects.archlinux.org/dbscripts.git/[dbscripts] - scripts used by Arch Linux to manage the main package repositories
* link:http://projects.archlinux.org/devtools.git/[devtools] - tools to assist in packaging and dependency checking
* link:http://projects.archlinux.org/namcap.git/[namcap] - a package analysis utility written in python
* link:http://projects.archlinux.org/srcpac.git/[srcpac] - a bash build-from-source pacman wrapper
Bugs
----
@@ -160,7 +167,7 @@ mailing last at mailto:pacman-dev@archlinux.org[] with specific information
such as your commandline, the nature of the bug, and even the package database
if it helps.
You can also post a bug to the Archlinux bug tracker
You can also post a bug to the Arch Linux bug tracker
link:http://bugs.archlinux.org/index.php?project=3[Flyspray]. Be sure to file
bugs under the Pacman project.
@@ -188,7 +195,7 @@ Pacman/libalpm frontends:
Copyright
---------
pacman is Copyright (C) 2006-2009 Pacman Development Team
pacman is Copyright (C) 2006-2011 Pacman Development Team
<pacman-dev@archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
<jvinet@zeroflux.org> and is licensed through the GNU General Public License,
version 2 or later.

View File

@@ -53,7 +53,7 @@ Options
in linkman:makepkg.conf[5].
*--config* <`/path/to/config`>::
Use an alternate config file instead of the `/etc/makepkg.conf` default;
Use an alternate config file instead of the `{sysconfdir}/makepkg.conf` default;
*-d, \--nodeps*::
Do not perform any dependency checks. This will let you override and
@@ -81,14 +81,14 @@ Options
*-g, \--geninteg*::
For each source file in the source array of PKGBUILD, download the file
if required and generate integrity checks. The integrity checks
generated are determined by the value of the INTEGRITY_CHECK array in
linkman:makepkg.conf[5]. This output can be redirected into your
PKGBUILD for source validation using "`makepkg -g >> PKGBUILD`".
if required and generate integrity checks. The integrity checks generated
are determined by the checks present in the PKGBUILD, falling back to the
value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent
This output can be redirected into your PKGBUILD for source validation
using "`makepkg -g >> PKGBUILD`".
*--skipinteg*::
Do not fail when the PKGBUILD does not contain any integrity checks, just
print a warning instead.
Do not perform any integrity checks, just print a warning instead.
*-h, \--help*::
Output syntax and command line options.
@@ -149,6 +149,17 @@ Options
remote builder, or a tarball upload. Because integrity checks are verified,
all source files of the package need to be present or downloadable.
*\--pkg <`list`>*::
Only build listed packages from a split package. The use of quotes is
necessary when specifying multiple packages. e.g. `--pkg "pkg1 pkg3"`
*\--check*::
Run the check() function in the PKGBUILD, overriding the setting in
linkman:makepkg.conf[5].
*\--nocheck*::
Do not run the check() function in the PKGBUILD or handle the checkdepends.
*\--noconfirm*::
(Passed to pacman) Prevent pacman from waiting for user input before
proceeding with operations.
@@ -166,6 +177,23 @@ separate utility 'versionpkg'. See linkman:PKGBUILD[5] for details on how to
set up a development PKGBUILD.
Environment Variables
---------------------
*PACMAN*::
The command that will be used to check for missing dependencies and to
install and remove packages. Pacman's -Qq, -Rns, -S, -T, and -U
operations must be supported by this command. If the variable is not
set or empty, makepkg will fall back to `pacman'.
**PKGDEST=**"/path/to/folder"::
Folder where the resulting packages will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
**SRCDEST=**"/path/to/folder"::
Folder where the downloaded sources will be stored. Overrides the
corresponding value defined in linkman:makepkg.conf[5].
Configuration
-------------
See linkman:makepkg.conf[5] for more details on configuring makepkg using the

View File

@@ -93,6 +93,11 @@ Options
be disabled for individual packages by placing `!ccache` in the
PKGBUILD options array.
*check*;;
Run the check() function if present in the PKGBUILD. This can be
enabled or disabled for individual packages through the use of
makepkg's `--check` and `--nocheck` options respectively.
**DISTCC_HOSTS=**"host1 ..."::
If using DistCC, this is used to specify a space-delimited list of hosts
running in the DistCC cluster. In addition, you will want to modify your
@@ -135,6 +140,18 @@ Options
affects both generation and checking. The current valid options are:
`md5`, `sha1`, `sha256`, `sha384`, and `sha512`.
**STRIP_BINARIES=**"--strip-all"::
Options to be used when stripping binaries. See linkman:strip[1]
for details.
**STRIP_SHARED=**"--strip-unneeded"::
Options to be used when stripping shared libraries. See linkman:strip[1]
for details.
**STRIP_STATIC=**"--strip-debug"::
Options to be used when stripping static libraries. See linkman:strip[1]
for details.
**MAN_DIRS=(**{usr{,/local}{,/share},opt/*}/{man,info} ...**)**::
If `zipman` is specified in the OPTIONS array, this variable will
instruct makepkg where to look to compress manual (man and info)
@@ -148,13 +165,6 @@ Options
that are located in opt/, you may need to add the directory to this
array. *NOTE:* Do not add the leading slash to the directory name.
**STRIP_DIRS=(**bin lib sbin usr/{bin,lib} ...**)**::
If `strip` is specified in the OPTIONS array, this variable will
instruct makepkg where to look to for files to strip. If you build
packages that are located in opt/, you may need to add the directory
to this array. *NOTE:* Do not add the leading slash to the directory
name.
**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
If `purge` is specified in the OPTIONS array, this variable will
instruct makepkg which files to remove from the package. This is
@@ -171,14 +181,20 @@ Options
in the current directory. Many people like to keep all source files in
a central location for easy cleanup, so this path can be set here.
**SRCPKGDEST=**"/path/to/folder"::
If this value is not set, source package files will be stored in
in the current directory. Many people like to keep all source package files
in a central location for easy cleanup, so this path can be set here.
**PACKAGER=**"John Doe <john@example.com>"::
This value is used when querying a package to see who was the builder.
It is recommended you change this to your name and email address.
*PKGEXT*, *SRCEXT*::
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
Sets the compression used when making compiled or source packages. The
current valid suffixes are `.tar`, `.tar.gz`, `.tar,bz2` and `.tar.xz`.
Do not touch these unless you know what you are doing.
See Also
--------
linkman:makepkg[8], linkman:pacman[8], linkman:PKGBUILD[5]

View File

@@ -28,6 +28,12 @@ front ends to be written (for instance, a GUI front end).
Operations
----------
*-D, \--database*::
Modify the package database. This options allows you to modify certain
attributes of the installed packages in pacman's database. At the
moment, you can only change the install reason using '\--asdeps' and
'\--asexplicit' options.
*-Q, \--query*::
Query the package database. This operation allows you to view installed
packages and their files, as well as meta-information about individual
@@ -73,6 +79,11 @@ to determine which packages need upgrading. This behavior operates as follows:
1.0a < 1.0alpha < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
+
Additionally, version strings can have an 'epoch' value defined that will
overrule any version comparison (unless the epoch values are equal). This is
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
greater than `1:3.6-1`.
*-T, \--deptest*::
Check dependencies; this is useful in scripts such as makepkg to check
@@ -82,9 +93,11 @@ to determine which packages need upgrading. This behavior operates as follows:
"bash>=3.2"`.
*-U, \--upgrade*::
Upgrade or add package(s) to the system. Either a URL or file path can be
specified. This is a ``remove-then-add'' process. See <<HCF,Handling Config
Files>> for an explanation on how pacman takes care of config files.
Upgrade or add package(s) to the system and install the required
dependencies from sync repos. Either a URL or file path can be
specified. This is a ``remove-then-add'' process. See <<UO,Upgrade
Options>> below; also see <<HCF,Handling Config Files>> for an explanation
on how pacman takes care of config files.
*-V, \--version*::
Display version and exit.
@@ -96,35 +109,12 @@ to determine which packages need upgrading. This behavior operates as follows:
Options
-------
*\--asdeps*::
Install packages non-explicitly; in other words, fake their install reason
to be installed as a dependency. This is useful for makepkg and other
build from source tools that need to install dependencies before building
the package.
*\--asexplicit*::
Install packages explicitly; in other words, fake their install reason to
be explicitly installed. This is useful if you want to mark a dependency
as explicitly installed so it will not be removed by the '\--recursive'
remove operation.
*-b, \--dbpath* <'path'>::
Specify an alternative database location (a typical default is
``/var/lib/pacman''). This should not be used unless you know what you are
``{localstatedir}/lib/pacman''). This should not be used unless you know what you are
doing. *NOTE*: if specified, this is an absolute path and the root path is
not automatically prepended.
*-d, \--nodeps*::
Skips all dependency checks. Normally, pacman will always check a
package's dependency fields to ensure that all dependencies are
installed and there are no package conflicts in the system.
*-f, \--force*::
Bypass file conflict checks and overwrite conflicting files. If the
package that is about to be installed contains files that are already
installed, this option will cause all those files to be overwritten.
This option should be used with care, ideally not at all.
*-r, \--root* <'path'>::
Specify an alternative installation root (default is ``/''). This should
not be used as a way to install software into ``/usr/local'' instead of
@@ -137,19 +127,22 @@ Options
*-v, \--verbose*::
Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
*\--debug*::
Display debug messages. When reporting bugs, this option is recommended
to be used.
*\--arch* <'arch'>::
Specify an alternate architecture.
*\--cachedir* <'dir'>::
Specify an alternative package cache location (a typical default is
``/var/cache/pacman/pkg''). Multiple cache directories can be specified,
``{localstatedir}/cache/pacman/pkg''). Multiple cache directories can be specified,
and they are tried in the order they are passed to pacman. *NOTE*: this
is an absolute path, the root path is not automatically prepended.
*\--config* <'file'>::
Specify an alternate configuration file.
*\--debug*::
Display debug messages. When reporting bugs, this option is recommended
to be used.
*\--logfile* <'file'>::
Specify an alternate log file. This is an absolute path, regardless of
the installation root setting.
@@ -158,6 +151,17 @@ Options
Bypass any and all ``Are you sure?'' messages. It's not a good idea to do
this unless you want to run pacman from a script.
Transaction Options (apply to '-S', '-R' and '-U')
--------------------------------------------------
*-d, \--nodeps*::
Skips dependency version checks. Package names are still checked. Normally,
pacman will always check a package's dependency fields to ensure that all
dependencies are installed and there are no package conflicts in the
system. Specify this option twice to skip all dependency checks.
*-k, \--dbonly*::
Adds/Removes the database entry only, leaves all files in place.
*\--noprogressbar*::
Do not show a progress bar when downloading files. This can be useful
for scripts that call pacman and capture the output.
@@ -166,25 +170,62 @@ Options
If an install scriptlet exists, do not execute it. Do not use this
unless you know what you are doing.
*-p, \--print*::
Only print the targets instead of performing the actual operation (sync,
remove or upgrade). Use '\--print-format' to specify how targets are
displayed. The default format string is "%l", which displays URLs with
'-S', filenames with '-U' and pkgname-pkgver with '-R'.
*\--print-format* <'format'>::
Specify a printf-like format to control the output of the '\--print'
operation. The possible attributes are: %n for pkgname, %v for pkgver,
%l for location, %r for repo and %s for size.
Upgrade Options (apply to '-S' and '-U')[[UO]]
--------------------------------------------
*-f, \--force*::
Bypass file conflict checks and overwrite conflicting files. If the
package that is about to be installed contains files that are already
installed, this option will cause all those files to be overwritten.
This option should be used with care, ideally not at all.
*\--asdeps*::
Install packages non-explicitly; in other words, fake their install reason
to be installed as a dependency. This is useful for makepkg and other
build from source tools that need to install dependencies before building
the package.
*\--asexplicit*::
Install packages explicitly; in other words, fake their install reason to
be explicitly installed. This is useful if you want to mark a dependency
as explicitly installed so it will not be removed by the '\--recursive'
remove operation.
*\--ignore* <'package'>::
Directs pacman to ignore upgrades of package even if there is one
available. Multiple packages can be specified by separating them
with a comma.
*\--ignoregroup* <'group'>::
Directs pacman to ignore upgrades of all packages in 'group' even if
there is one available. Multiple groups can be specified by
separating them with a comma.
Query Options[[QO]]
-------------------
*-c, \--changelog*::
View the ChangeLog of a package. Not every package will provide one but
it will be shown if available.
View the ChangeLog of a package if it exists.
*-d, \--deps*::
Restrict or filter output to packages installed as dependencies. This
option can be combined with '-t' for listing real orphans- packages that
option can be combined with '-t' for listing real orphans - packages that
were installed as dependencies but are no longer required by any
installed package. ('-Qdt' is equivalent to the pacman 3.0.X '-Qe'
option.)
installed package.
*-e, \--explicit*::
Restrict or filter output to packages explicitly installed. This option
can be combined with '-t' to list top-level packages- those packages
that were explicitly installed but are not required by any other
package. ('-Qet' is equivalent to the pacman 2.9.X '-Qe' option.)
Restrict or filter output to explicitly installed packages. This option
can be combined with '-t' to list explicitly installed packages which
are not required by any other package.
*-g, \--groups*::
Display all packages that are members of a named group. If a name is not
@@ -211,8 +252,8 @@ Query Options[[QO]]
and installed with '\--upgrade'.
*-o, \--owns* <'file'>::
Search for the package that owns file. The path can be relative or
absolute.
Search for packages that own the specified file(s). The path can be
relative or absolute and one or more files can be specified.
*-p, \--file*::
Signifies that the package supplied on the command line is a file and
@@ -230,10 +271,9 @@ Query Options[[QO]]
rather than names and versions.
*-s, \--search* <'regexp'>::
This will search each locally-installed package for names or
descriptions that match `regexp`. When you include multiple search
terms, only packages with descriptions matching ALL of those terms will
be returned.
Search each locally-installed package for names or descriptions that
match `regexp`. When including multiple search terms, only packages
with descriptions matching ALL of those terms are returned.
*-t, \--unrequired*::
Restrict or filter output to packages not required by any currently
@@ -253,9 +293,6 @@ Remove Options[[RO]]
or more target packages. This operation is recursive, and must be used
with care since it can remove many potentially needed packages.
*-k, \--keep*::
Removes the database entry only. Leaves all files in place.
*-n, \--nosave*::
Instructs pacman to ignore file backup designations. Normally, when a
file is removed from the system the database is checked to see if the
@@ -269,7 +306,7 @@ Remove Options[[RO]]
orphans. If you want to omit condition (B), pass this option twice.
*-u, \--unneeded*::
Removes the targets that are not required by any other packages.
Removes targets that are not required by any other packages.
This is mostly useful when removing a group without using the '-c' option,
to avoid breaking any dependencies.
@@ -296,18 +333,14 @@ linkman:pacman.conf[5].
view all groups and their members.
*-i, \--info*::
Display dependency and other information for a given package. This will
search through all repositories for a matching package.
Display information on a given sync database package. Passing two '\--info'
or '-i' flags will also display those packages in all repositories that
depend on this package.
*-l, \--list*::
List all packages in the specified repositories. Multiple repositories
can be specified on the command line.
*-p, \--print-uris*::
Print out URIs for each package that will be installed, including any
dependencies yet to be installed. These can be piped to a file and
downloaded at a later time, using a program like wget.
*-q, \--quiet*::
Show less information for certain sync operations. (This is useful when
pacman's output is processed in a script.) Search will only show package
@@ -330,31 +363,22 @@ linkman:pacman.conf[5].
necessary. Pass this option twice to enable package downgrade; in this
case pacman will select sync packages whose version does not match with
the local version. This can be useful when the user switches from a testing
repo to a stable one.
repo to a stable one. Additional targets can also be specified manually, so
that '-Su foo' will do a system upgrade and install/upgrade the foo package in
the same operation.
*-w, \--downloadonly*::
Retrieve all packages from the server, but do not install/upgrade
anything.
Retrieve all packages from the server, but do not install/upgrade anything.
*-y, \--refresh*::
Download a fresh copy of the master package list from the server(s)
defined in linkman:pacman.conf[5]. This should typically be used each time
you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y' flags
will force a refresh of all package lists even if they are thought to be up
will force a refresh of all package lists even if they appear to be up
to date.
*\--needed*::
Don't reinstall the targets that are already up-to-date.
*\--ignore* <'package'>::
Directs pacman to ignore upgrades of package even if there is one
available. Multiple packages can be specified by separating them
with a comma.
*\--ignoregroup* <'group'>::
Directs pacman to ignore upgrades of all packages in 'group' even if
there is one available. Multiple groups can be specified by
separating them with a comma.
Don't reinstall the targets that are already up to date.
Handling Config Files[[HCF]]
@@ -367,7 +391,7 @@ actual file existing on the filesystem. After comparing these 3 hashes, the
follow scenarios can result:
original=X, current=X, new=X::
All three files are the same, so overwrites are not an issue Install the
All three files are the same, so overwrites are not an issue. Install the
new file.
original=X, current=X, new=Y::
@@ -388,6 +412,25 @@ original=X, current=Y, new=Z::
necessary changes into the original file.
Examples
--------
pacman -Ss ne.hack::
Search for regexp "ne.hack" in package database.
pacman -S gpm::
Download and install gpm including dependencies.
pacman -U /home/user/ceofhack-0.6-1-x86_64.pkg.tar.gz::
Install ceofhack-0.6-1 package from a local file.
pacman -Syu::
Update package list and upgrade all packages afterwards.
pacman -Syu gpm::
Update package list, upgrade all packages, and then install gpm if it
wasn't already installed.
Configuration
-------------
See linkman:pacman.conf[5] for more details on configuring pacman using the

View File

@@ -35,7 +35,7 @@ NoUpgrade = etc/passwd etc/group etc/shadow
NoUpgrade = etc/fstab
[core]
Include = /etc/pacman.d/core
Include = {sysconfdir}/pacman.d/core
[custom]
Server = file:///home/pkgs
@@ -57,13 +57,13 @@ Options
*DBPath =* path/to/db/dir::
Overrides the default location of the toplevel database directory. A
typical default is ``/var/lib/pacman/''. Most users will not need to set
typical default is ``{localstatedir}/lib/pacman/''. Most users will not need to set
this option. *NOTE*: if specified, this is an absolute path and the root
path is not automatically prepended.
*CacheDir =* path/to/cache/dir::
Overrides the default location of the package cache directory. A typical
default is ``/var/cache/pacman/pkg/''. Multiple cache directories can be
default is ``{localstatedir}/cache/pacman/pkg/''. Multiple cache directories can be
specified, and they are tried in the order they are listed in the config
file. If a file is not found in any cache directory, it will be downloaded
to the first cache directory with write access. *NOTE*: this is an absolute
@@ -72,7 +72,7 @@ Options
*LogFile =* '/path/to/file'::
Overrides the default location of the pacman log file. A typical default
is ``/var/log/pacman.log''. This is an absolute path and the root directory
is ``{localstatedir}/log/pacman.log''. This is an absolute path and the root directory
is not prepended.
*HoldPkg =* package ...::
@@ -98,7 +98,16 @@ Options
*Include =* path::
Include another config file. This file can include repositories or
general configuration options.
general configuration options. Wildcards in the specified paths will get
expanded based on linkman:glob[7] rules.
*Architecture =* auto | i686 | x86_64 | ...::
If set, pacman will only allow installation of packages of the given
architecture (e.g. 'i686', 'x86_64', etc). The special value 'auto' will
use the system architecture, provided by in ``uname -m''. If unset, no
architecture checks are made. *NOTE*: packages with the special
architecture 'any' can always be installed, as they are meant to be
architecture independent.
*XferCommand =* /path/to/command %u::
If set, an external program will be used to download all remote files.
@@ -111,9 +120,6 @@ Options
http/ftp support, or need the more advanced proxy support that comes with
utilities like wget.
*NoPassiveFtp*::
Disables passive ftp connections when downloading packages. (aka Active Mode)
*NoUpgrade =* file ...::
All files listed with a `NoUpgrade` directive will never be touched during
a package install/upgrade, and the new files will be installed with a
@@ -130,18 +136,20 @@ Options
These files refer to files in the package archive, so do not include the
leading slash (the RootDir) when specifying them.
*CleanMethod =* KeepInstalled | KeepCurrent::
*CleanMethod =* KeepInstalled &| KeepCurrent::
If set to `KeepInstalled` (the default), the '-Sc' operation will clean
packages that are no longer installed (not present in the local database).
If set to `KeepCurrent`, '-Sc' will clean outdated packages (not present in
any sync database).
The second behavior is useful when the package cache is shared among
multiple machines, where the local databases are usually different, but the
sync databases in use could be the same.
sync databases in use could be the same. If both values are specified,
packages are only cleaned if not installed locally and not present in any
known sync database.
*UseSyslog*::
Log action messages through syslog(). This will insert log entries into
``/var/log/messages'' or equivalent.
``{localstatedir}/log/messages'' or equivalent.
*ShowSize*::
Display the size of individual packages for '\--sync' and '\--query' modes.
@@ -156,6 +164,10 @@ Options
than the percent of each individual download target. The progress
bar is still based solely on the current file download.
*CheckSpace*::
Performs an approximate check for adequate available disk space before
installing packages.
Repository Sections
-------------------
Each repository section defines a section name and at least one location where
@@ -174,15 +186,17 @@ contain a file that lists the servers for that repository.
# use this repository first
Server = ftp://ftp.archlinux.org/core/os/arch
# next use servers as defined in the mirrorlist below
Include = /etc/pacman.d/mirrorlist
Include = {sysconfdir}/pacman.d/mirrorlist
--------
During parsing, pacman will define the `$repo` variable to the name of the
current section. This is often utilized in files specified using the 'Include'
directive so all repositories can use the same mirrorfile.
directive so all repositories can use the same mirrorfile. pacman also defines
the `$arch` variable to the value of `Architecture`, so the same mirrorfile can
even be used for different architectures.
--------
Server = ftp://ftp.archlinux.org/$repo/os/arch
Server = ftp://ftp.archlinux.org/$repo/os/$arch
--------
The order of repositories in the configuration files matters; repositories

View File

@@ -10,7 +10,7 @@ repo-add - package database maintenance utility
Synopsis
--------
repo-add [-q] <path-to-db> <package1> [<package2> ...]
repo-add [-d] [-f] [-q] <path-to-db> <package1> [<package2> ...]
repo-remove [-q] <path-to-db> <packagename> [<packagename2> ...]
@@ -30,11 +30,19 @@ on the command line.
Options
-------
*-d, \--delta*::
Automatically generate and add a delta file between the old entry and the
new one, if the old package file is found next to the new one.
*-f, \--files*::
Tells repo-add also to create and include a list of the files in the
specified packages. This is useful for creating databases listing all files
in a given sync repository for tools that may use this information.
*-q, \--quiet*::
Force this program to keep quiet and run silent except for warning and
error messages.
See Also
--------
linkman:makepkg[8], linkman:pacman[8]

View File

@@ -4,13 +4,17 @@ Pacman - Translating
This document is here to guide you in helping translate pacman messages,
libalpm messages, and the manpages for the entire pacman package.
A quick note- the gettext website is a very useful guide to read before
embarking on translation work, as it describes many of the commands in more
detail than I will here:
http://www.gnu.org/software/gettext/manual/html_node/gettext.html[]
We are currently using http://www.transifex.net/[Transifex] as the translation
platform for pacman and libalpm. You will need to sign up for an account there
and then register with a translation team on the
http://www.transifex.net/projects/p/archlinux-pacman/[pacman project page].
In addition, this site presents a small tutorial that I found useful:
http://oriya.sarovar.org/docs/gettext/[]
NOTE: This may be old information due to our switch to Transifex, but the
gettext website is a very useful guide to read before embarking on translation
work, as it describes many of the commands in more detail than I will here:
http://www.gnu.org/software/gettext/manual/html_node/gettext.html[]. In
addition, this site presents a small tutorial that I found useful:
http://oriya.sarovar.org/docs/gettext/[].
Translating Messages
@@ -28,35 +32,31 @@ original message and the corresponding translation. These po files can then
either be hand edited, or modified with a tool such as poedit, gtranslator or
kbabel. Using a translation tool tends to make the job easier.
Please read up on Transifex usage using the
http://help.transifex.net/[Transifex Help] if you are not familiar.
See the <<Notes,Notes>> section for additional hints on translating.
Pre-release Updates
~~~~~~~~~~~~~~~~~~~
A week or two before each release, the codebase will go into a string freeze
and an email will be sent by the 'translation lieutenant' to the
mailto:pacman-dev@archlinux.org[pacman-dev] mailing list asking for
translations. This email will have a prefix of *[translation]* for anyone
looking to set up an email filter.
and an email will be sent to the mailto:pacman-dev@archlinux.org[pacman-dev]
mailing list asking for translations. This email will have a prefix of
*[translation]* for anyone looking to set up an email filter.
At this time, the `.po` language files will be made available at a URL
specified in the email. Each language will have two files available (backend
and frontend). Translators interested in helping are encouraged to send a
follow-up message to the mailing list stating exactly what they intend to
translate so efforts are not duplicated on the same language.
At this time, the latest `.po` language files will be made available at the
Transifex project page. Each language will have two files available (backend
and frontend). Translators interested in helping are encouraged to use the
features of Transifex to let others know they are currently translating their
language.
Once a translator has completed the translation (*OR* realizes they do not have
time to finish), please email the `.po` files back to the list with a subject
such as '[translation] Updated German translation'. At this point, the
'translation lieutenant' will gather the translations together for inclusion in
the upcoming release.
time to finish), please upload your progress back to the Transifex site.
NOTE: Please email your translations back to the list as soon as possible- this
will give other speakers of your language time to review your translations and
update them as necessary.
For those familiar with GIT, you may wish to follow the procedure outlined
below as another alternative.
NOTE: Please upload your translations as soon as possible- this will give other
speakers of your language time to review your translations and update them as
necessary.
Incremental Updates
~~~~~~~~~~~~~~~~~~~

71
doc/vercmp.8.txt Normal file
View File

@@ -0,0 +1,71 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet:
/////
vercmp(8)
=========
Name
----
vercmp - version comparsion utility
Synopsis
--------
'vercmp' <version1> <version2>
Description
-----------
'vercmp' is used to determine the relationship between two given version
numbers. It outputs values as follows:
* < 0 : if ver1 < ver2
* = 0 : if ver1 == ver2
* > 0 : if ver1 > ver2
Version comparsion operates as follows:
Alphanumeric:
1.0a < 1.0alpha < 1.0b < 1.0beta < 1.0p < 1.0pre < 1.0rc < 1.0
Numeric:
1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
Additionally, version strings can have an 'epoch' value defined that will
overrule any version comparison (unless the epoch values are equal). This is
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
greater than `1:3.6-1`.
Options
-------
*-h, \--help*::
Display syntax for the given operation. If no operation was supplied
then the general syntax is shown.
Examples
--------
$ vercmp 1 2
-1
$ vercmp 2 1
1
$ vercmp 2.0-1 1.7-6
1
$ vercmp 2.0 2.0-13
0
$ vercmp 4.34 1:001
-1
Configuration
-------------
There is none.
See Also
--------
linkman:pacman[8], linkman:makepkg[8], linkman:libalpm[3]
include::footer.txt[]

View File

@@ -13,6 +13,9 @@ edit = sed \
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
-e 's|@PKGEXT[@]|$(PKGEXT)|g' \
-e 's|@SRCEXT[@]|$(SRCEXT)|g' \
-e 's|@STRIP_BINARIES[@]|$(STRIP_BINARIES)|g' \
-e 's|@STRIP_SHARED[@]|$(STRIP_SHARED)|g' \
-e 's|@STRIP_STATIC[@]|$(STRIP_STATIC)|g' \
-e 's|@CARCH[@]|$(CARCH)|g' \
-e 's|@CHOST[@]|$(CHOST)|g' \
-e 's|@ARCHSWITCH[@]|$(ARCHSWITCH)|g' \

View File

@@ -26,7 +26,7 @@ DLAGENTS=('ftp::/usr/bin/wget -c --passive-ftp -t 3 --waitretry=3 -O %o %u'
CARCH="@CARCH@"
CHOST="@CHOST@"
#-- Exclusive: will only run on @CARCHFLAGS@
#-- Exclusive: will only run on @CARCH@
# -march (or -mcpu) builds exclusively for an architecture
# -mtune optimizes for an architecture, but builds for whole processor family
CFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
@@ -39,15 +39,16 @@ CXXFLAGS="@CARCHFLAGS@-mtune=generic -O2 -pipe"
# BUILD ENVIRONMENT
#########################################################################
#
# Defaults: BUILDENV=(fakeroot !distcc color !ccache)
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check)
# A negated environment option will do the opposite of the comments below.
#
#-- fakeroot: Allow building packages as a non-root user
#-- distcc: Use the Distributed C/C++/ObjC compiler
#-- color: Colorize output messages
#-- ccache: Use ccache to cache compilation
#-- check: Run the check() function if present in the PKGBUILD
#
BUILDENV=(fakeroot !distcc color !ccache)
BUILDENV=(fakeroot !distcc color !ccache check)
#
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
#-- specify a space-delimited list of hosts running in the DistCC cluster.
@@ -61,7 +62,7 @@ BUILDENV=(fakeroot !distcc color !ccache)
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries in STRIP_DIRS
#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- emptydirs: Leave empty directories in packages
@@ -72,12 +73,16 @@ OPTIONS=(strip docs libtool emptydirs zipman purge)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)
#-- Options to be used when stripping binaries. See `man strip' for details.
STRIP_BINARIES="@STRIP_BINARIES@"
#-- Options to be used when stripping shared libraries. See `man strip' for details.
STRIP_SHARED="@STRIP_SHARED@"
#-- Options to be used when stripping static libraries. See `man strip' for details.
STRIP_STATIC="@STRIP_STATIC@"
#-- Manual (man and info) directories to compress (if zipman is specified)
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
#-- Doc directories to remove (if !docs is specified)
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Directories to be searched for the strip option (if strip is specified)
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})
#-- Files to be removed from all packages (if purge is specified)
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
@@ -91,6 +96,8 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#PKGDEST=/home/packages
#-- Source cache: specify a fixed directory where source files will be cached
#SRCDEST=/home/sources
#-- Source packages: specify a fixed directory where all src packages will be placed
#SRCPKGDEST=/home/srcpackages
#-- Packager: name/email of the person or organization building packages
#PACKAGER="John Doe <john@doe.com>"

View File

@@ -17,8 +17,9 @@ HoldPkg = pacman glibc
# If upgrades are available for these packages they will be asked for first
SyncFirst = pacman
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#XferCommand = /usr/bin/curl %u > %o
#XferCommand = /usr/bin/curl -C - -f %u > %o
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
@@ -28,11 +29,11 @@ SyncFirst = pacman
#NoExtract =
# Misc options (all disabled by default)
#NoPassiveFtp
#UseSyslog
#ShowSize
#UseDelta
#TotalDownload
#CheckSpace
#
# REPOSITORIES
@@ -42,6 +43,7 @@ SyncFirst = pacman
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
@@ -57,7 +59,7 @@ SyncFirst = pacman
# servers immediately after the header and they will be used before the
# default mirrors.
#[core]
#Server = ftp://ftp.example.com/foobar/$repo/os/i686/
#Server = ftp://ftp.example.com/foobar/$repo/os/$arch/
# The file referenced here should contain a list of 'Server = ' lines.
#Include = @sysconfdir@/pacman.d/mirrorlist

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-10-14.15
scriptversion=2010-02-06.18; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -48,7 +48,7 @@ IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
@@ -58,34 +58,49 @@ fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_glob=
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
chgrpcmd=
stripcmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
mvcmd="$mvprog"
stripcmd=
src=
dst=
dir_arg=
dstarg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
@@ -95,65 +110,55 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) shift
continue;;
-c) ;;
-d) dir_arg=true
shift
continue;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
shift
shift
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
continue;;
shift;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
shift;;
-s) stripcmd=$stripprog
shift
continue;;
-s) stripcmd=$stripprog;;
-t) dstarg=$2
shift
shift
continue;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true
shift
continue;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
@@ -165,21 +170,22 @@ while test $# -ne 0; do
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dstarg=$arg
dst_arg=$arg
done
fi
@@ -194,7 +200,11 @@ if test $# -eq 0; then
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
@@ -224,7 +234,7 @@ for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
@@ -242,22 +252,22 @@ do
exit 1
fi
if test -z "$dstarg"; then
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
@@ -378,26 +388,19 @@ do
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix=/ ;;
-*) prefix=./ ;;
*) prefix= ;;
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
case $posix_glob in
'')
if (set -f) 2>/dev/null; then
posix_glob=true
else
posix_glob=false
fi ;;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob && set -f
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob && set +f
$posix_glob set +f
IFS=$oIFS
prefixes=
@@ -459,41 +462,54 @@ do
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dst"; then
$doit $rmcmd -f "$dst" 2>/dev/null \
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|| {
echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
else
:
fi
} &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
} || exit 1
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
@@ -503,5 +519,6 @@ done
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -25,25 +25,32 @@ libalpm_la_SOURCES = \
alpm.h alpm.c \
alpm_list.h alpm_list.c \
backup.h backup.c \
be_files.c \
be_local.c \
be_package.c \
cache.h cache.c \
be_sync.c \
conflict.h conflict.c \
db.h db.c \
delta.h delta.c \
deps.h deps.c \
diskspace.h diskspace.c \
dload.h dload.c \
error.c \
graph.h \
group.h group.c \
handle.h handle.c \
log.h log.c \
md5.h md5.c \
package.h package.c \
pkghash.h pkghash.c \
remove.h remove.c \
sync.h sync.c \
trans.h trans.c \
util.h util.c
util.h util.c \
version.c
if !HAVE_LIBSSL
libalpm_la_SOURCES += \
md5.h md5.c
endif
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
libalpm_la_LIBADD = $(LTLIBINTL)

View File

@@ -1,7 +1,7 @@
/*
* add.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -40,7 +40,6 @@
#include "alpm_list.h"
#include "trans.h"
#include "util.h"
#include "cache.h"
#include "log.h"
#include "backup.h"
#include "package.h"
@@ -50,222 +49,91 @@
#include "remove.h"
#include "handle.h"
int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
/** Add a package to the transaction.
* @param pkg the package to add
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int SYMEXPORT alpm_add_pkg(pmpkg_t *pkg)
{
pmpkg_t *pkg = NULL;
const char *pkgname, *pkgver;
alpm_list_t *i;
pmtrans_t *trans;
pmdb_t *db_local;
pmpkg_t *local;
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
trans = handle->trans;
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
ASSERT(name != NULL && strlen(name) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
db_local = handle->db_local;
_alpm_log(PM_LOG_DEBUG, "loading target '%s'\n", name);
if(alpm_pkg_load(name, 1, &pkg) != 0) {
goto error;
}
pkgname = alpm_pkg_get_name(pkg);
pkgver = alpm_pkg_get_version(pkg);
/* check if an older version of said package is already in transaction
* packages. if so, replace it in the list */
for(i = trans->packages; i; i = i->next) {
pmpkg_t *transpkg = i->data;
if(strcmp(transpkg->name, pkgname) == 0) {
if(alpm_pkg_vercmp(transpkg->version, pkgver) < 0) {
_alpm_log(PM_LOG_WARNING, _("replacing older version %s-%s by %s in target list\n"),
transpkg->name, transpkg->version, pkgver);
_alpm_pkg_free(i->data);
i->data = pkg;
_alpm_log(PM_LOG_DEBUG, "adding package '%s'\n", pkgname);
if(_alpm_pkg_find(trans->add, pkgname)) {
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
}
local = _alpm_db_get_pkgfromcache(db_local, pkgname);
if(local) {
const char *localpkgname = alpm_pkg_get_name(local);
const char *localpkgver = alpm_pkg_get_version(local);
int cmp = _alpm_pkg_compare_versions(pkg, local);
if(cmp == 0) {
if(trans->flags & PM_TRANS_FLAG_NEEDED) {
/* with the NEEDED flag, packages up to date are not reinstalled */
_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
localpkgname, localpkgver);
return(0);
} else {
_alpm_log(PM_LOG_WARNING, _("skipping %s-%s because newer version %s is in target list\n"),
pkgname, pkgver, transpkg->version);
_alpm_pkg_free(pkg);
_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"),
localpkgname, localpkgver);
}
return(0);
} else if(cmp < 0) {
/* local version is newer */
_alpm_log(PM_LOG_WARNING, _("downgrading package %s (%s => %s)\n"),
localpkgname, localpkgver, pkgver);
}
}
/* add the package to the transaction */
trans->packages = alpm_list_add(trans->packages, pkg);
pkg->reason = PM_PKG_REASON_EXPLICIT;
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s to the transaction targets\n",
pkgname, pkgver);
trans->add = alpm_list_add(trans->add, pkg);
return(0);
error:
_alpm_pkg_free(pkg);
return(-1);
}
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
static int perform_extraction(struct archive *archive,
struct archive_entry *entry, const char *filename, const char *origname)
{
alpm_list_t *lp = NULL;
int ret;
const int archive_flags = ARCHIVE_EXTRACT_OWNER |
ARCHIVE_EXTRACT_PERM |
ARCHIVE_EXTRACT_TIME;
ALPM_LOG_FUNC;
archive_entry_set_pathname(entry, filename);
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
/* Check dependencies
*/
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
/* look for unsatisfied dependencies */
_alpm_log(PM_LOG_DEBUG, "looking for unsatisfied dependencies\n");
lp = alpm_checkdeps(_alpm_db_get_pkgcache(db), 1, NULL, trans->packages);
if(lp != NULL) {
if(data) {
*data = lp;
} else {
alpm_list_free_inner(lp, (alpm_list_fn_free)_alpm_depmiss_free);
alpm_list_free(lp);
}
RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1);
}
/* no unsatisfied deps, so look for conflicts */
_alpm_log(PM_LOG_DEBUG, "looking for conflicts\n");
alpm_list_t *inner = _alpm_innerconflicts(trans->packages);
alpm_list_t *outer = _alpm_outerconflicts(db, trans->packages);
lp = alpm_list_join(inner, outer);
/* TODO : factorize the conflict resolving code from sync.c to use it here (FS#3492) */
if(lp != NULL) {
if(data) {
*data = lp;
} else {
alpm_list_free_inner(lp, (alpm_list_fn_free)_alpm_conflict_free);
alpm_list_free(lp);
}
if(inner) {
_alpm_log(PM_LOG_ERROR, _("conflicting packages were found in target list\n"));
_alpm_log(PM_LOG_ERROR, _("you cannot install two conflicting packages at the same time\n"));
}
if(outer) {
_alpm_log(PM_LOG_ERROR, _("replacing packages with -U is not supported yet\n"));
_alpm_log(PM_LOG_ERROR, _("you can replace packages manually using -Rd and -U\n"));
}
RET_ERR(PM_ERR_CONFLICTING_DEPS, -1);
}
/* re-order w.r.t. dependencies */
_alpm_log(PM_LOG_DEBUG, "sorting by dependencies\n");
lp = _alpm_sortbydeps(trans->packages, 0);
/* free the old alltargs */
alpm_list_free(trans->packages);
trans->packages = lp;
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);
ret = archive_read_extract(archive, entry, archive_flags);
if(ret == ARCHIVE_WARN && archive_errno(archive) != ENOSPC) {
/* operation succeeded but a "non-critical" error was encountered */
_alpm_log(PM_LOG_WARNING, _("warning given when extracting %s (%s)\n"),
origname, archive_error_string(archive));
} else if(ret != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
origname, archive_error_string(archive));
alpm_logaction("error: could not extract %s (%s)\n",
origname, archive_error_string(archive));
return(1);
}
/* Check for file conflicts */
if(!(trans->flags & PM_TRANS_FLAG_FORCE)) {
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
_alpm_log(PM_LOG_DEBUG, "looking for file conflicts\n");
lp = _alpm_db_find_fileconflicts(db, trans, trans->packages, NULL);
if(lp != NULL) {
if(data) {
*data = lp;
} else {
alpm_list_free_inner(lp, (alpm_list_fn_free)_alpm_fileconflict_free);
alpm_list_free(lp);
}
RET_ERR(PM_ERR_FILE_CONFLICTS, -1);
}
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
}
return(0);
}
static int upgrade_remove(pmpkg_t *oldpkg, pmpkg_t *newpkg, pmtrans_t *trans, pmdb_t *db) {
/* this is kinda odd. If the old package exists, at this point we make a
* NEW transaction, unrelated to handle->trans, and instantiate a "remove"
* with the type PM_TRANS_TYPE_REMOVEUPGRADE. TODO: kill this weird
* behavior. */
pmtrans_t *tr = _alpm_trans_new();
ALPM_LOG_FUNC;
_alpm_log(PM_LOG_DEBUG, "removing old package first (%s-%s)\n",
oldpkg->name, oldpkg->version);
if(!tr) {
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
if(_alpm_trans_init(tr, PM_TRANS_TYPE_REMOVEUPGRADE, trans->flags,
NULL, NULL, NULL) == -1) {
_alpm_trans_free(tr);
tr = NULL;
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
if(_alpm_remove_loadtarget(tr, db, newpkg->name) == -1) {
_alpm_trans_free(tr);
tr = NULL;
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
/* copy the remove skiplist over */
tr->skip_remove = alpm_list_strdup(trans->skip_remove);
const alpm_list_t *b;
/* Add files in the NEW backup array to the NoUpgrade array
* so this removal operation doesn't kill them */
alpm_list_t *old_noupgrade = alpm_list_strdup(handle->noupgrade);
/* old package backup list */
alpm_list_t *filelist = alpm_pkg_get_files(newpkg);
for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) {
char *backup = _alpm_backup_file(b->data);
/* safety check (fix the upgrade026 pactest) */
if(!alpm_list_find_str(filelist, backup)) {
FREE(backup);
continue;
}
_alpm_log(PM_LOG_DEBUG, "adding %s to the NoUpgrade array temporarily\n",
backup);
handle->noupgrade = alpm_list_add(handle->noupgrade,
backup);
}
/* TODO: we could also add files in the OLD backup array, but this would
* change the backup handling behavior, and break several pactests, and we
* can't do this just before 3.1 release.
* The unlink_file function in remove.c would also need to be reviewed. */
#if 0
/* new package backup list */
for(b = alpm_pkg_get_backup(oldpkg); b; b = b->next) {
char *backup = _alpm_backup_file(b->data);
/* make sure we don't add duplicate entries */
if(!alpm_list_find_ptr(handle->noupgrade, backup)) {
_alpm_log(PM_LOG_DEBUG, "adding %s to the NoUpgrade array temporarily\n",
backup);
handle->noupgrade = alpm_list_add(handle->noupgrade,
backup);
}
}
#endif
int ret = _alpm_remove_commit(tr, db);
_alpm_trans_free(tr);
tr = NULL;
/* restore our "NoUpgrade" list to previous state */
FREELIST(handle->noupgrade);
handle->noupgrade = old_noupgrade;
if(ret == -1) {
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
return(0);
}
@@ -279,9 +147,6 @@ static int extract_single_file(struct archive *archive,
int needbackup = 0, notouch = 0;
char *hash_orig = NULL;
char *entryname_orig = NULL;
const int archive_flags = ARCHIVE_EXTRACT_OWNER |
ARCHIVE_EXTRACT_PERM |
ARCHIVE_EXTRACT_TIME;
int errors = 0;
entryname = archive_entry_pathname(entry);
@@ -291,13 +156,13 @@ static int extract_single_file(struct archive *archive,
if(strcmp(entryname, ".INSTALL") == 0) {
/* the install script goes inside the db */
snprintf(filename, PATH_MAX, "%s%s-%s/install", db->path,
newpkg->name, newpkg->version);
snprintf(filename, PATH_MAX, "%s%s-%s/install",
_alpm_db_path(db), newpkg->name, newpkg->version);
archive_entry_set_perm(entry, 0644);
} else if(strcmp(entryname, ".CHANGELOG") == 0) {
/* the changelog goes inside the db */
snprintf(filename, PATH_MAX, "%s%s-%s/changelog", db->path,
newpkg->name, newpkg->version);
snprintf(filename, PATH_MAX, "%s%s-%s/changelog",
_alpm_db_path(db), newpkg->name, newpkg->version);
archive_entry_set_perm(entry, 0644);
} else if(*entryname == '.') {
/* for now, ignore all files starting with '.' that haven't
@@ -320,14 +185,6 @@ static int extract_single_file(struct archive *archive,
return(0);
}
/* if a file is in the add skiplist we never extract it */
if(alpm_list_find_str(trans->skip_add, filename)) {
_alpm_log(PM_LOG_DEBUG, "%s is in trans->skip_add, skipping extraction\n",
entryname);
archive_read_data_skip(archive);
return(0);
}
/* Check for file existence. This is one of the more crucial parts
* to get 'right'. Here are the possibilities, with the filesystem
* on the left and the package on the top:
@@ -358,7 +215,7 @@ static int extract_single_file(struct archive *archive,
/* case 12: existing dir, ignore it */
if(lsbuf.st_mode != entrymode) {
/* if filesystem perms are different than pkg perms, warn user */
int mask = 07777;
mode_t mask = 07777;
_alpm_log(PM_LOG_WARNING, _("directory permissions differ on %s\n"
"filesystem: %o package: %o\n"), entryname, lsbuf.st_mode & mask,
entrymode & mask);
@@ -436,18 +293,10 @@ static int extract_single_file(struct archive *archive,
int ret;
snprintf(checkfile, PATH_MAX, "%s.paccheck", filename);
archive_entry_set_pathname(entry, checkfile);
ret = archive_read_extract(archive, entry, archive_flags);
if(ret == ARCHIVE_WARN) {
/* operation succeeded but a non-critical error was encountered */
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)\n",
entryname_orig, archive_error_string(archive));
} else if(ret != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
entryname_orig, archive_error_string(archive));
alpm_logaction("error: could not extract %s (%s)\n",
entryname_orig, archive_error_string(archive));
ret = perform_extraction(archive, entry, checkfile, entryname_orig);
if(ret == 1) {
/* error */
FREE(hash_orig);
FREE(entryname_orig);
return(1);
@@ -589,18 +438,9 @@ static int extract_single_file(struct archive *archive,
unlink(filename);
}
archive_entry_set_pathname(entry, filename);
ret = archive_read_extract(archive, entry, archive_flags);
if(ret == ARCHIVE_WARN) {
/* operation succeeded but a non-critical error was encountered */
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)\n",
entryname_orig, archive_error_string(archive));
} else if(ret != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
entryname_orig, archive_error_string(archive));
alpm_logaction("error: could not extract %s (%s)\n",
entryname_orig, archive_error_string(archive));
ret = perform_extraction(archive, entry, filename, entryname_orig);
if(ret == 1) {
/* error */
FREE(entryname_orig);
return(1);
}
@@ -632,8 +472,8 @@ static int extract_single_file(struct archive *archive,
return(errors);
}
static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
pmtrans_t *trans, pmdb_t *db)
static int commit_single_pkg(pmpkg_t *newpkg, size_t pkg_current,
size_t pkg_count, pmtrans_t *trans, pmdb_t *db)
{
int i, ret = 0, errors = 0;
char scriptlet[PATH_MAX+1];
@@ -642,8 +482,11 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
ALPM_LOG_FUNC;
snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", db->path,
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
snprintf(scriptlet, PATH_MAX, "%s%s-%s/install",
_alpm_db_path(db), alpm_pkg_get_name(newpkg),
alpm_pkg_get_version(newpkg));
/* see if this is an upgrade. if so, remove the old package first */
pmpkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name);
@@ -654,7 +497,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
oldpkg = _alpm_pkg_dup(local);
/* make sure all infos are loaded because the database entry
* will be removed soon */
_alpm_db_read(oldpkg->origin_data.db, oldpkg, INFRQ_ALL);
_alpm_local_db_read(oldpkg->origin_data.db, oldpkg, INFRQ_ALL);
EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, oldpkg);
_alpm_log(PM_LOG_DEBUG, "upgrading package %s-%s\n",
@@ -691,15 +534,16 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
if(oldpkg) {
/* set up fake remove transaction */
int ret = upgrade_remove(oldpkg, newpkg, trans, db);
if(ret != 0) {
if(_alpm_upgraderemove_package(oldpkg, newpkg, trans) == -1) {
pm_errno = PM_ERR_TRANS_ABORT;
ret = -1;
goto cleanup;
}
}
/* prepare directory for database entries so permission are correct after
changelog/install script installation (FS#12263) */
if(_alpm_db_prepare(db, newpkg)) {
if(_alpm_local_db_prepare(db, newpkg)) {
alpm_logaction("error: could not create database entry %s-%s\n",
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
pm_errno = PM_ERR_DB_WRITE;
@@ -711,6 +555,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
struct archive *archive;
struct archive_entry *entry;
char cwd[PATH_MAX] = "";
int restore_cwd = 0;
_alpm_log(PM_LOG_DEBUG, "extracting files\n");
@@ -734,11 +579,16 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
/* save the cwd so we can restore it later */
if(getcwd(cwd, PATH_MAX) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not get current working directory\n"));
cwd[0] = 0;
} else {
restore_cwd = 1;
}
/* libarchive requires this for extracting hard links */
chdir(handle->root);
if(chdir(handle->root) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"), handle->root, strerror(errno));
ret = -1;
goto cleanup;
}
/* call PROGRESS once with 0 percent, as we sort-of skip that here */
if(is_upgrade) {
@@ -750,31 +600,31 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
}
for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
double percent;
int percent;
if(newpkg->size != 0) {
/* Using compressed size for calculations here, as newpkg->isize is not
* exact when it comes to comparing to the ACTUAL uncompressed size
* (missing metadata sizes) */
int64_t pos = archive_position_compressed(archive);
percent = (double)pos / (double)newpkg->size;
percent = (pos * 100) / newpkg->size;
_alpm_log(PM_LOG_DEBUG, "decompression progress: "
"%f%% (%"PRId64" / %jd)\n",
percent*100.0, pos, (intmax_t)newpkg->size);
if(percent >= 1.0) {
percent = 1.0;
"%d%% (%"PRId64" / %jd)\n",
percent, pos, (intmax_t)newpkg->size);
if(percent >= 100) {
percent = 100;
}
} else {
percent = 0.0;
percent = 0;
}
if(is_upgrade) {
PROGRESS(trans, PM_TRANS_PROGRESS_UPGRADE_START,
alpm_pkg_get_name(newpkg), (int)(percent * 100), pkg_count,
alpm_pkg_get_name(newpkg), percent, pkg_count,
pkg_current);
} else {
PROGRESS(trans, PM_TRANS_PROGRESS_ADD_START,
alpm_pkg_get_name(newpkg), (int)(percent * 100), pkg_count,
alpm_pkg_get_name(newpkg), percent, pkg_count,
pkg_current);
}
@@ -784,9 +634,9 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
}
archive_read_finish(archive);
/* restore the old cwd is we have it */
if(strlen(cwd)) {
chdir(cwd);
/* restore the old cwd if we have it */
if(restore_cwd && chdir(cwd) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"), cwd, strerror(errno));
}
if(errors) {
@@ -811,7 +661,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
_alpm_log(PM_LOG_DEBUG, "updating database\n");
_alpm_log(PM_LOG_DEBUG, "adding database entry '%s'\n", newpkg->name);
if(_alpm_db_write(db, newpkg, INFRQ_ALL)) {
if(_alpm_local_db_write(db, newpkg, INFRQ_ALL)) {
_alpm_log(PM_LOG_ERROR, _("could not update database entry %s-%s\n"),
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
alpm_logaction("error: could not update database entry %s-%s\n",
@@ -858,9 +708,10 @@ cleanup:
return(ret);
}
int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db)
{
int pkg_count, pkg_current;
size_t pkg_count, pkg_current;
int skip_ldconfig = 0, ret = 0;
alpm_list_t *targ;
ALPM_LOG_FUNC;
@@ -868,28 +719,38 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
if(trans->packages == NULL) {
if(trans->add == NULL) {
return(0);
}
pkg_count = alpm_list_count(trans->packages);
pkg_count = alpm_list_count(trans->add);
pkg_current = 1;
/* loop through our package list adding/upgrading one at a time */
for(targ = trans->packages; targ; targ = targ->next) {
for(targ = trans->add; targ; targ = targ->next) {
if(handle->trans->state == STATE_INTERRUPTED) {
return(0);
return(ret);
}
pmpkg_t *newpkg = (pmpkg_t *)targ->data;
commit_single_pkg(newpkg, pkg_current, pkg_count, trans, db);
if(commit_single_pkg(newpkg, pkg_current, pkg_count, trans, db)) {
/* something screwed up on the commit, abort the trans */
trans->state = STATE_INTERRUPTED;
pm_errno = PM_ERR_TRANS_ABORT;
/* running ldconfig at this point could possibly screw system */
skip_ldconfig = 1;
ret = -1;
}
pkg_current++;
}
/* run ldconfig if it exists */
_alpm_ldconfig(handle->root);
if(!skip_ldconfig) {
/* run ldconfig if it exists */
_alpm_ldconfig(handle->root);
}
return(0);
return(ret);
}
/* vim: set ts=2 sw=2 noet: */

View File

@@ -1,7 +1,7 @@
/*
* add.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -24,9 +24,7 @@
#include "alpm_list.h"
#include "trans.h"
int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data);
int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db);
int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db);
#endif /* _ALPM_ADD_H */

View File

@@ -1,7 +1,7 @@
/*
* alpm.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -23,6 +23,11 @@
#include "config.h"
/* connection caching setup */
#ifdef HAVE_LIBFETCH
#include <fetch.h>
#endif
/* libalpm */
#include "alpm.h"
#include "alpm_list.h"
@@ -49,11 +54,21 @@ int SYMEXPORT alpm_initialize(void)
if(handle == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
if(_alpm_db_register_local() == NULL) {
/* error code should be set */
_alpm_handle_free(handle);
handle = NULL;
return(-1);
}
#ifdef ENABLE_NLS
bindtextdomain("libalpm", LOCALEDIR);
#endif
#ifdef HAVE_LIBFETCH
fetchConnectionCacheInit(5, 1);
#endif
return(0);
}
@@ -71,6 +86,11 @@ int SYMEXPORT alpm_release(void)
}
_alpm_handle_free(handle);
handle = NULL;
#ifdef HAVE_LIBFETCH
fetchConnectionCacheClose();
#endif
return(0);
}

View File

@@ -1,7 +1,7 @@
/*
* alpm.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -67,14 +67,14 @@ const char *alpm_version(void);
/* Levels */
typedef enum _pmloglevel_t {
PM_LOG_ERROR = 0x01,
PM_LOG_WARNING = 0x02,
PM_LOG_DEBUG = 0x04,
PM_LOG_FUNCTION = 0x08
PM_LOG_ERROR = 1,
PM_LOG_WARNING = (1 << 1),
PM_LOG_DEBUG = (1 << 2),
PM_LOG_FUNCTION = (1 << 3)
} pmloglevel_t;
typedef void (*alpm_cb_log)(pmloglevel_t, char *, va_list);
int alpm_logaction(char *fmt, ...);
typedef void (*alpm_cb_log)(pmloglevel_t, const char *, va_list);
int alpm_logaction(const char *fmt, ...);
/*
* Downloading
@@ -86,84 +86,94 @@ typedef void (*alpm_cb_totaldl)(off_t total);
/** A callback for downloading files
* @param url the URL of the file to be downloaded
* @param localpath the directory to which the file should be downloaded
* @param mtimeold the modification time of the file previously downloaded
* @param mtimenew the modification time of the newly downloaded file.
* This should be set by the callback.
* @return 0 on success, 1 if the modification times are identical, -1 on
* @param force whether to force an update, even if the file is the same
* @return 0 on success, 1 if the file exists and is identical, -1 on
* error.
*/
typedef int (*alpm_cb_fetch)(const char *url, const char *localpath,
time_t mtimeold, time_t *mtimenew);
int force);
/*
* Options
*/
alpm_cb_log alpm_option_get_logcb();
alpm_cb_log alpm_option_get_logcb(void);
void alpm_option_set_logcb(alpm_cb_log cb);
alpm_cb_download alpm_option_get_dlcb();
alpm_cb_download alpm_option_get_dlcb(void);
void alpm_option_set_dlcb(alpm_cb_download cb);
alpm_cb_fetch alpm_option_get_fetchcb();
alpm_cb_fetch alpm_option_get_fetchcb(void);
void alpm_option_set_fetchcb(alpm_cb_fetch cb);
alpm_cb_totaldl alpm_option_get_totaldlcb();
alpm_cb_totaldl alpm_option_get_totaldlcb(void);
void alpm_option_set_totaldlcb(alpm_cb_totaldl cb);
const char *alpm_option_get_root();
const char *alpm_option_get_root(void);
int alpm_option_set_root(const char *root);
const char *alpm_option_get_dbpath();
const char *alpm_option_get_dbpath(void);
int alpm_option_set_dbpath(const char *dbpath);
alpm_list_t *alpm_option_get_cachedirs();
alpm_list_t *alpm_option_get_cachedirs(void);
int alpm_option_add_cachedir(const char *cachedir);
void alpm_option_set_cachedirs(alpm_list_t *cachedirs);
int alpm_option_remove_cachedir(const char *cachedir);
const char *alpm_option_get_logfile();
const char *alpm_option_get_logfile(void);
int alpm_option_set_logfile(const char *logfile);
const char *alpm_option_get_lockfile();
const char *alpm_option_get_lockfile(void);
/* no set_lockfile, path is determined from dbpath */
unsigned short alpm_option_get_usesyslog();
void alpm_option_set_usesyslog(unsigned short usesyslog);
int alpm_option_get_usesyslog(void);
void alpm_option_set_usesyslog(int usesyslog);
alpm_list_t *alpm_option_get_noupgrades();
alpm_list_t *alpm_option_get_noupgrades(void);
void alpm_option_add_noupgrade(const char *pkg);
void alpm_option_set_noupgrades(alpm_list_t *noupgrade);
int alpm_option_remove_noupgrade(const char *pkg);
alpm_list_t *alpm_option_get_noextracts();
alpm_list_t *alpm_option_get_noextracts(void);
void alpm_option_add_noextract(const char *pkg);
void alpm_option_set_noextracts(alpm_list_t *noextract);
int alpm_option_remove_noextract(const char *pkg);
alpm_list_t *alpm_option_get_ignorepkgs();
alpm_list_t *alpm_option_get_ignorepkgs(void);
void alpm_option_add_ignorepkg(const char *pkg);
void alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs);
int alpm_option_remove_ignorepkg(const char *pkg);
alpm_list_t *alpm_option_get_ignoregrps();
alpm_list_t *alpm_option_get_ignoregrps(void);
void alpm_option_add_ignoregrp(const char *grp);
void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps);
int alpm_option_remove_ignoregrp(const char *grp);
unsigned short alpm_option_get_nopassiveftp();
void alpm_option_set_nopassiveftp(unsigned short nopasv);
void alpm_option_set_usedelta(unsigned short usedelta);
const char *alpm_option_get_arch(void);
void alpm_option_set_arch(const char *arch);
pmdb_t *alpm_option_get_localdb();
alpm_list_t *alpm_option_get_syncdbs();
int alpm_option_get_usedelta(void);
void alpm_option_set_usedelta(int usedelta);
int alpm_option_get_checkspace(void);
void alpm_option_set_checkspace(int checkspace);
pmdb_t *alpm_option_get_localdb(void);
alpm_list_t *alpm_option_get_syncdbs(void);
/*
* Install reasons -- ie, why the package was installed
*/
typedef enum _pmpkgreason_t {
PM_PKG_REASON_EXPLICIT = 0, /* explicitly requested by the user */
PM_PKG_REASON_DEPEND = 1 /* installed as a dependency for another package */
} pmpkgreason_t;
/*
* Databases
*/
/* Preferred interfaces db_register_local and db_register_sync */
pmdb_t *alpm_db_register_local(void);
pmdb_t *alpm_db_register_sync(const char *treename);
int alpm_db_unregister(pmdb_t *db);
int alpm_db_unregister_all(void);
@@ -181,6 +191,7 @@ alpm_list_t *alpm_db_get_pkgcache(pmdb_t *db);
pmgrp_t *alpm_db_readgrp(pmdb_t *db, const char *name);
alpm_list_t *alpm_db_get_grpcache(pmdb_t *db);
alpm_list_t *alpm_db_search(pmdb_t *db, const alpm_list_t* needles);
int alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason);
/*
* Packages
@@ -188,13 +199,7 @@ alpm_list_t *alpm_db_search(pmdb_t *db, const alpm_list_t* needles);
/* Info parameters */
/* reasons -- ie, why the package was installed */
typedef enum _pmpkgreason_t {
PM_PKG_REASON_EXPLICIT = 0, /* explicitly requested by the user */
PM_PKG_REASON_DEPEND = 1 /* installed as a dependency for another package */
} pmpkgreason_t;
int alpm_pkg_load(const char *filename, unsigned short full, pmpkg_t **pkg);
int alpm_pkg_load(const char *filename, int full, pmpkg_t **pkg);
int alpm_pkg_free(pmpkg_t *pkg);
int alpm_pkg_checkmd5sum(pmpkg_t *pkg);
char *alpm_fetch_pkgurl(const char *url);
@@ -224,17 +229,16 @@ alpm_list_t *alpm_pkg_get_deltas(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_removes(pmpkg_t *pkg);
pmdb_t *alpm_pkg_get_db(pmpkg_t *pkg);
void *alpm_pkg_changelog_open(pmpkg_t *pkg);
size_t alpm_pkg_changelog_read(void *ptr, size_t size,
const pmpkg_t *pkg, const void *fp);
/*int alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp);*/
int alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp);
unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg);
unsigned short alpm_pkg_has_force(pmpkg_t *pkg);
int alpm_pkg_has_scriptlet(pmpkg_t *pkg);
off_t alpm_pkg_download_size(pmpkg_t *newpkg);
alpm_list_t *alpm_pkg_unused_deltas(pmpkg_t *pkg);
/*
* Deltas
@@ -251,6 +255,7 @@ off_t alpm_delta_get_size(pmdelta_t *delta);
*/
const char *alpm_grp_get_name(const pmgrp_t *grp);
alpm_list_t *alpm_grp_get_pkgs(const pmgrp_t *grp);
alpm_list_t *alpm_find_grp_pkgs(alpm_list_t *dbs, const char *name);
/*
* Sync
@@ -262,34 +267,27 @@ pmpkg_t *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync);
* Transactions
*/
/* Types */
typedef enum _pmtranstype_t {
PM_TRANS_TYPE_UPGRADE = 1,
PM_TRANS_TYPE_REMOVE,
PM_TRANS_TYPE_REMOVEUPGRADE,
PM_TRANS_TYPE_SYNC
} pmtranstype_t;
/* Flags */
typedef enum _pmtransflag_t {
PM_TRANS_FLAG_NODEPS = 0x01,
PM_TRANS_FLAG_FORCE = 0x02,
PM_TRANS_FLAG_NOSAVE = 0x04,
/* 0x08 flag can go here */
PM_TRANS_FLAG_CASCADE = 0x10,
PM_TRANS_FLAG_RECURSE = 0x20,
PM_TRANS_FLAG_DBONLY = 0x40,
/* 0x80 flag can go here */
PM_TRANS_FLAG_ALLDEPS = 0x100,
PM_TRANS_FLAG_DOWNLOADONLY = 0x200,
PM_TRANS_FLAG_NOSCRIPTLET = 0x400,
PM_TRANS_FLAG_NOCONFLICTS = 0x800,
/* 0x1000 flag can go here */
PM_TRANS_FLAG_NEEDED = 0x2000,
PM_TRANS_FLAG_ALLEXPLICIT = 0x4000,
PM_TRANS_FLAG_UNNEEDED = 0x8000,
PM_TRANS_FLAG_RECURSEALL = 0x10000,
PM_TRANS_FLAG_NOLOCK = 0x20000
PM_TRANS_FLAG_NODEPS = 1,
PM_TRANS_FLAG_FORCE = (1 << 1),
PM_TRANS_FLAG_NOSAVE = (1 << 2),
PM_TRANS_FLAG_NODEPVERSION = (1 << 3),
PM_TRANS_FLAG_CASCADE = (1 << 4),
PM_TRANS_FLAG_RECURSE = (1 << 5),
PM_TRANS_FLAG_DBONLY = (1 << 6),
/* (1 << 7) flag can go here */
PM_TRANS_FLAG_ALLDEPS = (1 << 8),
PM_TRANS_FLAG_DOWNLOADONLY = (1 << 9),
PM_TRANS_FLAG_NOSCRIPTLET = (1 << 10),
PM_TRANS_FLAG_NOCONFLICTS = (1 << 11),
/* (1 << 12) flag can go here */
PM_TRANS_FLAG_NEEDED = (1 << 13),
PM_TRANS_FLAG_ALLEXPLICIT = (1 << 14),
PM_TRANS_FLAG_UNNEEDED = (1 << 15),
PM_TRANS_FLAG_RECURSEALL = (1 << 16),
PM_TRANS_FLAG_NOLOCK = (1 << 17)
} pmtransflag_t;
/**
@@ -371,17 +369,22 @@ typedef enum _pmtransevt_t {
* The repository's tree name is passed to the callback.
*/
PM_TRANS_EVT_RETRIEVE_START,
/** Disk space usage will be computed for a package */
PM_TRANS_EVT_DISKSPACE_START,
/** Disk space usage was computed for a package */
PM_TRANS_EVT_DISKSPACE_DONE,
} pmtransevt_t;
/*@}*/
/* 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,
PM_TRANS_CONV_INSTALL_IGNOREPKG = 1,
PM_TRANS_CONV_REPLACE_PKG = (1 << 1),
PM_TRANS_CONV_CONFLICT_PKG = (1 << 2),
PM_TRANS_CONV_CORRUPTED_PKG = (1 << 3),
PM_TRANS_CONV_LOCAL_NEWER = (1 << 4),
PM_TRANS_CONV_REMOVE_PKGS = (1 << 5),
PM_TRANS_CONV_SELECT_PROVIDER = (1 << 6),
} pmtransconv_t;
/* Transaction Progress */
@@ -389,7 +392,9 @@ typedef enum _pmtransprog_t {
PM_TRANS_PROGRESS_ADD_START,
PM_TRANS_PROGRESS_UPGRADE_START,
PM_TRANS_PROGRESS_REMOVE_START,
PM_TRANS_PROGRESS_CONFLICTS_START
PM_TRANS_PROGRESS_CONFLICTS_START,
PM_TRANS_PROGRESS_DISKSPACE_START,
PM_TRANS_PROGRESS_INTEGRITY_START,
} pmtransprog_t;
/* Transaction Event callback */
@@ -400,21 +405,23 @@ typedef void (*alpm_trans_cb_conv)(pmtransconv_t, void *, void *,
void *, int *);
/* Transaction Progress callback */
typedef void (*alpm_trans_cb_progress)(pmtransprog_t, const char *, int, int, int);
typedef void (*alpm_trans_cb_progress)(pmtransprog_t, const char *, int, size_t, size_t);
pmtranstype_t alpm_trans_get_type();
unsigned int alpm_trans_get_flags();
alpm_list_t * alpm_trans_get_pkgs();
int alpm_trans_init(pmtranstype_t type, pmtransflag_t flags,
int alpm_trans_get_flags(void);
alpm_list_t * alpm_trans_get_add(void);
alpm_list_t * alpm_trans_get_remove(void);
int alpm_trans_init(pmtransflag_t flags,
alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv,
alpm_trans_cb_progress cb_progress);
int alpm_trans_sysupgrade(int enable_downgrade);
int alpm_trans_addtarget(char *target);
int alpm_trans_prepare(alpm_list_t **data);
int alpm_trans_commit(alpm_list_t **data);
int alpm_trans_interrupt(void);
int alpm_trans_release(void);
int alpm_sync_sysupgrade(int enable_downgrade);
int alpm_add_pkg(pmpkg_t *pkg);
int alpm_remove_pkg(pmpkg_t *pkg);
/*
* Dependencies and conflicts
*/
@@ -428,10 +435,10 @@ typedef enum _pmdepmod_t {
PM_DEP_MOD_LT
} pmdepmod_t;
int alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
alpm_list_t *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
alpm_list_t *remove, alpm_list_t *upgrade);
alpm_list_t *alpm_deptest(pmdb_t *db, alpm_list_t *targets);
pmpkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring);
pmpkg_t *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstring);
const char *alpm_miss_get_target(const pmdepmissing_t *miss);
pmdepend_t *alpm_miss_get_dep(pmdepmissing_t *miss);
@@ -441,6 +448,7 @@ alpm_list_t *alpm_checkconflicts(alpm_list_t *pkglist);
const char *alpm_conflict_get_package1(pmconflict_t *conflict);
const char *alpm_conflict_get_package2(pmconflict_t *conflict);
const char *alpm_conflict_get_reason(pmconflict_t *conflict);
pmdepmod_t alpm_dep_get_mod(const pmdepend_t *dep);
const char *alpm_dep_get_name(const pmdepend_t *dep);
@@ -478,6 +486,7 @@ enum _pmerrno_t {
PM_ERR_NOT_A_FILE,
PM_ERR_NOT_A_DIR,
PM_ERR_WRONG_ARGS,
PM_ERR_DISK_SPACE,
/* Interface */
PM_ERR_HANDLE_NULL,
PM_ERR_HANDLE_NOT_NULL,
@@ -488,6 +497,7 @@ enum _pmerrno_t {
PM_ERR_DB_NULL,
PM_ERR_DB_NOT_NULL,
PM_ERR_DB_NOT_FOUND,
PM_ERR_DB_VERSION,
PM_ERR_DB_WRITE,
PM_ERR_DB_REMOVE,
/* Servers */
@@ -509,6 +519,7 @@ enum _pmerrno_t {
PM_ERR_PKG_OPEN,
PM_ERR_PKG_CANT_REMOVE,
PM_ERR_PKG_INVALID_NAME,
PM_ERR_PKG_INVALID_ARCH,
PM_ERR_PKG_REPO_NOT_FOUND,
/* Deltas */
PM_ERR_DLT_INVALID,
@@ -519,6 +530,7 @@ enum _pmerrno_t {
PM_ERR_FILE_CONFLICTS,
/* Misc */
PM_ERR_RETRIEVE,
PM_ERR_WRITE,
PM_ERR_INVALID_REGEX,
/* External library errors */
PM_ERR_LIBARCHIVE,

View File

@@ -1,7 +1,7 @@
/*
* alpm_list.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -269,7 +269,7 @@ alpm_list_t SYMEXPORT *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, a
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn)
alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn)
{
if (n > 1) {
alpm_list_t *left = list;
@@ -285,6 +285,53 @@ alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cm
return(list);
}
/**
* @brief Remove an item from the list.
* item is not freed; this is the respnsiblity of the caller.
*
* @param haystack the list to remove the item from
* @param item the item to remove from the list
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_remove_item(alpm_list_t *haystack,
alpm_list_t *item)
{
if(haystack == NULL || item == NULL) {
return(haystack);
}
if(item == haystack) {
/* Special case: removing the head node which has a back reference to
* the tail node */
haystack = item->next;
if(haystack) {
haystack->prev = item->prev;
}
item->prev = NULL;
} else if(item == haystack->prev) {
/* Special case: removing the tail node, so we need to fix the back
* reference on the head node. We also know tail != head. */
if(item->prev) {
/* i->next should always be null */
item->prev->next = item->next;
haystack->prev = item->prev;
item->prev = NULL;
}
} else {
/* Normal case, non-head and non-tail node */
if(item->next) {
item->next->prev = item->prev;
}
if(item->prev) {
item->prev->next = item->next;
}
}
return(haystack);
}
/**
* @brief Remove an item from the list.
*
@@ -295,9 +342,10 @@ alpm_list_t SYMEXPORT *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cm
*
* @return the resultant list
*/
alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data)
alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack,
const void *needle, alpm_list_fn_cmp fn, void **data)
{
alpm_list_t *i = haystack, *tmp = NULL;
alpm_list_t *i = haystack;
if(data) {
*data = NULL;
@@ -309,46 +357,19 @@ alpm_list_t SYMEXPORT *alpm_list_remove(alpm_list_t *haystack, const void *needl
while(i) {
if(i->data == NULL) {
i = i->next;
continue;
}
tmp = i->next;
if(fn(i->data, needle) == 0) {
/* we found a matching item */
if(i == haystack) {
/* Special case: removing the head node which has a back reference to
* the tail node */
haystack = i->next;
if(haystack) {
haystack->prev = i->prev;
}
i->prev = NULL;
} else if(i == haystack->prev) {
/* Special case: removing the tail node, so we need to fix the back
* reference on the head node. We also know tail != head. */
if(i->prev) {
/* i->next should always be null */
i->prev->next = i->next;
haystack->prev = i->prev;
i->prev = NULL;
}
} else {
/* Normal case, non-head and non-tail node */
if(i->next) {
i->next->prev = i->prev;
}
if(i->prev) {
i->prev->next = i->next;
}
}
haystack = alpm_list_remove_item(haystack, i);
if(data) {
*data = i->data;
}
i->data = NULL;
free(i);
i = NULL;
break;
} else {
i = tmp;
i = i->next;
}
}
@@ -510,7 +531,7 @@ inline alpm_list_t SYMEXPORT *alpm_list_first(const alpm_list_t *list)
*
* @return an alpm_list_t node for index `n`
*/
alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, int n)
alpm_list_t SYMEXPORT *alpm_list_nth(const alpm_list_t *list, size_t n)
{
const alpm_list_t *i = list;
while(n--) {
@@ -573,9 +594,9 @@ void SYMEXPORT *alpm_list_getdata(const alpm_list_t *node)
*
* @return the number of list items
*/
int SYMEXPORT alpm_list_count(const alpm_list_t *list)
size_t SYMEXPORT alpm_list_count(const alpm_list_t *list)
{
unsigned int i = 0;
size_t i = 0;
const alpm_list_t *lp = list;
while(lp) {
++i;
@@ -615,7 +636,7 @@ static int ptr_cmp(const void *p, const void *q)
/**
* @brief Find an item in a list.
*
* Search for the item whos data matches that of the `needle`.
* Search for the item whose data matches that of the `needle`.
*
* @param needle the data to search for (== comparison)
* @param haystack the list
@@ -643,11 +664,65 @@ char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack,
}
/**
* @brief Find the items in list `lhs` that are not present in list `rhs`.
* @brief Find the differences between list `left` and list `right`
*
* Entries are not duplicated. Operation is O(m*n). The first list is stepped
* through one node at a time, and for each node in the first list, each node
* in the second list is compared to it.
* The two lists must be sorted. Items only in list `left` are added to the
* `onlyleft` list. Items only in list `right` are added to the `onlyright`
* list.
*
* @param left the first list
* @param right the second list
* @param fn the comparison function
* @param onlyleft pointer to the first result list
* @param onlyright pointer to the second result list
*
*/
void SYMEXPORT alpm_list_diff_sorted(const alpm_list_t *left,
const alpm_list_t *right, alpm_list_fn_cmp fn,
alpm_list_t **onlyleft, alpm_list_t **onlyright)
{
const alpm_list_t *l = left;
const alpm_list_t *r = right;
if(!onlyleft && !onlyright) {
return;
}
while (l != NULL && r != NULL) {
int cmp = fn(l->data, r->data);
if(cmp < 0) {
if(onlyleft) {
*onlyleft = alpm_list_add(*onlyleft, l->data);
}
l = l->next;
}
else if(cmp > 0) {
if(onlyright) {
*onlyright = alpm_list_add(*onlyright, r->data);
}
r = r->next;
} else {
l = l->next;
r = r->next;
}
}
while (l != NULL) {
if(onlyleft) {
*onlyleft = alpm_list_add(*onlyleft, l->data);
}
l = l->next;
}
while (r != NULL) {
if(onlyright) {
*onlyright = alpm_list_add(*onlyright, r->data);
}
r = r->next;
}
}
/**
* @brief Find the items in list `lhs` that are not present in list `rhs`.
*
* @param lhs the first list
* @param rhs the second list
@@ -658,21 +733,18 @@ char SYMEXPORT *alpm_list_find_str(const alpm_list_t *haystack,
alpm_list_t SYMEXPORT *alpm_list_diff(const alpm_list_t *lhs,
const alpm_list_t *rhs, alpm_list_fn_cmp fn)
{
const alpm_list_t *i, *j;
alpm_list_t *left, *right;
alpm_list_t *ret = NULL;
for(i = lhs; i; i = i->next) {
int found = 0;
for(j = rhs; j; j = j->next) {
if(fn(i->data, j->data) == 0) {
found = 1;
break;
}
}
if(!found) {
ret = alpm_list_add(ret, i->data);
}
}
left = alpm_list_copy(lhs);
left = alpm_list_msort(left, alpm_list_count(left), fn);
right = alpm_list_copy(rhs);
right = alpm_list_msort(right, alpm_list_count(right), fn);
alpm_list_diff_sorted(left, right, fn, &ret, NULL);
alpm_list_free(left);
alpm_list_free(right);
return(ret);
}

View File

@@ -1,7 +1,7 @@
/*
* alpm_list.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -56,7 +56,8 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second);
alpm_list_t *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
alpm_list_t *alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn);
alpm_list_t *alpm_list_msort(alpm_list_t *list, size_t n, alpm_list_fn_cmp fn);
alpm_list_t *alpm_list_remove_item(alpm_list_t *haystack, alpm_list_t *item);
alpm_list_t *alpm_list_remove(alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data);
alpm_list_t *alpm_list_remove_str(alpm_list_t *haystack, const char *needle, char **data);
alpm_list_t *alpm_list_remove_dupes(const alpm_list_t *list);
@@ -67,17 +68,19 @@ alpm_list_t *alpm_list_reverse(alpm_list_t *list);
/* item accessors */
alpm_list_t *alpm_list_first(const alpm_list_t *list);
alpm_list_t *alpm_list_nth(const alpm_list_t *list, int n);
alpm_list_t *alpm_list_nth(const alpm_list_t *list, size_t n);
alpm_list_t *alpm_list_next(const alpm_list_t *list);
alpm_list_t *alpm_list_last(const alpm_list_t *list);
void *alpm_list_getdata(const alpm_list_t *entry);
/* misc */
int alpm_list_count(const alpm_list_t *list);
size_t alpm_list_count(const alpm_list_t *list);
void *alpm_list_find(const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn);
void *alpm_list_find_ptr(const alpm_list_t *haystack, const void *needle);
char *alpm_list_find_str(const alpm_list_t *haystack, const char *needle);
alpm_list_t *alpm_list_diff(const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn);
void alpm_list_diff_sorted(const alpm_list_t *left, const alpm_list_t *right,
alpm_list_fn_cmp fn, alpm_list_t **onlyleft, alpm_list_t **onlyright);
#ifdef __cplusplus
}

View File

@@ -1,7 +1,7 @@
/*
* backup.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2005 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -33,7 +33,7 @@
#include "util.h"
/* split a backup string "file\thash" into two strings : file and hash */
int _alpm_backup_split(const char *string, char **file, char **hash)
static int backup_split(const char *string, char **file, char **hash)
{
char *str = strdup(string);
char *ptr;
@@ -65,14 +65,14 @@ int _alpm_backup_split(const char *string, char **file, char **hash)
char *_alpm_backup_file(const char *string)
{
char *file = NULL;
_alpm_backup_split(string, &file, NULL);
backup_split(string, &file, NULL);
return(file);
}
char *_alpm_backup_hash(const char *string)
{
char *hash = NULL;
_alpm_backup_split(string, NULL, &hash);
backup_split(string, NULL, &hash);
return(hash);
}
@@ -95,7 +95,7 @@ char *_alpm_needbackup(const char *file, const alpm_list_t *backup)
char *hash = NULL;
/* no hash found */
if(!_alpm_backup_split((char *)lp->data, &filename, &hash)) {
if(!backup_split((char *)lp->data, &filename, &hash)) {
FREE(filename);
continue;
}

View File

@@ -1,7 +1,7 @@
/*
* backup.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,921 +0,0 @@
/*
* be_files.c
*
* Copyright (c) 2006 by Christian Hamar <krics@linuxforum.hu>
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdint.h> /* uintmax_t, intmax_t */
#include <sys/stat.h>
#include <dirent.h>
#include <ctype.h>
#include <time.h>
#include <limits.h> /* PATH_MAX */
#include <locale.h> /* setlocale */
/* libalpm */
#include "db.h"
#include "alpm_list.h"
#include "cache.h"
#include "log.h"
#include "util.h"
#include "alpm.h"
#include "handle.h"
#include "package.h"
#include "delta.h"
#include "deps.h"
#include "dload.h"
/*
* Return the last update time as number of seconds from the epoch.
* Returns 0 if the value is unknown or can't be read.
*/
static time_t getlastupdate(const pmdb_t *db)
{
FILE *fp;
char *file;
time_t ret = 0;
ALPM_LOG_FUNC;
if(db == NULL) {
return(ret);
}
/* db->path + '.lastupdate' + NULL */
MALLOC(file, strlen(db->path) + 12, RET_ERR(PM_ERR_MEMORY, ret));
sprintf(file, "%s.lastupdate", db->path);
/* get the last update time, if it's there */
if((fp = fopen(file, "r")) == NULL) {
free(file);
return(ret);
} else {
char line[64];
if(fgets(line, sizeof(line), fp)) {
ret = atol(line);
}
}
fclose(fp);
free(file);
return(ret);
}
/*
* writes the dbpath/.lastupdate file with the value in time
*/
static int setlastupdate(const pmdb_t *db, time_t time)
{
FILE *fp;
char *file;
int ret = 0;
ALPM_LOG_FUNC;
if(db == NULL || time == 0) {
return(-1);
}
/* db->path + '.lastupdate' + NULL */
MALLOC(file, strlen(db->path) + 12, RET_ERR(PM_ERR_MEMORY, ret));
sprintf(file, "%s.lastupdate", db->path);
if((fp = fopen(file, "w")) == NULL) {
free(file);
return(-1);
}
if(fprintf(fp, "%ju", (uintmax_t)time) <= 0) {
ret = -1;
}
fclose(fp);
free(file);
return(ret);
}
static int checkdbdir(pmdb_t *db)
{
struct stat buf;
char *path = db->path;
if(stat(path, &buf) != 0) {
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
path);
if(_alpm_makepath(path) != 0) {
RET_ERR(PM_ERR_SYSTEM, -1);
}
} else if(!S_ISDIR(buf.st_mode)) {
_alpm_log(PM_LOG_WARNING, _("removing invalid database: %s\n"), path);
if(unlink(path) != 0 || _alpm_makepath(path) != 0) {
RET_ERR(PM_ERR_SYSTEM, -1);
}
}
return(0);
}
/** Update a package database
*
* An update of the package database \a db will be attempted. Unless
* \a force is true, the update will only be performed if the remote
* database was modified since the last update.
*
* A transaction is necessary for this operation, in order to obtain a
* database lock. During this transaction the front-end will be informed
* of the download progress of the database via the download callback.
*
* Example:
* @code
* pmdb_t *db;
* int result;
* db = alpm_list_getdata(alpm_option_get_syncdbs());
* if(alpm_trans_init(PM_TRANS_TYPE_SYNC, 0, NULL, NULL, NULL) == 0) {
* result = alpm_db_update(0, db);
* alpm_trans_release();
*
* if(result > 0) {
* printf("Unable to update database: %s\n", alpm_strerrorlast());
* } else if(result < 0) {
* printf("Database already up to date\n");
* } else {
* printf("Database updated\n");
* }
* }
* @endcode
*
* @ingroup alpm_databases
* @note After a successful update, the \link alpm_db_get_pkgcache()
* package cache \endlink will be invalidated
* @param force if true, then forces the update, otherwise update only in case
* the database isn't up to date
* @param db pointer to the package database to update
* @return 0 on success, > 0 on error (pm_errno is set accordingly), < 0 if up
* to date
*/
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
{
char *dbfile, *dbfilepath;
time_t newmtime = 0, lastupdate = 0;
const char *dbpath;
size_t len;
int ret;
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1));
/* Verify we are in a transaction. This is done _mainly_ because we need a DB
* lock - if we update without a db lock, we may kludge some other pacman
* process that _has_ a lock.
*/
ASSERT(handle->trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
ASSERT(handle->trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1));
if(!alpm_list_find_ptr(handle->dbs_sync, db)) {
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
if(!force) {
/* get the lastupdate time */
lastupdate = getlastupdate(db);
if(lastupdate == 0) {
_alpm_log(PM_LOG_DEBUG, "failed to get lastupdate time for %s\n",
db->treename);
}
}
len = strlen(db->treename) + strlen(DBEXT) + 1;
MALLOC(dbfile, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(dbfile, "%s" DBEXT, db->treename);
dbpath = alpm_option_get_dbpath();
ret = _alpm_download_single_file(dbfile, db->servers, dbpath,
lastupdate, &newmtime);
free(dbfile);
if(ret == 1) {
/* mtimes match, do nothing */
pm_errno = 0;
return(1);
} else if(ret == -1) {
/* pm_errno was set by the download code */
_alpm_log(PM_LOG_DEBUG, "failed to sync db: %s\n", alpm_strerrorlast());
return(-1);
} else {
/* remove the old dir */
if(_alpm_rmrf(db->path) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not remove database %s\n"), db->treename);
RET_ERR(PM_ERR_DB_REMOVE, -1);
}
/* Cache needs to be rebuilt */
_alpm_db_free_pkgcache(db);
/* form the path to the db location */
len = strlen(dbpath) + strlen(db->treename) + strlen(DBEXT) + 1;
MALLOC(dbfilepath, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(dbfilepath, "%s%s" DBEXT, dbpath, db->treename);
/* uncompress the sync database */
checkdbdir(db);
ret = _alpm_unpack(dbfilepath, db->path, NULL);
if(ret) {
free(dbfilepath);
RET_ERR(PM_ERR_SYSTEM, -1);
}
unlink(dbfilepath);
free(dbfilepath);
/* if we have a new mtime, set the DB last update value */
if(newmtime) {
_alpm_log(PM_LOG_DEBUG, "sync: new mtime for %s: %ju\n",
db->treename, (uintmax_t)newmtime);
setlastupdate(db, newmtime);
}
}
return(0);
}
static int splitname(const char *target, pmpkg_t *pkg)
{
/* the format of a db entry is as follows:
* package-version-rel/
* package name can contain hyphens, so parse from the back- go back
* two hyphens and we have split the version from the name.
*/
char *tmp, *p, *q;
if(target == NULL || pkg == NULL) {
return(-1);
}
STRDUP(tmp, target, RET_ERR(PM_ERR_MEMORY, -1));
p = tmp + strlen(tmp);
/* do the magic parsing- find the beginning of the version string
* by doing two iterations of same loop to lop off two hyphens */
for(q = --p; *q && *q != '-'; q--);
for(p = --q; *p && *p != '-'; p--);
if(*p != '-' || p == tmp) {
return(-1);
}
/* copy into fields and return */
if(pkg->version) {
FREE(pkg->version);
}
STRDUP(pkg->version, p+1, RET_ERR(PM_ERR_MEMORY, -1));
/* insert a terminator at the end of the name (on hyphen)- then copy it */
*p = '\0';
if(pkg->name) {
FREE(pkg->name);
}
STRDUP(pkg->name, tmp, RET_ERR(PM_ERR_MEMORY, -1));
free(tmp);
return(0);
}
int _alpm_db_populate(pmdb_t *db)
{
int count = 0;
struct dirent *ent = NULL;
struct stat sbuf;
char path[PATH_MAX];
DIR *dbdir;
ALPM_LOG_FUNC;
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
dbdir = opendir(db->path);
if(dbdir == NULL) {
return(0);
}
while((ent = readdir(dbdir)) != NULL) {
const char *name = ent->d_name;
pmpkg_t *pkg;
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
continue;
}
/* stat the entry, make sure it's a directory */
snprintf(path, PATH_MAX, "%s%s", db->path, name);
if(stat(path, &sbuf) != 0 || !S_ISDIR(sbuf.st_mode)) {
continue;
}
pkg = _alpm_pkg_new();
if(pkg == NULL) {
closedir(dbdir);
return(-1);
}
/* split the db entry name */
if(splitname(name, pkg) != 0) {
_alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'\n"),
name);
_alpm_pkg_free(pkg);
continue;
}
/* explicitly read with only 'BASE' data, accessors will handle the rest */
if(_alpm_db_read(db, pkg, INFRQ_BASE) == -1) {
_alpm_log(PM_LOG_ERROR, _("corrupted database entry '%s'\n"), name);
_alpm_pkg_free(pkg);
continue;
}
pkg->origin = PKG_FROM_CACHE;
pkg->origin_data.db = db;
/* add to the collection */
_alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
pkg->name, db->treename);
db->pkgcache = alpm_list_add(db->pkgcache, pkg);
count++;
}
closedir(dbdir);
db->pkgcache = alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp);
return(count);
}
/* Note: the return value must be freed by the caller */
static char *get_pkgpath(pmdb_t *db, pmpkg_t *info)
{
size_t len;
char *pkgpath;
len = strlen(db->path) + strlen(info->name) + strlen(info->version) + 3;
MALLOC(pkgpath, len, RET_ERR(PM_ERR_MEMORY, NULL));
sprintf(pkgpath, "%s%s-%s/", db->path, info->name, info->version);
return(pkgpath);
}
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
char path[PATH_MAX];
char line[513];
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL) {
RET_ERR(PM_ERR_DB_NULL, -1);
}
if(info == NULL || info->name == NULL || info->version == NULL) {
_alpm_log(PM_LOG_DEBUG, "invalid package entry provided to _alpm_db_read, skipping\n");
return(-1);
}
if(info->origin == PKG_FROM_FILE) {
_alpm_log(PM_LOG_DEBUG, "request to read database info for a file-based package '%s', skipping...\n", info->name);
return(-1);
}
/* bitmask logic here:
* infolevel: 00001111
* inforeq: 00010100
* & result: 00000100
* == to inforeq? nope, we need to load more info. */
if((info->infolevel & inforeq) == inforeq) {
/* already loaded this info, do nothing */
return(0);
}
_alpm_log(PM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
info->name, inforeq);
/* clear out 'line', to be certain - and to make valgrind happy */
memset(line, 0, 513);
pkgpath = get_pkgpath(db, info);
if(access(pkgpath, F_OK)) {
/* directory doesn't exist or can't be opened */
_alpm_log(PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n",
info->name, info->version, db->treename);
goto error;
}
/* DESC */
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
if(fgets(line, 256, fp) == NULL) {
break;
}
_alpm_strtrim(line);
if(strcmp(line, "%NAME%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
if(strcmp(_alpm_strtrim(line), info->name) != 0) {
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name "
"mismatch on package %s\n"), db->treename, info->name);
}
} else if(strcmp(line, "%VERSION%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
if(strcmp(_alpm_strtrim(line), info->version) != 0) {
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version "
"mismatch on package %s\n"), db->treename, info->name);
}
} else if(strcmp(line, "%FILENAME%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->filename, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%DESC%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->desc, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%GROUPS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->groups = alpm_list_add(info->groups, linedup);
}
} else if(strcmp(line, "%URL%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->url, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%LICENSE%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->licenses = alpm_list_add(info->licenses, linedup);
}
} else if(strcmp(line, "%ARCH%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->arch, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%BUILDDATE%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
_alpm_strtrim(line);
char first = tolower(line[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
setlocale(LC_TIME, "C");
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
info->builddate = mktime(&tmp_tm);
setlocale(LC_TIME, "");
} else {
info->builddate = atol(line);
}
} else if(strcmp(line, "%INSTALLDATE%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
_alpm_strtrim(line);
char first = tolower(line[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
setlocale(LC_TIME, "C");
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
info->installdate = mktime(&tmp_tm);
setlocale(LC_TIME, "");
} else {
info->installdate = atol(line);
}
} else if(strcmp(line, "%PACKAGER%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->packager, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%REASON%") == 0) {
if(fgets(line, 512, fp) == NULL) {
goto error;
}
info->reason = (pmpkgreason_t)atol(_alpm_strtrim(line));
} else if(strcmp(line, "%SIZE%") == 0 || strcmp(line, "%CSIZE%") == 0) {
/* NOTE: the CSIZE and SIZE fields both share the "size" field
* in the pkginfo_t struct. This can be done b/c CSIZE
* is currently only used in sync databases, and SIZE is
* only used in local databases.
*/
if(fgets(line, 512, fp) == NULL) {
goto error;
}
info->size = atol(_alpm_strtrim(line));
/* also store this value to isize if isize is unset */
if(info->isize == 0) {
info->isize = info->size;
}
} else if(strcmp(line, "%ISIZE%") == 0) {
/* ISIZE (installed size) tag only appears in sync repositories,
* not the local one. */
if(fgets(line, 512, fp) == NULL) {
goto error;
}
info->isize = atol(_alpm_strtrim(line));
} else if(strcmp(line, "%MD5SUM%") == 0) {
/* MD5SUM tag only appears in sync repositories,
* not the local one. */
if(fgets(line, 512, fp) == NULL) {
goto error;
}
STRDUP(info->md5sum, _alpm_strtrim(line), goto error);
} else if(strcmp(line, "%REPLACES%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->replaces = alpm_list_add(info->replaces, linedup);
}
} else if(strcmp(line, "%FORCE%") == 0) {
info->force = 1;
}
}
fclose(fp);
fp = NULL;
}
/* FILES */
if(inforeq & INFRQ_FILES) {
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(fgets(line, 256, fp)) {
_alpm_strtrim(line);
if(strcmp(line, "%FILES%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->files = alpm_list_add(info->files, linedup);
}
} else if(strcmp(line, "%BACKUP%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->backup = alpm_list_add(info->backup, linedup);
}
}
}
fclose(fp);
fp = NULL;
}
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
snprintf(path, PATH_MAX, "%sdepends", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
fgets(line, 255, fp);
_alpm_strtrim(line);
if(strcmp(line, "%DEPENDS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
pmdepend_t *dep = _alpm_splitdep(_alpm_strtrim(line));
info->depends = alpm_list_add(info->depends, dep);
}
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->optdepends = alpm_list_add(info->optdepends, linedup);
}
} else if(strcmp(line, "%CONFLICTS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->conflicts = alpm_list_add(info->conflicts, linedup);
}
} else if(strcmp(line, "%PROVIDES%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
char *linedup;
STRDUP(linedup, _alpm_strtrim(line), goto error);
info->provides = alpm_list_add(info->provides, linedup);
}
}
}
fclose(fp);
fp = NULL;
}
/* DELTAS */
if(inforeq & INFRQ_DELTAS) {
snprintf(path, PATH_MAX, "%sdeltas", pkgpath);
if((fp = fopen(path, "r"))) {
while(!feof(fp)) {
fgets(line, 255, fp);
_alpm_strtrim(line);
if(strcmp(line, "%DELTAS%") == 0) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
pmdelta_t *delta = _alpm_delta_parse(line);
if(delta) {
info->deltas = alpm_list_add(info->deltas, delta);
}
}
}
}
fclose(fp);
fp = NULL;
}
}
/* INSTALL */
if(inforeq & INFRQ_SCRIPTLET) {
snprintf(path, PATH_MAX, "%sinstall", pkgpath);
if(access(path, F_OK) == 0) {
info->scriptlet = 1;
}
}
/* internal */
info->infolevel |= inforeq;
free(pkgpath);
return(0);
error:
free(pkgpath);
if(fp) {
fclose(fp);
}
return(-1);
}
int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info)
{
mode_t oldmask;
int retval = 0;
char *pkgpath = NULL;
if(checkdbdir(db) != 0) {
return(-1);
}
oldmask = umask(0000);
pkgpath = get_pkgpath(db, info);
if((retval = mkdir(pkgpath, 0755)) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not create directory %s: %s\n"),
pkgpath, strerror(errno));
}
free(pkgpath);
umask(oldmask);
return(retval);
}
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
char path[PATH_MAX];
mode_t oldmask;
alpm_list_t *lp = NULL;
int retval = 0;
int local = 0;
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL || info == NULL) {
return(-1);
}
pkgpath = get_pkgpath(db, info);
/* make sure we have a sane umask */
oldmask = umask(0022);
if(strcmp(db->treename, "local") == 0) {
local = 1;
}
/* DESC */
if(inforeq & INFRQ_DESC) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
fprintf(fp, "%%NAME%%\n%s\n\n"
"%%VERSION%%\n%s\n\n", info->name, info->version);
if(info->desc) {
fprintf(fp, "%%DESC%%\n"
"%s\n\n", info->desc);
}
if(info->groups) {
fputs("%GROUPS%\n", fp);
for(lp = info->groups; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->replaces) {
fputs("%REPLACES%\n", fp);
for(lp = info->replaces; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->force) {
fprintf(fp, "%%FORCE%%\n\n");
}
if(local) {
if(info->url) {
fprintf(fp, "%%URL%%\n"
"%s\n\n", info->url);
}
if(info->licenses) {
fputs("%LICENSE%\n", fp);
for(lp = info->licenses; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->arch) {
fprintf(fp, "%%ARCH%%\n"
"%s\n\n", info->arch);
}
if(info->builddate) {
fprintf(fp, "%%BUILDDATE%%\n"
"%ju\n\n", (uintmax_t)info->builddate);
}
if(info->installdate) {
fprintf(fp, "%%INSTALLDATE%%\n"
"%ju\n\n", (uintmax_t)info->installdate);
}
if(info->packager) {
fprintf(fp, "%%PACKAGER%%\n"
"%s\n\n", info->packager);
}
if(info->isize) {
/* only write installed size, csize is irrelevant once installed */
fprintf(fp, "%%SIZE%%\n"
"%jd\n\n", (intmax_t)info->isize);
}
if(info->reason) {
fprintf(fp, "%%REASON%%\n"
"%u\n\n", info->reason);
}
} else {
if(info->size) {
fprintf(fp, "%%CSIZE%%\n"
"%jd\n\n", (intmax_t)info->size);
}
if(info->isize) {
fprintf(fp, "%%ISIZE%%\n"
"%jd\n\n", (intmax_t)info->isize);
}
if(info->md5sum) {
fprintf(fp, "%%MD5SUM%%\n"
"%s\n\n", info->md5sum);
}
}
fclose(fp);
fp = NULL;
}
/* FILES */
if(local && (inforeq & INFRQ_FILES)) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
if(info->files) {
fprintf(fp, "%%FILES%%\n");
for(lp = info->files; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->backup) {
fprintf(fp, "%%BACKUP%%\n");
for(lp = info->backup; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
fclose(fp);
fp = NULL;
}
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DEPENDS information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sdepends", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
if(info->depends) {
fputs("%DEPENDS%\n", fp);
for(lp = info->depends; lp; lp = lp->next) {
char *depstring = alpm_dep_compute_string(lp->data);
fprintf(fp, "%s\n", depstring);
free(depstring);
}
fprintf(fp, "\n");
}
if(info->optdepends) {
fputs("%OPTDEPENDS%\n", fp);
for(lp = info->optdepends; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->conflicts) {
fputs("%CONFLICTS%\n", fp);
for(lp = info->conflicts; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
if(info->provides) {
fputs("%PROVIDES%\n", fp);
for(lp = info->provides; lp; lp = lp->next) {
fprintf(fp, "%s\n", (char *)lp->data);
}
fprintf(fp, "\n");
}
fclose(fp);
fp = NULL;
}
/* INSTALL */
/* nothing needed here (script is automatically extracted) */
cleanup:
umask(oldmask);
free(pkgpath);
if(fp) {
fclose(fp);
}
return(retval);
}
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info)
{
int ret = 0;
char *pkgpath = NULL;
ALPM_LOG_FUNC;
if(db == NULL || info == NULL) {
RET_ERR(PM_ERR_DB_NULL, -1);
}
pkgpath = get_pkgpath(db, info);
ret = _alpm_rmrf(pkgpath);
free(pkgpath);
if(ret != 0) {
ret = -1;
}
return(ret);
}
/* vim: set ts=2 sw=2 noet: */

1007
lib/libalpm/be_local.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
/*
* be_package.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -24,8 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <locale.h> /* setlocale */
#include <errno.h>
/* libarchive */
#include <archive.h>
@@ -38,6 +37,109 @@
#include "package.h"
#include "deps.h" /* _alpm_splitdep */
/**
* Open a package changelog for reading. Similar to fopen in functionality,
* except that the returned 'file stream' is from an archive.
* @param pkg the package (file) to read the changelog
* @return a 'file stream' to the package changelog
*/
static void *_package_changelog_open(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
ASSERT(pkg != NULL, return(NULL));
struct archive *archive = NULL;
struct archive_entry *entry;
const char *pkgfile = pkg->origin_data.file;
if((archive = archive_read_new()) == NULL) {
RET_ERR(PM_ERR_LIBARCHIVE, NULL);
}
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);
if (archive_read_open_filename(archive, pkgfile,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
RET_ERR(PM_ERR_PKG_OPEN, NULL);
}
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
const char *entry_name = archive_entry_pathname(entry);
if(strcmp(entry_name, ".CHANGELOG") == 0) {
return(archive);
}
}
/* we didn't find a changelog */
archive_read_finish(archive);
errno = ENOENT;
return(NULL);
}
/**
* Read data from an open changelog 'file stream'. Similar to fread in
* functionality, this function takes a buffer and amount of data to read.
* @param ptr a buffer to fill with raw changelog data
* @param size the size of the buffer
* @param pkg the package that the changelog is being read from
* @param fp a 'file stream' to the package changelog
* @return the number of characters read, or 0 if there is no more data
*/
static size_t _package_changelog_read(void *ptr, size_t size,
const pmpkg_t *pkg, const void *fp)
{
ssize_t sret = archive_read_data((struct archive*)fp, ptr, size);
/* Report error (negative values) */
if(sret < 0) {
pm_errno = PM_ERR_LIBARCHIVE;
return(0);
} else {
return((size_t)sret);
}
}
/*
static int _package_changelog_feof(const pmpkg_t *pkg, void *fp)
{
// note: this doesn't quite work, no feof in libarchive
return( archive_read_data((struct archive*)fp, NULL, 0) );
}
*/
/**
* Close a package changelog for reading. Similar to fclose in functionality,
* except that the 'file stream' is from an archive.
* @param pkg the package (file) that the changelog was read from
* @param fp a 'file stream' to the package changelog
* @return whether closing the package changelog stream was successful
*/
static int _package_changelog_close(const pmpkg_t *pkg, void *fp)
{
return( archive_read_finish((struct archive *)fp) );
}
/** Package file operations struct accessor. We implement this as a method
* rather than a static struct as in be_files because we want to reuse the
* majority of the default_pkg_ops struct and add only a few operations of
* our own on top.
*/
static struct pkg_operations *get_file_pkg_ops(void)
{
static struct pkg_operations file_pkg_ops;
static int file_pkg_ops_initialized = 0;
if(!file_pkg_ops_initialized) {
file_pkg_ops = default_pkg_ops;
file_pkg_ops.changelog_open = _package_changelog_open;
file_pkg_ops.changelog_read = _package_changelog_read;
file_pkg_ops.changelog_close = _package_changelog_close;
file_pkg_ops_initialized = 1;
}
return(&file_pkg_ops);
}
/**
* Parses the package description file for a package into a pmpkg_t struct.
* @param archive the archive to read from, pointed at the .PKGINFO entry
@@ -47,17 +149,22 @@
*/
static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
{
char line[PATH_MAX];
char *ptr = NULL;
char *key = NULL;
int linenum = 0;
struct archive_read_buffer buf;
ALPM_LOG_FUNC;
/* loop until we reach EOF (where archive_fgets will return NULL) */
while(_alpm_archive_fgets(line, PATH_MAX, a) != NULL) {
memset(&buf, 0, sizeof(buf));
/* 512K for a line length seems reasonable */
buf.max_line_size = 512 * 1024;
/* loop until we reach EOF or other error */
while(_alpm_archive_fgets(a, &buf) == ARCHIVE_OK) {
char *line = _alpm_strtrim(buf.line);
linenum++;
_alpm_strtrim(line);
if(strlen(line) == 0 || line[0] == '#') {
continue;
}
@@ -68,55 +175,52 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
newpkg->name ? newpkg->name : "error", linenum);
} else {
key = _alpm_strtrim(key);
while(*ptr == ' ') ptr++;
ptr = _alpm_strtrim(ptr);
if(!strcmp(key, "pkgname")) {
if(strcmp(key, "pkgname") == 0) {
STRDUP(newpkg->name, ptr, RET_ERR(PM_ERR_MEMORY, -1));
} else if(!strcmp(key, "pkgver")) {
newpkg->name_hash = _alpm_hash_sdbm(newpkg->name);
} else if(strcmp(key, "pkgbase") == 0) {
/* not used atm */
} else if(strcmp(key, "pkgver") == 0) {
STRDUP(newpkg->version, ptr, RET_ERR(PM_ERR_MEMORY, -1));
} else if(!strcmp(key, "pkgdesc")) {
} else if(strcmp(key, "pkgdesc") == 0) {
STRDUP(newpkg->desc, ptr, RET_ERR(PM_ERR_MEMORY, -1));
} else if(!strcmp(key, "group")) {
} else if(strcmp(key, "group") == 0) {
newpkg->groups = alpm_list_add(newpkg->groups, strdup(ptr));
} else if(!strcmp(key, "url")) {
} else if(strcmp(key, "url") == 0) {
STRDUP(newpkg->url, ptr, RET_ERR(PM_ERR_MEMORY, -1));
} else if(!strcmp(key, "license")) {
} else if(strcmp(key, "license") == 0) {
newpkg->licenses = alpm_list_add(newpkg->licenses, strdup(ptr));
} else if(!strcmp(key, "builddate")) {
char first = tolower(ptr[0]);
if(first > 'a' && first < 'z') {
struct tm tmp_tm = {0}; /* initialize to null in case of failure */
setlocale(LC_TIME, "C");
strptime(ptr, "%a %b %e %H:%M:%S %Y", &tmp_tm);
newpkg->builddate = mktime(&tmp_tm);
setlocale(LC_TIME, "");
} else {
newpkg->builddate = atol(ptr);
}
} else if(!strcmp(key, "packager")) {
} else if(strcmp(key, "builddate") == 0) {
newpkg->builddate = _alpm_parsedate(ptr);
} else if(strcmp(key, "packager") == 0) {
STRDUP(newpkg->packager, ptr, RET_ERR(PM_ERR_MEMORY, -1));
} else if(!strcmp(key, "arch")) {
} else if(strcmp(key, "arch") == 0) {
STRDUP(newpkg->arch, ptr, RET_ERR(PM_ERR_MEMORY, -1));
} else if(!strcmp(key, "size")) {
} else if(strcmp(key, "size") == 0) {
/* size in the raw package is uncompressed (installed) size */
newpkg->isize = atol(ptr);
} else if(!strcmp(key, "depend")) {
} else if(strcmp(key, "depend") == 0) {
pmdepend_t *dep = _alpm_splitdep(ptr);
newpkg->depends = alpm_list_add(newpkg->depends, dep);
} else if(!strcmp(key, "optdepend")) {
} else if(strcmp(key, "optdepend") == 0) {
newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr));
} else if(!strcmp(key, "conflict")) {
} else if(strcmp(key, "conflict") == 0) {
newpkg->conflicts = alpm_list_add(newpkg->conflicts, strdup(ptr));
} else if(!strcmp(key, "replaces")) {
} else if(strcmp(key, "replaces") == 0) {
newpkg->replaces = alpm_list_add(newpkg->replaces, strdup(ptr));
} else if(!strcmp(key, "provides")) {
} else if(strcmp(key, "provides") == 0) {
newpkg->provides = alpm_list_add(newpkg->provides, strdup(ptr));
} else if(!strcmp(key, "backup")) {
} else if(strcmp(key, "backup") == 0) {
newpkg->backup = alpm_list_add(newpkg->backup, strdup(ptr));
} else if(!strcmp(key, "makepkgopt")) {
} else if(strcmp(key, "force") == 0) {
/* deprecated, skip it */
} else if(strcmp(key, "makepkgopt") == 0) {
/* not used atm */
} else {
_alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d\n",
newpkg->name ? newpkg->name : "error", linenum);
_alpm_log(PM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
newpkg->name ? newpkg->name : "error", key, linenum);
}
}
line[0] = '\0';
@@ -132,7 +236,7 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
* through the full archive
* @return An information filled pmpkg_t struct
*/
static pmpkg_t *pkg_load(const char *pkgfile, unsigned short full)
static pmpkg_t *pkg_load(const char *pkgfile, int full)
{
int ret = ARCHIVE_OK;
int config = 0;
@@ -172,6 +276,8 @@ static pmpkg_t *pkg_load(const char *pkgfile, unsigned short full)
newpkg->filename = strdup(pkgfile);
newpkg->size = st.st_size;
_alpm_log(PM_LOG_DEBUG, "starting package load for %s\n", pkgfile);
/* If full is false, only read through the archive until we find our needed
* metadata. If it is true, read through the entire archive, which serves
* as a verfication of integrity and allows us to create the filelist. */
@@ -200,7 +306,7 @@ static pmpkg_t *pkg_load(const char *pkgfile, unsigned short full)
} else if(*entry_name == '.') {
/* for now, ignore all files starting with '.' that haven't
* already been handled (for future possibilities) */
} else {
} else if(full) {
/* Keep track of all files for filelist generation */
newpkg->files = alpm_list_add(newpkg->files, strdup(entry_name));
}
@@ -230,11 +336,13 @@ static pmpkg_t *pkg_load(const char *pkgfile, unsigned short full)
goto pkg_invalid;
}
archive_read_finish(archive);
archive_read_finish(archive);
/* internal fields for package struct */
newpkg->origin = PKG_FROM_FILE;
/* TODO eventually kill/move this? */
newpkg->origin_data.file = strdup(pkgfile);
newpkg->ops = get_file_pkg_ops();
if(full) {
/* "checking for conflicts" requires a sorted list, ensure that here */
@@ -245,7 +353,7 @@ static pmpkg_t *pkg_load(const char *pkgfile, unsigned short full)
} else {
/* get rid of any partial filelist we may have collected, it is invalid */
FREELIST(newpkg->files);
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC | INFRQ_DEPENDS;
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC;
}
return(newpkg);
@@ -269,8 +377,7 @@ error:
* @param pkg address of the package pointer
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int SYMEXPORT alpm_pkg_load(const char *filename, unsigned short full,
pmpkg_t **pkg)
int SYMEXPORT alpm_pkg_load(const char *filename, int full, pmpkg_t **pkg)
{
ALPM_LOG_FUNC;

487
lib/libalpm/be_sync.c Normal file
View File

@@ -0,0 +1,487 @@
/*
* be_sync.c
*
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <errno.h>
#include <limits.h>
/* libarchive */
#include <archive.h>
#include <archive_entry.h>
/* libalpm */
#include "util.h"
#include "log.h"
#include "alpm.h"
#include "alpm_list.h"
#include "package.h"
#include "handle.h"
#include "delta.h"
#include "deps.h"
#include "dload.h"
/** Update a package database
*
* An update of the package database \a db will be attempted. Unless
* \a force is true, the update will only be performed if the remote
* database was modified since the last update.
*
* A transaction is necessary for this operation, in order to obtain a
* database lock. During this transaction the front-end will be informed
* of the download progress of the database via the download callback.
*
* Example:
* @code
* alpm_list_t *syncs = alpm_option_get_syncdbs();
* if(alpm_trans_init(0, NULL, NULL, NULL) == 0) {
* for(i = syncs; i; i = alpm_list_next(i)) {
* pmdb_t *db = alpm_list_getdata(i);
* result = alpm_db_update(0, db);
* alpm_trans_release();
*
* if(result < 0) {
* printf("Unable to update database: %s\n", alpm_strerrorlast());
* } else if(result == 1) {
* printf("Database already up to date\n");
* } else {
* printf("Database updated\n");
* }
* }
* }
* @endcode
*
* @ingroup alpm_databases
* @note After a successful update, the \link alpm_db_get_pkgcache()
* package cache \endlink will be invalidated
* @param force if true, then forces the update, otherwise update only in case
* the database isn't up to date
* @param db pointer to the package database to update
* @return 0 on success, -1 on error (pm_errno is set accordingly), 1 if up to
* to date
*/
int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
{
char *dbfile, *syncpath;
const char *dbpath;
struct stat buf;
size_t len;
int ret;
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1));
if(!alpm_list_find_ptr(handle->dbs_sync, db)) {
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
len = strlen(db->treename) + 4;
MALLOC(dbfile, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(dbfile, "%s.db", db->treename);
dbpath = alpm_option_get_dbpath();
len = strlen(dbpath) + 6;
MALLOC(syncpath, len, RET_ERR(PM_ERR_MEMORY, -1));
sprintf(syncpath, "%s%s", dbpath, "sync/");
if(stat(syncpath, &buf) != 0) {
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
syncpath);
if(_alpm_makepath(syncpath) != 0) {
free(dbfile);
free(syncpath);
RET_ERR(PM_ERR_SYSTEM, -1);
}
} else if(!S_ISDIR(buf.st_mode)) {
_alpm_log(PM_LOG_WARNING, _("removing invalid file: %s\n"), syncpath);
if(unlink(syncpath) != 0 || _alpm_makepath(syncpath) != 0) {
free(dbfile);
free(syncpath);
RET_ERR(PM_ERR_SYSTEM, -1);
}
}
ret = _alpm_download_single_file(dbfile, db->servers, syncpath, force);
free(dbfile);
free(syncpath);
if(ret == 1) {
/* files match, do nothing */
pm_errno = 0;
return(1);
} else if(ret == -1) {
/* pm_errno was set by the download code */
_alpm_log(PM_LOG_DEBUG, "failed to sync db: %s\n", alpm_strerrorlast());
return(-1);
}
/* Cache needs to be rebuilt */
_alpm_db_free_pkgcache(db);
return(0);
}
/* Forward decl so I don't reorganize the whole file right now */
static int sync_db_read(pmdb_t *db, struct archive *archive,
struct archive_entry *entry, pmpkg_t *likely_pkg);
/*
* This is the data table used to generate the estimating function below.
* "Weighted Avg" means averaging the bottom table values; thus each repo, big
* or small, will have equal influence. "Unweighted Avg" means averaging the
* sums of the top table columns, thus each package has equal influence. The
* final values are calculated by (surprise) averaging the averages, because
* why the hell not.
*
* Database Pkgs tar bz2 gz xz
* community 2096 5294080 256391 421227 301296
* core 180 460800 25257 36850 29356
* extra 2606 6635520 294647 470818 339392
* multilib 126 327680 16120 23261 18732
* testing 76 204800 10902 14348 12100
*
* Bytes Per Package
* community 2096 2525.80 122.32 200.97 143.75
* core 180 2560.00 140.32 204.72 163.09
* extra 2606 2546.25 113.06 180.67 130.23
* multilib 126 2600.63 127.94 184.61 148.67
* testing 76 2694.74 143.45 188.79 159.21
* Weighted Avg 2585.48 129.42 191.95 148.99
* Unweighted Avg 2543.39 118.74 190.16 137.93
* Average of Avgs 2564.44 124.08 191.06 143.46
*/
static size_t estimate_package_count(struct stat *st, struct archive *archive)
{
unsigned int per_package;
switch(archive_compression(archive)) {
case ARCHIVE_COMPRESSION_NONE:
per_package = 2564;
break;
case ARCHIVE_COMPRESSION_GZIP:
per_package = 191;
break;
case ARCHIVE_COMPRESSION_BZIP2:
per_package = 124;
break;
case ARCHIVE_COMPRESSION_COMPRESS:
per_package = 193;
break;
case ARCHIVE_COMPRESSION_LZMA:
case ARCHIVE_COMPRESSION_XZ:
per_package = 143;
break;
case ARCHIVE_COMPRESSION_UU:
per_package = 3543;
break;
default:
/* assume it is at least somewhat compressed */
per_package = 200;
}
return((size_t)(st->st_size / per_package) + 1);
}
static int sync_db_populate(pmdb_t *db)
{
size_t est_count;
int count = 0;
struct stat buf;
struct archive *archive;
struct archive_entry *entry;
pmpkg_t *pkg = NULL;
ALPM_LOG_FUNC;
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
if((archive = archive_read_new()) == NULL)
RET_ERR(PM_ERR_LIBARCHIVE, 1);
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);
if(archive_read_open_filename(archive, _alpm_db_path(db),
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), _alpm_db_path(db),
archive_error_string(archive));
archive_read_finish(archive);
RET_ERR(PM_ERR_DB_OPEN, 1);
}
if(stat(_alpm_db_path(db), &buf) != 0) {
RET_ERR(PM_ERR_DB_OPEN, 1);
}
est_count = estimate_package_count(&buf, archive);
/* initialize hash at 66% full */
db->pkgcache = _alpm_pkghash_create(est_count * 3 / 2);
if(db->pkgcache == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
const struct stat *st;
st = archive_entry_stat(entry);
if(S_ISDIR(st->st_mode)) {
const char *name;
pkg = _alpm_pkg_new();
if(pkg == NULL) {
archive_read_finish(archive);
RET_ERR(PM_ERR_MEMORY, -1);
}
name = archive_entry_pathname(entry);
if(_alpm_splitname(name, pkg) != 0) {
_alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'\n"),
name);
_alpm_pkg_free(pkg);
continue;
}
/* duplicated database entries are not allowed */
if(_alpm_pkghash_find(db->pkgcache, pkg->name)) {
_alpm_log(PM_LOG_ERROR, _("duplicated database entry '%s'\n"), pkg->name);
_alpm_pkg_free(pkg);
continue;
}
pkg->origin = PKG_FROM_SYNCDB;
pkg->ops = &default_pkg_ops;
pkg->origin_data.db = db;
/* add to the collection */
_alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
pkg->name, db->treename);
db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
count++;
} else {
/* we have desc, depends or deltas - parse it */
sync_db_read(db, archive, entry, pkg);
}
}
if(count > 0) {
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
}
archive_read_finish(archive);
return(count);
}
#define READ_NEXT(s) do { \
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
s = _alpm_strtrim(buf.line); \
} while(0)
#define READ_AND_STORE(f) do { \
READ_NEXT(line); \
STRDUP(f, line, goto error); \
} while(0)
#define READ_AND_STORE_ALL(f) do { \
char *linedup; \
READ_NEXT(line); \
if(strlen(line) == 0) break; \
STRDUP(linedup, line, goto error); \
f = alpm_list_add(f, linedup); \
} while(1) /* note the while(1) and not (0) */
static int sync_db_read(pmdb_t *db, struct archive *archive,
struct archive_entry *entry, pmpkg_t *likely_pkg)
{
const char *entryname = NULL, *filename;
char *pkgname, *p, *q;
pmpkg_t *pkg;
struct archive_read_buffer buf;
ALPM_LOG_FUNC;
if(db == NULL) {
RET_ERR(PM_ERR_DB_NULL, -1);
}
if(entry != NULL) {
entryname = archive_entry_pathname(entry);
}
if(entryname == NULL) {
_alpm_log(PM_LOG_DEBUG, "invalid archive entry provided to _alpm_sync_db_read, skipping\n");
return(-1);
}
_alpm_log(PM_LOG_FUNCTION, "loading package data from archive entry %s\n",
entryname);
memset(&buf, 0, sizeof(buf));
/* 512K for a line length seems reasonable */
buf.max_line_size = 512 * 1024;
/* get package and db file names */
STRDUP(pkgname, entryname, RET_ERR(PM_ERR_MEMORY, -1));
p = pkgname + strlen(pkgname);
for(q = --p; *q && *q != '/'; q--);
filename = q + 1;
for(p = --q; *p && *p != '-'; p--);
for(q = --p; *q && *q != '-'; q--);
*q = '\0';
/* package is already in db due to parsing of directory name */
if(likely_pkg && strcmp(likely_pkg->name, pkgname) == 0) {
pkg = likely_pkg;
} else {
if(db->pkgcache == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
pkg = _alpm_pkghash_find(db->pkgcache, pkgname);
}
if(pkg == NULL) {
_alpm_log(PM_LOG_DEBUG, "package %s not found in %s sync database",
pkgname, db->treename);
return(-1);
}
if(strcmp(filename, "desc") == 0 || strcmp(filename, "depends") == 0
|| strcmp(filename, "deltas") == 0) {
while(_alpm_archive_fgets(archive, &buf) == ARCHIVE_OK) {
char *line = _alpm_strtrim(buf.line);
if(strcmp(line, "%NAME%") == 0) {
READ_NEXT(line);
if(strcmp(line, pkg->name) != 0) {
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: name "
"mismatch on package %s\n"), db->treename, pkg->name);
}
} else if(strcmp(line, "%VERSION%") == 0) {
READ_NEXT(line);
if(strcmp(line, pkg->version) != 0) {
_alpm_log(PM_LOG_ERROR, _("%s database is inconsistent: version "
"mismatch on package %s\n"), db->treename, pkg->name);
}
} else if(strcmp(line, "%FILENAME%") == 0) {
READ_AND_STORE(pkg->filename);
} else if(strcmp(line, "%DESC%") == 0) {
READ_AND_STORE(pkg->desc);
} else if(strcmp(line, "%GROUPS%") == 0) {
READ_AND_STORE_ALL(pkg->groups);
} else if(strcmp(line, "%URL%") == 0) {
READ_AND_STORE(pkg->url);
} else if(strcmp(line, "%LICENSE%") == 0) {
READ_AND_STORE_ALL(pkg->licenses);
} else if(strcmp(line, "%ARCH%") == 0) {
READ_AND_STORE(pkg->arch);
} else if(strcmp(line, "%BUILDDATE%") == 0) {
READ_NEXT(line);
pkg->builddate = _alpm_parsedate(line);
} else if(strcmp(line, "%PACKAGER%") == 0) {
READ_AND_STORE(pkg->packager);
} else if(strcmp(line, "%CSIZE%") == 0) {
/* Note: the CSIZE and SIZE fields both share the "size" field in the
* pkginfo_t struct. This can be done b/c CSIZE is currently only used
* in sync databases, and SIZE is only used in local databases.
*/
READ_NEXT(line);
pkg->size = atol(line);
/* also store this value to isize if isize is unset */
if(pkg->isize == 0) {
pkg->isize = pkg->size;
}
} else if(strcmp(line, "%ISIZE%") == 0) {
READ_NEXT(line);
pkg->isize = atol(line);
} else if(strcmp(line, "%MD5SUM%") == 0) {
READ_AND_STORE(pkg->md5sum);
} else if(strcmp(line, "%REPLACES%") == 0) {
READ_AND_STORE_ALL(pkg->replaces);
} else if(strcmp(line, "%DEPENDS%") == 0) {
/* Different than the rest because of the _alpm_splitdep call. */
while(1) {
READ_NEXT(line);
if(strlen(line) == 0) break;
pkg->depends = alpm_list_add(pkg->depends, _alpm_splitdep(line));
}
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
READ_AND_STORE_ALL(pkg->optdepends);
} else if(strcmp(line, "%CONFLICTS%") == 0) {
READ_AND_STORE_ALL(pkg->conflicts);
} else if(strcmp(line, "%PROVIDES%") == 0) {
READ_AND_STORE_ALL(pkg->provides);
} else if(strcmp(line, "%DELTAS%") == 0) {
READ_AND_STORE_ALL(pkg->deltas);
}
}
} else if(strcmp(filename, "files") == 0) {
/* currently do nothing with this file */
} else {
/* unknown database file */
_alpm_log(PM_LOG_DEBUG, "unknown database file: %s\n", filename);
}
error:
FREE(pkgname);
/* TODO: return 0 always? */
return(0);
}
static int sync_db_version(pmdb_t *db)
{
return(2);
}
struct db_operations sync_db_ops = {
.populate = sync_db_populate,
.unregister = _alpm_db_unregister,
.version = sync_db_version,
};
pmdb_t *_alpm_db_register_sync(const char *treename)
{
pmdb_t *db;
alpm_list_t *i;
ALPM_LOG_FUNC;
for(i = handle->dbs_sync; i; i = i->next) {
pmdb_t *sdb = i->data;
if(strcmp(treename, sdb->treename) == 0) {
_alpm_log(PM_LOG_DEBUG, "attempt to re-register the '%s' database, using existing\n", sdb->treename);
return sdb;
}
}
_alpm_log(PM_LOG_DEBUG, "registering sync database '%s'\n", treename);
db = _alpm_db_new(treename, 0);
if(db == NULL) {
RET_ERR(PM_ERR_DB_CREATE, NULL);
}
db->ops = &sync_db_ops;
handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
return(db);
}
/* vim: set ts=2 sw=2 noet: */

View File

@@ -1,291 +0,0 @@
/*
* cache.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
/* libalpm */
#include "cache.h"
#include "alpm_list.h"
#include "log.h"
#include "alpm.h"
#include "util.h"
#include "package.h"
#include "group.h"
#include "db.h"
/* Returns a new package cache from db.
* It frees the cache if it already exists.
*/
int _alpm_db_load_pkgcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL) {
return(-1);
}
_alpm_db_free_pkgcache(db);
_alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'\n",
db->treename);
if(_alpm_db_populate(db) == -1) {
_alpm_log(PM_LOG_DEBUG,
"failed to load package cache for repository '%s'\n", db->treename);
return(-1);
}
db->pkgcache_loaded = 1;
return(0);
}
void _alpm_db_free_pkgcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL || !db->pkgcache_loaded) {
return;
}
_alpm_log(PM_LOG_DEBUG, "freeing package cache for repository '%s'\n",
db->treename);
alpm_list_free_inner(db->pkgcache, (alpm_list_fn_free)_alpm_pkg_free);
alpm_list_free(db->pkgcache);
db->pkgcache = NULL;
db->pkgcache_loaded = 0;
_alpm_db_free_grpcache(db);
}
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL) {
return(NULL);
}
if(!db->pkgcache_loaded) {
_alpm_db_load_pkgcache(db);
}
/* hmmm, still NULL ?*/
if(!db->pkgcache) {
_alpm_log(PM_LOG_DEBUG, "warning: pkgcache is NULL for db '%s'\n", db->treename);
}
return(db->pkgcache);
}
/* "duplicate" pkg with BASE info (to spare some memory) then add it to pkgcache */
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
{
pmpkg_t *newpkg;
ALPM_LOG_FUNC;
if(db == NULL || !db->pkgcache_loaded || pkg == NULL) {
return(-1);
}
newpkg = _alpm_pkg_new();
if(newpkg == NULL) {
return(-1);
}
newpkg->name = strdup(pkg->name);
newpkg->version = strdup(pkg->version);
if(newpkg->name == NULL || newpkg->version == NULL) {
pm_errno = PM_ERR_MEMORY;
_alpm_pkg_free(newpkg);
return(-1);
}
newpkg->origin = PKG_FROM_CACHE;
newpkg->origin_data.db = db;
newpkg->infolevel = INFRQ_BASE;
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
alpm_pkg_get_name(newpkg), db->treename);
db->pkgcache = alpm_list_add_sorted(db->pkgcache, newpkg, _alpm_pkg_cmp);
_alpm_db_free_grpcache(db);
return(0);
}
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
{
void *vdata;
pmpkg_t *data;
ALPM_LOG_FUNC;
if(db == NULL || !db->pkgcache_loaded || pkg == NULL) {
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "removing entry '%s' from '%s' cache\n",
alpm_pkg_get_name(pkg), db->treename);
db->pkgcache = alpm_list_remove(db->pkgcache, pkg, _alpm_pkg_cmp, &vdata);
data = vdata;
if(data == NULL) {
/* package not found */
_alpm_log(PM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found\n",
alpm_pkg_get_name(pkg), db->treename);
return(-1);
}
_alpm_pkg_free(data);
_alpm_db_free_grpcache(db);
return(0);
}
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
{
ALPM_LOG_FUNC;
if(db == NULL) {
return(NULL);
}
alpm_list_t *pkgcache = _alpm_db_get_pkgcache(db);
if(!pkgcache) {
_alpm_log(PM_LOG_DEBUG, "warning: failed to get '%s' from NULL pkgcache\n",
target);
return(NULL);
}
return(_alpm_pkg_find(pkgcache, target));
}
/* Returns a new group cache from db.
*/
int _alpm_db_load_grpcache(pmdb_t *db)
{
alpm_list_t *lp;
ALPM_LOG_FUNC;
if(db == NULL) {
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'\n",
db->treename);
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
const alpm_list_t *i;
pmpkg_t *pkg = lp->data;
for(i = alpm_pkg_get_groups(pkg); i; i = i->next) {
const char *grpname = i->data;
alpm_list_t *j;
pmgrp_t *grp = NULL;
int found = 0;
/* first look through the group cache for a group with this name */
for(j = db->grpcache; j; j = j->next) {
grp = j->data;
if(strcmp(grp->name, grpname) == 0
&& !alpm_list_find_ptr(grp->packages, pkg)) {
grp->packages = alpm_list_add(grp->packages, pkg);
found = 1;
break;
}
}
if(found) {
continue;
}
/* we didn't find the group, so create a new one with this name */
grp = _alpm_grp_new(grpname);
grp->packages = alpm_list_add(grp->packages, pkg);
db->grpcache = alpm_list_add(db->grpcache, grp);
}
}
db->grpcache_loaded = 1;
return(0);
}
void _alpm_db_free_grpcache(pmdb_t *db)
{
alpm_list_t *lg;
ALPM_LOG_FUNC;
if(db == NULL || !db->grpcache_loaded) {
return;
}
_alpm_log(PM_LOG_DEBUG, "freeing group cache for repository '%s'\n",
db->treename);
for(lg = db->grpcache; lg; lg = lg->next) {
_alpm_grp_free(lg->data);
lg->data = NULL;
}
FREELIST(db->grpcache);
db->grpcache_loaded = 0;
}
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL) {
return(NULL);
}
if(!db->grpcache_loaded) {
_alpm_db_load_grpcache(db);
}
return(db->grpcache);
}
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target)
{
alpm_list_t *i;
ALPM_LOG_FUNC;
if(db == NULL || target == NULL || strlen(target) == 0) {
return(NULL);
}
for(i = _alpm_db_get_grpcache(db); i; i = i->next) {
pmgrp_t *info = i->data;
if(strcmp(info->name, target) == 0) {
return(info);
}
}
return(NULL);
}
/* vim: set ts=2 sw=2 noet: */

View File

@@ -1,44 +0,0 @@
/*
* cache.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ALPM_CACHE_H
#define _ALPM_CACHE_H
#include "db.h"
#include "alpm_list.h"
#include "group.h"
#include "package.h"
/* packages */
int _alpm_db_load_pkgcache(pmdb_t *db);
void _alpm_db_free_pkgcache(pmdb_t *db);
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db);
int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target);
/* groups */
int _alpm_db_load_grpcache(pmdb_t *db);
void _alpm_db_free_grpcache(pmdb_t *db);
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db);
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target);
#endif /* _ALPM_CACHE_H */
/* vim: set ts=2 sw=2 noet: */

View File

@@ -1,7 +1,7 @@
/*
* conflict.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
@@ -38,10 +38,10 @@
#include "trans.h"
#include "util.h"
#include "log.h"
#include "cache.h"
#include "deps.h"
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2)
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2,
const char *reason)
{
pmconflict_t *conflict;
@@ -51,6 +51,7 @@ pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2)
STRDUP(conflict->package1, package1, RET_ERR(PM_ERR_MEMORY, NULL));
STRDUP(conflict->package2, package2, RET_ERR(PM_ERR_MEMORY, NULL));
STRDUP(conflict->reason, reason, RET_ERR(PM_ERR_MEMORY, NULL));
return(conflict);
}
@@ -59,6 +60,7 @@ void _alpm_conflict_free(pmconflict_t *conflict)
{
FREE(conflict->package2);
FREE(conflict->package1);
FREE(conflict->reason);
FREE(conflict);
}
@@ -69,24 +71,25 @@ pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict)
STRDUP(newconflict->package1, conflict->package1, RET_ERR(PM_ERR_MEMORY, NULL));
STRDUP(newconflict->package2, conflict->package2, RET_ERR(PM_ERR_MEMORY, NULL));
STRDUP(newconflict->reason, conflict->reason, RET_ERR(PM_ERR_MEMORY, NULL));
return(newconflict);
}
int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
static int conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
{
alpm_list_t *i;
const char *npkg1 = needle->package1;
const char *npkg2 = needle->package2;
ALPM_LOG_FUNC;
for(i = haystack; i; i = i->next) {
pmconflict_t *conflict = i->data;
char *cpkg1 = conflict->package1;
char *cpkg2 = conflict->package2;
char *npkg1 = needle->package1;
char *npkg2 = needle->package2;
if((!strcmp(cpkg1, npkg1) && !strcmp(cpkg2, npkg2))
|| (!strcmp(cpkg1, npkg2) && !strcmp(cpkg2, npkg1))) {
const char *cpkg1 = conflict->package1;
const char *cpkg2 = conflict->package2;
if((strcmp(cpkg1, npkg1) == 0 && strcmp(cpkg2, npkg2) == 0)
|| (strcmp(cpkg1, npkg2) == 0 && strcmp(cpkg2, npkg1) == 0)) {
return(1);
}
}
@@ -94,38 +97,18 @@ int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack)
return(0);
}
/** Check if pkg1 conflicts with pkg2
* @param pkg1 package we are looking at
* @param conflict name of the possible conflict
* @param pkg2 package to check
* @return 0 for no conflict, non-zero otherwise
*/
static int does_conflict(pmpkg_t *pkg1, const char *conflict, pmpkg_t *pkg2)
{
const char *pkg1name = alpm_pkg_get_name(pkg1);
const char *pkg2name = alpm_pkg_get_name(pkg2);
pmdepend_t *conf = _alpm_splitdep(conflict);
int match = 0;
match = alpm_depcmp(pkg2, conf);
if(match) {
_alpm_log(PM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n",
pkg1name, pkg2name, conflict);
}
_alpm_dep_free(conf);
return(match);
}
/** Adds the pkg1/pkg2 conflict to the baddeps list
* @param *baddeps list to add conflict to
* @param pkg1 first package
* @param pkg2 package causing conflict
*/
static void add_conflict(alpm_list_t **baddeps, const char *pkg1,
const char *pkg2)
const char *pkg2, const char *reason)
{
pmconflict_t *conflict = _alpm_conflict_new(pkg1, pkg2);
if(conflict && !_alpm_conflict_isin(conflict, *baddeps)) {
pmconflict_t *conflict = _alpm_conflict_new(pkg1, pkg2, reason);
_alpm_log(PM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n",
pkg1, pkg2, reason);
if(conflict && !conflict_isin(conflict, *baddeps)) {
*baddeps = alpm_list_add(*baddeps, conflict);
} else {
_alpm_conflict_free(conflict);
@@ -156,6 +139,7 @@ static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) {
const char *conflict = j->data;
pmdepend_t *parsed_conflict = _alpm_splitdep(conflict);
for(k = list2; k; k = k->next) {
pmpkg_t *pkg2 = k->data;
@@ -166,14 +150,15 @@ static void check_conflict(alpm_list_t *list1, alpm_list_t *list2,
continue;
}
if(does_conflict(pkg1, conflict, pkg2)) {
if(_alpm_depcmp(pkg2, parsed_conflict)) {
if(order >= 0) {
add_conflict(baddeps, pkg1name, pkg2name);
add_conflict(baddeps, pkg1name, pkg2name, conflict);
} else {
add_conflict(baddeps, pkg2name, pkg1name);
add_conflict(baddeps, pkg2name, pkg1name, conflict);
}
}
}
_alpm_dep_free(parsed_conflict);
}
}
}
@@ -205,8 +190,8 @@ alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages)
return(NULL);
}
alpm_list_t *dblist = alpm_list_diff(_alpm_db_get_pkgcache(db), packages,
_alpm_pkg_cmp);
alpm_list_t *dblist = alpm_list_diff(_alpm_db_get_pkgcache(db),
packages, _alpm_pkg_cmp);
/* two checks to be done here for conflicts */
_alpm_log(PM_LOG_DEBUG, "check targets vs db\n");
@@ -318,7 +303,7 @@ static alpm_list_t *chk_filedifference(alpm_list_t *filesA, alpm_list_t *filesB)
*/
static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
pmfileconflicttype_t type, const char *filestr,
const char* name1, const char* name2)
const char* name1, const char* name2)
{
pmfileconflict_t *conflict;
MALLOC(conflict, sizeof(pmfileconflict_t), RET_ERR(PM_ERR_MEMORY, NULL));
@@ -381,7 +366,7 @@ static int dir_belongsto_pkg(char *dirpath, pmpkg_t *pkg)
return(0);
}
} else {
if(alpm_list_find_str(alpm_pkg_get_files(pkg),path)) {
if(alpm_list_find_str(alpm_pkg_get_files(pkg), path)) {
continue;
} else {
closedir(dir);
@@ -400,12 +385,12 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
alpm_list_t *upgrade, alpm_list_t *remove)
{
alpm_list_t *i, *j, *conflicts = NULL;
int numtargs = alpm_list_count(upgrade);
int current;
size_t numtargs = alpm_list_count(upgrade);
size_t current;
ALPM_LOG_FUNC;
if(db == NULL || upgrade == NULL) {
if(db == NULL || upgrade == NULL || trans == NULL) {
return(NULL);
}
@@ -413,7 +398,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
* be possible with real transactions. Right now we only do half as much
* here as we do when we actually extract files in add.c with our 12
* different cases. */
for(current = 1, i = upgrade; i; i = i->next, current++) {
for(current = 0, i = upgrade; i; i = i->next, current++) {
alpm_list_t *k, *tmpfiles = NULL;
pmpkg_t *p1, *p2, *dbpkg;
char path[PATH_MAX+1];
@@ -423,8 +408,8 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
continue;
}
double percent = (double)current / numtargs;
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent * 100),
int percent = (current * 100) / numtargs;
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", percent,
numtargs, current);
/* CHECK 1: check every target against every target */
_alpm_log(PM_LOG_DEBUG, "searching for file conflicts: %s\n",
@@ -513,7 +498,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
/* skip removal of file, but not add. this will prevent a second
* package from removing the file when it was already installed
* by its new owner (whether the file is in backup array or not */
trans->skip_remove = alpm_list_add(trans->skip_remove, strdup(path));
trans->skip_remove = alpm_list_add(trans->skip_remove, strdup(filestr));
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s\n", filestr);
resolved_conflict = 1;
}
@@ -552,6 +537,8 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
}
FREELIST(tmpfiles);
}
PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", 100,
numtargs, current);
return(conflicts);
}
@@ -578,6 +565,17 @@ const char SYMEXPORT *alpm_conflict_get_package2(pmconflict_t *conflict)
return conflict->package2;
}
const char SYMEXPORT *alpm_conflict_get_reason(pmconflict_t *conflict)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(conflict != NULL, return(NULL));
return conflict->reason;
}
const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
{
ALPM_LOG_FUNC;

View File

@@ -1,7 +1,7 @@
/*
* conflict.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -27,6 +27,7 @@
struct __pmconflict_t {
char *package1;
char *package2;
char *reason;
};
struct __pmfileconflict_t {
@@ -36,10 +37,9 @@ struct __pmfileconflict_t {
char *ctarget;
};
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2);
pmconflict_t *_alpm_conflict_new(const char *package1, const char *package2, const char *reason);
pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict);
void _alpm_conflict_free(pmconflict_t *conflict);
int _alpm_conflict_isin(pmconflict_t *needle, alpm_list_t *haystack);
alpm_list_t *_alpm_innerconflicts(alpm_list_t *packages);
alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages);
alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,

View File

@@ -1,7 +1,7 @@
/*
* db.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@@ -29,7 +29,6 @@
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <dirent.h>
#include <regex.h>
#include <time.h>
@@ -39,8 +38,9 @@
#include "log.h"
#include "util.h"
#include "handle.h"
#include "cache.h"
#include "alpm.h"
#include "package.h"
#include "group.h"
/** \addtogroup alpm_databases Database Functions
* @brief Functions to query and manipulate the database of libalpm
@@ -64,23 +64,8 @@ pmdb_t SYMEXPORT *alpm_db_register_sync(const char *treename)
return(_alpm_db_register_sync(treename));
}
/** Register the local package database.
* @return a pmdb_t* representing the local database, or NULL on error
*/
pmdb_t SYMEXPORT *alpm_db_register_local(void)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, NULL));
/* Do not register a database if a transaction is on-going */
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, NULL));
return(_alpm_db_register_local());
}
/* Helper function for alpm_db_unregister{_all} */
static void _alpm_db_unregister(pmdb_t *db)
void _alpm_db_unregister(pmdb_t *db)
{
if(db == NULL) {
return;
@@ -96,6 +81,7 @@ static void _alpm_db_unregister(pmdb_t *db)
int SYMEXPORT alpm_db_unregister_all(void)
{
alpm_list_t *i;
pmdb_t *db;
ALPM_LOG_FUNC;
@@ -105,13 +91,16 @@ int SYMEXPORT alpm_db_unregister_all(void)
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
/* close local database */
_alpm_db_unregister(handle->db_local);
handle->db_local = NULL;
db = handle->db_local;
if(db) {
db->ops->unregister(db);
handle->db_local = NULL;
}
/* and also sync ones */
for(i = handle->dbs_sync; i; i = i->next) {
pmdb_t *db = i->data;
_alpm_db_unregister(db);
db = i->data;
db->ops->unregister(db);
i->data = NULL;
}
FREELIST(handle->dbs_sync);
@@ -154,7 +143,7 @@ int SYMEXPORT alpm_db_unregister(pmdb_t *db)
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
_alpm_db_unregister(db);
db->ops->unregister(db);
return(0);
}
@@ -168,7 +157,7 @@ int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url)
alpm_list_t *i;
int found = 0;
char *newurl;
int len = 0;
size_t len = 0;
ALPM_LOG_FUNC;
@@ -321,20 +310,51 @@ alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
return(_alpm_db_search(db, needles));
}
/** Set install reason for a package in db
* @param db pointer to the package database
* @param name the name of the package
* @param reason the new install reason
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
ASSERT(db != NULL && name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(db, name);
if(pkg == NULL) {
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
_alpm_log(PM_LOG_DEBUG, "setting install reason %u for %s/%s\n", reason, db->treename, name);
if(alpm_pkg_get_reason(pkg) == reason) {
/* we are done */
return(0);
}
/* set reason (in pkgcache) */
pkg->reason = reason;
/* write DESC */
if(_alpm_local_db_write(db, pkg, INFRQ_DESC)) {
return(-1);
}
return(0);
}
/** @} */
pmdb_t *_alpm_db_new(const char *dbpath, const char *treename)
pmdb_t *_alpm_db_new(const char *treename, int is_local)
{
pmdb_t *db;
const size_t pathsize = strlen(dbpath) + strlen(treename) + 2;
ALPM_LOG_FUNC;
CALLOC(db, 1, sizeof(pmdb_t), RET_ERR(PM_ERR_MEMORY, NULL));
CALLOC(db->path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
sprintf(db->path, "%s%s/", dbpath, treename);
STRDUP(db->treename, treename, RET_ERR(PM_ERR_MEMORY, NULL));
db->is_local = is_local;
return(db);
}
@@ -347,13 +367,52 @@ void _alpm_db_free(pmdb_t *db)
_alpm_db_free_pkgcache(db);
/* cleanup server list */
FREELIST(db->servers);
FREE(db->path);
FREE(db->_path);
FREE(db->treename);
FREE(db);
return;
}
const char *_alpm_db_path(pmdb_t *db)
{
if(!db) {
return(NULL);
}
if(!db->_path) {
const char *dbpath;
size_t pathsize;
dbpath = alpm_option_get_dbpath();
if(!dbpath) {
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
RET_ERR(PM_ERR_DB_OPEN, NULL);
}
if(db->is_local) {
pathsize = strlen(dbpath) + strlen(db->treename) + 2;
CALLOC(db->_path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
sprintf(db->_path, "%s%s/", dbpath, db->treename);
} else {
pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4;
CALLOC(db->_path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
/* all sync DBs now reside in the sync/ subdir of the dbpath */
sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
}
_alpm_log(PM_LOG_DEBUG, "database path for tree %s set to %s\n",
db->treename, db->_path);
}
return(db->_path);
}
int _alpm_db_version(pmdb_t *db)
{
if(!db) {
return(-1);
}
return(db->ops->version(db));
}
int _alpm_db_cmp(const void *d1, const void *d2)
{
pmdb_t *db1 = (pmdb_t *)d1;
@@ -437,69 +496,258 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
return(ret);
}
pmdb_t *_alpm_db_register_local(void)
/* Returns a new package cache from db.
* It frees the cache if it already exists.
*/
int _alpm_db_load_pkgcache(pmdb_t *db)
{
pmdb_t *db;
const char *dbpath;
ALPM_LOG_FUNC;
if(db == NULL) {
return(-1);
}
_alpm_db_free_pkgcache(db);
_alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'\n",
db->treename);
if(db->ops->populate(db) == -1) {
_alpm_log(PM_LOG_DEBUG,
"failed to load package cache for repository '%s'\n", db->treename);
return(-1);
}
db->pkgcache_loaded = 1;
return(0);
}
void _alpm_db_free_pkgcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL || !db->pkgcache_loaded) {
return;
}
_alpm_log(PM_LOG_DEBUG, "freeing package cache for repository '%s'\n",
db->treename);
alpm_list_free_inner(_alpm_db_get_pkgcache(db),
(alpm_list_fn_free)_alpm_pkg_free);
_alpm_pkghash_free(db->pkgcache);
db->pkgcache_loaded = 0;
_alpm_db_free_grpcache(db);
}
pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL) {
return(NULL);
}
if(!db->pkgcache_loaded) {
_alpm_db_load_pkgcache(db);
}
/* hmmm, still NULL ?*/
if(!db->pkgcache) {
_alpm_log(PM_LOG_DEBUG, "warning: pkgcache is NULL for db '%s'\n", db->treename);
}
return(db->pkgcache);
}
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
pmpkghash_t *hash = _alpm_db_get_pkgcache_hash(db);
if(hash == NULL) {
return(NULL);
}
return(hash->list);
}
/* "duplicate" pkg then add it to pkgcache */
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
{
pmpkg_t *newpkg;
ALPM_LOG_FUNC;
if(handle->db_local != NULL) {
_alpm_log(PM_LOG_WARNING, _("attempt to re-register the 'local' DB\n"));
RET_ERR(PM_ERR_DB_NOT_NULL, NULL);
if(db == NULL || !db->pkgcache_loaded || pkg == NULL) {
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "registering local database\n");
dbpath = alpm_option_get_dbpath();
if(!dbpath) {
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
RET_ERR(PM_ERR_DB_OPEN, NULL);
newpkg = _alpm_pkg_dup(pkg);
if(newpkg == NULL) {
return(-1);
}
db = _alpm_db_new(dbpath, "local");
if(db == NULL) {
RET_ERR(PM_ERR_DB_CREATE, NULL);
}
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
alpm_pkg_get_name(newpkg), db->treename);
db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg);
handle->db_local = db;
return(db);
_alpm_db_free_grpcache(db);
return(0);
}
pmdb_t *_alpm_db_register_sync(const char *treename)
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
{
pmpkg_t *data = NULL;
ALPM_LOG_FUNC;
if(db == NULL || !db->pkgcache_loaded || pkg == NULL) {
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "removing entry '%s' from '%s' cache\n",
alpm_pkg_get_name(pkg), db->treename);
db->pkgcache = _alpm_pkghash_remove(db->pkgcache, pkg, &data);
if(data == NULL) {
/* package not found */
_alpm_log(PM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found\n",
alpm_pkg_get_name(pkg), db->treename);
return(-1);
}
_alpm_pkg_free(data);
_alpm_db_free_grpcache(db);
return(0);
}
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
{
ALPM_LOG_FUNC;
if(db == NULL) {
return(NULL);
}
pmpkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db);
if(!pkgcache) {
_alpm_log(PM_LOG_DEBUG, "warning: failed to get '%s' from NULL pkgcache\n",
target);
return(NULL);
}
return(_alpm_pkghash_find(pkgcache, target));
}
/* Returns a new group cache from db.
*/
int _alpm_db_load_grpcache(pmdb_t *db)
{
alpm_list_t *lp;
ALPM_LOG_FUNC;
if(db == NULL) {
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'\n",
db->treename);
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
const alpm_list_t *i;
pmpkg_t *pkg = lp->data;
for(i = alpm_pkg_get_groups(pkg); i; i = i->next) {
const char *grpname = i->data;
alpm_list_t *j;
pmgrp_t *grp = NULL;
int found = 0;
/* first look through the group cache for a group with this name */
for(j = db->grpcache; j; j = j->next) {
grp = j->data;
if(strcmp(grp->name, grpname) == 0
&& !alpm_list_find_ptr(grp->packages, pkg)) {
grp->packages = alpm_list_add(grp->packages, pkg);
found = 1;
break;
}
}
if(found) {
continue;
}
/* we didn't find the group, so create a new one with this name */
grp = _alpm_grp_new(grpname);
grp->packages = alpm_list_add(grp->packages, pkg);
db->grpcache = alpm_list_add(db->grpcache, grp);
}
}
db->grpcache_loaded = 1;
return(0);
}
void _alpm_db_free_grpcache(pmdb_t *db)
{
alpm_list_t *lg;
ALPM_LOG_FUNC;
if(db == NULL || !db->grpcache_loaded) {
return;
}
_alpm_log(PM_LOG_DEBUG, "freeing group cache for repository '%s'\n",
db->treename);
for(lg = db->grpcache; lg; lg = lg->next) {
_alpm_grp_free(lg->data);
lg->data = NULL;
}
FREELIST(db->grpcache);
db->grpcache_loaded = 0;
}
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
if(db == NULL) {
return(NULL);
}
if(!db->grpcache_loaded) {
_alpm_db_load_grpcache(db);
}
return(db->grpcache);
}
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target)
{
pmdb_t *db;
const char *dbpath;
char path[PATH_MAX];
alpm_list_t *i;
ALPM_LOG_FUNC;
for(i = handle->dbs_sync; i; i = i->next) {
pmdb_t *sdb = i->data;
if(strcmp(treename, sdb->treename) == 0) {
_alpm_log(PM_LOG_DEBUG, "attempt to re-register the '%s' database, using existing\n", sdb->treename);
return sdb;
if(db == NULL || target == NULL || strlen(target) == 0) {
return(NULL);
}
for(i = _alpm_db_get_grpcache(db); i; i = i->next) {
pmgrp_t *info = i->data;
if(strcmp(info->name, target) == 0) {
return(info);
}
}
_alpm_log(PM_LOG_DEBUG, "registering sync database '%s'\n", treename);
dbpath = alpm_option_get_dbpath();
if(!dbpath) {
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
RET_ERR(PM_ERR_DB_OPEN, NULL);
}
/* all sync DBs now reside in the sync/ subdir of the dbpath */
snprintf(path, PATH_MAX, "%ssync/", dbpath);
db = _alpm_db_new(path, treename);
if(db == NULL) {
RET_ERR(PM_ERR_DB_CREATE, NULL);
}
handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
return(db);
return(NULL);
}
/* vim: set ts=2 sw=2 noet: */

View File

@@ -1,7 +1,7 @@
/*
* db.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
@@ -23,46 +23,80 @@
#define _ALPM_DB_H
#include "alpm.h"
#include <limits.h>
#include "pkghash.h"
#include <time.h>
/* libarchive */
#include <archive.h>
#include <archive_entry.h>
/* Database entries */
typedef enum _pmdbinfrq_t {
INFRQ_BASE = 0x01,
INFRQ_DESC = 0x02,
INFRQ_DEPENDS = 0x04,
INFRQ_FILES = 0x08,
INFRQ_SCRIPTLET = 0x10,
INFRQ_DELTAS = 0x20,
/* ALL should be sum of all above */
INFRQ_ALL = 0x3F
INFRQ_BASE = 1,
INFRQ_DESC = (1 << 1),
INFRQ_FILES = (1 << 2),
INFRQ_SCRIPTLET = (1 << 3),
INFRQ_DSIZE = (1 << 4),
/* ALL should be info stored in the package or database */
INFRQ_ALL = 0x1F
} pmdbinfrq_t;
struct db_operations {
int (*populate) (pmdb_t *);
void (*unregister) (pmdb_t *);
int (*version) (pmdb_t *);
};
/* Database */
struct __pmdb_t {
char *path;
char *treename;
unsigned short pkgcache_loaded;
alpm_list_t *pkgcache;
unsigned short grpcache_loaded;
/* do not access directly, use _alpm_db_path(db) for lazy access */
char *_path;
int pkgcache_loaded;
int grpcache_loaded;
/* also indicates whether we are RO or RW */
int is_local;
pmpkghash_t *pkgcache;
alpm_list_t *grpcache;
alpm_list_t *servers;
struct db_operations *ops;
};
/* db.c, database general calls */
pmdb_t *_alpm_db_new(const char *dbpath, const char *treename);
pmdb_t *_alpm_db_new(const char *treename, int is_local);
void _alpm_db_free(pmdb_t *db);
const char *_alpm_db_path(pmdb_t *db);
int _alpm_db_version(pmdb_t *db);
int _alpm_db_cmp(const void *d1, const void *d2);
alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles);
pmdb_t *_alpm_db_register_local(void);
pmdb_t *_alpm_db_register_sync(const char *treename);
void _alpm_db_unregister(pmdb_t *db);
/* be.c, backend specific calls */
int _alpm_db_populate(pmdb_t *db);
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info);
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
/* be_*.c, backend specific calls */
int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info);
int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_local_db_remove(pmdb_t *db, pmpkg_t *info);
/* cache bullshit */
/* packages */
int _alpm_db_load_pkgcache(pmdb_t *db);
void _alpm_db_free_pkgcache(pmdb_t *db);
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db);
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db);
int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target);
/* groups */
int _alpm_db_load_grpcache(pmdb_t *db);
void _alpm_db_free_grpcache(pmdb_t *db);
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db);
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target);
#endif /* _ALPM_DB_H */

View File

@@ -1,7 +1,7 @@
/*
* delta.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2007-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -71,34 +71,16 @@ off_t SYMEXPORT alpm_delta_get_size(pmdelta_t *delta)
/** @} */
static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
{
alpm_list_t *i, *j;
alpm_list_t *vertices = NULL;
/* create the vertices */
for(i = deltas; i; i = i->next) {
char *fpath, *md5sum;
pmgraph_t *v = _alpm_graph_new();
pmdelta_t *vdelta = i->data;
vdelta->download_size = vdelta->delta_size;
v->weight = LONG_MAX;
/* determine whether the delta file already exists */
fpath = _alpm_filecache_find(vdelta->delta);
md5sum = alpm_compute_md5sum(fpath);
if(fpath && md5sum && strcmp(md5sum, vdelta->delta_md5) == 0) {
vdelta->download_size = 0;
}
FREE(fpath);
FREE(md5sum);
/* determine whether a base 'from' file exists */
fpath = _alpm_filecache_find(vdelta->from);
if(fpath) {
v->weight = vdelta->download_size;
}
FREE(fpath);
v->data = vdelta;
vertices = alpm_list_add(vertices, v);
}
@@ -119,7 +101,8 @@ static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
* 3_to_4
* If J 'from' is equal to I 'to', then J is a child of I.
* */
if(strcmp(d_j->from, d_i->to) == 0) {
if((!reverse && strcmp(d_j->from, d_i->to) == 0) ||
(reverse && strcmp(d_j->to, d_i->from) == 0)) {
v_i->children = alpm_list_add(v_i->children, v_j);
}
}
@@ -128,8 +111,36 @@ static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
return(vertices);
}
static off_t delta_vert(alpm_list_t *vertices,
const char *to, alpm_list_t **path) {
static void graph_init_size(alpm_list_t *vertices)
{
alpm_list_t *i;
for(i = vertices; i; i = i->next) {
char *fpath, *md5sum;
pmgraph_t *v = i->data;
pmdelta_t *vdelta = v->data;
/* determine whether the delta file already exists */
fpath = _alpm_filecache_find(vdelta->delta);
md5sum = alpm_compute_md5sum(fpath);
if(fpath && md5sum && strcmp(md5sum, vdelta->delta_md5) == 0) {
vdelta->download_size = 0;
}
FREE(fpath);
FREE(md5sum);
/* determine whether a base 'from' file exists */
fpath = _alpm_filecache_find(vdelta->from);
if(fpath) {
v->weight = vdelta->download_size;
}
FREE(fpath);
}
}
static void dijkstra(alpm_list_t *vertices)
{
alpm_list_t *i;
pmgraph_t *v;
while(1) {
@@ -165,9 +176,14 @@ static off_t delta_vert(alpm_list_t *vertices,
}
}
}
v = NULL;
static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **path)
{
alpm_list_t *i;
pmgraph_t *v = NULL;
off_t bestsize = 0;
alpm_list_t *rpath = NULL;
for(i = vertices; i; i = i->next) {
pmgraph_t *v_i = i->data;
@@ -181,7 +197,6 @@ static off_t delta_vert(alpm_list_t *vertices,
}
}
alpm_list_t *rpath = NULL;
while(v != NULL) {
pmdelta_t *vdelta = v->data;
rpath = alpm_list_add(rpath, vdelta);
@@ -219,9 +234,10 @@ off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
_alpm_log(PM_LOG_DEBUG, "started delta shortest-path search for '%s'\n", to);
vertices = delta_graph_init(deltas);
bestsize = delta_vert(vertices, to, &bestpath);
vertices = graph_init(deltas, 0);
graph_init_size(vertices);
dijkstra(vertices);
bestsize = shortest_path(vertices, to, &bestpath);
_alpm_log(PM_LOG_DEBUG, "delta shortest-path search complete : '%jd'\n", (intmax_t)bestsize);
@@ -232,6 +248,45 @@ off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
return(bestsize);
}
static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota)
{
alpm_list_t *unused = NULL;
alpm_list_t *vertices;
alpm_list_t *i;
vertices = graph_init(deltas, 1);
for(i = vertices; i; i = i->next) {
pmgraph_t *v = i->data;
pmdelta_t *vdelta = v->data;
if(strcmp(vdelta->to, to) == 0)
{
v->weight = vdelta->download_size;
}
}
dijkstra(vertices);
for(i = vertices; i; i = i->next) {
pmgraph_t *v = i->data;
pmdelta_t *vdelta = v->data;
if(v->weight > quota) {
unused = alpm_list_add(unused, vdelta->delta);
}
}
alpm_list_free_inner(vertices, _alpm_graph_free);
alpm_list_free(vertices);
return(unused);
}
alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg)
{
off_t pkgsize = alpm_pkg_get_size(pkg);
alpm_list_t *unused = find_unused(
alpm_pkg_get_deltas(pkg),
alpm_pkg_get_filename(pkg),
pkgsize * MAX_DELTA_RATIO);
return(unused);
}
/** Parses the string representation of a pmdelta_t object.
* This function assumes that the string is in the correct format.
* This format is as follows:
@@ -282,7 +337,7 @@ pmdelta_t *_alpm_delta_parse(char *line)
tmp2 = tmp;
STRDUP(delta->to, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
_alpm_log(PM_LOG_DEBUG, "delta : %s %s '%lld'\n", delta->from, delta->to, (long long)delta->delta_size);
_alpm_log(PM_LOG_DEBUG, "delta : %s %s '%jd'\n", delta->from, delta->to, (intmax_t)delta->delta_size);
return(delta);
}

View File

@@ -1,7 +1,7 @@
/*
* delta.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2007-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -44,6 +44,9 @@ void _alpm_delta_free(pmdelta_t *delta);
off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
const char *to, alpm_list_t **path);
/* max percent of package size to download deltas */
#define MAX_DELTA_RATIO 0.7
#endif /* _ALPM_DELTA_H */
/* vim: set ts=2 sw=2 noet: */

View File

@@ -1,7 +1,7 @@
/*
* deps.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
@@ -34,7 +34,6 @@
#include "graph.h"
#include "package.h"
#include "db.h"
#include "cache.h"
#include "handle.h"
void _alpm_dep_free(pmdepend_t *dep)
@@ -140,8 +139,8 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
vertex->state = -1;
int found = 0;
while(vertex->childptr && !found) {
pmgraph_t *nextchild = (vertex->childptr)->data;
vertex->childptr = (vertex->childptr)->next;
pmgraph_t *nextchild = vertex->childptr->data;
vertex->childptr = vertex->childptr->next;
if (nextchild->state == 0) {
found = 1;
nextchild->parent = vertex;
@@ -150,12 +149,15 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse)
else if(nextchild->state == -1) {
pmpkg_t *vertexpkg = vertex->data;
pmpkg_t *childpkg = nextchild->data;
const char *message;
_alpm_log(PM_LOG_WARNING, _("dependency cycle detected:\n"));
if(reverse) {
_alpm_log(PM_LOG_WARNING, _("%s will be removed after its %s dependency\n"), vertexpkg->name, childpkg->name);
message =_("%s will be removed after its %s dependency\n");
} else {
_alpm_log(PM_LOG_WARNING, _("%s will be installed before its %s dependency\n"), vertexpkg->name, childpkg->name);
message =_("%s will be installed before its %s dependency\n");
}
_alpm_log(PM_LOG_WARNING, message, vertexpkg->name, childpkg->name);
}
}
if(!found) {
@@ -196,36 +198,25 @@ pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep)
for(i = pkgs; i; i = alpm_list_next(i)) {
pmpkg_t *pkg = i->data;
if(alpm_depcmp(pkg, dep)) {
if(_alpm_depcmp_tolerant(pkg, dep)) {
return(pkg);
}
}
return(NULL);
}
/** Checks dependencies and returns missing ones in a list.
* Dependencies can include versions with depmod operators.
* @param db pointer to the local package database
* @param targets an alpm_list_t* of dependencies strings to satisfy
* @return an alpm_list_t* of missing dependencies strings
/** Find a package satisfying a specified dependency.
* The dependency can include versions with depmod operators.
* @param pkgs an alpm_list_t* of pmpkg_t where the satisfier will be searched
* @param depstring package or provision name, versioned or not
* @return a pmpkg_t* satisfying depstring
*/
alpm_list_t SYMEXPORT *alpm_deptest(pmdb_t *db, alpm_list_t *targets)
pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
{
alpm_list_t *i, *ret = NULL;
for(i = targets; i; i = alpm_list_next(i)) {
pmdepend_t *dep;
char *target;
target = alpm_list_getdata(i);
dep = _alpm_splitdep(target);
if(!_alpm_find_dep_satisfier(_alpm_db_get_pkgcache(db), dep)) {
ret = alpm_list_add(ret, target);
}
_alpm_dep_free(dep);
}
return(ret);
pmdepend_t *dep = _alpm_splitdep(depstring);
pmpkg_t *pkg = _alpm_find_dep_satisfier(pkgs, dep);
_alpm_dep_free(dep);
return(pkg);
}
/** Checks dependencies and returns missing ones in a list.
@@ -234,7 +225,7 @@ alpm_list_t SYMEXPORT *alpm_deptest(pmdb_t *db, alpm_list_t *targets)
* @param reversedeps handles the backward dependencies
* @param remove an alpm_list_t* of packages to be removed
* @param upgrade an alpm_list_t* of packages to be upgraded (remove-then-upgrade)
* @return an alpm_list_t* of pmpkg_t* of missing_t pointers.
* @return an alpm_list_t* of pmpkg_t* of pmdepmissing_t pointers.
*/
alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
alpm_list_t *remove, alpm_list_t *upgrade)
@@ -242,14 +233,13 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
alpm_list_t *i, *j;
alpm_list_t *targets, *dblist = NULL, *modified = NULL;
alpm_list_t *baddeps = NULL;
pmdepmissing_t *miss = NULL;
ALPM_LOG_FUNC;
targets = alpm_list_join(alpm_list_copy(remove), alpm_list_copy(upgrade));
for(i = pkglist; i; i = i->next) {
void *pkg = i->data;
if(alpm_list_find(targets, pkg, _alpm_pkg_cmp)) {
pmpkg_t *pkg = i->data;
if(_alpm_pkg_find(targets, pkg->name)) {
modified = alpm_list_add(modified, pkg);
} else {
dblist = alpm_list_add(dblist, pkg);
@@ -270,6 +260,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
if(!_alpm_find_dep_satisfier(upgrade, depend) &&
!_alpm_find_dep_satisfier(dblist, depend)) {
/* Unsatisfied dependency in the upgrade list */
pmdepmissing_t *miss;
char *missdepstring = alpm_dep_compute_string(depend);
_alpm_log(PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n",
missdepstring, alpm_pkg_get_name(tp));
@@ -294,6 +285,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
if(causingpkg &&
!_alpm_find_dep_satisfier(upgrade, depend) &&
!_alpm_find_dep_satisfier(dblist, depend)) {
pmdepmissing_t *miss;
char *missdepstring = alpm_dep_compute_string(depend);
_alpm_log(PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
missdepstring, alpm_pkg_get_name(lp));
@@ -304,6 +296,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_list_t *pkglist, int reversedeps,
}
}
}
alpm_list_free(modified);
alpm_list_free(dblist);
@@ -331,89 +324,116 @@ static int dep_vercmp(const char *version1, pmdepmod_t mod,
return(equal);
}
int SYMEXPORT alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
/* nodepversion: skip version checking */
static int _depcmp(pmpkg_t *pkg, pmdepend_t *dep, int nodepversion)
{
alpm_list_t *i;
ALPM_LOG_FUNC;
const char *pkgname = alpm_pkg_get_name(pkg);
const char *pkgversion = alpm_pkg_get_version(pkg);
int satisfy = 0;
int depmod;
if(nodepversion) {
depmod = PM_DEP_MOD_ANY;
} else {
depmod = dep->mod;
}
/* check (pkg->name, pkg->version) */
satisfy = (strcmp(pkgname, dep->name) == 0
&& dep_vercmp(pkgversion, dep->mod, dep->version));
if(pkg->name_hash && dep->name_hash
&& pkg->name_hash != dep->name_hash) {
/* skip more expensive checks */
} else {
satisfy = (strcmp(pkg->name, dep->name) == 0
&& dep_vercmp(pkg->version, depmod, dep->version));
if(satisfy) {
return(satisfy);
}
}
/* check provisions, format : "name=version" */
for(i = alpm_pkg_get_provides(pkg); i && !satisfy; i = i->next) {
char *provname = strdup(i->data);
char *provver = strchr(provname, '=');
const char *provision = i->data;
const char *provver = strchr(provision, '=');
if(provver == NULL) { /* no provision version */
satisfy = (dep->mod == PM_DEP_MOD_ANY
&& strcmp(provname, dep->name) == 0);
satisfy = (depmod == PM_DEP_MOD_ANY
&& strcmp(provision, dep->name) == 0);
} else {
*provver = '\0';
/* This is a bit tricker than the old code for performance reasons. To
* prevent the need to copy and duplicate strings, strncmp only the name
* portion if they are the same length, since there is a version and
* operator in play here. Cast is to silence sign conversion warning;
* we know provver >= provision if we are here. */
size_t namelen = (size_t)(provver - provision);
provver += 1;
satisfy = (strcmp(provname, dep->name) == 0
&& dep_vercmp(provver, dep->mod, dep->version));
satisfy = (strlen(dep->name) == namelen
&& strncmp(provision, dep->name, namelen) == 0
&& dep_vercmp(provver, depmod, dep->version));
}
free(provname);
}
return(satisfy);
}
/* tolerant : respects NODEPVERSION flag */
int _alpm_depcmp_tolerant(pmpkg_t *pkg, pmdepend_t *dep)
{
int nodepversion = 0;
int flags = alpm_trans_get_flags();
if (flags != -1) {
nodepversion = flags & PM_TRANS_FLAG_NODEPVERSION;
}
return(_depcmp(pkg, dep, nodepversion));
}
/* strict : ignores NODEPVERSION flag */
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
{
return(_depcmp(pkg, dep, 0));
}
pmdepend_t *_alpm_splitdep(const char *depstring)
{
pmdepend_t *depend;
char *ptr = NULL;
char *newstr = NULL;
const char *ptr, *version = NULL;
if(depstring == NULL) {
return(NULL);
}
STRDUP(newstr, depstring, RET_ERR(PM_ERR_MEMORY, NULL));
CALLOC(depend, 1, sizeof(pmdepend_t), RET_ERR(PM_ERR_MEMORY, NULL));
/* Find a version comparator if one exists. If it does, set the type and
* increment the ptr accordingly so we can copy the right strings. */
if((ptr = strstr(newstr, ">="))) {
if((ptr = strstr(depstring, ">="))) {
depend->mod = PM_DEP_MOD_GE;
*ptr = '\0';
ptr += 2;
} else if((ptr = strstr(newstr, "<="))) {
version = ptr + 2;
} else if((ptr = strstr(depstring, "<="))) {
depend->mod = PM_DEP_MOD_LE;
*ptr = '\0';
ptr += 2;
} else if((ptr = strstr(newstr, "="))) { /* Note: we must do =,<,> checks after <=, >= checks */
version = ptr + 2;
} else if((ptr = strstr(depstring, "="))) {
/* Note: we must do =,<,> checks after <=, >= checks */
depend->mod = PM_DEP_MOD_EQ;
*ptr = '\0';
ptr += 1;
} else if((ptr = strstr(newstr, "<"))) {
version = ptr + 1;
} else if((ptr = strstr(depstring, "<"))) {
depend->mod = PM_DEP_MOD_LT;
*ptr = '\0';
ptr += 1;
} else if((ptr = strstr(newstr, ">"))) {
version = ptr + 1;
} else if((ptr = strstr(depstring, ">"))) {
depend->mod = PM_DEP_MOD_GT;
*ptr = '\0';
ptr += 1;
version = ptr + 1;
} else {
/* no version specified - copy the name and return it */
/* no version specified, leave version and ptr NULL */
depend->mod = PM_DEP_MOD_ANY;
STRDUP(depend->name, newstr, RET_ERR(PM_ERR_MEMORY, NULL));
depend->version = NULL;
free(newstr);
return(depend);
}
/* if we get here, we have a version comparator, copy the right parts
* to the right places */
STRDUP(depend->name, newstr, RET_ERR(PM_ERR_MEMORY, NULL));
STRDUP(depend->version, ptr, RET_ERR(PM_ERR_MEMORY, NULL));
free(newstr);
/* copy the right parts to the right places */
STRNDUP(depend->name, depstring, ptr - depstring,
RET_ERR(PM_ERR_MEMORY, NULL));
depend->name_hash = _alpm_hash_sdbm(depend->name);
if(version) {
STRDUP(depend->version, version, RET_ERR(PM_ERR_MEMORY, NULL));
}
return(depend);
}
@@ -424,6 +444,7 @@ pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep)
CALLOC(newdep, 1, sizeof(pmdepend_t), RET_ERR(PM_ERR_MEMORY, NULL));
STRDUP(newdep->name, dep->name, RET_ERR(PM_ERR_MEMORY, NULL));
newdep->name_hash = dep->name_hash;
STRDUP(newdep->version, dep->version, RET_ERR(PM_ERR_MEMORY, NULL));
newdep->mod = dep->mod;
@@ -505,6 +526,28 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit)
}
}
/** Find a package satisfying a specified dependency.
* First look for a literal, going through each db one by one. Then look for
* providers. The first satisfier found is returned.
* The dependency can include versions with depmod operators.
* @param dbs an alpm_list_t* of pmdb_t where the satisfier will be searched
* @param depstring package or provision name, versioned or not
* @return a pmpkg_t* satisfying depstring
*/
pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_list_t *dbs, const char *depstring)
{
pmdepend_t *dep;
pmpkg_t *pkg;
ASSERT(dbs, return(NULL));
dep = _alpm_splitdep(depstring);
ASSERT(dep, return(NULL));
pkg = _alpm_resolvedep(dep, dbs, NULL, 1);
_alpm_dep_free(dep);
return(pkg);
}
/**
* helper function for resolvedeps: search for dep satisfier in dbs
*
@@ -522,10 +565,14 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
{
alpm_list_t *i, *j;
int ignored = 0;
alpm_list_t *providers = NULL;
int count;
/* 1. literals */
for(i = dbs; i; i = i->next) {
pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
if(pkg && alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
if(pkg && _alpm_depcmp_tolerant(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) {
if(_alpm_pkg_should_ignore(pkg)) {
int install = 0;
if (prompt) {
@@ -546,7 +593,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
for(i = dbs; i; i = i->next) {
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
pmpkg_t *pkg = j->data;
if(alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) &&
if(_alpm_depcmp_tolerant(pkg, dep) && strcmp(pkg->name, dep->name) != 0 &&
!_alpm_pkg_find(excluding, pkg->name)) {
if(_alpm_pkg_should_ignore(pkg)) {
int install = 0;
@@ -561,12 +608,40 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
continue;
}
}
_alpm_log(PM_LOG_WARNING, _("provider package was selected (%s provides %s)\n"),
pkg->name, dep->name);
return(pkg);
_alpm_log(PM_LOG_DEBUG, "provider found (%s provides %s)\n",
pkg->name, dep->name);
providers = alpm_list_add(providers, pkg);
/* keep looking for other providers in the all dbs */
}
}
}
/* first check if one provider is already installed locally */
for(i = providers; i; i = i->next) {
pmpkg_t *pkg = i->data;
if (_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) {
alpm_list_free(providers);
return(pkg);
}
}
count = alpm_list_count(providers);
if (count >= 1) {
/* default to first provider if there is no QUESTION callback */
int index = 0;
if(count > 1) {
/* if there is more than one provider, we ask the user */
QUESTION(handle->trans, PM_TRANS_CONV_SELECT_PROVIDER,
providers, dep, NULL, &index);
}
if(index >= 0 && index < count) {
pmpkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index));
alpm_list_free(providers);
return(pkg);
}
alpm_list_free(providers);
providers = NULL;
}
if(ignored) { /* resolvedeps will override these */
pm_errno = PM_ERR_PKG_IGNORED;
} else {
@@ -578,7 +653,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
/* Computes resolvable dependencies for a given package and adds that package
* and those resolvable dependencies to a list.
*
* @param local is the local database
* @param localpkgs is the list of local packages
* @param dbs_sync are the sync databases
* @param pkg is the package to resolve
* @param packages is a pointer to a list of packages which will be
@@ -594,10 +669,11 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
* unresolvable dependency, in which case the [*packages] list will be
* unmodified by this function
*/
int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *pkg,
int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pkg,
alpm_list_t *preferred, alpm_list_t **packages,
alpm_list_t *remove, alpm_list_t **data)
{
int ret = 0;
alpm_list_t *i, *j;
alpm_list_t *targ;
alpm_list_t *deps = NULL;
@@ -605,10 +681,6 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *pkg,
ALPM_LOG_FUNC;
if(local == NULL || dbs_sync == NULL) {
return(-1);
}
if(_alpm_pkg_find(*packages, pkg->name) != NULL) {
return(0);
}
@@ -624,16 +696,20 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *pkg,
for(i = alpm_list_last(*packages); i; i = i->next) {
pmpkg_t *tpkg = i->data;
targ = alpm_list_add(NULL, tpkg);
deps = alpm_checkdeps(_alpm_db_get_pkgcache(local), 0, remove, targ);
deps = alpm_checkdeps(localpkgs, 0, remove, targ);
alpm_list_free(targ);
for(j = deps; j; j = j->next) {
pmdepmissing_t *miss = j->data;
pmdepend_t *missdep = alpm_miss_get_dep(miss);
/* check if one of the packages in the [*packages] list already satisfies this dependency */
/* check if one of the packages in the [*packages] list already satisfies
* this dependency */
if(_alpm_find_dep_satisfier(*packages, missdep)) {
_alpm_depmiss_free(miss);
continue;
}
/* check if one of the packages in the [preferred] list already satisfies this dependency */
/* check if one of the packages in the [preferred] list already satisfies
* this dependency */
pmpkg_t *spkg = _alpm_find_dep_satisfier(preferred, missdep);
if(!spkg) {
/* find a satisfier package in the given repositories */
@@ -642,33 +718,32 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *pkg,
if(!spkg) {
pm_errno = PM_ERR_UNSATISFIED_DEPS;
char *missdepstring = alpm_dep_compute_string(missdep);
_alpm_log(PM_LOG_WARNING, _("cannot resolve \"%s\", a dependency of \"%s\"\n"),
_alpm_log(PM_LOG_WARNING,
_("cannot resolve \"%s\", a dependency of \"%s\"\n"),
missdepstring, tpkg->name);
free(missdepstring);
if(data) {
pmdepmissing_t *missd = _alpm_depmiss_new(miss->target,
miss->depend, miss->causingpkg);
if(missd) {
*data = alpm_list_add(*data, missd);
}
*data = alpm_list_add(*data, miss);
}
alpm_list_free(*packages);
*packages = packages_copy;
alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_depmiss_free);
alpm_list_free(deps);
return(-1);
ret = -1;
} else {
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n",
alpm_pkg_get_name(spkg), alpm_pkg_get_name(tpkg));
*packages = alpm_list_add(*packages, spkg);
_alpm_depmiss_free(miss);
}
}
alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_depmiss_free);
alpm_list_free(deps);
}
alpm_list_free(packages_copy);
if(ret != 0) {
alpm_list_free(*packages);
*packages = packages_copy;
} else {
alpm_list_free(packages_copy);
}
_alpm_log(PM_LOG_DEBUG, "finished resolving dependencies\n");
return(0);
return(ret);
}
/* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */
@@ -676,7 +751,7 @@ int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2)
{
alpm_list_t *i;
for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) {
if(alpm_depcmp(pkg2, i->data)) {
if(_alpm_depcmp_tolerant(pkg2, i->data)) {
return(1);
}
}

View File

@@ -1,7 +1,7 @@
/*
* deps.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
@@ -29,9 +29,10 @@
/* Dependency */
struct __pmdepend_t {
pmdepmod_t mod;
char *name;
char *version;
unsigned long name_hash;
pmdepmod_t mod;
};
/* Missing dependency */
@@ -49,12 +50,14 @@ void _alpm_depmiss_free(pmdepmissing_t *miss);
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int reverse);
void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit);
pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, int prompt);
int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *pkg,
int _alpm_resolvedeps(alpm_list_t *localpkgs, alpm_list_t *dbs_sync, pmpkg_t *pkg,
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
alpm_list_t **data);
int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2);
pmdepend_t *_alpm_splitdep(const char *depstring);
pmpkg_t *_alpm_find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep);
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
int _alpm_depcmp_tolerant(pmpkg_t *pkg, pmdepend_t *dep);
#endif /* _ALPM_DEPS_H */

347
lib/libalpm/diskspace.c Normal file
View File

@@ -0,0 +1,347 @@
/*
* diskspace.c
*
* Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <errno.h>
#if defined(HAVE_MNTENT_H)
#include <mntent.h>
#endif
#if defined(HAVE_SYS_STATVFS_H)
#include <sys/statvfs.h>
#endif
#if defined(HAVE_SYS_PARAM_H)
#include <sys/param.h>
#endif
#if defined(HAVE_SYS_MOUNT_H)
#include <sys/mount.h>
#endif
#if defined(HAVE_SYS_UCRED_H)
#include <sys/ucred.h>
#endif
#if defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#endif
/* libarchive */
#include <archive.h>
#include <archive_entry.h>
/* libalpm */
#include "diskspace.h"
#include "alpm_list.h"
#include "util.h"
#include "log.h"
#include "trans.h"
#include "handle.h"
static int mount_point_cmp(const void *p1, const void *p2)
{
const alpm_mountpoint_t *mp1 = p1;
const alpm_mountpoint_t *mp2 = p2;
/* the negation will sort all mountpoints before their parent */
return(-strcmp(mp1->mount_dir, mp2->mount_dir));
}
static alpm_list_t *mount_point_list(void)
{
alpm_list_t *mount_points = NULL;
alpm_mountpoint_t *mp;
#if defined HAVE_GETMNTENT
struct mntent *mnt;
FILE *fp;
struct statvfs fsp;
fp = setmntent(MOUNTED, "r");
if (fp == NULL) {
return(NULL);
}
while((mnt = getmntent(fp))) {
if(!mnt) {
_alpm_log(PM_LOG_WARNING, _("could not get filesystem information\n"));
continue;
}
if(statvfs(mnt->mnt_dir, &fsp) != 0) {
_alpm_log(PM_LOG_WARNING,
_("could not get filesystem information for %s: %s\n"),
mnt->mnt_dir, strerror(errno));
continue;
}
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
mp->mount_dir = strdup(mnt->mnt_dir);
mp->mount_dir_len = strlen(mp->mount_dir);
memcpy(&(mp->fsp), &fsp, sizeof(struct statvfs));
mp->read_only = fsp.f_flag & ST_RDONLY;
mount_points = alpm_list_add(mount_points, mp);
}
endmntent(fp);
#elif defined HAVE_GETMNTINFO
int entries;
FSSTATSTYPE *fsp;
entries = getmntinfo(&fsp, MNT_NOWAIT);
if (entries < 0) {
return(NULL);
}
for(; entries-- > 0; fsp++) {
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
mp->mount_dir = strdup(fsp->f_mntonname);
mp->mount_dir_len = strlen(mp->mount_dir);
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
#if defined HAVE_STRUCT_STATVFS_F_FLAG
mp->read_only = fsp->f_flag & ST_RDONLY;
#elif defined HAVE_STRUCT_STATFS_F_FLAGS
mp->read_only = fsp->f_flags & MNT_RDONLY;
#endif
mount_points = alpm_list_add(mount_points, mp);
}
#endif
mount_points = alpm_list_msort(mount_points, alpm_list_count(mount_points),
mount_point_cmp);
return(mount_points);
}
static alpm_mountpoint_t *match_mount_point(const alpm_list_t *mount_points,
const char *real_path)
{
const alpm_list_t *mp;
for(mp = mount_points; mp != NULL; mp = mp->next) {
alpm_mountpoint_t *data = mp->data;
if(strncmp(data->mount_dir, real_path, data->mount_dir_len) == 0) {
return(data);
}
}
/* should not get here... */
return(NULL);
}
static int calculate_removed_size(const alpm_list_t *mount_points,
pmpkg_t *pkg)
{
alpm_list_t *file;
alpm_list_t *files = alpm_pkg_get_files(pkg);
for(file = files; file; file = file->next) {
alpm_mountpoint_t *mp;
struct stat st;
char path[PATH_MAX];
const char *filename = file->data;
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
_alpm_lstat(path, &st);
/* skip directories and symlinks to be consistent with libarchive that
* reports them to be zero size */
if(S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode)) {
continue;
}
mp = match_mount_point(mount_points, path);
if(mp == NULL) {
_alpm_log(PM_LOG_WARNING,
_("could not determine mount point for file %s"), filename);
continue;
}
/* the addition of (divisor - 1) performs ceil() with integer division */
mp->blocks_needed -=
(st.st_size + mp->fsp.f_bsize - 1l) / mp->fsp.f_bsize;
mp->used |= USED_REMOVE;
}
return(0);
}
static int calculate_installed_size(const alpm_list_t *mount_points,
pmpkg_t *pkg)
{
int ret=0;
struct archive *archive;
struct archive_entry *entry;
if ((archive = archive_read_new()) == NULL) {
pm_errno = PM_ERR_LIBARCHIVE;
ret = -1;
goto cleanup;
}
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);
if(archive_read_open_filename(archive, pkg->origin_data.file,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
pm_errno = PM_ERR_PKG_OPEN;
ret = -1;
goto cleanup;
}
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
alpm_mountpoint_t *mp;
const char *filename;
mode_t mode;
char path[PATH_MAX];
filename = archive_entry_pathname(entry);
mode = archive_entry_mode(entry);
/* libarchive reports these as zero size anyways */
/* NOTE: if we do start accounting for directory size, a dir matching a
* mountpoint needs to be attributed to the parent, not the mountpoint. */
if(S_ISDIR(mode) || S_ISLNK(mode)) {
continue;
}
/* approximate space requirements for db entries */
if(filename[0] == '.') {
filename = alpm_option_get_dbpath();
}
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
mp = match_mount_point(mount_points, path);
if(mp == NULL) {
_alpm_log(PM_LOG_WARNING,
_("could not determine mount point for file %s"), filename);
continue;
}
/* the addition of (divisor - 1) performs ceil() with integer division */
mp->blocks_needed +=
(archive_entry_size(entry) + mp->fsp.f_bsize - 1l) / mp->fsp.f_bsize;
mp->used |= USED_INSTALL;
if(archive_read_data_skip(archive)) {
_alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s\n"),
pkg->name, archive_error_string(archive));
pm_errno = PM_ERR_LIBARCHIVE;
break;
}
}
archive_read_finish(archive);
cleanup:
return(ret);
}
int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local)
{
alpm_list_t *mount_points, *i;
size_t replaces = 0, current = 0, numtargs;
int abort = 0;
alpm_list_t *targ;
numtargs = alpm_list_count(trans->add);
mount_points = mount_point_list();
if(mount_points == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not determine filesystem mount points"));
return(-1);
}
replaces = alpm_list_count(trans->remove);
if(replaces) {
numtargs += replaces;
for(targ = trans->remove; targ; targ = targ->next, current++) {
pmpkg_t *local_pkg;
int percent = (current * 100) / numtargs;
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
numtargs, current);
local_pkg = targ->data;
calculate_removed_size(mount_points, local_pkg);
}
}
for(targ = trans->add; targ; targ = targ->next, current++) {
pmpkg_t *pkg, *local_pkg;
int percent = (current * 100) / numtargs;
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent,
numtargs, current);
pkg = targ->data;
/* is this package already installed? */
local_pkg = _alpm_db_get_pkgfromcache(db_local, pkg->name);
if(local_pkg) {
calculate_removed_size(mount_points, local_pkg);
}
calculate_installed_size(mount_points, pkg);
for(i = mount_points; i; i = alpm_list_next(i)) {
alpm_mountpoint_t *data = i->data;
if(data->blocks_needed > data->max_blocks_needed) {
data->max_blocks_needed = data->blocks_needed;
}
}
}
PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", 100,
numtargs, current);
for(i = mount_points; i; i = alpm_list_next(i)) {
alpm_mountpoint_t *data = i->data;
if(data->used && data->read_only) {
_alpm_log(PM_LOG_ERROR, _("Partition %s is mounted read only\n"),
data->mount_dir);
abort = 1;
} else if(data->used & USED_INSTALL) {
/* cushion is roughly min(5% capacity, 20MiB) */
long fivepc = ((long)data->fsp.f_blocks / 20) + 1;
long twentymb = (20 * 1024 * 1024 / (long)data->fsp.f_bsize) + 1;
long cushion = fivepc < twentymb ? fivepc : twentymb;
_alpm_log(PM_LOG_DEBUG, "partition %s, needed %ld, cushion %ld, free %ld\n",
data->mount_dir, data->max_blocks_needed, cushion,
(unsigned long)data->fsp.f_bfree);
if(data->max_blocks_needed + cushion >= 0 &&
(unsigned long)(data->max_blocks_needed + cushion) > data->fsp.f_bfree) {
_alpm_log(PM_LOG_ERROR, _("Partition %s too full: %ld blocks needed, %ld blocks free\n"),
data->mount_dir, data->max_blocks_needed + cushion,
(unsigned long)data->fsp.f_bfree);
abort = 1;
}
}
}
for(i = mount_points; i; i = alpm_list_next(i)) {
alpm_mountpoint_t *data = i->data;
FREE(data->mount_dir);
}
FREELIST(mount_points);
if(abort) {
RET_ERR(PM_ERR_DISK_SPACE, -1);
}
return(0);
}
/* vim: set ts=2 sw=2 noet: */

53
lib/libalpm/diskspace.h Normal file
View File

@@ -0,0 +1,53 @@
/*
* diskspace.h
*
* Copyright (c) 2010-2011 Pacman Development Team <pacman-dev@archlinux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ALPM_DISKSPACE_H
#define _ALPM_DISKSPACE_H
#if defined(HAVE_SYS_MOUNT_H)
#include <sys/mount.h>
#endif
#if defined(HAVE_SYS_STATVFS_H)
#include <sys/statvfs.h>
#endif
#include "alpm.h"
enum mount_used_level {
USED_REMOVE = 1,
USED_INSTALL = (1 << 1),
};
typedef struct __alpm_mountpoint_t {
/* mount point information */
char *mount_dir;
size_t mount_dir_len;
/* storage for additional disk usage calculations */
long blocks_needed;
long max_blocks_needed;
enum mount_used_level used;
int read_only;
FSSTATSTYPE fsp;
} alpm_mountpoint_t;
int _alpm_check_diskspace(pmtrans_t *trans, pmdb_t *db_local);
#endif /* _ALPM_DISKSPACE_H */
/* vim: set ts=2 sw=2 noet: */

View File

@@ -1,7 +1,7 @@
/*
* download.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -25,17 +25,17 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <limits.h>
/* the following two are needed on BSD for libfetch */
#if defined(HAVE_SYS_SYSLIMITS_H)
#include <sys/syslimits.h> /* PATH_MAX */
#endif
/* the following two are needed for FreeBSD's libfetch */
#include <limits.h> /* PATH_MAX */
#if defined(HAVE_SYS_PARAM_H)
#include <sys/param.h> /* MAXHOSTNAMELEN */
#endif
#if defined(INTERNAL_DOWNLOAD)
#ifdef HAVE_LIBFETCH
#include <fetch.h>
#endif
@@ -55,11 +55,11 @@ static char *get_filename(const char *url) {
return(filename);
}
#if defined(INTERNAL_DOWNLOAD)
#ifdef HAVE_LIBFETCH
static char *get_destfile(const char *path, const char *filename) {
char *destfile;
/* len = localpath len + filename len + null */
int len = strlen(path) + strlen(filename) + 1;
size_t len = strlen(path) + strlen(filename) + 1;
CALLOC(destfile, len, sizeof(char), RET_ERR(PM_ERR_MEMORY, NULL));
snprintf(destfile, len, "%s%s", path, filename);
@@ -69,37 +69,13 @@ static char *get_destfile(const char *path, const char *filename) {
static char *get_tempfile(const char *path, const char *filename) {
char *tempfile;
/* len = localpath len + filename len + '.part' len + null */
int len = strlen(path) + strlen(filename) + 6;
size_t len = strlen(path) + strlen(filename) + 6;
CALLOC(tempfile, len, sizeof(char), RET_ERR(PM_ERR_MEMORY, NULL));
snprintf(tempfile, len, "%s%s.part", path, filename);
return(tempfile);
}
/* Build a 'struct url' from an url. */
static struct url *url_for_string(const char *url)
{
struct url *ret = NULL;
ret = fetchParseURL(url);
if(!ret) {
_alpm_log(PM_LOG_ERROR, _("url '%s' is invalid\n"), url);
RET_ERR(PM_ERR_SERVER_BAD_URL, NULL);
}
/* if no URL scheme specified, assume HTTP */
if(strlen(ret->scheme) == 0) {
_alpm_log(PM_LOG_WARNING, _("url scheme not specified, assuming HTTP\n"));
strcpy(ret->scheme, SCHEME_HTTP);
}
/* add a user & password for anonymous FTP */
if(strcmp(ret->scheme,SCHEME_FTP) == 0 && strlen(ret->user) == 0) {
strcpy(ret->user, "anonymous");
strcpy(ret->pwd, "libalpm@guest");
}
return(ret);
}
static const char *gethost(struct url *fileurl)
{
const char *host = _("disk");
@@ -109,75 +85,134 @@ static const char *gethost(struct url *fileurl)
return(host);
}
int dload_interrupted;
static void inthandler(int signum)
{
dload_interrupted = 1;
}
#define check_stop() if(dload_interrupted) { ret = -1; goto cleanup; }
enum sighandlers { OLD = 0, NEW = 1 };
static int download_internal(const char *url, const char *localpath,
time_t mtimeold, time_t *mtimenew) {
fetchIO *dlf = NULL;
int force) {
FILE *localf = NULL;
struct url_stat ust;
struct stat st;
int chk_resume = 0, ret = 0;
size_t dl_thisfile = 0;
int ret = 0;
off_t dl_thisfile = 0;
ssize_t nread = 0;
char *tempfile, *destfile, *filename;
struct sigaction new_action, old_action;
struct url *fileurl = url_for_string(url);
char buffer[PM_DLBUF_LEN];
struct sigaction sig_pipe[2], sig_int[2];
if(!fileurl) {
return(-1);
}
off_t local_size = 0;
time_t local_time = 0;
struct url *fileurl;
struct url_stat ust;
fetchIO *dlf = NULL;
char buffer[PM_DLBUF_LEN];
filename = get_filename(url);
if(!filename) {
return(-1);
_alpm_log(PM_LOG_ERROR, _("url '%s' is invalid\n"), url);
RET_ERR(PM_ERR_SERVER_BAD_URL, -1);
}
fileurl = fetchParseURL(url);
if(!fileurl) {
_alpm_log(PM_LOG_ERROR, _("url '%s' is invalid\n"), url);
RET_ERR(PM_ERR_LIBFETCH, -1);
}
destfile = get_destfile(localpath, filename);
tempfile = get_tempfile(localpath, filename);
if(mtimeold) {
fileurl->last_modified = mtimeold;
if(stat(tempfile, &st) == 0 && S_ISREG(st.st_mode) && st.st_size > 0) {
_alpm_log(PM_LOG_DEBUG, "tempfile found, attempting continuation\n");
local_time = fileurl->last_modified = st.st_mtime;
local_size = fileurl->offset = (off_t)st.st_size;
dl_thisfile = st.st_size;
localf = fopen(tempfile, "ab");
} else if(!force && stat(destfile, &st) == 0 && S_ISREG(st.st_mode) && st.st_size > 0) {
_alpm_log(PM_LOG_DEBUG, "destfile found, using mtime only\n");
local_time = fileurl->last_modified = st.st_mtime;
local_size = /* no fu->off here */ (off_t)st.st_size;
} else {
_alpm_log(PM_LOG_DEBUG, "no file found matching criteria, starting from scratch\n");
}
/* pass the raw filename for passing to the callback function */
_alpm_log(PM_LOG_DEBUG, "using '%s' for download progress\n", filename);
if(stat(tempfile, &st) == 0 && st.st_size > 0) {
_alpm_log(PM_LOG_DEBUG, "existing file found, using it\n");
fileurl->offset = (off_t)st.st_size;
dl_thisfile = st.st_size;
localf = fopen(tempfile, "ab");
chk_resume = 1;
} else {
fileurl->offset = (off_t)0;
dl_thisfile = 0;
}
/* print proxy info for debug purposes */
_alpm_log(PM_LOG_DEBUG, "HTTP_PROXY: %s\n", getenv("HTTP_PROXY"));
_alpm_log(PM_LOG_DEBUG, "http_proxy: %s\n", getenv("http_proxy"));
_alpm_log(PM_LOG_DEBUG, "FTP_PROXY: %s\n", getenv("FTP_PROXY"));
_alpm_log(PM_LOG_DEBUG, "ftp_proxy: %s\n", getenv("ftp_proxy"));
/* libfetch does not reset the error code */
fetchLastErrCode = 0;
/* 10s timeout */
fetchTimeout = 10;
/* ignore any SIGPIPE signals- these may occur if our FTP socket dies or
* something along those lines. Store the old signal handler first. */
new_action.sa_handler = SIG_IGN;
sigemptyset(&new_action.sa_mask);
sigaction(SIGPIPE, NULL, &old_action);
sigaction(SIGPIPE, &new_action, NULL);
sig_pipe[NEW].sa_handler = SIG_IGN;
sigemptyset(&sig_pipe[NEW].sa_mask);
sig_pipe[NEW].sa_flags = 0;
sigaction(SIGPIPE, NULL, &sig_pipe[OLD]);
sigaction(SIGPIPE, &sig_pipe[NEW], NULL);
dlf = fetchXGet(fileurl, &ust, (handle->nopassiveftp ? "i" : "pi"));
dload_interrupted = 0;
sig_int[NEW].sa_handler = &inthandler;
sigemptyset(&sig_int[NEW].sa_mask);
sig_int[NEW].sa_flags = 0;
sigaction(SIGINT, NULL, &sig_int[OLD]);
sigaction(SIGINT, &sig_int[NEW], NULL);
if(fetchLastErrCode == FETCH_UNCHANGED) {
_alpm_log(PM_LOG_DEBUG, "mtimes are identical, skipping %s\n", filename);
/* NOTE: libfetch does not reset the error code, be sure to do it before
* calls into the library */
/* TODO: if we call fetchStat() and get a redirect (disabling automagic
* redirect following), we should repeat the file locator stuff and get a new
* filename rather than only base if off the first URL, and then verify
* get_filename() didn't return ''. Of course, libfetch might not even allow
* us to even get that URL...FS#22645. This would allow us to download things
* without totally puking like
* http://www.archlinux.org/packages/community/x86_64/exim/download/ */
/* find out the remote size *and* mtime in one go. there is a lot of
* trouble in trying to do both size and "if-modified-since" logic in a
* non-stat request, so avoid it. */
fetchLastErrCode = 0;
if(fetchStat(fileurl, &ust, "") == -1) {
pm_errno = PM_ERR_LIBFETCH;
_alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
filename, gethost(fileurl), fetchLastErrString);
ret = -1;
goto cleanup;
}
check_stop();
_alpm_log(PM_LOG_DEBUG, "ust.mtime: %ld local_time: %ld compare: %ld\n",
ust.mtime, local_time, local_time - ust.mtime);
_alpm_log(PM_LOG_DEBUG, "ust.size: %jd local_size: %jd compare: %jd\n",
(intmax_t)ust.size, (intmax_t)local_size, (intmax_t)(local_size - ust.size));
if(!force && ust.mtime && ust.mtime == local_time
&& ust.size && ust.size == local_size) {
/* the remote time and size values agreed with what we have, so move on
* because there is nothing more to do. */
_alpm_log(PM_LOG_DEBUG, "files are identical, skipping %s\n", filename);
ret = 1;
goto cleanup;
}
if(!ust.mtime || ust.mtime != local_time) {
_alpm_log(PM_LOG_DEBUG, "mtimes were different or unavailable, downloading %s from beginning\n", filename);
fileurl->offset = 0;
}
fetchLastErrCode = 0;
dlf = fetchGet(fileurl, "");
check_stop();
if(fetchLastErrCode != 0 || dlf == NULL) {
pm_errno = PM_ERR_LIBFETCH;
@@ -189,17 +224,14 @@ static int download_internal(const char *url, const char *localpath,
_alpm_log(PM_LOG_DEBUG, "connected to %s successfully\n", fileurl->host);
}
if(ust.mtime && mtimenew) {
*mtimenew = ust.mtime;
if(localf && fileurl->offset == 0) {
_alpm_log(PM_LOG_WARNING, _("resuming download of %s not possible; starting over\n"), filename);
fclose(localf);
localf = NULL;
} else if(fileurl->offset) {
_alpm_log(PM_LOG_DEBUG, "resuming download at position %jd\n", (intmax_t)fileurl->offset);
}
if(chk_resume && fileurl->offset == 0) {
_alpm_log(PM_LOG_WARNING, _("cannot resume download, starting over\n"));
if(localf != NULL) {
fclose(localf);
localf = NULL;
}
}
if(localf == NULL) {
_alpm_rmrf(tempfile);
@@ -207,7 +239,9 @@ static int download_internal(const char *url, const char *localpath,
dl_thisfile = 0;
localf = fopen(tempfile, "wb");
if(localf == NULL) { /* still null? */
_alpm_log(PM_LOG_ERROR, _("cannot write to file '%s'\n"), tempfile);
pm_errno = PM_ERR_RETRIEVE;
_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"),
tempfile, strerror(errno));
ret = -1;
goto cleanup;
}
@@ -219,15 +253,15 @@ static int download_internal(const char *url, const char *localpath,
}
while((nread = fetchIO_read(dlf, buffer, PM_DLBUF_LEN)) > 0) {
check_stop();
size_t nwritten = 0;
while(nwritten < nread) {
nwritten += fwrite(buffer, 1, (nread - nwritten), localf);
if(ferror(localf)) {
_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"),
destfile, strerror(errno));
ret = -1;
goto cleanup;
}
nwritten = fwrite(buffer, 1, (size_t)nread, localf);
if((nwritten != (size_t)nread) || ferror(localf)) {
pm_errno = PM_ERR_RETRIEVE;
_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"),
tempfile, strerror(errno));
ret = -1;
goto cleanup;
}
dl_thisfile += nread;
@@ -262,36 +296,64 @@ static int download_internal(const char *url, const char *localpath,
fetchIO_close(dlf);
dlf = NULL;
rename(tempfile, destfile);
/* set the times on the file to the same as that of the remote file */
if(ust.mtime) {
struct timeval tv[2];
memset(&tv, 0, sizeof(tv));
tv[0].tv_sec = ust.atime;
tv[1].tv_sec = ust.mtime;
utimes(tempfile, tv);
}
if(rename(tempfile, destfile)) {
_alpm_log(PM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
tempfile, destfile, strerror(errno));
ret = -1;
}
ret = 0;
cleanup:
/* restore any existing SIGPIPE signal handler */
sigaction(SIGPIPE, &old_action, NULL);
FREE(tempfile);
FREE(destfile);
if(localf != NULL) {
/* if we still had a local file open, we got interrupted. set the mtimes on
* the file accordingly. */
fflush(localf);
if(ust.mtime) {
struct timeval tv[2];
memset(&tv, 0, sizeof(tv));
tv[0].tv_sec = ust.atime;
tv[1].tv_sec = ust.mtime;
futimes(fileno(localf), tv);
}
fclose(localf);
}
if(dlf != NULL) {
fetchIO_close(dlf);
}
fetchFreeURL(fileurl);
/* restore the old signal handlers */
sigaction(SIGINT, &sig_int[OLD], NULL);
sigaction(SIGPIPE, &sig_pipe[OLD], NULL);
/* if we were interrupted, trip the old handler */
if(dload_interrupted) {
raise(SIGINT);
}
return(ret);
}
#endif
static int download(const char *url, const char *localpath,
time_t mtimeold, time_t *mtimenew) {
int force) {
if(handle->fetchcb == NULL) {
#if defined(INTERNAL_DOWNLOAD)
return(download_internal(url, localpath, mtimeold, mtimenew));
#ifdef HAVE_LIBFETCH
return(download_internal(url, localpath, force));
#else
RET_ERR(PM_ERR_EXTERNAL_DOWNLOAD, -1);
#endif
} else {
int ret = handle->fetchcb(url, localpath, mtimeold, mtimenew);
int ret = handle->fetchcb(url, localpath, force);
if(ret == -1) {
RET_ERR(PM_ERR_EXTERNAL_DOWNLOAD, -1);
}
@@ -301,19 +363,15 @@ static int download(const char *url, const char *localpath,
/*
* Download a single file
* - if mtimeold is non-NULL, then only download the file if it's different
* than mtimeold.
* - if *mtimenew is non-NULL, it will be filled with the mtime of the remote
* file.
* - servers must be a list of urls WITHOUT trailing slashes.
*
* RETURN: 0 for successful download
* 1 if the mtimes are identical
* 1 if the files are identical
* -1 on error
*/
int _alpm_download_single_file(const char *filename,
alpm_list_t *servers, const char *localpath,
time_t mtimeold, time_t *mtimenew)
int force)
{
alpm_list_t *i;
int ret = -1;
@@ -323,14 +381,14 @@ int _alpm_download_single_file(const char *filename,
for(i = servers; i; i = i->next) {
const char *server = i->data;
char *fileurl = NULL;
int len;
size_t len;
/* print server + filename into a buffer */
len = strlen(server) + strlen(filename) + 2;
CALLOC(fileurl, len, sizeof(char), RET_ERR(PM_ERR_MEMORY, -1));
snprintf(fileurl, len, "%s/%s", server, filename);
ret = download(fileurl, localpath, mtimeold, mtimenew);
ret = download(fileurl, localpath, force);
FREE(fileurl);
if(ret != -1) {
break;
@@ -349,7 +407,7 @@ int _alpm_download_files(alpm_list_t *files,
for(lp = files; lp; lp = lp->next) {
char *filename = lp->data;
if(_alpm_download_single_file(filename, servers,
localpath, 0, NULL) == -1) {
localpath, 0) == -1) {
ret++;
}
}
@@ -376,7 +434,7 @@ char SYMEXPORT *alpm_fetch_pkgurl(const char *url)
cachedir = _alpm_filecache_setup();
/* download the file */
ret = download(url, cachedir, 0, NULL);
ret = download(url, cachedir, 0);
if(ret == -1) {
_alpm_log(PM_LOG_WARNING, _("failed to download %s\n"), url);
return(NULL);

View File

@@ -1,7 +1,7 @@
/*
* dload.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -25,11 +25,11 @@
#include <time.h>
#define PM_DLBUF_LEN (1024 * 10)
#define PM_DLBUF_LEN (1024 * 16)
int _alpm_download_single_file(const char *filename,
alpm_list_t *servers, const char *localpath,
time_t mtimeold, time_t *mtimenew);
int force);
int _alpm_download_files(alpm_list_t *files,
alpm_list_t *servers, const char *localpath);

View File

@@ -1,7 +1,7 @@
/*
* error.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -22,16 +22,13 @@
/* TODO: needed for the libfetch stuff, unfortunately- we should kill it */
#include <stdio.h>
#include <limits.h>
/* the following two are needed on BSD for libfetch */
#if defined(HAVE_SYS_SYSLIMITS_H)
#include <sys/syslimits.h> /* PATH_MAX */
#endif
/* the following two are needed for FreeBSD's libfetch */
#include <limits.h> /* PATH_MAX */
#if defined(HAVE_SYS_PARAM_H)
#include <sys/param.h> /* MAXHOSTNAMELEN */
#endif
#if defined(INTERNAL_DOWNLOAD)
#ifdef HAVE_LIBFETCH
#include <fetch.h> /* fetchLastErrString */
#endif
@@ -60,6 +57,8 @@ const char SYMEXPORT *alpm_strerror(int err)
return _("could not find or read directory");
case PM_ERR_WRONG_ARGS:
return _("wrong or NULL argument passed");
case PM_ERR_DISK_SPACE:
return _("not enough free disk space");
/* Interface */
case PM_ERR_HANDLE_NULL:
return _("library not initialized");
@@ -78,6 +77,8 @@ const char SYMEXPORT *alpm_strerror(int err)
return _("database already registered");
case PM_ERR_DB_NOT_FOUND:
return _("could not find database");
case PM_ERR_DB_VERSION:
return _("database is incorrect version");
case PM_ERR_DB_WRITE:
return _("could not update database");
case PM_ERR_DB_REMOVE:
@@ -117,8 +118,10 @@ const char SYMEXPORT *alpm_strerror(int err)
return _("cannot remove all files for package");
case PM_ERR_PKG_INVALID_NAME:
return _("package filename is not valid");
case PM_ERR_PKG_INVALID_ARCH:
return _("package architecture is not valid");
case PM_ERR_PKG_REPO_NOT_FOUND:
return _("no such repository");
return _("could not find repository for target");
/* Deltas */
case PM_ERR_DLT_INVALID:
return _("invalid or corrupted delta");
@@ -134,6 +137,8 @@ const char SYMEXPORT *alpm_strerror(int err)
/* Miscellaenous */
case PM_ERR_RETRIEVE:
return _("failed to retrieve some files");
case PM_ERR_WRITE:
return _("failed to copy some file");
case PM_ERR_INVALID_REGEX:
return _("invalid regular expression");
/* Errors from external libraries- our own wrapper error */
@@ -143,7 +148,7 @@ const char SYMEXPORT *alpm_strerror(int err)
* error string instead. */
return _("libarchive error");
case PM_ERR_LIBFETCH:
#if defined(INTERNAL_DOWNLOAD)
#ifdef HAVE_LIBFETCH
return fetchLastErrString;
#else
/* obviously shouldn't get here... */

View File

@@ -1,7 +1,7 @@
/*
* graph.h - helpful graph structure and setup/teardown methods
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -21,8 +21,7 @@
#include <sys/types.h> /* off_t */
#include "alpm_list.h"
#include "util.h" /* MALLOC() */
#include "alpm.h"
#include "util.h" /* CALLOC() */
struct __pmgraph_t {
char state; /* 0: untouched, -1: entered, other: leaving time */
@@ -38,15 +37,7 @@ static pmgraph_t *_alpm_graph_new(void)
{
pmgraph_t *graph = NULL;
MALLOC(graph, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL));
if(graph) {
graph->state = 0;
graph->data = NULL;
graph->parent = NULL;
graph->children = NULL;
graph->childptr = NULL;
}
CALLOC(graph, 1, sizeof(pmgraph_t), RET_ERR(PM_ERR_MEMORY, NULL));
return(graph);
}

View File

@@ -1,7 +1,7 @@
/*
* group.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* group.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/*
* handle.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
@@ -49,7 +49,6 @@ pmhandle_t *_alpm_handle_new()
ALPM_LOG_FUNC;
CALLOC(handle, 1, sizeof(pmhandle_t), RET_ERR(PM_ERR_MEMORY, NULL));
handle->lckfd = -1;
return(handle);
}
@@ -79,6 +78,7 @@ void _alpm_handle_free(pmhandle_t *handle)
FREELIST(handle->cachedirs);
FREE(handle->logfile);
FREE(handle->lockfile);
FREE(handle->arch);
FREELIST(handle->dbs_sync);
FREELIST(handle->noupgrade);
FREELIST(handle->noextract);
@@ -168,7 +168,7 @@ const char SYMEXPORT *alpm_option_get_lockfile()
return handle->lockfile;
}
unsigned short SYMEXPORT alpm_option_get_usesyslog()
int SYMEXPORT alpm_option_get_usesyslog()
{
if (handle == NULL) {
pm_errno = PM_ERR_HANDLE_NULL;
@@ -213,13 +213,31 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps()
return handle->ignoregrp;
}
unsigned short SYMEXPORT alpm_option_get_nopassiveftp()
const char SYMEXPORT *alpm_option_get_arch()
{
if (handle == NULL) {
pm_errno = PM_ERR_HANDLE_NULL;
return NULL;
}
return handle->arch;
}
int SYMEXPORT alpm_option_get_usedelta()
{
if (handle == NULL) {
pm_errno = PM_ERR_HANDLE_NULL;
return -1;
}
return handle->nopassiveftp;
return handle->usedelta;
}
int SYMEXPORT alpm_option_get_checkspace()
{
if (handle == NULL) {
pm_errno = PM_ERR_HANDLE_NULL;
return -1;
}
return handle->checkspace;
}
pmdb_t SYMEXPORT *alpm_option_get_localdb()
@@ -436,7 +454,7 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile)
return(0);
}
void SYMEXPORT alpm_option_set_usesyslog(unsigned short usesyslog)
void SYMEXPORT alpm_option_set_usesyslog(int usesyslog)
{
handle->usesyslog = usesyslog;
}
@@ -529,14 +547,20 @@ int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
return(0);
}
void SYMEXPORT alpm_option_set_nopassiveftp(unsigned short nopasv)
void SYMEXPORT alpm_option_set_arch(const char *arch)
{
handle->nopassiveftp = nopasv;
if(handle->arch) FREE(handle->arch);
if(arch) handle->arch = strdup(arch);
}
void SYMEXPORT alpm_option_set_usedelta(unsigned short usedelta)
void SYMEXPORT alpm_option_set_usedelta(int usedelta)
{
handle->usedelta = usedelta;
}
void SYMEXPORT alpm_option_set_checkspace(int checkspace)
{
handle->checkspace = checkspace;
}
/* vim: set ts=2 sw=2 noet: */

View File

@@ -1,7 +1,7 @@
/*
* handle.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,7 @@ typedef struct _pmhandle_t {
pmdb_t *db_local; /* local db pointer */
alpm_list_t *dbs_sync; /* List of (pmdb_t *) */
FILE *logstream; /* log file stream pointer */
int lckfd; /* lock file descriptor if one exists */
FILE *lckstream; /* lock file stream pointer if one exists */
pmtrans_t *trans;
/* callback functions */
@@ -57,15 +57,16 @@ typedef struct _pmhandle_t {
alpm_list_t *ignoregrp; /* List of groups to ignore */
/* options */
unsigned short usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
unsigned short nopassiveftp; /* Don't use PASV ftp connections */
unsigned short usedelta; /* Download deltas if possible */
int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */
char *arch; /* Architecture of packages we should allow */
int usedelta; /* Download deltas if possible */
int checkspace; /* Check disk space before installing */
} pmhandle_t;
/* global handle variable */
extern pmhandle_t *handle;
pmhandle_t *_alpm_handle_new();
pmhandle_t *_alpm_handle_new(void);
void _alpm_handle_free(pmhandle_t *handle);
#endif /* _ALPM_HANDLE_H */

View File

@@ -1,7 +1,7 @@
/*
* log.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -42,7 +42,7 @@
* @param fmt output format
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int SYMEXPORT alpm_logaction(char *fmt, ...)
int SYMEXPORT alpm_logaction(const char *fmt, ...)
{
int ret;
va_list args;
@@ -88,7 +88,7 @@ int SYMEXPORT alpm_logaction(char *fmt, ...)
/** @} */
void _alpm_log(pmloglevel_t flag, char *fmt, ...)
void _alpm_log(pmloglevel_t flag, const char *fmt, ...)
{
va_list args;
alpm_cb_log logcb = alpm_option_get_logcb();

View File

@@ -1,7 +1,7 @@
/*
* log.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@
#define ALPM_LOG_FUNC
#endif
void _alpm_log(pmloglevel_t flag, char *fmt, ...) __attribute__((format(printf,2,3)));
void _alpm_log(pmloglevel_t flag, const char *fmt, ...) __attribute__((format(printf,2,3)));
#endif /* _ALPM_LOG_H */

View File

@@ -36,11 +36,17 @@
* int md5_file( char *path, unsigned char *output )
* to
* int md5_file( const char *path, unsigned char *output )
* * use a dynamically-allocated buffer in md5_file, and increase the size
* for performance reasons
* * various static/inline changes
*
* NOTE: XySSL has been renamed to PolarSSL, which is available at
* www.polarssl.org. If we update, we should get it from there.
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "md5.h"
@@ -306,11 +312,16 @@ int md5_file( const char *path, unsigned char output[16] )
FILE *f;
size_t n;
md5_context ctx;
unsigned char buf[1024];
unsigned char *buf;
if( ( f = fopen( path, "rb" ) ) == NULL )
if( ( buf = calloc(8192, sizeof(unsigned char)) ) == NULL )
return( 1 );
if( ( f = fopen( path, "rb" ) ) == NULL ) {
free( buf );
return( 1 );
}
md5_starts( &ctx );
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
@@ -319,6 +330,7 @@ int md5_file( const char *path, unsigned char output[16] )
md5_finish( &ctx, output );
memset( &ctx, 0, sizeof( md5_context ) );
free( buf );
if( ferror( f ) != 0 )
{

View File

@@ -1,7 +1,7 @@
/*
* package.c
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005, 2006 by Christian Hamar <krics@linuxforum.hu>
@@ -25,24 +25,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
/* libarchive */
#include <archive.h>
#include <archive_entry.h>
/* libalpm */
#include "package.h"
#include "alpm_list.h"
#include "log.h"
#include "util.h"
#include "db.h"
#include "cache.h"
#include "delta.h"
#include "handle.h"
#include "deps.h"
@@ -63,7 +57,7 @@ int SYMEXPORT alpm_pkg_free(pmpkg_t *pkg)
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
/* Only free packages loaded in user space */
if(pkg->origin != PKG_FROM_CACHE) {
if(pkg->origin == PKG_FROM_FILE) {
_alpm_pkg_free(pkg);
}
@@ -83,8 +77,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg)
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
/* We only inspect packages from sync repositories */
ASSERT(pkg->origin == PKG_FROM_CACHE, RET_ERR(PM_ERR_PKG_INVALID, -1));
ASSERT(pkg->origin_data.db != handle->db_local, RET_ERR(PM_ERR_PKG_INVALID, -1));
ASSERT(pkg->origin == PKG_FROM_SYNCDB, RET_ERR(PM_ERR_PKG_INVALID, -1));
fpath = _alpm_filecache_find(alpm_pkg_get_filename(pkg));
@@ -100,341 +93,189 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg)
return(retval);
}
/* Default package accessor functions. These will get overridden by any
* backend logic that needs lazy access, such as the local database through
* a lazy-load cache. However, the defaults will work just fine for fully-
* populated package structures. */
static const char *_pkg_get_filename(pmpkg_t *pkg) { return pkg->filename; }
static const char *_pkg_get_name(pmpkg_t *pkg) { return pkg->name; }
static const char *_pkg_get_version(pmpkg_t *pkg) { return pkg->version; }
static const char *_pkg_get_desc(pmpkg_t *pkg) { return pkg->desc; }
static const char *_pkg_get_url(pmpkg_t *pkg) { return pkg->url; }
static time_t _pkg_get_builddate(pmpkg_t *pkg) { return pkg->builddate; }
static time_t _pkg_get_installdate(pmpkg_t *pkg) { return pkg->installdate; }
static const char *_pkg_get_packager(pmpkg_t *pkg) { return pkg->packager; }
static const char *_pkg_get_md5sum(pmpkg_t *pkg) { return pkg->md5sum; }
static const char *_pkg_get_arch(pmpkg_t *pkg) { return pkg->arch; }
static off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; }
static off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; }
static pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; }
static int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; }
static alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; }
static alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; }
static alpm_list_t *_pkg_get_depends(pmpkg_t *pkg) { return pkg->depends; }
static alpm_list_t *_pkg_get_optdepends(pmpkg_t *pkg) { return pkg->optdepends; }
static alpm_list_t *_pkg_get_conflicts(pmpkg_t *pkg) { return pkg->conflicts; }
static alpm_list_t *_pkg_get_provides(pmpkg_t *pkg) { return pkg->provides; }
static alpm_list_t *_pkg_get_replaces(pmpkg_t *pkg) { return pkg->replaces; }
static alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; }
static alpm_list_t *_pkg_get_files(pmpkg_t *pkg) { return pkg->files; }
static alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; }
/** The standard package operations struct. Get fields directly from the
* struct itself with no abstraction layer or any type of lazy loading.
*/
struct pkg_operations default_pkg_ops = {
.get_filename = _pkg_get_filename,
.get_name = _pkg_get_name,
.get_version = _pkg_get_version,
.get_desc = _pkg_get_desc,
.get_url = _pkg_get_url,
.get_builddate = _pkg_get_builddate,
.get_installdate = _pkg_get_installdate,
.get_packager = _pkg_get_packager,
.get_md5sum = _pkg_get_md5sum,
.get_arch = _pkg_get_arch,
.get_size = _pkg_get_size,
.get_isize = _pkg_get_isize,
.get_reason = _pkg_get_reason,
.has_scriptlet = _pkg_has_scriptlet,
.get_licenses = _pkg_get_licenses,
.get_groups = _pkg_get_groups,
.get_depends = _pkg_get_depends,
.get_optdepends = _pkg_get_optdepends,
.get_conflicts = _pkg_get_conflicts,
.get_provides = _pkg_get_provides,
.get_replaces = _pkg_get_replaces,
.get_deltas = _pkg_get_deltas,
.get_files = _pkg_get_files,
.get_backup = _pkg_get_backup,
};
/* Public functions for getting package information. These functions
* delegate the hard work to the function callbacks attached to each
* package, which depend on where the package was loaded from. */
const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->filename;
return pkg->ops->get_filename(pkg);
}
const char SYMEXPORT *alpm_pkg_get_name(pmpkg_t *pkg)
{
ASSERT(pkg != NULL, return(NULL));
return pkg->name;
return pkg->ops->get_name(pkg);
}
const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg)
{
ASSERT(pkg != NULL, return(NULL));
return pkg->version;
return pkg->ops->get_version(pkg);
}
const char SYMEXPORT *alpm_pkg_get_desc(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->desc;
return pkg->ops->get_desc(pkg);
}
const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->url;
return pkg->ops->get_url(pkg);
}
time_t SYMEXPORT alpm_pkg_get_builddate(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(0));
ASSERT(pkg != NULL, return(0));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->builddate;
return pkg->ops->get_builddate(pkg);
}
time_t SYMEXPORT alpm_pkg_get_installdate(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(0));
ASSERT(pkg != NULL, return(0));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->installdate;
return pkg->ops->get_installdate(pkg);
}
const char SYMEXPORT *alpm_pkg_get_packager(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->packager;
return pkg->ops->get_packager(pkg);
}
const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->md5sum;
return pkg->ops->get_md5sum(pkg);
}
const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->arch;
return pkg->ops->get_arch(pkg);
}
off_t SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
ASSERT(pkg != NULL, return(-1));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->size;
return pkg->ops->get_size(pkg);
}
off_t SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
ASSERT(pkg != NULL, return(-1));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->isize;
return pkg->ops->get_isize(pkg);
}
pmpkgreason_t SYMEXPORT alpm_pkg_get_reason(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
ASSERT(pkg != NULL, return(-1));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->reason;
return pkg->ops->get_reason(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->licenses;
return pkg->ops->get_licenses(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->groups;
}
unsigned short SYMEXPORT alpm_pkg_has_force(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
ASSERT(pkg != NULL, return(-1));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->force;
return pkg->ops->get_groups(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DEPENDS);
}
return pkg->depends;
return pkg->ops->get_depends(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DEPENDS);
}
return pkg->optdepends;
return pkg->ops->get_optdepends(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DEPENDS);
}
return pkg->conflicts;
return pkg->ops->get_conflicts(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_provides(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DEPENDS)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DEPENDS);
}
return pkg->provides;
}
alpm_list_t SYMEXPORT *alpm_pkg_get_deltas(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DELTAS)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DELTAS);
}
return pkg->deltas;
return pkg->ops->get_provides(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
return pkg->ops->get_replaces(pkg);
}
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
}
return pkg->replaces;
alpm_list_t SYMEXPORT *alpm_pkg_get_deltas(pmpkg_t *pkg)
{
return pkg->ops->get_deltas(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_files(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && pkg->origin_data.db == handle->db_local
&& !(pkg->infolevel & INFRQ_FILES)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_FILES);
}
return pkg->files;
return pkg->ops->get_files(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE && pkg->origin_data.db == handle->db_local
&& !(pkg->infolevel & INFRQ_FILES)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_FILES);
}
return pkg->backup;
}
alpm_list_t SYMEXPORT *alpm_pkg_get_removes(pmpkg_t *pkg)
{
ASSERT(pkg != NULL, return(NULL));
return(pkg->removes);
return pkg->ops->get_backup(pkg);
}
pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(pkg != NULL, return(NULL));
ASSERT(pkg->origin == PKG_FROM_CACHE, return(NULL));
ASSERT(pkg->origin != PKG_FROM_FILE, return(NULL));
return(pkg->origin_data.db);
}
@@ -448,84 +289,31 @@ pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
*/
void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
ASSERT(pkg != NULL, return(NULL));
if(pkg->origin == PKG_FROM_CACHE) {
char clfile[PATH_MAX];
snprintf(clfile, PATH_MAX, "%s/%s/%s-%s/changelog",
alpm_option_get_dbpath(),
alpm_db_get_name(handle->db_local),
alpm_pkg_get_name(pkg),
alpm_pkg_get_version(pkg));
return fopen(clfile, "r");
} else if(pkg->origin == PKG_FROM_FILE) {
struct archive *archive = NULL;
struct archive_entry *entry;
const char *pkgfile = pkg->origin_data.file;
int ret = ARCHIVE_OK;
if((archive = archive_read_new()) == NULL) {
RET_ERR(PM_ERR_LIBARCHIVE, NULL);
}
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);
if (archive_read_open_filename(archive, pkgfile,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
RET_ERR(PM_ERR_PKG_OPEN, NULL);
}
while((ret = archive_read_next_header(archive, &entry)) == ARCHIVE_OK) {
const char *entry_name = archive_entry_pathname(entry);
if(strcmp(entry_name, ".CHANGELOG") == 0) {
return(archive);
}
}
/* we didn't find a changelog */
archive_read_finish(archive);
errno = ENOENT;
}
return(NULL);
return pkg->ops->changelog_open(pkg);
}
/**
* Read data from an open changelog 'file stream'. Similar to fread in
* functionality, this function takes a buffer and amount of data to read.
* functionality, this function takes a buffer and amount of data to read. If an
* error occurs pm_errno will be set.
*
* @param ptr a buffer to fill with raw changelog data
* @param size the size of the buffer
* @param pkg the package that the changelog is being read from
* @param fp a 'file stream' to the package changelog
* @return the number of characters read, or 0 if there is no more data
* @return the number of characters read, or 0 if there is no more data or an
* error occurred.
*/
size_t SYMEXPORT alpm_pkg_changelog_read(void *ptr, size_t size,
const pmpkg_t *pkg, const void *fp)
{
size_t ret = 0;
if(pkg->origin == PKG_FROM_CACHE) {
ret = fread(ptr, 1, size, (FILE*)fp);
} else if(pkg->origin == PKG_FROM_FILE) {
ret = archive_read_data((struct archive*)fp, ptr, size);
}
return(ret);
return pkg->ops->changelog_read(ptr, size, pkg, fp);
}
/*
int SYMEXPORT alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp)
{
int ret = 0;
if(pkg->origin == PKG_FROM_CACHE) {
ret = feof((FILE*)fp);
} else if(pkg->origin == PKG_FROM_FILE) {
// note: this doesn't quite work, no feof in libarchive
ret = archive_read_data((struct archive*)fp, NULL, 0);
}
return(ret);
return pkg->ops->changelog_feof(pkg, fp);
}
*/
@@ -539,28 +327,29 @@ int SYMEXPORT alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp)
*/
int SYMEXPORT alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp)
{
int ret = 0;
if(pkg->origin == PKG_FROM_CACHE) {
ret = fclose((FILE*)fp);
} else if(pkg->origin == PKG_FROM_FILE) {
ret = archive_read_finish((struct archive *)fp);
}
return(ret);
return pkg->ops->changelog_close(pkg, fp);
}
unsigned short SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
return pkg->ops->has_scriptlet(pkg);
}
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
ASSERT(pkg != NULL, return(-1));
if(pkg->origin == PKG_FROM_CACHE && pkg->origin_data.db == handle->db_local
&& !(pkg->infolevel & INFRQ_SCRIPTLET)) {
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_SCRIPTLET);
static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)
{
const alpm_list_t *i;
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
if(!i->data) {
continue;
}
pmpkg_t *cachepkg = i->data;
if(_alpm_dep_edge(cachepkg, pkg)) {
const char *cachepkgname = cachepkg->name;
if(alpm_list_find_str(*reqs, cachepkgname) == 0) {
*reqs = alpm_list_add(*reqs, strdup(cachepkgname));
}
}
}
return pkg->scriptlet;
}
/**
@@ -572,192 +361,29 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
{
const alpm_list_t *i;
alpm_list_t *reqs = NULL;
pmdb_t *db;
pmdb_t *localdb = alpm_option_get_localdb();
for(i = _alpm_db_get_pkgcache(localdb); i; i = i->next) {
if(!i->data) {
continue;
}
pmpkg_t *cachepkg = i->data;
if(_alpm_dep_edge(cachepkg, pkg)) {
const char *cachepkgname = alpm_pkg_get_name(cachepkg);
reqs = alpm_list_add(reqs, strdup(cachepkgname));
if(pkg->origin == PKG_FROM_FILE) {
/* The sane option; search locally for things that require this. */
db = alpm_option_get_localdb();
find_requiredby(pkg, db, &reqs);
} else {
/* We have a DB package. if it is a local package, then we should
* only search the local DB; else search all known sync databases. */
db = pkg->origin_data.db;
if(db->is_local) {
find_requiredby(pkg, db, &reqs);
} else {
for(i = handle->dbs_sync; i; i = i->next) {
db = i->data;
find_requiredby(pkg, db, &reqs);
reqs = alpm_list_msort(reqs, alpm_list_count(reqs), _alpm_str_cmp);
}
}
}
return(reqs);
}
/** Compare two version strings and determine which one is 'newer'.
* Returns a value comparable to the way strcmp works. Returns 1
* if a is newer than b, 0 if a and b are the same version, or -1
* if b is newer than a.
*
* This function has been adopted from the rpmvercmp function located
* at lib/rpmvercmp.c, and was most recently updated against rpm
* version 4.4.2.3. Small modifications have been made to make it more
* consistent with the libalpm coding style.
*
* Keep in mind that the pkgrel is only compared if it is available
* on both versions handed to this function. For example, comparing
* 1.5-1 and 1.5 will yield 0; comparing 1.5-1 and 1.5-2 will yield
* -1 as expected. This is mainly for supporting versioned dependencies
* that do not include the pkgrel.
*/
int SYMEXPORT alpm_pkg_vercmp(const char *a, const char *b)
{
char oldch1, oldch2;
char *str1, *str2;
char *ptr1, *ptr2;
char *one, *two;
int rc;
int isnum;
int ret = 0;
ALPM_LOG_FUNC;
/* libalpm added code. ensure our strings are not null */
if(!a) {
if(!b) return(0);
return(-1);
}
if(!b) return(1);
/* easy comparison to see if versions are identical */
if(strcmp(a, b) == 0) return(0);
str1 = strdup(a);
str2 = strdup(b);
one = str1;
two = str2;
/* loop through each version segment of str1 and str2 and compare them */
while(*one && *two) {
while(*one && !isalnum((int)*one)) one++;
while(*two && !isalnum((int)*two)) two++;
/* If we ran to the end of either, we are finished with the loop */
if(!(*one && *two)) break;
ptr1 = one;
ptr2 = two;
/* grab first completely alpha or completely numeric segment */
/* leave one and two pointing to the start of the alpha or numeric */
/* segment and walk ptr1 and ptr2 to end of segment */
if(isdigit((int)*ptr1)) {
while(*ptr1 && isdigit((int)*ptr1)) ptr1++;
while(*ptr2 && isdigit((int)*ptr2)) ptr2++;
isnum = 1;
} else {
while(*ptr1 && isalpha((int)*ptr1)) ptr1++;
while(*ptr2 && isalpha((int)*ptr2)) ptr2++;
isnum = 0;
}
/* save character at the end of the alpha or numeric segment */
/* so that they can be restored after the comparison */
oldch1 = *ptr1;
*ptr1 = '\0';
oldch2 = *ptr2;
*ptr2 = '\0';
/* this cannot happen, as we previously tested to make sure that */
/* the first string has a non-null segment */
if (one == ptr1) {
ret = -1; /* arbitrary */
goto cleanup;
}
/* take care of the case where the two version segments are */
/* different types: one numeric, the other alpha (i.e. empty) */
/* numeric segments are always newer than alpha segments */
/* XXX See patch #60884 (and details) from bugzilla #50977. */
if (two == ptr2) {
ret = isnum ? 1 : -1;
goto cleanup;
}
if (isnum) {
/* this used to be done by converting the digit segments */
/* to ints using atoi() - it's changed because long */
/* digit segments can overflow an int - this should fix that. */
/* throw away any leading zeros - it's a number, right? */
while (*one == '0') one++;
while (*two == '0') two++;
/* whichever number has more digits wins */
if (strlen(one) > strlen(two)) {
ret = 1;
goto cleanup;
}
if (strlen(two) > strlen(one)) {
ret = -1;
goto cleanup;
}
}
/* strcmp will return which one is greater - even if the two */
/* segments are alpha or if they are numeric. don't return */
/* if they are equal because there might be more segments to */
/* compare */
rc = strcmp(one, two);
if (rc) {
ret = rc < 1 ? -1 : 1;
goto cleanup;
}
/* restore character that was replaced by null above */
*ptr1 = oldch1;
one = ptr1;
*ptr2 = oldch2;
two = ptr2;
/* libalpm added code. check if version strings have hit the pkgrel
* portion. depending on which strings have hit, take correct action.
* this is all based on the premise that we only have one dash in
* the version string, and it separates pkgver from pkgrel. */
if(*ptr1 == '-' && *ptr2 == '-') {
/* no-op, continue comparing since we are equivalent throughout */
} else if(*ptr1 == '-') {
/* ptr1 has hit the pkgrel and ptr2 has not. continue version
* comparison after stripping the pkgrel from ptr1. */
*ptr1 = '\0';
} else if(*ptr2 == '-') {
/* ptr2 has hit the pkgrel and ptr1 has not. continue version
* comparison after stripping the pkgrel from ptr2. */
*ptr2 = '\0';
}
}
/* this catches the case where all numeric and alpha segments have */
/* compared identically but the segment separating characters were */
/* different */
if ((!*one) && (!*two)) {
ret = 0;
goto cleanup;
}
/* the final showdown. we never want a remaining alpha string to
* beat an empty string. the logic is a bit weird, but:
* - if one is empty and two is not an alpha, two is newer.
* - if one is an alpha, two is newer.
* - otherwise one is newer.
* */
if ( ( !*one && !isalpha((int)*two) )
|| isalpha((int)*one) ) {
ret = -1;
} else {
ret = 1;
}
cleanup:
free(str1);
free(str2);
return(ret);
}
/** @} */
pmpkg_t *_alpm_pkg_new(void)
@@ -780,6 +406,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
CALLOC(newpkg, 1, sizeof(pmpkg_t), RET_ERR(PM_ERR_MEMORY, NULL));
newpkg->name_hash = pkg->name_hash;
STRDUP(newpkg->filename, pkg->filename, RET_ERR(PM_ERR_MEMORY, newpkg));
STRDUP(newpkg->name, pkg->name, RET_ERR(PM_ERR_MEMORY, newpkg));
STRDUP(newpkg->version, pkg->version, RET_ERR(PM_ERR_MEMORY, newpkg));
@@ -793,7 +420,6 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
newpkg->size = pkg->size;
newpkg->isize = pkg->isize;
newpkg->scriptlet = pkg->scriptlet;
newpkg->force = pkg->force;
newpkg->reason = pkg->reason;
newpkg->licenses = alpm_list_strdup(pkg->licenses);
@@ -811,6 +437,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
/* internal */
newpkg->origin = pkg->origin;
newpkg->ops = pkg->ops;
if(newpkg->origin == PKG_FROM_FILE) {
newpkg->origin_data.file = strdup(pkg->origin_data.file);
} else {
@@ -858,7 +485,11 @@ void _alpm_pkg_free(pmpkg_t *pkg)
FREE(pkg);
}
/* Free transaction specific fields */
/* This function should be used when removing a target from upgrade/sync target list
* Case 1: If pkg is a loaded package file (PKG_FROM_FILE), it will be freed.
* Case 2: If pkg is a pkgcache entry (PKG_FROM_CACHE), it won't be freed,
* only the transaction specific fields of pkg will be freed.
*/
void _alpm_pkg_free_trans(pmpkg_t *pkg)
{
ALPM_LOG_FUNC;
@@ -867,25 +498,22 @@ void _alpm_pkg_free_trans(pmpkg_t *pkg)
return;
}
if(pkg->origin == PKG_FROM_FILE) {
_alpm_pkg_free(pkg);
return;
}
alpm_list_free(pkg->removes);
pkg->removes = NULL;
}
/* Is spkg an upgrade for locapkg? */
/* Is spkg an upgrade for localpkg? */
int _alpm_pkg_compare_versions(pmpkg_t *spkg, pmpkg_t *localpkg)
{
int cmp = 0;
ALPM_LOG_FUNC;
cmp = alpm_pkg_vercmp(alpm_pkg_get_version(spkg),
return alpm_pkg_vercmp(alpm_pkg_get_version(spkg),
alpm_pkg_get_version(localpkg));
if(cmp < 0 && alpm_pkg_has_force(spkg)) {
cmp = 1;
}
return(cmp);
}
/* Helper function for comparing packages
@@ -894,7 +522,7 @@ int _alpm_pkg_cmp(const void *p1, const void *p2)
{
pmpkg_t *pkg1 = (pmpkg_t *)p1;
pmpkg_t *pkg2 = (pmpkg_t *)p2;
return(strcmp(alpm_pkg_get_name(pkg1), alpm_pkg_get_name(pkg2)));
return(strcoll(pkg1->name, pkg2->name));
}
/* Test for existence of a package in a alpm_list_t*
@@ -903,6 +531,7 @@ int _alpm_pkg_cmp(const void *p1, const void *p2)
pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle)
{
alpm_list_t *lp;
unsigned long needle_hash;
ALPM_LOG_FUNC;
@@ -910,11 +539,21 @@ pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle)
return(NULL);
}
needle_hash = _alpm_hash_sdbm(needle);
for(lp = haystack; lp; lp = lp->next) {
pmpkg_t *info = lp->data;
if(info && strcmp(alpm_pkg_get_name(info), needle) == 0) {
return(info);
if(info) {
/* a zero hash will cause a fall-through just in case */
if(info->name_hash && info->name_hash != needle_hash) {
continue;
}
/* finally: we had hash match, verify string match */
if(strcmp(info->name, needle) == 0) {
return(info);
}
}
}
return(NULL);

View File

@@ -1,7 +1,7 @@
/*
* package.h
*
* Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
@@ -31,27 +31,92 @@
#include "db.h"
typedef enum _pmpkgfrom_t {
PKG_FROM_CACHE = 1,
PKG_FROM_FILE
PKG_FROM_FILE = 1,
PKG_FROM_LOCALDB,
PKG_FROM_SYNCDB
} pmpkgfrom_t;
/** Package operations struct. This struct contains function pointers to
* all methods used to access data in a package to allow for things such
* as lazy package intialization (such as used by the file backend). Each
* backend is free to define a stuct containing pointers to a specific
* implementation of these methods. Some backends may find using the
* defined default_pkg_ops struct to work just fine for their needs.
*/
struct pkg_operations {
const char *(*get_filename) (pmpkg_t *);
const char *(*get_name) (pmpkg_t *);
const char *(*get_version) (pmpkg_t *);
const char *(*get_desc) (pmpkg_t *);
const char *(*get_url) (pmpkg_t *);
time_t (*get_builddate) (pmpkg_t *);
time_t (*get_installdate) (pmpkg_t *);
const char *(*get_packager) (pmpkg_t *);
const char *(*get_md5sum) (pmpkg_t *);
const char *(*get_arch) (pmpkg_t *);
off_t (*get_size) (pmpkg_t *);
off_t (*get_isize) (pmpkg_t *);
pmpkgreason_t (*get_reason) (pmpkg_t *);
int (*has_scriptlet) (pmpkg_t *);
alpm_list_t *(*get_licenses) (pmpkg_t *);
alpm_list_t *(*get_groups) (pmpkg_t *);
alpm_list_t *(*get_depends) (pmpkg_t *);
alpm_list_t *(*get_optdepends) (pmpkg_t *);
alpm_list_t *(*get_conflicts) (pmpkg_t *);
alpm_list_t *(*get_provides) (pmpkg_t *);
alpm_list_t *(*get_replaces) (pmpkg_t *);
alpm_list_t *(*get_deltas) (pmpkg_t *);
alpm_list_t *(*get_files) (pmpkg_t *);
alpm_list_t *(*get_backup) (pmpkg_t *);
void *(*changelog_open) (pmpkg_t *);
size_t (*changelog_read) (void *, size_t, const pmpkg_t *, const void *);
int (*changelog_close) (const pmpkg_t *, void *);
/* still to add:
* checkmd5sum() ?
* compute_requiredby()
*/
};
/** The standard package operations struct. get fields directly from the
* struct itself with no abstraction layer or any type of lazy loading.
* The actual definition is in package.c so it can have access to the
* default accessor functions which are defined there.
*/
extern struct pkg_operations default_pkg_ops;
struct __pmpkg_t {
unsigned long name_hash;
char *filename;
char *name;
char *version;
char *desc;
char *url;
time_t builddate;
time_t installdate;
char *packager;
char *md5sum;
char *arch;
time_t builddate;
time_t installdate;
off_t size;
off_t isize;
off_t download_size;
unsigned short scriptlet;
unsigned short force;
int scriptlet;
pmpkgreason_t reason;
pmpkgfrom_t origin;
/* origin == PKG_FROM_FILE, use pkg->origin_data.file
* origin == PKG_FROM_*DB, use pkg->origin_data.db */
union {
pmdb_t *db;
char *file;
} origin_data;
pmdbinfrq_t infolevel;
alpm_list_t *licenses;
alpm_list_t *replaces;
alpm_list_t *groups;
@@ -64,17 +129,8 @@ struct __pmpkg_t {
alpm_list_t *deltas;
alpm_list_t *delta_path;
alpm_list_t *removes; /* in transaction targets only */
/* internal */
pmpkgfrom_t origin;
/* Replaced 'void *data' with this union as follows:
origin == PKG_FROM_CACHE, use pkg->origin_data.db
origin == PKG_FROM_FILE, use pkg->origin_data.file
*/
union {
pmdb_t *db;
char *file;
} origin_data;
pmdbinfrq_t infolevel;
struct pkg_operations *ops;
};
pmpkg_t* _alpm_pkg_new(void);

331
lib/libalpm/pkghash.c Normal file
View File

@@ -0,0 +1,331 @@
/*
* pkghash.c
*
* Copyright (c) 2011 Pacman Development Team <pacman-dev@archlinux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "pkghash.h"
#include "util.h"
#include "log.h"
/* List of primes for possible sizes of hash tables.
*
* The maximum table size is the last prime under 1,000,000. That is
* more than an order of magnitude greater than the number of packages
* in any Linux distribution.
*/
static const size_t prime_list[] =
{
11ul, 13ul, 17ul, 19ul, 23ul, 29ul, 31ul, 37ul, 41ul, 43ul, 47ul,
53ul, 59ul, 61ul, 67ul, 71ul, 73ul, 79ul, 83ul, 89ul, 97ul, 103ul,
109ul, 113ul, 127ul, 137ul, 139ul, 149ul, 157ul, 167ul, 179ul, 193ul,
199ul, 211ul, 227ul, 241ul, 257ul, 277ul, 293ul, 313ul, 337ul, 359ul,
383ul, 409ul, 439ul, 467ul, 503ul, 541ul, 577ul, 619ul, 661ul, 709ul,
761ul, 823ul, 887ul, 953ul, 1031ul, 1109ul, 1193ul, 1289ul, 1381ul,
1493ul, 1613ul, 1741ul, 1879ul, 2029ul, 2179ul, 2357ul, 2549ul,
2753ul, 2971ul, 3209ul, 3469ul, 3739ul, 4027ul, 4349ul, 4703ul,
5087ul, 5503ul, 5953ul, 6427ul, 6949ul, 7517ul, 8123ul, 8783ul,
9497ul, 10273ul, 11113ul, 12011ul, 12983ul, 14033ul, 15173ul,
16411ul, 17749ul, 19183ul, 20753ul, 22447ul, 24281ul, 26267ul,
28411ul, 30727ul, 33223ul, 35933ul, 38873ul, 42043ul, 45481ul,
49201ul, 53201ul, 57557ul, 62233ul, 67307ul, 72817ul, 78779ul,
85229ul, 92203ul, 99733ul, 107897ul, 116731ul, 126271ul, 136607ul,
147793ul, 159871ul, 172933ul, 187091ul, 202409ul, 218971ul, 236897ul,
256279ul, 277261ul, 299951ul, 324503ul, 351061ul, 379787ul, 410857ul,
444487ul, 480881ul, 520241ul, 562841ul, 608903ul, 658753ul, 712697ul,
771049ul, 834181ul, 902483ul, 976369ul
};
/* Allocate a hash table with at least "size" buckets */
pmpkghash_t *_alpm_pkghash_create(size_t size)
{
pmpkghash_t *hash = NULL;
size_t i, loopsize;
MALLOC(hash, sizeof(pmpkghash_t), RET_ERR(PM_ERR_MEMORY, NULL));
hash->list = NULL;
hash->entries = 0;
hash->buckets = 0;
loopsize = sizeof(prime_list) / sizeof(*prime_list);
for(i = 0; i < loopsize; i++) {
if(prime_list[i] > size) {
hash->buckets = prime_list[i];
break;
}
}
if(hash->buckets < size) {
_alpm_log(PM_LOG_ERROR, _("database larger than maximum size\n"));
free(hash);
return(NULL);
}
CALLOC(hash->hash_table, hash->buckets, sizeof(alpm_list_t*), \
free(hash); RET_ERR(PM_ERR_MEMORY, NULL));
return(hash);
}
static size_t get_hash_position(unsigned long name_hash, pmpkghash_t *hash)
{
size_t position;
alpm_list_t *ptr;
position = name_hash % hash->buckets;
/* collision resolution using open addressing with linear probing */
while((ptr = hash->hash_table[position]) != NULL) {
position = (position + 1) % hash->buckets;
}
return(position);
}
/* Expand the hash table size to the next increment and rebin the entries */
static pmpkghash_t *rehash(pmpkghash_t *oldhash)
{
pmpkghash_t *newhash;
size_t newsize, position, i;
/* Hash tables will need resized in two cases:
* - adding packages to the local database
* - poor estimation of the number of packages in sync database
*
* For small hash tables sizes (<500) the increase in size is by a
* minimum of a factor of 2 for optimal rehash efficiency. For
* larger database sizes, this increase is reduced to avoid excess
* memory allocation as both scenarios requiring a rehash should not
* require a table size increase that large. */
if(oldhash->buckets < 500) {
newsize = oldhash->buckets * 2;
} else if(oldhash->buckets < 2000) {
newsize = oldhash->buckets * 3 / 2;
} else if(oldhash->buckets < 5000) {
newsize = oldhash->buckets * 4 / 3;
} else {
newsize = oldhash->buckets + 1;
}
newhash = _alpm_pkghash_create(newsize);
if(newhash == NULL) {
/* creation of newhash failed, stick with old one... */
return(oldhash);
}
newhash->list = oldhash->list;
oldhash->list = NULL;
for(i = 0; i < oldhash->buckets; i++) {
if(oldhash->hash_table[i] != NULL) {
pmpkg_t *package = oldhash->hash_table[i]->data;
position = get_hash_position(package->name_hash, newhash);
newhash->hash_table[position] = oldhash->hash_table[i];
oldhash->hash_table[i] = NULL;
}
}
newhash->entries = oldhash->entries;
_alpm_pkghash_free(oldhash);
return(newhash);
}
static pmpkghash_t *pkghash_add_pkg(pmpkghash_t *hash, pmpkg_t *pkg, int sorted)
{
alpm_list_t *ptr;
size_t position;
if(pkg == NULL || hash == NULL) {
return(hash);
}
if((hash->entries + 1) / MAX_HASH_LOAD > hash->buckets) {
hash = rehash(hash);
}
position = get_hash_position(pkg->name_hash, hash);
ptr = calloc(1, sizeof(alpm_list_t));
if(ptr == NULL) {
return(hash);
}
ptr->data = pkg;
ptr->next = NULL;
ptr->prev = ptr;
hash->hash_table[position] = ptr;
if(!sorted){
hash->list = alpm_list_join(hash->list, ptr);
}else{
hash->list = alpm_list_mmerge(hash->list, ptr, _alpm_pkg_cmp);
}
hash->entries += 1;
return(hash);
}
pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, pmpkg_t *pkg)
{
return(pkghash_add_pkg(hash, pkg, 0));
}
pmpkghash_t *_alpm_pkghash_add_sorted(pmpkghash_t *hash, pmpkg_t *pkg)
{
return(pkghash_add_pkg(hash, pkg, 1));
}
static size_t move_one_entry(pmpkghash_t *hash, size_t start, size_t end)
{
/* Iterate backwards from 'end' to 'start', seeing if any of the items
* would hash to 'start'. If we find one, we move it there and break. If
* we get all the way back to position and find none that hash to it, we
* also end iteration. Iterating backwards helps prevent needless shuffles;
* we will never need to move more than one item per function call. The
* return value is our current iteration location; if this is equal to
* 'start' we can stop this madness. */
while(end != start) {
alpm_list_t *i = hash->hash_table[end];
pmpkg_t *info = i->data;
size_t new_position = get_hash_position(info->name_hash, hash);
if(new_position == start) {
hash->hash_table[start] = i;
hash->hash_table[end] = NULL;
break;
}
/* the odd math ensures we are always positive, e.g.
* e.g. (0 - 1) % 47 == -1
* e.g. (47 + 0 - 1) % 47 == 46 */
end = (hash->buckets + end - 1) % hash->buckets;
}
return(end);
}
/**
* @brief Remove a package from a pkghash.
*
* @param hash the hash to remove the package from
* @param pkg the package we are removing
* @param data output parameter containing the removed item
*
* @return the resultant hash
*/
pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, pmpkg_t *pkg,
pmpkg_t **data)
{
alpm_list_t *i;
size_t position;
if(data) {
*data = NULL;
}
if(pkg == NULL || hash == NULL) {
return(hash);
}
position = pkg->name_hash % hash->buckets;
while((i = hash->hash_table[position]) != NULL) {
pmpkg_t *info = i->data;
if(info->name_hash == pkg->name_hash &&
strcmp(info->name, pkg->name) == 0) {
size_t stop, prev;
/* remove from list and hash */
hash->list = alpm_list_remove_item(hash->list, i);
if(data) {
*data = info;
}
hash->hash_table[position] = NULL;
free(i);
hash->entries -= 1;
/* Potentially move entries following removed entry to keep open
* addressing collision resolution working. We start by finding the
* next null bucket to know how far we have to look. */
stop = (position + 1) % hash->buckets;
while(hash->hash_table[stop] != NULL && stop != position) {
stop = (stop + 1) % hash->buckets;
}
stop = (hash->buckets + stop - 1) % hash->buckets;
/* We now search backwards from stop to position. If we find an
* item that now hashes to position, we will move it, and then try
* to plug the new hole we just opened up, until we finally don't
* move anything. */
while((prev = move_one_entry(hash, position, stop)) != position) {
position = prev;
}
return(hash);
}
position = (position + 1) % hash->buckets;
}
return(hash);
}
void _alpm_pkghash_free(pmpkghash_t *hash)
{
size_t i;
if(hash != NULL) {
for(i = 0; i < hash->buckets; i++) {
free(hash->hash_table[i]);
}
free(hash->hash_table);
}
free(hash);
}
pmpkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name)
{
alpm_list_t *lp;
unsigned long name_hash;
size_t position;
ALPM_LOG_FUNC;
if(name == NULL || hash == NULL) {
return(NULL);
}
name_hash = _alpm_hash_sdbm(name);
position = name_hash % hash->buckets;
while((lp = hash->hash_table[position]) != NULL) {
pmpkg_t *info = lp->data;
if(info->name_hash == name_hash && strcmp(info->name, name) == 0) {
return(info);
}
position = (position + 1) % hash->buckets;
}
return(NULL);
}
/* vim: set ts=2 sw=2 noet: */

60
lib/libalpm/pkghash.h Normal file
View File

@@ -0,0 +1,60 @@
/*
* pkghash.h
*
* Copyright (c) 2011 Pacman Development Team <pacman-dev@archlinux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ALPM_PKGHASH_H
#define _ALPM_PKGHASH_H
#include <stdlib.h>
#include "alpm.h"
#include "alpm_list.h"
/**
* @brief A hash table for holding pmpkg_t objects.
*
* A combination of a hash table and a list, allowing for fast look-up
* by package name but also iteration over the packages.
*/
struct __pmpkghash_t {
/** data held by the hash table */
alpm_list_t **hash_table;
/** number of buckets in hash table */
size_t buckets;
/** number of entries in hash table */
size_t entries;
/** head node of the hash table data in normal list format */
alpm_list_t *list;
};
typedef struct __pmpkghash_t pmpkghash_t;
pmpkghash_t *_alpm_pkghash_create(size_t size);
pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, pmpkg_t *pkg);
pmpkghash_t *_alpm_pkghash_add_sorted(pmpkghash_t *hash, pmpkg_t *pkg);
pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, pmpkg_t *pkg, pmpkg_t **data);
void _alpm_pkghash_free(pmpkghash_t *hash);
pmpkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name);
#define MAX_HASH_LOAD 0.7
#endif /* _ALPM_PKGHASH_H */

View File

@@ -1,19 +1,25 @@
# Set of available languages.
ca
cs
da
de
el
en_GB
es
fi
fr
hu
it
kk
nb_NO
ko
nb
pl
pt
pt_BR
ro
ru
sv_SE
sk
sv
tr
uk
zh_CN

View File

@@ -1,5 +1,5 @@
# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-1997, 2000-2003 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public
@@ -8,10 +8,12 @@
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
#
# Origin: gettext-0.13
# Origin: gettext-0.18
GETTEXT_MACRO_VERSION = 0.18
PACKAGE = @PACKAGE@
VERSION = @VERSION@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
SHELL = /bin/sh
@SET_MAKE@
@@ -22,18 +24,38 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
datarootdir = @datarootdir@
localedir = $(datadir)/locale
datadir = @datadir@
localedir = @localedir@
gettextsrcdir = $(datadir)/gettext/po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
mkinstalldirs = @INSTALL@ -d
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
# We use $(mkdir_p).
# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
# @install_sh@ does not start with $(SHELL), so we add it.
# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
# versions, $(mkinstalldirs) and $(install_sh) are unused.
mkinstalldirs = $(SHELL) @install_sh@ -d
install_sh = $(SHELL) @install_sh@
MKDIR_P = @MKDIR_P@
mkdir_p = @mkdir_p@
GMSGFMT_ = @GMSGFMT@
GMSGFMT_no = @GMSGFMT@
GMSGFMT_yes = @GMSGFMT_015@
GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
MSGFMT_ = @MSGFMT@
MSGFMT_no = @MSGFMT@
MSGFMT_yes = @MSGFMT_015@
MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
XGETTEXT_ = @XGETTEXT@
XGETTEXT_no = @XGETTEXT@
XGETTEXT_yes = @XGETTEXT_015@
XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
MSGMERGE = msgmerge
MSGMERGE_UPDATE = @MSGMERGE@ --update
MSGINIT = msginit
@@ -46,7 +68,7 @@ UPDATEPOFILES = @UPDATEPOFILES@
DUMMYPOFILES = @DUMMYPOFILES@
DISTFILES.common = Makefile.in.in remove-potcdate.sin \
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
$(POFILES) $(GMOFILES) \
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
@@ -57,7 +79,7 @@ CATALOGS = @CATALOGS@
# Makevars gets inserted here. (Don't remove this line!)
.SUFFIXES:
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
.po.mo:
@echo "$(MSGFMT) -c -o $@ $<"; \
@@ -66,19 +88,32 @@ CATALOGS = @CATALOGS@
.po.gmo:
@lang=`echo $* | sed -e 's,.*/,,'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@
all: all-@USE_NLS@
all: check-macro-version all-@USE_NLS@
all-yes: stamp-po
all-no:
# Ensure that the gettext macros and this Makefile.in.in are in sync.
check-macro-version:
@test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
|| { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \
exit 1; \
}
# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
# we don't want to bother translators with empty POT files). We assume that
# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
# In this case, stamp-po is a nop (i.e. a phony target).
# stamp-po is a timestamp denoting the last time at which the CATALOGS have
# been loosely updated. Its purpose is that when a developer or translator
# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
@@ -88,10 +123,13 @@ all-no:
# $(POFILES) has been designed to not touch files that don't need to be
# changed.
stamp-po: $(srcdir)/$(DOMAIN).pot
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
@echo "touch stamp-po"
@echo timestamp > stamp-poT
@mv stamp-poT stamp-po
test ! -f $(srcdir)/$(DOMAIN).pot || \
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
@test ! -f $(srcdir)/$(DOMAIN).pot || { \
echo "touch stamp-po" && \
echo timestamp > stamp-poT && \
mv stamp-poT stamp-po; \
}
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
# otherwise packages like GCC can not be built if only parts of the source
@@ -100,11 +138,34 @@ stamp-po: $(srcdir)/$(DOMAIN).pot
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--msgid-bugs-address='$(MSGID_BUGS_ADDRESS)'
if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \
package_gnu='GNU '; \
else \
package_gnu=''; \
fi; \
if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
else \
msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
fi; \
case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--msgid-bugs-address="$$msgid_bugs_address" \
;; \
*) \
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--package-name="$${package_gnu}@PACKAGE@" \
--package-version='@VERSION@' \
--msgid-bugs-address="$$msgid_bugs_address" \
;; \
esac
test ! -f $(DOMAIN).po || { \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
@@ -130,16 +191,27 @@ $(srcdir)/$(DOMAIN).pot:
# Note that a PO file is not touched if it doesn't need to be changed.
$(POFILES): $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
if test -f "$(srcdir)/$${lang}.po"; then \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) \
&& { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
esac; \
}; \
else \
$(MAKE) $${lang}.po-create; \
fi
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
$(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
for file in $(DISTFILES.common) Makevars.template; do \
$(INSTALL_DATA) $(srcdir)/$$file \
$(DESTDIR)$(gettextsrcdir)/$$file; \
@@ -152,13 +224,12 @@ install-data: install-data-@USE_NLS@
fi
install-data-no: all
install-data-yes: all
$(mkinstalldirs) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkinstalldirs) $(DESTDIR)$$dir; \
$(mkdir_p) $(DESTDIR)$$dir; \
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
@@ -198,19 +269,18 @@ installdirs: installdirs-exec installdirs-data
installdirs-exec:
installdirs-data: installdirs-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
$(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
else \
: ; \
fi
installdirs-data-no:
installdirs-data-yes:
$(mkinstalldirs) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkinstalldirs) $(DESTDIR)$$dir; \
$(mkdir_p) $(DESTDIR)$$dir; \
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
if test -n "$$lc"; then \
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
@@ -285,11 +355,14 @@ dist distdir:
$(MAKE) update-po
@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: $(DISTFILES)
dist2: stamp-po $(DISTFILES)
dists="$(DISTFILES)"; \
if test "$(PACKAGE)" = "gettext-tools"; then \
dists="$$dists Makevars.template"; \
fi; \
if test -f $(srcdir)/$(DOMAIN).pot; then \
dists="$$dists $(DOMAIN).pot stamp-po"; \
fi; \
if test -f $(srcdir)/ChangeLog; then \
dists="$$dists ChangeLog"; \
fi; \
@@ -301,9 +374,9 @@ dist2: $(DISTFILES)
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
for file in $$dists; do \
if test -f $$file; then \
cp -p $$file $(distdir); \
cp -p $$file $(distdir) || exit 1; \
else \
cp -p $(srcdir)/$$file $(distdir); \
cp -p $(srcdir)/$$file $(distdir) || exit 1; \
fi; \
done
@@ -312,6 +385,13 @@ update-po: Makefile
test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
$(MAKE) update-gmo
# General rule for creating PO files.
.nop.po-create:
@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
exit 1
# General rule for updating PO files.
.nop.po-update:
@@ -320,9 +400,15 @@ update-po: Makefile
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
esac; \
}; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
@@ -343,10 +429,13 @@ $(DUMMYPOFILES):
update-gmo: Makefile $(GMOFILES)
@:
Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@
# Recreate Makefile by invoking config.status. Explicitly invoke the shell,
# because execution permission bits may not work on the current file system.
# Use @SHELL@, which is the shell determined by autoconf for the use by its
# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
$(SHELL) ./config.status
&& @SHELL@ ./config.status $(subdir)/$@.in po-directories
force:

View File

@@ -10,7 +10,7 @@ top_builddir = ../../../
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --no-location \
--keyword=_ --flag=_:1:c-format \
--keyword=N_ --flag=N_:1:c-format
--keyword=_n:1,2 --flag=_n:1:c-format --flag=_n:2:c-format
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
@@ -19,7 +19,7 @@ COPYRIGHT_HOLDER = Pacman Development Team <pacman-dev@archlinux.org>
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings.
MSGID_BUGS_ADDRESS = pacman-dev@archlinux.org
MSGID_BUGS_ADDRESS = http://bugs.archlinux.org/index.php?project=3
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.

View File

@@ -6,13 +6,14 @@ lib/libalpm/add.c
lib/libalpm/alpm.c
#lib/libalpm/alpm_list.c
lib/libalpm/backup.c
lib/libalpm/be_files.c
lib/libalpm/be_local.c
lib/libalpm/be_package.c
lib/libalpm/cache.c
lib/libalpm/be_sync.c
lib/libalpm/conflict.c
lib/libalpm/db.c
lib/libalpm/delta.c
lib/libalpm/deps.c
lib/libalpm/diskspace.c
lib/libalpm/dload.c
lib/libalpm/error.c
lib/libalpm/group.c
@@ -20,6 +21,7 @@ lib/libalpm/handle.c
lib/libalpm/log.c
#lib/libalpm/md5.c
lib/libalpm/package.c
lib/libalpm/pkghash.c
lib/libalpm/remove.c
lib/libalpm/sync.c
lib/libalpm/trans.c

549
lib/libalpm/po/ca.po Normal file
View File

@@ -0,0 +1,549 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Arch Linux Pacman package manager\n"
"Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
"POT-Creation-Date: 2011-03-14 13:51-0500\n"
"PO-Revision-Date: 2011-03-04 18:24+0000\n"
"Last-Translator: toofishes <dpmcgee@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#, c-format
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s és al dia -- s'ignorarà\n"
#, c-format
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s és al dia -- es reinstal·larà\n"
#, c-format
msgid "downgrading package %s (%s => %s)\n"
msgstr "desactualitzant paquet %s (%s => %s)\n"
#, c-format
msgid "warning given when extracting %s (%s)\n"
msgstr ""
#, c-format
msgid "could not extract %s (%s)\n"
msgstr "no es pot extreure %s (%s)\n"
#, c-format
msgid ""
"directory permissions differ on %s\n"
"filesystem: %o package: %o\n"
msgstr ""
"els permisos del directori difereixen en %s\n"
"sistema de fitxers: %o paquet: %o\n"
#, c-format
msgid "extract: not overwriting dir with file %s\n"
msgstr "extracció: no se sobreescriurà el directori amb el fitxer %s\n"
#, c-format
msgid "extract: symlink %s does not point to dir\n"
msgstr "extracció: l'enllaç simbòlic %s no apunta al directori\n"
#, c-format
msgid "could not rename %s to %s (%s)\n"
msgstr "no es pot reanomenar %s a %s (%s)\n"
#, c-format
msgid "%s saved as %s\n"
msgstr "%s desat com %s\n"
#, c-format
msgid "could not install %s as %s (%s)\n"
msgstr "no es pot instal·lar %s com %s (%s)\n"
#, c-format
msgid "%s installed as %s\n"
msgstr "%s instal·lat com %s\n"
#, c-format
msgid "extracting %s as %s.pacnew\n"
msgstr "s'està extraient %s com %s.pacnew\n"
#, c-format
msgid "could not get current working directory\n"
msgstr "no es pot obtenir el directori de treball actual\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "no s'ha pogut canviar el directori a %s (%s)\n"
#, c-format
msgid "problem occurred while upgrading %s\n"
msgstr "ha ocorregut un problema en actualitzar %s\n"
#, c-format
msgid "problem occurred while installing %s\n"
msgstr "ha ocorregut un problema en instal·lar %s\n"
#, c-format
msgid "could not update database entry %s-%s\n"
msgstr "no s'ha pogut actualitzar l'entrada de la base de dades %s-%s\n"
#, c-format
msgid "could not add entry '%s' in cache\n"
msgstr "no s'ha pogut afegir l'entrada '%s' en la memòria cau\n"
#, c-format
msgid "removing invalid database: %s\n"
msgstr "s'està eliminant la base de dades invàlida: %s\n"
#, c-format
msgid "invalid name for database entry '%s'\n"
msgstr "nom invàlid per l'entrada de la base de dades '%s'\n"
#, c-format
msgid "duplicated database entry '%s'\n"
msgstr "entrada de la base de dades duplicada '%s'\n"
#, c-format
msgid "corrupted database entry '%s'\n"
msgstr "entrada de la base de dades corrupta '%s'\n"
#, c-format
msgid "could not open file %s: %s\n"
msgstr "no es pot obrir el fitxer %s: %s\n"
#, c-format
msgid "%s database is inconsistent: name mismatch on package %s\n"
msgstr "la base de dades %s és inconsistent: nom erroni en el paquet %s\n"
#, c-format
msgid "%s database is inconsistent: version mismatch on package %s\n"
msgstr "la base de dades %s és inconsistent: versió errònia en el paquet %s\n"
#, c-format
msgid "could not create directory %s: %s\n"
msgstr "no s'ha pogut crear el directori %s: %s\n"
#, c-format
msgid "could not parse package description file in %s\n"
msgstr "no s'ha pogut analitzar el fitxers de descripció de paquet en %s\n"
#, c-format
msgid "missing package name in %s\n"
msgstr "falta nom de paquet en %s\n"
#, c-format
msgid "missing package version in %s\n"
msgstr "falta versió de paquet en %s\n"
#, c-format
msgid "error while reading package %s: %s\n"
msgstr "error en llegir paquet %s: %s\n"
#, c-format
msgid "missing package metadata in %s\n"
msgstr "falten les metadades del paquet en %s\n"
#, c-format
msgid "removing invalid file: %s\n"
msgstr ""
#, c-format
msgid "database path is undefined\n"
msgstr "no s'ha definit la ruta de la base de dades\n"
#, c-format
msgid "dependency cycle detected:\n"
msgstr "s'ha detectat una dependència cíclica:\n"
#, c-format
msgid "%s will be removed after its %s dependency\n"
msgstr "%s serà eliminat després de la seva dependència %s\n"
#, c-format
msgid "%s will be installed before its %s dependency\n"
msgstr "%s serà instal·lar abans de la seva dependència %s\n"
#, c-format
msgid "ignoring package %s-%s\n"
msgstr "s'està ignorant paquet %s-%s\n"
#, c-format
msgid "cannot resolve \"%s\", a dependency of \"%s\"\n"
msgstr "no es pot resoldre \"%s\", una dependència de \"%s\"\n"
#, c-format
msgid "could not get filesystem information\n"
msgstr ""
#, c-format
msgid "could not get filesystem information for %s: %s\n"
msgstr ""
#, c-format
msgid "could not determine mount point for file %s"
msgstr ""
#, c-format
msgid "could not determine filesystem mount points"
msgstr ""
#, c-format
msgid "Partition %s is mounted read only\n"
msgstr ""
#, c-format
msgid "Partition %s too full: %ld blocks needed, %ld blocks free\n"
msgstr ""
#, c-format
msgid "disk"
msgstr "disc"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "l'url '%s' és invàlid\n"
#, c-format
msgid "failed retrieving file '%s' from %s : %s\n"
msgstr "ha fallat en recuperar el fitxer '%s' des de %s : %s\n"
#, c-format
msgid "resuming download of %s not possible; starting over\n"
msgstr "no es pot la reprendre la baixada de %s, s'està iniciant de nou\n"
#, c-format
msgid "error writing to file '%s': %s\n"
msgstr "error en escriure al fitxer '%s': %s\n"
#, c-format
msgid "failed retrieving file '%s' from %s\n"
msgstr "ha fallat en recuperar el fitxer '%s' de %s\n"
#, c-format
msgid "%s appears to be truncated: %jd/%jd bytes\n"
msgstr "%s sembla estar truncat: %jd/%jd bytes\n"
#, c-format
msgid "failed to download %s\n"
msgstr "ha fallat en baixar %s\n"
#, c-format
msgid "out of memory!"
msgstr "memòria esgotada!"
#, c-format
msgid "unexpected system error"
msgstr "error inesperat del sistema"
#, c-format
msgid "insufficient privileges"
msgstr "privilegis insuficients"
#, c-format
msgid "could not find or read file"
msgstr "no es pot trobar o llegir fitxer"
#, c-format
msgid "could not find or read directory"
msgstr "no es pot trobar o llegir directori"
#, c-format
msgid "wrong or NULL argument passed"
msgstr "s'ha passat un argument erroni o NULL"
#, c-format
msgid "not enough free disk space"
msgstr ""
#, c-format
msgid "library not initialized"
msgstr "llibreria no inicialitzada"
#, c-format
msgid "library already initialized"
msgstr "la llibreria ja s'ha inicialitzat"
#, c-format
msgid "unable to lock database"
msgstr "no s'ha pogut bloquejar la base de dades"
#, c-format
msgid "could not open database"
msgstr "no s'ha pogut obrir la base de dades"
#, c-format
msgid "could not create database"
msgstr "no s'ha pogut crear la base de dades"
#, c-format
msgid "database not initialized"
msgstr "base de dades no inicialitzada"
#, c-format
msgid "database already registered"
msgstr "la base de dades ja s'ha registrat"
#, c-format
msgid "could not find database"
msgstr "no s'ha pogut trobar la base de dades"
#, c-format
msgid "database is incorrect version"
msgstr ""
#, c-format
msgid "could not update database"
msgstr "no s'ha pogut actualitzar la base de dades"
#, c-format
msgid "could not remove database entry"
msgstr "no s'ha pogut suprimir l'entrada de la base de dades"
#, c-format
msgid "invalid url for server"
msgstr "url del servidor invàlid"
#, c-format
msgid "no servers configured for repository"
msgstr "no s'ha configurat cap servidor pel repositori"
#, c-format
msgid "transaction already initialized"
msgstr "ja s'ha inicialitzat la transacció"
#, c-format
msgid "transaction not initialized"
msgstr "no s'ha inicialitzat la transacció"
#, c-format
msgid "duplicate target"
msgstr "objectiu duplicat"
#, c-format
msgid "transaction not prepared"
msgstr "transacció no preparada"
#, c-format
msgid "transaction aborted"
msgstr "transacció cancel·lada"
#, c-format
msgid "operation not compatible with the transaction type"
msgstr "l'operació no és compatible amb el tipus de transacció"
#, c-format
msgid "transaction commit attempt when database is not locked"
msgstr ""
"intent de publicació de la transacció amb la base de dades no bloquejada"
#, c-format
msgid "could not find or read package"
msgstr "no s'ha pogut trobar o llegir el paquet"
#, c-format
msgid "operation cancelled due to ignorepkg"
msgstr "operació cancel·lada degut a ignorepkg"
#, c-format
msgid "invalid or corrupted package"
msgstr "paquet invàlid o corrupte"
#, c-format
msgid "cannot open package file"
msgstr "no s'ha pogut obrir el fitxer de paquet"
#, c-format
msgid "cannot remove all files for package"
msgstr "no s'han pogut eliminar tots els fitxers del paquet"
#, c-format
msgid "package filename is not valid"
msgstr "el nom de fitxer del paquet no és vàlid"
#, c-format
msgid "package architecture is not valid"
msgstr "l'arquitectura del paquet no és vàlida"
#, c-format
msgid "could not find repository for target"
msgstr "no s'ha pogut trobar el repositori per l'objectiu"
#, c-format
msgid "invalid or corrupted delta"
msgstr "delta invàlid o corrupte"
#, c-format
msgid "delta patch failed"
msgstr "ha fallat el pedaç delta"
#, c-format
msgid "could not satisfy dependencies"
msgstr "no s'han pogut satisfer les dependències"
#, c-format
msgid "conflicting dependencies"
msgstr "dependències conflictives"
#, c-format
msgid "conflicting files"
msgstr "fitxers conflictius"
#, c-format
msgid "failed to retrieve some files"
msgstr "ha fallat en recuperar alguns fitxers"
#, c-format
msgid "failed to copy some file"
msgstr ""
#, c-format
msgid "invalid regular expression"
msgstr "expressió regular invàlida"
#, c-format
msgid "libarchive error"
msgstr "error de libarchive"
#, c-format
msgid "download library error"
msgstr "error de la llibreria de baixades"
#, c-format
msgid "error invoking external downloader"
msgstr "error en invocar el baixador extern"
#, c-format
msgid "unexpected error"
msgstr "error inesperat"
#, c-format
msgid "database larger than maximum size\n"
msgstr ""
#, c-format
msgid "could not find %s in database -- skipping\n"
msgstr "no s'ha pogut trobar %s en la base de dades -- s'està ometent\n"
#, c-format
msgid "removing %s from target list\n"
msgstr "s'està eliminant %s de la llista d'objectius\n"
#, c-format
msgid "cannot remove file '%s': %s\n"
msgstr "no s'ha pogut eliminar el fitxer '%s': %s\n"
#, c-format
msgid "could not remove database entry %s-%s\n"
msgstr "no s'ha pogut eliminar la entrada de la base de dades %s-%s\n"
#, c-format
msgid "could not remove entry '%s' from cache\n"
msgstr "no s'ha pogut eliminar l'entrada '%s' de la memòria cau\n"
#, c-format
msgid "%s: ignoring package upgrade (%s => %s)\n"
msgstr "%s: s'ha ignorat l'actualització del paquet (%s => %s)\n"
#, c-format
msgid "%s: ignoring package downgrade (%s => %s)\n"
msgstr "%s: s'ha ignorat la desactualització del paquet (%s => %s)\n"
#, c-format
msgid "%s: downgrading from version %s to version %s\n"
msgstr "%s: desactualitzant de la versió %s a la versió %s\n"
#, c-format
msgid "%s: local (%s) is newer than %s (%s)\n"
msgstr "%s: local (%s) és més nou que %s (%s)\n"
#, c-format
msgid "ignoring package replacement (%s-%s => %s-%s)\n"
msgstr "s'està ignorant el reemplaçament del paquet (%s-%s => %s-%s)\n"
#, c-format
msgid "cannot replace %s by %s\n"
msgstr "no s'ha pogut reemplaçar %s per %s\n"
#, c-format
msgid "unresolvable package conflicts detected\n"
msgstr "s'ha detectat un paquet amb un conflicte impossible de resoldre\n"
#, c-format
msgid "removing '%s' from target list because it conflicts with '%s'\n"
msgstr ""
"s'està eliminant '%s' de la llista d'objectius perquè té conflictes amb "
"'%s'\n"
#, c-format
msgid "failed to retrieve some files from %s\n"
msgstr "ha fallat en recuperar alguns fitxers de %s\n"
#, c-format
msgid "could not commit removal transaction\n"
msgstr "no s'ha pogut publicar la transacció d'eliminació\n"
#, c-format
msgid "could not commit transaction\n"
msgstr "no s'ha pogut publicar la transacció\n"
#, c-format
msgid "%s database version is too old\n"
msgstr ""
#, c-format
msgid "could not remove lock file %s\n"
msgstr "no s'ha pogut eliminar el fitxer de bloqueig %s\n"
#, c-format
msgid "could not create temp directory\n"
msgstr "no s'ha pogut crear el directori temporal\n"
#, c-format
msgid "could not copy tempfile to %s (%s)\n"
msgstr "no s'ha pogut copiar el fitxer temporal a %s (%s)\n"
#, c-format
msgid "could not remove tmpdir %s\n"
msgstr "no s'ha pogut eliminar el directori temporal %s\n"
#, c-format
msgid "could not create pipe (%s)\n"
msgstr ""
#, c-format
msgid "could not fork a new process (%s)\n"
msgstr "no s'ha pogut bifurcar a un nou procés (%s)\n"
#, c-format
msgid "could not change the root directory (%s)\n"
msgstr "no s'ha pogut canviar el directori arrel (%s)\n"
#, c-format
msgid "call to execv failed (%s)\n"
msgstr ""
#, c-format
msgid "call to waitpid failed (%s)\n"
msgstr "ha fallat la crida a waitpid (%s)\n"
#, c-format
msgid "could not open pipe (%s)\n"
msgstr ""
#, c-format
msgid "command failed to execute correctly\n"
msgstr "l'ordre a fallat a executar-se correctament\n"
#, c-format
msgid "no %s cache exists, creating...\n"
msgstr "no existeix memòria cau %s, s'està creant...\n"
#, c-format
msgid "couldn't create package cache, using /tmp instead\n"
msgstr "no s'ha pogut crear la memòria cau del paquet, s'usarà /tmp\n"

View File

@@ -1,45 +1,41 @@
# translation of cs.po to Čeština
# Copyright (C) 2009 Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the pacman package manager package.
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Vojtěch Gondžala <vojtech.gondzala@gmail.com>, 2007, 2008, 2009.
msgid ""
msgstr ""
"Project-Id-Version: Pacman package manager 3.3.1\n"
"Report-Msgid-Bugs-To: pacman-dev@archlinux.org\n"
"POT-Creation-Date: 2009-10-04 16:48+0200\n"
"PO-Revision-Date: 2009-10-04 17:08+0200\n"
"Last-Translator: Vojtěch Gondžala <vojtech.gondzala@gmail.com>\n"
"Language-Team: Czech <kde-i18n-doc@kde.org>\n"
"Project-Id-Version: Arch Linux Pacman package manager\n"
"Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
"POT-Creation-Date: 2011-03-14 13:51-0500\n"
"PO-Revision-Date: 2011-03-14 18:54+0000\n"
"Last-Translator: toofishes <dpmcgee@gmail.com>\n"
"Language-Team: Czech <None>\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.0\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2\n"
#, c-format
msgid "replacing older version %s-%s by %s in target list\n"
msgstr "v seznamu cílů nahrazena starší verze %s-%s za %s\n"
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s je aktuální -- vynechat\n"
#, c-format
msgid "skipping %s-%s because newer version %s is in target list\n"
msgstr "vynechává se %s-%s, protože v seznamu cílů je novější veze %s\n"
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s je aktuální -- přeinstalovat\n"
#, c-format
msgid "conflicting packages were found in target list\n"
msgstr "v seznamu cílů byly nalezeny konfliktní balíčky\n"
msgid "downgrading package %s (%s => %s)\n"
msgstr "snížení verze balíčku %s (%s => %s)\n"
#, c-format
msgid "you cannot install two conflicting packages at the same time\n"
msgstr "nelze instalovat dva konfliktní balíčky současně\n"
msgid "warning given when extracting %s (%s)\n"
msgstr "varování při rozbalování %s (%s)\n"
#, c-format
msgid "replacing packages with -U is not supported yet\n"
msgstr "nahrazování balíčků pomocí -U není nyní podporováno\n"
#, c-format
msgid "you can replace packages manually using -Rd and -U\n"
msgstr "balíčky lze nahradit ručně použitím -Rd a -U\n"
msgid "could not extract %s (%s)\n"
msgstr "nelze rozbalit %s (%s)\n"
#, c-format
msgid ""
@@ -47,7 +43,7 @@ msgid ""
"filesystem: %o package: %o\n"
msgstr ""
"přístupová práva adresáře %s se neshodují\n"
"souborový systém: %o balíček: %o\n"
"souborový systém: %o balíček: %o\n"
#, c-format
msgid "extract: not overwriting dir with file %s\n"
@@ -57,10 +53,6 @@ msgstr "rozbalení: adresář nebyl přepsán souborem %s\n"
msgid "extract: symlink %s does not point to dir\n"
msgstr "rozbalení: symbolický odkaz %s neodkazuje na adresář\n"
#, c-format
msgid "could not extract %s (%s)\n"
msgstr "nelze rozbalit %s (%s)\n"
#, c-format
msgid "could not rename %s to %s (%s)\n"
msgstr "nelze přejmenovat %s na %s (%s)\n"
@@ -85,6 +77,10 @@ msgstr "%s byl rozbalen jako %s.pacnew\n"
msgid "could not get current working directory\n"
msgstr "nelze určit aktuální pracovní adresář\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "nelze změnit adresář na %s (%s)\n"
#, c-format
msgid "problem occurred while upgrading %s\n"
msgstr "nastal problém při aktualizaci %s\n"
@@ -99,20 +95,20 @@ msgstr "nelze aktualizovat záznam databáze %s-%s\n"
#, c-format
msgid "could not add entry '%s' in cache\n"
msgstr "nelze přidat položku '%s' do cache\n"
msgstr "nelze přidat položku '%s' do mezipaměti\n"
#, c-format
msgid "removing invalid database: %s\n"
msgstr "odstraňuje se chybná databáze: %s\n"
#, c-format
msgid "could not remove database %s\n"
msgstr "nelze odstranit záznam v databázi %s\n"
#, c-format
msgid "invalid name for database entry '%s'\n"
msgstr "chybný název záznamu v databázi '%s'\n"
#, c-format
msgid "duplicated database entry '%s'\n"
msgstr "duplicitní záznam v databázi '%s'\n"
#, c-format
msgid "corrupted database entry '%s'\n"
msgstr "poškozený záznam v databázi '%s'\n"
@@ -154,8 +150,8 @@ msgid "missing package metadata in %s\n"
msgstr "chybí metadata balíčku v %s\n"
#, c-format
msgid "attempt to re-register the 'local' DB\n"
msgstr "pokus o opětovné zaregistrování databáze 'local'\n"
msgid "removing invalid file: %s\n"
msgstr "odstraněn neplatný soubor: %s\n"
#, c-format
msgid "database path is undefined\n"
@@ -177,37 +173,50 @@ msgstr "%s bude nainstalován před %s, na kterém závisí\n"
msgid "ignoring package %s-%s\n"
msgstr "ignoruje se balíček %s-%s\n"
#, c-format
msgid "provider package was selected (%s provides %s)\n"
msgstr "byl vybrán nahrazující balíček (%s poskytuje %s)\n"
#, c-format
msgid "cannot resolve \"%s\", a dependency of \"%s\"\n"
msgstr "nelze vyřešit \"%s\", závislost \"%s\"\n"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "URL '%s' je chybná\n"
msgid "could not get filesystem information\n"
msgstr "nepodařilo se získat informace o souborovém systému\n"
#, c-format
msgid "url scheme not specified, assuming HTTP\n"
msgstr "schéma URL nedefinováno, předpokládá se HTTP\n"
msgid "could not get filesystem information for %s: %s\n"
msgstr "nepodařilo se získat informace o souborovém systému %s: %s\n"
#, c-format
msgid "could not determine mount point for file %s"
msgstr "nepodařilo se určit připojovací bod pro soubor %s"
#, c-format
msgid "could not determine filesystem mount points"
msgstr "nepodařilo se určit připojovací body pro souborové systémy"
#, c-format
msgid "Partition %s is mounted read only\n"
msgstr "Diskový oddíl %s je připojen jen pro čtení\n"
#, c-format
msgid "Partition %s too full: %ld blocks needed, %ld blocks free\n"
msgstr ""
"Diskový oddíl %s je příliš plný: je potřeba %ld bloků, %ld bloků je volných\n"
#, c-format
msgid "disk"
msgstr "disk"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "URL '%s' je chybná\n"
#, c-format
msgid "failed retrieving file '%s' from %s : %s\n"
msgstr "selhalo získání souboru '%s' z %s: %s\n"
#, c-format
msgid "cannot resume download, starting over\n"
msgstr "nelze navázat stahování, začíná se znovu\n"
#, c-format
msgid "cannot write to file '%s'\n"
msgstr "nelze zapisovat do souboru '%s'\n"
msgid "resuming download of %s not possible; starting over\n"
msgstr "nelze navázat stahování %s, začíná se znovu\n"
#, c-format
msgid "error writing to file '%s': %s\n"
@@ -249,6 +258,10 @@ msgstr "nelze nalézt nebo číst adresář"
msgid "wrong or NULL argument passed"
msgstr "předán chybný nebo NULL argument"
#, c-format
msgid "not enough free disk space"
msgstr "není dostatek volného místa na disku"
#, c-format
msgid "library not initialized"
msgstr "knihovna nebyla inicializována"
@@ -281,6 +294,10 @@ msgstr "databáze zaregistrována"
msgid "could not find database"
msgstr "nelze nalézt databázi"
#, c-format
msgid "database is incorrect version"
msgstr "databáze má nesprávnou verzi"
#, c-format
msgid "could not update database"
msgstr "nelze aktualizovat databázi"
@@ -350,8 +367,12 @@ msgid "package filename is not valid"
msgstr "jméno souboru balíčku není platné"
#, c-format
msgid "no such repository"
msgstr "takový repositář není nastaven"
msgid "package architecture is not valid"
msgstr "architektura balíčku není platná"
#, c-format
msgid "could not find repository for target"
msgstr "nelze nalézt repositář cíle"
#, c-format
msgid "invalid or corrupted delta"
@@ -377,6 +398,10 @@ msgstr "konfliktní soubory"
msgid "failed to retrieve some files"
msgstr "selhalo získání některých souborů"
#, c-format
msgid "failed to copy some file"
msgstr "selhalo kopírování souboru"
#, c-format
msgid "invalid regular expression"
msgstr "nesprávný regulární výraz"
@@ -397,6 +422,10 @@ msgstr "chyba volání externího programu pro stahování souborů"
msgid "unexpected error"
msgstr "neočekávaná chyba"
#, c-format
msgid "database larger than maximum size\n"
msgstr "databáze je větší než maximální přípustná velikost\n"
#, c-format
msgid "could not find %s in database -- skipping\n"
msgstr "nelze nalézt %s v databázi -- vynechat\n"
@@ -415,7 +444,7 @@ msgstr "nelze odstranit záznam databáze %s-%s\n"
#, c-format
msgid "could not remove entry '%s' from cache\n"
msgstr "nelze odstranit položku '%s' z cache\n"
msgstr "nelze odstranit položku '%s' z mezipaměti\n"
#, c-format
msgid "%s: ignoring package upgrade (%s => %s)\n"
@@ -423,11 +452,11 @@ msgstr "%s: ignoruje se aktualizace balíčku (%s => %s)\n"
#, c-format
msgid "%s: ignoring package downgrade (%s => %s)\n"
msgstr "%s: ignoruje se ponížení verze balíčku (%s => %s)\n"
msgstr "%s: ignoruje se snížení verze balíčku (%s => %s)\n"
#, c-format
msgid "%s: downgrading from version %s to version %s\n"
msgstr "%s: ponížení z verze %s na verzi %s\n"
msgstr "%s: snížení z verze %s na verzi %s\n"
#, c-format
msgid "%s: local (%s) is newer than %s (%s)\n"
@@ -441,22 +470,6 @@ msgstr "ignoruje se náhrada balíčku (%s-%s => %s-%s)\n"
msgid "cannot replace %s by %s\n"
msgstr "nelze nahradit soubor %s souborem %s\n"
#, c-format
msgid "repository '%s' not found\n"
msgstr "repositář '%s' nebyl nalezen\n"
#, c-format
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s je aktuální -- vynechat\n"
#, c-format
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s je aktuální -- přeinstalovat\n"
#, c-format
msgid "downgrading package %s (%s => %s)\n"
msgstr "ponížení verze balíčku %s (%s => %s)\n"
#, c-format
msgid "unresolvable package conflicts detected\n"
msgstr "zjištěn konflikt nerozlišitelných balíčků\n"
@@ -469,26 +482,6 @@ msgstr "'%s' odstraněn ze seznamu cílů, protože je konfliktní s '%s'\n"
msgid "failed to retrieve some files from %s\n"
msgstr "selhalo získání některých souborů z %s\n"
#, c-format
msgid "could not create removal transaction\n"
msgstr "nelze vytvořit transakci pro odstranění\n"
#, c-format
msgid "could not create transaction\n"
msgstr "nelze vytvořit transakci\n"
#, c-format
msgid "could not initialize the removal transaction\n"
msgstr "nelze inicializovat transakci pro odstranění\n"
#, c-format
msgid "could not initialize transaction\n"
msgstr "nelze inicializovat transakci\n"
#, c-format
msgid "could not prepare removal transaction\n"
msgstr "nelze připravit transakci pro odstranění\n"
#, c-format
msgid "could not commit removal transaction\n"
msgstr "nelze provést transakci pro odstranění\n"
@@ -497,6 +490,10 @@ msgstr "nelze provést transakci pro odstranění\n"
msgid "could not commit transaction\n"
msgstr "nelze provést transakci\n"
#, c-format
msgid "%s database version is too old\n"
msgstr "verze databáze %s je příliš stará\n"
#, c-format
msgid "could not remove lock file %s\n"
msgstr "nelze odstranit zamykací soubor %s\n"
@@ -514,12 +511,8 @@ msgid "could not remove tmpdir %s\n"
msgstr "nelze odstranit dočasný adresář %s\n"
#, c-format
msgid "could not open %s: %s\n"
msgstr "nelze otevřít %s: %s\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "nelze změnit adresář na %s (%s)\n"
msgid "could not create pipe (%s)\n"
msgstr "nepodařilo se vytvořit rouru (%s)\n"
#, c-format
msgid "could not fork a new process (%s)\n"
@@ -530,70 +523,25 @@ msgid "could not change the root directory (%s)\n"
msgstr "nelze změnit kořenový adresář (%s)\n"
#, c-format
msgid "could not change directory to / (%s)\n"
msgstr "nelze změnit adresář na / (%s)\n"
#, c-format
msgid "call to popen failed (%s)\n"
msgstr "volání popen selhalo (%s)\n"
msgid "call to execv failed (%s)\n"
msgstr "volání execv selhalo (%s)\n"
#, c-format
msgid "call to waitpid failed (%s)\n"
msgstr "volání waitpid selhalo (%s)\n"
#, c-format
msgid "could not open pipe (%s)\n"
msgstr "nepodařilo se otevřít rouru (%s)\n"
#, c-format
msgid "command failed to execute correctly\n"
msgstr "příkaz se nepodařilo spustit správně\n"
#, c-format
msgid "no %s cache exists, creating...\n"
msgstr "neexistuje cache %s, vytváří se...\n"
msgstr "neexistuje mezipaměť %s, vytváří se...\n"
#, c-format
msgid "couldn't create package cache, using /tmp instead\n"
msgstr "nelze vytvořit cache balíčků, používá se /tmp\n"
#~ msgid "error downloading '%s': %s\n"
#~ msgstr "chyba při stahování '%s': %s\n"
#~ msgid "could not chdir to %s\n"
#~ msgstr "nelze změnit adresář na %s\n"
#~ msgid "running XferCommand: fork failed!\n"
#~ msgstr "spouští se XferCommand: větvení selhalo!\n"
#~ msgid "could not commit transaction"
#~ msgstr "nelze provést transakci"
#~ msgid "could not download all files"
#~ msgstr "nelze stáhnout všechny soubory"
#~ msgid "cannot load package data"
#~ msgstr "nelze načíst data z balíčku"
#~ msgid "package not installed or lesser version"
#~ msgstr "balíček není nainstalovaný nebo má nižší verzi"
#~ msgid "group not found"
#~ msgstr "skupina nebyla nalezena"
#~ msgid "user aborted the operation"
#~ msgstr "uživatel zrušil operaci"
#~ msgid "internal error"
#~ msgstr "interní chyba"
#~ msgid "not confirmed"
#~ msgstr "nepotvrzeno"
#~ msgid "%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"
#~ msgstr "%s-%s: ignoruje se aktualizace balíčku (měl být nahrazen %s-%s)\n"
#~ msgid "command: %s\n"
#~ msgstr "příkaz: %s\n"
#~ msgid "could not prepare transaction\n"
#~ msgstr "nelze připravit transakci\n"
#~ msgid "No /bin/sh in parent environment, aborting scriptlet\n"
#~ msgstr "V rodičovském prostředí chybí /bin/sh, ruší se provádění skriptů\n"
msgstr "nelze vytvořit mezipaměť balíčků, používá se /tmp\n"

546
lib/libalpm/po/da.po Normal file
View File

@@ -0,0 +1,546 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Arch Linux Pacman package manager\n"
"Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
"POT-Creation-Date: 2011-03-14 13:51-0500\n"
"PO-Revision-Date: 2011-03-04 18:24+0000\n"
"Last-Translator: toofishes <dpmcgee@gmail.com>\n"
"Language-Team: Danish <None>\n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#, c-format
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s er opdateret - springer over\n"
#, c-format
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s er opdateret - springer over\n"
#, c-format
msgid "downgrading package %s (%s => %s)\n"
msgstr "nedgraderer pakke %s (%s => %s)\n"
#, c-format
msgid "warning given when extracting %s (%s)\n"
msgstr ""
#, c-format
msgid "could not extract %s (%s)\n"
msgstr "kunne ikke udtrække %s (%s)\n"
#, c-format
msgid ""
"directory permissions differ on %s\n"
"filesystem: %o package: %o\n"
msgstr ""
"mapperettigheder er forskellige for %s\n"
"filsystem: %o pakke: %o\n"
#, c-format
msgid "extract: not overwriting dir with file %s\n"
msgstr "udtræk: overskriver ikke mappe med fil %s\n"
#, c-format
msgid "extract: symlink %s does not point to dir\n"
msgstr "udtræk: symbolsk henvisning %s peger ikke på mappe\n"
#, c-format
msgid "could not rename %s to %s (%s)\n"
msgstr "kunne ikke omdøbe %s til %s (%s)\n"
#, c-format
msgid "%s saved as %s\n"
msgstr "%s gemt som %s\n"
#, c-format
msgid "could not install %s as %s (%s)\n"
msgstr "kunne ikke installere %s som %s (%s)\n"
#, c-format
msgid "%s installed as %s\n"
msgstr "%s installeret som %s\n"
#, c-format
msgid "extracting %s as %s.pacnew\n"
msgstr "udtrækker %s som %s.pacnew\n"
#, c-format
msgid "could not get current working directory\n"
msgstr "kunne ikke hente aktuelt arbejdsmappe\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "kunne ikke ændre mappe til %s (%s)\n"
#, c-format
msgid "problem occurred while upgrading %s\n"
msgstr "der opstod et problem under opgradering %s\n"
#, c-format
msgid "problem occurred while installing %s\n"
msgstr "der opstod et problem under installation af %s\n"
#, c-format
msgid "could not update database entry %s-%s\n"
msgstr "kunne ikke opdatere databasepunkt %s-%s\n"
#, c-format
msgid "could not add entry '%s' in cache\n"
msgstr "kunne ikke tilføje punkt »%s« i mellemlager\n"
#, c-format
msgid "removing invalid database: %s\n"
msgstr "fjerner ugyldig database: %s\n"
#, c-format
msgid "invalid name for database entry '%s'\n"
msgstr "ugyldigt navn for databasepunkt »%s«\n"
#, c-format
msgid "duplicated database entry '%s'\n"
msgstr "duplikeret databasepunkt »%s«\n"
#, c-format
msgid "corrupted database entry '%s'\n"
msgstr "ødelagt databasepunkt »%s«\n"
#, c-format
msgid "could not open file %s: %s\n"
msgstr "kunne ikke åbne fil %s: %s\n"
#, c-format
msgid "%s database is inconsistent: name mismatch on package %s\n"
msgstr "%s-database er inkonsistent: forskellige navne på pakke %s\n"
#, c-format
msgid "%s database is inconsistent: version mismatch on package %s\n"
msgstr "%s-database er inkonsistent: forskellige versioner på pakke %s\n"
#, c-format
msgid "could not create directory %s: %s\n"
msgstr "kunne ikke oprette mappe %s: %s\n"
#, c-format
msgid "could not parse package description file in %s\n"
msgstr "kunne ikke fortolke pakkebeskrivelsesfil i %s\n"
#, c-format
msgid "missing package name in %s\n"
msgstr "manglende pakkenavn i %s\n"
#, c-format
msgid "missing package version in %s\n"
msgstr "manglende pakkeversion i %s\n"
#, c-format
msgid "error while reading package %s: %s\n"
msgstr "der opstod en fejl under læsning af pakke %s: %s\n"
#, c-format
msgid "missing package metadata in %s\n"
msgstr "manglende pakkemetadata i %s\n"
#, c-format
msgid "removing invalid file: %s\n"
msgstr ""
#, c-format
msgid "database path is undefined\n"
msgstr "databasesti er udefineret\n"
#, c-format
msgid "dependency cycle detected:\n"
msgstr "afhængighedscyklus detekteret:\n"
#, c-format
msgid "%s will be removed after its %s dependency\n"
msgstr "%s vil blive fjernet efter dennes %s-afhængighed\n"
#, c-format
msgid "%s will be installed before its %s dependency\n"
msgstr "%s vil blive installeret før dennes %s-afhængighed\n"
#, c-format
msgid "ignoring package %s-%s\n"
msgstr "ignorerer pakke %s-%s\n"
#, c-format
msgid "cannot resolve \"%s\", a dependency of \"%s\"\n"
msgstr "kan ikke læse »%s«, en afhængighed af »%s«\n"
#, c-format
msgid "could not get filesystem information\n"
msgstr ""
#, c-format
msgid "could not get filesystem information for %s: %s\n"
msgstr ""
#, c-format
msgid "could not determine mount point for file %s"
msgstr ""
#, c-format
msgid "could not determine filesystem mount points"
msgstr ""
#, c-format
msgid "Partition %s is mounted read only\n"
msgstr ""
#, c-format
msgid "Partition %s too full: %ld blocks needed, %ld blocks free\n"
msgstr ""
#, c-format
msgid "disk"
msgstr "disk"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "adressen »%s« er ugyldig\n"
#, c-format
msgid "failed retrieving file '%s' from %s : %s\n"
msgstr "fejlede i indhentning af fil »%s« fra %s: %s\n"
#, c-format
msgid "resuming download of %s not possible; starting over\n"
msgstr "det er ikke muligt at genoptage hentning af %s; starter forfra\n"
#, c-format
msgid "error writing to file '%s': %s\n"
msgstr "fejl under skrivning til fil »%s«: %s\n"
#, c-format
msgid "failed retrieving file '%s' from %s\n"
msgstr "kunne ikke indhente fil »%s« fra %s\n"
#, c-format
msgid "%s appears to be truncated: %jd/%jd bytes\n"
msgstr "%s ser ud til at være afkortet: %jd/%jd byte\n"
#, c-format
msgid "failed to download %s\n"
msgstr "kunne ikke hente %s\n"
#, c-format
msgid "out of memory!"
msgstr "ikke nok hukommelse!"
#, c-format
msgid "unexpected system error"
msgstr "uventet systemfejl"
#, c-format
msgid "insufficient privileges"
msgstr "utilstrækkelige privilegier"
#, c-format
msgid "could not find or read file"
msgstr "kunne ikke finde eller læse fil"
#, c-format
msgid "could not find or read directory"
msgstr "kunne ikke finde eller læse mappe"
#, c-format
msgid "wrong or NULL argument passed"
msgstr "forkert eller NULL-argument vidersendt"
#, c-format
msgid "not enough free disk space"
msgstr ""
#, c-format
msgid "library not initialized"
msgstr "bibliotek er ikke initialiseret"
#, c-format
msgid "library already initialized"
msgstr "bibliotek er allerede initialiseret"
#, c-format
msgid "unable to lock database"
msgstr "kunne ikke låse database"
#, c-format
msgid "could not open database"
msgstr "kunne ikke åbne database"
#, c-format
msgid "could not create database"
msgstr "kunne ikke oprette database"
#, c-format
msgid "database not initialized"
msgstr "database er ikke initialiseret"
#, c-format
msgid "database already registered"
msgstr "database er allerede registreret"
#, c-format
msgid "could not find database"
msgstr "kunne ikke finde database"
#, c-format
msgid "database is incorrect version"
msgstr ""
#, c-format
msgid "could not update database"
msgstr "kunne ikke opdatere database"
#, c-format
msgid "could not remove database entry"
msgstr "kunne ikke fjerne databasepunkt"
#, c-format
msgid "invalid url for server"
msgstr "ugyldig adresse for server"
#, c-format
msgid "no servers configured for repository"
msgstr "ingen servere konfigureret for arkiv"
#, c-format
msgid "transaction already initialized"
msgstr "transaktion allerede initialiseret"
#, c-format
msgid "transaction not initialized"
msgstr "transaktion er ikke initialiseret"
#, c-format
msgid "duplicate target"
msgstr "dupliker mål"
#, c-format
msgid "transaction not prepared"
msgstr "transaktion er ikke forberedt"
#, c-format
msgid "transaction aborted"
msgstr "transaktion afbrudt"
#, c-format
msgid "operation not compatible with the transaction type"
msgstr "handling er ikke kompatibel med transaktionstype"
#, c-format
msgid "transaction commit attempt when database is not locked"
msgstr "forsøg på transaktionsindsendelse (commit) når database ikke er låst"
#, c-format
msgid "could not find or read package"
msgstr "kunne ikke finde eller læse pakke"
#, c-format
msgid "operation cancelled due to ignorepkg"
msgstr "handling afbrudt på grund af igonrepkg"
#, c-format
msgid "invalid or corrupted package"
msgstr "ugyldig eller ødelagt pakke"
#, c-format
msgid "cannot open package file"
msgstr "kan ikke åbne pakkefil"
#, c-format
msgid "cannot remove all files for package"
msgstr "kan ikke fjerne alle filer for pakke"
#, c-format
msgid "package filename is not valid"
msgstr "pakkefilnavn er ugyldigt"
#, c-format
msgid "package architecture is not valid"
msgstr "pakkearkitektur er ikke gyldig"
#, c-format
msgid "could not find repository for target"
msgstr "kunne ikke finde arkiv for mål"
#, c-format
msgid "invalid or corrupted delta"
msgstr "ugyldig eller ødelagt delta"
#, c-format
msgid "delta patch failed"
msgstr "deltarettelse (patch) fejlede"
#, c-format
msgid "could not satisfy dependencies"
msgstr "kunne ikke tilfredsstille afhængigheder"
#, c-format
msgid "conflicting dependencies"
msgstr "konfliktende afhængigheder"
#, c-format
msgid "conflicting files"
msgstr "konfliktende filer"
#, c-format
msgid "failed to retrieve some files"
msgstr "kunne ikke indhente nogle filer"
#, c-format
msgid "failed to copy some file"
msgstr ""
#, c-format
msgid "invalid regular expression"
msgstr "ugyldigt regulært udtryk"
#, c-format
msgid "libarchive error"
msgstr "biblioteksarkivfejl"
#, c-format
msgid "download library error"
msgstr "hent biblioteksfejl"
#, c-format
msgid "error invoking external downloader"
msgstr "fejl under opstart af ekstern hentningsprogram"
#, c-format
msgid "unexpected error"
msgstr "uventet fejl"
#, c-format
msgid "database larger than maximum size\n"
msgstr ""
#, c-format
msgid "could not find %s in database -- skipping\n"
msgstr "kunne ikke finde %s i database - springer over\n"
#, c-format
msgid "removing %s from target list\n"
msgstr "fjerner %s fra målliste\n"
#, c-format
msgid "cannot remove file '%s': %s\n"
msgstr "kan ikke fjerne fil »%s«:%s\n"
#, c-format
msgid "could not remove database entry %s-%s\n"
msgstr "kunne ikke fjerne databasepunkt %s-%s\n"
#, c-format
msgid "could not remove entry '%s' from cache\n"
msgstr "kunne ikke fjerne punkt '%s' fra mellemlager\n"
#, c-format
msgid "%s: ignoring package upgrade (%s => %s)\n"
msgstr "%s: ignorerer pakkeopgradering (%s => %s)\n"
#, c-format
msgid "%s: ignoring package downgrade (%s => %s)\n"
msgstr "%s: ignorerer pakkenedgradering (%s => %s)\n"
#, c-format
msgid "%s: downgrading from version %s to version %s\n"
msgstr "%s: nedgraderer fra version %s til version %s\n"
#, c-format
msgid "%s: local (%s) is newer than %s (%s)\n"
msgstr "%s: lokal (%s) er nyere end %s (%s)\n"
#, c-format
msgid "ignoring package replacement (%s-%s => %s-%s)\n"
msgstr "ignorerer pakkeerstatning (%s-%s => %s-%s)\n"
#, c-format
msgid "cannot replace %s by %s\n"
msgstr "kan ikke erstatte %s med %s\n"
#, c-format
msgid "unresolvable package conflicts detected\n"
msgstr "pakkekonflikter, der ikke kan løses, er detekteret\n"
#, c-format
msgid "removing '%s' from target list because it conflicts with '%s'\n"
msgstr "fjerner »%s« fra målliste da det konflikter med »%s«\n"
#, c-format
msgid "failed to retrieve some files from %s\n"
msgstr "kunne ikke indhente nogle filer fra %s\n"
#, c-format
msgid "could not commit removal transaction\n"
msgstr "kunne ikke indsende (commit) fjernelsestransaktion\n"
#, c-format
msgid "could not commit transaction\n"
msgstr "kunne ikke indsende (commit) transaktion\n"
#, c-format
msgid "%s database version is too old\n"
msgstr ""
#, c-format
msgid "could not remove lock file %s\n"
msgstr "kunne ikke fjerne låsningsfil %s\n"
#, c-format
msgid "could not create temp directory\n"
msgstr "kunne ikke oprette midlertidig mappe\n"
#, c-format
msgid "could not copy tempfile to %s (%s)\n"
msgstr "kunne ikke kopier midlertidig fil til %s (%s)\n"
#, c-format
msgid "could not remove tmpdir %s\n"
msgstr "kunne ikke fjerne tmpdir %s\n"
#, c-format
msgid "could not create pipe (%s)\n"
msgstr ""
#, c-format
msgid "could not fork a new process (%s)\n"
msgstr "kunne ikke forgren en ny proces (%s)\n"
#, c-format
msgid "could not change the root directory (%s)\n"
msgstr "kunne ikke ændre rodmappen (%s)\n"
#, c-format
msgid "call to execv failed (%s)\n"
msgstr ""
#, c-format
msgid "call to waitpid failed (%s)\n"
msgstr "kald til waitpid fejlede (%s)\n"
#, c-format
msgid "could not open pipe (%s)\n"
msgstr ""
#, c-format
msgid "command failed to execute correctly\n"
msgstr "kommando kunne ikke udføres korrekt\n"
#, c-format
msgid "no %s cache exists, creating...\n"
msgstr "intet %s-mellemlager findes, opretter...\n"
#, c-format
msgid "couldn't create package cache, using /tmp instead\n"
msgstr "kunne ikke oprette pakkemellemlager, bruger /tmp i steden for\n"

View File

@@ -1,52 +1,41 @@
# translation of de.po to German
# German translations for Pacman package manager package.
# Copyright (C) 2009 Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the pacman package manager package.
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Marcus Habermehl <bmh1980@frugalware.org>, 2006.
# Pierre Schmitz <pierre@archlinux.de>, 2007.
# Niclas Pfeifer <macwolf@archlinux.de>, 2007.
# Matthias Gorissen <matthias@archlinux.de>, 2008-2009.
msgid ""
msgstr ""
"Project-Id-Version: Pacman package manager 3.3.1\n"
"Report-Msgid-Bugs-To: pacman-dev@archlinux.org\n"
"POT-Creation-Date: 2009-10-04 16:48+0200\n"
"PO-Revision-Date: 2009-10-04 17:08+0200\n"
"Last-Translator: Matthias Gorissen <matthias@archlinux.de>\n"
"Language-Team: German <archlinux.de>\n"
"Project-Id-Version: Arch Linux Pacman package manager\n"
"Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
"POT-Creation-Date: 2011-03-14 13:51-0500\n"
"PO-Revision-Date: 2011-03-08 14:50+0000\n"
"Last-Translator: tlaloc <matthias@archlinux.de>\n"
"Language-Team: German <None>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);X-Generator: KBabel 1.11.4\n"
"X-Generator: KBabel 1.11.4\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#, c-format
msgid "replacing older version %s-%s by %s in target list\n"
msgstr "Ersetze ältere Version %s-%s durch %s in der Ziel-Liste\n"
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s ist aktuell -- Überspringe\n"
#, c-format
msgid "skipping %s-%s because newer version %s is in target list\n"
msgstr ""
"Überspringe %s-%s, da sich die neuere Version %s in der Ziel-Liste befindet\n"
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s ist aktuell -- Reinstalliere\n"
#, c-format
msgid "conflicting packages were found in target list\n"
msgstr "In Konflikt stehende Pakete wurden in der Ziel-Liste gefunden\n"
msgid "downgrading package %s (%s => %s)\n"
msgstr "Downgrade des Paketes %s (%s => %s)\n"
#, c-format
msgid "you cannot install two conflicting packages at the same time\n"
msgstr ""
"Sie können nicht zwei in Konflikt stehende Pakete zur selben Zeit "
"installieren\n"
msgid "warning given when extracting %s (%s)\n"
msgstr "Es erscheint eine Warnung, wenn %s extrahiert wird (%s)\n"
#, c-format
msgid "replacing packages with -U is not supported yet\n"
msgstr "Das Ersetzen von Paketen mit -U wird noch nicht unterstützt\n"
#, c-format
msgid "you can replace packages manually using -Rd and -U\n"
msgstr "Sie können Pakete manuell mit -Rd und -U ersetzen\n"
msgid "could not extract %s (%s)\n"
msgstr "Konnte %s nicht entpacken (%s)\n"
#, c-format
msgid ""
@@ -64,10 +53,6 @@ msgstr "Entpacken: Überschreibe Verzeichnis nicht mit Datei %s\n"
msgid "extract: symlink %s does not point to dir\n"
msgstr "Entpacken: Symlink %s zeigt nicht zum Verzeichnis\n"
#, c-format
msgid "could not extract %s (%s)\n"
msgstr "Konnte %s nicht entpacken (%s)\n"
#, c-format
msgid "could not rename %s to %s (%s)\n"
msgstr "Konnte %s nicht in %s umbenennen (%s)\n"
@@ -92,6 +77,10 @@ msgstr "Entpacke %s als %s.pacnew\n"
msgid "could not get current working directory\n"
msgstr "Konnte aktuelles Arbeitsverzeichnis nicht ermitteln\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "Konnte nicht zu Verzeichnis %s wechseln (%s)\n"
#, c-format
msgid "problem occurred while upgrading %s\n"
msgstr "Fehler traten auf, während %s aktualisiert wurde\n"
@@ -112,14 +101,14 @@ msgstr "Konnte Eintrag '%s' nicht zum Pufferspeicher hinzufügen\n"
msgid "removing invalid database: %s\n"
msgstr "Entferne die ungültige Datenbank: %s\n"
#, c-format
msgid "could not remove database %s\n"
msgstr "Konnte Datenbank %s nicht entfernen\n"
#, c-format
msgid "invalid name for database entry '%s'\n"
msgstr "Ungültiger Name für Datenbank-Eintrag '%s'\n"
#, c-format
msgid "duplicated database entry '%s'\n"
msgstr "Doppelter Datenbank-Eintrag '%s'\n"
#, c-format
msgid "corrupted database entry '%s'\n"
msgstr "Beschädigter Datenbank-Eintrag '%s'\n"
@@ -165,8 +154,8 @@ msgid "missing package metadata in %s\n"
msgstr "Fehlende Paket-Metadaten in %s\n"
#, c-format
msgid "attempt to re-register the 'local' DB\n"
msgstr "Versuche die lokale Datenbank neu zu registrieren\n"
msgid "removing invalid file: %s\n"
msgstr "Entferne ungültige Datei: %s\n"
#, c-format
msgid "database path is undefined\n"
@@ -188,37 +177,50 @@ msgstr "%s wird vor seiner Abhängigkeit %s installiert werden\n"
msgid "ignoring package %s-%s\n"
msgstr "Ignoriere Paket %s-%s)\n"
#, c-format
msgid "provider package was selected (%s provides %s)\n"
msgstr "Bereitstellendes Paket wurde ausgewählt (%s enthält %s)\n"
#, c-format
msgid "cannot resolve \"%s\", a dependency of \"%s\"\n"
msgstr "Kann \"%s\" nicht auflösen (eine Abhängigkeit von \"%s\")\n"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "URL '%s' ist ungültig\n"
msgid "could not get filesystem information\n"
msgstr "Konnte keine Dateisystem-Informationen erhalten\n"
#, c-format
msgid "url scheme not specified, assuming HTTP\n"
msgstr "URL-Schema nicht spezifiziert, vermute HTTP\n"
msgid "could not get filesystem information for %s: %s\n"
msgstr "Konnte keine Dateisystem-Informationen für %s erhalten: %s\n"
#, c-format
msgid "could not determine mount point for file %s"
msgstr "Konnte keinen Einhänge-Punkt für die Datei %s ermitteln"
#, c-format
msgid "could not determine filesystem mount points"
msgstr "Konnte die Einhängepunkte des Dateisystems nicht bestimmen"
#, c-format
msgid "Partition %s is mounted read only\n"
msgstr "Die Partition %s ist so eingehängt, daß sie nur gelesen werden kann\n"
#, c-format
msgid "Partition %s too full: %ld blocks needed, %ld blocks free\n"
msgstr ""
"Partition %s überfüllt: %ld Blöcke werden benötigt, %ld Blöcke sind frei\n"
#, c-format
msgid "disk"
msgstr "Platte"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "URL '%s' ist ungültig\n"
#, c-format
msgid "failed retrieving file '%s' from %s : %s\n"
msgstr "Konnte Datei '%s' nicht von %s übertragen : %s\n"
#, c-format
msgid "cannot resume download, starting over\n"
msgstr "Kann den Download nicht wieder aufnehmen, starte neu\n"
#, c-format
msgid "cannot write to file '%s'\n"
msgstr "Kann Datei '%s' nicht beschreiben\n"
msgid "resuming download of %s not possible; starting over\n"
msgstr "Kann den Download von %s nicht wieder aufnehmen, starte neu\n"
#, c-format
msgid "error writing to file '%s': %s\n"
@@ -260,6 +262,10 @@ msgstr "Konnte Verzeichnis nicht finden oder lesen"
msgid "wrong or NULL argument passed"
msgstr "Falsches oder NULL-Argument übergeben"
#, c-format
msgid "not enough free disk space"
msgstr "Nicht genug freier Festplattenplatz"
#, c-format
msgid "library not initialized"
msgstr "Bibliothek nicht initialisiert"
@@ -292,6 +298,10 @@ msgstr "Datenbank bereits registriert"
msgid "could not find database"
msgstr "Konnte Datenbank nicht finden"
#, c-format
msgid "database is incorrect version"
msgstr "Keine korrekte Version der Datenbank"
#, c-format
msgid "could not update database"
msgstr "Konnte Datenbank nicht aktualisieren"
@@ -362,8 +372,12 @@ msgid "package filename is not valid"
msgstr "Der Dateiname des Paketes ist nicht gültig"
#, c-format
msgid "no such repository"
msgstr "Kein solches Repositorium"
msgid "package architecture is not valid"
msgstr "Die Paket-Architektur ist ungültig"
#, c-format
msgid "could not find repository for target"
msgstr "Konnte kein Repositorium für das Ziel finden"
#, c-format
msgid "invalid or corrupted delta"
@@ -389,6 +403,10 @@ msgstr "In Konflikt stehende Dateien"
msgid "failed to retrieve some files"
msgstr "Konnte manche Dateien nicht übertragen"
#, c-format
msgid "failed to copy some file"
msgstr "Konnte irgendeine Datei nicht kopieren"
#, c-format
msgid "invalid regular expression"
msgstr "Ungültiger Regulärer Ausdruck"
@@ -409,6 +427,10 @@ msgstr "Fehler beim Aufruf eines externen Downloaders"
msgid "unexpected error"
msgstr "Unerwarteter Fehler"
#, c-format
msgid "database larger than maximum size\n"
msgstr "Datenbank überschreitet die maximal erlaubte Größe\n"
#, c-format
msgid "could not find %s in database -- skipping\n"
msgstr "Konnte %s nicht in Datenbank finden -- Überspringe\n"
@@ -453,22 +475,6 @@ msgstr "Ignoriere Paket-Ersetzung (%s-%s => %s-%s)\n"
msgid "cannot replace %s by %s\n"
msgstr "Kann %s nicht durch %s ersetzen\n"
#, c-format
msgid "repository '%s' not found\n"
msgstr "Repositorium '%s' nicht gefunden\n"
#, c-format
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s ist aktuell -- Überspringe\n"
#, c-format
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s ist aktuell -- Reinstalliere\n"
#, c-format
msgid "downgrading package %s (%s => %s)\n"
msgstr "Downgrade des Paketes %s (%s => %s)\n"
#, c-format
msgid "unresolvable package conflicts detected\n"
msgstr "Nicht lösbare Paketkonflikte gefunden\n"
@@ -481,26 +487,6 @@ msgstr "Entferne '%s' aus der Ziel-Liste, da es mit '%s' in Konflikt steht\n"
msgid "failed to retrieve some files from %s\n"
msgstr "Konnte manche Dateien von %s nicht übertragen\n"
#, c-format
msgid "could not create removal transaction\n"
msgstr "Konnte den Lösch-Vorgang nicht erstellen\n"
#, c-format
msgid "could not create transaction\n"
msgstr "Konnte den Vorgang nicht erstellen\n"
#, c-format
msgid "could not initialize the removal transaction\n"
msgstr "Konnte den Lösch-Vorgang nicht beginnen\n"
#, c-format
msgid "could not initialize transaction\n"
msgstr "Konnte den Vorgang nicht beginnen\n"
#, c-format
msgid "could not prepare removal transaction\n"
msgstr "Konnte Lösch-Vorgang nicht vorbereiten\n"
#, c-format
msgid "could not commit removal transaction\n"
msgstr "Konnte Lösch-Vorgang nicht durchführen\n"
@@ -509,6 +495,10 @@ msgstr "Konnte Lösch-Vorgang nicht durchführen\n"
msgid "could not commit transaction\n"
msgstr "Konnte den Vorgang nicht durchführen\n"
#, c-format
msgid "%s database version is too old\n"
msgstr "Datenbank-Version %s ist zu alt\n"
#, c-format
msgid "could not remove lock file %s\n"
msgstr "Konnte Sperrdatei %s nicht entfernen\n"
@@ -526,12 +516,8 @@ msgid "could not remove tmpdir %s\n"
msgstr "Konnte temporäres Verzeichnis %s nicht entfernen\n"
#, c-format
msgid "could not open %s: %s\n"
msgstr "Konnte Datei %s nicht öffnen: %s\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "Konnte nicht zu Verzeichnis %s wechseln (%s)\n"
msgid "could not create pipe (%s)\n"
msgstr "Konnte Weiterleitung nicht erstellen (%s)\n"
#, c-format
msgid "could not fork a new process (%s)\n"
@@ -542,17 +528,17 @@ msgid "could not change the root directory (%s)\n"
msgstr "Konnte Root-Verzeichnis nicht wechseln (%s)\n"
#, c-format
msgid "could not change directory to / (%s)\n"
msgstr "Konnte nicht zu Verzeichnis / (%s) wechseln\n"
#, c-format
msgid "call to popen failed (%s)\n"
msgstr "Aufruf von 'popen' fehlgeschlagen (%s)\n"
msgid "call to execv failed (%s)\n"
msgstr "Konnte execv nicht aufrufen (%s)\n"
#, c-format
msgid "call to waitpid failed (%s)\n"
msgstr "Aufruf von 'waitpid' fehlgeschlagen (%s)\n"
#, c-format
msgid "could not open pipe (%s)\n"
msgstr "Konnte Weiterleitung nicht öffnen (%s)\n"
#, c-format
msgid "command failed to execute correctly\n"
msgstr "Befehl konnte nicht korrekt ausgeführt werden\n"

View File

@@ -1,53 +1,48 @@
# Greek translations for Pacman package manager package.
# Copyright (C) 2009 Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the pacman package manager package.
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Christos Nouskas <nous@archlinux.us>, 2009.
msgid ""
msgstr ""
"Project-Id-Version: Pacman package manager 3.3.1\n"
"Report-Msgid-Bugs-To: pacman-dev@archlinux.org\n"
"POT-Creation-Date: 2009-10-04 16:48+0200\n"
"PO-Revision-Date: 2009-10-06 19:21+0200\n"
"Last-Translator: Christos Nouskas <nous@archlinux.us>\n"
"Language-Team: greek <el@li.org>\n"
"Project-Id-Version: Arch Linux Pacman package manager\n"
"Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
"POT-Creation-Date: 2011-03-14 13:51-0500\n"
"PO-Revision-Date: 2011-03-05 00:39+0000\n"
"Last-Translator: nous <nous@archlinux.us>\n"
"Language-Team: Greek <None>\n"
"Language: el\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#, c-format
msgid "replacing older version %s-%s by %s in target list\n"
msgstr ""
"αντικατάσταση παλαιότερης έκδοσης %s-%s από %s στην λίστα διεκπεραίωσης\n"
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s ενημερωμένο -- παράλειψη\n"
#, c-format
msgid "skipping %s-%s because newer version %s is in target list\n"
msgstr ""
"παράλειψη %s-%s καθώς υπάρχει νεότερη έκδοση %s στην λίστα διεκπεραίωσης\n"
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s ενημερωμένο -- επανεγκατάσταση\n"
#, c-format
msgid "conflicting packages were found in target list\n"
msgstr "βρέθηκαν αντιτιθέμενα πακέτα στην λίστα διεκπεραίωσης\n"
msgid "downgrading package %s (%s => %s)\n"
msgstr "υποβάθμιση πακέτου %s (%s => %s)\n"
#, c-format
msgid "you cannot install two conflicting packages at the same time\n"
msgstr "δεν επιτρέπεται η ταυτόχρονη εγκατάσταση δύο αντιτιθεμένων πακέτων\n"
msgid "warning given when extracting %s (%s)\n"
msgstr "προειδοποίηση κατά την εξαγωγή του %s (%s)\n"
#, c-format
msgid "replacing packages with -U is not supported yet\n"
msgstr "η αντικατάσταση πακέτων με όρισμα -U δεν υποστηρίζεται ακόμη\n"
#, c-format
msgid "you can replace packages manually using -Rd and -U\n"
msgstr "η αντικατάσταση πακέτων μπορεί να γίνει χειροκίνητα με -Rd and -U\n"
msgid "could not extract %s (%s)\n"
msgstr "αδυναμία εξαγωγής %s (%s)\n"
#, c-format
msgid ""
"directory permissions differ on %s\n"
"filesystem: %o package: %o\n"
msgstr ""
"οι άδειες καταλόγου διαφέρουν στο %s\n"
"τα δικαιώματα καταλόγου διαφέρουν στο %s\n"
"σύστημα αρχείων: %o πακέτο: %o\n"
#, c-format
@@ -58,17 +53,13 @@ msgstr "εξαγωγή: μη αντικατάσταση καταλόγου απ
msgid "extract: symlink %s does not point to dir\n"
msgstr "εξαγωγή: ο συμβολικός δεσμός %s δεν δείχνει σε κατάλογο\n"
#, c-format
msgid "could not extract %s (%s)\n"
msgstr "αδυναμία εξαγωγής %s (%s)\n"
#, c-format
msgid "could not rename %s to %s (%s)\n"
msgstr "αδυναμία μετονομασίας %s σε %s (%s)\n"
#, c-format
msgid "%s saved as %s\n"
msgstr "το %s αποθηκεύθηκε ως %s\n"
msgstr "αποθήκευση %s ως %s\n"
#, c-format
msgid "could not install %s as %s (%s)\n"
@@ -84,7 +75,11 @@ msgstr "εξαγωγή %s ως %s.pacnew\n"
#, c-format
msgid "could not get current working directory\n"
msgstr "αδυναμία πρόσκτησης τρέχοντος καταλόγου\n"
msgstr "αδυναμία χρήσης τρέχοντος καταλόγου\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "αδυναμία μετάβασης στον κατάλογο %s (%s)\n"
#, c-format
msgid "problem occurred while upgrading %s\n"
@@ -106,17 +101,17 @@ msgstr "αδυναμία προσθήκης εγγραφής '%s' στην κρ
msgid "removing invalid database: %s\n"
msgstr "διαγραφή άκυρης βάσης: %s\n"
#, c-format
msgid "could not remove database %s\n"
msgstr "αδυναμία διαγραφής βάσης %s\n"
#, c-format
msgid "invalid name for database entry '%s'\n"
msgstr "άκυρο όνομα εγγραφής βάσης '%s'\n"
#, c-format
msgid "duplicated database entry '%s'\n"
msgstr "διπλότυπη εγγραφή βάσης '%s'\n"
#, c-format
msgid "corrupted database entry '%s'\n"
msgstr "κατεστραμμένο όνομα εγγραφής βάσης '%s'\n"
msgstr "κατεστραμμένη εγγραφή βάσης '%s'\n"
#, c-format
msgid "could not open file %s: %s\n"
@@ -155,8 +150,8 @@ msgid "missing package metadata in %s\n"
msgstr "απόντα μετα-δεδομένα πακέτου στο %s\n"
#, c-format
msgid "attempt to re-register the 'local' DB\n"
msgstr "προσπάθεια επανακαταχώρησης 'τοπικής' βάσης\n"
msgid "removing invalid file: %s\n"
msgstr "διαγραφή άκυρου αρχείου: %s\n"
#, c-format
msgid "database path is undefined\n"
@@ -168,47 +163,59 @@ msgstr "εντοπισμός κυκλικής εξάρτησης:\n"
#, c-format
msgid "%s will be removed after its %s dependency\n"
msgstr "κατάργηση του %s μετά την εξάρτηση %s\n"
msgstr "κατάργηση του %s μετά την εξάρτησή του %s\n"
#, c-format
msgid "%s will be installed before its %s dependency\n"
msgstr "εγκατάσταση του %s πρίν από την εξάρτηση %s\n"
msgstr "εγκατάσταση του %s πρίν από την εξάρτησή του %s\n"
#, c-format
msgid "ignoring package %s-%s\n"
msgstr "αγνόηση πακέτου %s-%s\n"
#, c-format
msgid "provider package was selected (%s provides %s)\n"
msgstr "επιλογή παρέχοντος πακέτου (το %s παρέχει το %s)\n"
msgstr "παράβλεψη πακέτου %s-%s\n"
#, c-format
msgid "cannot resolve \"%s\", a dependency of \"%s\"\n"
msgstr "αδυναμία εύρεσης του \"%s\", εξάρτησης του \"%s\"\n"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "άκυρο url '%s'\n"
msgid "could not get filesystem information\n"
msgstr "αδυναμία λήψης πληροφοριών συστήματος αρχείων\n"
#, c-format
msgid "url scheme not specified, assuming HTTP\n"
msgstr "ακαθόριστο πρωτόκολλο url, εικάζεται HTTP\n"
msgid "could not get filesystem information for %s: %s\n"
msgstr "αδυναμία λήψης πληροφοριών συστήματος αρχείων για το %s: %s\n"
#, c-format
msgid "could not determine mount point for file %s"
msgstr "αδυναμία καθορισμού σημείου προσάρτησης αρχείου %s"
#, c-format
msgid "could not determine filesystem mount points"
msgstr "αδυναμία καθορισμού σημείων προσάρτησης συστήματος αρχείων"
#, c-format
msgid "Partition %s is mounted read only\n"
msgstr "Kατάτμηση %s: προσαρτημένη μόνο για ανάγνωση\n"
#, c-format
msgid "Partition %s too full: %ld blocks needed, %ld blocks free\n"
msgstr "Kατάτμηση %s πλήρης: %ld blocks απαιτούνται, %ld ελεύθερα\n"
#, c-format
msgid "disk"
msgstr "δίσκο(ς)"
msgstr "δίσκο"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "άκυρη διεύθυνση '%s'\n"
#, c-format
msgid "failed retrieving file '%s' from %s : %s\n"
msgstr "αποτυχία λήψης αρχείου '%s' από %s : %s\n"
#, c-format
msgid "cannot resume download, starting over\n"
msgstr "αδυναμία συνέχισης λήψης, επανάληψη\n"
#, c-format
msgid "cannot write to file '%s'\n"
msgstr "αδυναμία εγγραφής στο '%s'\n"
msgid "resuming download of %s not possible; starting over\n"
msgstr "συνέχιση λήψης %s αδύνατη, επανεκκίνηση\n"
#, c-format
msgid "error writing to file '%s': %s\n"
@@ -220,7 +227,7 @@ msgstr "αποτυχία λήψης αρχείου '%s' από %s\n"
#, c-format
msgid "%s appears to be truncated: %jd/%jd bytes\n"
msgstr "το %s φαίνεται ελλιπές: %jd/%jd bytes\n"
msgstr "το %s δείχνει ημιτελές: %jd/%jd bytes\n"
#, c-format
msgid "failed to download %s\n"
@@ -228,7 +235,7 @@ msgstr "αποτυχία λήψης %s\n"
#, c-format
msgid "out of memory!"
msgstr "έλλειψη μνήμης!"
msgstr "ανεπαρκής μνήμη!"
#, c-format
msgid "unexpected system error"
@@ -248,15 +255,19 @@ msgstr "αδυναμία εύρεσης ή ανάγνωσης καταλόγου
#, c-format
msgid "wrong or NULL argument passed"
msgstr "εσφαλμένο ή ΚΕΝΟ όρισμα"
msgstr "εσφαλμένο ή NULL όρισμα"
#, c-format
msgid "not enough free disk space"
msgstr "ανεπαρκής ελεύθερος χώρος στον δίσκο"
#, c-format
msgid "library not initialized"
msgstr "βιβλιοθήκη δεν εκκινήθηκε"
msgstr "βιβλιοθήκη μη εκκινηθείσα"
#, c-format
msgid "library already initialized"
msgstr "βιβλιοθήκη ήδη εκκινήθηκε"
msgstr "βιβλιοθήκη ήδη εκκινηθείσα"
#, c-format
msgid "unable to lock database"
@@ -272,16 +283,20 @@ msgstr "αδυναμία δημιουργίας βάσης"
#, c-format
msgid "database not initialized"
msgstr "βάση ήδη εκκινήθηκε"
msgstr "βάση μη εκκινηθείσα"
#, c-format
msgid "database already registered"
msgstr "βάση ήδη καταχωρήθηκε"
msgstr "βάση ήδη εκκινηθείσα"
#, c-format
msgid "could not find database"
msgstr "αδυναμία εύρεσης βάσης"
#, c-format
msgid "database is incorrect version"
msgstr "εσφαλμένη έκδοση βάσης"
#, c-format
msgid "could not update database"
msgstr "αδυναμία ενημέρωσης βάσης"
@@ -292,19 +307,19 @@ msgstr "αδυναμία κατάργησης εγγραφής βάσης"
#, c-format
msgid "invalid url for server"
msgstr "άκυρο url διακομιστή"
msgstr "άκυρη διεύθυνση διακομιστή"
#, c-format
msgid "no servers configured for repository"
msgstr "δεν ορίσθηκαν διακομιστές αποθήκης"
msgstr "ακαθόριστοι διακομιστές αποθήκης"
#, c-format
msgid "transaction already initialized"
msgstr "διεκπεραίωση ήδη εκκινήθηκε"
msgstr "διεκπεραίωση ήδη εκκινηθείσα"
#, c-format
msgid "transaction not initialized"
msgstr "διεκπεραίωση δεν εκκινήθηκε"
msgstr "διεκπεραίωση μη εκκινηθείσα"
#, c-format
msgid "duplicate target"
@@ -312,11 +327,11 @@ msgstr "διπλότυπος στόχος"
#, c-format
msgid "transaction not prepared"
msgstr "διεκπεραίωση δεν προετοιμάσθηκε"
msgstr "απροετοίμαστη διεκπεραίωση"
#, c-format
msgid "transaction aborted"
msgstr "διεκπεραίωση ματαιώθηκε"
msgstr "ματαίωση διεκπεραίωσης"
#, c-format
msgid "operation not compatible with the transaction type"
@@ -344,15 +359,19 @@ msgstr "αδυναμία ανοίγματος πακέτου"
#, c-format
msgid "cannot remove all files for package"
msgstr "αδυναμία κατάργησης όλων των αρχείων του πακέτου"
msgstr "αδυναμία διαγραφής όλων των αρχείων του πακέτου"
#, c-format
msgid "package filename is not valid"
msgstr "μη έγκυρο όνομα πακέτου"
#, c-format
msgid "no such repository"
msgstr "δεν υπάρχει τέτοια αποθήκη"
msgid "package architecture is not valid"
msgstr "μη έγκυρη αρχιτεκτονική πακέτου"
#, c-format
msgid "could not find repository for target"
msgstr "αδυναμία εύρεσης αποθήκης για διεκπεραίωση"
#, c-format
msgid "invalid or corrupted delta"
@@ -364,7 +383,7 @@ msgstr "αποτυχία μπάλωματος delta"
#, c-format
msgid "could not satisfy dependencies"
msgstr "αδυναμία ικανοποίησης εξαρτήσεων"
msgstr "αδυναμία επίλυσης εξαρτήσεων"
#, c-format
msgid "conflicting dependencies"
@@ -378,6 +397,10 @@ msgstr "διένεξη αρχείων"
msgid "failed to retrieve some files"
msgstr "αποτυχία λήψης κάποιων αρχείων"
#, c-format
msgid "failed to copy some file"
msgstr "αποτυχία αντιγραφής αρχείου"
#, c-format
msgid "invalid regular expression"
msgstr "άκυρη κανονική έκφραση"
@@ -398,9 +421,13 @@ msgstr "σφάλμα κλήσης προγράμματος λήψης"
msgid "unexpected error"
msgstr "απροσδόκητο σφάλμα"
#, c-format
msgid "database larger than maximum size\n"
msgstr "βάση μεγαλύτερη από μέγιστο όριο\n"
#, c-format
msgid "could not find %s in database -- skipping\n"
msgstr "δεν βρέθηκε το %s στην βάση -- παράλειψη\n"
msgstr "δεν βρέθηκε το %s στη βάση -- παράλειψη\n"
#, c-format
msgid "removing %s from target list\n"
@@ -412,19 +439,19 @@ msgstr "αδυναμία διαγραφής αρχείου '%s': %s\n"
#, c-format
msgid "could not remove database entry %s-%s\n"
msgstr "αδυναμία κατάργησης εγγραφής βάσης %s-%s\n"
msgstr "αδυναμία διαγραφής εγγραφής βάσης %s-%s\n"
#, c-format
msgid "could not remove entry '%s' from cache\n"
msgstr "αδυναμία κατάργησης εγγραφής '%s' από κρύπτη\n"
msgstr "αδυναμία διαγραφής εγγραφής '%s' από κρύπτη\n"
#, c-format
msgid "%s: ignoring package upgrade (%s => %s)\n"
msgstr "%s: αγνόηση αναβάθμισης πακέτου (%s => %s)\n"
msgstr "%s: παράβλεψη αναβάθμισης πακέτου (%s => %s)\n"
#, c-format
msgid "%s: ignoring package downgrade (%s => %s)\n"
msgstr "%s: αγνόηση υποβάθμισης πακέτου (%s => %s)\n"
msgstr "%s: παράβλεψη υποβάθμισης πακέτου (%s => %s)\n"
#, c-format
msgid "%s: downgrading from version %s to version %s\n"
@@ -432,32 +459,16 @@ msgstr "%s: υποβάθμιση από έκδοση %s στην έκδοση %s
#, c-format
msgid "%s: local (%s) is newer than %s (%s)\n"
msgstr "%s: το τοπικό (%s) είναι νεότερο από το %s (%s)\n"
msgstr "%s: τοπικό (%s) νεότερο από του [%s] (%s)\n"
#, c-format
msgid "ignoring package replacement (%s-%s => %s-%s)\n"
msgstr "αγνόηση αντικαταστάτη πακέτου (%s-%s => %s-%s)\n"
msgstr "παράβλεψη αντικαταστάτη πακέτου (%s-%s => %s-%s)\n"
#, c-format
msgid "cannot replace %s by %s\n"
msgstr "αδυναμία αντικατάστασης του %s από το %s\n"
#, c-format
msgid "repository '%s' not found\n"
msgstr "δεν βρέθηκε αποθήκη'%s'\n"
#, c-format
msgid "%s-%s is up to date -- skipping\n"
msgstr "το %s-%s είναι ενημερωμένο -- παράλειψη\n"
#, c-format
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "το %s-%s είναι ενημερωμένο -- επανεγκατάσταση\n"
#, c-format
msgid "downgrading package %s (%s => %s)\n"
msgstr "υποβάθμιση πακέτου %s (%s => %s)\n"
#, c-format
msgid "unresolvable package conflicts detected\n"
msgstr "εντοπισμός ανεπίλυτων διενέξεων πακέτων\n"
@@ -465,40 +476,24 @@ msgstr "εντοπισμός ανεπίλυτων διενέξεων πακέτ
#, c-format
msgid "removing '%s' from target list because it conflicts with '%s'\n"
msgstr ""
"κατάργηση του '%s' από την λίστα διεκπεραίωσης λόγω διένεξης με το '%s'\n"
"αφαίρεση του '%s' από την λίστα διεκπεραίωσης λόγω διένεξης με το '%s'\n"
#, c-format
msgid "failed to retrieve some files from %s\n"
msgstr "αποτυχία λήψεως κάποιων αρχείων από το %s\n"
#, c-format
msgid "could not create removal transaction\n"
msgstr "αδυναμία διεκπεραίωσης κατάργησης\n"
#, c-format
msgid "could not create transaction\n"
msgstr "αδυναμία δημιουργίας διεκπεραίωσης\n"
#, c-format
msgid "could not initialize the removal transaction\n"
msgstr "αδυναμία εκκίνησης κατάργησης\n"
#, c-format
msgid "could not initialize transaction\n"
msgstr "αδυναμία εκκίνησης διεκπεραίωσης\n"
#, c-format
msgid "could not prepare removal transaction\n"
msgstr "αδυναμία προετοιμασίας κατάργησης\n"
msgstr "αποτυχία λήψεως κάποιων αρχείων από %s\n"
#, c-format
msgid "could not commit removal transaction\n"
msgstr "αδυναμία ολοκλήρωσης κατάργησης\n"
msgstr "αδυναμία διεκπεραίωσης διαγραφής\n"
#, c-format
msgid "could not commit transaction\n"
msgstr "αδυναμία διεκπεραίωσης\n"
#, c-format
msgid "%s database version is too old\n"
msgstr "πολύ παλιά έκδοση βάσης %s\n"
#, c-format
msgid "could not remove lock file %s\n"
msgstr "αδυναμία διαγραφής αρχείου κλειδώματος %s\n"
@@ -516,12 +511,8 @@ msgid "could not remove tmpdir %s\n"
msgstr "αδυναμία διαγραφής προσωρινού καταλόγου %s\n"
#, c-format
msgid "could not open %s: %s\n"
msgstr "αδυναμία ανοίγματος %s: %s\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "αδυναμία αλλαγής καταλόγου σε %s (%s)\n"
msgid "could not create pipe (%s)\n"
msgstr "αδυναμία δημιουργίας αγωγού (%s)\n"
#, c-format
msgid "could not fork a new process (%s)\n"
@@ -532,24 +523,24 @@ msgid "could not change the root directory (%s)\n"
msgstr "αδυναμία αλλαγής ριζικού καταλόγου (%s)\n"
#, c-format
msgid "could not change directory to / (%s)\n"
msgstr "αδυναμία αλλαγής καταλόγου σε / (%s)\n"
#, c-format
msgid "call to popen failed (%s)\n"
msgstr "αποτυχία κλήσης popen (%s)\n"
msgid "call to execv failed (%s)\n"
msgstr "αποτυχία κλήσης execv (%s)\n"
#, c-format
msgid "call to waitpid failed (%s)\n"
msgstr "αποτυχία κλήσης waitpid (%s)\n"
#, c-format
msgid "could not open pipe (%s)\n"
msgstr "αποτυχία ανοίγματος αγωγού (%s)\n"
#, c-format
msgid "command failed to execute correctly\n"
msgstr "αποτυχία σωστής εκτέλεσης εντολής\n"
#, c-format
msgid "no %s cache exists, creating...\n"
msgstr "δεν υπάρχει κρύπτη %s, δημιουργία...\n"
msgstr "δημιουργία κρύπτης %s...\n"
#, c-format
msgid "couldn't create package cache, using /tmp instead\n"

View File

@@ -1,44 +1,41 @@
# English (British) translations for Pacman package manager package.
# Copyright (C) 2009 Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the pacman package manager package.
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Pacman Development Team <pacman-dev@archlinux.org>
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Jeff Bailes <thepizzaking@gmail.com>, 2007, 2009.
msgid ""
msgstr ""
"Project-Id-Version: Pacman package manager 3.3.1\n"
"Report-Msgid-Bugs-To: pacman-dev@archlinux.org\n"
"POT-Creation-Date: 2009-10-04 16:48+0200\n"
"PO-Revision-Date: 2009-10-04 17:08+0200\n"
"Last-Translator: Dan McGee <dpmcgee@gmail.com>\n"
"Language-Team: English <en_gb@li.org>\n"
"Project-Id-Version: Arch Linux Pacman package manager\n"
"Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
"POT-Creation-Date: 2011-03-14 13:51-0500\n"
"PO-Revision-Date: 2011-03-11 04:03+0000\n"
"Last-Translator: toofishes <dpmcgee@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: en_GB\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#, c-format
msgid "replacing older version %s-%s by %s in target list\n"
msgstr "replacing older version %s-%s by %s in target list\n"
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s is up to date -- skipping\n"
#, c-format
msgid "skipping %s-%s because newer version %s is in target list\n"
msgstr "skipping %s-%s because newer version %s is in target list\n"
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s is up to date -- reinstalling\n"
#, c-format
msgid "conflicting packages were found in target list\n"
msgstr "conflicting packages were found in target list\n"
msgid "downgrading package %s (%s => %s)\n"
msgstr "downgrading package %s (%s => %s)\n"
#, c-format
msgid "you cannot install two conflicting packages at the same time\n"
msgstr "you cannot install two conflicting packages at the same time\n"
msgid "warning given when extracting %s (%s)\n"
msgstr "warning given when extracting %s (%s)\n"
#, c-format
msgid "replacing packages with -U is not supported yet\n"
msgstr "replacing packages with -U is not supported yet\n"
#, c-format
msgid "you can replace packages manually using -Rd and -U\n"
msgstr "you can replace packages manually using -Rd and -U\n"
msgid "could not extract %s (%s)\n"
msgstr "could not extract %s (%s)\n"
#, c-format
msgid ""
@@ -56,10 +53,6 @@ msgstr "extract: not overwriting dir with file %s\n"
msgid "extract: symlink %s does not point to dir\n"
msgstr "extract: symlink %s does not point to dir\n"
#, c-format
msgid "could not extract %s (%s)\n"
msgstr "could not extract %s (%s)\n"
#, c-format
msgid "could not rename %s to %s (%s)\n"
msgstr "could not rename %s to %s (%s)\n"
@@ -84,6 +77,10 @@ msgstr "extracting %s as %s.pacnew\n"
msgid "could not get current working directory\n"
msgstr "could not get current working directory\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "could not change directory to %s (%s)\n"
#, c-format
msgid "problem occurred while upgrading %s\n"
msgstr "problem occurred while upgrading %s\n"
@@ -104,14 +101,14 @@ msgstr "could not add entry '%s' in cache\n"
msgid "removing invalid database: %s\n"
msgstr "removing invalid database: %s\n"
#, c-format
msgid "could not remove database %s\n"
msgstr "could not remove database %s\n"
#, c-format
msgid "invalid name for database entry '%s'\n"
msgstr "invalid name for database entry '%s'\n"
#, c-format
msgid "duplicated database entry '%s'\n"
msgstr "duplicated database entry '%s'\n"
#, c-format
msgid "corrupted database entry '%s'\n"
msgstr "corrupted database entry '%s'\n"
@@ -153,8 +150,8 @@ msgid "missing package metadata in %s\n"
msgstr "missing package metadata in %s\n"
#, c-format
msgid "attempt to re-register the 'local' DB\n"
msgstr "attempt to re-register the 'local' DB\n"
msgid "removing invalid file: %s\n"
msgstr "removing invalid file: %s\n"
#, c-format
msgid "database path is undefined\n"
@@ -176,37 +173,49 @@ msgstr "%s will be installed before its %s dependency\n"
msgid "ignoring package %s-%s\n"
msgstr "ignoring package %s-%s\n"
#, c-format
msgid "provider package was selected (%s provides %s)\n"
msgstr "provider package was selected (%s provides %s)\n"
#, c-format
msgid "cannot resolve \"%s\", a dependency of \"%s\"\n"
msgstr "cannot resolve \"%s\", a dependency of \"%s\"\n"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "URL '%s' is invalid\n"
msgid "could not get filesystem information\n"
msgstr "could not get filesystem information\n"
#, c-format
msgid "url scheme not specified, assuming HTTP\n"
msgstr "URL scheme not specified, assuming HTTP\n"
msgid "could not get filesystem information for %s: %s\n"
msgstr "could not get filesystem information for %s: %s\n"
#, c-format
msgid "could not determine mount point for file %s"
msgstr "could not determine mount point for file %s"
#, c-format
msgid "could not determine filesystem mount points"
msgstr "could not determine filesystem mount points"
#, c-format
msgid "Partition %s is mounted read only\n"
msgstr "Partition %s is mounted read only\n"
#, c-format
msgid "Partition %s too full: %ld blocks needed, %ld blocks free\n"
msgstr "Partition %s too full: %ld blocks needed, %ld blocks free\n"
#, c-format
msgid "disk"
msgstr "disk"
#, c-format
msgid "url '%s' is invalid\n"
msgstr "URL '%s' is invalid\n"
#, c-format
msgid "failed retrieving file '%s' from %s : %s\n"
msgstr "failed retrieving file '%s' from %s : %s\n"
#, c-format
msgid "cannot resume download, starting over\n"
msgstr "cannot resume download, starting over\n"
#, c-format
msgid "cannot write to file '%s'\n"
msgstr "cannot write to file '%s'\n"
msgid "resuming download of %s not possible; starting over\n"
msgstr "resuming download of %s not possible; starting over\n"
#, c-format
msgid "error writing to file '%s': %s\n"
@@ -248,6 +257,10 @@ msgstr "could not find or read directory"
msgid "wrong or NULL argument passed"
msgstr "wrong or NULL argument passed"
#, c-format
msgid "not enough free disk space"
msgstr "not enough free disk space"
#, c-format
msgid "library not initialized"
msgstr "library not initialised"
@@ -280,6 +293,10 @@ msgstr "database already registered"
msgid "could not find database"
msgstr "could not find database"
#, c-format
msgid "database is incorrect version"
msgstr "database is incorrect version"
#, c-format
msgid "could not update database"
msgstr "could not update database"
@@ -349,8 +366,12 @@ msgid "package filename is not valid"
msgstr "package filename is not valid"
#, c-format
msgid "no such repository"
msgstr "no such repository"
msgid "package architecture is not valid"
msgstr "package architecture is not valid"
#, c-format
msgid "could not find repository for target"
msgstr "could not find repository for target"
#, c-format
msgid "invalid or corrupted delta"
@@ -376,6 +397,10 @@ msgstr "conflicting files"
msgid "failed to retrieve some files"
msgstr "failed to retrieve some files"
#, c-format
msgid "failed to copy some file"
msgstr "failed to copy some file"
#, c-format
msgid "invalid regular expression"
msgstr "invalid regular expression"
@@ -396,6 +421,10 @@ msgstr "error invoking external downloader"
msgid "unexpected error"
msgstr "unexpected error"
#, c-format
msgid "database larger than maximum size\n"
msgstr "database larger than maximum size\n"
#, c-format
msgid "could not find %s in database -- skipping\n"
msgstr "could not find %s in database -- skipping\n"
@@ -440,22 +469,6 @@ msgstr "ignoring package replacement (%s-%s => %s-%s)\n"
msgid "cannot replace %s by %s\n"
msgstr "cannot replace %s by %s\n"
#, c-format
msgid "repository '%s' not found\n"
msgstr "repository '%s' not found\n"
#, c-format
msgid "%s-%s is up to date -- skipping\n"
msgstr "%s-%s is up to date -- skipping\n"
#, c-format
msgid "%s-%s is up to date -- reinstalling\n"
msgstr "%s-%s is up to date -- reinstalling\n"
#, c-format
msgid "downgrading package %s (%s => %s)\n"
msgstr "downgrading package %s (%s => %s)\n"
#, c-format
msgid "unresolvable package conflicts detected\n"
msgstr "unresolvable package conflicts detected\n"
@@ -468,26 +481,6 @@ msgstr "removing '%s' from target list because it conflicts with '%s'\n"
msgid "failed to retrieve some files from %s\n"
msgstr "failed to retrieve some files from %s\n"
#, c-format
msgid "could not create removal transaction\n"
msgstr "could not create removal transaction\n"
#, c-format
msgid "could not create transaction\n"
msgstr "could not create transaction\n"
#, c-format
msgid "could not initialize the removal transaction\n"
msgstr "could not initialise the removal transaction\n"
#, c-format
msgid "could not initialize transaction\n"
msgstr "could not initialise transaction\n"
#, c-format
msgid "could not prepare removal transaction\n"
msgstr "could not prepare removal transaction\n"
#, c-format
msgid "could not commit removal transaction\n"
msgstr "could not commit removal transaction\n"
@@ -496,6 +489,10 @@ msgstr "could not commit removal transaction\n"
msgid "could not commit transaction\n"
msgstr "could not commit transaction\n"
#, c-format
msgid "%s database version is too old\n"
msgstr "%s database version is too old\n"
#, c-format
msgid "could not remove lock file %s\n"
msgstr "could not remove lock file %s\n"
@@ -513,12 +510,8 @@ msgid "could not remove tmpdir %s\n"
msgstr "could not remove tmpdir %s\n"
#, c-format
msgid "could not open %s: %s\n"
msgstr "could not open %s: %s\n"
#, c-format
msgid "could not change directory to %s (%s)\n"
msgstr "could not change directory to %s (%s)\n"
msgid "could not create pipe (%s)\n"
msgstr "could not create pipe (%s)\n"
#, c-format
msgid "could not fork a new process (%s)\n"
@@ -529,17 +522,17 @@ msgid "could not change the root directory (%s)\n"
msgstr "could not change the root directory (%s)\n"
#, c-format
msgid "could not change directory to / (%s)\n"
msgstr "could not change directory to / (%s)\n"
#, c-format
msgid "call to popen failed (%s)\n"
msgstr "call to popen failed (%s)\n"
msgid "call to execv failed (%s)\n"
msgstr "call to execv failed (%s)\n"
#, c-format
msgid "call to waitpid failed (%s)\n"
msgstr "call to waitpid failed (%s)\n"
#, c-format
msgid "could not open pipe (%s)\n"
msgstr "could not open pipe (%s)\n"
#, c-format
msgid "command failed to execute correctly\n"
msgstr "command failed to execute correctly\n"
@@ -551,48 +544,3 @@ msgstr "no %s cache exists, creating...\n"
#, c-format
msgid "couldn't create package cache, using /tmp instead\n"
msgstr "couldn't create package cache, using /tmp instead\n"
#~ msgid "error downloading '%s': %s\n"
#~ msgstr "error downloading '%s': %s\n"
#~ msgid "could not chdir to %s\n"
#~ msgstr "could not chdir to %s\n"
#~ msgid "running XferCommand: fork failed!\n"
#~ msgstr "running XferCommand: fork failed!\n"
#~ msgid "could not commit transaction"
#~ msgstr "could not commit transaction"
#~ msgid "could not download all files"
#~ msgstr "could not download all files"
#~ msgid "cannot load package data"
#~ msgstr "cannot load package data"
#~ msgid "package not installed or lesser version"
#~ msgstr "package not installed or lesser version"
#~ msgid "group not found"
#~ msgstr "group not found"
#~ msgid "user aborted the operation"
#~ msgstr "user aborted the operation"
#~ msgid "internal error"
#~ msgstr "internal error"
#~ msgid "not confirmed"
#~ msgstr "not confirmed"
#~ msgid "%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"
#~ msgstr "%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"
#~ msgid "command: %s\n"
#~ msgstr "command: %s\n"
#~ msgid "could not prepare transaction\n"
#~ msgstr "could not prepare transaction\n"
#~ msgid "No /bin/sh in parent environment, aborting scriptlet\n"
#~ msgstr "No /bin/sh in parent environment, aborting scriptlet\n"

Some files were not shown because too many files have changed in this diff Show More