Dan McGee <dpmcgee@gmail.com>

* Lots of code cleanup, and type fixes
* Make 'makeworld' a bit more in-line with the other stuff
* Make -Si and -Qi operations appear the same
This commit is contained in:
Aaron Griffin 2007-01-26 02:13:16 +00:00
parent 7ffb1e5fac
commit e22336673a
13 changed files with 43 additions and 48 deletions

View file

@ -36,6 +36,7 @@ rm -rf etc/Makefile.in
rm -rf etc/Makefile
rm -rf etc/pacman.d/Makefile.in
rm -rf etc/pacman.d/Makefile
rm -rf etc/pacman.d/{current,extra,community,unstable,release}
rm -rf etc/abs/Makefile.in
rm -rf etc/abs/Makefile

View file

@ -147,7 +147,7 @@ AC_ARG_WITH(config-file,
dnl Help line for debug
AC_ARG_ENABLE(debug,
AC_HELP_STRING([ --enable-debug], [Enable debugging support]),
AC_HELP_STRING([--enable-debug], [Enable debugging support]),
[debug=$enableval], [debug=yes])
dnl Help line for fakeroot
@ -292,26 +292,20 @@ else
fi
dnl Check for math
AC_CHECK_LIB([m], [log10], [AC_CHECK_HEADER([math.h], [LIBM='-lm'])])
if test -n "$LIBM"; then
LDFLAGS="$LDFLAGS $LIBM"
else
AC_MSG_ERROR("math library not found!");
AC_CHECK_LIB([m], [sqrt], [AC_CHECK_HEADER([math.h], [LIBM='-lm'])])
if test -z "$LIBM"; then
AC_MSG_ERROR("math library needed to compile pacman!");
fi
dnl Check for libarchive
AC_CHECK_LIB([archive], [archive_read_data], [AC_CHECK_HEADER([archive.h], [LIBARCHIVE='-larchive'])])
if test -n "$LIBARCHIVE"; then
LDFLAGS="$LDFLAGS $LIBARCHIVE"
else
if test -z "$LIBARCHIVE"; then
AC_MSG_ERROR("libarchive is needed to compile pacman!");
fi
dnl Check for libdownload
AC_CHECK_LIB([download], [downloadParseURL], [AC_CHECK_HEADER([download.h], [LIBDOWNLOAD='-ldownload'])])
if test -n "$LIBDOWNLOAD"; then
LDFLAGS="$LDFLAGS $LIBDOWNLOAD"
else
if test -z "$LIBDOWNLOAD"; then
AC_MSG_ERROR("libdownload is needed to compile pacman!");
fi
@ -326,20 +320,20 @@ fi
dnl Enable or disable debug code
AC_MSG_CHECKING(for debug mode request)
if test x$debug = xyes ; then
AM_CONDITIONAL(PACMAN_DEBUG, test x$debug = xyes)
if test "$debug" = "yes" ; then
AM_CONDITIONAL(PACMAN_DEBUG, test "$debug" = "yes")
CFLAGS="$CFLAGS -g -Wall -Werror -std=c99 -DPACMAN_DEBUG"
LDFLAGS="$LDFLAGS -lmcheck"
AC_MSG_RESULT(yes)
else
AM_CONDITIONAL(PACMAN_DEBUG, test x$debug = xno)
AM_CONDITIONAL(PACMAN_DEBUG, test "$debug" = "no")
CFLAGS="$CFLAGS -Wall -std=c99"
AC_MSG_RESULT(no)
fi
dnl Enable or disable fakeroot code
AC_MSG_CHECKING(for fakeroot proof support)
if test x$fakeroot = xyes ; then
if test "$fakeroot" = "yes" ; then
AC_MSG_RESULT(yes)
else
CFLAGS="$CFLAGS -DFAKEROOT"

View file

@ -1,7 +1,6 @@
EXTRA_DIST = community current extra release unstable
clean:
rm $(EXTRA_DIST)
install-data-hook:
mkdir -p $(DESTDIR)$(sysconfdir)/pacman.d ; \

View file

@ -40,7 +40,7 @@ include_HEADERS = alpm_list.h alpm.h
libalpm_la_SOURCES = $(TARGETS)
libalpm_la_LDFLAGS = -no-undefined -version-info $(PM_VERSION_INFO)
libalpm_la_LIBADD = -larchive -ldownload
libalpm_la_LIBADD = -larchive -ldownload -lm
if HAS_DOXYGEN
all: doxygen.in

View file

@ -566,7 +566,7 @@ char *alpm_pkg_name_hasarch(char *pkgname)
* and
* package-name-bar-1.2.3-1
*/
int i = 0;
size_t i = 0;
char *arch, *cmp, *p;
if((p = strrchr(pkgname, '-'))) {
@ -1008,7 +1008,7 @@ int alpm_parse_config(char *file, alpm_cb_db_register callback, const char *this
_alpm_log(PM_LOG_DEBUG, _("config: xfercommand: %s"), ptr);
} else if (!strcmp(key, "UPGRADEDELAY")) {
/* The config value is in days, we use seconds */
long ud = atol(ptr) * 60 * 60 *24;
time_t ud = atol(ptr) * 60 * 60 *24;
alpm_option_set_upgradedelay(ud);
_alpm_log(PM_LOG_DEBUG, _("config: upgradedelay: %d"), ud);
} else {

View file

@ -249,9 +249,9 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
}
if(!_alpm_depcmp(tp, &depend)) {
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
depend.name, p->name);
depend.name, p->name);
miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod,
depend.name, depend.version);
depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {

View file

@ -20,8 +20,8 @@
# USA.
#
version="2.9.8"
toplevel=`pwd`
version="3.0.0"
toplevel=$(pwd)
usage() {
echo "makeworld version $version"
@ -119,13 +119,13 @@ fi
# convert a (possibly) relative path to absolute
cd $dest
dest=`pwd`
dest=$(pwd)
cd - &>/dev/null
sd=`date +"[%b %d %H:%M]"`
sd=$(date +"[%b %d %H:%M]")
for category in $*; do
for port in `find $toplevel/$category -maxdepth 1 -mindepth 1 -type d | sort`; do
for port in $(find $toplevel/$category -maxdepth 1 -mindepth 1 -type d | sort); do
cd $port
if [ -f PKGBUILD ]; then
. PKGBUILD
@ -138,7 +138,7 @@ for category in $*; do
buildstatus=1
fi
fi
d=`date +"[%b %d %H:%M]"`
d=$(date +"[%b %d %H:%M]")
echo -n "$d " >>$toplevel/build.log
case $buildstatus in
0) echo "$pkgname already built -- skipping" >>$toplevel/build.log ;;

View file

@ -17,9 +17,9 @@ pacman_SOURCES = util.c log.c package.c downloadprog.c trans.c add.c \
pacman_static_SOURCES = $(pacman_SOURCES)
pacman_LDADD = -L$(top_srcdir)/lib/libalpm/.libs \
-ldownload -lm -lalpm
-ldownload -lalpm
pacman_static_LDADD = -L$(top_srcdir)/lib/libalpm/.libs/ \
-ldownload -lm -lalpm
-ldownload -lalpm
pacman_static_LDFLAGS = $(LDFLAGS) -all-static

View file

@ -53,6 +53,9 @@ void log_progress(const char *filename, int xfered, int total)
{
static unsigned int lasthash = 0, mouth = 0;
unsigned int i, hash;
/* a little hard to conceal easter eggs in open-source software,
* but they're still fun. ;) */
const unsigned short chomp = alpm_option_get_chomp();
unsigned int chomp = 0;
char *fname, *p;
unsigned int maxcols = getcols();
@ -75,9 +78,6 @@ void log_progress(const char *filename, int xfered, int total)
return;
}
/* a little hard to conceal easter eggs in open-source software, but they're still fun. ;) */
chomp = alpm_option_get_chomp();
gettimeofday(&current_time, NULL);
total_timediff = current_time.tv_sec-initial_time.tv_sec
+ (float)(current_time.tv_usec-initial_time.tv_usec) / 1000000;

View file

@ -63,24 +63,24 @@ void dump_pkg_full(pmpkg_t *pkg, int level)
/* actual output */
printf(_("Name : %s\n"), (char *)alpm_pkg_get_name(pkg));
printf(_("Version : %s\n"), (char *)alpm_pkg_get_version(pkg));
list_display(_("Groups :"), alpm_pkg_get_groups(pkg));
printf(_("Packager : %s\n"), (char *)alpm_pkg_get_packager(pkg));
printf(_("URL : %s\n"), (char *)alpm_pkg_get_url(pkg));
list_display(_("License :"), alpm_pkg_get_licenses(pkg));
printf(_("Architecture : %s\n"), (char *)alpm_pkg_get_arch(pkg));
printf(_("Installed Size : %ld\n"), (long int)alpm_pkg_get_size(pkg));
printf(_("Build Date : %s %s\n"), bdate, strlen(bdate) ? "UTC" : "");
printf(_("Build Type : %s\n"), strlen(type) ? type : _("Unknown"));
/* TODO only applicable if querying installed package, not a file */
printf(_("Install Date : %s %s\n"), idate, strlen(idate) ? "UTC" : "");
printf(_("Install Script : %s\n"), alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"));
printf(_("Reason : %s\n"), reason);
list_display(_("Groups :"), alpm_pkg_get_groups(pkg));
list_display(_("Provides :"), alpm_pkg_get_provides(pkg));
list_display(_("Depends On :"), alpm_pkg_get_depends(pkg));
list_display(_("Removes :"), alpm_pkg_get_removes(pkg));
/* TODO only applicable if querying installed package, not a file */
list_display(_("Required By :"), alpm_pkg_get_requiredby(pkg));
list_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg));
printf(_("Installed Size : %ld K\n"), (long)alpm_pkg_get_size(pkg) / 1024);
printf(_("Packager : %s\n"), (char *)alpm_pkg_get_packager(pkg));
printf(_("Architecture : %s\n"), (char *)alpm_pkg_get_arch(pkg));
printf(_("Build Date : %s %s\n"), bdate, strlen(bdate) ? "UTC" : "");
printf(_("Build Type : %s\n"), strlen(type) ? type : _("Unknown"));
/* TODO only applicable if querying installed package, not a file */
printf(_("Install Date : %s %s\n"), idate, strlen(idate) ? "UTC" : "");
printf(_("Install Script : %s\n"), alpm_pkg_has_scriptlet(pkg) ? _("Yes") : _("No"));
printf(_("Reason : %s\n"), reason);
printf(_("Description : "));
indentprint(alpm_pkg_get_desc(pkg), 17);
@ -117,8 +117,8 @@ void dump_pkg_sync(pmpkg_t *pkg, const char *treename)
list_display(_("Removes :"), alpm_pkg_get_removes(pkg));
list_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg));
list_display(_("Replaces :"), alpm_pkg_get_replaces(pkg));
printf(_("Download Size : %ld\n"), (long)alpm_pkg_get_size(pkg));
printf(_("Installed Size : %ld\n"), (long)alpm_pkg_get_isize(pkg));
printf(_("Download Size : %6.2f K\n"), (float)alpm_pkg_get_size(pkg) / 1024.0);
printf(_("Installed Size : %6.2f K\n"), (float)alpm_pkg_get_isize(pkg) / 1024.0);
printf(_("Description : "));
indentprint(alpm_pkg_get_desc(pkg), 17);

View file

@ -121,8 +121,8 @@ static void usage(int op, char *myname)
printf(_("usage: %s {-Q --query} [options] [package]\n"), myname);
printf(_("options:\n"));
printf(_(" -c, --changelog view the changelog of a package\n"));
printf(_(" -e, --orphans list all packages that were installed as a dependency\n"));
printf(_(" and are not required by any other packages\n"));
printf(_(" -e, --orphans list all packages installed as dependencies but no longer\n"));
printf(_(" required by any package\n"));
printf(_(" -g, --groups view all members of a package group\n"));
printf(_(" -i, --info view package information\n"));
printf(_(" -l, --list list the contents of the queried package\n"));

View file

@ -28,6 +28,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2);
void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
void *data3, int *response);
/* callback to handle display of the progress bar for transactions */
void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent,
int howmany, int remain);

View file

@ -167,7 +167,7 @@ void indentprint(const char *str, unsigned int indent)
while(*p) {
if(*p == ' ') {
const char *next = NULL;
int len;
unsigned int len;
p++;
if(p == NULL || *p == ' ') continue;
next = strchr(p, ' ');