Imported from pacman-2.6.1.tar.gz
This commit is contained in:
parent
f8bfe729e4
commit
9d9ffa6cec
16 changed files with 487 additions and 163 deletions
|
@ -1,5 +1,14 @@
|
||||||
VERSION DESCRIPTION
|
VERSION DESCRIPTION
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
2.6.1 - Added http download support (Aurelien Foret)
|
||||||
|
- Improved makepkg's --builddeps behaviour when called via
|
||||||
|
makeworld
|
||||||
|
- makepkg's md5 validation now occurs before source extraction
|
||||||
|
- makepkg delays fakeroot entry until after option parsing
|
||||||
|
- Fixed an argument-passing bug in fakeroot
|
||||||
|
- Modified pacman's behaviour wrt provides -- it now allows
|
||||||
|
multiple packages to be installed, even if they provide the
|
||||||
|
same thing (they were treated as conflicts before)
|
||||||
2.6 - Added group handling, so one can run 'pacman -S kde' and
|
2.6 - Added group handling, so one can run 'pacman -S kde' and
|
||||||
install all files from the KDE group
|
install all files from the KDE group
|
||||||
- Fixed a duplication bug in cascade package removal
|
- Fixed a duplication bug in cascade package removal
|
||||||
|
|
|
@ -34,7 +34,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
|
||||||
PACVER = 2.6
|
PACVER = 2.6.1
|
||||||
|
|
||||||
TOPDIR = @srcdir@
|
TOPDIR = @srcdir@
|
||||||
SRCDIR = $(TOPDIR)/src/
|
SRCDIR = $(TOPDIR)/src/
|
||||||
|
|
1
TODO
1
TODO
|
@ -1,5 +1,6 @@
|
||||||
- fix the broken pipe bug
|
- fix the broken pipe bug
|
||||||
- handle version comparators in makepkg dep resolution (eg, glibc>=2.2.5)
|
- handle version comparators in makepkg dep resolution (eg, glibc>=2.2.5)
|
||||||
|
- add post_remove, pre_install, pre_upgrade functions to scriptlets
|
||||||
- record md5sums of all files in a package
|
- record md5sums of all files in a package
|
||||||
? use 'set -e' in makepkg?
|
? use 'set -e' in makepkg?
|
||||||
x if a package fails, ask before aborting the full operation
|
x if a package fails, ask before aborting the full operation
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH makepkg 8 "May 27, 2003" "makepkg #VERSION#" ""
|
.TH makepkg 8 "September 01, 2003" "makepkg #VERSION#" ""
|
||||||
.SH NAME
|
.SH NAME
|
||||||
makepkg \- package build utility
|
makepkg \- package build utility
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH pacman 8 "May 27, 2003" "pacman #VERSION#" ""
|
.TH pacman 8 "September 01, 2003" "pacman #VERSION#" ""
|
||||||
.SH NAME
|
.SH NAME
|
||||||
pacman \- package manager utility
|
pacman \- package manager utility
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
# /etc/makepkg.conf
|
# /etc/makepkg.conf
|
||||||
#
|
#
|
||||||
|
|
||||||
# the top-level directory of all your PKGBUILDs
|
|
||||||
export ABSROOT="/usr/abs"
|
|
||||||
|
|
||||||
# The FTP/HTTP download utility that makepkg should use to acquire sources
|
# The FTP/HTTP download utility that makepkg should use to acquire sources
|
||||||
export FTPAGENT="/usr/bin/wget --continue --passive-ftp --tries=3 --waitretry=3"
|
export FTPAGENT="/usr/bin/wget --continue --passive-ftp --tries=3 --waitretry=3"
|
||||||
#export FTPAGENT="/usr/bin/snarf"
|
#export FTPAGENT="/usr/bin/snarf"
|
||||||
|
|
|
@ -26,6 +26,7 @@ Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/pub/Linux/dist
|
||||||
Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/current
|
Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/current
|
||||||
Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/current
|
Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/current
|
||||||
Server = ftp://ftp.parrswood.net/Mirrors/ftp.archlinux.org/current
|
Server = ftp://ftp.parrswood.net/Mirrors/ftp.archlinux.org/current
|
||||||
|
Server = http://darkstar.ist.utl.pt/archlinux/current
|
||||||
Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/current
|
Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/current
|
||||||
Server = ftp://saule.mintis.lt/pub/linux/current
|
Server = ftp://saule.mintis.lt/pub/linux/current
|
||||||
Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/current
|
Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/current
|
||||||
|
@ -40,6 +41,7 @@ Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/pub/Linux/dist
|
||||||
Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/unofficial
|
Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/unofficial
|
||||||
Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/unofficial
|
Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/unofficial
|
||||||
Server = ftp://ftp.parrswood.net/Mirrors/ftp.archlinux.org/unofficial
|
Server = ftp://ftp.parrswood.net/Mirrors/ftp.archlinux.org/unofficial
|
||||||
|
Server = http://darkstar.ist.utl.pt/archlinux/unofficial
|
||||||
Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/unofficial
|
Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/unofficial
|
||||||
Server = ftp://saule.mintis.lt/pub/linux/unofficial
|
Server = ftp://saule.mintis.lt/pub/linux/unofficial
|
||||||
Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/unofficial
|
Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/unofficial
|
||||||
|
@ -55,6 +57,7 @@ Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/unofficial
|
||||||
#Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/stable
|
#Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/stable
|
||||||
#Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/stable
|
#Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/stable
|
||||||
#Server = ftp://ftp.parrswood.net/Mirrors/ftp.archlinux.org/stable
|
#Server = ftp://ftp.parrswood.net/Mirrors/ftp.archlinux.org/stable
|
||||||
|
#Server = http://darkstar.ist.utl.pt/archlinux/stable
|
||||||
#Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/stable
|
#Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/stable
|
||||||
#Server = ftp://saule.mintis.lt/pub/linux/stable
|
#Server = ftp://saule.mintis.lt/pub/linux/stable
|
||||||
#Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/stable
|
#Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/stable
|
||||||
|
@ -69,6 +72,7 @@ Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/unofficial
|
||||||
#Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/unstable
|
#Server = ftp://ftp.oit.unc.edu/pub/Linux/distributions/archlinux/unstable
|
||||||
#Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/unstable
|
#Server = ftp://ftp.tu-chemnitz.de/pub/linux/sunsite.unc-mirror/distributions/archlinux/unstable
|
||||||
#Server = ftp://ftp.parrswood.net/Mirrors/ftp.archlinux.org/unstable
|
#Server = ftp://ftp.parrswood.net/Mirrors/ftp.archlinux.org/unstable
|
||||||
|
#Server = http://darkstar.ist.utl.pt/archlinux/unstable
|
||||||
#Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/unstable
|
#Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/unstable
|
||||||
#Server = ftp://saule.mintis.lt/pub/linux/unstable
|
#Server = ftp://saule.mintis.lt/pub/linux/unstable
|
||||||
#Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/unstable
|
#Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/unstable
|
||||||
|
|
242
libftp/ftplib.c
242
libftp/ftplib.c
|
@ -1309,3 +1309,245 @@ GLOBALDEF void FtpQuit(netbuf *nControl)
|
||||||
free(nControl->buf);
|
free(nControl->buf);
|
||||||
free(nControl);
|
free(nControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HttpConnect - connect to remote server
|
||||||
|
*
|
||||||
|
* return 1 if connected, 0 if not
|
||||||
|
*/
|
||||||
|
GLOBALREF int HttpConnect(const char *host, netbuf **nControl)
|
||||||
|
{
|
||||||
|
int sControl;
|
||||||
|
struct sockaddr_in sin;
|
||||||
|
struct hostent *phe;
|
||||||
|
struct servent *pse;
|
||||||
|
int on=1;
|
||||||
|
netbuf *ctrl;
|
||||||
|
char *lhost;
|
||||||
|
char *pnum;
|
||||||
|
|
||||||
|
memset(&sin,0,sizeof(sin));
|
||||||
|
sin.sin_family = AF_INET;
|
||||||
|
lhost = strdup(host);
|
||||||
|
pnum = strchr(lhost,':');
|
||||||
|
if (pnum == NULL)
|
||||||
|
{
|
||||||
|
#if defined(VMS)
|
||||||
|
sin.sin_port = htons(21);
|
||||||
|
#else
|
||||||
|
if ((pse = getservbyname("http","tcp")) == NULL)
|
||||||
|
{
|
||||||
|
perror("getservbyname");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
sin.sin_port = pse->s_port;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pnum++ = '\0';
|
||||||
|
if (isdigit(*pnum))
|
||||||
|
sin.sin_port = htons(atoi(pnum));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pse = getservbyname(pnum,"tcp");
|
||||||
|
sin.sin_port = pse->s_port;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((sin.sin_addr.s_addr = inet_addr(lhost)) == -1)
|
||||||
|
{
|
||||||
|
if ((phe = gethostbyname(lhost)) == NULL)
|
||||||
|
{
|
||||||
|
perror("gethostbyname");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memcpy((char *)&sin.sin_addr, phe->h_addr, phe->h_length);
|
||||||
|
}
|
||||||
|
free(lhost);
|
||||||
|
sControl = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
if (sControl == -1)
|
||||||
|
{
|
||||||
|
perror("socket");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (setsockopt(sControl,SOL_SOCKET,SO_REUSEADDR,
|
||||||
|
SETSOCKOPT_OPTVAL_TYPE &on, sizeof(on)) == -1)
|
||||||
|
{
|
||||||
|
perror("setsockopt");
|
||||||
|
net_close(sControl);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (connect(sControl, (struct sockaddr *)&sin, sizeof(sin)) == -1)
|
||||||
|
{
|
||||||
|
perror("connect");
|
||||||
|
net_close(sControl);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ctrl = calloc(1,sizeof(netbuf));
|
||||||
|
if (ctrl == NULL)
|
||||||
|
{
|
||||||
|
perror("calloc");
|
||||||
|
net_close(sControl);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ctrl->buf = NULL;
|
||||||
|
ctrl->handle = sControl;
|
||||||
|
ctrl->dir = FTPLIB_CONTROL;
|
||||||
|
ctrl->ctrl = NULL;
|
||||||
|
ctrl->cmode = FTPLIB_DEFMODE;
|
||||||
|
ctrl->idlecb = NULL;
|
||||||
|
ctrl->idletime.tv_sec = ctrl->idletime.tv_usec = 0;
|
||||||
|
ctrl->idlearg = NULL;
|
||||||
|
ctrl->xfered = 0;
|
||||||
|
ctrl->xfered1 = 0;
|
||||||
|
ctrl->cbbytes = 0;
|
||||||
|
*nControl = ctrl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HttpSendCmd - send a command
|
||||||
|
*
|
||||||
|
* return 1 if proper response received, 0 otherwise
|
||||||
|
*/
|
||||||
|
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 (ftplib_debug > 2)
|
||||||
|
fprintf(stderr,"%s\n",cmd);
|
||||||
|
if (net_write(nControl->handle,cmd,strlen(cmd)) <= 0)
|
||||||
|
{
|
||||||
|
perror("write");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
while (ret < 256) {
|
||||||
|
if (socket_wait(nControl) != 1)
|
||||||
|
return 0;
|
||||||
|
if (net_read(nControl->handle,buf,1) != 1)
|
||||||
|
break;
|
||||||
|
ret++;
|
||||||
|
if (*buf == '\r') continue;
|
||||||
|
if (*buf == '\n') break;
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
*buf = 0;
|
||||||
|
if (nControl->response[9] == expresp)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HttpXfer - issue a command and transfer data
|
||||||
|
*
|
||||||
|
* return 1 if successful, 0 otherwise
|
||||||
|
*/
|
||||||
|
static int HttpXfer(const char *localfile, const char *path,
|
||||||
|
netbuf *nControl, int typ, int mode)
|
||||||
|
{
|
||||||
|
int l,c;
|
||||||
|
char *dbuf;
|
||||||
|
FILE *local = NULL;
|
||||||
|
int rv=1;
|
||||||
|
|
||||||
|
if (localfile != NULL)
|
||||||
|
{
|
||||||
|
char ac[4] = "a";
|
||||||
|
if (typ == FTPLIB_FILE_WRITE)
|
||||||
|
ac[0] = 'r';
|
||||||
|
if (mode == FTPLIB_IMAGE)
|
||||||
|
ac[1] = 'b';
|
||||||
|
local = fopen(localfile, ac);
|
||||||
|
if (local == NULL)
|
||||||
|
{
|
||||||
|
strncpy(nControl->response, strerror(errno),
|
||||||
|
sizeof(nControl->response));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (local == NULL)
|
||||||
|
local = (typ == FTPLIB_FILE_WRITE) ? stdin : stdout;
|
||||||
|
dbuf = malloc(FTPLIB_BUFSIZ);
|
||||||
|
if (typ == FTPLIB_FILE_WRITE)
|
||||||
|
{
|
||||||
|
while ((l = fread(dbuf, 1, FTPLIB_BUFSIZ, local)) > 0)
|
||||||
|
if ((c = FtpWrite(dbuf, l, nControl)) < l)
|
||||||
|
{
|
||||||
|
printf("short write: passed %d, wrote %d\n", l, c);
|
||||||
|
rv = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nControl->dir = FTPLIB_READ;
|
||||||
|
while ((l = FtpRead(dbuf, FTPLIB_BUFSIZ, nControl)) > 0)
|
||||||
|
if (fwrite(dbuf, 1, l, local) <= 0)
|
||||||
|
{
|
||||||
|
perror("localfile write");
|
||||||
|
rv = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(dbuf);
|
||||||
|
fflush(local);
|
||||||
|
if (localfile != NULL)
|
||||||
|
fclose(local);
|
||||||
|
free(nControl->data);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HttpGet - issue a GET command and write received data to output
|
||||||
|
*
|
||||||
|
* return 1 if successful, 0 otherwise
|
||||||
|
*/
|
||||||
|
GLOBALREF int HttpGet(const char *outputfile, const char *path, int *size,
|
||||||
|
netbuf *nControl)
|
||||||
|
{
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
sprintf(buf, "GET %s HTTP/1.0\r\n\r\n\r\n", path);
|
||||||
|
if(!HttpSendCmd(buf,'2',nControl))
|
||||||
|
{
|
||||||
|
if (nControl->response[9] == '3')
|
||||||
|
printf("redirection not supported\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
char *buf = nControl->response;
|
||||||
|
while (ret < 256) {
|
||||||
|
if (socket_wait(nControl) != 1)
|
||||||
|
return 0;
|
||||||
|
if (net_read(nControl->handle,buf,1) != 1)
|
||||||
|
break;
|
||||||
|
ret++;
|
||||||
|
if (*buf == '\r') continue;
|
||||||
|
if (*buf == '\n') break;
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
*buf = 0;
|
||||||
|
if (strstr(nControl->response,"Content-Length"))
|
||||||
|
sscanf(nControl->response,"Content-Length: %d",size);
|
||||||
|
if (strlen(nControl->response) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HttpXfer(outputfile, path, nControl, FTPLIB_FILE_READ, FTPLIB_IMAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HttpQuit - disconnect from remote
|
||||||
|
*
|
||||||
|
* return 1 if successful, 0 otherwise
|
||||||
|
*/
|
||||||
|
GLOBALREF void HttpQuit(netbuf *nControl)
|
||||||
|
{
|
||||||
|
net_close(nControl->handle);
|
||||||
|
free(nControl);
|
||||||
|
}
|
||||||
|
|
|
@ -119,6 +119,11 @@ GLOBALREF int FtpRename(const char *src, const char *dst, netbuf *nControl);
|
||||||
GLOBALREF int FtpDelete(const char *fnm, netbuf *nControl);
|
GLOBALREF int FtpDelete(const char *fnm, netbuf *nControl);
|
||||||
GLOBALREF void FtpQuit(netbuf *nControl);
|
GLOBALREF void FtpQuit(netbuf *nControl);
|
||||||
|
|
||||||
|
GLOBALREF int HttpConnect(const char *host, netbuf **nControl);
|
||||||
|
GLOBALREF int HttpGet(const char *output, const char *path, int *size,
|
||||||
|
netbuf *nControl);
|
||||||
|
GLOBALREF void HttpQuit(netbuf *nControl);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
# USA.
|
# USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
myver='2.6'
|
myver='2.6.1'
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "gensync $myver"
|
echo "gensync $myver"
|
||||||
|
|
152
scripts/makepkg
152
scripts/makepkg
|
@ -20,13 +20,13 @@
|
||||||
# USA.
|
# USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
myver='2.6'
|
myver='2.6.1'
|
||||||
startdir=`pwd`
|
startdir=`pwd`
|
||||||
|
|
||||||
msg() {
|
# source Arch's abs.conf if it's present
|
||||||
echo "$1" >&2
|
[ -f /etc/abs/abs.conf ] && source /etc/abs/abs.conf
|
||||||
}
|
|
||||||
|
|
||||||
|
# makepkg configuration
|
||||||
[ -f /etc/makepkg.conf ] && source /etc/makepkg.conf
|
[ -f /etc/makepkg.conf ] && source /etc/makepkg.conf
|
||||||
|
|
||||||
INFAKEROOT=
|
INFAKEROOT=
|
||||||
|
@ -35,35 +35,16 @@ if [ "$1" = "-F" ]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "`id -u`" != "0" ]; then
|
### SUBROUTINES ###
|
||||||
if [ "$USE_FAKEROOT" = "y" -o "$USE_FAKEROOT" = "Y" ]; then
|
|
||||||
if [ `type -p fakeroot` ]; then
|
|
||||||
msg "==> Entering fakeroot environment"
|
|
||||||
fakeroot -- $0 -F $@
|
|
||||||
exit $?
|
|
||||||
else
|
|
||||||
msg "==> WARNING: Fakeroot is not installed. Building as an unprivileged user"
|
|
||||||
msg "==> will result in non-root ownership of the packaged files."
|
|
||||||
msg "==> Install the fakeroot package to correctly build as a non-root"
|
|
||||||
msg "==> user."
|
|
||||||
msg ""
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
msg "==> WARNING: Running makepkg as an unprivileged user will result in non-root"
|
|
||||||
msg "==> ownership of the packaged files. Try using the fakeroot"
|
|
||||||
msg "==> environment. (USE_FAKEROOT=y in makepkg.conf)"
|
|
||||||
msg ""
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
msg() {
|
||||||
|
echo "$1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
strip_url() {
|
strip_url() {
|
||||||
echo $1 | sed 's|^.*://.*/||g'
|
echo $1 | sed 's|^.*://.*/||g'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
checkdeps() {
|
checkdeps() {
|
||||||
local missdep=`pacman -T $*`
|
local missdep=`pacman -T $*`
|
||||||
local deplist=""
|
local deplist=""
|
||||||
|
@ -132,6 +113,8 @@ NOSTRIP=0
|
||||||
PKGDEST=$startdir
|
PKGDEST=$startdir
|
||||||
BUILDSCRIPT="./PKGBUILD"
|
BUILDSCRIPT="./PKGBUILD"
|
||||||
|
|
||||||
|
ARGLIST=$@
|
||||||
|
|
||||||
while [ "$#" -ne "0" ]; do
|
while [ "$#" -ne "0" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--clean) CLEANUP=1 ;;
|
--clean) CLEANUP=1 ;;
|
||||||
|
@ -220,8 +203,39 @@ if [ `echo $pkgrel | grep '-'` ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz -a "$FORCE" = "0" -a "$GENMD5" = "0" ]; then
|
if [ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz -a "$FORCE" = "0" -a "$GENMD5" = "0" ]; then
|
||||||
|
if [ "$INSTALL" = "1" ]; then
|
||||||
|
msg "==> WARNING: a package has already been built, installing existing package."
|
||||||
|
pacman --upgrade $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
msg "==> ERROR: a package has already been built. (use -f to overwrite)"
|
msg "==> ERROR: a package has already been built. (use -f to overwrite)"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enter the fakeroot environment if necessary. This will call the makepkg script again
|
||||||
|
# as the fake root user. We detect this by passing a sentinel option (-F) to makepkg
|
||||||
|
if [ "`id -u`" != "0" ]; then
|
||||||
|
if [ "$USE_FAKEROOT" = "y" -o "$USE_FAKEROOT" = "Y" ]; then
|
||||||
|
if [ `type -p fakeroot` ]; then
|
||||||
|
msg "==> Entering fakeroot environment"
|
||||||
|
fakeroot -- $0 -F $ARGLIST
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
|
msg "==> WARNING: Fakeroot is not installed. Building as an unprivileged user"
|
||||||
|
msg "==> will result in non-root ownership of the packaged files."
|
||||||
|
msg "==> Install the fakeroot package to correctly build as a non-root"
|
||||||
|
msg "==> user."
|
||||||
|
msg ""
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
msg "==> WARNING: Running makepkg as an unprivileged user will result in non-root"
|
||||||
|
msg "==> ownership of the packaged files. Try using the fakeroot"
|
||||||
|
msg "==> environment. (USE_FAKEROOT=y in makepkg.conf)"
|
||||||
|
msg ""
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "==> Making package: $pkgname (`date`)"
|
msg "==> Making package: $pkgname (`date`)"
|
||||||
|
@ -285,7 +299,7 @@ fi
|
||||||
|
|
||||||
cd $startdir
|
cd $startdir
|
||||||
|
|
||||||
# extract source
|
# retrieve sources
|
||||||
msg "==> Retrieving Sources..."
|
msg "==> Retrieving Sources..."
|
||||||
mkdir -p src
|
mkdir -p src
|
||||||
cd $startdir/src
|
cd $startdir/src
|
||||||
|
@ -329,7 +343,41 @@ for netfile in ${source[@]}; do
|
||||||
cp $file ..
|
cp $file ..
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$GENMD5" = "0" ]; then
|
done
|
||||||
|
|
||||||
|
if [ "$GENMD5" = "0" ]; then
|
||||||
|
# MD5 validation
|
||||||
|
if [ ${#md5sums[@]} -ne ${#source[@]} ]; then
|
||||||
|
msg "==> WARNING: MD5sums are missing or incomplete. Cannot verify source integrity."
|
||||||
|
#sleep 1
|
||||||
|
elif [ `type -p md5sum` ]; then
|
||||||
|
msg "==> Validating source files with MD5sums"
|
||||||
|
errors=0
|
||||||
|
idx=0
|
||||||
|
for netfile in ${source[@]}; do
|
||||||
|
file=`strip_url $netfile`
|
||||||
|
echo -n " |=> $file ... " >&2
|
||||||
|
echo "${md5sums[$idx]} $file" | md5sum -c - >/dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "FAILED" >&2
|
||||||
|
errors=1
|
||||||
|
else
|
||||||
|
echo "Passed" >&2
|
||||||
|
fi
|
||||||
|
idx=$(($idx+1))
|
||||||
|
done
|
||||||
|
if [ $errors -gt 0 ]; then
|
||||||
|
msg "==> ERROR: One or more files did not pass the validity check!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
msg "==> WARNING: The md5sum program is missing. Cannot verify source files!"
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
# extract sources
|
||||||
|
msg "==> Extracting Sources..."
|
||||||
|
for netfile in ${source[@]}; do
|
||||||
|
file=`strip_url $netfile`
|
||||||
unset cmd
|
unset cmd
|
||||||
case $file in
|
case $file in
|
||||||
*.tar.gz|*.tar.Z|*.tgz)
|
*.tar.gz|*.tar.Z|*.tgz)
|
||||||
|
@ -342,6 +390,8 @@ for netfile in ${source[@]}; do
|
||||||
cmd="unzip -qq $file" ;;
|
cmd="unzip -qq $file" ;;
|
||||||
*.gz)
|
*.gz)
|
||||||
cmd="gunzip $file" ;;
|
cmd="gunzip $file" ;;
|
||||||
|
*.bz2)
|
||||||
|
cmd="bunzip2 $file" ;;
|
||||||
esac
|
esac
|
||||||
if [ "$cmd" != "" ]; then
|
if [ "$cmd" != "" ]; then
|
||||||
msg " |=> $cmd"
|
msg " |=> $cmd"
|
||||||
|
@ -352,10 +402,9 @@ for netfile in ${source[@]}; do
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
done
|
else
|
||||||
|
# generate md5 hashes
|
||||||
if [ "$GENMD5" = "1" ]; then
|
|
||||||
if [ ! `type -p md5sum` ]; then
|
if [ ! `type -p md5sum` ]; then
|
||||||
msg "==> ERROR: Cannot find the md5sum program."
|
msg "==> ERROR: Cannot find the md5sum program."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -384,34 +433,6 @@ if [ "$GENMD5" = "1" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# MD5 Validation
|
|
||||||
if [ ${#md5sums[@]} -ne ${#source[@]} ]; then
|
|
||||||
msg "==> WARNING: MD5sums are missing or incomplete. Cannot verify source integrity."
|
|
||||||
# sleep 1
|
|
||||||
elif [ `type -p md5sum` ]; then
|
|
||||||
msg "==> Validating source files with MD5sums"
|
|
||||||
errors=0
|
|
||||||
idx=0
|
|
||||||
for netfile in ${source[@]}; do
|
|
||||||
file=`strip_url $netfile`
|
|
||||||
echo -n " |=> $file ... " >&2
|
|
||||||
echo "${md5sums[$idx]} $file" | md5sum -c - >/dev/null 2>&1
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "FAILED" >&2
|
|
||||||
errors=1
|
|
||||||
else
|
|
||||||
echo "Passed" >&2
|
|
||||||
fi
|
|
||||||
idx=$(($idx+1))
|
|
||||||
done
|
|
||||||
if [ $errors -gt 0 ]; then
|
|
||||||
msg "==> ERROR: One or more files did not pass the validity check!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
msg "==> WARNING: The md5sum program is missing. Cannot verify source files!"
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "`id -u`" = "0" ]; then
|
if [ "`id -u`" = "0" ]; then
|
||||||
# chown all source files to root.root
|
# chown all source files to root.root
|
||||||
|
@ -481,7 +502,7 @@ if [ "$NOSTRIP" = "0" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get some package meta info
|
# get some package meta info
|
||||||
builddate=`LC_ALL= ; date -u "+%a %b %d %k:%M:%S %Y"`
|
builddate=`LC_ALL= ; date -u "+%a %b %e %k:%M:%S %Y"`
|
||||||
if [ "$PACKAGER" != "" ]; then
|
if [ "$PACKAGER" != "" ]; then
|
||||||
packager="$PACKAGER"
|
packager="$PACKAGER"
|
||||||
else
|
else
|
||||||
|
@ -531,9 +552,7 @@ fi
|
||||||
# build a filelist
|
# build a filelist
|
||||||
msg "==> Generating .FILELIST file..."
|
msg "==> Generating .FILELIST file..."
|
||||||
cd $startdir/pkg
|
cd $startdir/pkg
|
||||||
tar cv * >/dev/null 2>.FILELIST.tmp
|
tar cvf /dev/null * | sort >.FILELIST
|
||||||
cat .FILELIST.tmp | sort >.FILELIST
|
|
||||||
rm -f .FILELIST.tmp
|
|
||||||
|
|
||||||
# tar it up
|
# tar it up
|
||||||
msg "==> Compressing package..."
|
msg "==> Compressing package..."
|
||||||
|
@ -555,7 +574,8 @@ msg "==> Finished making: $pkgname (`date`)"
|
||||||
|
|
||||||
if [ "$INSTALL" = "1" ]; then
|
if [ "$INSTALL" = "1" ]; then
|
||||||
msg "==> Running pacman --upgrade"
|
msg "==> Running pacman --upgrade"
|
||||||
pacman --upgrade $PKGDEST/$pkgname-$pkgver-$pkgrel.pkg.tar.gz
|
pacman --upgrade $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz
|
||||||
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
toplevel=`pwd`
|
toplevel=`pwd`
|
||||||
version="2.6"
|
version="2.6.1"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "makeworld version $version"
|
echo "makeworld version $version"
|
||||||
|
|
1
src/db.c
1
src/db.c
|
@ -529,6 +529,7 @@ PMList* db_find_conflicts(pacdb_t *db, PMList *targets, char *root)
|
||||||
return(conflicts);
|
return(conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* return a PMList of packages in "db" that provide "package" */
|
||||||
PMList *whatprovides(pacdb_t *db, char* package)
|
PMList *whatprovides(pacdb_t *db, char* package)
|
||||||
{
|
{
|
||||||
PMList *pkgs, *i = NULL;
|
PMList *pkgs, *i = NULL;
|
||||||
|
|
75
src/pacman.c
75
src/pacman.c
|
@ -66,6 +66,7 @@ unsigned short pmo_d_resolve = 0;
|
||||||
unsigned short pmo_q_isfile = 0;
|
unsigned short pmo_q_isfile = 0;
|
||||||
unsigned short pmo_q_info = 0;
|
unsigned short pmo_q_info = 0;
|
||||||
unsigned short pmo_q_list = 0;
|
unsigned short pmo_q_list = 0;
|
||||||
|
unsigned short pmo_q_orphans = 0;
|
||||||
unsigned short pmo_q_owns = 0;
|
unsigned short pmo_q_owns = 0;
|
||||||
unsigned short pmo_r_cascade = 0;
|
unsigned short pmo_r_cascade = 0;
|
||||||
unsigned short pmo_s_upgrade = 0;
|
unsigned short pmo_s_upgrade = 0;
|
||||||
|
@ -1716,6 +1717,9 @@ int pacman_remove(pacdb_t *db, PMList *targets)
|
||||||
/* look for a provides package */
|
/* look for a provides package */
|
||||||
PMList *provides = whatprovides(db, depend.name);
|
PMList *provides = whatprovides(db, depend.name);
|
||||||
if(provides) {
|
if(provides) {
|
||||||
|
/* TODO: should check _all_ packages listed in provides, not just
|
||||||
|
* the first one.
|
||||||
|
*/
|
||||||
/* use the first one */
|
/* use the first one */
|
||||||
depinfo = db_scan(db, provides->data, INFRQ_ALL);
|
depinfo = db_scan(db, provides->data, INFRQ_ALL);
|
||||||
list_free(provides);
|
list_free(provides);
|
||||||
|
@ -1885,6 +1889,14 @@ int pacman_query(pacdb_t *db, PMList *targets)
|
||||||
printf("%s %s%s\n", info->name, pmo_root, (char*)q->data);
|
printf("%s %s%s\n", info->name, pmo_root, (char*)q->data);
|
||||||
}
|
}
|
||||||
freepkg(info);
|
freepkg(info);
|
||||||
|
} else if(pmo_q_orphans) {
|
||||||
|
info = db_scan(db, tmpp->name, INFRQ_DESC | INFRQ_DEPENDS);
|
||||||
|
if(info == NULL) {
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
if(info->requiredby == NULL) {
|
||||||
|
printf("%s %s\n", tmpp->name, tmpp->version);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("%s %s\n", tmpp->name, tmpp->version);
|
printf("%s %s\n", tmpp->name, tmpp->version);
|
||||||
}
|
}
|
||||||
|
@ -1908,6 +1920,15 @@ int pacman_query(pacdb_t *db, PMList *targets)
|
||||||
for(lp = info->files; lp; lp = lp->next) {
|
for(lp = info->files; lp; lp = lp->next) {
|
||||||
printf("%s %s%s\n", info->name, pmo_root, (char*)lp->data);
|
printf("%s %s%s\n", info->name, pmo_root, (char*)lp->data);
|
||||||
}
|
}
|
||||||
|
} else if(pmo_q_orphans) {
|
||||||
|
info = db_scan(db, package, INFRQ_DESC | INFRQ_DEPENDS);
|
||||||
|
if(info == NULL) {
|
||||||
|
fprintf(stderr, "Package \"%s\" was not found.\n", package);
|
||||||
|
return(2);
|
||||||
|
}
|
||||||
|
if(info->requiredby == NULL) {
|
||||||
|
printf("%s %s\n", info->name, info->version);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
info = db_scan(db, package, INFRQ_DESC);
|
info = db_scan(db, package, INFRQ_DESC);
|
||||||
if(info == NULL) {
|
if(info == NULL) {
|
||||||
|
@ -1953,7 +1974,7 @@ PMList* sortbydeps(PMList *targets)
|
||||||
int clean = 0;
|
int clean = 0;
|
||||||
|
|
||||||
/* count the number of targets */
|
/* count the number of targets */
|
||||||
for(i = targets; i; i = i->next, numtargs++);
|
numtargs = list_count(targets);
|
||||||
|
|
||||||
while(change) {
|
while(change) {
|
||||||
change = 0;
|
change = 0;
|
||||||
|
@ -2261,14 +2282,16 @@ PMList* checkdeps(pacdb_t *db, unsigned short op, PMList *targets)
|
||||||
/* PROVIDES -- check to see if another package already provides what
|
/* PROVIDES -- check to see if another package already provides what
|
||||||
* we offer
|
* we offer
|
||||||
*/
|
*/
|
||||||
|
/* XXX: disabled -- we allow multiple packages to provide the same thing.
|
||||||
|
* list packages in conflicts if they really do conflict.
|
||||||
for(j = tp->provides; j; j = j->next) {
|
for(j = tp->provides; j; j = j->next) {
|
||||||
PMList *provs = whatprovides(db, j->data);
|
PMList *provs = whatprovides(db, j->data);
|
||||||
for(k = provs; k; k = k->next) {
|
for(k = provs; k; k = k->next) {
|
||||||
if(!strcmp(tp->name, k->data)) {
|
if(!strcmp(tp->name, k->data)) {
|
||||||
/* this is the same package -- skip it */
|
// this is the same package -- skip it
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* we treat this just like a conflict */
|
// we treat this just like a conflict
|
||||||
MALLOC(miss, sizeof(depmissing_t));
|
MALLOC(miss, sizeof(depmissing_t));
|
||||||
miss->type = CONFLICT;
|
miss->type = CONFLICT;
|
||||||
miss->depend.mod = DEP_ANY;
|
miss->depend.mod = DEP_ANY;
|
||||||
|
@ -2279,7 +2302,7 @@ PMList* checkdeps(pacdb_t *db, unsigned short op, PMList *targets)
|
||||||
baddeps = list_add(baddeps, miss);
|
baddeps = list_add(baddeps, miss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* DEPENDENCIES -- look for unsatisfied dependencies */
|
/* DEPENDENCIES -- look for unsatisfied dependencies */
|
||||||
for(j = tp->depends; j; j = j->next) {
|
for(j = tp->depends; j; j = j->next) {
|
||||||
|
@ -2518,6 +2541,7 @@ int parseargs(int op, int argc, char **argv)
|
||||||
{"clean", no_argument, 0, 'c'},
|
{"clean", no_argument, 0, 'c'},
|
||||||
{"force", no_argument, 0, 'f'},
|
{"force", no_argument, 0, 'f'},
|
||||||
{"nodeps", no_argument, 0, 'd'},
|
{"nodeps", no_argument, 0, 'd'},
|
||||||
|
{"orphans", no_argument, 0, 'e'},
|
||||||
{"nosave", no_argument, 0, 'n'},
|
{"nosave", no_argument, 0, 'n'},
|
||||||
{"owns", no_argument, 0, 'o'},
|
{"owns", no_argument, 0, 'o'},
|
||||||
{"list", no_argument, 0, 'l'},
|
{"list", no_argument, 0, 'l'},
|
||||||
|
@ -2531,7 +2555,7 @@ int parseargs(int op, int argc, char **argv)
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
while((opt = getopt_long(argc, argv, "ARUFQSTDYr:b:vhscVfnoldpiuwyg", opts, &option_index))) {
|
while((opt = getopt_long(argc, argv, "ARUFQSTDYr:b:vhscVfnoldepiuwyg", opts, &option_index))) {
|
||||||
if(opt < 0) {
|
if(opt < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2548,25 +2572,26 @@ int parseargs(int op, int argc, char **argv)
|
||||||
case 'D': pmo_op = (pmo_op != PM_MAIN ? 0 : PM_DEPTEST); pmo_d_resolve = 1; break;
|
case 'D': pmo_op = (pmo_op != PM_MAIN ? 0 : PM_DEPTEST); pmo_d_resolve = 1; break;
|
||||||
case 'h': pmo_help = 1; break;
|
case 'h': pmo_help = 1; break;
|
||||||
case 'V': pmo_version = 1; break;
|
case 'V': pmo_version = 1; break;
|
||||||
case 'v': pmo_verbose = 1; break;
|
case 'b': strcpy(pmo_dbpath, optarg); break;
|
||||||
case 'f': pmo_force = 1; break;
|
|
||||||
case 'd': pmo_nodeps = 1; break;
|
|
||||||
case 'n': pmo_nosave = 1; break;
|
|
||||||
case 'l': pmo_q_list = 1; break;
|
|
||||||
case 'p': pmo_q_isfile = 1; break;
|
|
||||||
case 'i': pmo_q_info = 1; break;
|
|
||||||
case 'o': pmo_q_owns = 1; break;
|
|
||||||
case 'u': pmo_s_upgrade = 1; break;
|
|
||||||
case 'w': pmo_s_downloadonly = 1; break;
|
|
||||||
case 'y': pmo_s_sync = 1; break;
|
|
||||||
case 's': pmo_s_search = 1; break;
|
|
||||||
case 'c': pmo_s_clean = 1; pmo_r_cascade = 1; break;
|
case 'c': pmo_s_clean = 1; pmo_r_cascade = 1; break;
|
||||||
|
case 'd': pmo_nodeps = 1; break;
|
||||||
|
case 'e': pmo_q_orphans = 1; break;
|
||||||
|
case 'f': pmo_force = 1; break;
|
||||||
case 'g': pmo_group = 1; break;
|
case 'g': pmo_group = 1; break;
|
||||||
|
case 'i': pmo_q_info = 1; break;
|
||||||
|
case 'l': pmo_q_list = 1; break;
|
||||||
|
case 'n': pmo_nosave = 1; break;
|
||||||
|
case 'p': pmo_q_isfile = 1; break;
|
||||||
|
case 'o': pmo_q_owns = 1; break;
|
||||||
case 'r': if(realpath(optarg, pmo_root) == NULL) {
|
case 'r': if(realpath(optarg, pmo_root) == NULL) {
|
||||||
perror("bad root path");
|
perror("bad root path");
|
||||||
return(1);
|
return(1);
|
||||||
} break;
|
} break;
|
||||||
case 'b': strcpy(pmo_dbpath, optarg); break;
|
case 's': pmo_s_search = 1; break;
|
||||||
|
case 'u': pmo_s_upgrade = 1; break;
|
||||||
|
case 'v': pmo_verbose = 1; break;
|
||||||
|
case 'w': pmo_s_downloadonly = 1; break;
|
||||||
|
case 'y': pmo_s_sync = 1; break;
|
||||||
case '?': return(1);
|
case '?': return(1);
|
||||||
default: return(1);
|
default: return(1);
|
||||||
}
|
}
|
||||||
|
@ -2725,13 +2750,8 @@ int parseconfig(char *configfile)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
server->protocol = strdup(ptr);
|
server->protocol = strdup(ptr);
|
||||||
if(strcmp(server->protocol, "file")) {
|
if(!strcmp(server->protocol, "ftp") || !strcmp(server->protocol, "http")) {
|
||||||
char *slash;
|
char *slash;
|
||||||
/* no http support yet */
|
|
||||||
if(strcmp(ptr, "ftp")) {
|
|
||||||
fprintf(stderr, "config: line %d: protocol %s is not supported\n", linenum, ptr);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
/* split the url into domain and path */
|
/* split the url into domain and path */
|
||||||
slash = strchr(p, '/');
|
slash = strchr(p, '/');
|
||||||
if(slash == NULL) {
|
if(slash == NULL) {
|
||||||
|
@ -2748,7 +2768,7 @@ int parseconfig(char *configfile)
|
||||||
*slash = '\0';
|
*slash = '\0';
|
||||||
}
|
}
|
||||||
server->server = strdup(p);
|
server->server = strdup(p);
|
||||||
} else {
|
} else if(!strcmp(server->protocol, "file")){
|
||||||
/* add a trailing slash if we need to */
|
/* add a trailing slash if we need to */
|
||||||
if(p[strlen(p)-1] == '/') {
|
if(p[strlen(p)-1] == '/') {
|
||||||
server->path = strdup(p);
|
server->path = strdup(p);
|
||||||
|
@ -2756,9 +2776,12 @@ int parseconfig(char *configfile)
|
||||||
MALLOC(server->path, strlen(p)+2);
|
MALLOC(server->path, strlen(p)+2);
|
||||||
sprintf(server->path, "%s/", p);
|
sprintf(server->path, "%s/", p);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "config: line %d: protocol %s is not supported\n", linenum, ptr);
|
||||||
|
return(1);
|
||||||
}
|
}
|
||||||
/* add to the list */
|
/* add to the list */
|
||||||
vprint("config: %s: server: %s %s\n", section, server->server, server->path);
|
vprint("config: %s: server: %s %s %s\n", section, server->protocol, server->server, server->path);
|
||||||
sync->servers = list_add(sync->servers, server);
|
sync->servers = list_add(sync->servers, server);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "config: line %d: syntax error\n", linenum);
|
fprintf(stderr, "config: line %d: syntax error\n", linenum);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#define _PAC_PACMAN_H
|
#define _PAC_PACMAN_H
|
||||||
|
|
||||||
#ifndef PACVER
|
#ifndef PACVER
|
||||||
#define PACVER "2.6"
|
#define PACVER "2.6.1"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PKGDIR
|
#ifndef PKGDIR
|
||||||
|
|
|
@ -136,12 +136,25 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
} else {
|
} else {
|
||||||
vprint("FTP passive mode not set\n");
|
vprint("FTP passive mode not set\n");
|
||||||
}
|
}
|
||||||
|
} else if(!strcmp(server->protocol, "http")) {
|
||||||
|
if(!HttpConnect(server->server, &control)) {
|
||||||
|
fprintf(stderr, "error: cannot connect to %s\n", server->server);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set up our progress bar's callback */
|
||||||
|
if(strcmp(server->protocol, "file")) {
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get each file in the list */
|
/* get each file in the list */
|
||||||
for(lp = files; lp; lp = lp->next) {
|
for(lp = files; lp; lp = lp->next) {
|
||||||
char output[PATH_MAX];
|
char output[PATH_MAX];
|
||||||
int j;
|
int j, filedone = 0;
|
||||||
char *fn = (char*)lp->data;
|
char *fn = (char*)lp->data;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
@ -150,7 +163,7 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn);
|
snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn);
|
||||||
strncpy(sync_fnm, lp->data, 24);
|
strncpy(sync_fnm, fn, 24);
|
||||||
for(j = strlen(sync_fnm); j < 24; j++) {
|
for(j = strlen(sync_fnm); j < 24; j++) {
|
||||||
sync_fnm[j] = ' ';
|
sync_fnm[j] = ' ';
|
||||||
}
|
}
|
||||||
|
@ -170,35 +183,43 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
unlink(output);
|
unlink(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* set up our progress bar's callback */
|
if(!FtpGet(output, fn, FTPLIB_IMAGE, 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(!FtpGet(output, lp->data, FTPLIB_IMAGE, control)) {
|
|
||||||
fprintf(stderr, "\nfailed downloading %s from %s: %s\n",
|
fprintf(stderr, "\nfailed downloading %s from %s: %s\n",
|
||||||
fn, server->server, FtpLastResponse(control));
|
fn, server->server, FtpLastResponse(control));
|
||||||
/* we leave the partially downloaded file in place so it can be resumed later */
|
/* we leave the partially downloaded file in place so it can be resumed later */
|
||||||
} else {
|
} else {
|
||||||
char completefile[PATH_MAX];
|
filedone = 1;
|
||||||
log_progress(control, fsz-offset, &fsz);
|
}
|
||||||
complete = list_add(complete, fn);
|
} else if(!strcmp(server->protocol, "http")) {
|
||||||
/* rename "output.part" file to "output" file */
|
char src[PATH_MAX];
|
||||||
snprintf(completefile, PATH_MAX, "%s/%s", localpath, fn);
|
if(!stat(output, &st)) {
|
||||||
rename(output, completefile);
|
/* no resume support yet */
|
||||||
|
unlink(output);
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
fflush(stdout);
|
|
||||||
} else if(!strcmp(server->protocol, "file")) {
|
|
||||||
/* local repository, just copy the file */
|
|
||||||
char src[PATH_MAX], dest[PATH_MAX];
|
|
||||||
snprintf(src, PATH_MAX, "%s%s", server->path, fn);
|
snprintf(src, PATH_MAX, "%s%s", server->path, fn);
|
||||||
snprintf(dest, PATH_MAX, "%s/%s", localpath, fn);
|
if(!HttpGet(output, src, &fsz, control)) {
|
||||||
vprint("copying %s to %s\n", src, dest);
|
fprintf(stderr, "\nfailed downloading %s from %s: %s\n",
|
||||||
if(copyfile(src, dest)) {
|
fn, server->server, FtpLastResponse(control));
|
||||||
|
/* no resume support yet */
|
||||||
|
unlink(output);
|
||||||
|
} else {
|
||||||
|
filedone = 1;
|
||||||
|
}
|
||||||
|
} else if(!strcmp(server->protocol, "file")) {
|
||||||
|
char src[PATH_MAX];
|
||||||
|
snprintf(src, PATH_MAX, "%s%s", server->path, fn);
|
||||||
|
vprint("copying %s to %s/%s\n", src, localpath, fn);
|
||||||
|
/* local repository, just copy the file */
|
||||||
|
if(copyfile(src, output)) {
|
||||||
fprintf(stderr, "failed copying %s\n", src);
|
fprintf(stderr, "failed copying %s\n", src);
|
||||||
} else {
|
} else {
|
||||||
|
filedone = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(filedone) {
|
||||||
|
char completefile[PATH_MAX];
|
||||||
|
if(!strcmp(server->protocol, "file")) {
|
||||||
char out[56];
|
char out[56];
|
||||||
printf(" %s [", sync_fnm);
|
printf(" %s [", sync_fnm);
|
||||||
strncpy(out, server->path, 33);
|
strncpy(out, server->path, 33);
|
||||||
|
@ -207,11 +228,16 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
printf(" ");
|
printf(" ");
|
||||||
}
|
}
|
||||||
fputs("] 100% | LOCAL\n", stdout);
|
fputs("] 100% | LOCAL\n", stdout);
|
||||||
fflush(stdout);
|
} else {
|
||||||
|
log_progress(control, fsz-offset, &fsz);
|
||||||
|
}
|
||||||
complete = list_add(complete, fn);
|
complete = list_add(complete, fn);
|
||||||
|
/* rename "output.part" file to "output" file */
|
||||||
|
snprintf(completefile, PATH_MAX, "%s/%s", localpath, fn);
|
||||||
|
rename(output, completefile);
|
||||||
}
|
}
|
||||||
}
|
printf("\n");
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
if(list_count(complete) == list_count(files)) {
|
if(list_count(complete) == list_count(files)) {
|
||||||
done = 1;
|
done = 1;
|
||||||
|
@ -219,6 +245,8 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
|
|
||||||
if(!strcmp(server->protocol, "ftp")) {
|
if(!strcmp(server->protocol, "ftp")) {
|
||||||
FtpQuit(control);
|
FtpQuit(control);
|
||||||
|
} else if(!strcmp(server->protocol, "http")) {
|
||||||
|
HttpQuit(control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,12 +258,6 @@ static int log_progress(netbuf *ctl, int xfered, void *arg)
|
||||||
int fsz = *(int*)arg;
|
int fsz = *(int*)arg;
|
||||||
int pct = ((float)(xfered+offset) / fsz) * 100;
|
int pct = ((float)(xfered+offset) / fsz) * 100;
|
||||||
int i, cur;
|
int i, cur;
|
||||||
char *cenv = NULL;
|
|
||||||
|
|
||||||
cenv = getenv("COLUMNS");
|
|
||||||
if(cenv) {
|
|
||||||
maxcols = atoi(cenv);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf(" %s [", sync_fnm);
|
printf(" %s [", sync_fnm);
|
||||||
cur = (int)((maxcols-44)*pct/100);
|
cur = (int)((maxcols-44)*pct/100);
|
||||||
|
|
Loading…
Add table
Reference in a new issue