Pacman-dev
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 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
- 2 participants
- 7318 discussions
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
I'm just curious why the -w argument was removed from makepkg? It
apparently was removed in rev 1.23:
http://cvs.archlinux.org/cgi-bin/viewcvs.cgi/scripts/makepkg.diff?r1=1.22&r…
I know that aurbuild is currently making use of it, for example.
Scott
7
18
Date: Tuesday, January 23, 2007 @ 22:02:55
Author: aaron
Path: /home/cvs-pacman/pacman-lib
Modified: lib/libalpm/add.c (1.102 -> 1.103)
lib/libalpm/alpm.c (1.104 -> 1.105)
lib/libalpm/alpm.h (1.66 -> 1.67)
lib/libalpm/be_files.c (1.20 -> 1.21)
lib/libalpm/cache.c (1.25 -> 1.26)
lib/libalpm/cache.h (1.9 -> 1.10)
lib/libalpm/conflict.c (1.30 -> 1.31)
lib/libalpm/conflict.h (1.10 -> 1.11)
lib/libalpm/db.c (1.55 -> 1.56) lib/libalpm/db.h (1.22 -> 1.23)
lib/libalpm/deps.c (1.57 -> 1.58) lib/libalpm/deps.h (1.16 -> 1.17)
lib/libalpm/handle.c (1.27 -> 1.28)
lib/libalpm/handle.h (1.13 -> 1.14) lib/libalpm/log.c (1.8 -> 1.9)
lib/libalpm/log.h (1.7 -> 1.8) lib/libalpm/package.c (1.49 -> 1.50)
lib/libalpm/package.h (1.23 -> 1.24)
lib/libalpm/sync.c (1.91 -> 1.92) lib/libalpm/sync.h (1.16 -> 1.17)
lib/libalpm/trans.c (1.30 -> 1.31)
lib/libalpm/trans.h (1.21 -> 1.22)
lib/libalpm/util.c (1.39 -> 1.40) lib/libalpm/util.h (1.18 -> 1.19)
lib/libalpm/versioncmp.c (1.8 -> 1.9)
src/pacman/add.c (1.23 -> 1.24) src/pacman/deptest.c (1.10 -> 1.11)
src/pacman/sync.c (1.97 -> 1.98) src/pacman/trans.c (1.27 -> 1.28)
src/pacman/trans.h (1.5 -> 1.6)
This mainly deals with code clarity- removing currently unneeded
optimizations in order to make the code much more readable and
type-checkable. Every enum in the library now has it's own type that
should be used instead of the generic 'unsigned char'. In addition,
several #define statements dealing with constants were converted to
enums.
Signed-off-by: Dan McGee <dpmcgee(a)gmail.com>
--------------------------+
lib/libalpm/add.c | 2
lib/libalpm/alpm.c | 6 +-
lib/libalpm/alpm.h | 132 +++++++++++++++++++++++++--------------------
lib/libalpm/be_files.c | 2
lib/libalpm/cache.c | 8 +-
lib/libalpm/cache.h | 6 +-
lib/libalpm/conflict.c | 2
lib/libalpm/conflict.h | 2
lib/libalpm/db.c | 2
lib/libalpm/db.h | 20 +++---
lib/libalpm/deps.c | 39 ++++++++-----
lib/libalpm/deps.h | 17 +++--
lib/libalpm/handle.c | 32 ++++++++--
lib/libalpm/handle.h | 4 -
lib/libalpm/log.c | 2
lib/libalpm/log.h | 4 +
lib/libalpm/package.c | 4 -
lib/libalpm/package.h | 15 ++---
lib/libalpm/sync.c | 2
lib/libalpm/sync.h | 2
lib/libalpm/trans.c | 6 +-
lib/libalpm/trans.h | 28 +++++----
lib/libalpm/util.c | 4 -
lib/libalpm/util.h | 2
lib/libalpm/versioncmp.c | 14 ++--
src/pacman/add.c | 14 +++-
src/pacman/deptest.c | 14 +++-
src/pacman/sync.c | 19 ++++--
src/pacman/trans.c | 78 ++++++++++++++------------
src/pacman/trans.h | 8 +-
30 files changed, 290 insertions(+), 200 deletions(-)
Index: pacman-lib/lib/libalpm/add.c
diff -u pacman-lib/lib/libalpm/add.c:1.102 pacman-lib/lib/libalpm/add.c:1.103
--- pacman-lib/lib/libalpm/add.c:1.102 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/add.c Tue Jan 23 22:02:53 2007
@@ -332,7 +332,7 @@
register struct archive *archive;
struct archive_entry *entry;
char expath[PATH_MAX], cwd[PATH_MAX] = "", *what;
- unsigned char cb_state;
+ pmtransprog_t cb_state;
time_t t;
alpm_list_t *targ, *lp;
Index: pacman-lib/lib/libalpm/alpm.c
diff -u pacman-lib/lib/libalpm/alpm.c:1.104 pacman-lib/lib/libalpm/alpm.c:1.105
--- pacman-lib/lib/libalpm/alpm.c:1.104 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/alpm.c Tue Jan 23 22:02:54 2007
@@ -63,7 +63,7 @@
/* Globals */
pmhandle_t *handle = NULL;
-enum __pmerrno_t pm_errno;
+enum _pmerrno_t pm_errno;
/** \addtogroup alpm_interface Interface Functions
* @brief Functions to initialize and release libalpm
@@ -622,7 +622,9 @@
* @param progress progress callback function pointer
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_trans_init(unsigned char type, unsigned int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress)
+int alpm_trans_init(pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress)
{
char path[PATH_MAX];
Index: pacman-lib/lib/libalpm/alpm.h
diff -u pacman-lib/lib/libalpm/alpm.h:1.66 pacman-lib/lib/libalpm/alpm.h:1.67
--- pacman-lib/lib/libalpm/alpm.h:1.66 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/alpm.h Tue Jan 23 22:02:54 2007
@@ -71,13 +71,15 @@
*/
/* Levels */
-#define PM_LOG_DEBUG 0x01
-#define PM_LOG_ERROR 0x02
-#define PM_LOG_WARNING 0x04
-#define PM_LOG_FLOW1 0x08
-#define PM_LOG_FLOW2 0x10
-#define PM_LOG_FUNCTION 0x20
-#define PM_LOG_DOWNLOAD 0x40
+typedef enum _pmloglevel_t {
+ PM_LOG_DEBUG = 0x01,
+ PM_LOG_ERROR = 0x02,
+ PM_LOG_WARNING = 0x04,
+ PM_LOG_FLOW1 = 0x08,
+ PM_LOG_FLOW2 = 0x10,
+ PM_LOG_FUNCTION = 0x20,
+ PM_LOG_DOWNLOAD = 0x40
+} pmloglevel_t;
typedef void (*alpm_cb_log)(unsigned short, char *);
int alpm_logaction(char *fmt, ...);
@@ -100,8 +102,8 @@
alpm_cb_download alpm_option_get_dlcb();
void alpm_option_set_dlcb(alpm_cb_download cb);
-unsigned char alpm_option_get_logmask();
-void alpm_option_set_logmask(unsigned char mask);
+unsigned short alpm_option_get_logmask();
+void alpm_option_set_logmask(unsigned short mask);
const char *alpm_option_get_root();
void alpm_option_set_root(const char *root);
@@ -115,8 +117,8 @@
const char *alpm_option_get_logfile();
void alpm_option_set_logfile(const char *logfile);
-unsigned char alpm_option_get_usesyslog();
-void alpm_option_set_usesyslog(unsigned char usesyslog);
+unsigned short alpm_option_get_usesyslog();
+void alpm_option_set_usesyslog(unsigned short usesyslog);
alpm_list_t *alpm_option_get_noupgrades();
void alpm_option_add_noupgrade(char *pkg);
@@ -188,19 +190,26 @@
/* Info parameters */
/* reasons -- ie, why the package was installed */
-#define PM_PKG_REASON_EXPLICIT 0 /* explicitly requested by the user */
-#define PM_PKG_REASON_DEPEND 1 /* installed as a dependency for another package */
+typedef enum _pmpkgreason_t {
+ PM_PKG_REASON_EXPLICIT = 0, /* explicitly requested by the user */
+ PM_PKG_REASON_DEPEND = 1 /* installed as a dependency for another package */
+} pmpkgreason_t;
/* package name formats */
-#define PM_PKG_WITHOUT_ARCH 0 /* pkgname-pkgver-pkgrel, used under PM_DBPATH */
-#define PM_PKG_WITH_ARCH 1 /* ie, pkgname-pkgver-pkgrel-arch, used under PM_CACHEDIR */
+/*
+typedef enum _pmpkghasarch_t {
+ PM_PKG_WITHOUT_ARCH = 0, / pkgname-pkgver-pkgrel, used under PM_DBPATH /
+ PM_PKG_WITH_ARCH = 1 / pkgname-pkgver-pkgrel-arch, used under PM_CACHEDIR /
+} pmpkghasarch_t;
+*/
int alpm_pkg_load(char *filename, pmpkg_t **pkg);
int alpm_pkg_free(pmpkg_t *pkg);
int alpm_pkg_checkmd5sum(pmpkg_t *pkg);
int alpm_pkg_checksha1sum(pmpkg_t *pkg);
char *alpm_fetch_pkgurl(char *url);
-int alpm_parse_config(char *file, alpm_cb_db_register callback, const char *this_section);
+int alpm_parse_config(char *file, alpm_cb_db_register callback,
+ const char *this_section);
int alpm_pkg_vercmp(const char *ver1, const char *ver2);
char *alpm_pkg_name_hasarch(char *pkgname);
@@ -218,7 +227,7 @@
const char *alpm_pkg_get_arch(pmpkg_t *pkg);
unsigned long alpm_pkg_get_size(pmpkg_t *pkg);
unsigned long alpm_pkg_get_isize(pmpkg_t *pkg);
-unsigned char alpm_pkg_get_reason(pmpkg_t *pkg);
+pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_depends(pmpkg_t *pkg);
@@ -229,7 +238,7 @@
alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg);
-unsigned char alpm_pkg_has_scriptlet(pmpkg_t *pkg);
+unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg);
/*
* Groups
@@ -242,13 +251,13 @@
*/
/* Types */
-enum {
+typedef enum _pmsynctype_t {
PM_SYNC_TYPE_REPLACE = 1,
PM_SYNC_TYPE_UPGRADE,
PM_SYNC_TYPE_DEPEND
-};
+} pmsynctype_t;
-unsigned char alpm_sync_get_type(pmsyncpkg_t *sync);
+pmsynctype_t alpm_sync_get_type(pmsyncpkg_t *sync);
pmpkg_t *alpm_sync_get_package(pmsyncpkg_t *sync);
void *alpm_sync_get_data(pmsyncpkg_t *sync);
@@ -257,30 +266,32 @@
*/
/* Types */
-enum {
+typedef enum _pmtranstype_t {
PM_TRANS_TYPE_ADD = 1,
PM_TRANS_TYPE_REMOVE,
PM_TRANS_TYPE_UPGRADE,
PM_TRANS_TYPE_SYNC
-};
+} pmtranstype_t;
/* Flags */
-#define PM_TRANS_FLAG_NODEPS 0x01
-#define PM_TRANS_FLAG_FORCE 0x02
-#define PM_TRANS_FLAG_NOSAVE 0x04
-#define PM_TRANS_FLAG_FRESHEN 0x08
-#define PM_TRANS_FLAG_CASCADE 0x10
-#define PM_TRANS_FLAG_RECURSE 0x20
-#define PM_TRANS_FLAG_DBONLY 0x40
-#define PM_TRANS_FLAG_DEPENDSONLY 0x80
-#define PM_TRANS_FLAG_ALLDEPS 0x100
-#define PM_TRANS_FLAG_DOWNLOADONLY 0x200
-#define PM_TRANS_FLAG_NOSCRIPTLET 0x400
-#define PM_TRANS_FLAG_NOCONFLICTS 0x800
-#define PM_TRANS_FLAG_PRINTURIS 0x1000
+typedef enum _pmtransflag_t {
+ PM_TRANS_FLAG_NODEPS = 0x01,
+ PM_TRANS_FLAG_FORCE = 0x02,
+ PM_TRANS_FLAG_NOSAVE = 0x04,
+ PM_TRANS_FLAG_FRESHEN = 0x08,
+ PM_TRANS_FLAG_CASCADE = 0x10,
+ PM_TRANS_FLAG_RECURSE = 0x20,
+ PM_TRANS_FLAG_DBONLY = 0x40,
+ PM_TRANS_FLAG_DEPENDSONLY = 0x80,
+ PM_TRANS_FLAG_ALLDEPS = 0x100,
+ PM_TRANS_FLAG_DOWNLOADONLY = 0x200,
+ PM_TRANS_FLAG_NOSCRIPTLET = 0x400,
+ PM_TRANS_FLAG_NOCONFLICTS = 0x800,
+ PM_TRANS_FLAG_PRINTURIS = 0x1000
+} pmtransflag_t;
/* Transaction Events */
-enum {
+typedef enum _pmtransevt_t {
PM_TRANS_EVT_CHECKDEPS_START = 1,
PM_TRANS_EVT_CHECKDEPS_DONE,
PM_TRANS_EVT_FILECONFLICTS_START,
@@ -306,10 +317,10 @@
PM_TRANS_EVT_PRINTURI,
PM_TRANS_EVT_RETRIEVE_START,
PM_TRANS_EVT_RETRIEVE_LOCAL
-};
+} pmtransevt_t;
/* Transaction Conversations (ie, questions) */
-enum {
+typedef enum _pmtransconv_t {
PM_TRANS_CONV_INSTALL_IGNOREPKG = 0x01,
PM_TRANS_CONV_REPLACE_PKG = 0x02,
PM_TRANS_CONV_CONFLICT_PKG = 0x04,
@@ -317,30 +328,33 @@
PM_TRANS_CONV_LOCAL_NEWER = 0x10,
PM_TRANS_CONV_LOCAL_UPTODATE = 0x20,
PM_TRANS_CONV_REMOVE_HOLDPKG = 0x40
-};
+} pmtransconv_t;
/* Transaction Progress */
-enum {
+typedef enum _pmtransprog_t {
PM_TRANS_PROGRESS_ADD_START,
PM_TRANS_PROGRESS_UPGRADE_START,
PM_TRANS_PROGRESS_REMOVE_START,
PM_TRANS_PROGRESS_CONFLICTS_START
-};
+} pmtransprog_t;
/* Transaction Event callback */
-typedef void (*alpm_trans_cb_event)(unsigned char, void *, void *);
+typedef void (*alpm_trans_cb_event)(pmtransevt_t, void *, void *);
/* Transaction Conversation callback */
-typedef void (*alpm_trans_cb_conv)(unsigned char, void *, void *, void *, int *);
+typedef void (*alpm_trans_cb_conv)(pmtransconv_t, void *, void *,
+ void *, int *);
/* Transaction Progress callback */
-typedef void (*alpm_trans_cb_progress)(unsigned char, char *, int, int, int);
+typedef void (*alpm_trans_cb_progress)(pmtransprog_t, char *, int, int, int);
-unsigned char alpm_trans_get_type();
+pmtranstype_t alpm_trans_get_type();
unsigned int alpm_trans_get_flags();
alpm_list_t * alpm_trans_get_targets();
alpm_list_t * alpm_trans_get_packages();
-int alpm_trans_init(unsigned char type, unsigned int flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress);
+int alpm_trans_init(pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress cb_progress);
int alpm_trans_sysupgrade(void);
int alpm_trans_addtarget(char *target);
int alpm_trans_prepare(alpm_list_t **data);
@@ -351,21 +365,22 @@
* Dependencies and conflicts
*/
-enum {
+typedef enum _pmdepmod_t {
PM_DEP_MOD_ANY = 1,
PM_DEP_MOD_EQ,
PM_DEP_MOD_GE,
PM_DEP_MOD_LE
-};
-enum {
+} pmdepmod_t;
+
+typedef enum _pmdeptype_t {
PM_DEP_TYPE_DEPEND = 1,
PM_DEP_TYPE_REQUIRED,
PM_DEP_TYPE_CONFLICT
-};
+} pmdeptype_t;
const char *alpm_dep_get_target(pmdepmissing_t *miss);
-unsigned char alpm_dep_get_type(pmdepmissing_t *miss);
-unsigned char alpm_dep_get_mod(pmdepmissing_t *miss);
+pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss);
+pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss);
const char *alpm_dep_get_name(pmdepmissing_t *miss);
const char *alpm_dep_get_version(pmdepmissing_t *miss);
@@ -373,19 +388,20 @@
* File conflicts
*/
-enum {
+typedef enum _pmconflicttype_t {
PM_CONFLICT_TYPE_TARGET = 1,
PM_CONFLICT_TYPE_FILE
-};
+} pmconflicttype_t;
const char *alpm_conflict_get_target(pmconflict_t *conflict);
-unsigned char alpm_conflict_get_type(pmconflict_t *conflict);
+pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict);
const char *alpm_conflict_get_file(pmconflict_t *conflict);
const char *alpm_conflict_get_ctarget(pmconflict_t *conflict);
/*
* Helpers
*/
+
/* md5sums */
char *alpm_get_md5sum(char *name);
@@ -394,7 +410,7 @@
/*
* Errors
*/
-enum __pmerrno_t {
+enum _pmerrno_t {
PM_ERR_MEMORY = 1,
PM_ERR_SYSTEM,
PM_ERR_BADPERMS,
@@ -466,7 +482,7 @@
PM_ERR_FORK_FAILED
};
-extern enum __pmerrno_t pm_errno;
+extern enum _pmerrno_t pm_errno;
char *alpm_strerror(int err);
Index: pacman-lib/lib/libalpm/be_files.c
diff -u pacman-lib/lib/libalpm/be_files.c:1.20 pacman-lib/lib/libalpm/be_files.c:1.21
--- pacman-lib/lib/libalpm/be_files.c:1.20 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/be_files.c Tue Jan 23 22:02:54 2007
@@ -98,7 +98,7 @@
rewinddir(db->handle);
}
-pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq)
+pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
{
struct dirent *ent = NULL;
struct stat sbuf;
Index: pacman-lib/lib/libalpm/cache.c
diff -u pacman-lib/lib/libalpm/cache.c:1.25 pacman-lib/lib/libalpm/cache.c:1.26
--- pacman-lib/lib/libalpm/cache.c:1.25 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/cache.c Tue Jan 23 22:02:54 2007
@@ -41,12 +41,12 @@
/* Returns a new package cache from db.
* It frees the cache if it already exists.
*/
-int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel)
+int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
pmpkg_t *info;
int count = 0;
/* The group cache needs INFRQ_DESC as well */
- /*unsigned char infolevel = INFRQ_DEPENDS | INFRQ_DESC;*/
+ /* pmdbinfrq_t infolevel = INFRQ_DEPENDS | INFRQ_DESC;*/
if(db == NULL) {
return(-1);
@@ -86,7 +86,7 @@
}
}
-alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel)
+alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
if(db == NULL) {
return(NULL);
@@ -101,7 +101,7 @@
return(db->pkgcache);
}
-int _alpm_db_ensure_pkgcache(pmdb_t *db, unsigned char infolevel)
+int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
int reloaded = 0;
/* for each pkg, check and reload if the requested
Index: pacman-lib/lib/libalpm/cache.h
diff -u pacman-lib/lib/libalpm/cache.h:1.9 pacman-lib/lib/libalpm/cache.h:1.10
--- pacman-lib/lib/libalpm/cache.h:1.9 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/cache.h Tue Jan 23 22:02:54 2007
@@ -27,12 +27,12 @@
#include "package.h"
/* packages */
-int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel);
+int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
void _alpm_db_free_pkgcache(pmdb_t *db);
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
-alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel);
-int _alpm_db_ensure_pkgcache(pmdb_t *db, unsigned char infolevel);
+alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
+int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target);
/* groups */
int _alpm_db_load_grpcache(pmdb_t *db);
Index: pacman-lib/lib/libalpm/conflict.c
diff -u pacman-lib/lib/libalpm/conflict.c:1.30 pacman-lib/lib/libalpm/conflict.c:1.31
--- pacman-lib/lib/libalpm/conflict.c:1.30 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/conflict.c Tue Jan 23 22:02:54 2007
@@ -368,7 +368,7 @@
return conflict->target;
}
-unsigned char alpm_conflict_get_type(pmconflict_t *conflict)
+pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
Index: pacman-lib/lib/libalpm/conflict.h
diff -u pacman-lib/lib/libalpm/conflict.h:1.10 pacman-lib/lib/libalpm/conflict.h:1.11
--- pacman-lib/lib/libalpm/conflict.h:1.10 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/conflict.h Tue Jan 23 22:02:54 2007
@@ -28,7 +28,7 @@
struct __pmconflict_t {
char target[PKG_NAME_LEN];
- unsigned char type;
+ pmconflicttype_t type;
char file[CONFLICT_FILE_LEN];
char ctarget[PKG_NAME_LEN];
};
Index: pacman-lib/lib/libalpm/db.c
diff -u pacman-lib/lib/libalpm/db.c:1.55 pacman-lib/lib/libalpm/db.c:1.56
--- pacman-lib/lib/libalpm/db.c:1.55 Mon Jan 22 20:34:58 2007
+++ pacman-lib/lib/libalpm/db.c Tue Jan 23 22:02:54 2007
@@ -110,7 +110,7 @@
char *matched = NULL;
regex_t reg;
- if(regcomp(®, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE) != 0) {
+ if(regcomp(®, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
RET_ERR(PM_ERR_INVALID_REGEX, NULL);
}
Index: pacman-lib/lib/libalpm/db.h
diff -u pacman-lib/lib/libalpm/db.h:1.22 pacman-lib/lib/libalpm/db.h:1.23
--- pacman-lib/lib/libalpm/db.h:1.22 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/db.h Tue Jan 23 22:02:54 2007
@@ -27,12 +27,14 @@
#include <limits.h>
/* Database entries */
-#define INFRQ_NONE 0x00
-#define INFRQ_DESC 0x01
-#define INFRQ_DEPENDS 0x02
-#define INFRQ_FILES 0x04
-#define INFRQ_SCRIPTLET 0x08
-#define INFRQ_ALL 0xFF
+typedef enum _pmdbinfrq_t {
+ INFRQ_NONE = 0x00,
+ INFRQ_DESC = 0x01,
+ INFRQ_DEPENDS = 0x02,
+ INFRQ_FILES = 0x04,
+ INFRQ_SCRIPTLET = 0x08,
+ INFRQ_ALL = 0xFF
+} pmdbinfrq_t;
/* Database */
struct __pmdb_t {
@@ -55,9 +57,9 @@
int _alpm_db_open(pmdb_t *db);
void _alpm_db_close(pmdb_t *db);
void _alpm_db_rewind(pmdb_t *db);
-pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq);
-int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info);
-int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq);
+pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq);
+int _alpm_db_read(pmdb_t *db, pmdbinfrq_t inforeq, pmpkg_t *info);
+int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
int _alpm_db_getlastupdate(pmdb_t *db, char *ts);
int _alpm_db_setlastupdate(pmdb_t *db, char *ts);
Index: pacman-lib/lib/libalpm/deps.c
diff -u pacman-lib/lib/libalpm/deps.c:1.57 pacman-lib/lib/libalpm/deps.c:1.58
--- pacman-lib/lib/libalpm/deps.c:1.57 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/deps.c Tue Jan 23 22:02:54 2007
@@ -44,8 +44,9 @@
extern pmhandle_t *handle;
-pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsigned char depmod,
- const char *depname, const char *depversion)
+pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
+ pmdepmod_t depmod, const char *depname,
+ const char *depversion)
{
pmdepmissing_t *miss;
@@ -187,7 +188,8 @@
* dependencies can include versions with depmod operators.
*
*/
-alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, alpm_list_t *packages)
+alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
+ alpm_list_t *packages)
{
pmdepend_t depend;
alpm_list_t *i, *j, *k;
@@ -224,7 +226,7 @@
continue;
}
if(_alpm_pkg_isin(p->name, packages)) {
- /* this package is also in the upgrade list, so don't worry about it */
+ /* this package also in the upgrade list, so don't worry about it */
continue;
}
_alpm_db_read(db, INFRQ_DEPENDS, p);
@@ -246,8 +248,10 @@
FREELISTPTR(provides);
}
if(!_alpm_depcmp(tp, &depend)) {
- _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), depend.name, p->name);
- miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
+ depend.name, p->name);
+ miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod,
+ depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -278,7 +282,8 @@
_alpm_splitdep((char *)j->data, &depend);
found = 0;
/* check database for literal packages */
- for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS); k && !found; k = k->next) {
+ for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS);
+ k && !found; k = k->next) {
pmpkg_t *p = (pmpkg_t *)k->data;
found = _alpm_depcmp(p, &depend);
}
@@ -316,8 +321,9 @@
/* else if still not found... */
if(!found) {
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as a dependency for %s"),
- depend.name, tp->name);
- miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version);
+ depend.name, tp->name);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod,
+ depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -363,8 +369,10 @@
}
}
if(!found) {
- _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), reqname, tp->name);
- miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED, PM_DEP_MOD_ANY, j->data, NULL);
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
+ reqname, tp->name);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED,
+ PM_DEP_MOD_ANY, j->data, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -512,8 +520,9 @@
*
* make sure *list and *trail are already initialized
*/
-int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, alpm_list_t *list,
- alpm_list_t *trail, pmtrans_t *trans, alpm_list_t **data)
+int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
+ alpm_list_t *list, alpm_list_t *trail, pmtrans_t *trans,
+ alpm_list_t **data)
{
alpm_list_t *i, *j;
alpm_list_t *targ;
@@ -647,7 +656,7 @@
return miss->target;
}
-unsigned char alpm_dep_get_type(pmdepmissing_t *miss)
+pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
@@ -656,7 +665,7 @@
return miss->type;
}
-unsigned char alpm_dep_get_mod(pmdepmissing_t *miss)
+pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
Index: pacman-lib/lib/libalpm/deps.h
diff -u pacman-lib/lib/libalpm/deps.h:1.16 pacman-lib/lib/libalpm/deps.h:1.17
--- pacman-lib/lib/libalpm/deps.h:1.16 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/deps.h Tue Jan 23 22:02:54 2007
@@ -30,7 +30,7 @@
/* Dependency */
struct __pmdepend_t {
- unsigned char mod;
+ pmdepmod_t mod;
char name[PKG_NAME_LEN];
char version[PKG_VERSION_LEN];
};
@@ -38,19 +38,22 @@
/* Missing dependency */
struct __pmdepmissing_t {
char target[PKG_NAME_LEN];
- unsigned char type;
+ pmdeptype_t type;
pmdepend_t depend;
};
-pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsigned char depmod,
- const char *depname, const char *depversion);
+pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
+ pmdepmod_t depmod, const char *depname,
+ const char *depversion);
int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack);
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode);
-alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, alpm_list_t *packages);
+alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
+ alpm_list_t *packages);
int _alpm_splitdep(char *depstr, pmdepend_t *depend);
alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs);
-int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, alpm_list_t *list,
- alpm_list_t *trail, pmtrans_t *trans, alpm_list_t **data);
+int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
+ alpm_list_t *list, alpm_list_t *trail, pmtrans_t *trans,
+ alpm_list_t **data);
#endif /* _ALPM_DEPS_H */
Index: pacman-lib/lib/libalpm/handle.c
diff -u pacman-lib/lib/libalpm/handle.c:1.27 pacman-lib/lib/libalpm/handle.c:1.28
--- pacman-lib/lib/libalpm/handle.c:1.27 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/handle.c Tue Jan 23 22:02:54 2007
@@ -117,12 +117,12 @@
alpm_cb_log alpm_option_get_logcb() { return handle->logcb; }
alpm_cb_download alpm_option_get_dlcb() { return handle->dlcb; }
-unsigned char alpm_option_get_logmask() { return handle->logmask; }
+unsigned short alpm_option_get_logmask() { return handle->logmask; }
const char *alpm_option_get_root() { return handle->root; }
const char *alpm_option_get_dbpath() { return handle->dbpath; }
const char *alpm_option_get_cachedir() { return handle->cachedir; }
const char *alpm_option_get_logfile() { return handle->logfile; }
-unsigned char alpm_option_get_usesyslog() { return handle->usesyslog; }
+unsigned short alpm_option_get_usesyslog() { return handle->usesyslog; }
alpm_list_t *alpm_option_get_noupgrades() { return handle->noupgrade; }
alpm_list_t *alpm_option_get_noextracts() { return handle->noextract; }
alpm_list_t *alpm_option_get_ignorepkgs() { return handle->ignorepkg; }
@@ -135,13 +135,16 @@
unsigned short alpm_option_get_usecolor() { return handle->use_color; }
pmdb_t *alpm_option_get_localdb() { return handle->db_local; }
-alpm_list_t *alpm_option_get_syncdbs() { return handle->dbs_sync; }
+alpm_list_t *alpm_option_get_syncdbs()
+{
+ return handle->dbs_sync;
+}
void alpm_option_set_logcb(alpm_cb_log cb) { handle->logcb = cb; }
void alpm_option_set_dlcb(alpm_cb_download cb) { handle->dlcb = cb; }
-void alpm_option_set_logmask(unsigned char mask) { handle->logmask = mask; }
+void alpm_option_set_logmask(unsigned short mask) { handle->logmask = mask; }
void alpm_option_set_root(const char *root)
{
@@ -176,12 +179,16 @@
}
}
-void alpm_option_set_usesyslog(unsigned char usesyslog) { handle->usesyslog = usesyslog; }
+void alpm_option_set_usesyslog(unsigned short usesyslog)
+{
+ handle->usesyslog = usesyslog;
+}
void alpm_option_add_noupgrade(char *pkg)
{
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
}
+
void alpm_option_set_noupgrades(alpm_list_t *noupgrade)
{
if(handle->noupgrade) FREELIST(handle->noupgrade);
@@ -218,7 +225,10 @@
if(holdpkgs) handle->holdpkg = holdpkgs;
}
-void alpm_option_set_upgradedelay(time_t delay) { handle->upgradedelay = delay; }
+void alpm_option_set_upgradedelay(time_t delay)
+{
+ handle->upgradedelay = delay;
+}
void alpm_option_set_xfercommand(const char *cmd)
{
@@ -226,7 +236,10 @@
if(cmd) handle->xfercommand = strdup(cmd);
}
-void alpm_option_set_nopassiveftp(unsigned short nopasv) { handle->nopassiveftp = nopasv; }
+void alpm_option_set_nopassiveftp(unsigned short nopasv)
+{
+ handle->nopassiveftp = nopasv;
+}
void alpm_option_set_chomp(unsigned short chomp) { handle->chomp = chomp; }
@@ -239,6 +252,9 @@
if(handle->needles) FREELIST(handle->needles);
if(needles) handle->needles = needles;
}
-void alpm_option_set_usecolor(unsigned short usecolor) { handle->use_color = usecolor; }
+void alpm_option_set_usecolor(unsigned short usecolor)
+{
+ handle->use_color = usecolor;
+}
/* vim: set ts=2 sw=2 et: */
Index: pacman-lib/lib/libalpm/handle.h
diff -u pacman-lib/lib/libalpm/handle.h:1.13 pacman-lib/lib/libalpm/handle.h:1.14
--- pacman-lib/lib/libalpm/handle.h:1.13 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/handle.h Tue Jan 23 22:02:54 2007
@@ -45,12 +45,12 @@
/* options */
alpm_cb_log logcb; /* Log callback function */
alpm_cb_download dlcb; /* Download callback function */
- unsigned char logmask; /* Output mask for logging functions */
+ unsigned short logmask; /* Output mask for logging functions */
char *root; /* Root path, default '/' */
char *dbpath; /* Base path to pacman's DBs */
char *cachedir; /* Base path to pacman's cache */
char *logfile; /* Name of the file to log to */ /*TODO is this used?*/
- unsigned char usesyslog; /* Use syslog instead of logfile? */
+ unsigned short usesyslog; /* Use syslog instead of logfile? */
alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */
alpm_list_t *noextract; /* List of packages NOT to extrace */ /*TODO is this used?*/
Index: pacman-lib/lib/libalpm/log.c
diff -u pacman-lib/lib/libalpm/log.c:1.8 pacman-lib/lib/libalpm/log.c:1.9
--- pacman-lib/lib/libalpm/log.c:1.8 Mon Nov 20 04:10:24 2006
+++ pacman-lib/lib/libalpm/log.c Tue Jan 23 22:02:54 2007
@@ -27,7 +27,7 @@
#include "alpm.h"
#include "log.h"
-void _alpm_log(unsigned char flag, char *fmt, ...)
+void _alpm_log(pmloglevel_t flag, char *fmt, ...)
{
alpm_cb_log logcb = alpm_option_get_logcb();
if(logcb == NULL) {
Index: pacman-lib/lib/libalpm/log.h
diff -u pacman-lib/lib/libalpm/log.h:1.7 pacman-lib/lib/libalpm/log.h:1.8
--- pacman-lib/lib/libalpm/log.h:1.7 Mon Nov 20 04:10:24 2006
+++ pacman-lib/lib/libalpm/log.h Tue Jan 23 22:02:54 2007
@@ -21,9 +21,11 @@
#ifndef _ALPM_LOG_H
#define _ALPM_LOG_H
+#include "alpm.h"
+
#define LOG_STR_LEN 1024
-void _alpm_log(unsigned char flag, char *fmt, ...);
+void _alpm_log(pmloglevel_t flag, char *fmt, ...);
#endif /* _ALPM_LOG_H */
Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.49 pacman-lib/lib/libalpm/package.c:1.50
--- pacman-lib/lib/libalpm/package.c:1.49 Mon Jan 22 11:16:51 2007
+++ pacman-lib/lib/libalpm/package.c Tue Jan 23 22:02:54 2007
@@ -606,7 +606,7 @@
return pkg->isize;
}
-unsigned char alpm_pkg_get_reason(pmpkg_t *pkg)
+pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
@@ -741,7 +741,7 @@
return pkg->backup;
}
-unsigned char alpm_pkg_has_scriptlet(pmpkg_t *pkg)
+unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
Index: pacman-lib/lib/libalpm/package.h
diff -u pacman-lib/lib/libalpm/package.h:1.23 pacman-lib/lib/libalpm/package.h:1.24
--- pacman-lib/lib/libalpm/package.h:1.23 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/package.h Tue Jan 23 22:02:54 2007
@@ -30,11 +30,12 @@
#endif
#include "alpm.h"
+#include "db.h"
-enum {
+typedef enum _pmpkgfrom_t {
PKG_FROM_CACHE = 1,
PKG_FROM_FILE
-};
+} pmpkgfrom_t;
/* Packages */
#define PKG_FILENAME_LEN 512
@@ -65,10 +66,10 @@
char arch[PKG_ARCH_LEN];
unsigned long size;
unsigned long isize;
- unsigned char scriptlet;
- unsigned char force;
+ unsigned short scriptlet;
+ unsigned short force;
time_t date;
- unsigned char reason;
+ pmpkgreason_t reason;
alpm_list_t *desc_localized;
alpm_list_t *license;
alpm_list_t *replaces;
@@ -81,9 +82,9 @@
alpm_list_t *conflicts;
alpm_list_t *provides;
/* internal */
- unsigned char origin;
+ unsigned short origin;
void *data;
- unsigned char infolevel;
+ pmdbinfrq_t infolevel;
};
#define FREEPKG(p) do { if(p){_alpm_pkg_free(p); p = NULL;}} while(0)
Index: pacman-lib/lib/libalpm/sync.c
diff -u pacman-lib/lib/libalpm/sync.c:1.91 pacman-lib/lib/libalpm/sync.c:1.92
--- pacman-lib/lib/libalpm/sync.c:1.91 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/sync.c Tue Jan 23 22:02:54 2007
@@ -1069,7 +1069,7 @@
return(-1);
}
-unsigned char alpm_sync_get_type(pmsyncpkg_t *sync)
+pmsynctype_t alpm_sync_get_type(pmsyncpkg_t *sync)
{
/* Sanity checks */
ASSERT(sync != NULL, return(-1));
Index: pacman-lib/lib/libalpm/sync.h
diff -u pacman-lib/lib/libalpm/sync.h:1.16 pacman-lib/lib/libalpm/sync.h:1.17
--- pacman-lib/lib/libalpm/sync.h:1.16 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/sync.h Tue Jan 23 22:02:54 2007
@@ -27,7 +27,7 @@
/* Sync package */
struct __pmsyncpkg_t {
- unsigned char type;
+ pmsynctype_t type;
pmpkg_t *pkg;
void *data;
};
Index: pacman-lib/lib/libalpm/trans.c
diff -u pacman-lib/lib/libalpm/trans.c:1.30 pacman-lib/lib/libalpm/trans.c:1.31
--- pacman-lib/lib/libalpm/trans.c:1.30 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/trans.c Tue Jan 23 22:02:54 2007
@@ -85,7 +85,9 @@
FREE(trans);
}
-int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress)
+int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress)
{
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -226,7 +228,7 @@
return(0);
}
-unsigned char alpm_trans_get_type()
+pmtranstype_t alpm_trans_get_type()
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
Index: pacman-lib/lib/libalpm/trans.h
diff -u pacman-lib/lib/libalpm/trans.h:1.21 pacman-lib/lib/libalpm/trans.h:1.22
--- pacman-lib/lib/libalpm/trans.h:1.21 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/trans.h Tue Jan 23 22:02:54 2007
@@ -26,11 +26,21 @@
#include "alpm.h"
+typedef enum _pmtransstate_t {
+ STATE_IDLE = 0,
+ STATE_INITIALIZED,
+ STATE_PREPARED,
+ STATE_DOWNLOADING,
+ STATE_COMMITING,
+ STATE_COMMITED,
+ STATE_INTERRUPTED
+} pmtransstate_t;
+
/* Transaction */
struct __pmtrans_t {
- unsigned char type;
+ pmtranstype_t type;
unsigned int flags;
- unsigned char state;
+ pmtransstate_t state;
alpm_list_t *targets; /* alpm_list_t of (char *) */
alpm_list_t *packages; /* alpm_list_t of (pmpkg_t *) or (pmsyncpkg_t *) */
alpm_list_t *skiplist; /* alpm_list_t of (char *) */
@@ -39,16 +49,6 @@
alpm_trans_cb_progress cb_progress;
};
-enum {
- STATE_IDLE = 0,
- STATE_INITIALIZED,
- STATE_PREPARED,
- STATE_DOWNLOADING,
- STATE_COMMITING,
- STATE_COMMITED,
- STATE_INTERRUPTED
-};
-
#define FREETRANS(p) \
do { \
if(p) { \
@@ -77,7 +77,9 @@
pmtrans_t *_alpm_trans_new(void);
void _alpm_trans_free(void *data);
-int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress);
+int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress);
int _alpm_trans_sysupgrade(pmtrans_t *trans);
int _alpm_trans_addtarget(pmtrans_t *trans, char *target);
int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data);
Index: pacman-lib/lib/libalpm/util.c
diff -u pacman-lib/lib/libalpm/util.c:1.39 pacman-lib/lib/libalpm/util.c:1.40
--- pacman-lib/lib/libalpm/util.c:1.39 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/util.c Tue Jan 23 22:02:54 2007
@@ -66,7 +66,7 @@
#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;
@@ -342,7 +342,7 @@
return(0);
}
-int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str)
+int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *str)
{
_alpm_log(PM_LOG_DEBUG, _("logaction called: %s"), str);
Index: pacman-lib/lib/libalpm/util.h
diff -u pacman-lib/lib/libalpm/util.h:1.18 pacman-lib/lib/libalpm/util.h:1.19
--- pacman-lib/lib/libalpm/util.h:1.18 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/util.h Tue Jan 23 22:02:54 2007
@@ -62,7 +62,7 @@
int _alpm_lckrm(char *file);
int _alpm_unpack(const char *archive, const char *prefix, const char *fn);
int _alpm_rmrf(char *path);
-int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str);
+int _alpm_logaction(unsigned short 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);
Index: pacman-lib/lib/libalpm/versioncmp.c
diff -u pacman-lib/lib/libalpm/versioncmp.c:1.8 pacman-lib/lib/libalpm/versioncmp.c:1.9
--- pacman-lib/lib/libalpm/versioncmp.c:1.8 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/versioncmp.c Tue Jan 23 22:02:54 2007
@@ -253,17 +253,19 @@
} else {
int cmp = _alpm_versioncmp(pkg->version, dep->version);
switch(dep->mod) {
- case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
- case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
- case PM_DEP_MOD_LE: equal = (cmp <= 0); break;
+ case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
+ case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
+ case PM_DEP_MOD_LE: equal = (cmp <= 0); break;
+ default: equal = 1; break;
}
}
char *mod = "~=";
switch(dep->mod) {
- case PM_DEP_MOD_EQ: mod = "=="; break;
- case PM_DEP_MOD_GE: mod = ">="; break;
- case PM_DEP_MOD_LE: mod = "<="; break;
+ case PM_DEP_MOD_EQ: mod = "=="; break;
+ case PM_DEP_MOD_GE: mod = ">="; break;
+ case PM_DEP_MOD_LE: mod = "<="; break;
+ default: break;
}
if(strlen(dep->version) > 0) {
Index: pacman-lib/src/pacman/add.c
diff -u pacman-lib/src/pacman/add.c:1.23 pacman-lib/src/pacman/add.c:1.24
--- pacman-lib/src/pacman/add.c:1.23 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/add.c Tue Jan 23 22:02:55 2007
@@ -96,9 +96,17 @@
MSG(NL, _(":: %s: requires %s"), alpm_dep_get_target(miss),
alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
Index: pacman-lib/src/pacman/deptest.c
diff -u pacman-lib/src/pacman/deptest.c:1.10 pacman-lib/src/pacman/deptest.c:1.11
--- pacman-lib/src/pacman/deptest.c:1.10 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/deptest.c Tue Jan 23 22:02:55 2007
@@ -114,9 +114,17 @@
if(!config->op_d_resolve) {
MSG(NL, _("requires: %s"), alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
Index: pacman-lib/src/pacman/sync.c
diff -u pacman-lib/src/pacman/sync.c:1.97 pacman-lib/src/pacman/sync.c:1.98
--- pacman-lib/src/pacman/sync.c:1.97 Tue Jan 23 15:09:18 2007
+++ pacman-lib/src/pacman/sync.c Tue Jan 23 22:02:55 2007
@@ -579,12 +579,21 @@
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
MSG(NL, ":: %s %s %s", alpm_dep_get_target(miss),
- alpm_dep_get_type(miss) == PM_DEP_TYPE_DEPEND ? _("requires") : _("is required by"),
- alpm_dep_get_name(miss));
+ alpm_dep_get_type(miss) == PM_DEP_TYPE_DEPEND ?
+ _("requires") : _("is required by"),
+ alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
Index: pacman-lib/src/pacman/trans.c
diff -u pacman-lib/src/pacman/trans.c:1.27 pacman-lib/src/pacman/trans.c:1.28
--- pacman-lib/src/pacman/trans.c:1.27 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/trans.c Tue Jan 23 22:02:55 2007
@@ -44,7 +44,7 @@
/* Callback to handle transaction events
*/
-void cb_trans_evt(unsigned char event, void *data1, void *data2)
+void cb_trans_evt(pmtransevt_t event, void *data1, void *data2)
{
char str[LOG_STR_LEN] = "";
char out[PATH_MAX];
@@ -53,38 +53,42 @@
switch(event) {
case PM_TRANS_EVT_CHECKDEPS_START:
pm_fprintf(stderr, NL, _("checking dependencies... "));
- break;
+ break;
case PM_TRANS_EVT_FILECONFLICTS_START:
if(config->noprogressbar) {
MSG(NL, _("checking for file conflicts... "));
}
- break;
+ break;
+ case PM_TRANS_EVT_CLEANUP_START:
+ pm_fprintf(stderr, NL, _("resolving dependencies... "));
+ break;
case PM_TRANS_EVT_RESOLVEDEPS_START:
pm_fprintf(stderr, NL, _("resolving dependencies... "));
- break;
+ break;
case PM_TRANS_EVT_INTERCONFLICTS_START:
pm_fprintf(stderr, NL, _("looking for inter-conflicts... "));
- break;
+ break;
case PM_TRANS_EVT_FILECONFLICTS_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_CHECKDEPS_DONE:
+ case PM_TRANS_EVT_CLEANUP_DONE:
case PM_TRANS_EVT_RESOLVEDEPS_DONE:
case PM_TRANS_EVT_INTERCONFLICTS_DONE:
pm_fprintf(stderr, CL, _("done.\n"));
- break;
+ break;
case PM_TRANS_EVT_EXTRACT_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_ADD_START:
if(config->noprogressbar) {
MSG(NL, _("installing %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_ADD_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -93,12 +97,12 @@
alpm_pkg_get_name(data1),
alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_REMOVE_START:
if(config->noprogressbar) {
MSG(NL, _("removing %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_REMOVE_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -107,12 +111,12 @@
alpm_pkg_get_name(data1),
alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_UPGRADE_START:
if(config->noprogressbar) {
MSG(NL, _("upgrading %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_UPGRADE_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -122,34 +126,34 @@
(char *)alpm_pkg_get_version(data2),
(char *)alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_INTEGRITY_START:
MSG(NL, _("checking package integrity... "));
- break;
+ break;
case PM_TRANS_EVT_INTEGRITY_DONE:
MSG(CL, _("done.\n"));
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_INFO:
MSG(NL, "%s\n", (char*)data1);
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_START:
MSG(NL, (char*)data1);
MSG(CL, "...");
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_DONE:
if(!(long)data1) {
MSG(CL, _(" done.\n"));
} else {
MSG(CL, _(" failed.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_PRINTURI:
MSG(NL, "%s/%s\n", (char*)data1, (char*)data2);
- break;
+ break;
case PM_TRANS_EVT_RETRIEVE_START:
MSG(NL, _(":: Retrieving packages from %s...\n"), (char*)data1);
fflush(stdout);
- break;
+ break;
case PM_TRANS_EVT_RETRIEVE_LOCAL:
MSG(NL, " %s [", (char*)data1);
unsigned int maxcols = getcols();
@@ -159,11 +163,12 @@
MSG(CL, " ");
}
fputs(_("] 100% LOCAL "), stdout);
- break;
+ break;
}
}
-void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, int *response)
+void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
+ void *data3, int *response)
{
char str[LOG_STR_LEN] = "";
@@ -181,7 +186,7 @@
alpm_pkg_get_name(data2));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_REMOVE_HOLDPKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_REMOVE_HOLDPKG) {
@@ -190,11 +195,11 @@
*response = 0;
}
} else {
- snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
+ snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
alpm_pkg_get_name(data1));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_REPLACE_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_REPLACE_PKG) {
@@ -209,7 +214,7 @@
alpm_pkg_get_name(data2));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_CONFLICT_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_CONFLICT_PKG) {
@@ -224,7 +229,7 @@
(char *)data2);
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_LOCAL_NEWER:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_LOCAL_NEWER) {
@@ -242,7 +247,7 @@
*response = 1;
}
}
- break;
+ break;
case PM_TRANS_CONV_LOCAL_UPTODATE:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_LOCAL_UPTODATE) {
@@ -260,7 +265,7 @@
*response = 1;
}
}
- break;
+ break;
case PM_TRANS_CONV_CORRUPTED_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_CORRUPTED_PKG) {
@@ -277,11 +282,12 @@
*response = 1;
}
}
- break;
+ break;
}
}
-void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howmany, int remain)
+void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent,
+ int howmany, int remain)
{
static int lasthash = 0, mouth = 0;
int i, hash;
@@ -311,19 +317,19 @@
switch (event) {
case PM_TRANS_PROGRESS_ADD_START:
ptr = _("installing");
- break;
+ break;
case PM_TRANS_PROGRESS_UPGRADE_START:
ptr = _("upgrading");
- break;
+ break;
case PM_TRANS_PROGRESS_REMOVE_START:
ptr = _("removing");
- break;
+ break;
case PM_TRANS_PROGRESS_CONFLICTS_START:
ptr = _("checking for file conflicts");
- break;
+ break;
}
hash=percent*progresslen/100;
Index: pacman-lib/src/pacman/trans.h
diff -u pacman-lib/src/pacman/trans.h:1.5 pacman-lib/src/pacman/trans.h:1.6
--- pacman-lib/src/pacman/trans.h:1.5 Sun Oct 15 15:34:53 2006
+++ pacman-lib/src/pacman/trans.h Tue Jan 23 22:02:55 2007
@@ -22,12 +22,14 @@
#define _PM_TRANS_H
/* callback to handle messages/notifications from pacman transactions */
-void cb_trans_evt(unsigned char event, void *data1, void *data2);
+void cb_trans_evt(pmtransevt_t event, void *data1, void *data2);
/* callback to handle questions from pacman transactions (yes/no) */
-void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, int *response);
+void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
+ void *data3, int *response);
-void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howmany, int remain);
+void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent,
+ int howmany, int remain);
#endif /* _PM_TRANS_H */
1
0
Okay...blame wizzomafizzo :P. Because of the new way makepkg deals with files
(not using the extension), files that are actually zipfiles but called something
else that do not need to be extracted will be extracted (this is wizz's
example). Best example I can think of is like a .pk3 file for some games
(which I think is really just a zipfile). Anyway....we came up with the idea of
a noextract=(...) field in the PKGBUILD and the patch is below.
I'm not entirely too sure on whether or not this is entirely necessary...but oh
well.
Patch is below.
~ Jamie / yankees26
Signed-off-by: James Rosten <seinfeld90(a)gmail.com>
Index: makepkg
===================================================================
RCS file: /home/cvs-pacman/pacman-lib/scripts/makepkg,v
retrieving revision 1.33
diff -u -r1.33 makepkg
--- makepkg 22 Jan 2007 19:26:23 -0000 1.33
+++ makepkg 23 Jan 2007 05:34:25 -0000
@@ -425,7 +425,7 @@
unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force
unset replaces depends conflicts backup source install build makedepends
-unset options
+unset options noextract
# some applications (eg, blackbox) will not build with some languages
unset LC_ALL LANG
@@ -680,7 +680,17 @@
msg "Extracting Sources..."
for netfile in "${source[@]}"; do
unziphack=0
+ NoExtract=0
file=$(strip_url "$netfile")
+ for skipfile in "${noextract[@]}"; do
+ if [ "$skipfile" = "$file" ]; then
+ NoExtract=1
+ break;
+ fi
+ done
+ if [ $NoExtract -eq 1 ]; then
+ continue;
+ fi
# fix flyspray #6246
file_type=$(file -biz "$file")
unset cmd
7
9
[pacman-dev] [patch] remove use of unsigned char for enums, convert #define constants to enums
by Dan McGee 23 Jan '07
by Dan McGee 23 Jan '07
23 Jan '07
This mainly deals with code clarity- removing currently unneeded
optimizations in order to make the code much more readable and
type-checkable. Every enum in the library now has it's own type that
should be used instead of the generic 'unsigned char'. In addition,
several #define statements dealing with constants were converted to
enums.
Signed-off-by: Dan McGee <dpmcgee(a)gmail.com>
diff -uarp pacman-lib.orig/lib/libalpm/add.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/add.c
--- pacman-lib.orig/lib/libalpm/add.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/add.c 2007-01-19
20:26:21.000000000 -0500
@@ -332,7 +332,7 @@ int _alpm_add_commit(pmtrans_t *trans, p
register struct archive *archive;
struct archive_entry *entry;
char expath[PATH_MAX], cwd[PATH_MAX] = "", *what;
- unsigned char cb_state;
+ pmtransprog_t cb_state;
time_t t;
alpm_list_t *targ, *lp;
diff -uarp pacman-lib.orig/lib/libalpm/alpm.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/alpm.c
--- pacman-lib.orig/lib/libalpm/alpm.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/alpm.c 2007-01-19
20:26:21.000000000 -0500
@@ -63,7 +63,7 @@
/* Globals */
pmhandle_t *handle = NULL;
-enum __pmerrno_t pm_errno;
+enum _pmerrno_t pm_errno;
/** \addtogroup alpm_interface Interface Functions
* @brief Functions to initialize and release libalpm
@@ -622,7 +622,9 @@ alpm_list_t *alpm_db_search(pmdb_t *db)
* @param progress progress callback function pointer
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_trans_init(unsigned char type, unsigned int flags,
alpm_trans_cb_event event, alpm_trans_cb_conv conv,
alpm_trans_cb_progress progress)
+int alpm_trans_init(pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress)
{
char path[PATH_MAX];
diff -uarp pacman-lib.orig/lib/libalpm/alpm.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/alpm.h
--- pacman-lib.orig/lib/libalpm/alpm.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/alpm.h 2007-01-19
20:54:46.000000000 -0500
@@ -71,13 +71,15 @@ int alpm_release(void);
*/
/* Levels */
-#define PM_LOG_DEBUG 0x01
-#define PM_LOG_ERROR 0x02
-#define PM_LOG_WARNING 0x04
-#define PM_LOG_FLOW1 0x08
-#define PM_LOG_FLOW2 0x10
-#define PM_LOG_FUNCTION 0x20
-#define PM_LOG_DOWNLOAD 0x40
+typedef enum _pmloglevel_t {
+ PM_LOG_DEBUG = 0x01,
+ PM_LOG_ERROR = 0x02,
+ PM_LOG_WARNING = 0x04,
+ PM_LOG_FLOW1 = 0x08,
+ PM_LOG_FLOW2 = 0x10,
+ PM_LOG_FUNCTION = 0x20,
+ PM_LOG_DOWNLOAD = 0x40
+} pmloglevel_t;
typedef void (*alpm_cb_log)(unsigned short, char *);
int alpm_logaction(char *fmt, ...);
@@ -100,8 +102,8 @@ void alpm_option_set_logcb(alpm_cb_log c
alpm_cb_download alpm_option_get_dlcb();
void alpm_option_set_dlcb(alpm_cb_download cb);
-unsigned char alpm_option_get_logmask();
-void alpm_option_set_logmask(unsigned char mask);
+unsigned short alpm_option_get_logmask();
+void alpm_option_set_logmask(unsigned short mask);
const char *alpm_option_get_root();
void alpm_option_set_root(const char *root);
@@ -115,8 +117,8 @@ void alpm_option_set_cachedir(const char
const char *alpm_option_get_logfile();
void alpm_option_set_logfile(const char *logfile);
-unsigned char alpm_option_get_usesyslog();
-void alpm_option_set_usesyslog(unsigned char usesyslog);
+unsigned short alpm_option_get_usesyslog();
+void alpm_option_set_usesyslog(unsigned short usesyslog);
alpm_list_t *alpm_option_get_noupgrades();
void alpm_option_add_noupgrade(char *pkg);
@@ -188,19 +190,26 @@ alpm_list_t *alpm_db_search(pmdb_t *db);
/* Info parameters */
/* reasons -- ie, why the package was installed */
-#define PM_PKG_REASON_EXPLICIT 0 /* explicitly requested by the user */
-#define PM_PKG_REASON_DEPEND 1 /* installed as a dependency for
another package */
+typedef enum _pmpkgreason_t {
+ PM_PKG_REASON_EXPLICIT = 0, /* explicitly requested by the user */
+ PM_PKG_REASON_DEPEND = 1 /* installed as a dependency for another package */
+} pmpkgreason_t;
/* package name formats */
-#define PM_PKG_WITHOUT_ARCH 0 /* pkgname-pkgver-pkgrel, used under PM_DBPATH */
-#define PM_PKG_WITH_ARCH 1 /* ie, pkgname-pkgver-pkgrel-arch, used
under PM_CACHEDIR */
+/*
+typedef enum _pmpkghasarch_t {
+ PM_PKG_WITHOUT_ARCH = 0, / pkgname-pkgver-pkgrel, used under PM_DBPATH /
+ PM_PKG_WITH_ARCH = 1 / pkgname-pkgver-pkgrel-arch, used under PM_CACHEDIR /
+} pmpkghasarch_t;
+*/
int alpm_pkg_load(char *filename, pmpkg_t **pkg);
int alpm_pkg_free(pmpkg_t *pkg);
int alpm_pkg_checkmd5sum(pmpkg_t *pkg);
int alpm_pkg_checksha1sum(pmpkg_t *pkg);
char *alpm_fetch_pkgurl(char *url);
-int alpm_parse_config(char *file, alpm_cb_db_register callback, const
char *this_section);
+int alpm_parse_config(char *file, alpm_cb_db_register callback,
+ const char *this_section);
int alpm_pkg_vercmp(const char *ver1, const char *ver2);
char *alpm_pkg_name_hasarch(char *pkgname);
@@ -218,7 +227,7 @@ const char *alpm_pkg_get_sha1sum(pmpkg_t
const char *alpm_pkg_get_arch(pmpkg_t *pkg);
unsigned long alpm_pkg_get_size(pmpkg_t *pkg);
unsigned long alpm_pkg_get_isize(pmpkg_t *pkg);
-unsigned char alpm_pkg_get_reason(pmpkg_t *pkg);
+pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_depends(pmpkg_t *pkg);
@@ -229,7 +238,7 @@ alpm_list_t *alpm_pkg_get_provides(pmpkg
alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg);
-unsigned char alpm_pkg_has_scriptlet(pmpkg_t *pkg);
+unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg);
/*
* Groups
@@ -242,13 +251,13 @@ alpm_list_t *alpm_grp_get_packages(pmgrp
*/
/* Types */
-enum {
+typedef enum _pmsynctype_t {
PM_SYNC_TYPE_REPLACE = 1,
PM_SYNC_TYPE_UPGRADE,
PM_SYNC_TYPE_DEPEND
-};
+} pmsynctype_t;
-unsigned char alpm_sync_get_type(pmsyncpkg_t *sync);
+pmsynctype_t alpm_sync_get_type(pmsyncpkg_t *sync);
pmpkg_t *alpm_sync_get_package(pmsyncpkg_t *sync);
void *alpm_sync_get_data(pmsyncpkg_t *sync);
@@ -257,30 +266,32 @@ void *alpm_sync_get_data(pmsyncpkg_t *sy
*/
/* Types */
-enum {
+typedef enum _pmtranstype_t {
PM_TRANS_TYPE_ADD = 1,
PM_TRANS_TYPE_REMOVE,
PM_TRANS_TYPE_UPGRADE,
PM_TRANS_TYPE_SYNC
-};
+} pmtranstype_t;
/* Flags */
-#define PM_TRANS_FLAG_NODEPS 0x01
-#define PM_TRANS_FLAG_FORCE 0x02
-#define PM_TRANS_FLAG_NOSAVE 0x04
-#define PM_TRANS_FLAG_FRESHEN 0x08
-#define PM_TRANS_FLAG_CASCADE 0x10
-#define PM_TRANS_FLAG_RECURSE 0x20
-#define PM_TRANS_FLAG_DBONLY 0x40
-#define PM_TRANS_FLAG_DEPENDSONLY 0x80
-#define PM_TRANS_FLAG_ALLDEPS 0x100
-#define PM_TRANS_FLAG_DOWNLOADONLY 0x200
-#define PM_TRANS_FLAG_NOSCRIPTLET 0x400
-#define PM_TRANS_FLAG_NOCONFLICTS 0x800
-#define PM_TRANS_FLAG_PRINTURIS 0x1000
+typedef enum _pmtransflag_t {
+ PM_TRANS_FLAG_NODEPS = 0x01,
+ PM_TRANS_FLAG_FORCE = 0x02,
+ PM_TRANS_FLAG_NOSAVE = 0x04,
+ PM_TRANS_FLAG_FRESHEN = 0x08,
+ PM_TRANS_FLAG_CASCADE = 0x10,
+ PM_TRANS_FLAG_RECURSE = 0x20,
+ PM_TRANS_FLAG_DBONLY = 0x40,
+ PM_TRANS_FLAG_DEPENDSONLY = 0x80,
+ PM_TRANS_FLAG_ALLDEPS = 0x100,
+ PM_TRANS_FLAG_DOWNLOADONLY = 0x200,
+ PM_TRANS_FLAG_NOSCRIPTLET = 0x400,
+ PM_TRANS_FLAG_NOCONFLICTS = 0x800,
+ PM_TRANS_FLAG_PRINTURIS = 0x1000
+} pmtransflag_t;
/* Transaction Events */
-enum {
+typedef enum _pmtransevt_t {
PM_TRANS_EVT_CHECKDEPS_START = 1,
PM_TRANS_EVT_CHECKDEPS_DONE,
PM_TRANS_EVT_FILECONFLICTS_START,
@@ -306,10 +317,10 @@ enum {
PM_TRANS_EVT_PRINTURI,
PM_TRANS_EVT_RETRIEVE_START,
PM_TRANS_EVT_RETRIEVE_LOCAL
-};
+} pmtransevt_t;
/* Transaction Conversations (ie, questions) */
-enum {
+typedef enum _pmtransconv_t {
PM_TRANS_CONV_INSTALL_IGNOREPKG = 0x01,
PM_TRANS_CONV_REPLACE_PKG = 0x02,
PM_TRANS_CONV_CONFLICT_PKG = 0x04,
@@ -317,30 +328,33 @@ enum {
PM_TRANS_CONV_LOCAL_NEWER = 0x10,
PM_TRANS_CONV_LOCAL_UPTODATE = 0x20,
PM_TRANS_CONV_REMOVE_HOLDPKG = 0x40
-};
+} pmtransconv_t;
/* Transaction Progress */
-enum {
+typedef enum _pmtransprog_t {
PM_TRANS_PROGRESS_ADD_START,
PM_TRANS_PROGRESS_UPGRADE_START,
PM_TRANS_PROGRESS_REMOVE_START,
PM_TRANS_PROGRESS_CONFLICTS_START
-};
+} pmtransprog_t;
/* Transaction Event callback */
-typedef void (*alpm_trans_cb_event)(unsigned char, void *, void *);
+typedef void (*alpm_trans_cb_event)(pmtransevt_t, void *, void *);
/* Transaction Conversation callback */
-typedef void (*alpm_trans_cb_conv)(unsigned char, void *, void *,
void *, int *);
+typedef void (*alpm_trans_cb_conv)(pmtransconv_t, void *, void *,
+ void *, int *);
/* Transaction Progress callback */
-typedef void (*alpm_trans_cb_progress)(unsigned char, char *, int, int, int);
+typedef void (*alpm_trans_cb_progress)(pmtransprog_t, char *, int, int, int);
-unsigned char alpm_trans_get_type();
+pmtranstype_t alpm_trans_get_type();
unsigned int alpm_trans_get_flags();
alpm_list_t * alpm_trans_get_targets();
alpm_list_t * alpm_trans_get_packages();
-int alpm_trans_init(unsigned char type, unsigned int flags,
alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv,
alpm_trans_cb_progress cb_progress);
+int alpm_trans_init(pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress cb_progress);
int alpm_trans_sysupgrade(void);
int alpm_trans_addtarget(char *target);
int alpm_trans_prepare(alpm_list_t **data);
@@ -351,21 +365,22 @@ int alpm_trans_release(void);
* Dependencies and conflicts
*/
-enum {
+typedef enum _pmdepmod_t {
PM_DEP_MOD_ANY = 1,
PM_DEP_MOD_EQ,
PM_DEP_MOD_GE,
PM_DEP_MOD_LE
-};
-enum {
+} pmdepmod_t;
+
+typedef enum _pmdeptype_t {
PM_DEP_TYPE_DEPEND = 1,
PM_DEP_TYPE_REQUIRED,
PM_DEP_TYPE_CONFLICT
-};
+} pmdeptype_t;
const char *alpm_dep_get_target(pmdepmissing_t *miss);
-unsigned char alpm_dep_get_type(pmdepmissing_t *miss);
-unsigned char alpm_dep_get_mod(pmdepmissing_t *miss);
+pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss);
+pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss);
const char *alpm_dep_get_name(pmdepmissing_t *miss);
const char *alpm_dep_get_version(pmdepmissing_t *miss);
@@ -373,19 +388,20 @@ const char *alpm_dep_get_version(pmdepmi
* File conflicts
*/
-enum {
+typedef enum _pmconflicttype_t {
PM_CONFLICT_TYPE_TARGET = 1,
PM_CONFLICT_TYPE_FILE
-};
+} pmconflicttype_t;
const char *alpm_conflict_get_target(pmconflict_t *conflict);
-unsigned char alpm_conflict_get_type(pmconflict_t *conflict);
+pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict);
const char *alpm_conflict_get_file(pmconflict_t *conflict);
const char *alpm_conflict_get_ctarget(pmconflict_t *conflict);
/*
* Helpers
*/
+
/* md5sums */
char *alpm_get_md5sum(char *name);
@@ -394,7 +410,7 @@ char *alpm_get_sha1sum(char *name);
/*
* Errors
*/
-enum __pmerrno_t {
+enum _pmerrno_t {
PM_ERR_MEMORY = 1,
PM_ERR_SYSTEM,
PM_ERR_BADPERMS,
@@ -466,7 +482,7 @@ enum __pmerrno_t {
PM_ERR_FORK_FAILED
};
-extern enum __pmerrno_t pm_errno;
+extern enum _pmerrno_t pm_errno;
char *alpm_strerror(int err);
diff -uarp pacman-lib.orig/lib/libalpm/be_files.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/be_files.c
--- pacman-lib.orig/lib/libalpm/be_files.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/be_files.c 2007-01-19
20:26:21.000000000 -0500
@@ -98,7 +98,7 @@ void _alpm_db_rewind(pmdb_t *db)
rewinddir(db->handle);
}
-pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq)
+pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
{
struct dirent *ent = NULL;
struct stat sbuf;
diff -uarp pacman-lib.orig/lib/libalpm/cache.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/cache.c
--- pacman-lib.orig/lib/libalpm/cache.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/cache.c 2007-01-19
20:26:21.000000000 -0500
@@ -41,12 +41,12 @@
/* Returns a new package cache from db.
* It frees the cache if it already exists.
*/
-int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel)
+int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
pmpkg_t *info;
int count = 0;
/* The group cache needs INFRQ_DESC as well */
- /*unsigned char infolevel = INFRQ_DEPENDS | INFRQ_DESC;*/
+ /* pmdbinfrq_t infolevel = INFRQ_DEPENDS | INFRQ_DESC;*/
if(db == NULL) {
return(-1);
@@ -86,7 +86,7 @@ void _alpm_db_free_pkgcache(pmdb_t *db)
}
}
-alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel)
+alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
if(db == NULL) {
return(NULL);
@@ -101,7 +101,7 @@ alpm_list_t *_alpm_db_get_pkgcache(pmdb_
return(db->pkgcache);
}
-int _alpm_db_ensure_pkgcache(pmdb_t *db, unsigned char infolevel)
+int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
int reloaded = 0;
/* for each pkg, check and reload if the requested
diff -uarp pacman-lib.orig/lib/libalpm/cache.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/cache.h
--- pacman-lib.orig/lib/libalpm/cache.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/cache.h 2007-01-19
20:26:21.000000000 -0500
@@ -27,12 +27,12 @@
#include "package.h"
/* packages */
-int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel);
+int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
void _alpm_db_free_pkgcache(pmdb_t *db);
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
-alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel);
-int _alpm_db_ensure_pkgcache(pmdb_t *db, unsigned char infolevel);
+alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
+int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target);
/* groups */
int _alpm_db_load_grpcache(pmdb_t *db);
diff -uarp pacman-lib.orig/lib/libalpm/conflict.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/conflict.c
--- pacman-lib.orig/lib/libalpm/conflict.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/conflict.c 2007-01-19
20:26:21.000000000 -0500
@@ -368,7 +368,7 @@ const char *alpm_conflict_get_target(pmc
return conflict->target;
}
-unsigned char alpm_conflict_get_type(pmconflict_t *conflict)
+pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
diff -uarp pacman-lib.orig/lib/libalpm/conflict.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/conflict.h
--- pacman-lib.orig/lib/libalpm/conflict.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/conflict.h 2007-01-19
20:26:21.000000000 -0500
@@ -28,7 +28,7 @@
struct __pmconflict_t {
char target[PKG_NAME_LEN];
- unsigned char type;
+ pmconflicttype_t type;
char file[CONFLICT_FILE_LEN];
char ctarget[PKG_NAME_LEN];
};
diff -uarp pacman-lib.orig/lib/libalpm/db.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/db.h
--- pacman-lib.orig/lib/libalpm/db.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/db.h 2007-01-19
20:26:21.000000000 -0500
@@ -27,12 +27,14 @@
#include <limits.h>
/* Database entries */
-#define INFRQ_NONE 0x00
-#define INFRQ_DESC 0x01
-#define INFRQ_DEPENDS 0x02
-#define INFRQ_FILES 0x04
-#define INFRQ_SCRIPTLET 0x08
-#define INFRQ_ALL 0xFF
+typedef enum _pmdbinfrq_t {
+ INFRQ_NONE = 0x00,
+ INFRQ_DESC = 0x01,
+ INFRQ_DEPENDS = 0x02,
+ INFRQ_FILES = 0x04,
+ INFRQ_SCRIPTLET = 0x08,
+ INFRQ_ALL = 0xFF
+} pmdbinfrq_t;
/* Database */
struct __pmdb_t {
@@ -55,9 +57,9 @@ int _alpm_db_install(pmdb_t *db, const c
int _alpm_db_open(pmdb_t *db);
void _alpm_db_close(pmdb_t *db);
void _alpm_db_rewind(pmdb_t *db);
-pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq);
-int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info);
-int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq);
+pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq);
+int _alpm_db_read(pmdb_t *db, pmdbinfrq_t inforeq, pmpkg_t *info);
+int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
int _alpm_db_getlastupdate(pmdb_t *db, char *ts);
int _alpm_db_setlastupdate(pmdb_t *db, char *ts);
diff -uarp pacman-lib.orig/lib/libalpm/deps.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/deps.c
--- pacman-lib.orig/lib/libalpm/deps.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/deps.c 2007-01-19
20:26:21.000000000 -0500
@@ -44,8 +44,9 @@
extern pmhandle_t *handle;
-pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char
type, unsigned char depmod,
- const char *depname, const char *depversion)
+pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
+ pmdepmod_t depmod, const char *depname,
+ const char *depversion)
{
pmdepmissing_t *miss;
@@ -187,7 +188,8 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_
* dependencies can include versions with depmod operators.
*
*/
-alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned
char op, alpm_list_t *packages)
+alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
+ alpm_list_t *packages)
{
pmdepend_t depend;
alpm_list_t *i, *j, *k;
@@ -224,7 +226,7 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *
continue;
}
if(_alpm_pkg_isin(p->name, packages)) {
- /* this package is also in the upgrade list, so don't worry about it */
+ /* this package also in the upgrade list, so don't worry about it */
continue;
}
_alpm_db_read(db, INFRQ_DEPENDS, p);
@@ -246,8 +248,10 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *
FREELISTPTR(provides);
}
if(!_alpm_depcmp(tp, &depend)) {
- _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by
%s"), depend.name, p->name);
- miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED,
depend.mod, depend.name, depend.version);
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
+ depend.name, p->name);
+ miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod,
+ depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -278,7 +282,8 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *
_alpm_splitdep((char *)j->data, &depend);
found = 0;
/* check database for literal packages */
- for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS); k &&
!found; k = k->next) {
+ for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS);
+ k && !found; k = k->next) {
pmpkg_t *p = (pmpkg_t *)k->data;
found = _alpm_depcmp(p, &depend);
}
@@ -316,8 +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);
- miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND,
depend.mod, depend.name, depend.version);
+ depend.name, tp->name);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod,
+ depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -363,8 +369,10 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *
}
}
if(!found) {
- _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by
%s"), reqname, tp->name);
- miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED,
PM_DEP_MOD_ANY, j->data, NULL);
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
+ reqname, tp->name);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED,
+ PM_DEP_MOD_ANY, j->data, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -512,8 +520,9 @@ alpm_list_t *_alpm_removedeps(pmdb_t *db
*
* make sure *list and *trail are already initialized
*/
-int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t
*syncpkg, alpm_list_t *list,
- alpm_list_t *trail, pmtrans_t *trans, alpm_list_t **data)
+int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
+ alpm_list_t *list, alpm_list_t *trail, pmtrans_t *trans,
+ alpm_list_t **data)
{
alpm_list_t *i, *j;
alpm_list_t *targ;
@@ -647,7 +656,7 @@ const char *alpm_dep_get_target(pmdepmis
return miss->target;
}
-unsigned char alpm_dep_get_type(pmdepmissing_t *miss)
+pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
@@ -656,7 +665,7 @@ unsigned char alpm_dep_get_type(pmdepmis
return miss->type;
}
-unsigned char alpm_dep_get_mod(pmdepmissing_t *miss)
+pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
diff -uarp pacman-lib.orig/lib/libalpm/deps.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/deps.h
--- pacman-lib.orig/lib/libalpm/deps.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/deps.h 2007-01-19
20:26:21.000000000 -0500
@@ -30,7 +30,7 @@
/* Dependency */
struct __pmdepend_t {
- unsigned char mod;
+ pmdepmod_t mod;
char name[PKG_NAME_LEN];
char version[PKG_VERSION_LEN];
};
@@ -38,19 +38,22 @@ struct __pmdepend_t {
/* Missing dependency */
struct __pmdepmissing_t {
char target[PKG_NAME_LEN];
- unsigned char type;
+ pmdeptype_t type;
pmdepend_t depend;
};
-pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char
type, unsigned char depmod,
- const char *depname, const char *depversion);
+pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
+ pmdepmod_t depmod, const char *depname,
+ const char *depversion);
int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack);
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode);
-alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned
char op, alpm_list_t *packages);
+alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
+ alpm_list_t *packages);
int _alpm_splitdep(char *depstr, pmdepend_t *depend);
alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs);
-int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t
*syncpkg, alpm_list_t *list,
- alpm_list_t *trail, pmtrans_t *trans, alpm_list_t **data);
+int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
+ alpm_list_t *list, alpm_list_t *trail, pmtrans_t *trans,
+ alpm_list_t **data);
#endif /* _ALPM_DEPS_H */
diff -uarp pacman-lib.orig/lib/libalpm/handle.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/handle.c
--- pacman-lib.orig/lib/libalpm/handle.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/handle.c 2007-01-19
20:26:21.000000000 -0500
@@ -117,12 +117,12 @@ int _alpm_handle_free(pmhandle_t *handle
alpm_cb_log alpm_option_get_logcb() { return handle->logcb; }
alpm_cb_download alpm_option_get_dlcb() { return handle->dlcb; }
-unsigned char alpm_option_get_logmask() { return handle->logmask; }
+unsigned short alpm_option_get_logmask() { return handle->logmask; }
const char *alpm_option_get_root() { return handle->root; }
const char *alpm_option_get_dbpath() { return handle->dbpath; }
const char *alpm_option_get_cachedir() { return handle->cachedir; }
const char *alpm_option_get_logfile() { return handle->logfile; }
-unsigned char alpm_option_get_usesyslog() { return handle->usesyslog; }
+unsigned short alpm_option_get_usesyslog() { return handle->usesyslog; }
alpm_list_t *alpm_option_get_noupgrades() { return handle->noupgrade; }
alpm_list_t *alpm_option_get_noextracts() { return handle->noextract; }
alpm_list_t *alpm_option_get_ignorepkgs() { return handle->ignorepkg; }
@@ -134,14 +134,17 @@ unsigned short alpm_option_get_chomp() {
alpm_list_t *alpm_option_get_needles() { return handle->needles; }
unsigned short alpm_option_get_usecolor() { return handle->use_color; }
-pmdb_t *alpm_option_get_localdb() { return handle->db_local; }
-alpm_list_t *alpm_option_get_syncdbs() { return handle->dbs_sync; }
+pmdb_t *alpm_option_get_localdb(pmhandle_t *handle) { return
handle->db_local; }
+alpm_list_t *alpm_option_get_syncdbs(pmhandle_t *handle)
+{
+ return handle->dbs_sync;
+}
void alpm_option_set_logcb(alpm_cb_log cb) { handle->logcb = cb; }
void alpm_option_set_dlcb(alpm_cb_download cb) { handle->dlcb = cb; }
-void alpm_option_set_logmask(unsigned char mask) { handle->logmask = mask; }
+void alpm_option_set_logmask(unsigned short mask) { handle->logmask = mask; }
void alpm_option_set_root(const char *root)
{
@@ -176,12 +179,16 @@ void alpm_option_set_logfile(const char
}
}
-void alpm_option_set_usesyslog(unsigned char usesyslog) {
handle->usesyslog = usesyslog; }
+void alpm_option_set_usesyslog(unsigned short usesyslog)
+{
+ handle->usesyslog = usesyslog;
+}
void alpm_option_add_noupgrade(char *pkg)
{
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
}
+
void alpm_option_set_noupgrades(alpm_list_t *noupgrade)
{
if(handle->noupgrade) FREELIST(handle->noupgrade);
@@ -218,7 +225,10 @@ void alpm_option_set_holdpkgs(alpm_list_
if(holdpkgs) handle->holdpkg = holdpkgs;
}
-void alpm_option_set_upgradedelay(time_t delay) {
handle->upgradedelay = delay; }
+void alpm_option_set_upgradedelay(time_t delay)
+{
+ handle->upgradedelay = delay;
+}
void alpm_option_set_xfercommand(const char *cmd)
{
@@ -226,7 +236,10 @@ void alpm_option_set_xfercommand(const c
if(cmd) handle->xfercommand = strdup(cmd);
}
-void alpm_option_set_nopassiveftp(unsigned short nopasv) {
handle->nopassiveftp = nopasv; }
+void alpm_option_set_nopassiveftp(unsigned short nopasv)
+{
+ handle->nopassiveftp = nopasv;
+}
void alpm_option_set_chomp(unsigned short chomp) { handle->chomp = chomp; }
@@ -239,6 +252,9 @@ void alpm_option_set_needles(alpm_list_t
if(handle->needles) FREELIST(handle->needles);
if(needles) handle->needles = needles;
}
-void alpm_option_set_usecolor(unsigned short usecolor) {
handle->use_color = usecolor; }
+void alpm_option_set_usecolor(unsigned short usecolor)
+{
+ handle->use_color = usecolor;
+}
/* vim: set ts=2 sw=2 et: */
diff -uarp pacman-lib.orig/lib/libalpm/handle.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/handle.h
--- pacman-lib.orig/lib/libalpm/handle.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/handle.h 2007-01-19
20:26:21.000000000 -0500
@@ -45,12 +45,12 @@ typedef struct _pmhandle_t {
/* options */
alpm_cb_log logcb; /* Log callback function */
alpm_cb_download dlcb; /* Download callback function */
- unsigned char logmask; /* Output mask for logging functions */
+ unsigned short logmask; /* Output mask for logging functions */
char *root; /* Root path, default '/' */
char *dbpath; /* Base path to pacman's DBs */
char *cachedir; /* Base path to pacman's cache */
char *logfile; /* Name of the file to log to */ /*TODO is this used?*/
- unsigned char usesyslog; /* Use syslog instead of logfile? */
+ unsigned short usesyslog; /* Use syslog instead of logfile? */
alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */
alpm_list_t *noextract; /* List of packages NOT to extrace */
/*TODO is this used?*/
diff -uarp pacman-lib.orig/lib/libalpm/log.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/log.c
--- pacman-lib.orig/lib/libalpm/log.c 2006-11-20 04:10:24.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/log.c 2007-01-19
20:26:21.000000000 -0500
@@ -27,7 +27,7 @@
#include "alpm.h"
#include "log.h"
-void _alpm_log(unsigned char flag, char *fmt, ...)
+void _alpm_log(pmloglevel_t flag, char *fmt, ...)
{
alpm_cb_log logcb = alpm_option_get_logcb();
if(logcb == NULL) {
diff -uarp pacman-lib.orig/lib/libalpm/log.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/log.h
--- pacman-lib.orig/lib/libalpm/log.h 2006-11-20 04:10:24.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/log.h 2007-01-19
20:49:42.000000000 -0500
@@ -21,9 +21,11 @@
#ifndef _ALPM_LOG_H
#define _ALPM_LOG_H
+#include "alpm.h"
+
#define LOG_STR_LEN 1024
-void _alpm_log(unsigned char flag, char *fmt, ...);
+void _alpm_log(pmloglevel_t flag, char *fmt, ...);
#endif /* _ALPM_LOG_H */
diff -uarp pacman-lib.orig/lib/libalpm/package.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/package.c
--- pacman-lib.orig/lib/libalpm/package.c 2007-01-19 19:25:20.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/package.c 2007-01-19
20:26:21.000000000 -0500
@@ -603,7 +603,7 @@ unsigned long alpm_pkg_get_isize(pmpkg_t
return pkg->isize;
}
-unsigned char alpm_pkg_get_reason(pmpkg_t *pkg)
+pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
@@ -738,7 +738,7 @@ alpm_list_t *alpm_pkg_get_backup(pmpkg_t
return pkg->backup;
}
-unsigned char alpm_pkg_has_scriptlet(pmpkg_t *pkg)
+unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
diff -uarp pacman-lib.orig/lib/libalpm/package.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/package.h
--- pacman-lib.orig/lib/libalpm/package.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/package.h 2007-01-19
20:26:21.000000000 -0500
@@ -30,11 +30,12 @@
#endif
#include "alpm.h"
+#include "db.h"
-enum {
+typedef enum _pmpkgfrom_t {
PKG_FROM_CACHE = 1,
PKG_FROM_FILE
-};
+} pmpkgfrom_t;
/* Packages */
#define PKG_FILENAME_LEN 512
@@ -65,10 +66,10 @@ struct __pmpkg_t {
char arch[PKG_ARCH_LEN];
unsigned long size;
unsigned long isize;
- unsigned char scriptlet;
- unsigned char force;
+ unsigned short scriptlet;
+ unsigned short force;
time_t date;
- unsigned char reason;
+ pmpkgreason_t reason;
alpm_list_t *desc_localized;
alpm_list_t *license;
alpm_list_t *replaces;
@@ -81,9 +82,9 @@ struct __pmpkg_t {
alpm_list_t *conflicts;
alpm_list_t *provides;
/* internal */
- unsigned char origin;
+ unsigned short origin;
void *data;
- unsigned char infolevel;
+ pmdbinfrq_t infolevel;
};
#define FREEPKG(p) do { if(p){_alpm_pkg_free(p); p = NULL;}} while(0)
diff -uarp pacman-lib.orig/lib/libalpm/sync.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/sync.c
--- pacman-lib.orig/lib/libalpm/sync.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/sync.c 2007-01-19
20:26:21.000000000 -0500
@@ -1069,7 +1069,7 @@ error:
return(-1);
}
-unsigned char alpm_sync_get_type(pmsyncpkg_t *sync)
+pmsynctype_t alpm_sync_get_type(pmsyncpkg_t *sync)
{
/* Sanity checks */
ASSERT(sync != NULL, return(-1));
diff -uarp pacman-lib.orig/lib/libalpm/sync.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/sync.h
--- pacman-lib.orig/lib/libalpm/sync.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/sync.h 2007-01-19
20:26:21.000000000 -0500
@@ -27,7 +27,7 @@
/* Sync package */
struct __pmsyncpkg_t {
- unsigned char type;
+ pmsynctype_t type;
pmpkg_t *pkg;
void *data;
};
diff -uarp pacman-lib.orig/lib/libalpm/trans.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/trans.c
--- pacman-lib.orig/lib/libalpm/trans.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/trans.c 2007-01-19
20:26:21.000000000 -0500
@@ -85,7 +85,9 @@ void _alpm_trans_free(void *data)
FREE(trans);
}
-int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned
int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv,
alpm_trans_cb_progress progress)
+int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress)
{
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -226,7 +228,7 @@ int _alpm_trans_commit(pmtrans_t *trans,
return(0);
}
-unsigned char alpm_trans_get_type()
+pmtranstype_t alpm_trans_get_type()
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
diff -uarp pacman-lib.orig/lib/libalpm/trans.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/trans.h
--- pacman-lib.orig/lib/libalpm/trans.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/trans.h 2007-01-19
20:26:21.000000000 -0500
@@ -26,11 +26,21 @@
#include "alpm.h"
+typedef enum _pmtransstate_t {
+ STATE_IDLE = 0,
+ STATE_INITIALIZED,
+ STATE_PREPARED,
+ STATE_DOWNLOADING,
+ STATE_COMMITING,
+ STATE_COMMITED,
+ STATE_INTERRUPTED
+} pmtransstate_t;
+
/* Transaction */
struct __pmtrans_t {
- unsigned char type;
+ pmtranstype_t type;
unsigned int flags;
- unsigned char state;
+ pmtransstate_t state;
alpm_list_t *targets; /* alpm_list_t of (char *) */
alpm_list_t *packages; /* alpm_list_t of (pmpkg_t *) or (pmsyncpkg_t *) */
alpm_list_t *skiplist; /* alpm_list_t of (char *) */
@@ -39,16 +49,6 @@ struct __pmtrans_t {
alpm_trans_cb_progress cb_progress;
};
-enum {
- STATE_IDLE = 0,
- STATE_INITIALIZED,
- STATE_PREPARED,
- STATE_DOWNLOADING,
- STATE_COMMITING,
- STATE_COMMITED,
- STATE_INTERRUPTED
-};
-
#define FREETRANS(p) \
do { \
if(p) { \
@@ -77,7 +77,9 @@ do { \
pmtrans_t *_alpm_trans_new(void);
void _alpm_trans_free(void *data);
-int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned
int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv,
alpm_trans_cb_progress progress);
+int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress);
int _alpm_trans_sysupgrade(pmtrans_t *trans);
int _alpm_trans_addtarget(pmtrans_t *trans, char *target);
int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data);
diff -uarp pacman-lib.orig/lib/libalpm/util.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/util.c
--- pacman-lib.orig/lib/libalpm/util.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/util.c 2007-01-19
21:24:13.000000000 -0500
@@ -66,7 +66,7 @@
#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;
@@ -342,7 +342,7 @@ int _alpm_rmrf(char *path)
return(0);
}
-int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str)
+int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *str)
{
_alpm_log(PM_LOG_DEBUG, _("logaction called: %s"), str);
diff -uarp pacman-lib.orig/lib/libalpm/util.h
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/util.h
--- pacman-lib.orig/lib/libalpm/util.h 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/util.h 2007-01-19
20:26:21.000000000 -0500
@@ -62,7 +62,7 @@ int _alpm_lckmk(char *file);
int _alpm_lckrm(char *file);
int _alpm_unpack(const char *archive, const char *prefix, const char *fn);
int _alpm_rmrf(char *path);
-int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str);
+int _alpm_logaction(unsigned short 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);
diff -uarp pacman-lib.orig/lib/libalpm/versioncmp.c
pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/versioncmp.c
--- pacman-lib.orig/lib/libalpm/versioncmp.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/lib/libalpm/versioncmp.c 2007-01-19
20:26:21.000000000 -0500
@@ -253,17 +253,19 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_
} else {
int cmp = _alpm_versioncmp(pkg->version, dep->version);
switch(dep->mod) {
- case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
- case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
- case PM_DEP_MOD_LE: equal = (cmp <= 0); break;
+ case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
+ case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
+ case PM_DEP_MOD_LE: equal = (cmp <= 0); break;
+ default: equal = 1; break;
}
}
char *mod = "~=";
switch(dep->mod) {
- case PM_DEP_MOD_EQ: mod = "=="; break;
- case PM_DEP_MOD_GE: mod = ">="; break;
- case PM_DEP_MOD_LE: mod = "<="; break;
+ case PM_DEP_MOD_EQ: mod = "=="; break;
+ case PM_DEP_MOD_GE: mod = ">="; break;
+ case PM_DEP_MOD_LE: mod = "<="; break;
+ default: break;
}
if(strlen(dep->version) > 0) {
diff -uarp pacman-lib.orig/src/pacman/add.c
pacman-lib-monotone/org.archlinux.pacman/src/pacman/add.c
--- pacman-lib.orig/src/pacman/add.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/src/pacman/add.c 2007-01-19
20:26:21.000000000 -0500
@@ -96,9 +96,17 @@ int pacman_add(alpm_list_t *targets)
MSG(NL, _(":: %s: requires %s"), alpm_dep_get_target(miss),
alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
diff -uarp pacman-lib.orig/src/pacman/deptest.c
pacman-lib-monotone/org.archlinux.pacman/src/pacman/deptest.c
--- pacman-lib.orig/src/pacman/deptest.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/src/pacman/deptest.c 2007-01-19
20:26:21.000000000 -0500
@@ -114,9 +114,17 @@ int pacman_deptest(alpm_list_t *targets)
if(!config->op_d_resolve) {
MSG(NL, _("requires: %s"), alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
diff -uarp pacman-lib.orig/src/pacman/package.c
pacman-lib-monotone/org.archlinux.pacman/src/pacman/package.c
--- pacman-lib.orig/src/pacman/package.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/src/pacman/package.c 2007-01-19
19:46:16.000000000 -0500
@@ -30,7 +30,6 @@
/* pacman */
#include "log.h"
#include "util.h"
-#include "list.h"
#include "package.h"
/* Display the content of an installed package
diff -uarp pacman-lib.orig/src/pacman/sync.c
pacman-lib-monotone/org.archlinux.pacman/src/pacman/sync.c
--- pacman-lib.orig/src/pacman/sync.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/src/pacman/sync.c 2007-01-19
20:26:21.000000000 -0500
@@ -572,12 +572,21 @@ int pacman_sync(alpm_list_t *targets)
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
MSG(NL, ":: %s %s %s", alpm_dep_get_target(miss),
- alpm_dep_get_type(miss) == PM_DEP_TYPE_DEPEND ?
_("requires") : _("is required by"),
- alpm_dep_get_name(miss));
+ alpm_dep_get_type(miss) == PM_DEP_TYPE_DEPEND ?
+ _("requires") : _("is required by"),
+ alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
diff -uarp pacman-lib.orig/src/pacman/trans.c
pacman-lib-monotone/org.archlinux.pacman/src/pacman/trans.c
--- pacman-lib.orig/src/pacman/trans.c 2007-01-19 18:09:55.000000000 -0500
+++ pacman-lib-monotone/org.archlinux.pacman/src/pacman/trans.c 2007-01-19
20:26:21.000000000 -0500
@@ -44,7 +44,7 @@ static int prevpercent=0; /* for less pr
/* Callback to handle transaction events
*/
-void cb_trans_evt(unsigned char event, void *data1, void *data2)
+void cb_trans_evt(pmtransevt_t event, void *data1, void *data2)
{
char str[LOG_STR_LEN] = "";
char out[PATH_MAX];
@@ -53,38 +53,42 @@ void cb_trans_evt(unsigned char event, v
switch(event) {
case PM_TRANS_EVT_CHECKDEPS_START:
pm_fprintf(stderr, NL, _("checking dependencies... "));
- break;
+ break;
case PM_TRANS_EVT_FILECONFLICTS_START:
if(config->noprogressbar) {
MSG(NL, _("checking for file conflicts... "));
}
- break;
+ break;
+ case PM_TRANS_EVT_CLEANUP_START:
+ pm_fprintf(stderr, NL, _("resolving dependencies... "));
+ break;
case PM_TRANS_EVT_RESOLVEDEPS_START:
pm_fprintf(stderr, NL, _("resolving dependencies... "));
- break;
+ break;
case PM_TRANS_EVT_INTERCONFLICTS_START:
pm_fprintf(stderr, NL, _("looking for inter-conflicts... "));
- break;
+ break;
case PM_TRANS_EVT_FILECONFLICTS_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_CHECKDEPS_DONE:
+ case PM_TRANS_EVT_CLEANUP_DONE:
case PM_TRANS_EVT_RESOLVEDEPS_DONE:
case PM_TRANS_EVT_INTERCONFLICTS_DONE:
pm_fprintf(stderr, CL, _("done.\n"));
- break;
+ break;
case PM_TRANS_EVT_EXTRACT_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_ADD_START:
if(config->noprogressbar) {
MSG(NL, _("installing %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_ADD_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -93,12 +97,12 @@ void cb_trans_evt(unsigned char event, v
alpm_pkg_get_name(data1),
alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_REMOVE_START:
if(config->noprogressbar) {
MSG(NL, _("removing %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_REMOVE_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -107,12 +111,12 @@ void cb_trans_evt(unsigned char event, v
alpm_pkg_get_name(data1),
alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_UPGRADE_START:
if(config->noprogressbar) {
MSG(NL, _("upgrading %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_UPGRADE_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -122,34 +126,34 @@ void cb_trans_evt(unsigned char event, v
(char *)alpm_pkg_get_version(data2),
(char *)alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_INTEGRITY_START:
MSG(NL, _("checking package integrity... "));
- break;
+ break;
case PM_TRANS_EVT_INTEGRITY_DONE:
MSG(CL, _("done.\n"));
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_INFO:
MSG(NL, "%s\n", (char*)data1);
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_START:
MSG(NL, (char*)data1);
MSG(CL, "...");
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_DONE:
if(!(long)data1) {
MSG(CL, _(" done.\n"));
} else {
MSG(CL, _(" failed.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_PRINTURI:
MSG(NL, "%s/%s\n", (char*)data1, (char*)data2);
- break;
+ break;
case PM_TRANS_EVT_RETRIEVE_START:
MSG(NL, _(":: Retrieving packages from %s...\n"), (char*)data1);
fflush(stdout);
- break;
+ break;
case PM_TRANS_EVT_RETRIEVE_LOCAL:
MSG(NL, " %s [", (char*)data1);
unsigned int maxcols = getcols();
@@ -159,11 +163,12 @@ void cb_trans_evt(unsigned char event, v
MSG(CL, " ");
}
fputs(_("] 100% LOCAL "), stdout);
- break;
+ break;
}
}
-void cb_trans_conv(unsigned char event, void *data1, void *data2,
void *data3, int *response)
+void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
+ void *data3, int *response)
{
char str[LOG_STR_LEN] = "";
@@ -181,7 +186,7 @@ void cb_trans_conv(unsigned char event,
alpm_pkg_get_name(data2));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_REMOVE_HOLDPKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_REMOVE_HOLDPKG) {
@@ -190,11 +195,11 @@ void cb_trans_conv(unsigned char event,
*response = 0;
}
} else {
- snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg.
Remove anyway? [Y/n] "),
+ snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg.
Remove anyway? [Y/n] "),
alpm_pkg_get_name(data1));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_REPLACE_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_REPLACE_PKG) {
@@ -209,7 +214,7 @@ void cb_trans_conv(unsigned char event,
alpm_pkg_get_name(data2));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_CONFLICT_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_CONFLICT_PKG) {
@@ -224,7 +229,7 @@ void cb_trans_conv(unsigned char event,
(char *)data2);
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_LOCAL_NEWER:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_LOCAL_NEWER) {
@@ -242,7 +247,7 @@ void cb_trans_conv(unsigned char event,
*response = 1;
}
}
- break;
+ break;
case PM_TRANS_CONV_LOCAL_UPTODATE:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_LOCAL_UPTODATE) {
@@ -260,7 +265,7 @@ void cb_trans_conv(unsigned char event,
*response = 1;
}
}
- break;
+ break;
case PM_TRANS_CONV_CORRUPTED_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_CORRUPTED_PKG) {
@@ -277,11 +282,12 @@ void cb_trans_conv(unsigned char event,
*response = 1;
}
}
- break;
+ break;
}
}
-void cb_trans_progress(unsigned char event, char *pkgname, int
percent, int howmany, int remain)
+void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent,
+ int howmany, int remain)
{
static int lasthash = 0, mouth = 0;
int i, hash;
@@ -311,19 +317,19 @@ void cb_trans_progress(unsigned char eve
switch (event) {
case PM_TRANS_PROGRESS_ADD_START:
ptr = _("installing");
- break;
+ break;
case PM_TRANS_PROGRESS_UPGRADE_START:
ptr = _("upgrading");
- break;
+ break;
case PM_TRANS_PROGRESS_REMOVE_START:
ptr = _("removing");
- break;
+ break;
case PM_TRANS_PROGRESS_CONFLICTS_START:
ptr = _("checking for file conflicts");
- break;
+ break;
}
hash=percent*progresslen/100;
diff -uarp pacman-lib.orig/src/pacman/trans.h
pacman-lib-monotone/org.archlinux.pacman/src/pacman/trans.h
--- pacman-lib.orig/src/pacman/trans.h 2006-10-15 15:34:53.000000000 -0400
+++ pacman-lib-monotone/org.archlinux.pacman/src/pacman/trans.h 2007-01-19
20:26:21.000000000 -0500
@@ -22,12 +22,14 @@
#define _PM_TRANS_H
/* callback to handle messages/notifications from pacman transactions */
-void cb_trans_evt(unsigned char event, void *data1, void *data2);
+void cb_trans_evt(pmtransevt_t event, void *data1, void *data2);
/* callback to handle questions from pacman transactions (yes/no) */
-void cb_trans_conv(unsigned char event, void *data1, void *data2,
void *data3, int *response);
+void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
+ void *data3, int *response);
-void cb_trans_progress(unsigned char event, char *pkgname, int
percent, int howmany, int remain);
+void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent,
+ int howmany, int remain);
#endif /* _PM_TRANS_H */
3
3
Date: Tuesday, January 23, 2007 @ 15:09:18
Author: aaron
Path: /home/cvs-pacman/pacman-lib/src/pacman
Modified: sync.c (1.96 -> 1.97)
Removed some debugging cruft left in in the last commit
--------+
sync.c | 2 --
1 file changed, 2 deletions(-)
Index: pacman-lib/src/pacman/sync.c
diff -u pacman-lib/src/pacman/sync.c:1.96 pacman-lib/src/pacman/sync.c:1.97
--- pacman-lib/src/pacman/sync.c:1.96 Mon Jan 22 20:34:58 2007
+++ pacman-lib/src/pacman/sync.c Tue Jan 23 15:09:18 2007
@@ -289,8 +289,6 @@
char *grpname = alpm_list_getdata(i);
for(j = syncs; j; j = alpm_list_next(j)) {
pmdb_t *db = alpm_list_getdata(j);
- printf("searching '%s' for groups '%s'\n", alpm_db_get_name(db), grpname);
- fflush(stdout);
pmgrp_t *grp = alpm_db_readgrp(db, grpname);
if(grp) {
1
0
Date: Monday, January 22, 2007 @ 20:34:58
Author: aaron
Path: /home/cvs-pacman/pacman-lib
Modified: lib/libalpm/alpm_list.c (1.2 -> 1.3)
lib/libalpm/db.c (1.54 -> 1.55) lib/libalpm/group.c (1.11 -> 1.12)
src/pacman/sync.c (1.95 -> 1.96)
* Added some calloc calls to replace the malloc-then-set-to-zero functionality
* Fixed -Ss output so as not to call alpm_list_getdata with a NULl list
* Added a NULL check in alpm_list_getdata
* Fixed alpm_list_add_sorted to properly handle a new / beginning insertions
-------------------------+
lib/libalpm/alpm_list.c | 5 ++++-
lib/libalpm/db.c | 8 ++------
lib/libalpm/group.c | 5 +----
src/pacman/sync.c | 23 ++++++++++++++++-------
4 files changed, 23 insertions(+), 18 deletions(-)
Index: pacman-lib/lib/libalpm/alpm_list.c
diff -u pacman-lib/lib/libalpm/alpm_list.c:1.2 pacman-lib/lib/libalpm/alpm_list.c:1.3
--- pacman-lib/lib/libalpm/alpm_list.c:1.2 Mon Jan 22 04:27:00 2007
+++ pacman-lib/lib/libalpm/alpm_list.c Mon Jan 22 20:34:58 2007
@@ -145,8 +145,10 @@
if(prev != NULL) {
prev->next = add; /* In middle. */
+ } else {
+ list = add; /* At beginning, or new list */
}
-
+
return(list);
}
}
@@ -369,6 +371,7 @@
*/
void *alpm_list_getdata(const alpm_list_t *entry)
{
+ if(entry == NULL) return(NULL);
return(entry->data);
}
Index: pacman-lib/lib/libalpm/db.c
diff -u pacman-lib/lib/libalpm/db.c:1.54 pacman-lib/lib/libalpm/db.c:1.55
--- pacman-lib/lib/libalpm/db.c:1.54 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/db.c Mon Jan 22 20:34:58 2007
@@ -55,14 +55,14 @@
{
pmdb_t *db;
- db = (pmdb_t *)malloc(sizeof(pmdb_t));
+ db = calloc(1, sizeof(pmdb_t));
if(db == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failed: could not allocate %d bytes"),
sizeof(pmdb_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
- db->path = (char *)malloc(strlen(root)+strlen(dbpath)+strlen(treename)+2);
+ db->path = calloc(1, strlen(root)+strlen(dbpath)+strlen(treename)+2);
if(db->path == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failed: could not allocate %d bytes"),
strlen(root)+strlen(dbpath)+strlen(treename)+2);
@@ -73,10 +73,6 @@
STRNCPY(db->treename, treename, PATH_MAX);
- db->pkgcache = NULL;
- db->grpcache = NULL;
- db->servers = NULL;
-
return(db);
}
Index: pacman-lib/lib/libalpm/group.c
diff -u pacman-lib/lib/libalpm/group.c:1.11 pacman-lib/lib/libalpm/group.c:1.12
--- pacman-lib/lib/libalpm/group.c:1.11 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/group.c Mon Jan 22 20:34:58 2007
@@ -36,16 +36,13 @@
{
pmgrp_t* grp;
- grp = (pmgrp_t *)malloc(sizeof(pmgrp_t));
+ grp = calloc(1, sizeof(pmgrp_t));
if(grp == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
sizeof(pmgrp_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
- grp->name[0] = '\0';
- grp->packages = NULL;
-
return(grp);
}
Index: pacman-lib/src/pacman/sync.c
diff -u pacman-lib/src/pacman/sync.c:1.95 pacman-lib/src/pacman/sync.c:1.96
--- pacman-lib/src/pacman/sync.c:1.95 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/sync.c Mon Jan 22 20:34:58 2007
@@ -248,14 +248,20 @@
continue;
}
for(j = ret; j; j = alpm_list_next(j)) {
+ char *group = NULL;
+ alpm_list_t *grp;
pmpkg_t *pkg = alpm_list_getdata(j);
- char *group = (char *)alpm_list_getdata(alpm_pkg_get_groups(pkg));
- printf("%s/%s %s %s%s%s\n ",
- alpm_db_get_name(db),
- alpm_pkg_get_name(pkg),
- alpm_pkg_get_version(pkg),
- (group ? " (" : ""), (group ? group : ""), (group ? ") " : ""));
+ printf("%s/%s %s", alpm_db_get_name(db), 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\n");
}
@@ -280,9 +286,12 @@
if(targets) {
for(i = targets; i; i = alpm_list_next(i)) {
+ char *grpname = alpm_list_getdata(i);
for(j = syncs; j; j = alpm_list_next(j)) {
pmdb_t *db = alpm_list_getdata(j);
- pmgrp_t *grp = alpm_db_readgrp(db, alpm_list_getdata(i));
+ printf("searching '%s' for groups '%s'\n", alpm_db_get_name(db), grpname);
+ fflush(stdout);
+ pmgrp_t *grp = alpm_db_readgrp(db, grpname);
if(grp) {
MSG(NL, "%s\n", (char *)alpm_grp_get_name(grp));
3
2
I noticed that even after moving it to *.pacsave it will still try to delete the
original file which fails and causes an error message which will only 'cause the
user to worry about this (possibly), which they don't need to.
Patch is below.
~ Jamie / yankees26
Signed-off-by: James Rosten <seinfeld90(a)gmail.com>
2
1