13 years agoUse xsystem() to be consistent. Some minor cleanup too.
graham.gower [Tue, 10 Nov 2009 05:00:25 +0000 (05:00 +0000)]
Use xsystem() to be consistent. Some minor cleanup too.

git-svn-id: http://opkg.googlecode.com/svn/trunk@274 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoPut update temp directory in with the others. Also, don't confuse returning
graham.gower [Fri, 6 Nov 2009 06:17:44 +0000 (06:17 +0000)]
Put update temp directory in with the others. Also, don't confuse returning
error codes with number of download failures.

git-svn-id: http://opkg.googlecode.com/svn/trunk@273 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoUse mkdtemp() to create a unique directory instead of a goto loop.
graham.gower [Fri, 6 Nov 2009 05:57:57 +0000 (05:57 +0000)]
Use mkdtemp() to create a unique directory instead of a goto loop.

git-svn-id: http://opkg.googlecode.com/svn/trunk@272 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoMore dead code removal.
graham.gower [Fri, 6 Nov 2009 04:49:01 +0000 (04:49 +0000)]
More dead code removal.

git-svn-id: http://opkg.googlecode.com/svn/trunk@271 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove if (0 && ...) ... statements.
graham.gower [Fri, 6 Nov 2009 04:34:49 +0000 (04:34 +0000)]
Remove if (0 && ...) ... statements.

git-svn-id: http://opkg.googlecode.com/svn/trunk@270 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove more unused code.
graham.gower [Fri, 6 Nov 2009 04:28:03 +0000 (04:28 +0000)]
Remove more unused code.

git-svn-id: http://opkg.googlecode.com/svn/trunk@269 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove unused function.
graham.gower [Fri, 6 Nov 2009 04:27:48 +0000 (04:27 +0000)]
Remove unused function.

git-svn-id: http://opkg.googlecode.com/svn/trunk@268 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove dead code. We would segfault before following this code path.
graham.gower [Fri, 6 Nov 2009 04:27:37 +0000 (04:27 +0000)]
Remove dead code. We would segfault before following this code path.

git-svn-id: http://opkg.googlecode.com/svn/trunk@267 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove some bogus error checking and return void instead of int.
graham.gower [Fri, 6 Nov 2009 00:50:12 +0000 (00:50 +0000)]
Remove some bogus error checking and return void instead of int.

git-svn-id: http://opkg.googlecode.com/svn/trunk@266 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoSpecify --enable-pathfinder instead of --with-pathfinder.
graham.gower [Fri, 6 Nov 2009 00:48:36 +0000 (00:48 +0000)]
Specify --enable-pathfinder instead of --with-pathfinder.

git-svn-id: http://opkg.googlecode.com/svn/trunk@265 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoI hate autotools.
graham.gower [Fri, 6 Nov 2009 00:41:31 +0000 (00:41 +0000)]
I hate autotools.

If the first call to PKG_CHECK_MODULES() may not occur, then the macro does
something really really stupid: it sets PKG_CONFIG="". Thus subsequent calls
will fail and tell you that pkg-config cannot be found or is too old.

git-svn-id: http://opkg.googlecode.com/svn/trunk@264 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoSome refactoring of pathfinder support
pixdamix [Thu, 5 Nov 2009 16:07:47 +0000 (16:07 +0000)]
Some refactoring of pathfinder support

git-svn-id: http://opkg.googlecode.com/svn/trunk@263 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemoved a bunch of if(0) and dead code
pixdamix [Thu, 5 Nov 2009 08:46:43 +0000 (08:46 +0000)]
Removed a bunch of if(0) and dead code

Applied this semantic patch:

  statement S;
  - if(0) S

  - remove_obsolete_maintainer_scripts(...) {
  - ...

  - remove_obsolete_maintainer_scripts(...);

  identifier i;

git-svn-id: http://opkg.googlecode.com/svn/trunk@262 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoAdd pathfinder support for certificate validation
pixdamix [Thu, 5 Nov 2009 08:46:33 +0000 (08:46 +0000)]
Add pathfinder support for certificate validation

  From http://code.google.com/p/pathfinder-pki/

       PathFinder is designed to provide a mechanism for any program to
       perform RFC3280-compliant path validation of X509 certificates,
       even when some of the intermediate certificates are not present
       on the local machine. By design, Pathfinder automatically
       downloads any such certificates from the Internet as needed using
       the AIA and CRL distribution point extensions of the certificates
       it is processing. It has the ability to do revocation status
       checking either using CRL or OCSP, or both. And, given the recent
       vulnerabilities that have rendered the MD5 algorithm highly
       suspect, it allows the administrator to choose to not validate
       certificates using that algorithm anywhere in the trust path.

git-svn-id: http://opkg.googlecode.com/svn/trunk@261 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThese functions cannot fail, so return void.
graham.gower [Thu, 5 Nov 2009 04:52:10 +0000 (04:52 +0000)]
These functions cannot fail, so return void.

git-svn-id: http://opkg.googlecode.com/svn/trunk@260 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agos/malloc/xmalloc/ s/calloc/xcalloc/ s/realloc/realloc/
graham.gower [Thu, 5 Nov 2009 04:20:09 +0000 (04:20 +0000)]
s/malloc/xmalloc/ s/calloc/xcalloc/ s/realloc/realloc/

And redundant error checking removed from the places where allocation failures
were actually checked.

git-svn-id: http://opkg.googlecode.com/svn/trunk@259 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoDon't set PATH="/dev/null". Shuffle things around while here.
graham.gower [Thu, 5 Nov 2009 03:09:44 +0000 (03:09 +0000)]
Don't set PATH="/dev/null". Shuffle things around while here.

git-svn-id: http://opkg.googlecode.com/svn/trunk@258 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove code path which cannot be executed.
graham.gower [Thu, 5 Nov 2009 02:38:40 +0000 (02:38 +0000)]
Remove code path which cannot be executed.

git-svn-id: http://opkg.googlecode.com/svn/trunk@257 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agos/strndup/xstrndup/ - check memory allocations for failure.
graham.gower [Wed, 4 Nov 2009 03:15:09 +0000 (03:15 +0000)]
s/strndup/xstrndup/ - check memory allocations for failure.

git-svn-id: http://opkg.googlecode.com/svn/trunk@256 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agos/strdup/xstrdup/ - check memory allocations for failure.
graham.gower [Wed, 4 Nov 2009 03:14:59 +0000 (03:14 +0000)]
s/strdup/xstrdup/ - check memory allocations for failure.

git-svn-id: http://opkg.googlecode.com/svn/trunk@255 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove some strdup abuse.
graham.gower [Wed, 4 Nov 2009 03:14:39 +0000 (03:14 +0000)]
Remove some strdup abuse.

git-svn-id: http://opkg.googlecode.com/svn/trunk@254 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove str_dup_safe() in favour of xstrdup() from libbb.
graham.gower [Wed, 4 Nov 2009 02:13:22 +0000 (02:13 +0000)]
Remove str_dup_safe() in favour of xstrdup() from libbb.

git-svn-id: http://opkg.googlecode.com/svn/trunk@253 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove unused opkg_set_current_state bits.
graham.gower [Wed, 4 Nov 2009 01:22:05 +0000 (01:22 +0000)]
Remove unused opkg_set_current_state bits.

git-svn-id: http://opkg.googlecode.com/svn/trunk@252 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoMake `curl' an instance variable and ssl support
pixdamix [Tue, 3 Nov 2009 09:27:03 +0000 (09:27 +0000)]
Make `curl' an instance variable and ssl support

This patch adds several new options

  - option ssl_ca_path /path/to/dir
     Tells curl to use the specified certificate directory to verify the
     peer. The certificates must be in PEM format, and the directory
     must have been processed using the c_rehash utility supplied with

  - option ssl_ca_file
     Tells curl to use the specified certificate file to verify the
     peer. The file may contain multiple CA certificates

  - option ssl_key_type
     Tells curl the Private key file type. Specify which type your
     ssl_key provided private key is. PEM (default), DER and ENG
     (see option ssl_engine) are recognized types.

  - option ssl_cert_type
     Tells curl what certificate type the provided certificate is in.
     PEM (default), DER and ENG (see option ssl_engine) are recognized

  - option ssl_key & option ssl_cert
     Tells curl to use the specified certificate file and private key
     when getting a file with HTTPS

  - option ssl_key_passwd
     Passphrase for the private key

  - option ssl_engine
     Select the OpenSSL crypto engine to use for cipher operations.

  - option ssl_dont_verify_peer
     This option explicitly allows curl to perform "insecure" SSL
     connections and transfers. All SSL connections are attempted to be
     made secure by using the CA certificate. This makes all connections
     considered "insecure" fail unless ssl_dont_verify_peer is used.

git-svn-id: http://opkg.googlecode.com/svn/trunk@251 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThe list-installed command does not exist.
graham.gower [Tue, 3 Nov 2009 06:26:31 +0000 (06:26 +0000)]
The list-installed command does not exist.

git-svn-id: http://opkg.googlecode.com/svn/trunk@250 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove response_callback bits. Forgot to commit this before.
graham.gower [Tue, 3 Nov 2009 06:19:56 +0000 (06:19 +0000)]
Remove response_callback bits. Forgot to commit this before.

git-svn-id: http://opkg.googlecode.com/svn/trunk@249 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove some code duplication, check for realloc failure.
graham.gower [Tue, 3 Nov 2009 05:56:49 +0000 (05:56 +0000)]
Remove some code duplication, check for realloc failure.

git-svn-id: http://opkg.googlecode.com/svn/trunk@248 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoClean up pkg_vec_insert.
graham.gower [Tue, 3 Nov 2009 05:56:39 +0000 (05:56 +0000)]
Clean up pkg_vec_insert.

- Check for realloc failure.
- Don't cast an lvalue.
- Remove unused counter.

git-svn-id: http://opkg.googlecode.com/svn/trunk@247 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove prototype for deleted function.
graham.gower [Tue, 3 Nov 2009 03:58:20 +0000 (03:58 +0000)]
Remove prototype for deleted function.

git-svn-id: http://opkg.googlecode.com/svn/trunk@246 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoStop my eyes from bleeding.
graham.gower [Tue, 3 Nov 2009 03:51:34 +0000 (03:51 +0000)]
Stop my eyes from bleeding.

Testing shows that the info and status commands give the same output as before.
If you find a case where they differ, please let me know.

git-svn-id: http://opkg.googlecode.com/svn/trunk@245 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove unused callbacks, a legacy of the now removed ipkg API.
graham.gower [Tue, 3 Nov 2009 01:38:51 +0000 (01:38 +0000)]
Remove unused callbacks, a legacy of the now removed ipkg API.

git-svn-id: http://opkg.googlecode.com/svn/trunk@244 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoStop using opkg_cb_message.
graham.gower [Tue, 3 Nov 2009 01:38:39 +0000 (01:38 +0000)]
Stop using opkg_cb_message.

git-svn-id: http://opkg.googlecode.com/svn/trunk@243 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoClean up some _cmd functions, in particular remove use of print callbacks.
graham.gower [Tue, 3 Nov 2009 01:38:28 +0000 (01:38 +0000)]
Clean up some _cmd functions, in particular remove use of print callbacks.

git-svn-id: http://opkg.googlecode.com/svn/trunk@242 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemove unused code: if pkg was NULL, we would already have segfaulted.
graham.gower [Tue, 3 Nov 2009 00:53:11 +0000 (00:53 +0000)]
Remove unused code: if pkg was NULL, we would already have segfaulted.

git-svn-id: http://opkg.googlecode.com/svn/trunk@241 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: fix nullpointer dereference
pixdamix [Mon, 2 Nov 2009 15:47:29 +0000 (15:47 +0000)]
opkg: fix nullpointer dereference

Applied 011-fix_nullpointer_deref.patch from OpenWRT

git-svn-id: http://opkg.googlecode.com/svn/trunk@240 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: fix the -force_space option
pixdamix [Mon, 2 Nov 2009 15:47:16 +0000 (15:47 +0000)]
opkg: fix the -force_space option

- 006-fix_force_space.patch from OpenWRT

git-svn-id: http://opkg.googlecode.com/svn/trunk@239 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoCleanup error_list stuff a bit more.
graham.gower [Mon, 2 Nov 2009 03:39:12 +0000 (03:39 +0000)]
Cleanup error_list stuff a bit more.

- Remove reverse_error_list.
- Push messages on to the tail of the list.
- Move the print function in with the other error list functions.
- Indentation and variable name cleanups.

git-svn-id: http://opkg.googlecode.com/svn/trunk@238 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFree memory if we fail to remove a package due to it having dependents.
graham.gower [Mon, 2 Nov 2009 02:49:25 +0000 (02:49 +0000)]
Free memory if we fail to remove a package due to it having dependents.

git-svn-id: http://opkg.googlecode.com/svn/trunk@237 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoAvoid reading past the end of the array.
graham.gower [Mon, 2 Nov 2009 02:34:29 +0000 (02:34 +0000)]
Avoid reading past the end of the array.

git-svn-id: http://opkg.googlecode.com/svn/trunk@236 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agopkg_init_from_file() already does this strdup(), so stop another leak.
graham.gower [Mon, 2 Nov 2009 01:35:59 +0000 (01:35 +0000)]
pkg_init_from_file() already does this strdup(), so stop another leak.

git-svn-id: http://opkg.googlecode.com/svn/trunk@235 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFree memory used when parsing a control file.
graham.gower [Mon, 2 Nov 2009 01:35:48 +0000 (01:35 +0000)]
Free memory used when parsing a control file.

git-svn-id: http://opkg.googlecode.com/svn/trunk@234 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFix memory leaks.
graham.gower [Mon, 2 Nov 2009 01:15:14 +0000 (01:15 +0000)]
Fix memory leaks.

git-svn-id: http://opkg.googlecode.com/svn/trunk@233 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agofree() temporary string.
graham.gower [Mon, 2 Nov 2009 00:23:05 +0000 (00:23 +0000)]
free() temporary string.

git-svn-id: http://opkg.googlecode.com/svn/trunk@232 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoMissing free in sha256 hash verification
pixdamix [Fri, 30 Oct 2009 17:04:06 +0000 (17:04 +0000)]
Missing free in sha256 hash verification

git-svn-id: http://opkg.googlecode.com/svn/trunk@231 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoAdd missing free (again)
pixdamix [Fri, 30 Oct 2009 15:07:59 +0000 (15:07 +0000)]
Add missing free (again)

git-svn-id: http://opkg.googlecode.com/svn/trunk@230 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFix some memory leaks.
graham.gower [Fri, 30 Oct 2009 06:37:09 +0000 (06:37 +0000)]
Fix some memory leaks.

git-svn-id: http://opkg.googlecode.com/svn/trunk@229 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThe compiler almost certainly knows better.
graham.gower [Fri, 30 Oct 2009 06:35:22 +0000 (06:35 +0000)]
The compiler almost certainly knows better.

git-svn-id: http://opkg.googlecode.com/svn/trunk@228 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFix problems in error list
pixdamix [Thu, 29 Oct 2009 09:07:11 +0000 (09:07 +0000)]
Fix problems in error list

push_error_list() should allocate the sizeof(struct) not sizeof(pointer
to struct).

And add some memory deallocation in error paths found while looking at

git-svn-id: http://opkg.googlecode.com/svn/trunk@227 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoRemoved a unused variable warning
pixdamix [Wed, 28 Oct 2009 21:00:56 +0000 (21:00 +0000)]
Removed a unused variable warning

When compiled without openssl nor gpg signature verification
opkg build fail due to 3 unused variable and -Werror

git-svn-id: http://opkg.googlecode.com/svn/trunk@226 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoAdd error messages in case of signature error
pixdamix [Wed, 28 Oct 2009 10:05:48 +0000 (10:05 +0000)]
Add error messages in case of signature error

git-svn-id: http://opkg.googlecode.com/svn/trunk@225 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFix implicit declaration of strndup
pixdamix [Wed, 28 Oct 2009 09:10:59 +0000 (09:10 +0000)]
Fix implicit declaration of strndup


Thanks to Graham Gower <graham.gower@gmail.com>

git-svn-id: http://opkg.googlecode.com/svn/trunk@224 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoAdding sha256.[ch]
ticktock35 [Wed, 28 Oct 2009 07:27:13 +0000 (07:27 +0000)]
Adding sha256.[ch]
Sorry forgot adding them.
Thanks for Graham Gower <graham.gower@gmail.com>

git-svn-id: http://opkg.googlecode.com/svn/trunk@223 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoImprove the poor man's fseek in unarchive.c
pixdamix [Tue, 27 Oct 2009 21:15:50 +0000 (21:15 +0000)]
Improve the poor man's fseek in unarchive.c

Modified seek_sub_file since the fgetc in the for loop
was very slow when installing huge packages.

A test on my machine showed a 4x gain when installing
a large package (23Mib)

git-svn-id: http://opkg.googlecode.com/svn/trunk@222 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoOpkg support for smime (pkcs7) packages list signing
ticktock35 [Tue, 27 Oct 2009 12:45:24 +0000 (12:45 +0000)]
Opkg support for smime (pkcs7) packages list signing

Thanks to Camille Moncelier <moncelier@devlife.org>

As promised :) here is a patch allowing opkg to authenticate
a package list using smime and openssl instead of gpgme


 Sign a package list:
openssl smime -sign -in /path/to/repo/Packages \
       -signer /root/server.pem -binary \
       -outform PEM -out /path/to/repo/Packages.sig

 Configuration in /etc/opkg/opkg.conf
option check_signature 1
option signature_ca_file /etc/serverCA.pem
 option signature_ca_path /path/to/certs/dir

 opkg update
Downloading http://repo:8000/Packages
Updated list of available packages in /usr/lib/opkg/lists/angstrom
Downloading http://repo:8000/Packages.sig
Signature check passed

 Package list corruption or MIM:
Downloading http://repo:8000/Packages
Updated list of available packages in /usr/lib/opkg/lists/angstrom
Downloading http://repo:8000/Packages.sig
Signature check failed
Collected errors:
 * Verification failure

Camille Moncelier

git-svn-id: http://opkg.googlecode.com/svn/trunk@221 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoAdd sha256 ckecksums to okpg
ticktock35 [Tue, 27 Oct 2009 12:45:12 +0000 (12:45 +0000)]
Add sha256 ckecksums to okpg

Thanks to Camille Moncelier <moncelier@devlife.org>

Here is a patch which adds sha256 checksum checking to Opkg.
More Opkg patches will follow shortly (x509 and smime signature support,
libcurl client/server authentication)

I hope these patch will be useful and finds their ways into okpg

Camille Moncelier

git-svn-id: http://opkg.googlecode.com/svn/trunk@220 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoImprove install candidate selection
ticktock35 [Tue, 6 Oct 2009 03:57:46 +0000 (03:57 +0000)]
Improve install candidate selection
    Florian Boor <florian.boor@kernelconcepts.de>

I have noticed that opkg does not resolve package selection properly if
the same
package is available in more than one compatible architecture.
Failing having installable candidates available is not necessary in this
Either the packages are from feeds with different priorities - in this
case we
can select by priority - or the priorities are the same and it does not
which one gets installed.
Another problem is that in some situations the package lists seem to
duplicates for no obvious reason. (e.g. one package available from two
makes four entries in the package lists.)
The patch implements a workaround for this by filtering out duplicates
when the
candidate lists are created and makes opkg select an install candidate
per feed

I have tested the changes with OpenEmbedded and it does not seem to
cause any
obvious problems.
Could I get some opinions about the solution? :)


Thanks to Florian

git-svn-id: http://opkg.googlecode.com/svn/trunk@219 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFix Segmentation fault while data in Package.gz is not good
ticktock35 [Tue, 22 Sep 2009 16:07:19 +0000 (16:07 +0000)]
Fix Segmentation fault while data in Package.gz is not good

While setting up a personal opkg feed, I encountered a crash in opgk
when trying to install the package from the repository. Instead of an
error message from opkg, it just gave me "Segmentation fault" and

Thanks to EdorFaus <edorfaus@gmail.com>

git-svn-id: http://opkg.googlecode.com/svn/trunk@218 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFix opkg doesn't handle long link/path names in tar files well
ticktock35 [Mon, 21 Sep 2009 10:11:52 +0000 (10:11 +0000)]
Fix opkg doesn't handle long link/path names in tar files well

1. provide opkg with a tar file that has a link name that is 100
2. provide opkg with a tar file that has a 'path_prefix' of 155

Thanks to pblack88@gmail.com

git-svn-id: http://opkg.googlecode.com/svn/trunk@217 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoAdding error message for the lock file.
ticktock35 [Fri, 18 Sep 2009 02:35:00 +0000 (02:35 +0000)]
Adding error message for the lock file.
pkg just says "Could not obtain administrative lock" and provides no
further info when it encounters problems with the lock file. The
patch makes these errors a bit easier to diagnose.

Thanks to cconroy

git-svn-id: http://opkg.googlecode.com/svn/trunk@216 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoFix issue on "Segmentation fault on package removal"
ticktock35 [Sat, 4 Jul 2009 03:22:11 +0000 (03:22 +0000)]
Fix issue on "Segmentation fault on package removal"
Thanks to http://code.google.com/u/kosmaty/
Find the issue and fix it.


git-svn-id: http://opkg.googlecode.com/svn/trunk@215 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThanks to claudyus84 and Gilles
ticktock35 [Fri, 26 Jun 2009 06:25:36 +0000 (06:25 +0000)]
Thanks to claudyus84 and Gilles

Fix issue:

git-svn-id: http://opkg.googlecode.com/svn/trunk@214 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoadds a configure option so "/etc/opkg" can be
ticktock35 [Sun, 14 Jun 2009 05:43:35 +0000 (05:43 +0000)]
adds a configure option so "/etc/opkg" can be
changed when opkg is configured and built.
fix issue due to an error of opkg_conf.c

Thanks to jlc <jlcster@gmail.com>

git-svn-id: http://opkg.googlecode.com/svn/trunk@213 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoadding new flag flag_maintainer
ticktock35 [Fri, 17 Apr 2009 07:59:05 +0000 (07:59 +0000)]
adding new flag flag_maintainer
This flag is used for maintainer can use the latest conffile.
this flag need to be set manually.

git-svn-id: http://opkg.googlecode.com/svn/trunk@212 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agousing pkg->dest->root_dir
ticktock35 [Fri, 3 Apr 2009 08:22:03 +0000 (08:22 +0000)]
using pkg->dest->root_dir

git-svn-id: http://opkg.googlecode.com/svn/trunk@211 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoTry to avoid long unsigned int overflow.
ticktock35 [Fri, 3 Apr 2009 08:21:44 +0000 (08:21 +0000)]
Try to avoid long unsigned int overflow.
When free size is more than 4G, long unsigned int may enounter overflow

git-svn-id: http://opkg.googlecode.com/svn/trunk@210 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThanks to Keon's notify.
ticktock35 [Thu, 26 Mar 2009 18:22:39 +0000 (18:22 +0000)]
Thanks to Keon's notify.

converting curl error code to readable message

git-svn-id: http://opkg.googlecode.com/svn/trunk@209 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoDue to deb_extract's defect that I cannot tell if an extraction is
ticktock35 [Thu, 26 Mar 2009 17:57:23 +0000 (17:57 +0000)]
Due to deb_extract's defect that I cannot tell if an extraction is
successfull or failed via the return value.
Therefore I cannot use it as error message.
revert some code of R206

git-svn-id: http://opkg.googlecode.com/svn/trunk@208 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoreduce a memory leak of closing dir
ticktock35 [Thu, 26 Mar 2009 08:26:27 +0000 (08:26 +0000)]
reduce a memory leak of closing dir

git-svn-id: http://opkg.googlecode.com/svn/trunk@207 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoreduce a big memory leak
ticktock35 [Thu, 26 Mar 2009 07:58:43 +0000 (07:58 +0000)]
reduce a big memory leak
connecting deb_extract Null pointers

git-svn-id: http://opkg.googlecode.com/svn/trunk@206 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThanks to Antonio
ticktock35 [Thu, 26 Mar 2009 07:58:26 +0000 (07:58 +0000)]
Thanks to Antonio

Propagate gz_open() errors to caller function.

This is not enough, it is still needed to check deb_extract return value
everywhere in libopkg/pkg_extract.c

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
git-svn-id: http://opkg.googlecode.com/svn/trunk@205 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agobecause of the file_hash_set_file_owner may break the file list of pkgs
ticktock35 [Mon, 9 Mar 2009 04:39:22 +0000 (04:39 +0000)]
because of the file_hash_set_file_owner may break the file list of pkgs
it should be iterated more carefully.

Dealing with

git-svn-id: http://opkg.googlecode.com/svn/trunk@204 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThanks to Krzysztof Kotlenga <pocek@users.sf.net>:
ticktock35 [Wed, 4 Mar 2009 00:59:35 +0000 (00:59 +0000)]
Thanks to Krzysztof Kotlenga <pocek@users.sf.net>:
 Frans Meulenbroeks wrote:

> Anyway, appending the 0 byte is no good as tar_entry->name[100] is
> already out of bounds.

http://tiny.cc/964UD looks good enough. It's interesting that we have
to trace bugs already fixed upstream years ago.


git-svn-id: http://opkg.googlecode.com/svn/trunk@203 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agothanks to Koen, a memory leak were fond and fixed here.
ticktock35 [Sat, 28 Feb 2009 06:12:06 +0000 (06:12 +0000)]
thanks to Koen, a memory leak were fond and fixed here.
When the flag is force-overwrite and replace files.
opkg will not free the root_filename well.

git-svn-id: http://opkg.googlecode.com/svn/trunk@202 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThanks to
ticktock35 [Thu, 12 Feb 2009 13:27:50 +0000 (13:27 +0000)]
Thanks to
Frans Meulenbroeks


If a file name in a tar archive is exactly 100 bytes long the name
field is completely filled and there is no terminating null byte;
so extraction of the file will yield a name that is extended with the
mode (e.g. 000644).

The attached patch cures it although there might be better solutions.
The problem is also in busybox tar and reported there too.


git-svn-id: http://opkg.googlecode.com/svn/trunk@201 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoreduce a meory leak
ticktock35 [Tue, 3 Feb 2009 12:04:38 +0000 (12:04 +0000)]
reduce a meory leak

git-svn-id: http://opkg.googlecode.com/svn/trunk@200 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoInitial the 'err' valaible in opkg_install_by_name , or it may be used without
ticktock35 [Sun, 1 Feb 2009 14:12:41 +0000 (14:12 +0000)]
Initial the 'err' valaible in opkg_install_by_name , or it may be used without

git-svn-id: http://opkg.googlecode.com/svn/trunk@199 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThanks to: Per Hansen <spamhans@yahoo.de>
ticktock35 [Sat, 24 Jan 2009 08:51:21 +0000 (08:51 +0000)]
Thanks to: Per Hansen <spamhans@yahoo.de>

opkg install *.ipk
An error ocurred, return value: -50512.

This error message is not very helpful!

git-svn-id: http://opkg.googlecode.com/svn/trunk@198 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agofix a buffer overflow bug that cause
ticktock35 [Mon, 19 Jan 2009 18:21:08 +0000 (18:21 +0000)]
fix a buffer overflow bug that cause

git-svn-id: http://opkg.googlecode.com/svn/trunk@197 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoMaking the status_file singleton, every package is using the same file,
ticktock35 [Fri, 9 Jan 2009 13:05:05 +0000 (13:05 +0000)]
Making the status_file singleton, every package is using the same file,
and it should be handled only once.
Let status_file works (make the dest->status_file obsolete)

git-svn-id: http://opkg.googlecode.com/svn/trunk@196 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg the config file dir to that one actually works
ticktock35 [Sun, 28 Dec 2008 08:06:35 +0000 (08:06 +0000)]
opkg the config file dir to that one actually works

git-svn-id: http://opkg.googlecode.com/svn/trunk@194 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoadding check_signature config
ticktock35 [Sun, 28 Dec 2008 07:53:44 +0000 (07:53 +0000)]
adding check_signature config
default if off
you can turn that on via adding one line in /etc/opkg/opkg.conf file
+ option check_signature 1

git-svn-id: http://opkg.googlecode.com/svn/trunk@193 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agorevert R190, keep R191
ticktock35 [Sat, 27 Dec 2008 18:52:24 +0000 (18:52 +0000)]
revert R190, keep R191
Waiting for the patch fixing bugs.

git-svn-id: http://opkg.googlecode.com/svn/trunk@192 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoadding --enable-curl configuation to configure.ac
ticktock35 [Sat, 27 Dec 2008 17:26:46 +0000 (17:26 +0000)]
adding --enable-curl configuation to configure.ac

Basically it apply opkg_wget.patch from OE but I add something to the configure.ac


Thanks Mike Westerhof <mwester@dls.net>

git-svn-id: http://opkg.googlecode.com/svn/trunk@191 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoThanks for Mike Westerhof <mwester@dls.net>
ticktock35 [Sat, 27 Dec 2008 16:52:36 +0000 (16:52 +0000)]
Thanks for  Mike Westerhof <mwester@dls.net>
 This patchset updates the libbb stuff to use a vfork() version of
 gz_open, called gzvopen.  This is done because a standard fork will
 duplicate the entire address space.  This will invoke the OOM
 (out of memory) killer on small-memory machines, because most often
 by the time we unzip any package, we've read the entire package
 database into memory already.  By using vfork() and immediatly
 execing the external gunzip utility, we avoid the need to clone the
 entire address space.

 Yes, this is actually **LESS** efficient than the original way!
 But there is no way to (currently) dodge the OOM killer on a
 per-process basis, so the alternatives are to either change the
 OOM killer behavior system-wide, or to use this workaround.

 Mike Westerhof, Dec 2008

git-svn-id: http://opkg.googlecode.com/svn/trunk@190 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agowhen configure with --disable-gpg, no message complain about the signature stuff.
ticktock35 [Fri, 26 Dec 2008 07:07:21 +0000 (07:07 +0000)]
when configure with --disable-gpg, no message complain about the signature stuff.

git-svn-id: http://opkg.googlecode.com/svn/trunk@189 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoremove the active_list_test target
ticktock35 [Fri, 19 Dec 2008 22:53:28 +0000 (22:53 +0000)]
remove the active_list_test target

git-svn-id: http://opkg.googlecode.com/svn/trunk@188 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoTurn off the active_list_test app by default. Use it when we need it.
ticktock35 [Fri, 19 Dec 2008 22:48:57 +0000 (22:48 +0000)]
Turn off the active_list_test app by default. Use it when we need it.

git-svn-id: http://opkg.googlecode.com/svn/trunk@187 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agousing hash_table reduce an O(n^2) algorithm to O(n)
ticktock35 [Fri, 19 Dec 2008 10:43:55 +0000 (10:43 +0000)]
using hash_table reduce an O(n^2) algorithm to O(n)
in strcmp

analysis from gcov:
      507: 1386:     old_files = pkg_get_installed_files(old_pkg);
      507: 1387:     new_files = pkg_get_installed_files(pkg);
        -: 1388:
     5466: 1389:     for (of = str_list_first(old_files); of; of = str_list_next
        -: 1390:          pkg_t *owner;
        -: 1391:          char *old, *new;
     4959: 1392:          old = (char *)of->data;
  2963021: 1393:          for (nf = str_list_first(new_files); nf; nf = str_list
  2961464: 1394:               new = nf->data;
  2961464: 1395:               if (strcmp(old, new) == 0) {
     3402: 1396:                    niter = &nf;
     3402: 1397:                    nf=str_list_next(new_files, nf);
     3402: 1398:                    str_list_remove(new_files, niter);
     3402: 1399:                    free(new);
     3402: 1400:                    goto NOT_OBSOLETE;
        -: 1401:               }

      507: 1393:     new_files_table.entries = NULL;
      507: 1394:     hash_table_init("new_files" , &new_files_table, 20);
     8897: 1395:     for (nf = str_list_first(new_files); nf; nf = str_list_next
     8390: 1396:         if (nf && nf->data)
     8390: 1397:            hash_table_insert(&new_files_table, nf->data, nf->da
        -: 1398:     }
        -: 1399:
     5466: 1400:     for (of = str_list_first(old_files); of; of = str_list_next
        -: 1401:          pkg_t *owner;
        -: 1402:          char *old, *new;
     4959: 1403:          old = (char *)of->data;
     4959: 1404:          new = (char *) hash_table_get (&new_files_table, old);
     4959: 1405:          if (new)
     4894: 1406:              continue;

git-svn-id: http://opkg.googlecode.com/svn/trunk@186 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agousing list_head to handle the list
ticktock35 [Thu, 18 Dec 2008 17:47:41 +0000 (17:47 +0000)]
using list_head to handle the list

git-svn-id: http://opkg.googlecode.com/svn/trunk@185 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoonly add pkg_vec_sort when needed
ticktock35 [Wed, 17 Dec 2008 00:27:16 +0000 (00:27 +0000)]
only add pkg_vec_sort when needed

git-svn-id: http://opkg.googlecode.com/svn/trunk@184 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agomove pkg_compare_name to pkg_vec and remove qsort in hash_get
ticktock35 [Wed, 17 Dec 2008 00:27:04 +0000 (00:27 +0000)]
move pkg_compare_name to pkg_vec and remove qsort in hash_get

git-svn-id: http://opkg.googlecode.com/svn/trunk@183 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoremove some unnecessary code from pkg_vec_insert
ticktock35 [Wed, 17 Dec 2008 00:26:45 +0000 (00:26 +0000)]
remove some unnecessary code from pkg_vec_insert

git-svn-id: http://opkg.googlecode.com/svn/trunk@182 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agointroduce the active_list for searching.
ticktock35 [Wed, 17 Dec 2008 00:26:32 +0000 (00:26 +0000)]
introduce the active_list for searching.

introduce the active_list_sort

git-svn-id: http://opkg.googlecode.com/svn/trunk@181 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: rename opkg_clone to pkg_t_to_opkg_package_t.
ticktock35 [Mon, 15 Dec 2008 05:34:38 +0000 (05:34 +0000)]
opkg: rename opkg_clone to pkg_t_to_opkg_package_t.
It's more likely the functionality.

git-svn-id: http://opkg.googlecode.com/svn/trunk@180 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: Update TODO and remark that pkg_hash_fetch_best_installation_candidate
ticktock35 [Mon, 15 Dec 2008 05:34:28 +0000 (05:34 +0000)]
opkg: Update TODO and remark that pkg_hash_fetch_best_installation_candidate
      is very slow and been called very often. This has a huge improve space.

git-svn-id: http://opkg.googlecode.com/svn/trunk@179 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: using active_list to list all the installed pkgs.
ticktock35 [Mon, 15 Dec 2008 05:34:16 +0000 (05:34 +0000)]
opkg: using active_list to list all the installed pkgs.
      adding function that allows node move from one list to another

git-svn-id: http://opkg.googlecode.com/svn/trunk@178 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: using active list to list upgradeable pkgs
ticktock35 [Mon, 15 Dec 2008 05:34:03 +0000 (05:34 +0000)]
opkg: using active list to list upgradeable pkgs

git-svn-id: http://opkg.googlecode.com/svn/trunk@177 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: trivial adding some comments
ticktock35 [Mon, 15 Dec 2008 05:33:45 +0000 (05:33 +0000)]
opkg: trivial adding some comments

git-svn-id: http://opkg.googlecode.com/svn/trunk@176 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: update TODO
ticktock35 [Mon, 15 Dec 2008 05:33:34 +0000 (05:33 +0000)]
opkg: update TODO

git-svn-id: http://opkg.googlecode.com/svn/trunk@175 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

13 years agoopkg: trivial rename old_pkg_to_new to pkg_clone as a more readable name.
ticktock35 [Mon, 15 Dec 2008 05:33:27 +0000 (05:33 +0000)]
opkg: trivial rename old_pkg_to_new to pkg_clone as a more readable name.

git-svn-id: http://opkg.googlecode.com/svn/trunk@174 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358