summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-07-23 14:56:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-24 23:45:19 +0100
commitdf0ef260f36df3993377196962eb6d52ab36b38c (patch)
treed542df60b7b24a16fc40f7306b2f70432e27231d /scripts
parentb396c98e4379ef080ad7e90efe0d5fb21a3b046c (diff)
downloadopenembedded-core-df0ef260f36df3993377196962eb6d52ab36b38c.tar.gz
openembedded-core-df0ef260f36df3993377196962eb6d52ab36b38c.tar.bz2
openembedded-core-df0ef260f36df3993377196962eb6d52ab36b38c.zip
scripts/create-recipe: drop
We have "recipetool create" (or "devtool add" which wraps it) instead which works pretty well now, is written in Python and thus can call into BitBake/OE code easily, and can do things that create-recipe can't; any future improvements should go into recipetool and therefore I think we'd rather people used it instead. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create-recipe2071
1 files changed, 0 insertions, 2071 deletions
diff --git a/scripts/create-recipe b/scripts/create-recipe
deleted file mode 100755
index e4bc4c322b..0000000000
--- a/scripts/create-recipe
+++ /dev/null
@@ -1,2071 +0,0 @@
-#!/usr/bin/perl -w
-
-# Copyright (C) 2012 Wind River Systems, Inc.
-#
-# Copyright (C) 2010 Intel Corporation
-#
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception, you may create a larger work that contains
-# part or all of the autospectacle output and distribute that work
-# under terms of your choice.
-# Alternatively, if you modify or redistribute autospectacle itself,
-# you may (at your option) remove this special exception.
-#
-# This special exception was modeled after the bison exception
-# (as done by the Free Software Foundation in version 2.2 of Bison)
-#
-
-
-use File::Temp qw(tempdir);
-use File::Path qw(mkpath rmtree);
-use File::Spec ();
-use File::Basename qw(basename dirname);
-
-
-my $name = "";
-my $predef_version = "TO BE FILLED IN";
-my $version = $predef_version;
-my $pversion = $predef_version;
-my $description = "";
-my $summary = "";
-my $url = "";
-my $homepage = "";
-my @depends;
-my @rdepends;
-my @rawpythondeps;
-my $configure = "";
-my $localename = "";
-my @sources;
-my @mainfiles;
-my @patches;
-
-my $md5sum = "";
-my $sh256sum = "";
-my @inherits;
-
-my $printed_subpackages = 0;
-my $fulldir = "";
-
-my $builder = "";
-
-
-my $oscmode = 0;
-my $python = 0;
-
-my @banned_pkgconfig;
-my %failed_commands;
-my %failed_libs;
-my %failed_headers;
-
-
-
-######################################################################
-#
-# License management
-#
-# We store the sha1sum of common COPYING files in an associative array
-# %licenses.
-#
-# For all matching sha1's in the tarball, we then push the result
-# in the @license array (which we'll dedupe at the time of printing).
-#
-
-my %licenses;
-my @license;
-my %lic_files;
-
-sub setup_licenses
-{
- $licenses{"06877624ea5c77efe3b7e39b0f909eda6e25a4ec"} = "GPLv2";
- $licenses{"075d599585584bb0e4b526f5c40cb6b17e0da35a"} = "GPLv2";
- $licenses{"10782dd732f42f49918c839e8a5e2894c508b079"} = "GPLv2";
- $licenses{"2d29c273fda30310211bbf6a24127d589be09b6c"} = "GPLv2";
- $licenses{"4df5d4b947cf4e63e675729dd3f168ba844483c7"} = "LGPLv2.1";
- $licenses{"503df7650052cf38efde55e85f0fe363e59b9739"} = "GPLv2";
- $licenses{"5405311284eab5ab51113f87c9bfac435c695bb9"} = "GPLv2";
- $licenses{"5fb362ef1680e635fe5fb212b55eef4db9ead48f"} = "LGPLv2";
- $licenses{"68c94ffc34f8ad2d7bfae3f5a6b996409211c1b1"} = "GPLv2";
- $licenses{"66c77efd1cf9c70d4f982ea59487b2eeb6338e26"} = "LGPLv2.1";
- $licenses{"74a8a6531a42e124df07ab5599aad63870fa0bd4"} = "GPLv2";
- $licenses{"8088b44375ef05202c0fca4e9e82d47591563609"} = "LGPLv2.1";
- $licenses{"8624bcdae55baeef00cd11d5dfcfa60f68710a02"} = "GPLv3";
- $licenses{"8e57ffebd0ed4417edc22e3f404ea3664d7fed27"} = "MIT";
- $licenses{"99b5245b4714b9b89e7584bfc88da64e2d315b81"} = "BSD";
- $licenses{"aba8d76d0af67d57da3c3c321caa59f3d242386b"} = "MPLv1.1";
- $licenses{"bf50bac24e7ec325dbb09c6b6c4dcc88a7d79e8f"} = "LGPLv2";
- $licenses{"caeb68c46fa36651acf592771d09de7937926bb3"} = "LGPLv2.1";
- $licenses{"dfac199a7539a404407098a2541b9482279f690d"} = "GPLv2";
- $licenses{"e60c2e780886f95df9c9ee36992b8edabec00bcc"} = "LGPLv2.1";
- $licenses{"c931aad3017d975b7f20666cde0953234a9efde3"} = "GPLv2";
-}
-
-sub guess_license_from_file {
- my ($copying) = @_;
-
- if (!-e $copying) {
- return;
- }
-
- my $sha1output = `sha1sum $copying`;
- $sha1output =~ /^([a-zA-Z0-9]*) /;
- my $sha1 = $1;
-
- chomp($sha1);
-
- #
- # if sha1 matches.. push there result
- #
- if (defined($licenses{$sha1})) {
- my $lic = $licenses{$sha1};
- push(@license, $lic);
-
- my $md5output = `md5sum $copying`;
- $md5output =~ /^([a-zA-Z0-9]*) /;
- my $md5 = $1;
- chomp($md5);
- $lic_files{$copying} = $md5
- }
-
- #
- # if file is found, and licence of python
- # package is already aquired, add file.
- #
- if ($python == 1 && @license != 0) {
- my $md5output = `md5sum $copying`;
- $md5output =~ /^([a-zA-Z0-9]*) /;
- my $md5 = $1;
- chomp($md5);
- $lic_files{$copying} = $md5
- }
-
- #
- # We also must make sure that the COPYING/etc files
- # end up in the main package as %doc..
- #
- $copying =~ s/$fulldir//g;
- $copying =~ s/^\///g;
- $copying = "\"\%doc " . $copying ."\"";
-
- push(@mainfiles, $copying);
-}
-
-sub print_license
-{
- my $count = @license;
- if ($count == 0) {
- print OUTFILE "License: TO BE FILLED IN\n";
- return;
- }
-
- # remove dupes
- undef %saw;
- @saw{@license} = ();
- @out = sort keys %saw;
-
- print OUTFILE "License : ";
- foreach (@out) {
- print OUTFILE "$_ ";
- }
- print OUTFILE "\n";
-}
-
-# end of license section
-#
-#######################################################################
-
-######################################################################
-#
-# Package group management
-#
-# We set up an associative array of regexp patterns, where the content
-# of the array is the name of the group.
-#
-# These are "strings of regexps", which means one needs to escape
-# everything, and if you want the actual regexp to have a \,
-# it needs to be a \\ in this string.
-
-my %group_patterns;
-my @groups;
-my $group = "TO_BE/FILLED_IN";
-
-sub setup_group_rules
-{
- $group_patterns{"^\\/usr\\/lib\\/.*so"} = "System/Libraries";
- $group_patterns{"^\\/lib\\/.*so"} = "System/Libraries";
- $group_patterns{"^\\/bin\\/.*"} = "Applications/System";
- $group_patterns{"^\\/sbin\\/.*"} = "Applications/System";
- $group_patterns{"^\\/usr\\/sbin\\/.*"} = "Applications/System";
-}
-
-sub guess_group_from_file
-{
- my ($filename) = @_;
- while (($key,$value) = each %group_patterns) {
- if ($filename =~ /$key/) {
- push(@groups, $value);
- }
- }
-
-}
-
-# end of group section
-#
-######################################################################
-
-
-######################################################################
-#
-# Files and package section
-#
-# This section creates the %files section, but also decides which
-# subpackages (devel and/or doc) we need to have.
-#
-# We start out with the @allfiles array, which will contain all the
-# files installed by the %build phase of the package. The task is
-# to sort these into @mainfiles, @develfiles and @docfiles.
-# In addition, an attempt is made to compress the files list by
-# replacing full filenames with "*" patterns.
-#
-# For this we use a set of regexps from the @files_match array,
-# which are then used as index to three associative arrays:
-# %files_target : numerical index for which package the regexp
-# would place the file at hand.
-# 0 - main package
-# 1 - devel package
-# 2 - doc package
-# 99 - don't package this at all
-#
-# %files_from: regexp to match the file against for filename-wildcarding
-# %files_to : pattern to append to the ()'d part of %files_from to end up
-# with the filename-wildcard.
-
-my @allfiles;
-my @develfiles;
-my @docfiles;
-
-
-my @files_match;
-my %files_target;
-my %files_from;
-my %files_to;
-
-my $totaldocs = 0;
-
-
-sub add_files_rule
-{
- my ($match, $target, $from, $to) =@_;
- push(@files_match, $match);
- $files_target{"$match"} = $target;
-
- if (length($from) > 0) {
- $files_from{"$match"} = $from;
- }
-
- if (length($to) > 0) {
- $files_to{"$match"} = $to;
- }
-}
-
-sub setup_files_rules
-{
-
-#
-# Files for the Main package
-#
-
- add_files_rule("^\\/usr\\/lib\\/[a-z0-9A-Z\\_\\-\\.]+\\.so\\.", 0,
- "(\\/usr\\/lib\\/.*\\.so\\.).*", "\*");
-
-
- add_files_rule("^\\/usr\\/share\\/omf\\/", 0,
- "(\\/usr\\/share\\/omf\\/.*?\\/).*", "\*");
-
-#
-# Files for the Devel subpackage
-#
- add_files_rule("^\\/usr\\/share\\/gir-1\\.0\\/[a-z0-9A-Z\\_\\-\\.]+\\.gir\$", 1,
- "(\\/usr\\/share\\/gir-1\\.0\/).*", "\*\.gir");
- add_files_rule("^\\/usr\\/lib\\/girepository-1\\.0\\/[a-z0-9A-Z\\_\\-\\.]+\\.typelib\$", 1,
- "(\\/usr\\/lib\\/girepository-1\\.0\/).*", "\*\.typelib");
- add_files_rule("^\\/usr\\/include\\/[a-z0-9A-Z\\_\\-\\.]+\\.h\$", 1,
- "(\\/usr\\/include\/).*", "\*\.h");
- add_files_rule("^\\/usr\\/include\\/[a-z0-9A-Z\\_\\-\\.]+\\/.*?\\.h\$", 1,
- "(\\/usr\\/include\\/[a-z0-9A-Z\\_\\-\\.]+\\/.*?)[a-z0-9A-Z\\_\\-\\.]+\\.h", "\*\.h");
- add_files_rule("^\\/usr\\/lib\\/[a-z0-9A-Z\\_\\-\\.]+\\.so\$", 1,
- "(\\/usr\\/lib\\/).*\\.so\$", "\*.so");
- add_files_rule("^\\/usr\\/lib\\/pkgconfig\\/[a-z0-9A-Z\\_\\-\\.\+]+\\.pc\$", 1,
- "(\\/usr\\/lib\\/pkgconfig\\/).*\\.pc\$", "\*.pc");
- add_files_rule("^\\/usr\\/share\\/aclocal", 1, "", "");
- add_files_rule("^\\/usr\\/lib\\/qt4\\/mkspecs/", 1, "", "");
-
-
-
-
-#
-# Files for the documentation subpackage
-#
- add_files_rule("^\\/usr\\/share\\/gtk\-doc\\/html\\/[a-z0-9A-Z\\_\\-\\.]+\\/.\*", 2,
- "(\\/usr\\/share\\/gtk\-doc\\/html\\/[a-z0-9A-Z\\_\\-\\.]+\\/).\*", "\*");
- add_files_rule("^\\/usr\\/share\\/doc\\/[a-zA-Z0-9\-]*", 2,
- "(\\/usr\\/share\\/doc\\/[a-zA-Z0-9\-]+\\/).*", "\*");
- add_files_rule("^\\/usr\\/share\\/man\\/man[0-9]\\/[a-zA-Z0-9\-]*", 2,
- "(\\/usr\\/share\\/man\\/man[0-9]\\/[a-zA-Z0-9\-]+\\/).*", "\*");
- add_files_rule("^\\/usr\\/share\\/gnome\\/help\\/", 2,
- "(\\/usr\\/share\\/gnome\\/help\\/.*?\\/.*?\\/).*", "\*");
-
-
-#
-# Files to just not package at all (picked up by other things)
-#
- add_files_rule("^\\/usr\\/share\\/locale", 99, "", "");
- # compiled python things will get auto cleaned by rpm
-# add_files_rule("\.pyo\$", 99, "", "");
-# add_files_rule("\.pyc\$", 99, "", "");
-
-}
-
-sub apply_files_rules
-{
- my $filenumber = @allfiles;
-
- if ($filenumber == 0) {
- return;
- }
-
- while (@allfiles > 0) {
- my $filename = $allfiles[0];
- my $destname = $filename;
- my $handled = 0;
-
-#
-# while we're here, try to guess what group our package is
-#
- guess_group_from_file($filename);
-
- foreach (@files_match) {
- my $match = $_;
-
- if ($filename =~ /$match/) {
-#
-# First try to see if we can turn the full filename into a
-# wildcard based filename
-#
- if (defined($files_from{$match}) && defined($files_to{$match})) {
- $from = $files_from{$match};
- $to = $files_to{$match};
- $destname =~ s/$from/$1$to/;
-# print "changing $filename to $destname\n";
- }
-
-# devel package
- if ($files_target{$match} == 1) {
- $handled = 1;
- push(@develfiles, $destname);
- }
-# doc rules.. also prepend %doc
- if ($files_target{$match} == 2) {
- $handled = 1;
- $destname = "\"%doc " . $destname . "\"";
- push(@docfiles, $destname);
- $totaldocs = $totaldocs + 1;
- }
-# don't package
- if ($files_target{$match} == 99) {
- $handled = 1;
- if ($filename =~ /\/usr\/share\/locale\/.*?\/LC_MESSAGES\/(.*)\.mo/) {
- $localename = $1;
- }
- }
- }
- }
-
-
-#
-# if the destination name contains our package version,
-# use %version instead for future maintenance
-#
- $destname =~ s/$version/\%\{version\}/g;
- if ($handled == 0) {
- push(@mainfiles, $destname);
- }
- shift(@allfiles);
- }
-
-#
-# Now.. if we have less than 5 documentation files, just stick them in the main package
-#
-
- $filenumber = @docfiles;
-
- if ($filenumber <= 5) {
- while (@docfiles > 0) {
- my $filename = $docfiles[0];
-
- push(@mainfiles, $filename);
- shift(@docfiles);
- }
- }
-
-}
-
-sub print_files
-{
- my $count = @mainfiles;
- if ($count == 0) {
- return;
- }
-
- # remove dupes
- undef %saw;
- @saw{@mainfiles} = ();
- @out = sort keys %saw;
-
- print OUTFILE "Files:\n";
- foreach (@out) {
- print OUTFILE " - $_\n";
- }
-}
-
-sub print_devel
-{
- my $count = @develfiles;
- if ($count == 0) {
- return;
- }
- print OUTFILE "SubPackages:\n";
- $printed_subpackages = 1;
- print OUTFILE " - Name: devel\n";
- print OUTFILE " Summary: Development components for the $name package\n";
- print OUTFILE " Group: Development/Libraries\n";
- print OUTFILE " Description:\n";
- print OUTFILE " - Development files for the $name package\n";
-
- # remove dupes
- undef %saw;
- @saw{@develfiles} = ();
- @out = sort keys %saw;
-
- print OUTFILE " Files:\n";
- foreach (@out) {
- print OUTFILE " - $_\n";
- }
-}
-
-sub print_doc
-{
- my $count = @docfiles;
- if ($count == 0) {
- return;
- }
- if ($printed_subpackages == 0) {
- print OUTFILE "SubPackages:\n";
- $printed_subpackages = 1;
- }
- print OUTFILE " - Name: docs\n";
- print OUTFILE " Summary: Documentation components for the $name package\n";
- print OUTFILE " Group: Documentation\n";
-
- # remove dupes
- undef %saw;
- @saw{@docfiles} = ();
- @out = sort keys %saw;
-
- print OUTFILE " Files:\n";
- foreach (@out) {
- print OUTFILE " - $_\n";
- }
-}
-
-
-# end of %files section
-#
-######################################################################
-
-
-######################################################################
-#
-# What we can learn from configure.ac/configure
-#
-# - pkgconfig requirements
-# - regular build requirements
-# - package name / version
-
-
-sub setup_pkgconfig_ban
-{
- push(@banned_pkgconfig, "^dnl\$");
- push(@banned_pkgconfig, "^hal\$"); # we don't have nor want HAL
- push(@banned_pkgconfig, "tslib-0.0"); # we don't want tslib-0.0 (legacy touchscreen interface)
- push(@banned_pkgconfig, "intel-gen4asm");
- push(@banned_pkgconfig, "^xp\$"); # xprint - deprecated and not in meego
- push(@banned_pkgconfig, "^directfb\$"); # we use X, not directfb
- push(@banned_pkgconfig, "^gtkmm-2.4\$"); # we use X, not directfb
- push(@banned_pkgconfig, "^evil\$");
- push(@banned_pkgconfig, "^directfb");
- push(@banned_pkgconfig, "^sdl ");
-
-
-}
-
-sub setup_failed_commands
-{
- $failed_commands{"doxygen"} = "doxygen";
- $failed_commands{"scrollkeeper-config"} = "rarian-compat";
- $failed_commands{"dot"} = "graphviz";
- $failed_commands{"flex"} = "flex";
- $failed_commands{"lex"} = "flex";
- $failed_commands{"freetype-config"} = "freetype-devel";
- $failed_commands{"makeinfo"} = "texinfo";
- $failed_commands{"desktop-file-install"} = "desktop-file-utils";
- $failed_commands{"deflateBound in -lz"} = "zlib-devel";
- $failed_commands{"gconftool-2"} = "GConf-dbus";
- $failed_commands{"jpeglib.h"} = "libjpeg-devel";
- $failed_commands{"expat.h"} = "expat-devel";
- $failed_commands{"bison"} = "bison";
- $failed_commands{"msgfmt"} = "gettext";
- $failed_commands{"curl-config"} = "libcurl-devel";
- $failed_commands{"doxygen"} = "doxygen";
- $failed_commands{"X"} = "pkgconfig(x11)";
-
- $failed_commands{"gawk"} = "gawk";
- $failed_commands{"xbkcomp"} = "xkbcomp";
- $failed_commands{"Vorbis"} = "libvorbis-devel";
- # checking Expat 1.95.x... no
- $failed_commands{"Expat 1.95.x"} = "expat-devel";
- $failed_commands{"xml2-config path"} = "libxml2-devel";
-
- $failed_libs{"-lz"} = "zlib-devel";
- $failed_libs{"-lncursesw"} = "ncurses-devel";
- $failed_libs{"-ltiff"} = "libtiff-devel";
- $failed_libs{"-lasound"} = "alsa-lib-devel";
- $failed_libs{"Curses"} = "ncurses-devel";
-
- $failed_headers{"X11/extensions/randr.h"} = "xrandr";
- $failed_headers{"X11/Xlib.h"} = "x11";
- $failed_headers{"X11/extensions/XShm.h"} = "xext";
- $failed_headers{"X11/extensions/shape.h"} = "xext";
- $failed_headers{"ncurses.h"} = "ncursesw";
- $failed_headers{"curses.h"} = "ncursesw";
- $failed_headers{"pci/pci.h"} = "libpci";
- $failed_headers{"xf86.h"} = "xorg-server";
- $failed_headers{"sqlite.h"} = "sqlite3";
-
- $failed_headers{"X11/extensions/XIproto.h"} = "xi";
- $failed_headers{"QElapsedTimer"} = "";
-}
-
-
-
-my @package_configs;
-my @buildreqs;
-my $uses_configure = 0;
-
-
-sub push_pkgconfig_buildreq
-{
- my ($pr) = @_;
-
- $pr =~ s/\s+//g;
-
- # remove collateral ] ) etc damage in the string
- $pr =~ s/\"//g;
- $pr =~ s/\)//g;
- $pr =~ s/\]//g;
- $pr =~ s/\[//g;
-
-
- # first, undo the space packing
-
- $pr =~ s/\>\=/ \>\= /g;
- $pr =~ s/\<\=/ \<\= /g;
-
- $pr =~ s/\<1.1.1/ /g;
-
- # don't show configure variables, we can't deal with them
- if ($pr =~ /^\$/) {
- return;
- }
- if ($pr =~ /AC_SUBST/) {
- return;
- }
-
-
-
-
- # process banned pkgconfig options for things that we don't
- # have or don't want.
-
-
- # remore versions that are macros or strings, not numbers
- $pr =~ s/\s\>\= \$.*//g;
-
- $pr =~ s/\s\>\= [a-zA-Z]+.*//g;
-
- # don't show configure variables, we can't deal with them
- if ($pr =~ /\$/) {
- return;
- }
-
- foreach (@banned_pkgconfig) {
- my $ban = $_;
- if ($pr =~ /$ban/) {
- return;
- }
- }
-
- push(@package_configs, $pr);
-}
-
-#
-# detect cases where we require both a generic pkgconfig, and a version specific
-# case
-#
-sub uniquify_pkgconfig
-{
- # first remove real dupes
- undef %saw;
- @saw{@package_configs} = ();
- @out = sort keys %saw;
-
- my $count = 0;
-
- while ($count < @out) {
-
- my $entry = $out[$count];
-
- foreach(@out) {
- my $compare = $_;
- if ($entry eq $compare) {
- next;
- }
-
- $compare =~ s/ \>\=.*//g;
- if ($entry eq $compare) {
- $out[$count] = "";
- }
- }
- $count = $count + 1;
- }
- @package_configs = @out;
-}
-
-
-sub process_configure_ac
-{
- my ($filename) = @_;
- my $line = "";
- my $depth = 0;
- my $keepgoing = 1;
- my $buffer = "";
-
- if (!-e $filename) {
- return;
- }
-
- $uses_configure = 1;
-
-
-
- open(CONFIGURE, "$filename") || die "Couldn't open $filename\n";
- seek(CONFIGURE, 0,0) or die "seek : $!";
- while ($keepgoing && !eof(CONFIGURE)) {
- $buffer = getc(CONFIGURE);
-
- if ($buffer eq "(") {
- $depth = $depth + 1;
- }
- if ($buffer eq ")" && $depth > 0) {
- $depth = $depth - 1;
- }
-
- if (!($buffer eq "\n")) {
- $line = $line . $buffer;
- }
-
- if (!($buffer eq "\n") || $depth > 0) {
- redo unless eof(CONFIGURE);
- }
-
- if ($line =~ /PKG_CHECK_MODULES\((.*)\)/) {
- my $match = $1;
- $match =~ s/\s+/ /g;
- $match =~ s/, /,/g;
- my @pkgs = split(/,/, $match);
- my $pkg;
- if (defined($pkgs[1])) {
- $pkg = $pkgs[1];
- } else {
- next;
- }
- if ($pkg =~ /\[(.*)\]/) {
- $pkg = $1;
- }
-
- $pkg =~ s/\s+/ /g;
- # deal with versioned pkgconfig's by removing the spaces around >= 's
- $pkg =~ s/\>\=\s/\>\=/g;
- $pkg =~ s/\s\>\=/\>\=/g;
- $pkg =~ s/\=\s/\=/g;
- $pkg =~ s/\s\=/\=/g;
- $pkg =~ s/\<\=\s/\<\=/g;
- $pkg =~ s/\<\s/\</g;
- $pkg =~ s/\s\<\=/\<\=/g;
- $pkg =~ s/\s\</\</g;
-
- @words = split(/ /, $pkg);
- foreach(@words) {
- push_pkgconfig_buildreq($_);
- }
- }
-
- if ($line =~ /PKG_CHECK_EXISTS\((.*)\)/) {
- my $match = $1;
- $match =~ s/\s+/ /g;
- $match =~ s/, /,/g;
- my @pkgs = split(/,/, $match);
- my $pkg = $pkgs[0];
- if ($pkg =~ /\[(.*)\]/) {
- $pkg = $1;
- }
-
- $pkg =~ s/\s+/ /g;
- # deal with versioned pkgconfig's by removing the spaces around >= 's
- $pkg =~ s/\>\=\s/\>\=/g;
- $pkg =~ s/\s\>\=/\>\=/g;
- $pkg =~ s/\<\=\s/\<\=/g;
- $pkg =~ s/\<\s/\</g;
- $pkg =~ s/\s\<\=/\<\=/g;
- $pkg =~ s/\s\</\</g;
- $pkg =~ s/\=\s/\=/g;
- $pkg =~ s/\s\=/\=/g;
-
- @words = split(/ /, $pkg);
- foreach(@words) {
- push_pkgconfig_buildreq($_);
- }
- }
-
- if ($line =~ /XDT_CHECK_PACKAGE\(.*?,.*?\[(.*?)\].*\)/) {
- my $pkg = $1;
-
- $pkg =~ s/\s+/ /g;
- # deal with versioned pkgconfig's by removing the spaces around >= 's
- $pkg =~ s/\>\=\s/\>\=/g;
- $pkg =~ s/\s\>\=/\>\=/g;
- $pkg =~ s/\=\s/\=/g;
- $pkg =~ s/\s\=/\=/g;
-
- @words = split(/ /, $pkg);
- foreach(@words) {
- push_pkgconfig_buildreq($_);
- }
- }
-
- if ($line =~ /XDT_CHECK_OPTIONAL_PACKAGE\(.*?,.*?\[(.*?)\].*\)/) {
- my $pkg = $1;
-
- $pkg =~ s/\s+/ /g;
- # deal with versioned pkgconfig's by removing the spaces around >= 's
- $pkg =~ s/\>\=\s/\>\=/g;
- $pkg =~ s/\s\>\=/\>\=/g;
- $pkg =~ s/\=\s/\=/g;
- $pkg =~ s/\s\=/\=/g;
-
- @words = split(/ /, $pkg);
- foreach(@words) {
- push_pkgconfig_buildreq($_);
- }
- }
-
- if ($line =~ /AC_CHECK_LIB\(\[expat\]/) {
- push(@buildreqs, "expat-devel");
- }
- if ($line =~ /AC_CHECK_FUNC\(\[tgetent\]/) {
- push(@buildreqs, "ncurses-devel");
- }
- if ($line =~ /_PROG_INTLTOOL/) {
- push(@buildreqs, "intltool");
- }
- if ($line =~ /GETTEXT_PACKAGE/) {
- push(@buildreqs, "gettext");
- }
- if ($line =~ /GTK_DOC_CHECK/) {
- push_pkgconfig_buildreq("gtk-doc");
- }
- if ($line =~ /GNOME_DOC_INIT/) {
- push(@buildreqs, "gnome-doc-utils");
- }
- if ($line =~ /AM_GLIB_GNU_GETTEXT/) {
- push(@buildreqs, "gettext");
- }
-
- if ($line =~ /AC_INIT\((.*)\)/) {
- my $match = $1;
- $match =~ s/\s+/ /g;
- @acinit = split(/,/, $match);
-# $name = $acinit[0];
-
- if ($name =~ /\[(.*)\]/) {
-# $name = $1;
- }
-
- if (defined($acinit[3])) {
-# $name = $acinit[3];
- if ($name =~ /\[(.*)\]/) {
-# $name = $1;
- }
- }
- if (defined($acinit[1]) and $version eq $predef_version) {
- my $ver = $acinit[1];
- $ver =~ s/\[//g;
- $ver =~ s/\]//g;
- if ($ver =~ /\$/){} else {
- $version = $ver;
- $version =~ s/\s+//g;
- }
- }
- }
- if ($line =~ /AM_INIT_AUTOMAKE\((.*)\)/) {
- my $match = $1;
- $match =~ s/\s+/ /g;
- @acinit = split(/,/, $match);
-# $name = $acinit[0];
-
- if ($name =~ /\[(.*)\]/) {
-# $name = $1;
- }
-
- if (defined($acinit[3])) {
-# $name = $acinit[3];
- if ($name =~ /\[(.*)\]/) {
-# $name = $1;
- }
- }
- if (defined($acinit[1]) and $version eq $predef_version) {
- my $ver = $acinit[1];
- $ver =~ s/\[//g;
- $ver =~ s/\]//g;
- if ($ver =~ /\$/){} else {
- $version = $ver;
- $version =~ s/\s+//g;
- }
- }
- }
-
- $line = "";
- }
- close(CONFIGURE);
-}
-
-sub process_qmake_pro
-{
- my ($filename) = @_;
- my $line = "";
- my $depth = 0;
- my $keepgoing = 1;
- my $buffer = "";
- my $prev_char = "";
-
- if (!-e $filename) {
- return;
- }
-
-
- open(CONFIGURE, "$filename") || die "Couldn't open $filename\n";
- seek(CONFIGURE, 0,0) or die "seek : $!";
- while ($keepgoing && !eof(CONFIGURE)) {
- $buffer = getc(CONFIGURE);
-
- if ($buffer eq "(") {
- $depth = $depth + 1;
- }
- if ($buffer eq ")" && $depth > 0) {
- $depth = $depth - 1;
- }
-
- if (!($buffer eq "\n")) {
- $line = $line . $buffer;
- }
-
- if (!($buffer eq "\n") || ($prev_char eq "\\") ) {
- $prev_char = $buffer;
- redo unless eof(CONFIGURE);
- }
- $prev_char = " ";
-
- if ($line =~ /PKGCONFIG.*?\=(.*)/) {
- my $l = $1;
- my @pkgs;
-
- $l =~ s/\\//g;
- $l =~ s/\s/ /g;
- @pkgs = split(/ /, $l);
- foreach (@pkgs) {
- if (length($_)>1) {
- push_pkgconfig_buildreq($_);
- }
- }
- }
-
- $line = "";
- }
- close(CONFIGURE);
-}
-
-#
-# We also check configure if it exists, it's nice for some things
-# because various configure.ac macros have been expanded for us already.
-#
-sub process_configure
-{
- my ($filename) = @_;
- my $line = "";
- my $depth = 0;
- my $keepgoing = 1;
-
- if (!-e $filename) {
- return;
- }
-
- $uses_configure = 1;
-
- open(CONFIGURE, "$filename") || die "Couldn't open $filename\n";
- seek(CONFIGURE, 0,0) or die "seek : $!";
- while ($keepgoing && !eof(CONFIGURE)) {
- $buffer = getc(CONFIGURE);
-
- if ($buffer eq "(") {
- $depth = $depth + 1;
- }
- if ($buffer eq ")" && $depth > 0) {
- $depth = $depth - 1;
- }
-
- if (!($buffer eq "\n")) {
- $line = $line . $buffer;
- }
-
- if (!($buffer eq "\n") || $depth > 0) {
- redo unless eof(CONFIGURE);
- }
-
-
-
- if ($line =~ /^PACKAGE_NAME=\'(.*?)\'/) {
- $name = $1;
- }
- if ($line =~ /^PACKAGE_TARNAME=\'(.*?)\'/) {
- $name = $1;
- }
- if ($line =~ /^PACKAGE_VERSION=\'(.*?)\'/) {
- $version = $1;
- $version =~ s/\s+//g;
- }
- if ($line =~ /^PACKAGE_URL=\'(.*?)\'/) {
- if (length($1) > 2) {
- $url = $1;
- }
- }
-
-
- $line = "";
- }
- close(CONFIGURE);
-}
-
-sub print_pkgconfig
-{
- my $count = @package_configs;
- if ($count == 0) {
- return;
- }
-
- uniquify_pkgconfig();
-
- print OUTFILE "PkgConfigBR:\n";
- foreach (@out) {
- $line = $_;
- $line =~ s/^\s+//g;
- if (length($line) > 1) {
- print OUTFILE " - $line\n";
- }
- }
-}
-
-sub print_buildreq
-{
- my $count = @buildreqs;
- if ($count == 0) {
- return;
- }
-
- # remove dupes
- undef %saw;
- @saw{@buildreqs} = ();
- @out = sort keys %saw;
-
- print OUTFILE "PkgBR:\n";
- foreach (@out) {
- print OUTFILE " - $_\n";
- }
-}
-
-
-# end of configure section
-#
-######################################################################
-
-
-######################################################################
-#
-# Guessing the Description and Summary for a package
-#
-# We'll look at various sources of information for this:
-# - spec files in the package
-# - debain files in the package
-# - DOAP files in the package
-# - pkgconfig files in the package
-# - the README file in the package
-# - freshmeat.net online
-#
-
-sub guess_description_from_spec {
- my ($specfile) = @_;
-
- my $state = 0;
- my $cummul = "";
-
- open(SPEC, $specfile);
- while (<SPEC>) {
- my $line = $_;
- if ($state == 1 && $line =~ /^\%/) {
- $state = 2;
- }
- if ($state == 1) {
- $cummul = $cummul . $line;
- }
- if ($state==0 && $line =~ /\%description/) {
- $state = 1;
- }
-
- if ($line =~ /Summary:\s*(.*)/ && length($summary) < 2) {
- $summary = $1;
- }
- if ($line =~ /URL:\s*(.*)/ && length($url) < 2) {
- $url = $1;
- }
- }
- close(SPEC);
- if (length($cummul) > 4) {
- $description = $cummul;
- }
-}
-
-#
-# DOAP is a project to create an XML/RDF vocabulary to describe software projects, and in particular open source.
-# so if someone ships a .doap file... we can learn from it.
-#
-sub guess_description_from_doap {
- my ($doapfile) = @_;
-
- open(DOAP, $doapfile);
- while (<DOAP>) {
- my $line = $_;
- # <shortdesc xml:lang="en">Virtual filesystem implementation for gio</shortdesc>
- if ($line =~ /\<shortdesc .*?\>(.*)\<\/shortdesc\>/) {
- $summary = $1;
- }
- if ($line =~ /\<homepage .*?resource=\"(.*)\"\s*\/>/) {
- $url = $1;
- }
- }
- close(DOAP);
-}
-
-#
-# Debian control files have some interesting fields we can glean information
-# from as well.
-#
-sub guess_description_from_debian_control {
- my ($file) = @_;
-
- my $state = 0;
- my $cummul = "";
-
- $file = $file . "/debian/control";
-
- open(FILE, $file) || return;
- while (<FILE>) {
- my $line = $_;
- if ($state == 1 && length($line) < 2) {
- $state = 2;
- }
- if ($state == 1) {
- $cummul = $cummul . $line;
- }
- if ($state==0 && $line =~ /\Description: (.*)/) {
- $state = 1;
- $cummul = $1;
- }
-
- }
- close(FILE);
- if (length($cummul) > 4) {
- $description = $cummul;
- }
-}
-
-#
-# the pkgconfig files have often a one line description
-# of the software... good for Summary
-#
-sub guess_description_from_pkgconfig {
- my ($file) = @_;
-
- open(FILE, $file);
- while (<FILE>) {
- my $line = $_;
-
- if ($line =~ /Description:\s*(.*)/ && length($summary) < 2) {
- $summary = $1;
- }
- }
- close(FILE);
-}
-
-#
-# Freshmeat can provide us with a good one paragraph description
-# of the software..
-#
-sub guess_description_from_freshmeat {
- my ($tarname) = @_;
- my $cummul = "";
- my $state = 0;
- open(HTML, "curl -s http://freshmeat.net/projects/$tarname |");
- while (<HTML>) {
- my $line = $_;
-
- if ($state == 1) {
- $cummul = $cummul . $line;
- }
- if ($state == 0 && $line =~ /\<div class\=\"project-detail\"\>/) {
- $state = 1;
- }
- if ($state == 1 && $line =~/\<\/p\>/) {
- $state = 2;
- }
- }
- close(HTML);
- $cummul =~ s/\<p\>//g;
- $cummul =~ s/\r//g;
- $cummul =~ s/\<\/p\>//g;
- $cummul =~ s/^\s*//g;
- if (length($cummul)>10) {
- $description = $cummul;
- }
-}
-#
-# If all else fails, just take the first paragraph of the
-# readme file
-#
-sub guess_description_from_readme {
- my ($file) = @_;
-
- my $state = 0;
- my $cummul = "";
-
- open(FILE, $file);
- while (<FILE>) {
- my $line = $_;
- if ($state == 1 && $line =~ /^\n/ && length($cummul) > 80) {
- $state = 2;
- }
- if ($state == 0 && length($line)>1) {
- $state = 1;
- }
- if ($state == 1) {
- $cummul = $cummul . $line;
- }
- if ($line =~ /(http\:\/\/.*$name.*\.org)/) {
- my $u = $1;
- if ($u =~ /bug/ || length($url) > 1) {
- } else {
- $url = $u;
- }
- }
- }
- close(FILE);
- if (length($cummul) > 4 && length($description)<3) {
- $des