summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDavid Nyström <david.c.nystrom@gmail.com>2012-12-17 16:16:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-07 11:09:35 +0000
commitb03f4b7051ca274143b6cfac3b54542617df3842 (patch)
tree06a91dc307a50a3ca0972c3c0e4bdd750c219bd7 /scripts
parent5d8a2e82e885b79c380ffaa5f613318f6d271e2c (diff)
downloadpoky-b03f4b7051ca274143b6cfac3b54542617df3842.tar.gz
Added ability to parse python sources to create-recipe
Hi, Added python source parsing abilities to create-recipe. (From OE-Core rev: 417357cbcd3ecc7a2e43f87c618c8fdfe04a9d33) Signed-off-by: David Nyström <david.nystrom@enea.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create-recipe51
1 files changed, 48 insertions, 3 deletions
diff --git a/scripts/create-recipe b/scripts/create-recipe
index 776c91dd9d..a556e39dd1 100755
--- a/scripts/create-recipe
+++ b/scripts/create-recipe
@@ -40,6 +40,8 @@ my $version = $predef_version;
40my $description = ""; 40my $description = "";
41my $summary = ""; 41my $summary = "";
42my $url = ""; 42my $url = "";
43my $homepage;
44my @rdepends;
43my $configure = ""; 45my $configure = "";
44my $localename = ""; 46my $localename = "";
45my @sources; 47my @sources;
@@ -1679,6 +1681,7 @@ sub write_bbfile
1679 open(BBFILE, ">${name}_$version.bb"); 1681 open(BBFILE, ">${name}_$version.bb");
1680 print BBFILE "SUMMARY = \"$summary\"\n"; 1682 print BBFILE "SUMMARY = \"$summary\"\n";
1681 print BBFILE "DESCRIPTION = \"$description\"\n"; 1683 print BBFILE "DESCRIPTION = \"$description\"\n";
1684 print BBFILE "HOMEPAGE = \"$homepage\"\n";
1682 1685
1683 print BBFILE "LICENSE = \"@license\"\n"; 1686 print BBFILE "LICENSE = \"@license\"\n";
1684 print BBFILE "LIC_FILES_CHKSUM = \""; 1687 print BBFILE "LIC_FILES_CHKSUM = \"";
@@ -1698,6 +1701,10 @@ sub write_bbfile
1698 print BBFILE "DEPENDS = \"@out\"\n\n"; 1701 print BBFILE "DEPENDS = \"@out\"\n\n";
1699 }; 1702 };
1700 1703
1704 if (@rdepends > 0) {
1705 print BBFILE "RDEPENDS_\$\{PN\} += \"@rdepends\"\n";
1706 }
1707
1701 print BBFILE 'PR = "r0"' . "\n\n"; 1708 print BBFILE 'PR = "r0"' . "\n\n";
1702 print BBFILE "SRC_URI = \""; 1709 print BBFILE "SRC_URI = \"";
1703 foreach (@sources) { 1710 foreach (@sources) {
@@ -1734,6 +1741,7 @@ sub calculate_sums
1734 chomp($sha256sum); 1741 chomp($sha256sum);
1735} 1742}
1736 1743
1744
1737############################################################################ 1745############################################################################
1738# 1746#
1739# Main program 1747# Main program
@@ -1820,6 +1828,40 @@ foreach (@dirs) {
1820 1828
1821$fulldir = $dir; 1829$fulldir = $dir;
1822 1830
1831if ( -e "$dir/setup.py" ) {
1832 $python = 1;
1833 push(@inherits, "distutils");
1834
1835 system("cd $dir ; python setup.py build sdist &> /dev/null");
1836
1837 $templic = `sed '/^License: */!d; s///;q' $dir/*.egg-info/PKG-INFO`;
1838 chomp($templic);
1839 push(@license, $templic);
1840 $summary = `sed '/^Name: */!d; s///;q' $dir/*.egg-info/PKG-INFO`;
1841 chomp($summary);
1842 $description = `sed '/^Summary: */!d; s///;q' $dir/*.egg-info/PKG-INFO`;
1843 chomp($description);
1844 $homepage = `sed '/^Home-page: */!d; s///;q' $dir/*.egg-info/PKG-INFO`;
1845 chomp($homepage);
1846 $findoutput = `find $dir/*.egg-info/ -name "requires.txt" 2>/dev/null`;
1847 @findlist = split(/\n/, $findoutput);
1848 foreach (@findlist) {
1849 # Adding dependency do buildreqs should be removed when
1850 # distutils is unbroken, i.e. blocks setup.py install from
1851 # downloading and installing dependencies.
1852 push(@buildreqs, `sed 's/[^a-zA-Z]//g' $dir/*.egg-info/requires.txt`);
1853 chomp(@buildreqs);
1854 foreach $item (@buildreqs) {
1855 $item = "python-" . $item
1856 }
1857 push(@rdepends, `sed 's/[^a-zA-Z]//g' $dir/*.egg-info/requires.txt`);
1858 chomp(@rdepends);
1859 foreach $item (@rdepends) {
1860 $item = "python-" . $item
1861 }
1862 }
1863}
1864
1823if ( -e "$dir/autogen.sh" ) { 1865if ( -e "$dir/autogen.sh" ) {
1824 $configure = "autogen"; 1866 $configure = "autogen";
1825 $uses_configure = 1; 1867 $uses_configure = 1;
@@ -1859,7 +1901,6 @@ if (-e "$dir/$name.pro") {
1859 push(@inherits, "qmake2"); 1901 push(@inherits, "qmake2");
1860} 1902}
1861 1903
1862
1863# 1904#
1864# This is a good place to generate configure.in 1905# This is a good place to generate configure.in
1865# 1906#
@@ -1868,6 +1909,8 @@ if (length($configure) > 2) {
1868 system("cd $dir ; ./autogen.sh &> /dev/null"); 1909 system("cd $dir ; ./autogen.sh &> /dev/null");
1869 } 1910 }
1870} 1911}
1912
1913
1871@files = <$dir/configure>; 1914@files = <$dir/configure>;
1872foreach (@files) { 1915foreach (@files) {
1873 process_configure("$_"); 1916 process_configure("$_");
@@ -1893,8 +1936,10 @@ foreach (@files) {
1893 guess_license_from_file("$_"); 1936 guess_license_from_file("$_");
1894} 1937}
1895 1938
1896 1939
1897guess_description($dir); 1940if ($python != 1) {
1941 guess_description($dir);
1942}
1898 1943
1899# 1944#
1900# Output of bbfile file 1945# Output of bbfile file