summaryrefslogtreecommitdiff
path: root/lib/libalpm/sync.c
Commit message (Collapse)AuthorAge
* Style change: return(x) --> return xDan McGee2011-03-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was discussed and more or less agreed upon on the mailing list. A huge checkin, but if we just do it and let people adjust the pain will end soon enough. Rebasing should be relatively straighforward for anyone that sees conflicts; just be sure you use the new return style if possible. The following semantic patch was used to do the change, along with some hand-massaging in order to preserve parenthesis where appropriate: The semantic match that finds this problem is as follows, although some hand-massaging was done in order to keep parenthesis where appropriate: (http://coccinelle.lip6.fr/) // <smpl> @@ expression a; @@ - return(a); + return a; // </smpl> A macros_file was also provided with the following content: Additional steps taken, mainly for ASSERT() macros: $ sed -i -e 's#return(NULL)#return NULL#' lib/libalpm/*.c $ sed -i -e 's#return(-1)#return -1#' lib/libalpm/*.c 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>
* 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>
* 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>
* Read pkgcache into hashAllan McRae2011-02-04
| | | | | | | | | | | | 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>
* alpm: drop old target interfacesXavier Chantry2011-01-29
| | | | | | | | | | 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>
* alpm: add alpm_find_grp_pkgsXavier Chantry2011-01-29
| | | | | | | | 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>
* Compute download size for sync packages onlyDan McGee2011-01-22
| | | | | | | Neither packages from files nor packages from the local database will ever have a download size. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix integrity check status when installing from fileDan McGee2011-01-18
| | | | | | | | 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>
* Add a progressbar for package integrity checkingDan McGee2011-01-11
| | | | | | | 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>
* Use size_t for alpm_list sizesAllan McRae2011-01-07
| | | | | | | | | | | | | 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>
* Update copyright years for 2011Allan McRae2011-01-07
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2010-12-30
|\ | | | | | | | | | | Conflicts: lib/libalpm/sync.c test/pacman/tests/ignore007.py
| * Respect Ignore{Pkg,Group} for group membersJakob Gruber2010-12-30
| | | | | | | | | | | | Fixes FS#19854. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Move group code to separate functionJakob Gruber2010-12-30
| | | | | | | | | | | | | | This makes the following commits more readable. No logic was changed in this commit. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add const to some ALPM function signaturesJakob Gruber2010-12-30
| | | | | | | | | | | | char * -> const char *. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Detect undefined PATH_MAXAllan McRae2010-12-29
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Display progress bar for disk space checkingAllan McRae2010-12-12
| | | | | | | | | | | | | | | | 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>
* | Add configuration option to control disk space checkingAllan McRae2010-12-12
| | | | | | | | | | | | | | | | | | 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>
* | Prototype disk space checking functionalityAllan McRae2010-12-12
| | | | | | | | | | | | | | | | 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>
* | dirent usage cleanupDan McGee2010-12-12
| | | | | | | | | | | | | | | | | | | | 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>
* | alpm: don't expose alpm_depcmpXavier Chantry2010-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2010-10-18
|\|
| * alpm/sync: very small memleak fixXavier Chantry2010-10-18
| | | | | | | | | | Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Move the cache stuff where it should beDan McGee2010-10-13
| | | | | | | | | | | | | | | | 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>
* | Allow local and sync db to be treated separatelyDan McGee2010-10-13
|/ | | | | | | | | | | | | | | | | | | | | | | 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>
* Mark sync_pkg and sync_target as static functionsDan McGee2010-07-27
| | | | | | | 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>
* Maintain a list of seen packages when installing a groupDan McGee2010-07-27
| | | | | | | | | | | | | | 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>
* Handle sync target + ignore properlyDan McGee2010-06-20
| | | | | | | | | | | 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>
* fix memory leak in _alpm_sync_commitJonathan Conder2010-05-18
| | | | | Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Partial fix for the phonon/qt issueNagy Gabor2010-05-18
| | | | | | | | | | | | | | | | | 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>
* Fix a serious bug in the download codeNagy Gabor2010-05-14
| | | | | | | | | | | | 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>
* Compute package download size outside _alpm_sync_prepareJonathan Conder2010-05-05
| | | | | | | 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>
* Bump copyright dates to 2010Dan McGee2010-03-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix "-Sd conflict_pkg" bugNagy Gabor2009-10-11
| | | | | | | | | | | | | | | | | | | 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>
* typing: a few more fixes for special int typesDan McGee2009-10-11
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* sync.c : duplicate the target before modifying itXavier Chantry2009-09-20
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Change the interface for target loadingXavier Chantry2009-09-12
| | | | | | | | | | | | | | | | | | | -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 )
* Remove transaction typeXavier Chantry2009-09-08
| | | | | | | | | | | | | | | 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.
* Use sync.c for upgrade transaction prepare and commitNagy Gabor2009-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add a new reason field to pmconflict_t structNagy Gabor2009-09-08
| | | | | | | | | | | | | 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>
* Introduce -SuuNagy Gabor2009-07-22
| | | | | | | | | | | | | | | If the user switches from unstable repo to a stable one, it is quite hard to sync its system with the new repo (the user will see many "Local is newer than stable" messages, nothing more). That's why I introduced -Suu, which treats a sync package like an upgrade, iff the package version doesn't match with the local one's. I added a new pactest (sync104.py) to test this, and I updated the documentation of -Su. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: slight doc reword] Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix 2 minor memleaksXavier Chantry2009-07-20
| | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright headers and messagesDan McGee2009-07-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Enable remove progressbar with -S (conflict resolving)Nagy Gabor2009-06-13
| | | | | | | | | | | | | | | | | | | | | | $ sudo pacman -S mc Old output: *********** :: mc conflicts with mc-mp. Remove mc-mp? [Y/n] y ... (1/1) checking for file conflicts [################] 100% (1/1) installing mc [################] 100% New output: *********** :: mc conflicts with mc-mp. Remove mc-mp? [Y/n] y ... (1/1) checking for file conflicts [################] 100% (1/1) removing mc-mp [################] 100% (1/1) installing mc [################] 100% Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Give sensible feedback when a repo has no configured serversDan McGee2009-06-08
| | | | | | | | | | | | | | This fixes FS#14899. When running an -Sp operation without servers configured for a repository, we would segfault, so add an assert to the backend method returning the first server preventing a null pointer dereference. In addition, add a new error code to libalpm that indicates we have no servers configured for a repository. This makes -Sy and -S <package> operations fail gracefully and helpfully when a repo is set up with no servers, as the default mirrorlist in Arch is provided this way. Signed-off-by: Dan McGee <dan@archlinux.org>
* Introduce _alpm_pkg_free_trans()Nagy Gabor2009-06-07
| | | | | | | | | The main purpose of this function to make our code more readable. It frees transaction specific fields of pmpkg_t. (It is used when a package is removed from the target list.) Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* xdelta : only handle gz compression specificallyXavier Chantry2009-06-06
| | | | | | | | | | | | | | There is apparently no need to handle the re-compression manually when applying a xdelta patch in case of bzip2 or xz. Only gzip needs to be handled specifically for disabling timestamp with the -n option. After this patch, if xdelta is enhanced with xz support (1-line patch), it will be transparent from pacman side. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove find_replacements()Nagy Gabor2009-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Foo replaces bar" simply means that "foo is a new version of bar". So this patch refactors the code to use this "rule". _alpm_sync_sysupgrade now does the following for each local package [bar] (pseudo-code): for db in syncdbs { if(db contains bar) {check if db/bar is an upgrade; break;} replacers = find(bar replacers in db); if(replacers!=NULL) {ask_user; break;} } Note: 1. Replacers are grouped per repo. If more than one package replace bar in a repo, all of them are considered ("package set of bar replacers"). 2. If repo1/foo1 and repo2/foo2 both replaces bar, only repo1/foo1 is considered (if repo1 stands before repo2 in pacman.conf). FS#11737 is fixed. 3. It can happen that pacman doesn't consider any replacer, if it found a literal "earlier", so sync132.py modified accordingly (btw, that situation should not appear irl). The new sysupgrade code doesn't use sync_newversion(), so I removed the "local is newer than repo" message, which was annoying with -Qu and SyncFirst. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Look in target-list first to resolve dependenciesBryan Ischo2009-04-11
| | | | | | | | | | | | | | | This fixes a bug introduced by my previous changes which changes the behavior of IgnorePkg/IgnoreGroup to allow the user to remove unresolvable packages from the transaction. The bug is that the target-list was no longer being consulted first to resolve dependencies, which means that if two packages in the sync database satisfied a dependency, and the user explicitly requested one of those two packages in the sync, the other package was still being pulled in. A new test was added, sync993.py, to verify the desired behavior. Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>