summaryrefslogtreecommitdiffstats
path: root/src/pacman/sync.c
AgeCommit message (Collapse)AuthorFilesLines
2011-06-09Require handle argument to alpm_logaction()Dan McGee1-2/+2
This is the first in a series of patches to update the API to remove the implicit global handle variable. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-11Don't balk on .sig files being invalid in package cacheDan McGee1-4/+19
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-24Perform package verification at package load timeDan McGee1-1/+2
Both md5sum verification and PGP verification can and should be done at package load time. This allows verification to happen as early as possible for packages provided by filename and loaded in the frontend, and moves more stuff out of sync_commit that doesn't really belong there. This should also set the stage for simplified parallel loading of packages later down the road. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-23Make dump_pkg_full a little less insaneDan McGee1-3/+4
The various "level" values were a bit crazy to decipher, and we were doing some very interesting comparisons in certain places. Break it out into two parameters instead so we can seperate the type from the extra information display, and do things accordingly. Nothing changes with the display of any of the five types we currently show: -Si, -Sii, -Qi, -Qii, -Qip. Something to note- we should expose the PKG_FROM enum type somehow, this patch leaves the door open to do that quite easily. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21syntax: if/while statements should have no trailing spaceDan McGee1-3/+3
This is the standard, and we have had a few of these introduced lately that should not be here. Done with: find -name '*.c' | xargs sed -i -e 's#if (#if(#g' find -name '*.c' | xargs sed -i -e 's#while (#while(#g' Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21style cleanup: cast as (type *) not (type*)Dave Reisner1-1/+1
Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21Remove ShowSize optionJakob Gruber1-8/+0
Dan: The commit message originally referenced "VerbosePkgLists", but I'm going to change the name of the option. In addition, this patch serves a purpose being standalone- we should really do things like this with -S --print and hopefully -Q --print in the future. Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-29Merge branch 'maint'Dan McGee1-1/+2
2011-03-29call alpm_option_get_localdb once in syncfirst()Andrea Scarpino1-1/+2
Signed-off-by: Andrea Scarpino <andrea@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Merge branch 'maint'Dan McGee1-14/+26
Conflicts due to change in return calling style. Conflicts: src/pacman/pacman.c src/pacman/sync.c
2011-03-21Do not query group selection when using -SpAllan McRae1-14/+26
Remove unnecessary output when using -Sp. Fixes FS#23340. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Style change: return(x) --> return xDan McGee1-43/+43
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>
2011-03-20Fix handling of ignored packagesPang Yan Han1-0/+7
Noted in FS#23342. When the user attempts to install an ignored package and answers no when asked whether to install it, pacman bails out with: "error: target not found: packagename" This is because satisfiers are not found for the package and execution continues to process_group(), where the package is treated as a group (which does not exist). In addition, test ignore006.py is updated with PACMAN_RETCODE=0 since saying no to installing an ignored package should not be considered an error. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcacheDave Reisner1-5/+5
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-04Read pkgcache into hashAllan McRae1-5/+5
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-01-31Allow both cleanmethod values to be specified at the same timeDan McGee1-37/+39
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-31Style cleanups in clean cache codeDan McGee1-7/+9
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29pacman/sync: implement interactive group selectionXavier Chantry1-2/+1
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29pacman/remove: switch to new alpm_remove_pkg interfaceXavier Chantry1-2/+1
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29pacman/sync: rewrite target handlingXavier Chantry1-15/+95
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-29Remove need to explicitly register the local DBDan McGee1-5/+6
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-08Fix some more simple conversion "errors"Dan McGee1-1/+1
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-08Update copyright years for 2011Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21Always specify arguement type in function delcarationsAllan McRae1-1/+1
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-10-14Clean up all old database files and directoriesAllan McRae1-8/+24
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-06-20Clarify testing within conditional statementsAllan McRae1-4/+4
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-05Remove unnecessary gettext callDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-24Show 'Required By' in -Sii outputDan McGee1-3/+3
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-15Bump copyright dates to 2010Dan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15Add new --print operation for all operationsXavier Chantry1-23/+3
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-15print installed packagesXavier Chantry1-2/+22
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-20Print "there is nothing to do" with NOOP transactionsNagy Gabor1-1/+1
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>
2009-09-21Allow cache cleaning to process all cache directoriesDan McGee1-31/+32
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-21Propagate return status up in DB cleaning codeDan McGee1-4/+6
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-21Add missing closedir calls in cache cleanupDan McGee1-1/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20Merge branch 'maint'Dan McGee1-1/+1
Message updates made this one a bit messy, but nothing too bad. Conflicts: lib/libalpm/add.c lib/libalpm/remove.c
2009-09-20sync.c : duplicate the target before modifying itXavier Chantry1-16/+18
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-17String improvementsXavier Chantry1-1/+1
Add more untranslated strings, improve consistency, etc. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-12Change the interface for target loadingXavier Chantry1-53/+23
-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-09Remove transaction typeXavier Chantry1-6/+7
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-09Add a new reason field to pmconflict_t structNagy Gabor1-3/+10
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-09Allow '-Su foo' operationXavier Chantry1-64/+71
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-06Check package arch before installingXavier Chantry1-0/+6
This implements FS#15622 Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-19Quiet ShowSize with -Ss and -QsXavier Chantry1-1/+1
This fixes FS#15923 PS : duplicated code ftw Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08Fix for FS#15810Nagy Gabor1-9/+17
Skip the SyncFirst dialog, if all the -S packages are SyncFirst packages. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-23Introduce -SuuNagy Gabor1-1/+1
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>
2009-07-16Offer to clean up non-package files in cache directory.Xavier Chantry1-6/+8
This implements FS#15142. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01Update copyright headers and messagesDan McGee1-1/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-09Give sensible feedback when a repo has no configured serversDan McGee1-1/+9
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>
2009-04-11Remove pmsyncpkg_tNagy Gabor1-1/+1
pmsyncpkg_t data sructure was removed: 1. pmpkg_t.reason is used instead of pmsyncpkg_t.newreason. (The target packages come from sync repos, so we can use this field without any problems. Upgrade transaction also uses this field to store this info.) 2. pmsyncpkg_t.removes was moved to pmpkg_t.removes. This step requires careful programming, because we don't duplicate packages when we add them to trans->packages. So we modify sync pkgcache when we add this transaction-only info to our package. Hence it is important to free this list when we remove any package from the target list (remove_unresolvable, remove_conflicts, trans_free), otherwise this could confuse the new sync transactions (with non-pacman GUI). Overall, our code became ~100 line shorter, and we can call our helper functions directly on trans->packages in sync.c, we don't need to maintain parallel package lists. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>