4 * Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@archlinux.org>
5 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 #include <alpm_list.h>
40 static int unlink_verbose(const char *pathname
, int ignore_missing
)
42 int ret
= unlink(pathname
);
44 if(ignore_missing
&& errno
== ENOENT
) {
47 pm_printf(ALPM_LOG_ERROR
, _("could not remove %s: %s\n"),
48 pathname
, strerror(errno
));
54 /* if keep_used != 0, then the db files which match an used syncdb
56 static int sync_cleandb(const char *dbpath
, int keep_used
)
63 dir
= opendir(dbpath
);
65 pm_printf(ALPM_LOG_ERROR
, _("could not access database directory\n"));
69 syncdbs
= alpm_get_syncdbs(config
->handle
);
72 /* step through the directory one file at a time */
73 while((ent
= readdir(dir
)) != NULL
) {
77 const char *dname
= ent
->d_name
;
81 if(strcmp(dname
, ".") == 0 || strcmp(dname
, "..") == 0) {
84 /* skip the local and sync directories */
85 if(strcmp(dname
, "sync") == 0 || strcmp(dname
, "local") == 0) {
88 /* skip the db.lck file */
89 if(strcmp(dname
, "db.lck") == 0) {
93 /* build the full path */
94 snprintf(path
, PATH_MAX
, "%s%s", dbpath
, dname
);
96 /* remove all non-skipped directories and non-database files */
98 if(S_ISDIR(buf
.st_mode
)) {
100 pm_printf(ALPM_LOG_ERROR
, _("could not remove %s: %s\n"),
101 path
, strerror(errno
));
107 if(len
> 3 && strcmp(dname
+ len
- 3, ".db") == 0) {
108 dbname
= strndup(dname
, len
- 3);
109 } else if(len
> 7 && strcmp(dname
+ len
- 7, ".db.sig") == 0) {
110 dbname
= strndup(dname
, len
- 7);
112 ret
+= unlink_verbose(path
, 0);
118 for(i
= syncdbs
; i
&& !found
; i
= alpm_list_next(i
)) {
119 alpm_db_t
*db
= i
->data
;
120 found
= !strcmp(dbname
, alpm_db_get_name(db
));
124 /* We have a database that doesn't match any syncdb. */
126 /* ENOENT check is because the signature and database could come in any
127 * order in our readdir() call, so either file may already be gone. */
128 snprintf(path
, PATH_MAX
, "%s%s.db", dbpath
, dbname
);
129 ret
+= unlink_verbose(path
, 1);
130 /* unlink a signature file if present too */
131 snprintf(path
, PATH_MAX
, "%s%s.db.sig", dbpath
, dbname
);
132 ret
+= unlink_verbose(path
, 1);
140 static int sync_cleandb_all(void)
146 dbpath
= alpm_option_get_dbpath(config
->handle
);
147 printf(_("Database directory: %s\n"), dbpath
);
148 if(!yesno(_("Do you want to remove unused repositories?"))) {
151 printf(_("removing unused sync repositories...\n"));
152 /* The sync dbs were previously put in dbpath/ but are now in dbpath/sync/.
153 * We will clean everything in dbpath/ except local/, sync/ and db.lck, and
154 * only the unused sync dbs in dbpath/sync/ */
155 ret
+= sync_cleandb(dbpath
, 0);
157 if(asprintf(&newdbpath
, "%s%s", dbpath
, "sync/") < 0) {
161 ret
+= sync_cleandb(newdbpath
, 1);
167 static int sync_cleancache(int level
)
170 alpm_list_t
*sync_dbs
= alpm_get_syncdbs(config
->handle
);
171 alpm_db_t
*db_local
= alpm_get_localdb(config
->handle
);
172 alpm_list_t
*cachedirs
= alpm_option_get_cachedirs(config
->handle
);
175 if(!config
->cleanmethod
) {
176 /* default to KeepInstalled if user did not specify */
177 config
->cleanmethod
= PM_CLEAN_KEEPINST
;
181 printf(_("Packages to keep:\n"));
182 if(config
->cleanmethod
& PM_CLEAN_KEEPINST
) {
183 printf(_(" All locally installed packages\n"));
185 if(config
->cleanmethod
& PM_CLEAN_KEEPCUR
) {
186 printf(_(" All current sync database packages\n"));
191 for(i
= cachedirs
; i
; i
= alpm_list_next(i
)) {
192 const char *cachedir
= i
->data
;
196 printf(_("Cache directory: %s\n"), (const char *)i
->data
);
199 if(!yesno(_("Do you want to remove all other packages from cache?"))) {
203 printf(_("removing old packages from cache...\n"));
205 if(!noyes(_("Do you want to remove ALL files from cache?"))) {
209 printf(_("removing all files from cache...\n"));
212 dir
= opendir(cachedir
);
214 pm_printf(ALPM_LOG_ERROR
,
215 _("could not access cache directory %s\n"), cachedir
);
221 /* step through the directory one file at a time */
222 while((ent
= readdir(dir
)) != NULL
) {
225 alpm_pkg_t
*localpkg
= NULL
, *pkg
= NULL
;
226 const char *local_name
, *local_version
;
228 if(strcmp(ent
->d_name
, ".") == 0 || strcmp(ent
->d_name
, "..") == 0) {
233 static const char * const glob_skips
[] = {
234 /* skip signature files - they are removed with their package file */
236 /* skip package database within the cache directory */
238 /* skip source packages within the cache directory */
240 /* skip package deltas, we aren't smart enough to clean these yet */
242 /* skip any partial downloads */
247 for(j
= 0; j
< sizeof(glob_skips
) / sizeof(glob_skips
[0]); j
++) {
248 if(fnmatch(glob_skips
[j
], ent
->d_name
, 0) == 0) {
258 /* build the full filepath */
259 snprintf(path
, PATH_MAX
, "%s%s", cachedir
, ent
->d_name
);
261 /* short circuit for removing all files from cache */
263 ret
+= unlink_verbose(path
, 0);
267 /* attempt to load the file as a package. if we cannot load the file,
268 * simply skip it and move on. we don't need a full load of the package,
269 * just the metadata. */
270 if(alpm_pkg_load(config
->handle
, path
, 0, 0, &localpkg
) != 0) {
271 pm_printf(ALPM_LOG_DEBUG
, "skipping %s, could not load as package\n",
275 local_name
= alpm_pkg_get_name(localpkg
);
276 local_version
= alpm_pkg_get_version(localpkg
);
278 if(config
->cleanmethod
& PM_CLEAN_KEEPINST
) {
279 /* check if this package is in the local DB */
280 pkg
= alpm_db_get_pkg(db_local
, local_name
);
281 if(pkg
!= NULL
&& alpm_pkg_vercmp(local_version
,
282 alpm_pkg_get_version(pkg
)) == 0) {
283 /* package was found in local DB and version matches, keep it */
284 pm_printf(ALPM_LOG_DEBUG
, "package %s-%s found in local db\n",
285 local_name
, local_version
);
289 if(config
->cleanmethod
& PM_CLEAN_KEEPCUR
) {
291 /* check if this package is in a sync DB */
292 for(j
= sync_dbs
; j
&& delete; j
= alpm_list_next(j
)) {
293 alpm_db_t
*db
= j
->data
;
294 pkg
= alpm_db_get_pkg(db
, local_name
);
295 if(pkg
!= NULL
&& alpm_pkg_vercmp(local_version
,
296 alpm_pkg_get_version(pkg
)) == 0) {
297 /* package was found in a sync DB and version matches, keep it */
298 pm_printf(ALPM_LOG_DEBUG
, "package %s-%s found in sync db\n",
299 local_name
, local_version
);
304 /* free the local file package */
305 alpm_pkg_free(localpkg
);
308 size_t pathlen
= strlen(path
);
309 ret
+= unlink_verbose(path
, 0);
310 /* unlink a signature file if present too */
311 if(PATH_MAX
- 5 >= pathlen
) {
312 strcpy(path
+ pathlen
, ".sig");
313 ret
+= unlink_verbose(path
, 1);
324 static int sync_synctree(int level
, alpm_list_t
*syncs
)
327 unsigned int success
= 0;
329 for(i
= syncs
; i
; i
= alpm_list_next(i
)) {
330 alpm_db_t
*db
= i
->data
;
332 int ret
= alpm_db_update((level
< 2 ? 0 : 1), db
);
334 pm_printf(ALPM_LOG_ERROR
, _("failed to update %s (%s)\n"),
335 alpm_db_get_name(db
), alpm_strerror(alpm_errno(config
->handle
)));
336 } else if(ret
== 1) {
337 printf(_(" %s is up to date\n"), alpm_db_get_name(db
));
344 /* We should always succeed if at least one DB was upgraded - we may possibly
345 * fail later with unresolved deps, but that should be rare, and would be
349 pm_printf(ALPM_LOG_ERROR
, _("failed to synchronize any databases\n"));
352 return (success
> 0);
355 static void print_installed(alpm_db_t
*db_local
, alpm_pkg_t
*pkg
)
357 const char *pkgname
= alpm_pkg_get_name(pkg
);
358 const char *pkgver
= alpm_pkg_get_version(pkg
);
359 alpm_pkg_t
*lpkg
= alpm_db_get_pkg(db_local
, pkgname
);
361 const char *lpkgver
= alpm_pkg_get_version(lpkg
);
362 if(strcmp(lpkgver
,pkgver
) == 0) {
363 printf(" [%s]", _("installed"));
365 printf(" [%s: %s]", _("installed"), lpkgver
);
370 /* search the sync dbs for a matching package */
371 static int sync_search(alpm_list_t
*syncs
, alpm_list_t
*targets
)
373 alpm_list_t
*i
, *j
, *ret
;
376 alpm_db_t
*db_local
= alpm_get_localdb(config
->handle
);
378 for(i
= syncs
; i
; i
= alpm_list_next(i
)) {
379 alpm_db_t
*db
= i
->data
;
381 /* if we have a targets list, search for packages matching it */
383 ret
= alpm_db_search(db
, targets
);
386 ret
= alpm_db_get_pkgcache(db
);
394 cols
= getcols(fileno(stdout
));
395 for(j
= ret
; j
; j
= alpm_list_next(j
)) {
397 alpm_pkg_t
*pkg
= j
->data
;
400 printf("%s/%s %s", alpm_db_get_name(db
), alpm_pkg_get_name(pkg
),
401 alpm_pkg_get_version(pkg
));
403 fputs(alpm_pkg_get_name(pkg
), stdout
);
407 if((grp
= alpm_pkg_get_groups(pkg
)) != NULL
) {
410 for(k
= grp
; k
; k
= alpm_list_next(k
)) {
411 const char *group
= k
->data
;
412 fputs(group
, stdout
);
413 if(alpm_list_next(k
)) {
414 /* only print a spacer if there are more groups */
421 print_installed(db_local
, pkg
);
423 /* we need a newline and initial indent first */
424 fputs("\n ", stdout
);
425 indentprint(alpm_pkg_get_desc(pkg
), 4, cols
);
429 /* we only want to free if the list was a search list */
438 static int sync_group(int level
, alpm_list_t
*syncs
, alpm_list_t
*targets
)
440 alpm_list_t
*i
, *j
, *k
, *s
= NULL
;
443 for(i
= targets
; i
; i
= alpm_list_next(i
)) {
444 const char *grpname
= i
->data
;
445 for(j
= syncs
; j
; j
= alpm_list_next(j
)) {
446 alpm_db_t
*db
= j
->data
;
447 alpm_group_t
*grp
= alpm_db_get_group(db
, grpname
);
450 /* get names of packages in group */
451 for(k
= grp
->packages
; k
; k
= alpm_list_next(k
)) {
453 printf("%s %s\n", grpname
,
454 alpm_pkg_get_name(k
->data
));
456 printf("%s\n", alpm_pkg_get_name(k
->data
));
463 for(i
= syncs
; i
; i
= alpm_list_next(i
)) {
464 alpm_db_t
*db
= i
->data
;
466 for(j
= alpm_db_get_groupcache(db
); j
; j
= alpm_list_next(j
)) {
467 alpm_group_t
*grp
= j
->data
;
470 for(k
= grp
->packages
; k
; k
= alpm_list_next(k
)) {
471 printf("%s %s\n", grp
->name
,
472 alpm_pkg_get_name(k
->data
));
475 /* print grp names only, no package names */
476 if(!alpm_list_find_str (s
, grp
->name
)) {
477 s
= alpm_list_add (s
, grp
->name
);
478 printf("%s\n", grp
->name
);
489 static int sync_info(alpm_list_t
*syncs
, alpm_list_t
*targets
)
491 alpm_list_t
*i
, *j
, *k
;
495 for(i
= targets
; i
; i
= alpm_list_next(i
)) {
496 const char *target
= i
->data
;
497 char *name
= strdup(target
);
499 int foundpkg
= 0, founddb
= 0;
501 pkgstr
= strchr(name
, '/');
511 for(j
= syncs
; j
; j
= alpm_list_next(j
)) {
512 alpm_db_t
*db
= j
->data
;
513 if(repo
&& strcmp(repo
, alpm_db_get_name(db
)) != 0) {
518 for(k
= alpm_db_get_pkgcache(db
); k
; k
= alpm_list_next(k
)) {
519 alpm_pkg_t
*pkg
= k
->data
;
521 if(strcmp(alpm_pkg_get_name(pkg
), pkgstr
) == 0) {
522 dump_pkg_full(pkg
, config
->op_s_info
> 1);
530 pm_printf(ALPM_LOG_ERROR
,
531 _("repository '%s' does not exist\n"), repo
);
535 pm_printf(ALPM_LOG_ERROR
,
536 _("package '%s' was not found\n"), target
);
542 for(i
= syncs
; i
; i
= alpm_list_next(i
)) {
543 alpm_db_t
*db
= i
->data
;
545 for(j
= alpm_db_get_pkgcache(db
); j
; j
= alpm_list_next(j
)) {
546 alpm_pkg_t
*pkg
= j
->data
;
547 dump_pkg_full(pkg
, config
->op_s_info
> 1);
555 static int sync_list(alpm_list_t
*syncs
, alpm_list_t
*targets
)
557 alpm_list_t
*i
, *j
, *ls
= NULL
;
558 alpm_db_t
*db_local
= alpm_get_localdb(config
->handle
);
561 for(i
= targets
; i
; i
= alpm_list_next(i
)) {
562 const char *repo
= i
->data
;
563 alpm_db_t
*db
= NULL
;
565 for(j
= syncs
; j
; j
= alpm_list_next(j
)) {
566 alpm_db_t
*d
= j
->data
;
568 if(strcmp(repo
, alpm_db_get_name(d
)) == 0) {
575 pm_printf(ALPM_LOG_ERROR
,
576 _("repository \"%s\" was not found.\n"),repo
);
581 ls
= alpm_list_add(ls
, db
);
587 for(i
= ls
; i
; i
= alpm_list_next(i
)) {
588 alpm_db_t
*db
= i
->data
;
590 for(j
= alpm_db_get_pkgcache(db
); j
; j
= alpm_list_next(j
)) {
591 alpm_pkg_t
*pkg
= j
->data
;
594 printf("%s %s %s", alpm_db_get_name(db
), alpm_pkg_get_name(pkg
),
595 alpm_pkg_get_version(pkg
));
596 print_installed(db_local
, pkg
);
599 printf("%s\n", alpm_pkg_get_name(pkg
));
611 static alpm_db_t
*get_db(const char *dbname
)
614 for(i
= alpm_get_syncdbs(config
->handle
); i
; i
= i
->next
) {
615 alpm_db_t
*db
= i
->data
;
616 if(strcmp(alpm_db_get_name(db
), dbname
) == 0) {
623 static int process_pkg(alpm_pkg_t
*pkg
)
625 int ret
= alpm_add_pkg(config
->handle
, pkg
);
628 alpm_errno_t err
= alpm_errno(config
->handle
);
629 if(err
== ALPM_ERR_TRANS_DUP_TARGET
630 || err
== ALPM_ERR_PKG_IGNORED
) {
631 /* just skip duplicate or ignored targets */
632 pm_printf(ALPM_LOG_WARNING
, _("skipping target: %s\n"), alpm_pkg_get_name(pkg
));
635 pm_printf(ALPM_LOG_ERROR
, "'%s': %s\n", alpm_pkg_get_name(pkg
),
640 config
->explicit_adds
= alpm_list_add(config
->explicit_adds
, pkg
);
644 static int process_group(alpm_list_t
*dbs
, const char *group
, int error
)
648 alpm_list_t
*pkgs
= alpm_find_group_pkgs(dbs
, group
);
649 int count
= alpm_list_count(pkgs
);
652 pm_printf(ALPM_LOG_ERROR
, _("target not found: %s\n"), group
);
657 /* we already know another target errored. there is no reason to prompt the
658 * user here; we already validated the group name so just move on since we
659 * won't actually be installing anything anyway. */
663 if(config
->print
== 0) {
664 printf(_(":: There are %d members in group %s:\n"), count
,
666 select_display(pkgs
);
667 char *array
= malloc(count
);
672 if(multiselect_question(array
, count
)) {
678 for(i
= pkgs
; i
; i
= alpm_list_next(i
)) {
681 alpm_pkg_t
*pkg
= i
->data
;
683 if(process_pkg(pkg
) == 1) {
691 for(i
= pkgs
; i
; i
= alpm_list_next(i
)) {
692 alpm_pkg_t
*pkg
= i
->data
;
694 if(process_pkg(pkg
) == 1) {
702 alpm_list_free(pkgs
);
706 static int process_targname(alpm_list_t
*dblist
, const char *targname
,
709 alpm_pkg_t
*pkg
= alpm_find_dbs_satisfier(config
->handle
, dblist
, targname
);
711 /* #FS#23342 - skip ignored packages when user says no */
712 if(alpm_errno(config
->handle
) == ALPM_ERR_PKG_IGNORED
) {
713 pm_printf(ALPM_LOG_WARNING
, _("skipping target: %s\n"), targname
);
718 return process_pkg(pkg
);
720 /* fallback on group */
721 return process_group(dblist
, targname
, error
);
724 static int process_target(const char *target
, int error
)
726 /* process targets */
727 char *targstring
= strdup(target
);
728 char *targname
= strchr(targstring
, '/');
732 if(targname
&& targname
!= targstring
) {
741 pm_printf(ALPM_LOG_ERROR
, _("database not found: %s\n"),
746 dblist
= alpm_list_add(NULL
, db
);
747 ret
= process_targname(dblist
, targname
, error
);
748 alpm_list_free(dblist
);
750 targname
= targstring
;
751 dblist
= alpm_get_syncdbs(config
->handle
);
752 ret
= process_targname(dblist
, targname
, error
);
757 if(ret
&& access(target
, R_OK
) == 0) {
758 pm_printf(ALPM_LOG_WARNING
,
759 _("'%s' is a file, did you mean %s instead of %s?\n"),
760 target
, "-U/--upgrade", "-S/--sync");
765 static int sync_trans(alpm_list_t
*targets
)
770 /* Step 1: create a new transaction... */
771 if(trans_init(config
->flags
, 1) == -1) {
775 /* process targets */
776 for(i
= targets
; i
; i
= alpm_list_next(i
)) {
777 const char *targ
= i
->data
;
778 if(process_target(targ
, retval
) == 1) {
788 if(config
->op_s_upgrade
) {
789 printf(_(":: Starting full system upgrade...\n"));
790 alpm_logaction(config
->handle
, "starting full system upgrade\n");
791 if(alpm_sync_sysupgrade(config
->handle
, config
->op_s_upgrade
>= 2) == -1) {
792 pm_printf(ALPM_LOG_ERROR
, "%s\n", alpm_strerror(alpm_errno(config
->handle
)));
798 return sync_prepare_execute();
801 int sync_prepare_execute(void)
803 alpm_list_t
*i
, *packages
, *data
= NULL
;
806 /* Step 2: "compute" the transaction based on targets and flags */
807 if(alpm_trans_prepare(config
->handle
, &data
) == -1) {
808 alpm_errno_t err
= alpm_errno(config
->handle
);
809 pm_printf(ALPM_LOG_ERROR
, _("failed to prepare transaction (%s)\n"),
812 case ALPM_ERR_PKG_INVALID_ARCH
:
813 for(i
= data
; i
; i
= alpm_list_next(i
)) {
814 const char *pkg
= i
->data
;
815 printf(_(":: package %s does not have a valid architecture\n"), pkg
);
818 case ALPM_ERR_UNSATISFIED_DEPS
:
819 for(i
= data
; i
; i
= alpm_list_next(i
)) {
820 alpm_depmissing_t
*miss
= i
->data
;
821 char *depstring
= alpm_dep_compute_string(miss
->depend
);
822 printf(_(":: %s: requires %s\n"), miss
->target
, depstring
);
826 case ALPM_ERR_CONFLICTING_DEPS
:
827 for(i
= data
; i
; i
= alpm_list_next(i
)) {
828 alpm_conflict_t
*conflict
= i
->data
;
829 /* only print reason if it contains new information */
830 if(conflict
->reason
->mod
== ALPM_DEP_MOD_ANY
) {
831 printf(_(":: %s and %s are in conflict\n"),
832 conflict
->package1
, conflict
->package2
);
834 char *reason
= alpm_dep_compute_string(conflict
->reason
);
835 printf(_(":: %s and %s are in conflict (%s)\n"),
836 conflict
->package1
, conflict
->package2
, reason
);
848 packages
= alpm_trans_get_add(config
->handle
);
849 if(packages
== NULL
) {
850 /* nothing to do: just exit without complaining */
852 printf(_(" there is nothing to do\n"));
857 /* Step 3: actually perform the operation */
859 print_packages(packages
);
867 if(config
->op_s_downloadonly
) {
868 confirm
= yesno(_("Proceed with download?"));
870 confirm
= yesno(_("Proceed with installation?"));
876 if(alpm_trans_commit(config
->handle
, &data
) == -1) {
877 alpm_errno_t err
= alpm_errno(config
->handle
);
878 pm_printf(ALPM_LOG_ERROR
, _("failed to commit transaction (%s)\n"),
881 case ALPM_ERR_FILE_CONFLICTS
:
882 for(i
= data
; i
; i
= alpm_list_next(i
)) {
883 alpm_fileconflict_t
*conflict
= i
->data
;
884 switch(conflict
->type
) {
885 case ALPM_FILECONFLICT_TARGET
:
886 printf(_("%s exists in both '%s' and '%s'\n"),
887 conflict
->file
, conflict
->target
, conflict
->ctarget
);
889 case ALPM_FILECONFLICT_FILESYSTEM
:
890 printf(_("%s: %s exists in filesystem\n"),
891 conflict
->target
, conflict
->file
);
896 case ALPM_ERR_PKG_INVALID
:
897 case ALPM_ERR_PKG_INVALID_CHECKSUM
:
898 case ALPM_ERR_PKG_INVALID_SIG
:
899 case ALPM_ERR_DLT_INVALID
:
900 for(i
= data
; i
; i
= alpm_list_next(i
)) {
901 const char *filename
= i
->data
;
902 printf(_("%s is invalid or corrupted\n"), filename
);
909 printf(_("Errors occurred, no packages were upgraded.\n"));
914 /* Step 4: release transaction resources */
919 if(trans_release() == -1) {
926 int pacman_sync(alpm_list_t
*targets
)
928 alpm_list_t
*sync_dbs
= NULL
;
930 /* clean the cache */
931 if(config
->op_s_clean
) {
934 if(trans_init(0, 0) == -1) {
938 ret
+= sync_cleancache(config
->op_s_clean
);
939 ret
+= sync_cleandb_all();
941 if(trans_release() == -1) {
948 if(check_syncdbs(1, 0)) {
952 sync_dbs
= alpm_get_syncdbs(config
->handle
);
954 if(config
->op_s_sync
) {
955 /* grab a fresh package list */
956 printf(_(":: Synchronizing package databases...\n"));
957 alpm_logaction(config
->handle
, "synchronizing package lists\n");
958 if(!sync_synctree(config
->op_s_sync
, sync_dbs
)) {
963 if(check_syncdbs(1, 1)) {
967 /* search for a package */
968 if(config
->op_s_search
) {
969 return sync_search(sync_dbs
, targets
);
972 /* look for groups */
974 return sync_group(config
->group
, sync_dbs
, targets
);
977 /* get package info */
978 if(config
->op_s_info
) {
979 return sync_info(sync_dbs
, targets
);
982 /* get a listing of files in sync DBs */
983 if(config
->op_q_list
) {
984 return sync_list(sync_dbs
, targets
);
987 if(targets
== NULL
) {
988 if(config
->op_s_upgrade
) {
990 } else if(config
->op_s_sync
) {
993 /* don't proceed here unless we have an operation that doesn't require a
995 pm_printf(ALPM_LOG_ERROR
, _("no targets specified (use -h for help)\n"));
1000 return sync_trans(targets
);
1003 /* vim: set ts=2 sw=2 noet: */