summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* Minor code cleanupsDan McGee2011-03-21
| | | | | | | Wrap lines of long length, noticed while creating and messing around with some of the other maint branch patches. Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure package removal list does not contain duplicatesDan McGee2011-03-21
| | | | | | | | | Noticed with the openoffice/libreoffice replacement scheme where many packages are listed as replacements to one package, thus electing it for removal multiple times. Ensure a given package is not already present before placing it in the removal list. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix line_offset not being reset in _alpm_archive_fgets()Dan McGee2011-03-21
| | | | | | | | | | This is a rather serious data corruption issue that luckily manifested itself today in a noticable way. A package in testing had replaces entries read in as ["%RE pkgname", "%RE"] which was clearly wrong. This happens when we hit the end of an archive block, do not have a newline, and have to continue reading from the next block to complete the line. Signed-off-by: Dan McGee <dan@archlinux.org>
* Update source translation files in prep for 3.5.1Dan McGee2011-03-20
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix comparison to 0 rather than NULLDan McGee2011-03-20
| | | | | | Another fix found by Coccinelle example semantic patches. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix assignment before NULL checkDan McGee2011-03-20
| | | | | | Easy fix, found using null_ref.cocci example Coccinelle script. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add missing include for size_tDan McGee2011-03-20
| | | | | | Needed for things like our strndup() substitute function. Signed-off-by: Dan McGee <dan@archlinux.org>
* Use sane umask for repo db downloadsAllan McRae2011-03-20
| | | | | | | Fixes FS#23343. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Correctly parse %DELTAS% entries in sync DBtuxce2011-03-17
| | | | | | | We erroniously dropped the call to _alpm_delta_parse() when macro-izing, causing segfaults for repos that provide deltas. Addresses FS#23314. Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure we have a root partition when checking spaceDan McGee2011-03-17
| | | | | | | | | Partially addresses the "why doesn't CheckSpace work in a chroot" issue. We can't make it work, but we can at least detect when it won't work by checking for a partition for our given installation root. If we can't determine the mountpoint for this, bail out with an error. Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm_list: fix typo in doxygen commentDave Reisner2011-03-16
| | | | | Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update translations for message with added newlineDan McGee2011-03-16
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Add missing newline to warning messageAllan McRae2011-03-16
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Updated translations for 3.5.0 from TransifexDan McGee2011-03-16
| | | | | | Thanks to all translators that contributed! Signed-off-by: Dan McGee <dan@archlinux.org>
* Do not print warning with files entry in sync dbAllan McRae2011-03-07
| | | | | | | | | 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>
* Fix gettext plural detectionDan McGee2011-03-03
| | | | | | | 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>
* libalpm/diskspace.c: remove bogus parenthesisXavier Chantry2011-03-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure d_type is not DT_UNKNOWN before relying on itDan McGee2011-03-01
| | | | | | | | | | 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>
* Fix some easy to find double translationsDan McGee2011-02-28
| | | | | | | | 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>
* Update translation template filesDan McGee2011-02-28
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Check local DB version before continuing transactionDan McGee2011-02-28
| | | | | | | | | 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>
* Move locking functions to where they are neededDan McGee2011-02-28
| | | | | | | | 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>
* Fix trans no-argument function definitionsDan McGee2011-02-28
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix double close of the lock fileJonathan Conder2011-02-27
| | | | | | | | | | 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>
* alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcacheDave Reisner2011-02-25
| | | | | | | This avoids needless breakage of the public API. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm: remove public visibility of pmpkghash_tDave Reisner2011-02-25
| | | | | | | | | 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>
* Continue resolving dependencies rather than bailing on first errorDan McGee2011-02-25
| | | | | | | | | | | | | | | | | 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>
* Various small spelling fixes and small tweaksDan McGee2011-02-25
| | | | | | | 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>
* Mark log callback format string constDan McGee2011-02-24
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove trans->skip_addDan McGee2011-02-22
| | | | | | | | 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>
* Don't generate filelist unless we are going to use itDan McGee2011-02-16
| | | | | | | 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>
* Conflict checking code cleanupDan McGee2011-02-16
| | | | | | | | | * 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>
* Fix some database size estimation problemsDan McGee2011-02-15
| | | | | | | | | | * 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>
* Use CALLOC for _alpm_graph_new()Pang Yan Han2011-02-15
| | | | | | | | 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>
* diskspace: allow used flag to be toggled for both remove and installDan McGee2011-02-11
| | | | | | | | | | | | | | 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>
* Check mountpoint read-only status when checking spaceDan McGee2011-02-11
| | | | | | | | | | | 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>
* diskspace: use calloc instead of mallocDan McGee2011-02-11
| | | | | | Prevents us from having to manually zero out several of our fields. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix mount dir length calculationDan McGee2011-02-11
| | | | | | | | | 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>
* Avoid a memmove by advancing value pointerDan McGee2011-02-11
| | | | | | | | | | | | 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>
* Fix fileconflict progress with only one packageDan McGee2011-02-11
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Skip diskspace checking for symlinks and directories in all casesDan McGee2011-02-08
| | | | | | | | | | | | | | | | | | 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>
* Refactor out common code in pkghash add functionsPang Yan Han2011-02-07
| | | | | | | | | | 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>
* Handle null pkgcache for local/sync db_populate()Pang Yan Han2011-02-07
| | | | | | | | | | | | | | | 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>
* Merge branch 'maint'Dan McGee2011-02-06
|\
| * Add new translations from TransifexDan McGee2011-02-04
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Remove redundant _alpm_strtrim() in be_local.cPang Yan Han2011-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Handle PM_ERR_WRITE in alpm_strerror()Pang Yan Han2011-02-04
| | | | | | | | | | | | | | | | 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>
* | Update translation file indexes and MakevarsDan McGee2011-02-04
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add comment about download file resolutionDan McGee2011-02-04
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge remote-tracking branch 'allan/hash'Dan McGee2011-02-04
|\ \