Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to use a newer package version with my stable Ubuntu release. Asking for backport takes too long without visible result, so I thought that maybe I can build newer version myself.

Can anybody tell me what is the current best practices to build newer versions of packages that are already available on Ubuntu?

UPDATE: I found out that I need pbuilder to keep my system clean from build dependencies. So I've done:

sudo apt-get install pbuilder
sudo pbuilder create           # create isolated environment for building packages

UPD2: I tried to check if I can build current version, so I fetched source code for the current <version> of my <package>:

mkdir delme
cd delme
apt-get source <package>

UPD3: Now I tried build package from source, but can not find the results:

sudo pbuilder build *.dsc

The log says:

...
0 packages upgraded, 94 newly installed, 0 to remove and 0 not upgraded.
Need to get 30.2 MB of archives. After unpacking 89.4 MB will be used.
The following packages have unmet dependencies:
 pbuilder-satisfydepends-dummy : Depends: libjansson-dev which is a virtual package.
                                 Depends: libudev-dev but it is not going to be installed.
                                 Depends: ocl-icd-opencl-dev which is a virtual package. or
                                          opencl-dev which is a virtual package.
Unable to resolve dependencies!  Giving up...
The following NEW packages will be installed:
...
Need to get 30.2 MB of archives. After unpacking 89.4 MB will be used.
Abort.
E: pbuilder-satisfydepends failed.
I: Copying back the cached apt archive contents
...

UPD4: It appeared that these unmet dependencies are from universe package repository, so I had to enable it:

sudo pbuilder update --components "main universe" --override-config

Without --override-config pbuilder will complain that it is not set. Everything is built successfully:

ls -la /var/cache/pbuilder/result/

UP5: Found out which package versions are available and fetched the source for the needed one:

uscan --report --verbose
uscan --download-version <version>

UP6: Found uupdate utility and used that to create directory for new package and update debian/changelog, which is needed to produce new version:

cd <package>-<old-version>
uupdate ../<package>_<version>.orig.tar.gz
cd ../<package>-<version>
vim debian/changelog

UP7: To build source with pbuilder I need to generate .dsc file. It is usually done with debuild -S command, or with pdebuild -S in `pbuilder.

pdebuild -S

This errors out:

...
 fakeroot debian/rules clean
dh clean --with autoreconf
dh: unable to load addon autoreconf: ..
BEGIN failed--compilation aborted at (eval 19) line 2.

make: *** [clean] Error 2
dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2

Looks like there is no autoreconf package, but pbiulder is supposed to fetch it automatically, and seems like it uses .dsc file to do so. catch22.

UPD8: The command to build .dsc file is dpkg-source.

cd ..
dpkg-source -b <package>-<version>

Now it is possible to run pbuilder over it.

sudo pbuilder build <package>_<version>.dsc
ls -la /var/cache/pbuilder/result/

UP9: Uploading to PPA is as simple as running:

dput ppa:techtonik/backports /var/cache/pbuilder/result/<package>_<version>.changes

But it doesn't work:

Checking signature on .changes
gpg: no valid OpenPGP data found.
gpg: the signature could not be verified.
...
No signature on /var/cache/pbuilder/result/<package>_<version>.changes

UP10: I don't remember how did I generated GPG key, but I have one. Found a way to sign the packages. Edited Maintaner: field in .dsc file and used debsign.

sudo vim /var/cache/pbuilder/result/<package>_<version>.dsc
sudo debsign /var/cache/pbuilder/result/<package>_<version>.changes

Attempt to upload failed:

Error: uploading files for distribution UNRELEASED to ppa not allowed.

UP11: Redone everything from step 6. How could I know that I need to edit debian/changes to replace UNRELEASED with saucy and set my email in Maintainer: field of debian/control?

vim <package>-<version>/debian/changelog
vim <package>-<version>/debian/control
dpkg-source -b <package>-<version>
sudo pbuilder build <package>_<version>.dsc
sudo debsign /var/cache/pbuilder/result/<package>_<version>.changes
sudo dput ppa:techtonik/backports /var/cache/pbuilder/result/<package>_<version>.changes

UPD12: I still can't upload to PPA. First it was Unable to find distroseries: unstable, because I specified unstable instead of saucy as UNRELEASED replacement. After repeated step 11 it complained with Already uploaded to ... which was healed with -f key to dput. Now there is a mail that upload is rejected, because Source/binary (i.e. mixed) uploads are not allowed.

Somewhere on the new it is said that I needed to build my package with debuild -S, but I don't know how to tell that to pbuilder.

UPD14: It appeared that the culprit is dh-autoreconf package, which is required for the cleaning source before the build, but both pbuilder and debuild miss this fact and unable to recover. Installing dh-autoreconf on the host system allowed to build source package, sign and upload it even without pbuilder build.

cd <package>-<version>
debuild -S
cd ..
dput ppa:techtonik/backports <package>_<version>_source.changes

Done.

share|improve this question
    
What package are you trying to get the newest version of? Why not just download the source files and ./configure && make && make install or if they are in the repositories just sudo apt-get --only-upgrade install package_name –  jmunsch Dec 26 '13 at 20:07
    
@jmunsch, I am not sure what build dependencies are required, I'd prefer to keep my system clean of them, and no, versions are not in repositories. –  techtonik Dec 27 '13 at 1:07
    
The issue with the building, the lack of dh-autoreconf was identified in their duplicate thread here. I would suggest marking this as a duplicate of that one, so that we can show that the issue has been identified (per comments on my answer on that other thread). –  Thomas W. Dec 28 '13 at 8:16
    
I am still looking for way to do a build in isolated environment. This is still not answered. –  techtonik Dec 28 '13 at 12:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.