Discussion:
1st attempt at building package: "Malformed package file package.opk"
Fred
2011-06-23 14:19:03 UTC
Permalink
Hello

Based on the following article mentionned in the wiki...

www.inportb.com/2010/10/19/making-an-opkg-package/

... I attempted to build my first opkg package, which fails installing
with the following error: "Collected errors: * pkg_init_from_file:
Malformed package file package.opk."

Here's what I did:

1. mkdir /tmp/mypackage

2. /tmp/mypackage/ contains the following files:
+-- bin
¦   +-- hello
¦   +-- hello.c
+-- control
+-- control.tar.gz
+-- data.tar.gz
+-- debian-binary
+-- package.tar.gz
+-- postinst
+-- postrm
+-- preinst
+-- prerm

3. Here's the contents of each file:
debian-binary
2.0
control.tar.gz: tar czvf control.tar.gz control preinst postinst prerm
postrm
control
Package: opkg-hello
Version: 0.0.1
Description: Sample OPKG package
Section: cyanogenmod/applications
Priority: optional
Maintainer: Jiang Yio
Architecture: all
Homepage: http://inportb.com/
Source:
Depends:
preinst
#!/bin/sh
echo "preinst: preparing to install package"
postinst
#!/bin/sh
echo "postinst: installed package"
prerm
#!/bin/sh
echo "prerm: preparing to remove package"
postrm
#!/bin/sh
echo "postrm: removed package"
data.tar.gz: tar czvfP data.tar.gz ./bin/hello
/bin
hello

4. Still on the workstation, I proceeded with the following:

tar zcvf package.tar.gz debian-binary control.tar.gz data.tar.gz
ar -r package.opk package.tar.gz
mv package.opk /var/www

5. On the appliance, downloaded and ran the following:

/var/tmp> ./opkg-cl install package.opk
Collected errors:
* pkg_init_from_file: Malformed package file package.opk.

Can someone spot what I did wrong?

Thank you.
--
You received this message because you are subscribed to the Google Groups "opkg-devel" group.
To post to this group, send email to opkg-devel-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to opkg-devel+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/opkg-devel?hl=en.
Fred
2011-06-23 14:46:21 UTC
Permalink
Post by Fred
Can someone spot what I did wrong?
Incidently, the OpenWrt people build opkg packages using a Makefile:

http://wiki.openwrt.org/doc/devel/packages

What is the recommended way? Do it manually like the above or through
OpenWrt's Makefile?
--
You received this message because you are subscribed to the Google Groups "opkg-devel" group.
To post to this group, send email to opkg-devel-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to opkg-devel+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/opkg-devel?hl=en.
Graham Gower
2011-06-23 23:40:19 UTC
Permalink
Post by Fred
Post by Fred
Can someone spot what I did wrong?
http://wiki.openwrt.org/doc/devel/packages
What is the recommended way? Do it manually like the above or through
OpenWrt's Makefile?
The "Malformed package" error occurs when opkg cannot correctly parse
the control file - more accurately, when it can't find a name for the
package (the "Package" field). Your control file doesn't look
obviously wrong, but I suppose this might happen if you have dos end
of line characters.

There is no authoritative way that is recommended when creating a
.opk. Many people use opkg-utils successfully, others do it manually
or roll their own scripts. I have in the past done all three.

-Graham
--
You received this message because you are subscribed to the Google Groups "opkg-devel" group.
To post to this group, send email to opkg-devel-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to opkg-devel+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/opkg-devel?hl=en.
Fred
2011-06-24 10:45:28 UTC
Permalink
Post by Graham Gower
The "Malformed package" error occurs when opkg cannot correctly parse
the control file - more accurately, when it can't find a name for the
package (the "Package" field). Your control file doesn't look
obviously wrong, but I suppose this might happen if you have dos end
of line characters.
Thanks Graham. Elsewhere, I was told not to leave empty fields in the
control file, so removed the Source and Depends lines, but am getting
the same error.

What settings can I use in the Section line? The tutorial used
"cyanogenmod/applications" because it was written for Android, but is
it OK to keep this even to install on an appliance that uses uClinux?

Likewise, can I leave "all" for the Architecture line, or should I use
the specific CPU/OS used by the appliance (in which case: What format
should the string use?)?

Thank you.
--
You received this message because you are subscribed to the Google Groups "opkg-devel" group.
To post to this group, send email to opkg-devel-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to opkg-devel+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/opkg-devel?hl=en.
Fred
2011-06-24 17:45:05 UTC
Permalink
For the benefit of other opkg newbies:

1. Do not use "tar" followed by "ar": Only use "ar" to combine
control.tar.gz data.tar.gz debian-binary

2. control.tar.gz must not include paths to the files, so either the
files are at the root, or you must cd to the directory, eg. this won't
work: "tar zcvf control.tar.gz ./CONTROL/*"

Thanks for the help.
Graham Gower
2011-06-25 00:07:17 UTC
Permalink
Post by Fred
What settings can I use in the Section line? The tutorial used
"cyanogenmod/applications" because it was written for Android, but is
it OK to keep this even to install on an appliance that uses uClinux?
The Section field is completely ignored by opkg. You can put whatever
you want here.
Post by Fred
Likewise, can I leave "all" for the Architecture line, or should I use
the specific CPU/OS used by the appliance (in which case: What format
should the string use?)?
The Architecture field is free form, it can be whatever you want, but
it must match one of the arch fields specified in your conf files.

-Graham
Fred
2011-06-25 23:49:57 UTC
Permalink
Thanks Graham.

Loading...