Packaging

From iPhone Development Wiki
Revision as of 21:32, 12 December 2014 by Britta (talk | contribs) (→‎Other files: potential error messages)

Packaging is the step prior to sharing or releasing a tweak/application/tool/library/theme. Here you put all your project files into a single nicely wrapped file that others can install on their devices.

Cydia is based on Debian APT (Advanced Packaging Tool), so a lot of general documentation about packaging for APT also applies to packaging for Cydia.

Tools

To do: add existing tools, on which platforms they are available, how to use them.

DEBIAN folder

Control file

To do: add layout of fields, what do they mean, how they are used. Refer to saurik's post and links at the bottom.

If you need to list dependencies or conflicting packages, Debian's packaging manual may be useful (because Cydia packaging is based on Debian packaging): Syntax of relationship fields, Dependencies, Conflicts -- or if you're submitting this package to a default repository, you can just ask your repository maintainer for help with this.

Other files

You can add preinst, postinst, extrainst_, prerm, and postrm files to run scripts at various points of the package installation and uninstallation lifecycle. It's important to be conservative with this code - as Best Practices explains, "Do not use postinst/preinst/extrainst_ for file management purposes! Do not store in the package files or directories that your software could create. Do not enforce permissions that your package should contain. dpkg uses an expressive packaging format that has support for permissions, ownership, and links. Use that support!"

If your package scripts have problems, especially upon uninstallation, this can be very frustrating for your user because that can be very hard to fix for them. You don't want to cause the dreaded "subprocess pre-removal script returned error" and "Sub-process /usr/bin/dpkg returned an error code" error messages.

Documentation about these scripts in the Debian packaging manual: basics and more info.

To do: Consider this paste as one example. Explain how it fits into Debian packaging (how it interacts with apt/aptitude/dpkg/Cydia).

Troubleshooting

dpkg-deb