[pacman-dev] CVS update of pacman-lib (13 files)

Aaron Griffin aaron at archlinux.org
Thu Jan 25 21:13:17 EST 2007


    Date: Thursday, January 25, 2007 @ 21:13:17
  Author: aaron
    Path: /home/cvs-pacman/pacman-lib

Modified: autoclean.sh (1.7 -> 1.8) configure.ac (1.22 -> 1.23)
          etc/pacman.d/Makefile.am (1.3 -> 1.4)
          lib/libalpm/Makefile.am (1.13 -> 1.14)
          lib/libalpm/alpm.c (1.105 -> 1.106)
          lib/libalpm/deps.c (1.58 -> 1.59) scripts/makeworld (1.5 -> 1.6)
          src/pacman/Makefile.am (1.11 -> 1.12)
          src/pacman/downloadprog.c (1.6 -> 1.7)
          src/pacman/package.c (1.23 -> 1.24)
          src/pacman/pacman.c (1.83 -> 1.84) src/pacman/trans.h (1.6 -> 1.7)
          src/pacman/util.c (1.23 -> 1.24)

Dan McGee <dpmcgee at 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


---------------------------+
 autoclean.sh              |    1 +
 configure.ac              |   26 ++++++++++----------------
 etc/pacman.d/Makefile.am  |    1 -
 lib/libalpm/Makefile.am   |    2 +-
 lib/libalpm/alpm.c        |    4 ++--
 lib/libalpm/deps.c        |    4 ++--
 scripts/makeworld         |   12 ++++++------
 src/pacman/Makefile.am    |    4 ++--
 src/pacman/downloadprog.c |    6 +++---
 src/pacman/package.c      |   22 +++++++++++-----------
 src/pacman/pacman.c       |    4 ++--
 src/pacman/trans.h        |    1 +
 src/pacman/util.c         |    2 +-
 13 files changed, 42 insertions(+), 47 deletions(-)


Index: pacman-lib/autoclean.sh
diff -u pacman-lib/autoclean.sh:1.7 pacman-lib/autoclean.sh:1.8
--- pacman-lib/autoclean.sh:1.7	Tue Dec 19 02:58:29 2006
+++ pacman-lib/autoclean.sh	Thu Jan 25 21:13:16 2007
@@ -36,6 +36,7 @@
 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
 
Index: pacman-lib/configure.ac
diff -u pacman-lib/configure.ac:1.22 pacman-lib/configure.ac:1.23
--- pacman-lib/configure.ac:1.22	Thu Jan 11 12:34:51 2007
+++ pacman-lib/configure.ac	Thu Jan 25 21:13:16 2007
@@ -147,7 +147,7 @@
 
 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 @@
 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 @@
 
 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"
Index: pacman-lib/etc/pacman.d/Makefile.am
diff -u pacman-lib/etc/pacman.d/Makefile.am:1.3 pacman-lib/etc/pacman.d/Makefile.am:1.4
--- pacman-lib/etc/pacman.d/Makefile.am:1.3	Tue Jan 16 22:40:09 2007
+++ pacman-lib/etc/pacman.d/Makefile.am	Thu Jan 25 21:13:16 2007
@@ -1,7 +1,6 @@
 EXTRA_DIST = community current extra release unstable
 
 clean:
-	rm $(EXTRA_DIST)
 
 install-data-hook:
 	mkdir -p $(DESTDIR)$(sysconfdir)/pacman.d ; \
Index: pacman-lib/lib/libalpm/Makefile.am
diff -u pacman-lib/lib/libalpm/Makefile.am:1.13 pacman-lib/lib/libalpm/Makefile.am:1.14
--- pacman-lib/lib/libalpm/Makefile.am:1.13	Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/Makefile.am	Thu Jan 25 21:13:16 2007
@@ -40,7 +40,7 @@
 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
