Skip to content

Commit

Permalink
RPM package construction
Browse files Browse the repository at this point in the history
Former-commit-id: b804704
  • Loading branch information
Cristina Yenyxe Gonzalez Garcia committed Nov 22, 2012
1 parent 002f981 commit 0de252c
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 3 deletions.
6 changes: 6 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ sudo yum install libconfig libcurl gsl libxml2 zlib

Install
-------
This step is not neccessary to run HPG Variant, but to install it in your system.

In order to create RPM packages, you must install the rpmbuild tool by running the command 'sudo yum install rpm-build'.

Type 'scons rpm' to create a file named 'hpg-variant_X.Y.fc17.x86_64.rpm' (with X.Y being the version number) in the subfolder 'rpm/rpmbuild/RPMS/x86_64'.
Type 'sudo rpm -i hpg-variant_X.Y.fc17.x86_64.rpm', and don't forget to replace X.Y with the corresponding version number of your package.
7 changes: 6 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@ env.Package(NAME = 'hpg-variant',
PACKAGEVERSION = 0,
PACKAGETYPE = 'src_targz',
source = env.FindSourceFiles() + env.FindHeaderFiles(progs) +
[ '#libs/libargtable2.a', '#libs/libcprops.a',
[ '#libs/libargtable2.a', '#libs/libcprops.a',
Glob('#include/*.h'), Glob('#include/cprops/*.h'),
'#buildaux.py', '#buildvars.py', '#libs/common-libs/buildvars.py', '#libs/bioinfo-libs/buildvars.py',
'#deb/SConscript', '#rpm/SConscript',
'#COPYING', '#INSTALL' ]
)

# Create Debian package
if 'debian' in COMMAND_LINE_TARGETS:
SConscript("deb/SConscript", exports = ['env'] )

if 'rpm' in COMMAND_LINE_TARGETS:
SConscript("rpm/SConscript", exports = ['env'] )
4 changes: 2 additions & 2 deletions deb/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ DEBFILES = [
("usr/bin/hpg-var-gwas", "#bin/hpg-var-gwas"),
("usr/bin/hpg-var-vcf", "#bin/hpg-var-vcf"),

("etc/hpg-variant/hpg-variant.conf", "#bin/hpg-variant.cfg"),
("etc/hpg-variant/vcf-info-fields.conf", "#bin/vcf-info-fields.cfg"),
("etc/hpg-variant/hpg-variant.conf", "#bin/hpg-variant.conf"),
("etc/hpg-variant/vcf-info-fields.conf", "#bin/vcf-info-fields.conf"),

]

Expand Down
57 changes: 57 additions & 0 deletions rpm/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import hashlib, os, shutil, sys

Import('env') # exported by parent SConstruct

RPMNAME = "hpg-variant"
RPMVERSION = "0.2"
RPMARCH = "x86_64"
RPMBUILDREQUIRES = "gcc,glibc-devel,scons,libconfig-devel,libcurl-devel,gsl-devel,libxml2-devel,zlib-devel".split(", ")
RPMREQUIRES = "libconfig,libcurl,gsl,libxml2,zlib".split(", ") # what are we dependent on?
RPMSUMMARY = "HPG Variant summary"
RPMDESC = "HPG Variant retrieves the effect of genome mutations and allows to conduct analysis"
RPMSECTION = "Application/Engineering"
RPMSOURCE = "hpg-variant-0.2.tar.gz"
RPMURL = "http://bioinfo.cipf.es"

RPMBUILDIR = 'rpmbuild'
RPMSPECFILE = "%s.spec" % RPMNAME


# We want the package to be built when we build 'rpm'
basename_rpmpkg = '%s-%s.fc17.%s.rpm' % (RPMNAME, RPMVERSION, RPMARCH)
root_rpmpkg = "#" + basename_rpmpkg
rpmpkg = os.path.join(RPMBUILDIR, 'RPMS', RPMARCH, basename_rpmpkg)
env.Alias("rpm", rpmpkg)
env.Depends(rpmpkg, RPMSPECFILE)
env.Depends(root_rpmpkg, RPMSPECFILE)


# 1) Create folder for building the packages
if os.path.exists(RPMBUILDIR):
shutil.rmtree(RPMBUILDIR)

SOURCES_DIR = os.path.join(RPMBUILDIR, 'SOURCES')
SPECS_DIR = os.path.join(RPMBUILDIR, 'SPECS')

os.mkdir(RPMBUILDIR)
os.mkdir(os.path.join(RPMBUILDIR, 'BUILD'))
os.mkdir(os.path.join(RPMBUILDIR, 'RPMS'))
os.mkdir(SOURCES_DIR)
os.mkdir(SPECS_DIR)
os.mkdir(os.path.join(RPMBUILDIR, 'SRPMS'))

# 2) Copy tarball to RPMBUILDIR/SOURCES subfolder
shutil.copy('../%s' % RPMSOURCE, SOURCES_DIR)

# 3) Copy .spec file to RPMBUILDIR folder
shutil.copy(RPMSPECFILE, SPECS_DIR)

# 4) Run rpmbuild with the .spec file as argument and copy to root folder
SOURCETAR = os.path.join(SOURCES_DIR, RPMSOURCE)
cmd = "rpmbuild --define='_topdir %s' -ba $SOURCE" % os.path.abspath(RPMBUILDIR)

env.Command(rpmpkg, RPMSPECFILE, cmd)

# 5) Copy to root folder
#print "copy to %s" % root_rpmpkg
#env.Command(root_rpmpkg, rpmpkg, Copy("$TARGET", "$SOURCE"))
58 changes: 58 additions & 0 deletions rpm/hpg-variant.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
%define name hpg-variant
%define version 0.2
Name: %{name}
Version: %{version}
Release: 1%{?dist}
Summary: HPG Variant

License: GPLv2
URL: http://bioinfo.cipf.es
Source0: %{name}-%{version}.tar.gz

BuildRequires: gcc
BuildRequires: glibc-devel
BuildRequires: scons
BuildRequires: libconfig-devel
BuildRequires: libcurl-devel
BuildRequires: gsl-devel
BuildRequires: libxml2-devel
BuildRequires: zlib-devel

Requires: libconfig
Requires: libcurl
Requires: gsl
Requires: libxml2
Requires: zlib

%description
HPG Variant retrieves the effect of genome mutations and allows to conduct analysis

%prep
%setup -q


%build
scons


%install
rm -rf $RPM_BUILD_ROOT

mkdir -p %{buildroot}%{_bindir}/
cp bin/hpg-var-effect %{buildroot}%{_bindir}/
cp bin/hpg-var-gwas %{buildroot}%{_bindir}/
cp bin/hpg-var-vcf %{buildroot}%{_bindir}/

mkdir -p %{buildroot}%{_sysconfdir}/%{name}/
cp bin/hpg-variant.conf %{buildroot}%{_sysconfdir}/%{name}/
cp bin/vcf-info-fields.conf %{buildroot}%{_sysconfdir}/%{name}/


%files
%doc
%{_bindir}/*
%{_sysconfdir}/*


%changelog

0 comments on commit 0de252c

Please sign in to comment.