Pacman-dev
Threads by month
- ----- 2025 -----
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
January 2007
- 23 participants
- 104 discussions
[pacman-dev] CVS update of pacman-lib (etc/pacman.conf.in lib/libalpm/util.c)
by Aaron Griffin 26 Jan '07
by Aaron Griffin 26 Jan '07
26 Jan '07
Date: Thursday, January 25, 2007 @ 20:33:03
Author: aaron
Path: /home/cvs-pacman/pacman-lib
Modified: etc/pacman.conf.in (1.3 -> 1.4) lib/libalpm/util.c (1.40 -> 1.41)
* Fix FS #3107- Use ISO date style
* Fix FS #5409- document that pacman.conf repo ordering is important
Signed-off-by: Dan McGee <dpmcgee(a)gmail.com>
--------------------+
etc/pacman.conf.in | 4 +++-
lib/libalpm/util.c | 9 +++++----
2 files changed, 8 insertions(+), 5 deletions(-)
Index: pacman-lib/etc/pacman.conf.in
diff -u pacman-lib/etc/pacman.conf.in:1.3 pacman-lib/etc/pacman.conf.in:1.4
--- pacman-lib/etc/pacman.conf.in:1.3 Thu Dec 21 12:51:50 2006
+++ pacman-lib/etc/pacman.conf.in Thu Jan 25 20:33:03 2007
@@ -21,7 +21,9 @@
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
-
+# - repositories listed first will take precedence when packages
+# have identical names, regardless of version number
+#
#[testing]
#Server = ftp://ftp.archlinux.org/testing/os/i686
Index: pacman-lib/lib/libalpm/util.c
diff -u pacman-lib/lib/libalpm/util.c:1.40 pacman-lib/lib/libalpm/util.c:1.41
--- pacman-lib/lib/libalpm/util.c:1.40 Tue Jan 23 22:02:54 2007
+++ pacman-lib/lib/libalpm/util.c Thu Jan 25 20:33:03 2007
@@ -357,10 +357,11 @@
t = time(NULL);
tm = localtime(&t);
- fprintf(f, "[%02d/%02d/%02d %02d:%02d] %s\n",
- tm->tm_mon+1, tm->tm_mday, tm->tm_year-100,
- tm->tm_hour, tm->tm_min,
- str);
+ /* Use ISO-8601 date format */
+ fprintf(f, "[%04d-%02d-%02d %02d:%02d] %s\n",
+ tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, str);
+
fflush(f);
}
1
0
Date: Thursday, January 25, 2007 @ 20:26:09
Author: aaron
Path: /home/cvs-pacman/pacman-lib/scripts
Modified: makepkg (1.34 -> 1.35)
James Rosten <seinfeld90 at gmail.com>
* Use PKGDEST and SRCDEST from the environment (if defined) when calling makepkg
---------+
makepkg | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Index: pacman-lib/scripts/makepkg
diff -u pacman-lib/scripts/makepkg:1.34 pacman-lib/scripts/makepkg:1.35
--- pacman-lib/scripts/makepkg:1.34 Tue Jan 23 11:02:37 2007
+++ pacman-lib/scripts/makepkg Thu Jan 25 20:26:08 2007
@@ -27,7 +27,6 @@
myver='3.0.0'
startdir=$(pwd)
-PKGDEST=$startdir
BUILDSCRIPT="PKGBUILD"
PKGEXT="pkg.tar.gz"
@@ -314,6 +313,11 @@
ARGLIST=$@
+#preserve environment variables
+PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined
+_PKGDEST=${PKGDEST}
+_SRCDEST=$SRCDEST
+
#Source makepkg.conf; fail if it is not found
if [ -f /etc/makepkg.conf ]; then
source /etc/makepkg.conf
@@ -327,6 +331,10 @@
source ~/.makepkg.conf
fi
+# override settings with an environment variable for batch processing
+PKGDEST=${_PKGDEST:-$PKGDEST}
+SRCDEST=${_SRCDEST:-$SRCDEST}
+
while [ "$#" -ne "0" ]; do
case $1 in
# pacman
1
0
Someone with the proper permissions, I found these on the bugtracker
today and they seem to be old, outdated, or otherwise unnecessary:
FS#4036 — file can't recognize python 2.4 byte-code
- It can now
FS#5009 — pacman-optimize makes errnous fs assumptions
- Didn't Jaime fix this with his recent rewrite?
FS#5555 — pacman -Scc is slow
-Quote from bug report - "sorry that I couldn't come up with
something better, but I just had to get #5555 ;)"
-Good luck speeding it up- I think it just removes the directory
and recreates it
-Dan
2
1
[pacman-dev] [patch] Fix FS #3107 (Use ISO style dates), FS #5409 (document pacman.conf order is relevent)
by Dan McGee 25 Jan '07
by Dan McGee 25 Jan '07
25 Jan '07
* Fix FS #3107- Use ISO date style
* Fix FS #5409- document that pacman.conf repo ordering is important
Signed-off-by: Dan McGee <dpmcgee(a)gmail.com>
============================================================
--- doc/pacman.8.in 3143c0f4de3cd5ca7ddbf100690e91a8d3d7f7b6
+++ doc/pacman.8.in e9a8f44c7a2ced2b3594bd41a6f60dd1a026a144
@@ -305,6 +305,9 @@ shown above.
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
'file://' prefix, as
shown above.
+The order of repositories in the file matters; repositories listed first will
+take precidence over those listed later in the file when packages in two
+repositories have identical names, regardless of version number.
.SH USING YOUR OWN REPOSITORY
Let's say you have a bunch of custom packages in \fI/home/pkgs\fP and
their respective PKGBUILD
files are all in \fI/var/abs/local\fP. All you need to do is
generate a compressed package database
============================================================
--- etc/pacman.conf.in f0a4dc45658de05f03658969dc81136801736229
+++ etc/pacman.conf.in de8076ec76dd59832b10616c782e471e2d1d5ed7
@@ -21,6 +21,8 @@ HoldPkg = pacman glibc
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
+# - repositories listed first will take precedence when packages
+# have identical names, regardless of version number
#[testing]
#Server = ftp://ftp.archlinux.org/testing/os/i686
============================================================
--- lib/libalpm/util.c 1749c1006346422efcc2257de4ff96e74ebc9336
+++ lib/libalpm/util.c 0a2ce942c427b52148f0dfab02a3c3dd5cc15b67
@@ -357,10 +357,10 @@ int _alpm_logaction(unsigned short usesy
t = time(NULL);
tm = localtime(&t);
- fprintf(f, "[%02d/%02d/%02d %02d:%02d] %s\n",
- tm->tm_mon+1, tm->tm_mday, tm->tm_year-100,
- tm->tm_hour, tm->tm_min,
- str);
+ /* Use ISO-8601 date format */
+ fprintf(f, "[%04d-%02d-%02d %02d:%02d] %s\n",
+ tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, str);
fflush(f);
}
1
0
[pacman-dev] [psuedo-patch] First attempt at FS#3492 and fix a copy-paste error
by Dan McGee 25 Jan '07
by Dan McGee 25 Jan '07
25 Jan '07
If you are interested in fixing this bug, let me know. Otherwise I'm
going to put this on the back burner for a bit and hopefully get back
to it later. If you do want to work on it and have questions, shoot me
an email or talk to me on IRC when I'm on (as toofishes).
* start to fixing FS #3492, fixed typecasts, clarified actions,
added notes to code but not actual removal code that is
necessary, as I'm not sure what the best plan of action is.
* copy and paste error, "resolving deps" -> "cleaning up"
Signed-off-by: Dan McGee <dpmcgee(a)gmail.com>
#
# old_revision [8b849d94fb042fa6b42cad8ff6938fe27406dadb]
#
# patch "lib/libalpm/add.c"
# from [5340d7f7768bf9d8ec37b907a422350c510c8f39]
# to [2e8010675af78d63c5f57b2eb7c71b0f4a2db455]
#
# patch "src/pacman/trans.c"
# from [1f02954b56601d065e49e0c52c92e3af395c65fd]
# to [41d5b28cb0602a8b59368da1b5b3ef1874048af1]
#
============================================================
--- lib/libalpm/add.c 5340d7f7768bf9d8ec37b907a422350c510c8f39
+++ lib/libalpm/add.c 2e8010675af78d63c5f57b2eb7c71b0f4a2db455
@@ -210,10 +210,9 @@ error:
return(-1);
}
-
-static int name_cmp(const void *p1, const void *p2)
+static int pkg_cmp(const void *p1, const void *p2)
{
- return(strcmp(((pmpkg_t *)p1)->name, (const char *)p2));
+ return(strcmp(((pmdepmissing_t *)p1)->target, ((pmdepmissing_t
*)p2)->target));
}
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
@@ -253,11 +252,26 @@ int _alpm_add_prepare(pmtrans_t *trans,
/* Attempt to resolve conflicts */
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target,
miss->depend.name, NULL, &skip_this);
if(skip_this) {
- pmpkg_t **pkg = NULL;
- lp = alpm_list_remove(lp, (void *)miss->depend.name, name_cmp,
(void **)pkg);
- FREEPKG(*pkg);
+ pmdepmissing_t *pkg = NULL;
+ lp = alpm_list_remove(lp, (void *)miss, pkg_cmp, (void*)&pkg);
+ /* TODO: We remove the conflict from the list but never actually remove
+ * the package. Need to do this to fix FS #3492. The sync code should
+ * provide an example of how to do this, as it handles replaces and
+ * removes. We run into problems because we do a file conflict check
+ * below and it fails there. A force flag will skip that part, but
+ * still not remove the original package designated here for removal.
+ * Better yet, dump all this shitty duplicate code and somehow combine
+ * it with the sync code. */
+ FREE(pkg);
+ if(lp == NULL) {
+ break;
+ }
}
}
+ /* Removal code should go here, as described above. Instead of simply
+ * removing items, perhaps throw them in another list to be removed, then
+ * proceed as sync.c would? I'm not sure because I'm not familiar enough
+ * with the codebase. */
if(lp != NULL) {
if(data) {
*data = lp;
@@ -283,8 +297,10 @@ int _alpm_add_prepare(pmtrans_t *trans,
_alpm_log(PM_LOG_FLOW1, _("cleaning up"));
for (lp=trans->packages; lp!=NULL; lp=lp->next) {
info=(pmpkg_t *)lp->data;
+ fprintf(stderr, "package: %s %s\n", info->name, info->version); /* DEBUG */
for (rmlist=info->removes; rmlist!=NULL; rmlist=rmlist->next) {
snprintf(rm_fname, PATH_MAX, "%s%s", handle->root, (char *)rmlist->data);
+ fprintf(stderr, " removing %s\n", rm_fname); /* DEBUG */
remove(rm_fname);
}
}
============================================================
--- src/pacman/trans.c 1f02954b56601d065e49e0c52c92e3af395c65fd
+++ src/pacman/trans.c 41d5b28cb0602a8b59368da1b5b3ef1874048af1
@@ -60,7 +60,7 @@ void cb_trans_evt(pmtransevt_t event, vo
}
break;
case PM_TRANS_EVT_CLEANUP_START:
- pm_fprintf(stderr, NL, _("resolving dependencies... "));
+ pm_fprintf(stderr, NL, _("cleaning up... "));
break;
case PM_TRANS_EVT_RESOLVEDEPS_START:
pm_fprintf(stderr, NL, _("resolving dependencies... "));
1
0
Date: Wednesday, January 24, 2007 @ 03:51:51
Author: aaron
Path: /home/cvs-pacman/pacman-lib
Added: config.rpath (1.1)
Modified: .cvsignore (1.2 -> 1.3) TODO.aaron (1.9 -> 1.10)
lib/libalpm/alpm_list.c (1.3 -> 1.4)
lib/libalpm/alpm_list.h (1.1 -> 1.2)
lib/libalpm/be_files.c (1.21 -> 1.22)
lib/libalpm/cache.c (1.26 -> 1.27)
lib/libalpm/package.c (1.50 -> 1.51)
src/pacman/add.c (1.24 -> 1.25) src/pacman/deptest.c (1.11 -> 1.12)
src/pacman/log.c (1.23 -> 1.24) src/pacman/query.c (1.18 -> 1.19)
src/pacman/remove.c (1.24 -> 1.25) src/pacman/sync.c (1.98 -> 1.99)
* Shuffled some of the alpm_list free funtions - still not perfect, but better
* Added alpm_list_remove_node for single list node removal
* Proper error checking/output for failed db_read/db_write (missing files)
* Invalid packages (missing files) are now removed from the package cache
* -Qs and -Ss output now look the same
* config.rpath causes errors on one machine I had, so I added it to CVS
* Fixed a "clobbered memory" issue when installing groups - only the outer list
should be free'd, not the contained data
-------------------------+
.cvsignore | 1
TODO.aaron | 3
config.rpath | 614 ++++++++++++++++++++++++++++++++++++++++++++++
lib/libalpm/alpm_list.c | 55 +++-
lib/libalpm/alpm_list.h | 13
lib/libalpm/be_files.c | 23 -
lib/libalpm/cache.c | 9
lib/libalpm/package.c | 3
src/pacman/add.c | 2
src/pacman/deptest.c | 4
src/pacman/log.c | 6
src/pacman/query.c | 17 -
src/pacman/remove.c | 2
src/pacman/sync.c | 11
14 files changed, 710 insertions(+), 53 deletions(-)
Index: pacman-lib/.cvsignore
diff -u pacman-lib/.cvsignore:1.2 pacman-lib/.cvsignore:1.3
--- pacman-lib/.cvsignore:1.2 Tue Jan 16 22:40:08 2007
+++ pacman-lib/.cvsignore Wed Jan 24 03:51:50 2007
@@ -9,7 +9,6 @@
config.log
config.status
config.sub
-config.rpath
configure
depcomp
install-sh
Index: pacman-lib/TODO.aaron
diff -u pacman-lib/TODO.aaron:1.9 pacman-lib/TODO.aaron:1.10
--- pacman-lib/TODO.aaron:1.9 Fri Jan 19 12:42:58 2007
+++ pacman-lib/TODO.aaron Wed Jan 24 03:51:50 2007
@@ -22,6 +22,9 @@
- maybe it's my fault, but I see little difference between PM_LOG_FLOW1,
PM_LOG_FLOW2, and PM_LOG_DEBUG. We might want to just do away with flow1
and flow2 and use debug across the board.
+ - clear up list allocation/deallocation - some lists need to be free'd, some
+ do not and there is no clear indication WHEN this should happen.
+ - remove DB entries (directories) on a read error?
* pacman: A LOT of functions are way too long. There should be an upper limit of
100-200 lines. _alpm_add_commit is around 600 lines, and is far too complex.
Index: pacman-lib/config.rpath
diff -u /dev/null pacman-lib/config.rpath:1.1
--- /dev/null Wed Jan 24 03:51:51 2007
+++ pacman-lib/config.rpath Wed Jan 24 03:51:50 2007
@@ -0,0 +1,614 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+# Copyright 1996-2006 Free Software Foundation, Inc.
+# Taken from GNU libtool, 2001
+# Originally by Gordon Matzigkeit <gord(a)gnu.ai.mit.edu>, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+# than 256 bytes, otherwise the compiler driver will dump core. The only
+# known workaround is to choose shorter directory names for the build
+# directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+ wl='-Wl,'
+else
+ case "$host_os" in
+ aix*)
+ wl='-Wl,'
+ ;;
+ darwin*)
+ case $cc_basename in
+ xlc*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ mingw* | pw32* | os2*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ wl='-Wl,'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ wl='-Wl,'
+ ;;
+ newsos6)
+ ;;
+ linux*)
+ case $cc_basename in
+ icc* | ecc*)
+ wl='-Wl,'
+ ;;
+ pgcc | pgf77 | pgf90)
+ wl='-Wl,'
+ ;;
+ ccc*)
+ wl='-Wl,'
+ ;;
+ como)
+ wl='-lopt='
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ osf3* | osf4* | osf5*)
+ wl='-Wl,'
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ wl='-Wl,'
+ ;;
+ sunos4*)
+ wl='-Qoption ld '
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ wl='-Wl,'
+ ;;
+ sysv4*MP*)
+ ;;
+ unicos*)
+ wl='-Wl,'
+ ;;
+ uts4*)
+ ;;
+ esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ # Unlike libtool, we use -rpath here, not --rpath, since the documented
+ # option of GNU ld is called -rpath, not --rpath.
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ case "$host_os" in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # Samuel A. Falvo II <kc5tja(a)dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we cannot use
+ # them.
+ ld_shlibs=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ cygwin* | mingw* | pw32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ interix3*)
+ hardcode_direct=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ linux*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ netbsd*)
+ ;;
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+ sunos4*)
+ hardcode_direct=yes
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ if test "$ld_shlibs" = no; then
+ hardcode_libdir_flag_spec=
+ fi
+else
+ case "$host_os" in
+ aix3*)
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ else
+ aix_use_runtimelinking=no
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+ fi
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ fi
+ # Begin _LT_AC_SYS_LIBPATH_AIX.
+ echo 'int main () { return 0; }' > conftest.c
+ ${CC} ${LDFLAGS} conftest.c -o conftest
+ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ fi
+ if test -z "$aix_libpath"; then
+ aix_libpath="/usr/lib:/lib"
+ fi
+ rm -f conftest.c conftest
+ # End _LT_AC_SYS_LIBPATH_AIX.
+ if test "$aix_use_runtimelinking" = yes; then
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ fi
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+ bsdi[45]*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ libext=lib
+ ;;
+ darwin* | rhapsody*)
+ hardcode_direct=no
+ if test "$GCC" = yes ; then
+ :
+ else
+ case $cc_basename in
+ xlc*)
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+ dgux*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+ freebsd2.2*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ freebsd2*)
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ hpux10*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+ hpux11*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ ;;
+ *)
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+ irix5* | irix6* | nonstopux*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ netbsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ newsos6)
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ openbsd*)
+ hardcode_direct=yes
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ else
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ osf3*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ osf4* | osf5*)
+ if test "$GCC" = yes; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ # Both cc and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+ solaris*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ sunos4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ hardcode_direct=no
+ ;;
+ motorola)
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ ;;
+ sysv4.3*)
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ ld_shlibs=yes
+ fi
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator=':'
+ ;;
+ uts4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+libname_spec='lib$name'
+case "$host_os" in
+ aix3*)
+ ;;
+ aix4* | aix5*)
+ ;;
+ amigaos*)
+ ;;
+ beos*)
+ ;;
+ bsdi[45]*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ shrext=.dll
+ ;;
+ darwin* | rhapsody*)
+ shrext=.dylib
+ ;;
+ dgux*)
+ ;;
+ freebsd1*)
+ ;;
+ kfreebsd*-gnu)
+ ;;
+ freebsd* | dragonfly*)
+ ;;
+ gnu*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $host_cpu in
+ ia64*)
+ shrext=.so
+ ;;
+ hppa*64*)
+ shrext=.sl
+ ;;
+ *)
+ shrext=.sl
+ ;;
+ esac
+ ;;
+ interix3*)
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case "$host_os" in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+ *) libsuff= shlibsuff= ;;
+ esac
+ ;;
+ esac
+ ;;
+ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+ linux*)
+ ;;
+ knetbsd*-gnu)
+ ;;
+ netbsd*)
+ ;;
+ newsos6)
+ ;;
+ nto-qnx*)
+ ;;
+ openbsd*)
+ ;;
+ os2*)
+ libname_spec='$name'
+ shrext=.dll
+ ;;
+ osf3* | osf4* | osf5*)
+ ;;
+ solaris*)
+ ;;
+ sunos4*)
+ ;;
+ sysv4 | sysv4.3*)
+ ;;
+ sysv4*MP*)
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ ;;
+ uts4*)
+ ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
Index: pacman-lib/lib/libalpm/alpm_list.c
diff -u pacman-lib/lib/libalpm/alpm_list.c:1.3 pacman-lib/lib/libalpm/alpm_list.c:1.4
--- pacman-lib/lib/libalpm/alpm_list.c:1.3 Mon Jan 22 20:34:58 2007
+++ pacman-lib/lib/libalpm/alpm_list.c Wed Jan 24 03:51:51 2007
@@ -49,33 +49,37 @@
return(list);
}
-/** Free a list structure and possibly the internal data as well
+/** Free a list, but not the contained data
* @param list the list to free
- * @param fn a free function for the internal data, or NULL for none
*/
-void alpm_list_free(alpm_list_t *list, alpm_list_fn_free fn)
+void alpm_list_free(alpm_list_t *list)
{
alpm_list_t *it = list;
while(it) {
- alpm_list_t *ptr = it->next;
- if(fn && it->data) {
- fn(it->data);
- }
- FREE(it);
- it = ptr;
+ alpm_list_t *tmp = it->next;
+ free(it);
+ it = tmp;
}
}
-/** Free the outer list, but not the contained data
- * A minor simplification of alpm_list_free
+/** Free the internal data of a list structure
* @param list the list to free
+ * @param fn a free function for the internal data
*/
-void alpm_list_free_outer(alpm_list_t *list)
+void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn)
{
- alpm_list_free(list, NULL);
+ alpm_list_t *it = list;
+
+ while(it) {
+ if(fn && it->data) {
+ fn(it->data);
+ }
+ it = it->next;
+ }
}
+
/* Mutators */
/** Add a new item to the list
@@ -271,6 +275,31 @@
return(haystack);
}
+/** Remove the passed in node from the list that it is a part of
+ * @note this DOES NOT free the node
+ * @param node the list node we're removing
+ * @return the node which took the place of this one
+ */
+alpm_list_t *alpm_list_remove_node(alpm_list_t *node)
+{
+ if(!node) return(NULL);
+
+ alpm_list_t *ret = NULL;
+
+ if(node->prev) {
+ node->prev->next = node->next;
+ ret = node->prev;
+ node->prev = NULL;
+ }
+ if(node->next) {
+ node->next->prev = node->prev;
+ ret = node->next;
+ node->next = NULL;
+ }
+
+ return(ret);
+}
+
/** Create a new list without any duplicates
* @note DOES NOT copy data members
* @param list the list to copy
Index: pacman-lib/lib/libalpm/alpm_list.h
diff -u pacman-lib/lib/libalpm/alpm_list.h:1.1 pacman-lib/lib/libalpm/alpm_list.h:1.2
--- pacman-lib/lib/libalpm/alpm_list.h:1.1 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/alpm_list.h Wed Jan 24 03:51:51 2007
@@ -30,18 +30,18 @@
struct __alpm_list_t *next;
};
-/* TODO we should do away with these... they're messy */
-#define _FREELIST(p, f) do { if(p) { alpm_list_free(p, f); p = NULL; } } while(0)
-#define FREELIST(p) _FREELIST(p, free)
-#define FREELISTPTR(p) _FREELIST(p, NULL)
+/* TODO we should do away with these... they're messy*/
+#define _FREELIST(p, f) do { alpm_list_free_inner(p, f); alpm_list_free(p); p = NULL; } while(0)
+#define FREELIST(p) _FREELIST(p, free)
+#define FREELISTPTR(p) do { alpm_list_free(p); p = NULL; } while(0)
typedef void (*alpm_list_fn_free)(void *); /* item deallocation callback */
typedef int (*alpm_list_fn_cmp)(const void *, const void *); /* item comparison callback */
/* allocation */
alpm_list_t *alpm_list_new(void);
-void alpm_list_free(alpm_list_t *list, alpm_list_fn_free fn);
-void alpm_list_free_outer(alpm_list_t *list);
+void alpm_list_free(alpm_list_t *list);
+void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn);
/* item mutators */
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
@@ -49,6 +49,7 @@
alpm_list_t* alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
alpm_list_t* alpm_list_msort(alpm_list_t *list, int n, alpm_list_fn_cmp fn);
alpm_list_t *alpm_list_remove(alpm_list_t *haystack, void *needle, alpm_list_fn_cmp fn, void **data);
+alpm_list_t *alpm_list_remove_node(alpm_list_t *node);
alpm_list_t *alpm_list_remove_dupes(alpm_list_t *list);
alpm_list_t *alpm_list_strdup(alpm_list_t *list);
alpm_list_t *alpm_list_reverse(alpm_list_t *list);
Index: pacman-lib/lib/libalpm/be_files.c
diff -u pacman-lib/lib/libalpm/be_files.c:1.21 pacman-lib/lib/libalpm/be_files.c:1.22
--- pacman-lib/lib/libalpm/be_files.c:1.21 Tue Jan 23 22:02:54 2007
+++ pacman-lib/lib/libalpm/be_files.c Wed Jan 24 03:51:51 2007
@@ -217,9 +217,8 @@
/* DESC */
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
- fp = fopen(path, "r");
- if(fp == NULL) {
- _alpm_log(PM_LOG_DEBUG, "%s (%s)", path, strerror(errno));
+ if((fp = fopen(path, "r")) == NULL) {
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
@@ -362,9 +361,8 @@
/* FILES */
if(inforeq & INFRQ_FILES) {
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
- fp = fopen(path, "r");
- if(fp == NULL) {
- _alpm_log(PM_LOG_WARNING, "%s (%s)", path, strerror(errno));
+ if((fp = fopen(path, "r")) == NULL) {
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
goto error;
}
while(fgets(line, 256, fp)) {
@@ -386,9 +384,8 @@
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
- fp = fopen(path, "r");
- if(fp == NULL) {
- _alpm_log(PM_LOG_WARNING, "%s (%s)", path, strerror(errno));
+ if((fp = fopen(path, "r")) == NULL) {
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
@@ -474,8 +471,8 @@
_alpm_log(PM_LOG_DEBUG, _("writing %s-%s DESC information back to db"), info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/desc"), db->treename);
- retval = 1;
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
+ retval = -1;
goto cleanup;
}
fprintf(fp, "%%NAME%%\n%s\n\n"
@@ -560,7 +557,7 @@
_alpm_log(PM_LOG_DEBUG, _("writing %s-%s FILES information back to db"), info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/files"), db->treename);
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
retval = -1;
goto cleanup;
}
@@ -587,7 +584,7 @@
_alpm_log(PM_LOG_DEBUG, _("writing %s-%s DEPENDS information back to db"), info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("db_write: could not open file %s/depends"), db->treename);
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
retval = -1;
goto cleanup;
}
Index: pacman-lib/lib/libalpm/cache.c
diff -u pacman-lib/lib/libalpm/cache.c:1.26 pacman-lib/lib/libalpm/cache.c:1.27
--- pacman-lib/lib/libalpm/cache.c:1.26 Tue Jan 23 22:02:54 2007
+++ pacman-lib/lib/libalpm/cache.c Wed Jan 24 03:51:51 2007
@@ -112,8 +112,13 @@
for(p = db->pkgcache; p; p = p->next) {
pmpkg_t *pkg = (pmpkg_t *)p->data;
if(infolevel != INFRQ_NONE && !(pkg->infolevel & infolevel)) {
- _alpm_db_read(db, infolevel, pkg);
- reloaded = 1;
+ if(_alpm_db_read(db, infolevel, pkg) == -1) {
+ _alpm_log(PM_LOG_ERROR, _("failed to read package '%s-%s', removing from package cache"),
+ pkg->name, pkg->version);
+ p = alpm_list_remove_node(p);
+ } else {
+ reloaded = 1;
+ }
}
}
if(reloaded) {
Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.50 pacman-lib/lib/libalpm/package.c:1.51
--- pacman-lib/lib/libalpm/package.c:1.50 Tue Jan 23 22:02:54 2007
+++ pacman-lib/lib/libalpm/package.c Wed Jan 24 03:51:51 2007
@@ -29,6 +29,7 @@
#include <string.h>
#include <libintl.h>
#include <locale.h>
+#include <errno.h>
/* pacman */
#include "log.h"
#include "util.h"
@@ -136,7 +137,7 @@
int linenum = 0;
if((fp = fopen(descfile, "r")) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not open file %s"), descfile);
+ _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), descfile, strerror(errno));
return(-1);
}
Index: pacman-lib/src/pacman/add.c
diff -u pacman-lib/src/pacman/add.c:1.24 pacman-lib/src/pacman/add.c:1.25
--- pacman-lib/src/pacman/add.c:1.24 Tue Jan 23 22:02:55 2007
+++ pacman-lib/src/pacman/add.c Wed Jan 24 03:51:51 2007
@@ -167,7 +167,7 @@
cleanup:
if(data) {
- alpm_list_free(data, NULL);
+ alpm_list_free(data);
}
if(alpm_trans_release() == -1) {
ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
Index: pacman-lib/src/pacman/deptest.c
diff -u pacman-lib/src/pacman/deptest.c:1.11 pacman-lib/src/pacman/deptest.c:1.12
--- pacman-lib/src/pacman/deptest.c:1.11 Tue Jan 23 22:02:55 2007
+++ pacman-lib/src/pacman/deptest.c Wed Jan 24 03:51:51 2007
@@ -130,7 +130,7 @@
}
synctargs = alpm_list_add(synctargs, strdup(alpm_dep_get_name(miss)));
}
- alpm_list_free(data, NULL);
+ alpm_list_free(data);
break;
case PM_ERR_CONFLICTING_DEPS:
/* we can't auto-resolve conflicts */
@@ -139,7 +139,7 @@
MSG(NL, _("conflict: %s"), alpm_dep_get_name(miss));
}
retval = 127;
- alpm_list_free(data, NULL);
+ alpm_list_free(data);
break;
default:
retval = 127;
Index: pacman-lib/src/pacman/log.c
diff -u pacman-lib/src/pacman/log.c:1.23 pacman-lib/src/pacman/log.c:1.24
--- pacman-lib/src/pacman/log.c:1.23 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/log.c Wed Jan 24 03:51:51 2007
@@ -192,12 +192,14 @@
pch--;
}
*++pch = 0;
- strtrim(response);
+ if(strlen(response) != 0) {
+ strtrim(response);
+ }
/* User hits 'enter', forcing a newline here */
neednl = 0;
- if(!strcasecmp(response, _("Y")) || !strcasecmp(response, _("YES")) || !strlen(response)) {
+ if(!strcasecmp(response, _("Y")) || !strcasecmp(response, _("YES")) || strlen(response) == 0) {
return(1);
}
}
Index: pacman-lib/src/pacman/query.c
diff -u pacman-lib/src/pacman/query.c:1.18 pacman-lib/src/pacman/query.c:1.19
--- pacman-lib/src/pacman/query.c:1.18 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/query.c Wed Jan 24 03:51:51 2007
@@ -98,16 +98,23 @@
return(1);
}
for(i = ret; i; i = alpm_list_next(i)) {
+ char *group = NULL;
+ alpm_list_t *grp;
pmpkg_t *pkg = alpm_list_getdata(i);
- printf("local/%s/%s %s\n ",
- (char *)alpm_list_getdata(alpm_pkg_get_groups(pkg)),
- alpm_pkg_get_name(pkg),
- alpm_pkg_get_version(pkg));
+ printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
+
+ if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
+ group = alpm_list_getdata(grp);
+ printf(" (%s)\n ", (char *)alpm_list_getdata(grp));
+ } else {
+ printf("\n ");
+ }
+
indentprint(alpm_pkg_get_desc(pkg), 4);
printf("\n");
}
- alpm_list_free_outer(ret);
+ alpm_list_free(ret);
return(0);
}
Index: pacman-lib/src/pacman/remove.c
diff -u pacman-lib/src/pacman/remove.c:1.24 pacman-lib/src/pacman/remove.c:1.25
--- pacman-lib/src/pacman/remove.c:1.24 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/remove.c Wed Jan 24 03:51:51 2007
@@ -103,7 +103,7 @@
MSG(NL, _(":: %s is required by %s\n"), alpm_dep_get_target(miss),
alpm_dep_get_name(miss));
}
- alpm_list_free(data, NULL);
+ alpm_list_free(data);
break;
default:
break;
Index: pacman-lib/src/pacman/sync.c
diff -u pacman-lib/src/pacman/sync.c:1.98 pacman-lib/src/pacman/sync.c:1.99
--- pacman-lib/src/pacman/sync.c:1.98 Tue Jan 23 22:02:55 2007
+++ pacman-lib/src/pacman/sync.c Wed Jan 24 03:51:51 2007
@@ -265,7 +265,7 @@
indentprint(alpm_pkg_get_desc(pkg), 4);
printf("\n\n");
}
- alpm_list_free_outer(ret);
+ alpm_list_free(ret);
} else {
for(j = alpm_db_getpkgcache(db); j; j = alpm_list_next(j)) {
pmpkg_t *pkg = alpm_list_getdata(j);
@@ -375,7 +375,7 @@
if(db == NULL) {
ERR(NL, _("repository \"%s\" was not found.\n"),repo);
- FREELISTPTR(ls);
+ alpm_list_free(ls);
return(1);
}
@@ -395,7 +395,7 @@
}
if(targets) {
- FREELISTPTR(ls);
+ alpm_list_free(ls);
}
return(0);
@@ -541,7 +541,7 @@
}
}
}
- FREELIST(pkgs);
+ alpm_list_free(pkgs);
}
}
if(!found) {
@@ -756,8 +756,7 @@
*/
cleanup:
if(data) {
- alpm_list_free(data, NULL);
- data = NULL;
+ alpm_list_free(data);
}
if(alpm_trans_release() == -1) {
ERR(NL, _("failed to release transaction (%s)\n"), alpm_strerror(pm_errno));
5
7
[pacman-dev] CVS update of pacman-lib/src/pacman (log.c pacman.c util.c)
by Aaron Griffin 24 Jan '07
by Aaron Griffin 24 Jan '07
24 Jan '07
Date: Wednesday, January 24, 2007 @ 11:57:19
Author: aaron
Path: /home/cvs-pacman/pacman-lib/src/pacman
Modified: log.c (1.24 -> 1.25) pacman.c (1.82 -> 1.83) util.c (1.22 -> 1.23)
Cleanup 'neednl' usage - make it static
----------+
log.c | 2 +-
pacman.c | 18 +++---------------
util.c | 1 -
3 files changed, 4 insertions(+), 17 deletions(-)
Index: pacman-lib/src/pacman/log.c
diff -u pacman-lib/src/pacman/log.c:1.24 pacman-lib/src/pacman/log.c:1.25
--- pacman-lib/src/pacman/log.c:1.24 Wed Jan 24 03:51:51 2007
+++ pacman-lib/src/pacman/log.c Wed Jan 24 11:57:19 2007
@@ -37,7 +37,7 @@
extern config_t *config;
-int neednl = 0; /* for cleaner message output */
+static int neednl = 0; /* for cleaner message output */
static int needpad = 0; /* pad blanks to terminal width */
/* simple helper for needpad */
Index: pacman-lib/src/pacman/pacman.c
diff -u pacman-lib/src/pacman/pacman.c:1.82 pacman-lib/src/pacman/pacman.c:1.83
--- pacman-lib/src/pacman/pacman.c:1.82 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/pacman.c Wed Jan 24 11:57:19 2007
@@ -78,8 +78,6 @@
/* list of targets specified on command line */
static alpm_list_t *pm_targets;
-extern int neednl;
-
/* Display usage/syntax for the specified operation.
* op: the operation code requested
* myname: basename(argv[0])
@@ -197,14 +195,8 @@
FREELIST(pm_targets);
FREECONF(config);
- if(neednl) {
- putchar('\n');
- }
-
- /* restore the cursor
- printf("\033[?25h\033[?0c");
- fflush(stdout);
- */
+ /* This fixes up any missing newlines (neednl) */
+ MSG(NL, "");
exit(signum);
}
@@ -407,10 +399,6 @@
signal(SIGTERM, cleanup);
signal(SIGSEGV, cleanup);
- /* hide the cursor, prevent flicker during fancy graphics
- printf("\033[?25l\033[?1c");
- */
-
/* i18n init */
lang=getenv("LC_ALL");
if(lang==NULL || lang[0]=='\0')
@@ -419,7 +407,7 @@
lang=getenv("LANG");
setlocale(LC_ALL, lang);
- // workaround for tr_TR
+ /* workaround for tr_TR */
if(lang && !strcmp(lang, "tr_TR"))
setlocale(LC_CTYPE, "C");
bindtextdomain("pacman", "/usr/share/locale");
Index: pacman-lib/src/pacman/util.c
diff -u pacman-lib/src/pacman/util.c:1.22 pacman-lib/src/pacman/util.c:1.23
--- pacman-lib/src/pacman/util.c:1.22 Fri Jan 19 04:28:47 2007
+++ pacman-lib/src/pacman/util.c Wed Jan 24 11:57:19 2007
@@ -49,7 +49,6 @@
#include "log.h"
extern config_t *config;
-extern int neednl;
/* gets the current screen column width */
unsigned int getcols()
1
0
I've made a few changes in my side branch that I've been maintaining
and wanted to see if anything here is good enough to be put on the
main line. I have the patch below and a comment or two before each
individual file diff explaining what I changed and why. Search for ***
to find my added comments.
-Dan
****These files should be removed here and not by make, since they are
created by configure, not make.
============================================================
--- autoclean.sh 1924ab94d4748bd719b6d05c3c9754e0ef6e5dc5
+++ autoclean.sh f01e101d3eda8c4a5719702b7c73ac288dd7be57
@@ -36,6 +36,7 @@ rm -rf etc/pacman.d/Makefile
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
***Got rid of spurious spaces, cleaned up library checking code-- if
we don't have math, archive, or download, we can't build, and we don't
need to include them here, only in the specific directories they are
used.
============================================================
--- configure.ac 8358b1c0036a631a10901e015f2a3625c370863b
+++ configure.ac 4945cc3d67c50784681ee7de5301976c8fcafcd4
@@ -147,7 +147,7 @@ AC_ARG_ENABLE(debug,
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 @@ dnl Check for math
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 @@ AC_MSG_CHECKING(for debug mode request)
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"
***As stated above, these shouldn't be removed by the makefile.
============================================================
--- etc/pacman.d/Makefile.am 840cb3c81402c99b85ac891ca9aa6ea73c9a6665
+++ etc/pacman.d/Makefile.am 6ed630aed49de51817151acf1039130ca0f4186b
@@ -1,7 +1,6 @@ clean:
EXTRA_DIST = community current extra release unstable
clean:
- rm $(EXTRA_DIST)
install-data-hook:
mkdir -p $(DESTDIR)$(sysconfdir)/pacman.d ; \
***Include math library here where needed.
============================================================
--- lib/libalpm/Makefile.am 3c32b7ed489cabd115bb7d62d895513102f9723e
+++ lib/libalpm/Makefile.am 7e25d2b6af9cc5f0fbfb808e84c4cf06c31abfdd
@@ -40,7 +40,7 @@ libalpm_la_LDFLAGS = -no-undefined -vers
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
***Two minor typing changes, probably not real necessary.
============================================================
--- lib/libalpm/alpm.c 4a523ffcb264a38c24b6c192702e7c6e437518f0
+++ lib/libalpm/alpm.c c21f46f9408260ed9ffb15cfa98a167ef0d4aec5
@@ -566,7 +566,7 @@ char *alpm_pkg_name_hasarch(char *pkgnam
* 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_c
_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 {
***Refactor square root so it is only called once.
============================================================
--- lib/libalpm/deps.c 600ed931f1f4e65ee5d87065d81cd0d17d34857d
+++ lib/libalpm/deps.c dc04f286046eefcb489b10bab01ded162c357e82
@@ -106,6 +106,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_
int change = 1;
int numscans = 0;
int numtargs = 0;
+ int maxscans;
if(targets == NULL) {
return(NULL);
@@ -116,15 +117,14 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_
numtargs++;
}
+ /* calculate this here so we aren't doing it each loop */
+ maxscans = (int)sqrt(numtargs);
+
_alpm_log(PM_LOG_DEBUG, _("started sorting dependencies"));
while(change) {
alpm_list_t *tmptargs = NULL;
change = 0;
- /* TODO only use of a math.h function in entire libalpm,
- * can we get rid of it? Former code line:
- *if(numscans > numtargs) {
- */
- if(numscans > sqrt(numtargs)) {
+ if(numscans > maxscans) {
_alpm_log(PM_LOG_DEBUG, _("possible dependency cycle detected"));
continue;
}
@@ -321,9 +321,9 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *
/* else if still not found... */
if(!found) {
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as a dependency for %s"),
- depend.name, tp->name);
+ depend.name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod,
- depend.name, depend.version);
+ depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
***Just quick updates to script- update version number, convert `` to $().
============================================================
--- scripts/makeworld 3295e2dacc2a9c6e391f6fc76ee591c95a887744
+++ scripts/makeworld b341ff0d4176b487df69da2bc015890263a42910
@@ -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 @@ cd $dest
# 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 ;;
@@ -148,7 +148,7 @@ done
fi
done
done
-ed=`date +"[%b %d %H:%M]"`
+ed=$(date +"[%b %d %H:%M]")
echo "makeworld complete." >>$toplevel/build.log
echo " started: $sd" >>$toplevel/build.log
***With some changes below, no longer need math library on frontend.
Be sure to sanity check my changes below, however.
============================================================
--- src/pacman/Makefile.am 4f082673b275a96c909b442bf3bcff121bc00d33
+++ src/pacman/Makefile.am 54351cf1782dd3d0e8fedf766250f7a77145b1c3
@@ -17,9 +17,9 @@ pacman_LDADD = -L$(top_srcdir)/lib/libal
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
***Changed type to match return type and moved it up to variable declaration.
============================================================
--- src/pacman/downloadprog.c 7d676cc84c01eff241f7b3abbf8eca9e7d45b1dc
+++ src/pacman/downloadprog.c 3fbd45421973235cdb2e5b000ca17735f9a4f0d6
@@ -53,7 +53,9 @@ void log_progress(const char *filename,
{
static unsigned int lasthash = 0, mouth = 0;
unsigned int i, hash;
- unsigned int chomp = 0;
+ /* a little hard to conceal easter eggs in open-source software,
+ * but they're still fun. ;) */
+ const unsigned short chomp = alpm_option_get_chomp();
char *fname, *p;
unsigned int maxcols = getcols();
unsigned int progresslen = maxcols - 57;
@@ -75,9 +77,6 @@ void log_progress(const char *filename,
return;
}
- /* a little hard to conceal easter eggs in open-source software, but
they're still fun. ;) */
- chomp = alpm_option_get_chomp();
-
gettimeofday(¤t_time, NULL);
total_timediff = current_time.tv_sec-initial_time.tv_sec
+ (float)(current_time.tv_usec-initial_time.tv_usec) / 1000000;
***Reorder options so pacman -Qi and pacman -Si output are much more
similar (to the extent they can be). Also, print sizes using kilobytes
instead of bytes.
============================================================
--- src/pacman/package.c 83c565ab5f2ce16c6029730312e3fc36e0fc5a34
+++ src/pacman/package.c 6843843535db726227361a3955a1ee4f0e7c413b
@@ -63,24 +63,25 @@ void dump_pkg_full(pmpkg_t *pkg, int lev
/* actual output */
printf(_("Name : %s\n"), (char *)alpm_pkg_get_name(pkg));
printf(_("Version : %s\n"), (char *)alpm_pkg_get_version(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(_("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(_("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 +118,8 @@ void dump_pkg_sync(pmpkg_t *pkg, const c
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 : %ld K\n"), (long)alpm_pkg_get_size(pkg) / 1024);
+ printf(_("Installed Size : %ld K\n"), (long)alpm_pkg_get_isize(pkg) / 1024);
printf(_("Description : "));
indentprint(alpm_pkg_get_desc(pkg), 17);
***Reword a usage instruction.
============================================================
--- src/pacman/pacman.c 1b006c77745dc36301ee96f5dfc4ce231124342f
+++ src/pacman/pacman.c 7894fabbf4e27e17090dbecb8235ffcfbf60210e
@@ -123,8 +123,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"
+ " 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"));
***Remove use of math.h by making assumptions about the possible range
of the former log10 call. As long as we are installing <1000 packages
(a reasonable assumption?), this new code works fine.
***Refactor two functions out to allow better variable declaration
(closer to where they are actually used, and not initialized if
unused). fill_progress might also be applicable now in the other
status bar display (downloadprog, I believe).
***Fix indenting of a switch statement.
============================================================
--- src/pacman/trans.c 1f02954b56601d065e49e0c52c92e3af395c65fd
+++ src/pacman/trans.c 7ea136c95d81f51115ff6bab946917be89a71b13
@@ -26,7 +26,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
-#include <math.h>
#include <libintl.h>
#include <alpm.h>
@@ -42,13 +41,84 @@ static int prevpercent=0; /* for less pr
static int prevpercent=0; /* for less progressbar output */
+/* static function declarations */
+static void retrieve_local(void *data1, void *data2);
+static void fill_progress(int percent);
+
+/* refactored function from below because of variable declaration */
+static void retrieve_local(void *data1, void *data2)
+{
+ const unsigned int maxcols = getcols();
+ char out[PATH_MAX];
+ unsigned int i;
+
+ MSG(NL, " %s [", (char*)data1);
+ STRNCPY(out, (char*)data2, maxcols-42);
+ MSG(CL, "%s", out);
+ for(i = strlen(out); i < maxcols-43; i++) {
+ MSG(CL, " ");
+ }
+ fputs(_("] 100% LOCAL "), stdout);
+}
+
+/* refactored from below to make variable declaration cleaner */
+static void fill_progress(int percent)
+{
+ const unsigned short chomp = alpm_option_get_chomp();
+ const unsigned int progresslen = getcols() - 57;
+ const unsigned int hash = percent * progresslen / 100;
+ unsigned int lasthash = 0, mouth = 0;
+ unsigned int i;
+
+ /* hide the cursor, prevent flicker during fancy graphics
+ printf("\033[?25l\033[?1c[");
+ */
+ printf("[");
+ for(i = progresslen; i > 1; --i) {
+ /* if special progress bar enabled */
+ if(chomp) {
+ if(i > progresslen - hash) {
+ printf("-");
+ } else if(i == progresslen - hash) {
+ if(lasthash == hash) {
+ if(mouth) {
+ printf("\033[1;33mC\033[m");
+ } else {
+ printf("\033[1;33mc\033[m");
+ }
+ } else {
+ lasthash = hash;
+ mouth = mouth == 1 ? 0 : 1;
+ if(mouth) {
+ printf("\033[1;33mC\033[m");
+ } else {
+ printf("\033[1;33mc\033[m");
+ }
+ }
+ } else if(i%3 == 0) {
+ printf("\033[0;37mo\033[m");
+ } else {
+ printf("\033[0;37m \033[m");
+ }
+ } /* else regular progress bar */
+ else if(i > progresslen - hash) {
+ printf("#");
+ } else {
+ printf("-");
+ }
+ }
+ printf("] %3d%%\r", percent);
+
+ if(percent == 100) {
+ printf("\n");
+ }
+}
+
/* Callback to handle transaction events
*/
void cb_trans_evt(pmtransevt_t event, void *data1, void *data2)
{
char str[LOG_STR_LEN] = "";
- char out[PATH_MAX];
- int i;
switch(event) {
case PM_TRANS_EVT_CHECKDEPS_START:
@@ -155,14 +225,7 @@ void cb_trans_evt(pmtransevt_t event, vo
fflush(stdout);
break;
case PM_TRANS_EVT_RETRIEVE_LOCAL:
- MSG(NL, " %s [", (char*)data1);
- unsigned int maxcols = getcols();
- STRNCPY(out, (char*)data2, maxcols-42);
- MSG(CL, "%s", out);
- for(i = strlen(out); i < maxcols-43; i++) {
- MSG(CL, " ");
- }
- fputs(_("] 100% LOCAL "), stdout);
+ retrieve_local(data1, data2);
break;
}
}
@@ -289,11 +352,14 @@ void cb_trans_progress(pmtransprog_t eve
void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent,
int howmany, int remain)
{
- static int lasthash = 0, mouth = 0;
- int i, hash;
- long chomp = 0;
- unsigned int maxcols = getcols();
- unsigned int maxpkglen, progresslen = maxcols - 57;
+ /* these 3 vars determine size of the howmany/remaining packages counter
+ * change from log10 allows elimination of math library from front end
+ * former code: log10(howmany) or log10(remain)
+ * current code: identical to above as long as value < 1000 */
+ const int digitshm= howmany < 10 ? 1 : (howmany < 100 ? 2 : 3);
+ const int digitsr = remain < 10 ? 1 : (remain < 100 ? 2 : 3);
+ unsigned int maxpkglen;
+ int i;
char *ptr = NULL;
if(config->noprogressbar) {
@@ -306,12 +372,8 @@ void cb_trans_progress(pmtransprog_t eve
set_output_padding(0); /* shut it off again */
}
- if (!pkgname)
+ if (!pkgname || percent > 100 || percent == prevpercent)
return;
- if (percent > 100)
- return;
- if(percent == prevpercent)
- return;
prevpercent=percent;
switch (event) {
@@ -331,78 +393,38 @@ void cb_trans_progress(pmtransprog_t eve
ptr = _("checking for file conflicts");
break;
}
- hash=percent*progresslen/100;
- // if the package name is too long, then slice the ending
- maxpkglen=46-strlen(ptr)-(3+2*(int)log10(howmany));
- if(strlen(pkgname)>maxpkglen)
- pkgname[maxpkglen]='\0';
+ maxpkglen = 46 - strlen(ptr) - (3 + 2 * digitshm);
+ /* if the package name is too long, then slice the ending */
+ if(strlen(pkgname) > maxpkglen)
+ pkgname[maxpkglen] = '\0';
+
switch (event) {
- case PM_TRANS_PROGRESS_ADD_START:
- case PM_TRANS_PROGRESS_UPGRADE_START:
- case PM_TRANS_PROGRESS_REMOVE_START:
- putchar('(');
- for(i=0;i<(int)log10(howmany)-(int)log10(remain);i++)
- putchar(' ');
- printf("%d/%d) %s %s ", remain, howmany, ptr, pkgname);
- if (strlen(pkgname)<maxpkglen)
- for (i=maxpkglen-strlen(pkgname)-1; i>0; i--)
+ case PM_TRANS_PROGRESS_ADD_START:
+ case PM_TRANS_PROGRESS_UPGRADE_START:
+ case PM_TRANS_PROGRESS_REMOVE_START:
+ putchar('(');
+ for(i = 0;i < digitshm - digitsr; i++)
putchar(' ');
- break;
+ printf("%d/%d) %s %s ", remain, howmany, ptr, pkgname);
+ if (strlen(pkgname) < maxpkglen)
+ for (i = maxpkglen - strlen(pkgname) - 1; i > 0; i--)
+ putchar(' ');
+ break;
- case PM_TRANS_PROGRESS_CONFLICTS_START:
- printf("%s (", ptr);
- for(i=0;i<(int)log10(howmany)-(int)log10(remain);i++)
- putchar(' ');
- printf("%d/%d) ", remain, howmany);
- for (i=maxpkglen; i>0; i--)
- putchar(' ');
- break;
- }
+ case PM_TRANS_PROGRESS_CONFLICTS_START:
+ printf("%s (", ptr);
+ for(i = 0; i < digitshm - digitsr; i++)
+ putchar(' ');
+ printf("%d/%d) ", remain, howmany);
+ for (i = maxpkglen; i > 0; i--)
+ putchar(' ');
+ break;
- chomp = alpm_option_get_chomp();
-
- /* hide the cursor, prevent flicker during fancy graphics
- printf("\033[?25l\033[?1c[");
- */
- printf("[");
- for(i = progresslen; i > 0; --i) {
- if(chomp) {
- if(i > progresslen - hash) {
- printf("-");
- } else if(i == progresslen - hash) {
- if(lasthash == hash) {
- if(mouth) {
- printf("\033[1;33mC\033[m");
- } else {
- printf("\033[1;33mc\033[m");
- }
- } else {
- lasthash = hash;
- mouth = mouth == 1 ? 0 : 1;
- if(mouth) {
- printf("\033[1;33mC\033[m");
- } else {
- printf("\033[1;33mc\033[m");
- }
- }
- } else if(i%3 == 0) {
- printf("\033[0;37mo\033[m");
- } else {
- printf("\033[0;37m \033[m");
- }
- } else if(i > progresslen - hash) {
- printf("#");
- } else {
- printf("-");
- }
}
- printf("] %3d%%\r", percent);
- if(percent == 100) {
- printf("\n");
- }
+ fill_progress(percent);
}
/* vim: set ts=2 sw=2 noet: */
***Add a missing comment.
============================================================
--- src/pacman/trans.h 4d7d7f9b948979d070bcc648027c26b73c7732d3
+++ src/pacman/trans.h 1fd2c160d34e607571f0829820c924f6179f8193
@@ -28,6 +28,7 @@ void cb_trans_conv(pmtransconv_t event,
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);
***Slight type change to match where it is used.
============================================================
--- src/pacman/util.c c553258df09eae12fbdd31a68295c1e47097a030
+++ src/pacman/util.c f30c0a9ab665739c13b47bb33b44e086c88c3783
@@ -168,7 +168,7 @@ void indentprint(const char *str, unsign
while(*p) {
if(*p == ' ') {
const char *next = NULL;
- int len;
+ unsigned int len;
p++;
if(p == NULL || *p == ' ') continue;
next = strchr(p, ' ');
1
0
Hi,
I tried to clean up lib/libalpm/util.[ch]. It's not yet complete, I
would like to have some comments on it first.
Some notes:
There has to be a proper way handling out-of-memory. The lib
can't do anything anymore without memory - am I right?
_alpm_runscriptlet is really long and I'm going to split it.
So, here goes the patch:
Signed-off-by: Johannes Weiner <hannes(a)saeurebad.de>
diff -Naur pacman-lib.old/lib/libalpm/util.c pacman-lib/lib/libalpm/util.c
--- pacman-lib.old/lib/libalpm/util.c 2007-01-24 16:09:16.000000000 +0100
+++ pacman-lib/lib/libalpm/util.c 2007-01-24 16:10:13.000000000 +0100
@@ -64,9 +64,49 @@
#include "package.h"
#include "alpm.h"
+/* Memory allocation frontends with return value check.
+ * TODO: Think about an elegant way to die on failure */
+static void *safe_mem(void *r)
+{
+ if (r) {
+ return (r);
+ }
+
+ _alpm_log(PM_LOG_ERROR, "Memory exhausted.\n");
+
+ /* TODO: This is probably the wrong way */
+ alpm_release();
+ exit(2);
+}
+
+void *pmalloc(size_t s)
+{
+ return (safe_mem(malloc(s)));
+}
+
+void *pcalloc(size_t e, size_t s)
+{
+ return (safe_mem(calloc(e, s)));
+}
+
+void *prealloc(void *p, size_t s)
+{
+ return (safe_mem(realloc(p, s)));
+}
+
+char *pstrdup(const char *s)
+{
+ return (safe_mem((char *) strdup(s)));
+}
+
+void *palloca(size_t s)
+{
+ return (safe_mem(alloca(s)));
+}
+
#ifdef __sun__
/* This is a replacement for strsep which is not portable (missing on Solaris).
- * Copyright (c) 2001 by François Gouget <fgouget_at_codeweavers.com> */
+ * Copyright (c) 2001 by Fran�ois Gouget <fgouget_at_codeweavers.com> */
char* strsep(char** str, const char* delims)
{
char* token;
@@ -92,13 +132,12 @@
/* Backported from Solaris Express 4/06
* Copyright (c) 2006 Sun Microsystems, Inc. */
-char * mkdtemp(char *template)
+char * mkdtemp(const char *template)
{
- char *t = alloca(strlen(template) + 1);
- char *r;
+ char *r, *t = palloca(strlen(template) + 1);
/* Save template */
- (void) strcpy(t, template);
+ strcpy(t, template);
for (; ; ) {
r = mktemp(template);
@@ -113,7 +152,7 @@
return (NULL);
/* Reset template */
- (void) strcpy(template, t);
+ strcpy(template, t);
}
}
#endif
@@ -121,14 +160,16 @@
/* does the same thing as 'mkdir -p' */
int _alpm_makepath(char *path)
{
- char *orig, *str, *ptr;
- char full[PATH_MAX] = "";
mode_t oldmask;
+ char *orig, *str, *ptr, full[PATH_MAX];
oldmask = umask(0000);
- orig = strdup(path);
+ memset(full, 0, sizeof(full));
+
+ orig = pstrdup(path);
str = orig;
+
while((ptr = strsep(&str, "/"))) {
if(strlen(ptr)) {
struct stat buf;
@@ -149,32 +190,46 @@
return(0);
}
-int _alpm_copyfile(char *src, char *dest)
+int _alpm_copyfile(const char *src, const char *dest)
{
- FILE *in, *out;
- size_t len;
- char buf[4097];
+ FILE *fp;
+ char *buf;
+ struct stat sbuf;
- in = fopen(src, "r");
- if(in == NULL) {
+ if (stat(src, &sbuf)) {
return(1);
}
- out = fopen(dest, "w");
- if(out == NULL) {
- fclose(in);
+
+ if (!(fp = fopen(src, "r"))) {
return(1);
}
- while((len = fread(buf, 1, 4096, in))) {
- fwrite(buf, 1, len, out);
+ buf = pmalloc(sbuf.st_size);
+
+ if (fread(buf, sbuf.st_size, 1, fp) != 1) {
+ FREE(buf);
+ return(1);
+ }
+
+ fclose(fp);
+
+ if (!(fp = fopen(dest, "w"))) {
+ FREE(buf);
+ return(1);
+ }
+
+ if (fwrite(buf, sbuf.st_size, 1, fp) != 1) {
+ FREE(buf);
+ fclose(fp);
+ return(1);
}
- fclose(in);
- fclose(out);
+ FREE(buf);
+ fclose(fp);
return(0);
}
-/* Convert a string to uppercase
+/* Convert a string to uppercase destructively
*/
char *_alpm_strtoupper(char *str)
{
@@ -187,7 +242,7 @@
return str;
}
-/* Trim whitespace and newlines from a string
+/* Trim whitespace and newlines from a string destructively
*/
char *_alpm_strtrim(char *str)
{
@@ -210,8 +265,8 @@
return(str);
}
- pch = (char *)(str + (strlen(str) - 1));
- while(isspace((int)*pch)) {
+ pch = (str + (strlen(str) - 1));
+ while(isspace(*pch)) {
pch--;
}
*++pch = '\0';
@@ -221,35 +276,36 @@
/* Create a lock file
*/
-int _alpm_lckmk(char *file)
+int _alpm_lckmk(const char *file)
{
int fd, count = 0;
char *dir, *ptr;
/* create the dir of the lockfile first */
- dir = strdup(file);
+ dir = pstrdup(file);
ptr = strrchr(dir, '/');
if(ptr) {
*ptr = '\0';
}
_alpm_makepath(dir);
- while((fd = open(file, O_WRONLY | O_CREAT | O_EXCL, 0000)) == -1 && errno == EACCES) {
+ while((fd = open(file, O_WRONLY | O_CREAT | O_EXCL, 0000) == -1) &&
+ (errno == EACCES)) {
if(++count < 1) {
sleep(1);
- } else {
+ } else {
return(-1);
}
}
- free(dir);
+ FREE(dir);
return(fd > 0 ? fd : -1);
}
/* Remove a lock file
*/
-int _alpm_lckrm(char *file)
+int _alpm_lckrm(const char *file)
{
if(unlink(file) == -1 && errno != ENOENT) {
return(-1);
@@ -272,8 +328,12 @@
archive_read_support_compression_all(_archive);
archive_read_support_format_all(_archive);
- if(archive_read_open_file(_archive, archive, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
- _alpm_log(PM_LOG_ERROR, _("could not open %s: %s\n"), archive, archive_error_string(_archive));
+ if(archive_read_open_file(_archive,
+ archive,
+ ARCHIVE_DEFAULT_BYTES_PER_BLOCK)
+ != ARCHIVE_OK) {
+ _alpm_log(PM_LOG_ERROR, _("could not open %s: %s\n"), archive,
+ archive_error_string(_archive));
RET_ERR(PM_ERR_PKG_OPEN, -1);
}
@@ -283,10 +343,18 @@
return(1);
continue;
}
- snprintf(expath, PATH_MAX, "%s/%s", prefix, archive_entry_pathname(entry));
+
+ snprintf(expath, PATH_MAX, "%s/%s", prefix,
+ archive_entry_pathname(entry));
archive_entry_set_pathname(entry, expath);
- if(archive_read_extract(_archive, entry, ARCHIVE_EXTRACT_FLAGS) != ARCHIVE_OK) {
- _alpm_log(PM_LOG_ERROR, _("could not extract %s: %s\n"), archive_entry_pathname(entry), archive_error_string(_archive));
+
+ if(archive_read_extract(_archive,
+ entry,
+ ARCHIVE_EXTRACT_FLAGS)
+ != ARCHIVE_OK) {
+ _alpm_log(PM_LOG_ERROR, _("could not extract %s: %s\n"),
+ archive_entry_pathname(entry),
+ archive_error_string(_archive));
return(1);
}
@@ -300,49 +368,53 @@
}
/* does the same thing as 'rm -rf' */
-int _alpm_rmrf(char *path)
+int _alpm_rmrf(const char *path)
{
int errflag = 0;
struct dirent *dp;
DIR *dirp;
char name[PATH_MAX];
- struct stat st;
+ struct stat st;
- if(stat(path, &st) == 0) {
- if(S_ISREG(st.st_mode)) {
- if(!unlink(path)) {
- return(0);
- } else {
- if(errno == ENOENT) {
- return(0);
- } else {
- /* not a directory */
- return(1);
- }
- }
- } else if(S_ISDIR(st.st_mode)) {
- if((dirp = opendir(path)) == (DIR *)-1) {
- return(1);
- }
- for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
- if(dp->d_ino) {
- sprintf(name, "%s/%s", path, dp->d_name);
- if(strcmp(dp->d_name, "..") && strcmp(dp->d_name, ".")) {
- errflag += _alpm_rmrf(name);
- }
+ if(stat(path, &st)) {
+ return(0);
+ }
+
+ if(S_ISREG(st.st_mode)) {
+ if(!unlink(path)) {
+ return(0);
+ }
+
+ if(errno == ENOENT) {
+ return(0);
+ } else {
+ /* not a directory */
+ return(1);
+ }
+ } else if(S_ISDIR(st.st_mode)) {
+ if(!(dirp = opendir(path))) {
+ return(1);
+ }
+ for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
+ if(dp->d_ino) {
+ sprintf(name, "%s/%s", path, dp->d_name);
+ if(strcmp(dp->d_name, "..") &&
+ strcmp(dp->d_name, ".")) {
+ errflag += _alpm_rmrf(name);
}
}
- closedir(dirp);
- if(rmdir(path)) {
- errflag++;
- }
}
- return(errflag);
+ closedir(dirp);
+
+ if(rmdir(path)) {
+ errflag++;
+ }
}
- return(0);
+
+ return(errflag);
}
-int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *str)
+int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str)
{
_alpm_log(PM_LOG_DEBUG, _("logaction called: %s"), str);
@@ -387,37 +459,39 @@
/* A cheap grep for text files, returns 1 if a substring
* was found in the text file fn, 0 if it wasn't
+ *
+ * TODO: Remove hardcoded buffersize
*/
static int grep(const char *fn, const char *needle)
{
FILE *fp;
+ char line[1024];
if((fp = fopen(fn, "r")) == NULL) {
return(0);
}
- while(!feof(fp)) {
- char line[1024];
- fgets(line, 1024, fp);
- if(feof(fp)) {
- continue;
- }
+
+ while(fgets(line, 1024, fp)) {
if(strstr(line, needle)) {
fclose(fp);
return(1);
}
}
+
fclose(fp);
return(0);
}
-int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, char *oldver, pmtrans_t *trans)
+/*
+ * TODO: This function is WAY too complex and long!!!
+ */
+int _alpm_runscriptlet(const char *root, const char *installfn,
+ const char *script, const char *ver,
+ const char *oldver, pmtrans_t *trans)
{
- char scriptfn[PATH_MAX];
- char cmdline[PATH_MAX];
- char tmpdir[PATH_MAX] = "";
- char *scriptpath;
+ char scriptfn[PATH_MAX], cmdline[PATH_MAX], tmpdir[PATH_MAX];
+ char *scriptpath, cwd[PATH_MAX] = "";
struct stat buf;
- char cwd[PATH_MAX] = "";
pid_t pid;
int retval = 0;
@@ -433,7 +507,8 @@
}
snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root);
if(mkdtemp(tmpdir) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not create temp directory"));
+ _alpm_log(PM_LOG_ERROR,
+ _("could not create temp directory"));
return(1);
}
_alpm_unpack(installfn, tmpdir, ".INSTALL");
@@ -453,14 +528,18 @@
/* save the cwd so we can restore it later */
if(getcwd(cwd, PATH_MAX) == NULL) {
- _alpm_log(PM_LOG_ERROR, _("could not get current working directory"));
- /* in case of error, cwd content is undefined: so we set it to something */
+ _alpm_log(PM_LOG_ERROR,
+ _("could not get current working directory"));
+ /* in case of error, cwd content is undefined:
+ * so we set it to something */
cwd[0] = 0;
}
/* just in case our cwd was removed in the upgrade operation */
if(chdir(root) != 0) {
- _alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)"), root, strerror(errno));
+ _alpm_log(PM_LOG_ERROR,
+ _("could not change directory to %s (%s)"),
+ root, strerror(errno));
}
_alpm_log(PM_LOG_FLOW2, _("executing %s script..."), script);
@@ -476,52 +555,70 @@
pid = fork();
if(pid == -1) {
- _alpm_log(PM_LOG_ERROR, _("could not fork a new process (%s)"), strerror(errno));
+ _alpm_log(PM_LOG_ERROR,
+ _("could not fork a new process (%s)"),
+ strerror(errno));
retval = 1;
goto cleanup;
}
if(pid == 0) {
FILE *pp;
+ char line[1024];
_alpm_log(PM_LOG_DEBUG, _("chrooting in %s"), root);
if(chroot(root) != 0) {
- _alpm_log(PM_LOG_ERROR, _("could not change the root directory (%s)"), strerror(errno));
+ _alpm_log(PM_LOG_ERROR,
+ _("could not change the root directory (%s)"),
+ strerror(errno));
return(1);
}
if(chdir("/") != 0) {
- _alpm_log(PM_LOG_ERROR, _("could not change directory to / (%s)"), strerror(errno));
+ _alpm_log(PM_LOG_ERROR,
+ _("could not change directory to / (%s)"),
+ strerror(errno));
return(1);
}
umask(0022);
_alpm_log(PM_LOG_DEBUG, _("executing \"%s\""), cmdline);
pp = popen(cmdline, "r");
if(!pp) {
- _alpm_log(PM_LOG_ERROR, _("call to popen failed (%s)"), strerror(errno));
+ _alpm_log(PM_LOG_ERROR,
+ _("call to popen failed (%s)"),
+ strerror(errno));
retval = 1;
goto cleanup;
}
- while(!feof(pp)) {
- char line[1024];
- if(fgets(line, 1024, pp) == NULL)
- break;
+ while(fgets(line, 1024, pp)) {
+ size_t slen, dlen;
+ slen = strlen(SCRIPTLET_START);
+ dlen = strlen(SCRIPTLET_DONE);
+
/* "START <event desc>" */
- if((strlen(line) > strlen(SCRIPTLET_START)) && !strncmp(line, SCRIPTLET_START, strlen(SCRIPTLET_START))) {
- EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START, _alpm_strtrim(line + strlen(SCRIPTLET_START)), NULL);
+ if((strlen(line) > slen) &&
+ !strncmp(line, SCRIPTLET_START, slen)) {
+ EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START,
+ _alpm_strtrim(line + slen), NULL);
/* "DONE <ret code>" */
- } else if((strlen(line) > strlen(SCRIPTLET_DONE)) && !strncmp(line, SCRIPTLET_DONE, strlen(SCRIPTLET_DONE))) {
- EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE, (void*)atol(_alpm_strtrim(line + strlen(SCRIPTLET_DONE))), NULL);
+ } else if((strlen(line) > dlen) &&
+ !strncmp(line, SCRIPTLET_DONE, dlen)) {
+ EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE,
+ (void *)atol(_alpm_strtrim(line + dlen)),
+ NULL);
} else {
_alpm_strtrim(line);
/* log our script output */
alpm_logaction(line);
- EVENT(trans, PM_TRANS_EVT_SCRIPTLET_INFO, line, NULL);
+ EVENT(trans, PM_TRANS_EVT_SCRIPTLET_INFO,
+ line, NULL);
}
}
pclose(pp);
exit(0);
} else {
if(waitpid(pid, 0, 0) == -1) {
- _alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)"), strerror(errno));
+ _alpm_log(PM_LOG_ERROR,
+ _("call to waitpid failed (%s)"),
+ strerror(errno));
retval = 1;
goto cleanup;
}
@@ -529,14 +626,16 @@
cleanup:
if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) {
- _alpm_log(PM_LOG_WARNING, _("could not remove tmpdir %s"), tmpdir);
+ _alpm_log(PM_LOG_WARNING,
+ _("could not remove tmpdir %s"),
+ tmpdir);
}
if(strlen(cwd)) {
chdir(cwd);
}
return(retval);
-}
+} /* Thank goddess, I'm through. */
#ifndef __sun__
static long long get_freespace()
@@ -584,23 +683,16 @@
}
}
freespace = get_freespace();
- _alpm_log(PM_LOG_DEBUG, _("check_freespace: total pkg size: %lld, disk space: %lld"), pkgsize, freespace);
+ _alpm_log(PM_LOG_DEBUG,
+ _("check_freespace: total pkg size: %lld, disk space: %lld"),
+ pkgsize, freespace);
if(pkgsize > freespace) {
if(data) {
- long long *ptr;
- if((ptr = (long long*)malloc(sizeof(long long)))==NULL) {
- _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long));
- pm_errno = PM_ERR_MEMORY;
- return(-1);
- }
+ long long *ptr = pmalloc(sizeof(long long));
*ptr = pkgsize;
*data = alpm_list_add(*data, ptr);
- if((ptr = (long long*)malloc(sizeof(long long)))==NULL) {
- _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(long long));
- FREELIST(*data);
- pm_errno = PM_ERR_MEMORY;
- return(-1);
- }
+
+ ptr = pmalloc(sizeof(long long));
*ptr = freespace;
*data = alpm_list_add(*data, ptr);
}
@@ -621,8 +713,8 @@
struct tm *lt;
lt = localtime(&t);
sprintf(buffer, "%4d%02d%02d%02d%02d%02d",
- lt->tm_year+1900, lt->tm_mon+1, lt->tm_mday,
- lt->tm_hour, lt->tm_min, lt->tm_sec);
+ lt->tm_year+1900, lt->tm_mon+1, lt->tm_mday,
+ lt->tm_hour, lt->tm_min, lt->tm_sec);
buffer[14] = '\0';
}
}
diff -Naur pacman-lib.old/lib/libalpm/util.h pacman-lib/lib/libalpm/util.h
--- pacman-lib.old/lib/libalpm/util.h 2007-01-24 16:09:16.000000000 +0100
+++ pacman-lib/lib/libalpm/util.h 2007-01-24 16:10:13.000000000 +0100
@@ -43,7 +43,9 @@
s1[(len)-1] = 0; \
} while(0)
-#define ARCHIVE_EXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_TIME
+#define ARCHIVE_EXTRACT_FLAGS (ARCHIVE_EXTRACT_OWNER \
+ | ARCHIVE_EXTRACT_PERM \
+ | ARCHIVE_EXTRACT_TIME)
#ifdef ENABLE_NLS
#define _(str) dgettext ("libalpm", str)
@@ -54,18 +56,25 @@
#define SCRIPTLET_START "START "
#define SCRIPTLET_DONE "DONE "
+void *pmalloc(size_t s);
+void *pcalloc(size_t e, size_t s);
+void *prealloc(void *p, size_t s);
+char *pstrdup(const char *s);
+void *palloca(size_t s);
int _alpm_makepath(char *path);
-int _alpm_copyfile(char *src, char *dest);
+int _alpm_copyfile(const char *src, const char *dest);
char *_alpm_strtoupper(char *str);
char *_alpm_strtrim(char *str);
-int _alpm_lckmk(char *file);
-int _alpm_lckrm(char *file);
+int _alpm_lckmk(const char *file);
+int _alpm_lckrm(const char *file);
int _alpm_unpack(const char *archive, const char *prefix, const char *fn);
-int _alpm_rmrf(char *path);
-int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *str);
+int _alpm_rmrf(const char *path);
+int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str);
int _alpm_ldconfig(char *root);
#ifdef _ALPM_TRANS_H
-int _alpm_runscriptlet(char *util, char *installfn, char *script, char *ver, char *oldver, pmtrans_t *trans);
+int _alpm_runscriptlet(const char *util, const char *installfn,
+ const char *script, const char *ver,
+ const char *oldver, pmtrans_t *trans);
#ifndef __sun__
int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data);
#endif
2
1
So, there's been a handful of changes recently. Most have been code
cleanup, but there were some performance improvements and all that
jazz too.
New RC has pkgrel 5 and is here: http://archlinux.org/~aaron/pacman/
In case you haven't been following, this DOES install side-by-side
with the existing pacman. You should have nothing to fear (except
fear itself?)
For the record, this has a changelog in it now, so if you install it
with pacman3 you can then pacman3 -Qc pacman-rc to see the changelog
(currently, abysmally empty - I suck at documentation).
If you guys can, please please test this out.
Here are the pending bugs still:
http://bugs.archlinux.org/index.php?cat=6&type=1
I'd like to get the "Critical" and "High" ones complete and pushed out
of there before giving this URL to the masses (soon, I swear it this
time!) for better testing. All-in-all, I'd like to have nothing but
"Low" / "Very Low" (excepting Feature Requests) before pushing this
out.
Thanks everyone, and special thanks to all the new contributors. We
currently have 5 people stepping up to the plate and helping out with
this, which is great, and highly appreciated.
7
18