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

Compiling packages in the pkg-ocaml-maint structure



On Sat, Jun 07, 2003 at 12:40:21PM +0200, Stefano Zacchiroli wrote:

> Then, to work with the package, I suggest this approach [1]:
> - untar the original tarball
> - copy the debian directory inside the untarred upstream directory
> - work on the package as usual
> - build it using passing "-i.svn" option to dpkg-buildpackage or debuild
> - once finished commit your changes to the debian directory directly
>   from the upstream tarball
> - now you can remove the upstream tree and update the debian directory
>   outside the upstram tree

Attached is small script (yes - it is written in perl!) that builds
the source of a package following the structure of pkg-ocaml-maint,
and compiles it. You should be in the directory containing the
*.orig.tar.gz and the debian directory when you start it. Attention,
no test is done before possibly overwriting other existing 
subdirectories.

-Ralf.
-- 
#!/usr/bin/perl

# opkg-buildpackage, Version 0.1 (June 30, 2003)
# Ralf Treinen <treinen@debian.org>
#
# simple perl script to build a debian package following the pkg-ocaml-maint
# structure of original source tarball and separate debian dir containing
# the patches.

# get package name and version from debian/changelog
open(CHL, "debian/changelog") || die "cannot open debian/changelog.\n";
while(<CHL>){
    last unless /^\s*$/;
}
close CHL;
($package,$version) = m/^\s*([a-z0-9\+\-\.]*)\s*\(([0-9\+\-\.]*)\).*$/;
$version =~ s/\-[^\-]*$//;
$topdir = "$package-$version";
$origtar = "$package" . "_" . "$version.orig.tar.gz";

# get the name of the directory containing the orig sources
open(TARLIST, "tar tvfz $origtar |");
($unpackdir) = (<TARLIST> =~ m/([^\s]*)\/\s*$/);
close TARLIST;

# unpack
system "\rm -rf $topdir $unpackdir";
system "tar xfz $origtar";
rename($unpackdir, $topdir); 
system "cp -r debian $topdir";

# compile
chdir $topdir;
system "dpkg-buildpackage -rfakeroot -uc -us -i.svn";

Reply to: