Proposing a New App Developer Upload Process

Michael Hall mhall119 at ubuntu.com
Tue Sep 4 23:21:30 UTC 2012


On 09/04/2012 06:05 PM, Scott Kitterman wrote:
> On Tuesday, September 04, 2012 01:19:50 PM Michael Hall wrote:
>> On 09/04/2012 01:02 PM, Emmet Hikory wrote:
>>> Michael Hall wrote:
>>>> Not only would it require the we carry these patches to system tools and
>>>> libraries indefinitely, it would also mean that we encourage developers
>>>> to produce apps and packages that are not compatible with our Upstream
>>>> (Debian) or any other distro.
>>>>
>>>     We rather ought encourage developers to use build systems that allow
>>>
>>> one to specify an install location: then the difference between installing
>>> to /opt/ and system locations becomes entirely a matter of a preference in
>>> the packaging: other format distributions will not even notice. 
>>> Distributions that use Debian-format packages are likely to be downstream
>>> from either Debian or Ubuntu: if we share the optional /opt/ packaging
>>> preference with Debian, then it is trivial for any distribution to adopt
>>> the package as either extra or part of the system with very little
>>> effort.
>>
>> If it can be reduced to a matter of build-time preferences, that would
>> be fine.  The current /opt/ rules and support, however, require both a
>> significant amount of extra work in the packaging, and usually
>> additional changes to the code itself.
>>
>>>     As for patches in system tools, at least for icon cache, path, and
>>>     desktop
>>>
>>> file discovery, this is one or two lines in a configuration file that
>>> already carries Ubuntu-specific patches.  Is there a specific example of
>>> a discovery mechanism that is more complicated to change?
>>
>> .desktop files, .service files (for dbus), .lens and .scope files (for
>> Unity) all needed to be changed to point to executables or images in
>> /opt/extra.ubuntu.com/${appname}/ when being packaged for Extras.  Unity
>> APIs that require a .desktop or image file name had to use absolute
>> paths to the files in /opt/extras.ubuntu.com/{$appname}.  These all
>> required changes to the app's source in order to support the
>> installation under /opt/.
> 
> These sorts of changes should be generalizable to be supported at build time.  
> It would take some work to set up the first time, but any build system I've 
> worked with would be able to do this.
> 
> Scott K
> 
To support them at build-time, you end up having to make various changes
to the original source.  For example, a typical foo.desktop file will
contain the following lines:

Icon=foo
Exec=foo

Now, if the app has to be installed into /opt/extras.ubuntu.com/foo/,
those lines will need to be changed to:

Icon=/opt/extras.ubuntu.com/foo/foo.png
Exec=/opt/extras.ubuntu.com/foo/bin/foo

Which requires running sed against foo.desktop using overrides in
debian/rules.  We need to do this for DBus services and Unity lenses and
scopes as well.  Other build-time hacks are required to support
translations in /opt/, and apport crashdb.  None of these are especially
difficult, but they accumulate into a large number of changes for even
the most basic application.

I have attached an example debian/rules file from one of the App
Showdown entries.  This was a simple python app with a valid setup.py,
built using Quickly.  You can see how much it's having to change to
install into /opt/, and this was typical of all App Showdown
debian/rules files.

In addition, a quick scan of the source for some of those apps shows a
number of places where paths to /opt/ are being hard-coded elsewhere in
the source.  I know this isn't something they should be hard-coding, but
these are the kind of independent app developers we want to target
Ubuntu and this is what they are likely going to keep doing in order to
support having their app installed in /opt/.


Michael Hall
mhall119 at ubuntu.com
-------------- next part --------------
#!/usr/bin/make -f
%:
ifneq ($(shell dh -l | grep -xF translations),)
	dh $@ --with python2,translations
else
	dh $@ --with python2
endif

override_dh_auto_install:
	dh_auto_install -- --install-scripts=/opt/extras.ubuntu.com/kwikly                 --install-data=/opt/extras.ubuntu.com/kwikly                 --install-lib=/opt/extras.ubuntu.com/kwikly

override_dh_python2:
	dh_python2 /opt/extras.ubuntu.com/kwikly


override_dh_install:
	dh_install
	mkdir -p debian/kwikly/opt/extras.ubuntu.com/kwikly/bin
	if [ -x debian/kwikly/opt/extras.ubuntu.com/kwikly/kwikly/kwikly ]; then mv debian/kwikly/opt/extras.ubuntu.com/kwikly/kwikly/kwikly debian/kwikly/opt/extras.ubuntu.com/kwikly/bin; fi
	if [ -f debian/kwikly/opt/extras.ubuntu.com/kwikly/share/applications/kwikly.desktop ]; then \
		mkdir -p debian/kwikly/usr/share/applications; \
		mv debian/kwikly/opt/extras.ubuntu.com/kwikly/share/applications/kwikly.desktop debian/kwikly/usr/share/applications/extras-kwikly.desktop; \
		rmdir --ignore-fail-on-non-empty debian/kwikly/opt/extras.ubuntu.com/kwikly/share/applications; \
		sed -i 's|Exec=.*|Exec=/opt/extras.ubuntu.com/kwikly/bin/kwikly|' debian/kwikly/usr/share/applications/extras-kwikly.desktop; \
		sed -i 's|Icon=/usr/|Icon=/opt/extras.ubuntu.com/kwikly/|' debian/kwikly/usr/share/applications/extras-kwikly.desktop; \
	fi
	grep -RlZ 'import gettext' debian/kwikly/* | xargs -0 -r sed -i 's|\(import\) gettext$$|\1 locale|'
	grep -RlZ 'from gettext import gettext as _' debian/kwikly/* | xargs -0 -r sed -i 's|from gettext \(import gettext as _\)|from locale \1|'
	grep -RlZ "gettext.textdomain('kwikly')" debian/kwikly/* | xargs -0 -r sed -i "s|gettext\(\.textdomain('kwikly')\)|locale\.bindtextdomain('kwikly', '/opt/extras.ubuntu.com/kwikly/share/locale')\nlocale\1|" 
	sed -i "s|__kwikly_data_directory__ =.*|__kwikly_data_directory__ = '/opt/extras.ubuntu.com/kwikly/share/kwikly/'|" debian/kwikly/opt/extras.ubuntu.com/kwikly/kwikly*/kwiklyconfig.py
	sed -i 's|        sys.path.insert(0, opt_path)|\0\n    os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/kwikly/share/", os.getenv("XDG_DATA_DIRS", "")))|' debian/kwikly/opt/extras.ubuntu.com/kwikly/bin/kwikly
	if [ -d debian/kwikly/opt/extras.ubuntu.com/kwikly/share/glib-2.0/schemas ]; then glib-compile-schemas debian/kwikly/opt/extras.ubuntu.com/kwikly/share/glib-2.0/schemas; fi
	if [ -f debian/kwikly/etc/apport/crashdb.conf.d/kwikly-crashdb.conf ]; then \
			mkdir -p debian/kwikly/opt/extras.ubuntu.com/kwikly/etc/apport/crashdb.conf.d; \
			mv debian/kwikly/etc/apport/crashdb.conf.d/kwikly-crashdb.conf debian/kwikly/opt/extras.ubuntu.com/kwikly/etc/apport/crashdb.conf.d; \
			rm -rf debian/kwikly/etc; \
	fi


More information about the ubuntu-devel mailing list