ipkg stable port information

Package: ipkg
Version: 0.99.163
Revision: 3
###
BuildDepends: fink (>= 0.24.12)
Depends: lib%N0-shlibs (= %v-%r), dpkg
###
Source: http://www.handhelds.org/download/packages/ipkg/%n-%v.tar.gz
Source-MD5: 0b10ad2924611bccaea8ddf98481a192
###
### This patch is from http://www.openembedded.org/repo/org.openembedded.dev/packages/ipkg/files/is-processing.patch
PatchFile: %n.patch
PatchFile-MD5: e7fa26f4156da0568e88a11666d38630
PatchScript: <<
%{default_script}
### fix multi defines
perl -pi -e 's,struct errlist\*,extern struct errlist\*,g' ipkg.h.in
perl -pi -e 's,#include "libbb.h",#include "libbb.h"\nstruct errlist\* error_list;,g' libbb/error_msg.c

### fix endian.h include in md5.c
perl -pi -e 's,#include \,#ifndef __APPLE__\n# include \\n#else\n# include \\n#endif,g' md5.c

### fix vfs.h include in ipkg_utils.c
perl -pi -e 's,#include \,#ifndef __APPLE__\n# include \\n#else\n# include \\n#endif,g' ipkg_utils.c

### remove un-needed features.h include from libbb/libbb.h
perl -pi -e 's,#include \,#ifndef __APPLE__\n# include \\n#endif,g' libbb/libbb.h

### dirname already defined OS X
perl -pi -e 's,char \*dirname \(char \*path\);,#ifndef __APPLE__\nchar \*dirname \(char \*path\);\n#endif,g' libbb/libbb.h

### Use fink dir for etc
perl -pi -e 's,/etc,%p/etc,g' args.h

### Add define for strndup
perl -pi -e "s,#include \"xsystem.h\",#include \"xsystem.h\"\n\n#ifndef HAVE_STRNDUP\nstatic void\*\nstrndup \(const char \*src\, size_t n\)\n\{\n size_t i;\n char \*dst;\n\n if \(src == NULL\)\n return NULL;\n\n dst = \(char*\) malloc \(n + 1\);\n if \(dst != NULL\) \{\n for \(i = 0; i \< n \&\& src\[i\]; i++\)\n dst\[i\] = src\[i\];\n dst\[i\] = '\\\0';\n \}\n\n return dst;\n\}\n#endif,g" ipkg_conf.c
<<
###
DocFiles: AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
###
ConfigureParams: --with-ipkglibdir=%p/var/lib --disable-dependency-tracking --with-pic --enable-shared --enable-static --mandir=%i/share/man --infodir=%p/share/info --libexecdir=%p/lib
###
InstallScript: <<
make -j1 install prefix=%i

### Install pkgconfig file (not sure why it doesn't do this)
mkdir -p %i/lib/pkgconfig
install -m 644 %b/libipkg.pc %i/lib/pkgconfig/libipkg.pc

### Already in dpkg
rm %i/bin/update-alternatives

### Make sure all uses can run the app
mkdir -p %i/var/lib/ipkg/lists
mkdir -p %i/var/lib/ipkg/info
<<
###
SplitOff: <<
Package: lib%N0-shlibs
Files: <<
lib/lib%N.*.dylib
<<
Shlibs: <<
%p/lib/libipkg.0.dylib 1.0.0 %n (>= 0.99.163-1)
<<
DocFiles: AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
<<
###
SplitOff2: <<
Package: lib%N-dev
Depends: lib%N0-shlibs (= %v-%r)
BuildDependsOnly: true
Files: <<
include
lib/pkgconfig
lib/lib%N.a
lib/lib%N.la
lib/lib%N.dylib
<<
DocFiles: AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
<<
###
PostInstScript: <<
set -e

update-alternatives --install %p/bin/ipkg ipkg %p/bin/ipkg-cl 60

exit 0
<<
###
PreRmScript: <<
set -e

update-alternatives --remove ipkg %p/bin/ipkg-cl

exit 0
<<
###
Description: Itsy Package Management System
DescDetail: <<
iPKG is a very lightweight package management system. It was designed for
Linux installations with severe storage limitations such as handheld
computers. iPKG is more than just an embedded Linux flash image builder,
(although it does that fairly well). It also allows for dynamic
installation/removal of packages on a running system.
.
ipkg knows how to install both .ipk and .deb packages.
.
ipkg is intended to serve the same functions (and more) for
Familiar that dpkg and apt serve for Debian, (while taking
up much less space).
<<
###
License: GPL
Maintainer: Justin F. Hallett
Homepage: http://handhelds.org/moin/moin.cgi/Ipkg

ipkg stable port .patch