Index: pacman-lib/lib/libalpm/alpm.c
diff -u pacman-lib/lib/libalpm/alpm.c:1.105 pacman-lib/lib/libalpm/alpm.c:1.106
--- pacman-lib/lib/libalpm/alpm.c:1.105	Tue Jan 23 22:02:54 2007
+++ pacman-lib/lib/libalpm/alpm.c	Thu Jan 25 21:13:16 2007
@@ -566,7 +566,7 @@
 	 * 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 @@
 						_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 {
Index: pacman-lib/lib/libalpm/deps.c
diff -u pacman-lib/lib/libalpm/deps.c:1.58 pacman-lib/lib/libalpm/deps.c:1.59
--- pacman-lib/lib/libalpm/deps.c:1.58	Tue Jan 23 22:02:54 2007
+++ pacman-lib/lib/libalpm/deps.c	Thu Jan 25 21:13:16 2007
@@ -249,9 +249,9 @@
 				}
 				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 {
Index: pacman-lib/scripts/makeworld
diff -u pacman-lib/scripts/makeworld:1.5 pacman-lib/scripts/makeworld:1.6
--- pacman-lib/scripts/makeworld:1.5	Wed Dec 20 20:53:41 2006
+++ pacman-lib/scripts/makeworld	Thu Jan 25 21:13:16 2007
@@ -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 @@
 
 # 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 @@
 					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 ;;
Index: pacman-lib/src/pacman/Makefile.am
diff -u pacman-lib/src/pacman/Makefile.am:1.11 pacman-lib/src/pacman/Makefile.am:1.12
--- pacman-lib/src/pacman/Makefile.am:1.11	Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/Makefile.am	Thu Jan 25 21:13:16 2007
@@ -17,9 +17,9 @@
 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
Index: pacman-lib/src/pacman/downloadprog.c
diff -u pacman-lib/src/pacman/downloadprog.c:1.6 pacman-lib/src/pacman/downloadprog.c:1.7
--- pacman-lib/src/pacman/downloadprog.c:1.6	Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/downloadprog.c	Thu Jan 25 21:13:16 2007
@@ -53,6 +53,9 @@
 {
 	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 @@
 		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;
Index: pacman-lib/src/pacman/package.c
diff -u pacman-lib/src/pacman/package.c:1.23 pacman-lib/src/pacman/package.c:1.24
--- pacman-lib/src/pacman/package.c:1.23	Mon Jan 22 03:52:18 2007
+++ pacman-lib/src/pacman/package.c	Thu Jan 25 21:13:16 2007
@@ -63,24 +63,24 @@
 	/* 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 @@
 	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);
Index: pacman-lib/src/pacman/pacman.c
diff -u pacman-lib/src/pacman/pacman.c:1.83 pacman-lib/src/pacman/pacman.c:1.84
--- pacman-lib/src/pacman/pacman.c:1.83	Wed Jan 24 11:57:19 2007
+++ pacman-lib/src/pacman/pacman.c	Thu Jan 25 21:13:16 2007
@@ -121,8 +121,8 @@
 			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"));
Index: pacman-lib/src/pacman/trans.h
diff -u pacman-lib/src/pacman/trans.h:1.6 pacman-lib/src/pacman/trans.h:1.7
--- pacman-lib/src/pacman/trans.h:1.6	Tue Jan 23 22:02:55 2007
+++ pacman-lib/src/pacman/trans.h	Thu Jan 25 21:13:16 2007
@@ -28,6 +28,7 @@
 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);
 
Index: pacman-lib/src/pacman/util.c
diff -u pacman-lib/src/pacman/util.c:1.23 pacman-lib/src/pacman/util.c:1.24
--- pacman-lib/src/pacman/util.c:1.23	Wed Jan 24 11:57:19 2007
+++ pacman-lib/src/pacman/util.c	Thu Jan 25 21:13:16 2007
@@ -167,7 +167,7 @@
 	while(*p) {
 		if(*p == ' ') {
 			const char *next = NULL;
-			int len;
+			unsigned int len;
 			p++;
 			if(p == NULL || *p == ' ') continue;
 			next = strchr(p, ' ');




More information about the pacman-dev mailing list