Imported from pacman-2.6.tar.gz
This commit is contained in:
parent
ffe1d50cff
commit
f8bfe729e4
27 changed files with 1602 additions and 548 deletions
27
ChangeLog
27
ChangeLog
|
@ -1,8 +1,27 @@
|
||||||
VERSION DESCRIPTION
|
VERSION DESCRIPTION
|
||||||
------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
2.5.1 - Added retries to the downloader to get around some
|
2.6 - Added group handling, so one can run 'pacman -S kde' and
|
||||||
transient network errors. (this will likely be an option
|
install all files from the KDE group
|
||||||
in pacman.conf for later versions)
|
- Fixed a duplication bug in cascade package removal
|
||||||
|
- Added support for virtual provisions with "provides" tags
|
||||||
|
- When conflicts are encountered, pacman now offers the chance
|
||||||
|
to remove the conflicting packages (provides or literals)
|
||||||
|
- Added support for renamed/combined packages with a "replaces"
|
||||||
|
tag
|
||||||
|
- Added --nostrip option to makepkg
|
||||||
|
- Improved --search to list all packages from all repos when
|
||||||
|
a search term is omitted
|
||||||
|
- Added logging support through syslog()
|
||||||
|
- Added fakeroot support to makepkg (RomanK)
|
||||||
|
- Added MD5sum generation/validation to makepkg (RomanK)
|
||||||
|
- Fixed a progress bar bug (Aurelien Foret)
|
||||||
|
- Sorted makepkg's .FILELISTs (Aurelien Foret)
|
||||||
|
- Targets are now re-ordered w.r.t. dependencies when
|
||||||
|
using -A/-U
|
||||||
|
- Modified --search to work when called as -Sys
|
||||||
|
- Modified abs to use ABS_ROOT from /etc/abs/abs.conf (Aurelien)
|
||||||
|
- Other bug fixes
|
||||||
|
2.5.1 - Minor bug fixes
|
||||||
2.5 - Added an URL tag to package info
|
2.5 - Added an URL tag to package info
|
||||||
- Sped up package load times by about 500% by introducing
|
- Sped up package load times by about 500% by introducing
|
||||||
a .FILELIST into the package
|
a .FILELIST into the package
|
||||||
|
|
|
@ -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.5.1
|
PACVER = 2.6
|
||||||
|
|
||||||
TOPDIR = @srcdir@
|
TOPDIR = @srcdir@
|
||||||
SRCDIR = $(TOPDIR)/src/
|
SRCDIR = $(TOPDIR)/src/
|
||||||
|
|
14
TODO
14
TODO
|
@ -1,29 +1,15 @@
|
||||||
- fix the broken pipe bug
|
- fix the broken pipe bug
|
||||||
- add some logging mechanism (/var/log/pacman.log)
|
|
||||||
- handle version comparators in makepkg dep resolution (eg, glibc>=2.2.5)
|
- handle version comparators in makepkg dep resolution (eg, glibc>=2.2.5)
|
||||||
- have "group" designations
|
|
||||||
- record md5sums of all files in a package
|
- record md5sums of all files in a package
|
||||||
- add a way to clean /var/cache/pacman/src
|
|
||||||
- duplicate dep checks occur with sync (one in sync, one in add)
|
|
||||||
- if a package is removed with --nodeps and re-installed, the requiredby
|
|
||||||
fields of it's required packages are not updated
|
|
||||||
- add an option equivalent to 'pacman -Ql pkg | grep filename'
|
|
||||||
- add other options to config file: db location, overwrite behaviour, etc.
|
|
||||||
- use the COLUMNS env var for the progress bar
|
|
||||||
? 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
|
||||||
- can't -- further dependent packages may fail b/c of the first failure
|
- can't -- further dependent packages may fail b/c of the first failure
|
||||||
? ask, then remove conflicting packages with --sync
|
|
||||||
? use a provides tag (instead of an OR operator in depends)
|
|
||||||
- add a 'cascade' option to --remove that will remove a package and
|
|
||||||
all requiredby packages under it
|
|
||||||
- check $PACCONF env var
|
- check $PACCONF env var
|
||||||
? use a 'trust pacman' config option for downgrading?
|
? use a 'trust pacman' config option for downgrading?
|
||||||
? build-time (source) dependencies in makepkg
|
? build-time (source) dependencies in makepkg
|
||||||
? run ldd on every executable in a newly built package to find required so's
|
? run ldd on every executable in a newly built package to find required so's
|
||||||
- add a --pretend option
|
- add a --pretend option
|
||||||
- add a consistency/sanity check operation (md5 tracking for all files)
|
- add a consistency/sanity check operation (md5 tracking for all files)
|
||||||
- add a --dbpath option
|
|
||||||
- use package caches more for performance
|
- use package caches more for performance
|
||||||
- clean up output a bit (message queue?)
|
- clean up output a bit (message queue?)
|
||||||
- use a files.cache db for --owns and db_find_conflicts
|
- use a files.cache db for --owns and db_find_conflicts
|
||||||
|
|
19
cnvpkg
19
cnvpkg
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
TMPDIR=/tmp/.pkgcnv
|
|
||||||
TMPFILE=/tmp/.pkgcnvf
|
|
||||||
tl=`pwd`
|
|
||||||
|
|
||||||
for fn in $*; do
|
|
||||||
rm -rf $TMPDIR;
|
|
||||||
mkdir -p $TMPDIR;
|
|
||||||
echo "Converting $fn"
|
|
||||||
cd $TMPDIR
|
|
||||||
tar zxvf $tl/$fn | grep -v '^.PKGINFO' | grep -v '._install' >$TMPFILE
|
|
||||||
mv $TMPFILE ./.FILELIST
|
|
||||||
if [ -f ._install ]; then
|
|
||||||
tar cfz /new/$fn .PKGINFO .FILELIST ._install *
|
|
||||||
else
|
|
||||||
tar cfz /new/$fn .PKGINFO .FILELIST *
|
|
||||||
fi
|
|
||||||
done
|
|
|
@ -8,7 +8,7 @@ makepkg \- package build utility
|
||||||
a build-capable linux platform, wget, and some build scripts. The advantage
|
a build-capable linux platform, wget, and some build scripts. The advantage
|
||||||
to a script-based build is that you only really do the work once. Once you
|
to a script-based build is that you only really do the work once. Once you
|
||||||
have the build script for a package, you just need to run makepkg and it
|
have the build script for a package, you just need to run makepkg and it
|
||||||
will do the rest: download source files, check dependencies,
|
will do the rest: download and validate source files, check dependencies,
|
||||||
configure the buildtime settings, build the package, install the package
|
configure the buildtime settings, build the package, install the package
|
||||||
into a temporary root, make customizations, generate meta-info, and package
|
into a temporary root, make customizations, generate meta-info, and package
|
||||||
the whole thing up for \fBpacman\fP to use.
|
the whole thing up for \fBpacman\fP to use.
|
||||||
|
@ -31,20 +31,23 @@ the \fBabs\fP script included with pacman/makepkg.
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
pkgname=modutils
|
pkgname=modutils
|
||||||
pkgver=2.4.13
|
pkgver=2.4.25
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Utilities for inserting and removing modules from the linux kernel"
|
pkgdesc="Utilities for inserting and removing modules from the linux kernel"
|
||||||
url="http://www.kernel.org"
|
url="http://www.kernel.org"
|
||||||
backup=(etc/modules.conf)
|
backup=(etc/modules.conf)
|
||||||
depends=('glibc>=2.2.5' 'bash' 'zlib')
|
depends=('mawk' 'bash' 'glibc' 'zlib')
|
||||||
source=(ftp://ftp.server.com/$pkgname-$pkgver.tar.gz modules.conf)
|
source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/$pkgname/v2.4/$pkgname-$pkgver.tar.bz2 \\
|
||||||
|
modules.conf)
|
||||||
|
md5sums=('2c0cca3ef6330a187c6ef4fe41ecaa4d' \\
|
||||||
|
'35175bee593a7cc7d6205584a94d8625')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd $startdir/src/$pkgname-$pkgver
|
cd $startdir/src/$pkgname-$pkgver
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr --enable-insmod-static
|
||||||
make || return 1
|
make || return 1
|
||||||
make prefix=$startdir/pkg/usr install
|
make prefix=$startdir/pkg/usr install
|
||||||
# copy our custom modules.conf into the package root
|
mv $startdir/pkg/usr/sbin $startdir/pkg
|
||||||
mkdir -p $startdir/pkg/etc
|
mkdir -p $startdir/pkg/etc
|
||||||
cp ../modules.conf $startdir/pkg/etc
|
cp ../modules.conf $startdir/pkg/etc
|
||||||
}
|
}
|
||||||
|
@ -61,10 +64,14 @@ The line with \fIbackup=\fP specifies files that should be treated specially
|
||||||
when removing or upgrading packages. See \fBHANDLING CONFIG FILES\fP in
|
when removing or upgrading packages. See \fBHANDLING CONFIG FILES\fP in
|
||||||
the \fIpacman\fP manpage for more information on this.
|
the \fIpacman\fP manpage for more information on this.
|
||||||
|
|
||||||
The sixth line lists the dependencies for this package. In order to build/run
|
The seventh line lists the dependencies for this package. In order to build/run
|
||||||
the package, all dependencies must be satisifed first. makepkg will check this
|
the package, all dependencies must be satisifed first. makepkg will check this
|
||||||
before attempting to build the package.
|
before attempting to build the package.
|
||||||
|
|
||||||
|
The \fIsource\fP array tells makepkg which files to download/extract before compiling
|
||||||
|
begins. The \fImd5sums\fP array provides md5sums for each of these files. These
|
||||||
|
are used to validate the integrity of the source files.
|
||||||
|
|
||||||
Once your PKGBUILD is created, you can run \fImakepkg\fP from the build directory.
|
Once your PKGBUILD is created, you can run \fImakepkg\fP from the build directory.
|
||||||
makepkg will then check dependencies and look for the source files required to
|
makepkg will then check dependencies and look for the source files required to
|
||||||
build. If some are missing it will attempt to download them, provided there is
|
build. If some are missing it will attempt to download them, provided there is
|
||||||
|
@ -193,7 +200,28 @@ This field contains an optional URL that is associated with the piece of softwar
|
||||||
being packaged. This is typically the project's website.
|
being packaged. This is typically the project's website.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B backup
|
.B install
|
||||||
|
Specifies a special install script that is to be included in the package.
|
||||||
|
This file should reside in the same directory as the PKGBUILD, and will be
|
||||||
|
copied into the package by makepkg. It does not need to be included in the
|
||||||
|
\fIsource\fP array. (eg, install=modutils.install)
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B source \fI(array)\fP
|
||||||
|
The \fIsource\fP line is an array of source files required to build the
|
||||||
|
package. Source files must reside in the same directory as the PKGBUILD
|
||||||
|
file, unless they have a fully-qualified URL. Then if the source file
|
||||||
|
does not already exist in /var/cache/pacman/src, the file is downloaded
|
||||||
|
by wget.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B groups \fI(array)\fP
|
||||||
|
This is an array of symbolic names that represent groups of packages, allowing
|
||||||
|
you to install multiple packages by requesting a single target. For example,
|
||||||
|
one could install all KDE packages by installing the 'kde' group.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B backup \fI(array)\fP
|
||||||
A space-delimited array of filenames (without a preceding slash). The
|
A space-delimited array of filenames (without a preceding slash). The
|
||||||
\fIbackup\fP line will be propagated to the package meta-info file for
|
\fIbackup\fP line will be propagated to the package meta-info file for
|
||||||
pacman. This will designate all files listed there to be backed up if this
|
pacman. This will designate all files listed there to be backed up if this
|
||||||
|
@ -201,14 +229,7 @@ package is ever removed from a system. See \fBHANDLING CONFIG FILES\fP in
|
||||||
the \fIpacman\fP manpage for more information.
|
the \fIpacman\fP manpage for more information.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B install
|
.B depends \fI(array)\fP
|
||||||
Specified a special install script that is to be included in the package.
|
|
||||||
This file should reside in the same directory as the PKGBUILD, and will be
|
|
||||||
copied into the package by makepkg. It does not need to be included in the
|
|
||||||
\fIsource\fP array. (eg, install=modutils.install)
|
|
||||||
|
|
||||||
.TP
|
|
||||||
.B depends
|
|
||||||
An array of packages that this package depends on to build and run. Packages
|
An array of packages that this package depends on to build and run. Packages
|
||||||
in this list should be surrounded with single quotes and contain at least the
|
in this list should be surrounded with single quotes and contain at least the
|
||||||
package name. They can also include a version requirement of the form
|
package name. They can also include a version requirement of the form
|
||||||
|
@ -217,18 +238,24 @@ package name. They can also include a version requirement of the form
|
||||||
See the PKGBUILD example above for an example of the \fIdepends\fP directive.
|
See the PKGBUILD example above for an example of the \fIdepends\fP directive.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B conflicts
|
.B conflicts \fI(array)\fP
|
||||||
An array of packages that will conflict with this package (ie, they cannot both
|
An array of packages that will conflict with this package (ie, they cannot both
|
||||||
be installed at the same time). This directive follows the same format as
|
be installed at the same time). This directive follows the same format as
|
||||||
\fIdepends\fP except you cannot specify versions here, only package names.
|
\fIdepends\fP except you cannot specify versions here, only package names.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B source
|
.B provides \fI(array)\fP
|
||||||
The \fIsource\fP line is an array of source files required to build the
|
An array of "virtual provisions" that this package provides. This allows a package
|
||||||
package. Source files must reside in the same directory as the PKGBUILD
|
to provide dependency names other than it's own package name. For example, the
|
||||||
file, unless they have a fully-qualified URL. Then if the source file
|
kernel-scsi and kernel-ide packages can each provide 'kernel' which allows packages
|
||||||
does not already exist in /var/cache/pacman/src, the file is downloaded
|
to simply depend on 'kernel' rather than "kernel-scsi OR kernel-ide OR ..."
|
||||||
by wget.
|
|
||||||
|
.TP
|
||||||
|
.B replaces \fI(array)\fP
|
||||||
|
This is an array of packages that this package should replace, and can be used to handle
|
||||||
|
renamed/combined packages. For example, if the kernel package gets renamed
|
||||||
|
to kernel-ide, then subsequent 'pacman -Syu' calls will not pick up the upgrade, due
|
||||||
|
to the differing package names. \fIreplaces\fP handles this.
|
||||||
|
|
||||||
.SH MAKEPKG OPTIONS
|
.SH MAKEPKG OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
@ -255,9 +282,20 @@ process if all of the dependencies aren't installed.
|
||||||
file already exists in the build directory. You can override this behaviour with
|
file already exists in the build directory. You can override this behaviour with
|
||||||
the \fB--force\fP switch.
|
the \fB--force\fP switch.
|
||||||
.TP
|
.TP
|
||||||
|
.B "\-g, \-\-genmd5"
|
||||||
|
Download all source files (if required) and use \fImd5sum\fP to generate md5 hashes
|
||||||
|
for each of them. You can then redirect the output into your PKGBUILD for source
|
||||||
|
validation (makepkg -g >>PKGBUILD).
|
||||||
|
.TP
|
||||||
|
.B "\-h, \-\-help"
|
||||||
|
Output syntax and commandline options.
|
||||||
|
.TP
|
||||||
.B "\-i, \-\-install"
|
.B "\-i, \-\-install"
|
||||||
Install/Upgrade the package after a successful build.
|
Install/Upgrade the package after a successful build.
|
||||||
.TP
|
.TP
|
||||||
|
.B "\-n, \-\-nostrip"
|
||||||
|
Do not strip binaries and libraries.
|
||||||
|
.TP
|
||||||
.B "\-p <buildscript>"
|
.B "\-p <buildscript>"
|
||||||
Read the package script \fI<buildscript>\fP instead of the default (\fIPKGBUILD\fP).
|
Read the package script \fI<buildscript>\fP instead of the default (\fIPKGBUILD\fP).
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -96,6 +96,10 @@ Remove packages from the cache. When pacman downloads packages,
|
||||||
it saves them in \fI/var/cache/pacman/pkg\fP. If you need to free up
|
it saves them in \fI/var/cache/pacman/pkg\fP. If you need to free up
|
||||||
diskspace, you can remove these packages by using the --clean option.
|
diskspace, you can remove these packages by using the --clean option.
|
||||||
.TP
|
.TP
|
||||||
|
.B "\-g, \-\-groups"
|
||||||
|
Display all the members for each package group specified. If no group
|
||||||
|
names are provided, all groups and members will be listed.
|
||||||
|
.TP
|
||||||
.B "\-s, \-\-search <string>"
|
.B "\-s, \-\-search <string>"
|
||||||
This will search each package in the package list for names or descriptions
|
This will search each package in the package list for names or descriptions
|
||||||
that contains <string>.
|
that contains <string>.
|
||||||
|
@ -117,6 +121,10 @@ defined in \fI/etc/pacman.conf\fP. This should typically be used each
|
||||||
time you use \fB--sysupgrade\fP.
|
time you use \fB--sysupgrade\fP.
|
||||||
.SH QUERY OPTIONS
|
.SH QUERY OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
.B "\-g, \-\-groups"
|
||||||
|
Display all groups that a specified package is part of. If no package
|
||||||
|
names are provided, all groups and members will be listed.
|
||||||
|
.TP
|
||||||
.B "\-i, \-\-info"
|
.B "\-i, \-\-info"
|
||||||
Display information on a given package. If it is used with the \fB-p\fP
|
Display information on a given package. If it is used with the \fB-p\fP
|
||||||
option then the .PKGINFO file will be printed.
|
option then the .PKGINFO file will be printed.
|
||||||
|
@ -179,15 +187,15 @@ Server = ftp://ftp.archlinux.org/current
|
||||||
Server = ftp://ftp.mirror.com/archlinux/current
|
Server = ftp://ftp.mirror.com/archlinux/current
|
||||||
|
|
||||||
[custom]
|
[custom]
|
||||||
Server = local:///home/pkgs
|
Server = file:///home/pkgs
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.SH CONFIG: OPTIONS
|
.SH CONFIG: OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B "DBPath = /path/to/db/dir"
|
.B "DBPath = path/to/db/dir"
|
||||||
Overrides the default location of the toplevel database directory. The default is
|
Overrides the default location of the toplevel database directory. The default is
|
||||||
\fI/var/lib/pacman\fP.
|
\fIvar/lib/pacman\fP.
|
||||||
.TP
|
.TP
|
||||||
.B "IgnorePkg = <package> [package] ..."
|
.B "IgnorePkg = <package> [package] ..."
|
||||||
Instructs pacman to ignore any upgrades for this package when performing a
|
Instructs pacman to ignore any upgrades for this package when performing a
|
||||||
|
@ -199,13 +207,17 @@ Disables passive ftp connections when downloading packages. (aka Active Mode)
|
||||||
.B "NoUpgrade = <file> [file] ..."
|
.B "NoUpgrade = <file> [file] ..."
|
||||||
All files listed with a \fBNoUpgrade\fP directive will never be touched during a package
|
All files listed with a \fBNoUpgrade\fP directive will never be touched during a package
|
||||||
install/upgrade. \fINote:\fP do not include the leading slash when specifying files.
|
install/upgrade. \fINote:\fP do not include the leading slash when specifying files.
|
||||||
|
.TP
|
||||||
|
.B "UseSyslog"
|
||||||
|
Log action messages through syslog(). This will insert pacman log entries into your
|
||||||
|
/var/log/messages or equivalent.
|
||||||
|
|
||||||
.SH CONFIG: REPOSITORIES
|
.SH CONFIG: REPOSITORIES
|
||||||
Each repository section defines a section name and at least one location where the packages
|
Each repository section defines a section name and at least one location where the packages
|
||||||
can be found. The section name is defined by the string within square brackets (eg, the two
|
can be found. The section name is defined by the string within square brackets (eg, the two
|
||||||
above are 'current' and 'custom'). Locations are defined with the \fIServer\fP directive and
|
above are 'current' and 'custom'). Locations are defined with the \fIServer\fP directive and
|
||||||
follow a URL naming structure. Currently only ftp is supported for remote servers. If you
|
follow a URL naming structure. Currently only ftp is supported for remote servers. If you
|
||||||
want to use a local directory, you can specify the full path with a 'local://' prefix, as
|
want to use a local directory, you can specify the full path with a 'file://' prefix, as
|
||||||
shown above.
|
shown above.
|
||||||
.SH USING YOUR OWN REPOSITORY
|
.SH USING YOUR OWN REPOSITORY
|
||||||
Let's say you have a bunch of custom packages in \fI/home/pkgs\fP and their respective PKGBUILD
|
Let's say you have a bunch of custom packages in \fI/home/pkgs\fP and their respective PKGBUILD
|
||||||
|
|
|
@ -10,21 +10,23 @@ export FTPAGENT="/usr/bin/wget --continue --passive-ftp --tries=3 --waitretry=3"
|
||||||
#export FTPAGENT="/usr/bin/snarf"
|
#export FTPAGENT="/usr/bin/snarf"
|
||||||
#export FTPAGENT="/usr/bin/lftpget -c"
|
#export FTPAGENT="/usr/bin/lftpget -c"
|
||||||
|
|
||||||
|
# Pentium Pro/Pentium II/Pentium III+/Pentium 4/Athlon exclusive (binaries
|
||||||
|
# will use the P6 instruction set and only run on P6+ systems)
|
||||||
|
export CHOST="i686-pc-linux-gnu"
|
||||||
|
export CFLAGS="-march=i686 -O2 -pipe"
|
||||||
|
export CXXFLAGS="-march=i686 -O2 -pipe"
|
||||||
# Pentium Pro/Pentium II/Pentium III+/Pentium 4/Athlon optimized (but binaries
|
# Pentium Pro/Pentium II/Pentium III+/Pentium 4/Athlon optimized (but binaries
|
||||||
# will run on any x86 system)
|
# will run on any x86 system)
|
||||||
#export CHOST="i686-pc-linux-gnu"
|
#export CHOST="i686-pc-linux-gnu"
|
||||||
#export CFLAGS="-mcpu=i686 -O2 -pipe"
|
#export CFLAGS="-mcpu=i686 -O2 -pipe"
|
||||||
#export CXXFLAGS="-mcpu=i686 -O2 -pipe"
|
#export CXXFLAGS="-mcpu=i686 -O2 -pipe"
|
||||||
|
|
||||||
# Pentium Pro/Pentium II/Pentium III+/Pentium 4/Athlon exclusive (binaries
|
|
||||||
# will use the P6 instruction set and only run on P6+ systems)
|
|
||||||
export CHOST="i686-pc-linux-gnu"
|
|
||||||
export CFLAGS="-march=i686 -O2 -pipe"
|
|
||||||
export CXXFLAGS="-march=i686 -O2 -pipe"
|
|
||||||
|
|
||||||
# SMP Systems
|
# SMP Systems
|
||||||
#export MAKEFLAGS="-j 2"
|
#export MAKEFLAGS="-j 2"
|
||||||
|
|
||||||
|
# Enable fakeroot for building packages as a non-root user
|
||||||
|
export USE_FAKEROOT="y"
|
||||||
|
|
||||||
# if you want your name to show up in the packages you build, set this.
|
# if you want your name to show up in the packages you build, set this.
|
||||||
#export PACKAGER="John Doe <john@doe.com>"
|
#export PACKAGER="John Doe <john@doe.com>"
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,11 @@
|
||||||
# GENERAL OPTIONS
|
# GENERAL OPTIONS
|
||||||
#
|
#
|
||||||
[options]
|
[options]
|
||||||
|
UseSyslog
|
||||||
NoUpgrade = etc/passwd etc/group etc/shadow
|
NoUpgrade = etc/passwd etc/group etc/shadow
|
||||||
NoUpgrade = etc/fstab etc/rc.conf etc/rc.local
|
NoUpgrade = etc/fstab etc/raidtab
|
||||||
NoUpgrade = etc/lilo.conf etc/raidtab
|
NoUpgrade = etc/rc.conf etc/rc.local
|
||||||
|
NoUpgrade = etc/lilo.conf boot/grub/menu.lst
|
||||||
#IgnorePkg = lilo gcc
|
#IgnorePkg = lilo gcc
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -28,6 +30,20 @@ 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
|
||||||
|
|
||||||
|
# The "unofficial" package set
|
||||||
|
#
|
||||||
|
[unofficial]
|
||||||
|
Server = ftp://ftp.archlinux.org/unofficial
|
||||||
|
Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/unofficial
|
||||||
|
Server = ftp://ftp.webtrek.com/pub/mirrors/archlinux/unofficial
|
||||||
|
Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/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.parrswood.net/Mirrors/ftp.archlinux.org/unofficial
|
||||||
|
Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/unofficial
|
||||||
|
Server = ftp://saule.mintis.lt/pub/linux/unofficial
|
||||||
|
Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/unofficial
|
||||||
|
|
||||||
# If you use the 'stable' tree, you should disable the 'current'
|
# If you use the 'stable' tree, you should disable the 'current'
|
||||||
# tree to avoid conflicts
|
# tree to avoid conflicts
|
||||||
#
|
#
|
||||||
|
@ -43,26 +59,12 @@ Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/current
|
||||||
#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
|
||||||
|
|
||||||
# Uncomment this block to access the 'unofficial' package set
|
|
||||||
#
|
|
||||||
#[unofficial]
|
|
||||||
#Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/unofficial
|
|
||||||
#Server = ftp://ftp.webtrek.com/pub/mirrors/archlinux/unofficial
|
|
||||||
#Server = ftp://ftp.archlinux.org/unofficial
|
|
||||||
#Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/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.parrswood.net/Mirrors/ftp.archlinux.org/unofficial
|
|
||||||
#Server = ftp://gd.tuwien.ac.at/opsys/linux/archlinux/unofficial
|
|
||||||
#Server = ftp://saule.mintis.lt/pub/linux/unofficial
|
|
||||||
#Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/unofficial
|
|
||||||
|
|
||||||
# Uncomment this block to access the 'unstable' package set
|
# Uncomment this block to access the 'unstable' package set
|
||||||
#
|
#
|
||||||
#[unstable]
|
#[unstable]
|
||||||
|
#Server = ftp://ftp.archlinux.org/unstable
|
||||||
#Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/unstable
|
#Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/unstable
|
||||||
#Server = ftp://ftp.webtrek.com/pub/mirrors/archlinux/unstable
|
#Server = ftp://ftp.webtrek.com/pub/mirrors/archlinux/unstable
|
||||||
#Server = ftp://ftp.archlinux.org/unstable
|
|
||||||
#Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/pub/Linux/distributions/archlinux/unstable
|
#Server = ftp://ftp.mpi-sb.mpg.de/pub/linux/mirror/ftp.ibiblio.org/pub/Linux/distributions/archlinux/unstable
|
||||||
#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
|
||||||
|
@ -74,5 +76,5 @@ Server = ftp://ftp.rez-gif.supelec.fr/pub/Linux/distrib/archlinux/current
|
||||||
# An example of a custom package repository. See the pacman manpage for
|
# An example of a custom package repository. See the pacman manpage for
|
||||||
# tips on creating your own repositories.
|
# tips on creating your own repositories.
|
||||||
#[custom]
|
#[custom]
|
||||||
#Server = local:///home/custompkgs
|
#Server = file:///home/custompkgs
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,26 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# gensync
|
||||||
|
#
|
||||||
|
# Copyright (c) 2002-2003 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA.
|
||||||
|
#
|
||||||
|
|
||||||
myver='2.5.1'
|
myver='2.6'
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "gensync $myver"
|
echo "gensync $myver"
|
||||||
|
@ -24,14 +44,15 @@ usage() {
|
||||||
|
|
||||||
db_write_entry()
|
db_write_entry()
|
||||||
{
|
{
|
||||||
unset pkgname pkgver pkgrel
|
unset pkgname pkgver pkgrel pkgdesc
|
||||||
unset depends conflicts
|
unset groups replaces provides depends conflicts
|
||||||
source $1 || return 1
|
source $1 || return 1
|
||||||
cd /tmp/.gensync
|
cd /tmp/.gensync
|
||||||
mkdir $pkgname-$pkgver-$pkgrel
|
mkdir $pkgname-$pkgver-$pkgrel
|
||||||
cd $pkgname-$pkgver-$pkgrel
|
cd $pkgname-$pkgver-$pkgrel
|
||||||
# desc
|
# desc
|
||||||
echo "%NAME%" >desc
|
: >desc
|
||||||
|
echo "%NAME%" >>desc
|
||||||
echo "$pkgname" >>desc
|
echo "$pkgname" >>desc
|
||||||
echo "" >>desc
|
echo "" >>desc
|
||||||
echo "%VERSION%" >>desc
|
echo "%VERSION%" >>desc
|
||||||
|
@ -40,17 +61,43 @@ db_write_entry()
|
||||||
echo "%DESC%" >>desc
|
echo "%DESC%" >>desc
|
||||||
echo "$pkgdesc" >>desc
|
echo "$pkgdesc" >>desc
|
||||||
echo "" >>desc
|
echo "" >>desc
|
||||||
|
if [ ${#groups[*]} -gt 0 ]; then
|
||||||
|
echo "%GROUPS%" >>desc
|
||||||
|
for it in "${groups[@]}"; do
|
||||||
|
echo "$it" >>desc
|
||||||
|
done
|
||||||
|
echo "" >>desc
|
||||||
|
fi
|
||||||
|
if [ ${#replaces[*]} -gt 0 ]; then
|
||||||
|
echo "%REPLACES%" >>desc
|
||||||
|
for it in "${replaces[@]}"; do
|
||||||
|
echo "$it" >>desc
|
||||||
|
done
|
||||||
|
echo "" >>desc
|
||||||
|
fi
|
||||||
# depends
|
# depends
|
||||||
echo "%DEPENDS%" >depends
|
: >depends
|
||||||
for depend in "${depends[@]}"; do
|
if [ ${#depends[*]} -gt 0 ]; then
|
||||||
echo "$depend" >>depends
|
echo "%DEPENDS%" >>depends
|
||||||
|
for it in "${depends[@]}"; do
|
||||||
|
echo "$it" >>depends
|
||||||
done
|
done
|
||||||
echo "" >>depends
|
echo "" >>depends
|
||||||
|
fi
|
||||||
|
if [ ${#conflicts[*]} -gt 0 ]; then
|
||||||
echo "%CONFLICTS%" >>depends
|
echo "%CONFLICTS%" >>depends
|
||||||
for conflict in "${conflicts[@]}"; do
|
for it in "${conflicts[@]}"; do
|
||||||
echo "$conflict" >>depends
|
echo "$it" >>depends
|
||||||
done
|
done
|
||||||
echo "" >>depends
|
echo "" >>depends
|
||||||
|
fi
|
||||||
|
if [ ${#provides[*]} -gt 0 ]; then
|
||||||
|
echo "%PROVIDES%" >>depends
|
||||||
|
for it in "${provides[@]}"; do
|
||||||
|
echo "$it" >>depends
|
||||||
|
done
|
||||||
|
echo "" >>depends
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
|
|
232
scripts/makepkg
232
scripts/makepkg
|
@ -1,17 +1,68 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# makepkg
|
||||||
|
#
|
||||||
|
# Copyright (c) 2002-2003 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA.
|
||||||
|
#
|
||||||
|
|
||||||
myver='2.5.1'
|
myver='2.6'
|
||||||
startdir=`pwd`
|
startdir=`pwd`
|
||||||
|
|
||||||
|
msg() {
|
||||||
|
echo "$1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
[ -f /etc/makepkg.conf ] && source /etc/makepkg.conf
|
[ -f /etc/makepkg.conf ] && source /etc/makepkg.conf
|
||||||
|
|
||||||
|
INFAKEROOT=
|
||||||
|
if [ "$1" = "-F" ]; then
|
||||||
|
INFAKEROOT=1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
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 $@
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
strip_url() {
|
strip_url() {
|
||||||
echo $1 | sed 's|^.*://.*/||g'
|
echo $1 | sed 's|^.*://.*/||g'
|
||||||
}
|
}
|
||||||
|
|
||||||
msg() {
|
|
||||||
echo $* >&2
|
|
||||||
}
|
|
||||||
|
|
||||||
checkdeps() {
|
checkdeps() {
|
||||||
local missdep=`pacman -T $*`
|
local missdep=`pacman -T $*`
|
||||||
|
@ -50,31 +101,34 @@ usage() {
|
||||||
echo "makepkg version $myver"
|
echo "makepkg version $myver"
|
||||||
echo "usage: $0 [options]"
|
echo "usage: $0 [options]"
|
||||||
echo "options:"
|
echo "options:"
|
||||||
|
echo " -b, --builddeps Build missing dependencies from source"
|
||||||
echo " -c, --clean Clean up work files after build"
|
echo " -c, --clean Clean up work files after build"
|
||||||
echo " -C, --cleancache Clean up source files from the cache"
|
echo " -C, --cleancache Clean up source files from the cache"
|
||||||
echo " -s, --syncdeps Install missing dependencies with pacman"
|
|
||||||
echo " -b, --builddeps Build missing dependencies from source"
|
|
||||||
echo " -d, --nodeps Skip all dependency checks"
|
echo " -d, --nodeps Skip all dependency checks"
|
||||||
echo " -i, --install Install package after successful build"
|
|
||||||
echo " -f, --force Overwrite existing package"
|
echo " -f, --force Overwrite existing package"
|
||||||
echo " -w <destdir> Write package to <destdir> instead of the working dir"
|
echo " -g, --genmd5 Generate MD5sums for source files"
|
||||||
echo " -p <buildscript> Use an alternate build script (instead of PKGBUILD)"
|
|
||||||
echo " -h, --help This help"
|
echo " -h, --help This help"
|
||||||
|
echo " -i, --install Install package after successful build"
|
||||||
|
echo " -n, --nostrip Do not strip binaries/libraries"
|
||||||
|
echo " -p <buildscript> Use an alternate build script (instead of PKGBUILD)"
|
||||||
|
echo " -s, --syncdeps Install missing dependencies with pacman"
|
||||||
|
echo " -w <destdir> Write package to <destdir> instead of the working dir"
|
||||||
echo
|
echo
|
||||||
echo " if -p is not specified, makepkg will look for a PKGBUILD"
|
echo " if -p is not specified, makepkg will look for a PKGBUILD"
|
||||||
echo " file in the current directory."
|
echo " file in the current directory."
|
||||||
echo
|
echo
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
CLEANUP=0
|
CLEANUP=0
|
||||||
CLEANCACHE=0
|
CLEANCACHE=0
|
||||||
INSTALL=0
|
INSTALL=0
|
||||||
|
GENMD5=0
|
||||||
DEP_BIN=0
|
DEP_BIN=0
|
||||||
DEP_SRC=0
|
DEP_SRC=0
|
||||||
NODEPS=0
|
NODEPS=0
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
NOSTRIP=0
|
||||||
PKGDEST=$startdir
|
PKGDEST=$startdir
|
||||||
BUILDSCRIPT="./PKGBUILD"
|
BUILDSCRIPT="./PKGBUILD"
|
||||||
|
|
||||||
|
@ -87,12 +141,18 @@ while [ "$#" -ne "0" ]; do
|
||||||
--nodeps) NODEPS=1 ;;
|
--nodeps) NODEPS=1 ;;
|
||||||
--install) INSTALL=1 ;;
|
--install) INSTALL=1 ;;
|
||||||
--force) FORCE=1 ;;
|
--force) FORCE=1 ;;
|
||||||
|
--nostrip) NOSTRIP=1 ;;
|
||||||
|
--genmd5) GENMD5=1 ;;
|
||||||
|
--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
while getopts "cCsbdifp:w:-" opt; do
|
while getopts "cCsbdhifgnp:w:-" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
c) CLEANUP=1 ;;
|
c) CLEANUP=1 ;;
|
||||||
C) CLEANCACHE=1 ;;
|
C) CLEANCACHE=1 ;;
|
||||||
|
@ -100,9 +160,15 @@ while [ "$#" -ne "0" ]; do
|
||||||
b) DEP_SRC=1 ;;
|
b) DEP_SRC=1 ;;
|
||||||
d) NODEPS=1 ;;
|
d) NODEPS=1 ;;
|
||||||
i) INSTALL=1 ;;
|
i) INSTALL=1 ;;
|
||||||
|
g) GENMD5=1 ;;
|
||||||
f) FORCE=1 ;;
|
f) FORCE=1 ;;
|
||||||
|
n) NOSTRIP=1 ;;
|
||||||
w) PKGDEST=$OPTARG ;;
|
w) PKGDEST=$OPTARG ;;
|
||||||
p) BUILDSCRIPT=$OPTARG ;;
|
p) BUILDSCRIPT=$OPTARG ;;
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
-)
|
-)
|
||||||
OPTIND=0
|
OPTIND=0
|
||||||
break
|
break
|
||||||
|
@ -122,13 +188,18 @@ while [ "$#" -ne "0" ]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$CLEANCACHE" = "1" ]; then
|
if [ "$CLEANCACHE" = "1" ]; then
|
||||||
msg "==> Cleaning up source files from the cache"
|
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
||||||
|
msg "==> Cleaning up source files from the cache."
|
||||||
rm -rf /var/cache/pacman/src/*
|
rm -rf /var/cache/pacman/src/*
|
||||||
exit 0
|
exit 0
|
||||||
|
else
|
||||||
|
msg "==> You must be root to clean the cache."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset pkgname pkgver pkgrel pkgdesc url
|
unset pkgname pkgver pkgrel pkgdesc url groups provides md5sums
|
||||||
unset depends conflicts backup source install build
|
unset replaces depends conflicts backup source install build
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
if [ ! -f $BUILDSCRIPT ]; then
|
if [ ! -f $BUILDSCRIPT ]; then
|
||||||
|
@ -148,11 +219,13 @@ if [ `echo $pkgrel | grep '-'` ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz -a "$FORCE" = "0" ]; then
|
if [ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}.pkg.tar.gz -a "$FORCE" = "0" -a "$GENMD5" = "0" ]; then
|
||||||
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
|
||||||
|
|
||||||
|
msg "==> Making package: $pkgname (`date`)"
|
||||||
|
|
||||||
unset deplist
|
unset deplist
|
||||||
if [ `type -p pacman` -a "$NODEPS" = "0" ]; then
|
if [ `type -p pacman` -a "$NODEPS" = "0" ]; then
|
||||||
msg "==> Checking Dependencies..."
|
msg "==> Checking Dependencies..."
|
||||||
|
@ -210,21 +283,19 @@ else
|
||||||
msg "==> WARNING: pacman was not found in PATH. skipping dependency checks."
|
msg "==> WARNING: pacman was not found in PATH. skipping dependency checks."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
d=`date`
|
|
||||||
cd $startdir
|
cd $startdir
|
||||||
msg "==> Making package $pkgname ($d)"
|
|
||||||
|
|
||||||
# extract source
|
# extract source
|
||||||
msg "==> Acquiring/Extracting Sources..."
|
msg "==> Retrieving Sources..."
|
||||||
mkdir -p src
|
mkdir -p src
|
||||||
cd $startdir/src
|
cd $startdir/src
|
||||||
for netfile in ${source[@]}; do
|
for netfile in ${source[@]}; do
|
||||||
file=`strip_url $netfile`
|
file=`strip_url $netfile`
|
||||||
if [ -f ../$file ]; then
|
if [ -f ../$file ]; then
|
||||||
msg "==> Found $file in build dir"
|
msg " |=> Found $file in build dir"
|
||||||
cp ../$file .
|
cp ../$file .
|
||||||
elif [ -f /var/cache/pacman/src/$file ]; then
|
elif [ -f /var/cache/pacman/src/$file ]; then
|
||||||
msg "==> Using local copy of $file"
|
msg " |=> Using local copy of $file"
|
||||||
cp /var/cache/pacman/src/$file .
|
cp /var/cache/pacman/src/$file .
|
||||||
else
|
else
|
||||||
# check for a download utility
|
# check for a download utility
|
||||||
|
@ -245,15 +316,20 @@ for netfile in ${source[@]}; do
|
||||||
msg "==> Aborting..."
|
msg "==> Aborting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
msg "==> Downloading $file"
|
msg " |=> Downloading $file"
|
||||||
$FTPAGENT $netfile 2>&1
|
$FTPAGENT $netfile 2>&1
|
||||||
if [ ! -f $file ]; then
|
if [ ! -f $file ]; then
|
||||||
msg "==> ERROR: Failed to download $file"
|
msg "==> ERROR: Failed to download $file"
|
||||||
msg "==> Aborting..."
|
msg "==> Aborting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ "`id -u`" = "0" -a "$INFAKEROOT" != "1" ]; then
|
||||||
mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src
|
mkdir -p /var/cache/pacman/src && cp $file /var/cache/pacman/src
|
||||||
|
else
|
||||||
|
cp $file ..
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$GENMD5" = "0" ]; then
|
||||||
unset cmd
|
unset cmd
|
||||||
case $file in
|
case $file in
|
||||||
*.tar.gz|*.tar.Z|*.tgz)
|
*.tar.gz|*.tar.Z|*.tgz)
|
||||||
|
@ -268,7 +344,7 @@ for netfile in ${source[@]}; do
|
||||||
cmd="gunzip $file" ;;
|
cmd="gunzip $file" ;;
|
||||||
esac
|
esac
|
||||||
if [ "$cmd" != "" ]; then
|
if [ "$cmd" != "" ]; then
|
||||||
msg "==> $cmd"
|
msg " |=> $cmd"
|
||||||
$cmd
|
$cmd
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
msg "==> ERROR: Failed to extract $file"
|
msg "==> ERROR: Failed to extract $file"
|
||||||
|
@ -276,8 +352,72 @@ for netfile in ${source[@]}; do
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$GENMD5" = "1" ]; then
|
||||||
|
if [ ! `type -p md5sum` ]; then
|
||||||
|
msg "==> ERROR: Cannot find the md5sum program."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
msg "==> Generating MD5sums for source files"
|
||||||
|
msg ""
|
||||||
|
ct=0
|
||||||
|
numsrc=${#source[@]}
|
||||||
|
for netfile in ${source[@]}; do
|
||||||
|
file=`strip_url $netfile`
|
||||||
|
sum=`md5sum $file | cut -d' ' -f 1`
|
||||||
|
if [ $ct -eq 0 ]; then
|
||||||
|
echo -n "md5sums=("
|
||||||
|
else
|
||||||
|
echo -ne "\t"
|
||||||
|
fi
|
||||||
|
echo -n "'$sum'"
|
||||||
|
ct=$(($ct+1))
|
||||||
|
if [ $ct -eq $numsrc ]; then
|
||||||
|
echo ')'
|
||||||
|
else
|
||||||
|
echo ' \'
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
msg ""
|
||||||
|
exit 0
|
||||||
|
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
|
||||||
|
# chown all source files to root.root
|
||||||
|
chown -R root.root $startdir/src
|
||||||
|
fi
|
||||||
|
|
||||||
# check for existing pkg directory
|
# check for existing pkg directory
|
||||||
if [ -d $startdir/pkg ]; then
|
if [ -d $startdir/pkg ]; then
|
||||||
msg "==> Removing existing pkg directory..."
|
msg "==> Removing existing pkg directory..."
|
||||||
|
@ -286,7 +426,7 @@ fi
|
||||||
mkdir -p $startdir/pkg
|
mkdir -p $startdir/pkg
|
||||||
|
|
||||||
# build
|
# build
|
||||||
msg "==> Building Package..."
|
msg "==> Starting build()..."
|
||||||
build 2>&1
|
build 2>&1
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
msg "==> Build Failed. Aborting..."
|
msg "==> Build Failed. Aborting..."
|
||||||
|
@ -330,15 +470,18 @@ if [ -d pkg/usr/man ]; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# strip binaries
|
|
||||||
cd $startdir
|
cd $startdir
|
||||||
msg "==> Stripping debugging symbols from libraries..."
|
|
||||||
find pkg/{,usr,usr/local,opt/*}/lib -type f -exec /usr/bin/strip --strip-debug '{}' ';' 2>&1
|
# strip binaries
|
||||||
msg "==> Stripping symbols from binaries..."
|
if [ "$NOSTRIP" = "0" ]; then
|
||||||
find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -exec /usr/bin/strip '{}' ';' 2>&1
|
msg "==> Stripping debugging symbols from libraries..."
|
||||||
|
find pkg/{,usr,usr/local,opt/*}/lib -type f -exec /usr/bin/strip --strip-debug '{}' \; 2>&1
|
||||||
|
msg "==> Stripping symbols from binaries..."
|
||||||
|
find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -exec /usr/bin/strip '{}' \; 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
# get some package meta info
|
# get some package meta info
|
||||||
builddate=`date -u "+%a %b %d %k:%M:%S %Y"`
|
builddate=`LC_ALL= ; date -u "+%a %b %d %k:%M:%S %Y"`
|
||||||
if [ "$PACKAGER" != "" ]; then
|
if [ "$PACKAGER" != "" ]; then
|
||||||
packager="$PACKAGER"
|
packager="$PACKAGER"
|
||||||
else
|
else
|
||||||
|
@ -360,14 +503,23 @@ echo "builddate = $builddate" >>.PKGINFO
|
||||||
echo "packager = $packager" >>.PKGINFO
|
echo "packager = $packager" >>.PKGINFO
|
||||||
echo "size = $size" >>.PKGINFO
|
echo "size = $size" >>.PKGINFO
|
||||||
|
|
||||||
for depend in "${depends[@]}"; do
|
for it in "${replaces[@]}"; do
|
||||||
echo "depend = $depend" >>.PKGINFO
|
echo "replaces = $it" >>.PKGINFO
|
||||||
done
|
done
|
||||||
for conflict in "${conflicts[@]}"; do
|
for it in "${groups[@]}"; do
|
||||||
echo "conflict = $conflict" >>.PKGINFO
|
echo "group = $it" >>.PKGINFO
|
||||||
done
|
done
|
||||||
for bakfile in "${backup[@]}"; do
|
for it in "${depends[@]}"; do
|
||||||
echo "backup = $bakfile" >>.PKGINFO
|
echo "depend = $it" >>.PKGINFO
|
||||||
|
done
|
||||||
|
for it in "${conflicts[@]}"; do
|
||||||
|
echo "conflict = $it" >>.PKGINFO
|
||||||
|
done
|
||||||
|
for it in "${provides[@]}"; do
|
||||||
|
echo "provides = $it" >>.PKGINFO
|
||||||
|
done
|
||||||
|
for it in "${backup[@]}"; do
|
||||||
|
echo "backup = $it" >>.PKGINFO
|
||||||
done
|
done
|
||||||
|
|
||||||
# check for an install script
|
# check for an install script
|
||||||
|
@ -377,9 +529,11 @@ if [ "$install" != "" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# build a filelist
|
# build a filelist
|
||||||
msg "==> Building filelist..."
|
msg "==> Generating .FILELIST file..."
|
||||||
cd $startdir/pkg
|
cd $startdir/pkg
|
||||||
tar cv * >/dev/null 2>.FILELIST
|
tar cv * >/dev/null 2>.FILELIST.tmp
|
||||||
|
cat .FILELIST.tmp | sort >.FILELIST
|
||||||
|
rm -f .FILELIST.tmp
|
||||||
|
|
||||||
# tar it up
|
# tar it up
|
||||||
msg "==> Compressing package..."
|
msg "==> Compressing package..."
|
||||||
|
@ -389,7 +543,7 @@ if [ -f $startdir/pkg/.INSTALL ]; then
|
||||||
else
|
else
|
||||||
cmd="tar czvf $PKGDEST/$pkgname-$pkgver-$pkgrel.pkg.tar.gz .PKGINFO .FILELIST *"
|
cmd="tar czvf $PKGDEST/$pkgname-$pkgver-$pkgrel.pkg.tar.gz .PKGINFO .FILELIST *"
|
||||||
fi
|
fi
|
||||||
$cmd >../filelist
|
$cmd | sort >../filelist
|
||||||
|
|
||||||
cd $startdir
|
cd $startdir
|
||||||
if [ "$CLEANUP" = "1" ]; then
|
if [ "$CLEANUP" = "1" ]; then
|
||||||
|
@ -397,7 +551,7 @@ if [ "$CLEANUP" = "1" ]; then
|
||||||
rm -rf src pkg filelist
|
rm -rf src pkg filelist
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "==> Finished making $pkgname (`date`)"
|
msg "==> Finished making: $pkgname (`date`)"
|
||||||
|
|
||||||
if [ "$INSTALL" = "1" ]; then
|
if [ "$INSTALL" = "1" ]; then
|
||||||
msg "==> Running pacman --upgrade"
|
msg "==> Running pacman --upgrade"
|
||||||
|
|
|
@ -1,7 +1,27 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# makeworld
|
||||||
|
#
|
||||||
|
# Copyright (c) 2002-2003 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
# USA.
|
||||||
|
#
|
||||||
|
|
||||||
toplevel=`pwd`
|
toplevel=`pwd`
|
||||||
version="2.5.1"
|
version="2.6"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "makeworld version $version"
|
echo "makeworld version $version"
|
||||||
|
@ -21,7 +41,7 @@ usage() {
|
||||||
echo " this should be run from the toplevel directory of ABS (usually /usr/abs)"
|
echo " this should be run from the toplevel directory of ABS (usually /usr/abs)"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -lt 2 -o "$1" = "--help" -o "$1" = "-h" ]; then
|
if [ $# -lt 2 ]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -35,12 +55,16 @@ for arg in $*; do
|
||||||
--builddeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
|
--builddeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
|
||||||
--nodeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
|
--nodeps) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
|
||||||
--force) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
|
--force) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
|
||||||
|
--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
--*)
|
--*)
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
while getopts "cisbdf-" opt; do
|
while getopts "chisbdf-" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
c) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;;
|
c) MAKEPKG_OPTS="$MAKEPKG_OPTS -c" ;;
|
||||||
i) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;;
|
i) MAKEPKG_OPTS="$MAKEPKG_OPTS -i" ;;
|
||||||
|
@ -48,6 +72,10 @@ for arg in $*; do
|
||||||
b) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
|
b) MAKEPKG_OPTS="$MAKEPKG_OPTS -b" ;;
|
||||||
d) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
|
d) MAKEPKG_OPTS="$MAKEPKG_OPTS -d" ;;
|
||||||
f) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
|
f) MAKEPKG_OPTS="$MAKEPKG_OPTS -f" ;;
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
-)
|
-)
|
||||||
OPTIND=0
|
OPTIND=0
|
||||||
break
|
break
|
||||||
|
@ -63,7 +91,7 @@ for arg in $*; do
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
if [ "$dest" != "" ]; then
|
if [ "$dest" != "" ]; then
|
||||||
break;
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -104,3 +132,4 @@ echo "makeworld complete." >>$toplevel/build.log
|
||||||
echo " started: $sd" >>$toplevel/build.log
|
echo " started: $sd" >>$toplevel/build.log
|
||||||
echo " finished: $ed" >>$toplevel/build.log
|
echo " finished: $ed" >>$toplevel/build.log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* convertdb.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
|
112
src/db.c
112
src/db.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* db.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
@ -29,13 +29,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
|
|
||||||
/* Verify database integrity and build a list of
|
/* Open a database and return a pacdb_t handle */
|
||||||
* installed packages
|
|
||||||
*
|
|
||||||
* returns: 0 on success
|
|
||||||
* 1 if db is not initialized
|
|
||||||
* 2 if db is corrupt
|
|
||||||
*/
|
|
||||||
pacdb_t* db_open(char *root, char *pkgdir, char *treename)
|
pacdb_t* db_open(char *root, char *pkgdir, char *treename)
|
||||||
{
|
{
|
||||||
pacdb_t *db = NULL;
|
pacdb_t *db = NULL;
|
||||||
|
@ -111,7 +105,7 @@ PMList* db_loadpkgs(pacdb_t *db, PMList *pkgcache)
|
||||||
cache = list_add(cache, arr[i]);
|
cache = list_add(cache, arr[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(arr);
|
FREE(arr);
|
||||||
|
|
||||||
return(cache);
|
return(cache);
|
||||||
}
|
}
|
||||||
|
@ -216,6 +210,11 @@ pkginfo_t* db_read(pacdb_t *db, struct dirent *ent, unsigned int inforeq)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
trim(info->desc);
|
trim(info->desc);
|
||||||
|
} else if(!strcmp(line, "%GROUPS%")) {
|
||||||
|
while(fgets(line, 512, fp) && strlen(trim(line))) {
|
||||||
|
char *s = strdup(line);
|
||||||
|
info->groups = list_add(info->groups, s);
|
||||||
|
}
|
||||||
} else if(!strcmp(line, "%URL%")) {
|
} else if(!strcmp(line, "%URL%")) {
|
||||||
if(fgets(info->url, sizeof(info->url), fp) == NULL) {
|
if(fgets(info->url, sizeof(info->url), fp) == NULL) {
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
@ -243,6 +242,14 @@ pkginfo_t* db_read(pacdb_t *db, struct dirent *ent, unsigned int inforeq)
|
||||||
}
|
}
|
||||||
trim(tmp);
|
trim(tmp);
|
||||||
info->size = atol(tmp);
|
info->size = atol(tmp);
|
||||||
|
} else if(!strcmp(line, "%REPLACES%")) {
|
||||||
|
/* the REPLACES tag is special -- it only appears in sync repositories,
|
||||||
|
* not the local one.
|
||||||
|
*/
|
||||||
|
while(fgets(line, 512, fp) && strlen(trim(line))) {
|
||||||
|
char *s = strdup(line);
|
||||||
|
info->replaces = list_add(info->replaces, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -303,6 +310,12 @@ pkginfo_t* db_read(pacdb_t *db, struct dirent *ent, unsigned int inforeq)
|
||||||
info->conflicts = list_add(info->conflicts, s);
|
info->conflicts = list_add(info->conflicts, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!strcmp(line, "%PROVIDES%")) {
|
||||||
|
while(fgets(line, 512, fp) && strlen(trim(line))) {
|
||||||
|
char *s = strdup(line);
|
||||||
|
info->provides = list_add(info->provides, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
@ -347,6 +360,11 @@ int db_write(pacdb_t *db, pkginfo_t *info)
|
||||||
fprintf(fp, "%s\n\n", info->version);
|
fprintf(fp, "%s\n\n", info->version);
|
||||||
fputs("%DESC%\n", fp);
|
fputs("%DESC%\n", fp);
|
||||||
fprintf(fp, "%s\n\n", info->desc);
|
fprintf(fp, "%s\n\n", info->desc);
|
||||||
|
fputs("%GROUPS%\n", fp);
|
||||||
|
for(lp = info->groups; lp; lp = lp->next) {
|
||||||
|
fprintf(fp, "%s\n", (char*)lp->data);
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
fputs("%URL%\n", fp);
|
fputs("%URL%\n", fp);
|
||||||
fprintf(fp, "%s\n\n", info->url);
|
fprintf(fp, "%s\n\n", info->url);
|
||||||
fputs("%BUILDDATE%\n", fp);
|
fputs("%BUILDDATE%\n", fp);
|
||||||
|
@ -400,6 +418,11 @@ int db_write(pacdb_t *db, pkginfo_t *info)
|
||||||
fprintf(fp, "%s\n", (char*)lp->data);
|
fprintf(fp, "%s\n", (char*)lp->data);
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
|
fputs("%PROVIDES%\n", fp);
|
||||||
|
for(lp = info->provides; lp; lp = lp->next) {
|
||||||
|
fprintf(fp, "%s\n", (char*)lp->data);
|
||||||
|
}
|
||||||
|
fprintf(fp, "\n");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* INSTALL */
|
/* INSTALL */
|
||||||
|
@ -426,7 +449,6 @@ PMList* db_find_conflicts(pacdb_t *db, PMList *targets, char *root)
|
||||||
*
|
*
|
||||||
pkginfo_t *info = NULL;
|
pkginfo_t *info = NULL;
|
||||||
char *dbstr = NULL;
|
char *dbstr = NULL;
|
||||||
vprint("Checking database against targets...\n");
|
|
||||||
rewinddir(db->dir);
|
rewinddir(db->dir);
|
||||||
while((info = db_scan(db, NULL, INFRQ_DESC | INFRQ_FILES)) != NULL) {
|
while((info = db_scan(db, NULL, INFRQ_DESC | INFRQ_FILES)) != NULL) {
|
||||||
for(i = info->files; i; i = i->next) {
|
for(i = info->files; i; i = i->next) {
|
||||||
|
@ -453,7 +475,6 @@ PMList* db_find_conflicts(pacdb_t *db, PMList *targets, char *root)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* CHECK 2: check every target against every target */
|
/* CHECK 2: check every target against every target */
|
||||||
/* orelien - vprint("Checking targets against targets...\n"); */
|
|
||||||
for(i = targets; i; i = i->next) {
|
for(i = targets; i; i = i->next) {
|
||||||
pkginfo_t *p1 = (pkginfo_t*)i->data;
|
pkginfo_t *p1 = (pkginfo_t*)i->data;
|
||||||
for(j = i; j; j = j->next) {
|
for(j = i; j; j = j->next) {
|
||||||
|
@ -480,7 +501,6 @@ PMList* db_find_conflicts(pacdb_t *db, PMList *targets, char *root)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CHECK 3: check every target against the filesystem */
|
/* CHECK 3: check every target against the filesystem */
|
||||||
/* orelien - vprint("Checking targets against filesystem...\n"); */
|
|
||||||
for(i = targets; i; i = i->next) {
|
for(i = targets; i; i = i->next) {
|
||||||
pkginfo_t *p = (pkginfo_t*)i->data;
|
pkginfo_t *p = (pkginfo_t*)i->data;
|
||||||
pkginfo_t *dbpkg = NULL;
|
pkginfo_t *dbpkg = NULL;
|
||||||
|
@ -509,4 +529,72 @@ PMList* db_find_conflicts(pacdb_t *db, PMList *targets, char *root)
|
||||||
return(conflicts);
|
return(conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PMList *whatprovides(pacdb_t *db, char* package)
|
||||||
|
{
|
||||||
|
PMList *pkgs, *i = NULL;
|
||||||
|
pkginfo_t *info;
|
||||||
|
|
||||||
|
rewinddir(db->dir);
|
||||||
|
while((info = db_scan(db, NULL, INFRQ_DESC | INFRQ_DEPENDS)) != NULL) {
|
||||||
|
if(is_in(package, info->provides)) {
|
||||||
|
i = list_add(i, strdup(info->name));
|
||||||
|
}
|
||||||
|
freepkg(info);
|
||||||
|
}
|
||||||
|
pkgs = list_sort(i);
|
||||||
|
list_free(i);
|
||||||
|
|
||||||
|
return(pkgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return a list of all groups present in *db
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
PMList *find_groups(pacdb_t *db)
|
||||||
|
{
|
||||||
|
PMList *groups, *i = NULL;
|
||||||
|
PMList *lp = NULL;
|
||||||
|
pkginfo_t *info;
|
||||||
|
|
||||||
|
rewinddir(db->dir);
|
||||||
|
while((info = db_scan(db, NULL, INFRQ_DESC)) != NULL) {
|
||||||
|
for(lp = info->groups; lp; lp = lp->next) {
|
||||||
|
if(!is_in((char*)lp->data, i)) {
|
||||||
|
i = list_add(i, strdup((char*)lp->data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freepkg(info);
|
||||||
|
}
|
||||||
|
groups = list_sort(i);
|
||||||
|
list_free(i);
|
||||||
|
|
||||||
|
return(groups);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return a list of all members of the specified group
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
PMList *pkg_ingroup(pacdb_t *db, char *group)
|
||||||
|
{
|
||||||
|
PMList *pkg, *i = NULL;
|
||||||
|
PMList *lp = NULL;
|
||||||
|
pkginfo_t *info;
|
||||||
|
|
||||||
|
rewinddir(db->dir);
|
||||||
|
while((info = db_scan(db, NULL, INFRQ_DESC)) != NULL) {
|
||||||
|
for(lp = info->groups; lp; lp = lp->next) {
|
||||||
|
if(!strcmp((char*)lp->data, group)) {
|
||||||
|
i = list_add(i, strdup(info->name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freepkg(info);
|
||||||
|
}
|
||||||
|
pkg = list_sort(i);
|
||||||
|
list_free(i);
|
||||||
|
|
||||||
|
return(pkg);
|
||||||
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|
5
src/db.h
5
src/db.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* db.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
@ -42,6 +42,9 @@ pkginfo_t* db_scan(pacdb_t *db, char *target, unsigned int inforeq);
|
||||||
pkginfo_t* db_read(pacdb_t *db, struct dirent *ent, unsigned int inforeq);
|
pkginfo_t* db_read(pacdb_t *db, struct dirent *ent, unsigned int inforeq);
|
||||||
int db_write(pacdb_t *db, pkginfo_t *info);
|
int db_write(pacdb_t *db, pkginfo_t *info);
|
||||||
PMList* db_find_conflicts(pacdb_t *db, PMList* targets, char *root);
|
PMList* db_find_conflicts(pacdb_t *db, PMList* targets, char *root);
|
||||||
|
PMList *whatprovides(pacdb_t *db, char* package);
|
||||||
|
PMList *find_groups(pacdb_t *db);
|
||||||
|
PMList *pkg_ingroup(pacdb_t *db, char *group);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* list.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
@ -174,7 +174,9 @@ PMList *list_sort(PMList *list)
|
||||||
lp = list_add(lp, strdup(arr[i]));
|
lp = list_add(lp, strdup(arr[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(arr) {
|
||||||
free(arr);
|
free(arr);
|
||||||
|
}
|
||||||
|
|
||||||
return(lp);
|
return(lp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* list.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* package.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002-2003 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -181,6 +181,8 @@ int parse_descfile(char *descfile, pkginfo_t *info, PMList **backup, int output)
|
||||||
strncpy(info->version, ptr, sizeof(info->version));
|
strncpy(info->version, ptr, sizeof(info->version));
|
||||||
} else if(!strcmp(key, "PKGDESC")) {
|
} else if(!strcmp(key, "PKGDESC")) {
|
||||||
strncpy(info->desc, ptr, sizeof(info->desc));
|
strncpy(info->desc, ptr, sizeof(info->desc));
|
||||||
|
} else if(!strcmp(key, "GROUP")) {
|
||||||
|
info->groups = list_add(info->groups, strdup(ptr));
|
||||||
} else if(!strcmp(key, "URL")) {
|
} else if(!strcmp(key, "URL")) {
|
||||||
strncpy(info->url, ptr, sizeof(info->url));
|
strncpy(info->url, ptr, sizeof(info->url));
|
||||||
} else if(!strcmp(key, "BUILDDATE")) {
|
} else if(!strcmp(key, "BUILDDATE")) {
|
||||||
|
@ -194,14 +196,15 @@ int parse_descfile(char *descfile, pkginfo_t *info, PMList **backup, int output)
|
||||||
strncpy(tmp, ptr, sizeof(tmp));
|
strncpy(tmp, ptr, sizeof(tmp));
|
||||||
info->size = atol(tmp);
|
info->size = atol(tmp);
|
||||||
} else if(!strcmp(key, "DEPEND")) {
|
} else if(!strcmp(key, "DEPEND")) {
|
||||||
char *s = strdup(ptr);
|
info->depends = list_add(info->depends, strdup(ptr));
|
||||||
info->depends = list_add(info->depends, s);
|
|
||||||
} else if(!strcmp(key, "CONFLICT")) {
|
} else if(!strcmp(key, "CONFLICT")) {
|
||||||
char *s = strdup(ptr);
|
info->conflicts = list_add(info->conflicts, strdup(ptr));
|
||||||
info->conflicts = list_add(info->conflicts, s);
|
} else if(!strcmp(key, "REPLACES")) {
|
||||||
|
info->replaces = list_add(info->replaces, strdup(ptr));
|
||||||
|
} else if(!strcmp(key, "PROVIDES")) {
|
||||||
|
info->provides = list_add(info->provides, strdup(ptr));
|
||||||
} else if(!strcmp(key, "BACKUP")) {
|
} else if(!strcmp(key, "BACKUP")) {
|
||||||
char *s = strdup(ptr);
|
bak = list_add(bak, strdup(ptr));
|
||||||
bak = list_add(bak, s);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: syntax error in description file line %d\n",
|
fprintf(stderr, "%s: syntax error in description file line %d\n",
|
||||||
info->name[0] != '\0' ? info->name : "error", linenum);
|
info->name[0] != '\0' ? info->name : "error", linenum);
|
||||||
|
@ -235,6 +238,9 @@ pkginfo_t* newpkg()
|
||||||
pkg->files = NULL;
|
pkg->files = NULL;
|
||||||
pkg->backup = NULL;
|
pkg->backup = NULL;
|
||||||
pkg->depends = NULL;
|
pkg->depends = NULL;
|
||||||
|
pkg->groups = NULL;
|
||||||
|
pkg->provides = NULL;
|
||||||
|
pkg->replaces = NULL;
|
||||||
|
|
||||||
return(pkg);
|
return(pkg);
|
||||||
}
|
}
|
||||||
|
@ -250,6 +256,9 @@ void freepkg(pkginfo_t *pkg)
|
||||||
list_free(pkg->depends);
|
list_free(pkg->depends);
|
||||||
list_free(pkg->conflicts);
|
list_free(pkg->conflicts);
|
||||||
list_free(pkg->requiredby);
|
list_free(pkg->requiredby);
|
||||||
|
list_free(pkg->groups);
|
||||||
|
list_free(pkg->provides);
|
||||||
|
list_free(pkg->replaces);
|
||||||
FREE(pkg);
|
FREE(pkg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -300,12 +309,18 @@ void dump_pkg(pkginfo_t *info)
|
||||||
|
|
||||||
printf("Name : %s\n", info->name);
|
printf("Name : %s\n", info->name);
|
||||||
printf("Version : %s\n", info->version);
|
printf("Version : %s\n", info->version);
|
||||||
|
pm = list_sort(info->groups);
|
||||||
|
list_display("Groups : ", pm);
|
||||||
|
FREE(pm);
|
||||||
printf("Packager : %s\n", info->packager);
|
printf("Packager : %s\n", info->packager);
|
||||||
printf("URL: : %s\n", info->url);
|
printf("URL : %s\n", (info->url ? info->url : "None"));
|
||||||
printf("Size : %ld\n", info->size);
|
printf("Size : %ld\n", info->size);
|
||||||
printf("Build Date : %s %s\n", info->builddate, strlen(info->builddate) ? "UTC" : "");
|
printf("Build Date : %s %s\n", info->builddate, strlen(info->builddate) ? "UTC" : "");
|
||||||
printf("Install Date : %s %s\n", info->installdate, strlen(info->installdate) ? "UTC" : "");
|
printf("Install Date : %s %s\n", info->installdate, strlen(info->installdate) ? "UTC" : "");
|
||||||
printf("Install Script: %s\n", (info->scriptlet ? "yes" : "no"));
|
printf("Install Script : %s\n", (info->scriptlet ? "Yes" : "No"));
|
||||||
|
pm = list_sort(info->provides);
|
||||||
|
list_display("Provides : ", pm);
|
||||||
|
FREE(pm);
|
||||||
pm = list_sort(info->depends);
|
pm = list_sort(info->depends);
|
||||||
list_display("Depends On : ", pm);
|
list_display("Depends On : ", pm);
|
||||||
FREE(pm);
|
FREE(pm);
|
||||||
|
@ -313,7 +328,7 @@ void dump_pkg(pkginfo_t *info)
|
||||||
list_display("Required By : ", pm);
|
list_display("Required By : ", pm);
|
||||||
FREE(pm);
|
FREE(pm);
|
||||||
pm = list_sort(info->conflicts);
|
pm = list_sort(info->conflicts);
|
||||||
list_display("Conflicts With: ", pm);
|
list_display("Conflicts With : ", pm);
|
||||||
FREE(pm);
|
FREE(pm);
|
||||||
printf("Description : %s\n", info->desc);
|
printf("Description : %s\n", info->desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* package.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
@ -41,11 +41,14 @@ typedef struct __pkginfo_t {
|
||||||
char packager[64];
|
char packager[64];
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
unsigned short scriptlet;
|
unsigned short scriptlet;
|
||||||
|
PMList *replaces;
|
||||||
|
PMList *groups;
|
||||||
PMList *files;
|
PMList *files;
|
||||||
PMList *backup;
|
PMList *backup;
|
||||||
PMList *depends;
|
PMList *depends;
|
||||||
PMList *requiredby;
|
PMList *requiredby;
|
||||||
PMList *conflicts;
|
PMList *conflicts;
|
||||||
|
PMList *provides;
|
||||||
} pkginfo_t;
|
} pkginfo_t;
|
||||||
|
|
||||||
typedef struct __depend_t {
|
typedef struct __depend_t {
|
||||||
|
|
895
src/pacman.c
895
src/pacman.c
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* pacman.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
#define _PAC_PACMAN_H
|
#define _PAC_PACMAN_H
|
||||||
|
|
||||||
#ifndef PACVER
|
#ifndef PACVER
|
||||||
#define PACVER "2.5.1"
|
#define PACVER "2.6"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PKGDIR
|
#ifndef PKGDIR
|
||||||
|
@ -51,6 +51,7 @@ int pacman_query(pacdb_t *db, PMList *targets);
|
||||||
int pacman_sync(pacdb_t *db, PMList *targets);
|
int pacman_sync(pacdb_t *db, PMList *targets);
|
||||||
int pacman_deptest(pacdb_t *db, PMList *targets);
|
int pacman_deptest(pacdb_t *db, PMList *targets);
|
||||||
|
|
||||||
|
PMList* sortbydeps(PMList *targets);
|
||||||
PMList* checkdeps(pacdb_t *db, unsigned short op, PMList *targets);
|
PMList* checkdeps(pacdb_t *db, unsigned short op, PMList *targets);
|
||||||
int resolvedeps(pacdb_t *local, PMList *databases, syncpkg_t *sync, PMList *list, PMList *trail);
|
int resolvedeps(pacdb_t *local, PMList *databases, syncpkg_t *sync, PMList *list, PMList *trail);
|
||||||
int splitdep(char *depstr, depend_t *depend);
|
int splitdep(char *depstr, depend_t *depend);
|
||||||
|
@ -62,7 +63,9 @@ int parseconfig(char *configfile);
|
||||||
void usage(int op, char *myname);
|
void usage(int op, char *myname);
|
||||||
void version(void);
|
void version(void);
|
||||||
|
|
||||||
int vprint(char *fmt, ...);
|
void vprint(char *fmt, ...);
|
||||||
|
void logaction(char *fmt, ...);
|
||||||
|
char* buildstring(PMList *strlist);
|
||||||
int lckmk(char *file, int retries, unsigned int sleep_secs);
|
int lckmk(char *file, int retries, unsigned int sleep_secs);
|
||||||
int lckrm(char *lckfile);
|
int lckrm(char *lckfile);
|
||||||
void cleanup(int signum);
|
void cleanup(int signum);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* pacsync.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -39,10 +40,12 @@ static int offset;
|
||||||
|
|
||||||
/* pacman options */
|
/* pacman options */
|
||||||
extern char *pmo_root;
|
extern char *pmo_root;
|
||||||
|
extern char *pmo_dbpath;
|
||||||
extern unsigned short pmo_nopassiveftp;
|
extern unsigned short pmo_nopassiveftp;
|
||||||
|
|
||||||
/* sync servers */
|
/* sync servers */
|
||||||
extern PMList *pmc_syncs;
|
extern PMList *pmc_syncs;
|
||||||
|
extern int maxcols;
|
||||||
|
|
||||||
int sync_synctree()
|
int sync_synctree()
|
||||||
{
|
{
|
||||||
|
@ -55,7 +58,7 @@ int sync_synctree()
|
||||||
|
|
||||||
for(i = pmc_syncs; i; i = i->next) {
|
for(i = pmc_syncs; i; i = i->next) {
|
||||||
sync_t *sync = (sync_t*)i->data;
|
sync_t *sync = (sync_t*)i->data;
|
||||||
snprintf(ldir, PATH_MAX, "%s%s", pmo_root, PKGDIR);
|
snprintf(ldir, PATH_MAX, "%s%s", pmo_root, pmo_dbpath);
|
||||||
|
|
||||||
/* build a one-element list */
|
/* build a one-element list */
|
||||||
snprintf(path, PATH_MAX, "%s.db.tar.gz", sync->treename);
|
snprintf(path, PATH_MAX, "%s.db.tar.gz", sync->treename);
|
||||||
|
@ -66,13 +69,12 @@ int sync_synctree()
|
||||||
fprintf(stderr, "failed to synchronize %s\n", sync->treename);
|
fprintf(stderr, "failed to synchronize %s\n", sync->treename);
|
||||||
success = 0;
|
success = 0;
|
||||||
}
|
}
|
||||||
/*printf("\n");*/
|
|
||||||
list_free(files);
|
list_free(files);
|
||||||
files = NULL;
|
files = NULL;
|
||||||
snprintf(path, PATH_MAX, "%s/%s.db.tar.gz", ldir, sync->treename);
|
snprintf(path, PATH_MAX, "%s/%s.db.tar.gz", ldir, sync->treename);
|
||||||
|
|
||||||
if(success) {
|
if(success) {
|
||||||
snprintf(ldir, PATH_MAX, "%s%s/%s", pmo_root, PKGDIR, sync->treename);
|
snprintf(ldir, PATH_MAX, "%s%s/%s", pmo_root, pmo_dbpath, sync->treename);
|
||||||
/* remove the old dir */
|
/* remove the old dir */
|
||||||
vprint("removing %s (if it exists)\n", ldir);
|
vprint("removing %s (if it exists)\n", ldir);
|
||||||
rmrf(ldir);
|
rmrf(ldir);
|
||||||
|
@ -111,7 +113,7 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
for(i = servers; i && !done; i = i->next) {
|
for(i = servers; i && !done; i = i->next) {
|
||||||
server_t *server = (server_t*)i->data;
|
server_t *server = (server_t*)i->data;
|
||||||
|
|
||||||
if(!server->islocal) {
|
if(!strcmp(server->protocol, "ftp")) {
|
||||||
FtpInit();
|
FtpInit();
|
||||||
if(!FtpConnect(server->server, &control)) {
|
if(!FtpConnect(server->server, &control)) {
|
||||||
fprintf(stderr, "error: cannot connect to %s\n", server->server);
|
fprintf(stderr, "error: cannot connect to %s\n", server->server);
|
||||||
|
@ -153,18 +155,14 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
sync_fnm[j] = ' ';
|
sync_fnm[j] = ' ';
|
||||||
}
|
}
|
||||||
sync_fnm[24] = '\0';
|
sync_fnm[24] = '\0';
|
||||||
|
offset = 0;
|
||||||
|
|
||||||
if(!server->islocal) {
|
if(!strcmp(server->protocol, "ftp")) {
|
||||||
int tries = 2;
|
|
||||||
while(tries) {
|
|
||||||
if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) {
|
if(!FtpSize(fn, &fsz, FTPLIB_IMAGE, control)) {
|
||||||
fprintf(stderr, "warning: failed to get filesize for %s\n", fn);
|
fprintf(stderr, "warning: failed to get filesize for %s\n", fn);
|
||||||
}
|
}
|
||||||
offset = 0;
|
|
||||||
if(!stat(output, &st)) {
|
if(!stat(output, &st)) {
|
||||||
offset = (int)st.st_size;
|
offset = (int)st.st_size;
|
||||||
}
|
|
||||||
if(offset) {
|
|
||||||
if(!FtpRestart(offset, control)) {
|
if(!FtpRestart(offset, control)) {
|
||||||
fprintf(stderr, "warning: failed to resume download -- restarting\n");
|
fprintf(stderr, "warning: failed to resume download -- restarting\n");
|
||||||
/* can't resume: */
|
/* can't resume: */
|
||||||
|
@ -182,21 +180,17 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
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 */
|
||||||
/* try each file twice in case it was just one of those transient network errors */
|
|
||||||
tries--;
|
|
||||||
} else {
|
} else {
|
||||||
char completefile[PATH_MAX];
|
char completefile[PATH_MAX];
|
||||||
log_progress(control, fsz-offset, &fsz);
|
log_progress(control, fsz-offset, &fsz);
|
||||||
complete = list_add(complete, fn);
|
complete = list_add(complete, fn);
|
||||||
tries = 0;
|
|
||||||
/* rename "output.part" file to "output" file */
|
/* rename "output.part" file to "output" file */
|
||||||
snprintf(completefile, PATH_MAX, "%s/%s", localpath, fn);
|
snprintf(completefile, PATH_MAX, "%s/%s", localpath, fn);
|
||||||
rename(output, completefile);
|
rename(output, completefile);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
} else if(!strcmp(server->protocol, "file")) {
|
||||||
} else {
|
|
||||||
/* local repository, just copy the file */
|
/* local repository, just copy the file */
|
||||||
char src[PATH_MAX], dest[PATH_MAX];
|
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);
|
||||||
|
@ -206,10 +200,10 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
fprintf(stderr, "failed copying %s\n", src);
|
fprintf(stderr, "failed copying %s\n", src);
|
||||||
} else {
|
} else {
|
||||||
char out[56];
|
char out[56];
|
||||||
printf("%s [", sync_fnm);
|
printf(" %s [", sync_fnm);
|
||||||
strncpy(out, server->path, 33);
|
strncpy(out, server->path, 33);
|
||||||
printf("%s", out);
|
printf("%s", out);
|
||||||
for(j = strlen(out); j < 33; j++) {
|
for(j = strlen(out); j < maxcols-44; j++) {
|
||||||
printf(" ");
|
printf(" ");
|
||||||
}
|
}
|
||||||
fputs("] 100% | LOCAL\n", stdout);
|
fputs("] 100% | LOCAL\n", stdout);
|
||||||
|
@ -223,7 +217,7 @@ int downloadfiles(PMList *servers, char *localpath, PMList *files)
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!server->islocal) {
|
if(!strcmp(server->protocol, "ftp")) {
|
||||||
FtpQuit(control);
|
FtpQuit(control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,37 +229,44 @@ 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;
|
int i, cur;
|
||||||
|
char *cenv = NULL;
|
||||||
|
|
||||||
printf("%s [", sync_fnm);
|
cenv = getenv("COLUMNS");
|
||||||
for(i = 0; i < (int)(pct/3); i++) {
|
if(cenv) {
|
||||||
printf("#");
|
maxcols = atoi(cenv);
|
||||||
}
|
}
|
||||||
for(i = (int)(pct/3); i < (int)(100/3); i++) {
|
|
||||||
printf(" ");
|
printf(" %s [", sync_fnm);
|
||||||
|
cur = (int)((maxcols-44)*pct/100);
|
||||||
|
for(i = 0; i < maxcols-44; i++) {
|
||||||
|
(i < cur) ? printf("#") : printf(" ");
|
||||||
}
|
}
|
||||||
printf("] %3d%% | %6dK\r ", pct, ((xfered+offset)/1024));
|
printf("] %3d%% | %6dK\r", pct, ((xfered+offset)/1024));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test for existence of a package in a PMList*
|
/* Test for existance of a package in a PMList* of syncpkg_t*
|
||||||
* of syncpkg_t*
|
* If found, return a pointer to the respective syncpkg_t*
|
||||||
*/
|
*/
|
||||||
int is_pkginsync(syncpkg_t *needle, PMList *haystack)
|
syncpkg_t* find_pkginsync(char *needle, PMList *haystack)
|
||||||
{
|
{
|
||||||
PMList *lp;
|
PMList *i;
|
||||||
syncpkg_t *sync;
|
syncpkg_t *sync;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
for(lp = haystack; lp && !found; lp = lp->next) {
|
for(i = haystack; i && !found; i = i->next) {
|
||||||
sync = (syncpkg_t*)lp->data;
|
sync = (syncpkg_t*)i->data;
|
||||||
if(sync && !strcmp(sync->pkg->name, needle->pkg->name)) {
|
if(sync && !strcmp(sync->pkg->name, needle)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!found) {
|
||||||
|
sync = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return found;
|
return sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* pacsync.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/* Servers */
|
/* Servers */
|
||||||
typedef struct __server_t {
|
typedef struct __server_t {
|
||||||
unsigned short islocal;
|
char* protocol;
|
||||||
char* server;
|
char* server;
|
||||||
char* path;
|
char* path;
|
||||||
} server_t;
|
} server_t;
|
||||||
|
@ -44,11 +44,12 @@ typedef struct __dbsync_t {
|
||||||
typedef struct __syncpkg_t {
|
typedef struct __syncpkg_t {
|
||||||
pkginfo_t *pkg;
|
pkginfo_t *pkg;
|
||||||
dbsync_t *dbs;
|
dbsync_t *dbs;
|
||||||
|
PMList *replaces;
|
||||||
} syncpkg_t;
|
} syncpkg_t;
|
||||||
|
|
||||||
int sync_synctree();
|
int sync_synctree();
|
||||||
int downloadfiles(PMList *servers, char *localpath, PMList *files);
|
int downloadfiles(PMList *servers, char *localpath, PMList *files);
|
||||||
int is_pkginsync(syncpkg_t *needle, PMList *haystack);
|
syncpkg_t* find_pkginsync(char *needle, PMList *haystack);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* rpmvercmp.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* rpmvercmp.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
|
15
src/util.c
15
src/util.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* util.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
@ -117,6 +117,7 @@ int copyfile(char *src, char *dest)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* does the same thing as 'mkdir -p' */
|
||||||
int makepath(char *path)
|
int makepath(char *path)
|
||||||
{
|
{
|
||||||
char *orig, *str, *ptr;
|
char *orig, *str, *ptr;
|
||||||
|
@ -146,6 +147,7 @@ int makepath(char *path)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* does the same thing as 'rm -rf' */
|
||||||
int rmrf(char *path)
|
int rmrf(char *path)
|
||||||
{
|
{
|
||||||
int errflag = 0;
|
int errflag = 0;
|
||||||
|
@ -157,13 +159,13 @@ int rmrf(char *path)
|
||||||
if(!unlink(path)) {
|
if(!unlink(path)) {
|
||||||
return(0);
|
return(0);
|
||||||
} else {
|
} else {
|
||||||
if (errno == ENOENT) {
|
if(errno == ENOENT) {
|
||||||
return(0);
|
return(0);
|
||||||
} else if (errno == EPERM) {
|
} else if(errno == EPERM) {
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
} else if (errno == EISDIR) {
|
} else if(errno == EISDIR) {
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
} else if (errno == ENOTDIR) {
|
} else if(errno == ENOTDIR) {
|
||||||
return(1);
|
return(1);
|
||||||
} else {
|
} else {
|
||||||
/* not a directory */
|
/* not a directory */
|
||||||
|
@ -174,7 +176,7 @@ int rmrf(char *path)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
|
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
|
||||||
if (dp->d_ino) {
|
if(dp->d_ino) {
|
||||||
sprintf(name, "%s/%s", path, dp->d_name);
|
sprintf(name, "%s/%s", path, dp->d_name);
|
||||||
if(strcmp(dp->d_name, "..") && strcmp(dp->d_name, ".")) {
|
if(strcmp(dp->d_name, "..") && strcmp(dp->d_name, ".")) {
|
||||||
errflag += rmrf(name);
|
errflag += rmrf(name);
|
||||||
|
@ -190,6 +192,7 @@ int rmrf(char *path)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* presents a prompt and gets a Y/N answer */
|
||||||
int yesno(char *fmt, ...)
|
int yesno(char *fmt, ...)
|
||||||
{
|
{
|
||||||
char response[32];
|
char response[32];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* util.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* pacman
|
* vercmp.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue