Imported from pacman-2.7.6.tar.gz

This commit is contained in:
Judd Vinet 2004-04-04 06:32:24 +00:00
parent 88c73d4d65
commit d7c17ff1cc
7 changed files with 124 additions and 57 deletions

View file

@ -1,5 +1,8 @@
VERSION DESCRIPTION
-----------------------------------------------------------------------------
2.7.6 - added --print-uris option
- fixed an http download bug (bug #667)
- fixed a segfault related to replaces/conflicts handling
2.7.5 - "replaces" packages were ignoring IgnorePkg in pacman.conf
- fixed another bug in conflict handling
- found an out-dated reference to /usr/abs, fixed

View file

@ -34,7 +34,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
PACVER = 2.7.5
PACVER = 2.7.6
TOPDIR = @srcdir@
SRCDIR = $(TOPDIR)/src/

View file

@ -1,4 +1,4 @@
.TH pacman 8 "February 6, 2004" "pacman #VERSION#" ""
.TH pacman 8 "April 3, 2004" "pacman #VERSION#" ""
.SH NAME
pacman \- package manager utility
.SH SYNOPSIS
@ -115,6 +115,11 @@ dependencies, conflicts, etc.
List all files in the specified repositories. Multiple repositories can
be specified on the command line.
.TP
.B "\-p, \-\-print-uris"
Print out URIs for each specified package and its dependencies. These
can be piped to a file and downloaded at a later time, using a program
like wget.
.TP
.B "\-s, \-\-search <string>"
This will search each package in the package list for names or descriptions
that contains <string>.
@ -217,12 +222,9 @@ Overrides the default location of the toplevel database directory. The default
Instructs pacman to ignore any upgrades for this package when performing a
\fB--sysupgrade\fP.
.TP
.B "ProxyServer = <host | ip>"
.B "ProxyServer = <host|ip>[:port]"
If set, pacman will use this proxy server for all ftp/http transfers.
.TP
.B "ProxyPort = <port>"
Use this to set a different port for your proxy server (default is 80).
.TP
.B "NoPassiveFtp"
Disables passive ftp connections when downloading packages. (aka Active Mode)
.TP

View file

@ -1414,8 +1414,8 @@ static int HttpSendCmd(const char *cmd, char expresp, netbuf *nControl)
{
int ret = 0;
char *buf = nControl->response;
if (nControl->dir != FTPLIB_CONTROL)
return 0;
//if (nControl->dir != FTPLIB_CONTROL)
//return 0;
if (ftplib_debug > 2)
fprintf(stderr,"%s\n",cmd);
if (net_write(nControl->handle,cmd,strlen(cmd)) <= 0)
@ -1426,8 +1426,9 @@ static int HttpSendCmd(const char *cmd, char expresp, netbuf *nControl)
while (ret < 256) {
if (socket_wait(nControl) != 1)
return 0;
if (net_read(nControl->handle,buf,1) != 1)
if (net_read(nControl->handle,buf,1) != 1) {
break;
}
ret++;
if (*buf == '\r') continue;
if (*buf == '\n') break;

View file

@ -72,6 +72,7 @@ unsigned short pmo_r_cascade = 0;
unsigned short pmo_r_recurse = 0;
unsigned short pmo_s_upgrade = 0;
unsigned short pmo_s_downloadonly = 0;
unsigned short pmo_s_printuris = 0;
unsigned short pmo_s_sync = 0;
unsigned short pmo_s_search = 0;
unsigned short pmo_s_clean = 0;
@ -80,7 +81,7 @@ unsigned short pmo_group = 0;
char *pmo_dbpath = NULL;
char *pmo_logfile = NULL;
char *pmo_proxyhost = NULL;
unsigned short pmo_proxyport = 80;
unsigned short pmo_proxyport = 0;
PMList *pmo_noupgrade = NULL;
PMList *pmo_ignorepkg = NULL;
unsigned short pmo_usesyslog = 0;
@ -942,7 +943,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
final = k;
/* list targets */
if(final && final->data && allgood) {
if(final && final->data && allgood && !pmo_s_printuris) {
PMList *list = NULL;
char *str;
for(i = rmtargs; i; i = i->next) {
@ -987,7 +988,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
confirm = yesno("\nProceed with download? [Y/n] ");
} else {
/* don't get any confirmation if we're called from makepkg */
if(pmo_d_resolve) {
if(pmo_d_resolve || pmo_s_printuris) {
confirm = 1;
} else {
confirm = yesno("\nProceed with upgrade? [Y/n] ");
@ -1025,46 +1026,64 @@ int pacman_sync(pacdb_t *db, PMList *targets)
struct stat buf;
char path[PATH_MAX];
snprintf(path, PATH_MAX, "%s/%s-%s.pkg.tar.gz",
ldir, sync->pkg->name, sync->pkg->version);
if(stat(path, &buf)) {
/* file is not in the cache dir, so add it to the list */
if(pmo_s_printuris) {
snprintf(path, PATH_MAX, "%s-%s.pkg.tar.gz", sync->pkg->name, sync->pkg->version);
files = list_add(files, strdup(path));
} else {
vprint(" %s-%s.pkg.tar.gz is already in the cache\n", sync->pkg->name, sync->pkg->version);
count++;
snprintf(path, PATH_MAX, "%s/%s-%s.pkg.tar.gz",
ldir, sync->pkg->name, sync->pkg->version);
if(stat(path, &buf)) {
/* file is not in the cache dir, so add it to the list */
snprintf(path, PATH_MAX, "%s-%s.pkg.tar.gz", sync->pkg->name, sync->pkg->version);
files = list_add(files, strdup(path));
} else {
vprint(" %s-%s.pkg.tar.gz is already in the cache\n", sync->pkg->name, sync->pkg->version);
count++;
}
}
}
}
if(files) {
struct stat buf;
printf("\n:: Retrieving packages from %s...\n", current->treename);
fflush(stdout);
if(stat(ldir, &buf)) {
mode_t oldmask;
char parent[PATH_MAX];
/* no cache directory.... try creating it */
snprintf(parent, PATH_MAX, "%svar/cache/pacman", pmo_root);
logaction(stderr, "warning: no %s cache exists. creating...", ldir);
oldmask = umask(0000);
mkdir(parent, 0755);
if(mkdir(ldir, 0755)) {
/* couldn't mkdir the cache directory, so fall back to /tmp and unlink
* the package afterwards.
*/
logaction(stderr, "warning: couldn't create package cache, using /tmp instead");
snprintf(ldir, PATH_MAX, "/tmp");
varcache = 0;
if(pmo_s_printuris) {
server_t *server = (server_t*)current->servers->data;
for(j = files; j; j = j->next) {
if(!strcmp(server->protocol, "file")) {
printf("%s://%s%s\n", server->protocol, server->path,
(char*)j->data);
} else {
printf("%s://%s%s%s\n", server->protocol,
server->server, server->path, (char*)j->data);
}
}
} else {
struct stat buf;
printf("\n:: Retrieving packages from %s...\n", current->treename);
fflush(stdout);
if(stat(ldir, &buf)) {
mode_t oldmask;
char parent[PATH_MAX];
/* no cache directory.... try creating it */
snprintf(parent, PATH_MAX, "%svar/cache/pacman", pmo_root);
logaction(stderr, "warning: no %s cache exists. creating...", ldir);
oldmask = umask(0000);
mkdir(parent, 0755);
if(mkdir(ldir, 0755)) {
/* couldn't mkdir the cache directory, so fall back to /tmp and unlink
* the package afterwards.
*/
logaction(stderr, "warning: couldn't create package cache, using /tmp instead");
snprintf(ldir, PATH_MAX, "/tmp");
varcache = 0;
}
umask(oldmask);
}
if(downloadfiles(current->servers, ldir, files)) {
fprintf(stderr, "error: failed to retrieve some files from %s\n", current->treename);
allgood = 0;
}
umask(oldmask);
}
if(downloadfiles(current->servers, ldir, files)) {
fprintf(stderr, "error: failed to retrieve some files from %s\n", current->treename);
allgood = 0;
}
count += list_count(files);
FREELIST(files);
@ -1077,6 +1096,10 @@ int pacman_sync(pacdb_t *db, PMList *targets)
/* double-check */
FREELIST(files);
if(pmo_s_printuris) {
/* we're done */
goto sync_cleanup;
}
if(allgood) {
/* Check integrity of files */
@ -1128,14 +1151,19 @@ int pacman_sync(pacdb_t *db, PMList *targets)
}
}
if(allgood) {
if(allgood && rmtargs) {
/* Check dependencies of packages in rmtargs and make sure
* we won't be breaking anything by removing them.
* If a broken dep is detected, make sure it's not from a
* package that's in our final (upgrade) list.
*/
vprint("checking dependencies...\n");
i = checkdeps(db, PM_REMOVE, rmtargs);
PMList *rmtargs_p = NULL;
for(i = rmtargs; i; i = i->next) {
pkginfo_t *p = db_scan(db, i->data, INFRQ_DESC | INFRQ_DEPENDS);
rmtargs_p = list_add(rmtargs_p, p);
}
vprint("checking dependencies of packages designated for removal...\n");
i = checkdeps(db, PM_REMOVE, rmtargs_p);
for(j = i; j; j = j->next) {
depmissing_t* miss = (depmissing_t*)j->data;
syncpkg_t *s = find_pkginsync(miss->depend.name, final);
@ -1148,16 +1176,18 @@ int pacman_sync(pacdb_t *db, PMList *targets)
}
}
FREELIST(i);
FREELISTPKGS(rmtargs_p);
}
if(!pmo_s_downloadonly && allgood) {
/* remove any conflicting packages (WITHOUT dep checks) */
if(rmtargs) {
int retcode;
int oldupg = pmo_upgrade;
pmo_upgrade = 1;
retcode = pacman_remove(db, rmtargs);
pmo_upgrade = oldupg;
int oldval = pmo_nodeps;
/* we make pacman_remove() skip dependency checks by setting pmo_nodeps high */
pmo_nodeps = 1;
retcode = pacman_remove(db, rmtargs);
pmo_nodeps = oldval;
FREELIST(rmtargs);
if(retcode == 1) {
fprintf(stderr, "\nupgrade aborted.\n");
@ -1239,6 +1269,7 @@ int pacman_sync(pacdb_t *db, PMList *targets)
}
/* cleanup */
sync_cleanup:
for(i = final; i; i = i->next) {
syncpkg_t *sync = (syncpkg_t*)i->data;
if(sync) {
@ -2900,6 +2931,7 @@ int parseargs(int op, int argc, char **argv)
{"info", no_argument, 0, 'i'},
{"sysupgrade", no_argument, 0, 'u'},
{"downloadonly", no_argument, 0, 'w'},
{"print-uris", no_argument, 0, 'p'},
{"refresh", no_argument, 0, 'y'},
{"cascade", no_argument, 0, 'c'},
{"recursive", no_argument, 0, 's'},
@ -2933,7 +2965,7 @@ int parseargs(int op, int argc, char **argv)
case 'i': pmo_q_info++; break;
case 'l': pmo_q_list = 1; break;
case 'n': pmo_nosave = 1; break;
case 'p': pmo_q_isfile = 1; break;
case 'p': pmo_q_isfile = 1; pmo_s_printuris = 1; break;
case 'o': pmo_q_owns = 1; break;
case 'r': if(realpath(optarg, pmo_root) == NULL) {
perror("bad root path");
@ -3230,6 +3262,7 @@ void usage(int op, char *myname)
printf(" -g, --groups view all members of a package group\n");
printf(" -i, --info view package information\n");
printf(" -l, --list list all packages belonging to the specified repository\n");
printf(" -p, --print-uris print out download URIs for each package to be installed\n");
printf(" -s, --search search sync database for matching strings\n");
printf(" -u, --sysupgrade upgrade all packages that are out of date\n");
printf(" -w, --downloadonly download packages, but do not install/upgrade anything\n");

View file

@ -22,7 +22,7 @@
#define _PAC_PACMAN_H
#ifndef PACVER
#define PACVER "2.7.5"
#define PACVER "2.7.6"
#endif
#ifndef PKGDIR

View file

@ -145,13 +145,16 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
} else {
vprint("FTP passive mode not set\n");
}
/*} else if(!strcmp(server->protocol, "http") || (pmo_proxyhost && !strcmp(server->protocol, "ftp"))) {*/
} else if(!strcmp(server->protocol, "http") || pmo_proxyhost) {
} else if(pmo_proxyhost) {
char *host;
unsigned port;
host = (pmo_proxyhost) ? pmo_proxyhost : server->server;
port = (pmo_proxyhost) ? pmo_proxyport : 80;
vprint("Connecting to %s:%u\n", host, port);
if(strchr(host, ':')) {
vprint("Connecting to %s\n", host);
} else {
vprint("Connecting to %s:%u\n", host, port);
}
if(!HttpConnect(host, port, &control)) {
fprintf(stderr, "error: cannot connect to %s\n", host);
continue;
@ -159,7 +162,7 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
}
/* set up our progress bar's callback (and idle timeout) */
if(strcmp(server->protocol, "file")) {
if(strcmp(server->protocol, "file") && control) {
FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control);
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
@ -224,9 +227,34 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
} else {
filedone = 1;
}
/*} else if(!strcmp(server->protocol, "http") || (pmo_proxyhost && !strcmp(server->protocol, "ftp"))) {*/
} else if(!strcmp(server->protocol, "http") || pmo_proxyhost) {
char src[PATH_MAX];
char *host;
unsigned port;
if(!strcmp(server->protocol, "http") && !pmo_proxyhost) {
/* HTTP servers hang up after each request (but not proxies), so
* we have to re-connect for each files.
*/
host = (pmo_proxyhost) ? pmo_proxyhost : server->server;
port = (pmo_proxyhost) ? pmo_proxyport : 80;
if(strchr(host, ':')) {
vprint("Connecting to %s\n", host);
} else {
vprint("Connecting to %s:%u\n", host, port);
}
if(!HttpConnect(host, port, &control)) {
fprintf(stderr, "error: cannot connect to %s\n", host);
continue;
}
/* set up our progress bar's callback (and idle timeout) */
if(strcmp(server->protocol, "file") && control) {
FtpOptions(FTPLIB_CALLBACK, (long)log_progress, control);
FtpOptions(FTPLIB_IDLETIME, (long)1000, control);
FtpOptions(FTPLIB_CALLBACKARG, (long)&fsz, control);
FtpOptions(FTPLIB_CALLBACKBYTES, (10*1024), control);
}
}
if(!stat(output, &st)) {
offset = (int)st.st_size;
}