summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-01-26 02:13:16 +0000
committerAaron Griffin <aaron@archlinux.org>2007-01-26 02:13:16 +0000
commite22336673aca979e1e893b25b58e6d726fc739cf (patch)
tree33d6261dcb1801bfbdf7aafdc13fa6a5ee14da6b
parent7ffb1e5facd4121602e6fdd2eafd3c7f37ded446 (diff)
downloadpacman-e22336673aca979e1e893b25b58e6d726fc739cf.tar.xz
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
-rwxr-xr-xautoclean.sh1
-rw-r--r--configure.ac26
-rw-r--r--etc/pacman.d/Makefile.am1
-rw-r--r--lib/libalpm/Makefile.am2
-rw-r--r--lib/libalpm/alpm.c4
-rw-r--r--lib/libalpm/deps.c4
-rwxr-xr-xscripts/makeworld12
-rw-r--r--src/pacman/Makefile.am4
-rw-r--r--src/pacman/downloadprog.c6
-rw-r--r--src/pacman/package.c22
-rw-r--r--src/pacman/pacman.c4
-rw-r--r--src/pacman/trans.h1
-rw-r--r--src/pacman/util.c2
13 files changed, 42 insertions, 47 deletions
diff --git a/autoclean.sh b/autoclean.sh
index 16364519..a2708356 100755
--- a/autoclean.sh
+++ b/autoclean.sh
@@ -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
diff --git a/configure.ac b/configure.ac
index 86956226..2856e86a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
diff --git a/etc/pacman.d/Makefile.am b/etc/pacman.d/Makefile.am
index 2d39cac5..187c63f2 100644
--- a/etc/pacman.d/Makefile.am
+++ b/etc/pacman.d/Makefile.am
@@ -1,7 +1,6 @@
EXTRA_DIST = community current extra release unstable
clean:
- rm $(EXTRA_DIST)
install-data-hook:
mkdir -p $(DESTDIR)$(sysconfdir)/pacman.d ; \
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 77f092bb..688fd009 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -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
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 6bfaaada..3c06971e 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -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 {
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 3393f01f..607dd673 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -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 {
diff --git a/scripts/makeworld b/scripts/makeworld
index 9182680a..597e0b7a 100755
--- a/scripts/makeworld
+++ b/scripts/makeworld
@@ -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 ;;
diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am
index 0de2383e..02748628 100644
--- a/src/pacman/Makefile.am
+++ b/src/pacman/Makefile.am
@@ -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
diff --git a/src/pacman/downloadprog.c b/src/pacman/downloadprog.c
index ae9f2005..e7dc37f0 100644
--- a/src/pacman/downloadprog.c
+++ b/src/pacman/downloadprog.c
@@ -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;
diff --git a/src/pacman/package.c b/src/pacman/package.c
index fa5ae0f4..a2357dbe 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -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));
+ 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(_("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(_("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(_("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);
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 56dd5035..808d8ad1 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -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"));
diff --git a/src/pacman/trans.h b/src/pacman/trans.h
index 1e08dff6..6eb78358 100644
--- a/src/pacman/trans.h
+++ b/src/pacman/trans.h
@@ -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);
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 16f4c78a..01d0e65c 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -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, ' ');