aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-06-19 09:09:57 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-06-19 09:09:57 -0300
commit9f86bbad7efe41a2467677765e7bb304fffb5057 (patch)
tree017c89bbf97eb847f08654d1f96bb3f89bfae58f
parent16cf0606fd59484236356e400a89c083e76da64b (diff)
move all checks to check_needs.pl
This helps to add an OS-dependent logic on it Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rwxr-xr-xbuild.sh4
-rwxr-xr-xcheck_needs.pl19
2 files changed, 19 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index 3cc21f8..7d9e417 100755
--- a/build.sh
+++ b/build.sh
@@ -10,10 +10,6 @@ run ()
echo "Checking if the needed tools are present"
run ./check_needs.pl
-echo "Checking for Digest::SHA1 (package perl-Digest-SHA1)"
-run perl -MDigest::SHA1 -e 1
-echo "Checking for Proc::ProcessTable (package perl-Proc-ProcessTable)"
-run perl -MProc::ProcessTable -e 1
echo
echo "************************************************************"
echo "* This script will download the latest tarball and build it*"
diff --git a/check_needs.pl b/check_needs.pl
index 8ced4f3..dd464ac 100755
--- a/check_needs.pl
+++ b/check_needs.pl
@@ -21,11 +21,30 @@ sub need_program
$need++;
}
+sub need_perl_module
+{
+ my $prog = shift;
+ my $pkgname = shift;
+
+ my $err = system("perl -M$prog -e 1 2>/dev/null /dev/null");
+ return if ($err == 0);
+ print "ERROR: please install \"$prog\", otherwise, build won't work.";
+ print " This program is generally found at \"$pkgname\" package." if ($pkgname);
+ print "\n";
+
+ $need++;
+}
+
+# Check for needed programs/tools
need_program "git";
need_program "make";
need_program "gcc";
need_program "patch";
need_program "lsdiff", "patchutils";
+# Check for needed perl modules
+need_perl_module "Digest::SHA1", "perl-Digest-SHA1";
+need_perl_module "Proc::ProcessTable", "perl-Proc-ProcessTable";
+
die "Build can't procceed as $need dependency is missing" if ($need == 1);
die "Build can't procceed as $need dependencies are missing" if ($need);

Privacy Policy