Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=34bdc319e2ee3c2b66253017e789664a7e337754

commit 34bdc319e2ee3c2b66253017e789664a7e337754
Author: Laszlo Papp <djsza...@gmail.com>
Date:   Sun Nov 22 02:53:35 2009 +0100

Refactor -Sp option for separate -Sp/-Spp meaning

* Separate -Sp/-Spp options
* -Sp is now used for printing out URIs in case the package or
dependencies are not downloaded in the cache directory you choosed or
the default /var/cache/pacman-g2/pkg/
* -Spp (or 'p' more than two times) is now used for printing out URIs
in every case, because sometimes it can be useful to get this information
even you downloaded it, that why the previous operation wasn't overwritten
simply.
* The occured 'p' number in the option by the user is examined in the
frontend/pacman-g2, but the skipping part of the code in the
API/libpacman, a new define was needed to establish to communicate
between the API/libpacman and frontend/pacman-g2

[ mv: fix whitespace errors ]

diff --git a/doc/pacman-g2.txt b/doc/pacman-g2.txt
index a97f18b..53ca34f 100644
--- a/doc/pacman-g2.txt
+++ b/doc/pacman-g2.txt
@@ -156,8 +156,9 @@ pacman-g2 packages are in a bzipped tar format.

-p, --print-uris::
Print out URIs for each package that will be installed, including any
-       dependencies that have yet to be installed. These can be piped to a 
file and
-       downloaded at a later time, using a program like wget.
+       dependencies. These can be piped to a file and downloaded at a later 
time,
+       using a program like wget. If you need to get the URIs even if they're 
downloaded,
+       just use -pp for it.

-s, --search <regexp>::
This will search each package in the package list for names or descriptions
diff --git a/lib/libpacman/pacman.h b/lib/libpacman/pacman.h
index 5b67275..815e832 100644
--- a/lib/libpacman/pacman.h
+++ b/lib/libpacman/pacman.h
@@ -280,6 +280,7 @@ enum {
#define PM_TRANS_FLAG_PRINTURIS 0x1000
#define PM_TRANS_FLAG_NOINTEGRITY 0x2000
#define PM_TRANS_FLAG_NOARCH 0x4000
+#define PM_TRANS_FLAG_PRINTURIS_CACHED 0x8000 /* print uris for pkgs that are 
already cached */

/* Transaction Events */
enum {
diff --git a/lib/libpacman/sync.c b/lib/libpacman/sync.c
index 35a4b01..bb3a816 100644
--- a/lib/libpacman/sync.c
+++ b/lib/libpacman/sync.c
@@ -819,6 +819,16 @@ int _pacman_sync_commit(pmtrans_t *trans, pmdb_t 
*db_local, pmlist_t **data)
(char *)_pacman_pkg_getinfo(spkg, PM_PKG_NAME),
(char *)_pacman_pkg_getinfo(spkg, PM_PKG_VERSION),
(char *)_pacman_pkg_getinfo(spkg, PM_PKG_ARCH));
+
+                                               if (!(trans->flags & 
PM_TRANS_FLAG_PRINTURIS_CACHED)) {
+                                                       char lcpath[PATH_MAX];
+                                                       struct stat lcbuf;
+                                                       snprintf(lcpath, 
sizeof(lcpath), "%s/%s", ldir, path);
+                                                       if (stat(lcpath, 
&lcbuf) == 0) {
+                                                               continue;
+                                                       }
+                                               }
+
EVENT(trans, PM_TRANS_EVT_PRINTURI, pacman_db_getinfo(current, 
PM_DB_FIRSTSERVER), path);
} else {
struct stat buf;
diff --git a/src/pacman-g2/pacman-g2.c b/src/pacman-g2/pacman-g2.c
index 3c03ca6..adec47c 100644
--- a/src/pacman-g2/pacman-g2.c
+++ b/src/pacman-g2/pacman-g2.c
@@ -376,6 +376,9 @@ static int parseargs(int argc, char *argv[])
case 'o': config->op_q_owns = 1; break;
case 'p':
config->op_q_isfile = 1;
+                               if (config->flags & PM_TRANS_FLAG_PRINTURIS) {
+                                       config->flags |= 
PM_TRANS_FLAG_PRINTURIS_CACHED;
+                               }
config->flags |= PM_TRANS_FLAG_PRINTURIS;
break;
case 'r':
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to