1. Moises Henriquez
  2. sbbuilder-buildbot-patching


sbbuilder-buildbot-patching / sbbuilder


=head1 NAME

sbbuilder - A Simple script to create SlackBuild files with directory structure


sbbuilder --package=foo --version=42 [--user=Bill] [--build=1] ...

    Help Options:
	--package  Name of the package to build SlackBuild for.
	--version  Version of the package to build SlackBuild for.
	--link	   Direct link to the source tarball.
	--help     Show this scripts help information.
	--manual   Read this scripts manual.


=head1 OPTIONS

=over 8

=item B<--package=>string

Name of the package.

=item B<--version=>string

Version of the package.

=item B<--build=>string

Build number.

=item B<--user=>string

Author of the SlackBuild.

=item B<--ldoptions=>string

Extra ldoptions.

=item B<--type=>string

Type of SlackBuild.  There are 7 types of SlackBuilds :

I<normal> . Default configure; make and make install flags. 

I<perl> . Slackbuild for perl packages.

I<python> . Slackbuild for python packages.

I<noarch> . noarch package? This is for you. 

I<cmake> . Use cmake instead GNU autoconf.

I<waf> . Use waf instead GNU autoconf.

I<scons> . Use scons instead GNU autoconf.

=item B<--link=>string

Enter a download link if you know where you can find the source tarball.

If this option is set and nor package nor version are, sbbuilder will try to
guess them from the file. Alert: No success guaranteed, sbbuilder expects a
standard naming scheme.

Example: sbbuilder --link=http://foobar.com/foo-2.3.tar.gz [--user=Bill] [--build=1] ...

=item B<--configure_options=>string

Pass arguments to the configure script, in general quotes are required.

Example: sbbuilder --link=http://foobar.com/foo-2.3.tar.gz --configure_options="--without-x"

=item B<--add=>string

Add explicit package as dependency. Usually needed when a software has a non binary dependency.

Example: sbbuilder --link=http://foobar.com/foo-2.3.tar.gz --add="package_name >= 1.0-i586-1vl60"

=item B<--exclude=>string

Remove a package from the dependencies list.

Example: sbbuilder --link=http://foobar.com/foo-2.3.tar.gz --exclude="package_name >= 1.0-i586-1vl60"

=item B<--no-configure>

Do not include the execution of a configure script.

=item B<--xdesktop>

Include the generation of a Desktop Entry in the SlackBuild.

=item B<--help>
Show the brief help information.

=item B<--manual>
Read the manual, with examples.

=item B<--version>
Show the version number and exit.




  Sbbuilder is a perl script for generating SlackBuilds for the VectorLinux repository. 
  It was written for helping to build packages compliant with Vectorlinux repository standards 
  in a consistent way.


=head1 AUTHORS



=head1 LICENSE

GNU General Public License

use strict;
use warnings;
use Template;
use Getopt::Long;
use Pod::Usage;

# main
my $user;
my $type;
my $package;
my $version;
my $link;
my $build = 1;
my $configure_options;
my $ldflags;
my $manual;
my $help;
my $add;
my $exclude;
my $noconfig;
my $xdesktop;

	"user=s"              => \$user,
	"type=s"	      => \$type,
	"package=s"           => \$package,
	"version=s"           => \$version,
	"link=s"              => \$link,
	"build=s"	      => \$build,
	"configure_options=s" => \$configure_options,
	"ldflags=s"           => \$ldflags,
	"manual"    	      => \$manual,
	"help"		      => \$help,
	"add=s"		      => \$add,
	"exclude=s"	      => \$exclude,
	"no-configure"        => \$noconfig,
	"xdesktop"	      => \$xdesktop);

my $message_text = "\nVectorLinux SlackBuild Builder.\n";
my $exit_status   = 1;         
my $verbose_level = 0;
$verbose_level=2 if $manual;

if (!$link and (!$package or !$version)) {
       	pod2usage ({ -message => $message_text ,
	     -exitval => $exit_status  ,  
	     -verbose => $verbose_level,

if ($link and !$package and !$version) {
	($package, $version) = $link =~ m{(?:ht|f)tp.*/(.+)-([^-]+)\.t(ar|gz)}i ;

chomp ($user = $user || $ENV{VL_PACKAGER} || `whoami`);
$link =~ s/$package/\$NAME/g if ($link) ;
$link =~ s/$version/\$VERSION/g if ($link);

# Get sbbuilder version
my $sbbversion;
my $ls;

open $ls, "ls /var/log/packages/sbbuilder*|";
while (<$ls>) {
	if (m/sbbuilder/) {
		($sbbversion) = m/sbbuilder-(.+)-.+-\d+vl\d+/ ;

my $tt = Template->new({
	INCLUDE_PATH => '/usr/share/sbb/template'});

my $file = 'main.template';
my $vars = {
       	user              => $user,
       	type              => $type,
       	'package'         => $package,
       	version           => $version,
       	'link'            => $link,
        build             => $build,
       	configure_options => $configure_options,
       	ldflags           => $ldflags,
	add		  => $add,
	exclude		  => $exclude,
	sbbversion        => $sbbversion,
	noconfig	  => $noconfig,
	xdesktop	  => $xdesktop,

my $sbText;
$tt->process($file, $vars, \$sbText);
$sbText =~ s/^\s+|\s+$//g;

mkdir "$package" or warn "$!. Failed creating top dir.\n";
mkdir "$package/$version" or warn "$!. Failed creating version folder.\n";
mkdir "$package/$version/src" or warn "$!. Failed creating src folder.\n";
mkdir "$package/$version/src/patches" or warn "$!. Failed creating patches folder.\n";
chdir "$package/$version/src" or die $!;
open my $fh, "+>$package.SlackBuild" or die $!;
print $fh $sbText;
close $fh;
chmod(0777, "$package.SlackBuild") or warn "$!. Failed chmod on SlackBuild";

# vim: set tabstop=4 shiftwidth=4 foldmethod=marker : ##