diff -Nur ipkg-0.99.163.orig/ipkg_install.c ipkg-0.99.163/ipkg_install.c
--- ipkg-0.99.163.orig/ipkg_install.c 2006-03-30 21:50:24.000000000 +0800
+++ ipkg-0.99.163/ipkg_install.c 2006-08-10 09:30:40.000000000 +0800
@@ -211,6 +211,7 @@
anyone ever wants to make a nice libipkg. */

ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__);
+ new->is_processing = 1;
return ipkg_install_pkg(conf, new,0);
}

diff -Nur ipkg-0.99.163.orig/pkg.c ipkg-0.99.163/pkg.c
--- ipkg-0.99.163.orig/pkg.c 2006-04-21 04:29:28.000000000 +0800
+++ ipkg-0.99.163/pkg.c 2006-08-10 09:35:06.000000000 +0800
@@ -33,6 +33,7 @@
#include "xsystem.h"
#include "ipkg_conf.h"

+
typedef struct enum_map enum_map_t;
struct enum_map
{
@@ -522,6 +523,10 @@
strncat(buff ,line, strlen(line));
free(line);

+ line = pkg_formatted_field(pkg, "Installed-Size");
+ strncat(buff ,line, strlen(line));
+ free(line);
+
return buff;
}

@@ -542,7 +547,6 @@
}

temp[0]='\0';
-
switch (field[0])
{
case 'a':
@@ -690,13 +694,42 @@
case 'I': {
if (strcasecmp(field, "Installed-Size") == 0) {
/* Installed-Size */
- temp = (char *)realloc(temp,strlen(pkg->installed_size)+17);
- if ( temp == NULL ){
- fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
- return NULL;
- }
- temp[0]='\0';
- snprintf(temp, (strlen(pkg->installed_size)+17), "Installed-Size: %s\n", pkg->installed_size);
+ if (pkg->installed_size) {
+ temp = (char *)realloc(temp,strlen(pkg->installed_size)+18);
+ if ( temp == NULL ){
+ fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
+ return NULL;
+ }
+ temp[0]='\0';
+ snprintf(temp, (strlen(pkg->installed_size)+18), "Installed-Size: %s\n", pkg->installed_size);
+ } else {
+ /* Caculate installed files size */
+ str_list_elt_t *iter;
+ struct stat buf;
+ int installed_files_length = 0;
+ if (pkg->installed_files == NULL)
+ break;
+
+ if (pkg->is_processing!=1)
+ break;
+
+ for (iter = pkg->installed_files->head; iter; iter = iter->next) {
+ memset(&buf, 0, sizeof(struct stat));
+ stat(iter->data, &buf);
+ if (S_ISREG(buf.st_mode))
+ installed_files_length += buf.st_size;
+ }
+ /*printf("installed_files_length:%d\n", installed_files_length);*/
+
+ sprintf_alloc(&pkg->installed_size, "%d", installed_files_length);
+ temp = (char *)realloc(temp,strlen(pkg->installed_size)+18);
+ if ( temp == NULL ){
+ fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
+ return NULL;
+ }
+ temp[0]='\0';
+ snprintf(temp, (strlen(pkg->installed_size)+18), "Installed-Size: %s\n", pkg->installed_size);
+ }
} else if (strcasecmp(field, "Installed-Time") == 0 && pkg->installed_time) {
temp = (char *)realloc(temp,29);
if ( temp == NULL ){
@@ -720,7 +753,7 @@
return NULL;
}
temp[0]='\0';
- snprintf(temp, (strlen(pkg->maintainer)+14), "maintainer: %s\n", pkg->maintainer);
+ snprintf(temp, (strlen(pkg->maintainer)+14), "Maintainer: %s\n", pkg->maintainer);
}
} else if (strcasecmp(field, "MD5sum") == 0) {
/* MD5sum */
@@ -1016,6 +1049,12 @@
pkg_print_field(pkg, file, "Essential"); /* @@@@ should be removed in future release. */
pkg_print_field(pkg, file, "Architecture");
pkg_print_field(pkg, file, "Conffiles");
+ pkg_print_field(pkg, file, "Description");
+ pkg_print_field(pkg, file, "Maintainer");
+ pkg_print_field(pkg, file, "Section");
+ pkg_print_field(pkg, file, "Size");
+ pkg_print_field(pkg, file, "Filename");
+ pkg_print_field(pkg, file, "Installed-Size");
pkg_print_field(pkg, file, "Installed-Time");
fputs("\n", file);
}
diff -Nur ipkg-0.99.163.orig/pkg.h ipkg-0.99.163/pkg.h
--- ipkg-0.99.163.orig/pkg.h 2006-05-30 16:31:08.000000000 +0800
+++ ipkg-0.99.163/pkg.h 2006-08-10 09:19:14.000000000 +0800
@@ -176,6 +176,10 @@
int arch_priority;
/* Adding this flag, to "force" ipkg to choose a "provided_by_hand" package, if there are multiple choice */
int provided_by_hand;
+
+ /* Check whether this pkg is being removed or installed */
+ int is_processing;
+
};

pkg_t *pkg_new(void);

ipkg _unstable_ port .patch