[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Correction to web site information: OpenMRS has debian packages available for download



Hi Misha,

On Mon, Sep 27, 2010 at 06:18:04PM -0500, Misha Koshelev wrote:
> Sorry to bother...

No need to sorry!

> 1. Let's say I check out a debian package for Debian Med from the svn
> repository. Any package. I end up with a trunk directory that has a
> debian folder in it.
> 2. What are the exact steps to go from that to having a deb... i.e., is it:
> 
> debian/rules get-orig-source
> debuild
> 
> or something else?

Yes, that's the basic idea.
 
> I guess I am somewhat confused about how we store debian folders in
> subversion but nothing else. Where does the source come from?

The source is usually provided by upstream and in the most cases you
can simply download this source and rename (or symlink) it like

   mv <program>-<version>.tgz <program>_<version>.orig.tar.gz

(mind the underscore '_' between <program> and <version> - that's a
typical beginners mistake).  This is also what an

   uscan --force-download

will do for you if there is a proper debian/watch file.  The
get-orig-source target is only recommended if changes to the tarball are
needed (stripping non-free parts might be a reason to do so) or if there
is no actual tarball but simply a VCS checkout which needs to be turned
into a tarball.

> Do
> developers simply have the source locally and check out the debian
> folder into the source folder?

Once you have the source obtained as described above you unpack the
source and copy the debian directory into it and (p)debuild.  The
rationale to keep only the debian directory is that only the code in
this directory is "our" code.  Everything else is upstream work.

BTW, if you are not comfortable with this principle there is also the
option to use git.  The git people prefer a different workflow and keep
the whole source in the repository and creating the tarball via
pristine-tar.  I'm not (yet) adapted to this but here are other helpful
people on the list who will be able to provide you with details.
 
> If someone could perhaps clarify for our repository how one would go
> from retrieving the debian folder to building a package in two or
> three steps that would be great.

In short:

   1. check out <package>/trunk/debian
   2. cd <package>/trunk
   3. uscan --force-download
   4. tar -xzf <package>_<version>.orig.tar.gz
   5. cp -a debian <package-dir>
   6. cd <package-dir>
   7. pdebuild

Note: This recipe leaves some .svn directories in your debian directory
which is ugly and should be avoided.  To not push to many new things onto
you it is probably the simplest thing to just to remove these dirs
  ( find debian -name .svn -type d -exec rm -rf \{\} \; )
to build a clean package.  The more elegant way is to use the tool
svn-buildpackage but this does not always come hassle free and IMHO it
makes sense to keep it simple for the moment.

Thanks for commiting your changes.  I'll comment on your snippet of
the log:
 
> misha@misha-d630:~/debianmed/trunk$ dpkg-buildpackage -d
> dpkg-buildpackage: set CFLAGS to default value: -g -O2
> dpkg-buildpackage: set CPPFLAGS to default value:
> dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
> dpkg-buildpackage: set FFLAGS to default value: -g -O2
> dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
> dpkg-buildpackage: source package openmrs
> dpkg-buildpackage: source version 1.6.1-1
> dpkg-buildpackage: source changed by Andreas Tille <tille@debian.org>
> dpkg-buildpackage: host architecture amd64
>  fakeroot debian/rules clean
> dh --with javahelper --with quilt clean
>    dh_testdir
>    dh_auto_clean
>    dh_quilt_unpatch
> No patch removed
>    dh_clean
>    jh_clean
>  dpkg-source -b trunk
> dpkg-source: info: using source format `1.0'
> dpkg-source: warning: source directory 'trunk' is not
> <sourcepackage>-<upstreamversion> 'openmrs-1.6.1'

You probably did not unpacked the upstream source - this was discussed above.

> dpkg-source: warning: .orig directory name trunk.orig is not
> <package>-<upstreamversion> (wanted openmrs-1.6.1.orig)

See above.

> dpkg-source: info: building openmrs using existing openmrs_1.6.1.orig.tar.gz
> dpkg-source: info: building openmrs in openmrs_1.6.1-1.diff.gz
> dpkg-source: warning: executable mode 0755 of 'debian/postrm' will not
> be represented in diff
> dpkg-source: warning: executable mode 0755 of 'debian/postinst' will
> not be represented in diff

That's a cosmetical nitpicking.  I removed the executable permission in SVN
(I'm not sure whether this is propagated if you just "svn up" - you might need
to delete these files before or simply "chmod 644 post*")

> dpkg-source: warning: file trunk/debian/copyright has no final newline
> (either original or modified version)

Also cosmetical nitpicking - I just added a newline in SVN.

> dpkg-source: warning: executable mode 0755 of 'debian/get-orig-source'
> will not be represented in diff

See above with post* files.

> dpkg-source: warning: file
> trunk/debian/.svn/text-base/copyright.svn-base has no final newline
> (either original or modified version)

That's what I was talking about above: Simple remove the .svn dirs in your
copy of the debian directory.

> dpkg-source: warning: file trunk/debian/patches/series has no final
> newline (either original or modified version)
> dpkg-source: warning: file
> trunk/debian/patches/.svn/text-base/series.svn-base has no final
> newline (either original or modified version)
> dpkg-source: warning: ignoring deletion of file .classpath
> dpkg-source: warning: ignoring deletion of file license.txt
> dpkg-source: warning: ignoring deletion of file build.xml
> dpkg-source: warning: ignoring deletion of file liquibase.build.xml
> dpkg-source: warning: ignoring deletion of file readme.txt
> dpkg-source: warning: ignoring deletion of file .project
> ...

I guess this is also because you simply did not unpackaged the source
tarball.
 
I just made one important change to the packaging and added a
Build-Depends on quilt.  This at least results in *some* package.

However, the resulting package is basically empty.  You need to add code
which installs the builded files right into place.  I'd recommend using
a debian/install file (man dh_install) or you might need to tweek the
install target a bit.  I'll leave this as the next exercise to you - but
do not hesitate to ask in case you have no idea what to do.

Moreover there is a really important tool which checks your packages
called lintian.  Please try

   lintian -i -I *.dsc   # checks the source package
   lintian -i -I *.deb   # checks the binary package

on your resulting packages.  The -i option gives longish information
about the problem and the -I is "nitpicking mode" which also imports
really cosmetic issues.  However I'd regard it as a really nice way
to guide beginners through the details of packaging and I really hope
you will make it through these warnings (for sure with our help here
if needed).

Hope this helps

        Andreas.

-- 
http://fam-tille.de


Reply to: