1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00
Commit Graph

3425 Commits

Author SHA1 Message Date
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