From 18b4676c4c1d87affbf3271a61b9c8850abc8784 Mon Sep 17 00:00:00 2001 From: Lucius Hu Date: Mon, 31 Aug 2020 22:28:41 -0400 Subject: [PATCH 1/2] Removed `infile` features https://github.com/clearlinux/autospec/issues/645 https://github.com/clearlinux/autospec/issues/646 --- Makefile | 3 - README.rst | 45 +---- autospec/autospec.py | 33 +--- autospec/infile_bb_parser.py | 265 ---------------------------- autospec/infile_handler.py | 151 ---------------- autospec/infile_update_spec.py | 96 ----------- autospec/util.py | 5 - tests/test_infile_bb_parser.py | 288 ------------------------------- tests/test_infile_handler.py | 46 ----- tests/test_infile_update_spec.py | 100 ----------- 10 files changed, 7 insertions(+), 1025 deletions(-) delete mode 100644 autospec/infile_bb_parser.py delete mode 100644 autospec/infile_handler.py delete mode 100644 autospec/infile_update_spec.py delete mode 100644 tests/test_infile_bb_parser.py delete mode 100644 tests/test_infile_handler.py delete mode 100644 tests/test_infile_update_spec.py diff --git a/Makefile b/Makefile index 82a18eb3..12880ed2 100644 --- a/Makefile +++ b/Makefile @@ -46,9 +46,6 @@ test_check: test_util: PYTHONPATH=${CURDIR}/autospec python3 tests/test_util.py -test_infile_parser: - PYTHONPATH=${CURDIR}/autospec python3 -m unittest discover -b -s tests -p 'test_infile_*' - test_general: PYTHONPATH=${CURDIR}/autospec python3 tests/test_general.py diff --git a/README.rst b/README.rst index 2dcc599a..6de140c0 100644 --- a/README.rst +++ b/README.rst @@ -58,10 +58,9 @@ Synopsis usage: autospec.py [-h] [-g] [-n NAME] [-v VERSION] [-a [ARCHIVES [ARCHIVES ...]]] [-l] [-b] [-c CONFIG] [-t TARGET] [-i] [-p] [--non_interactive] [-C] - [--infile INFILE] [-m MOCK_CONFIG] - [url] + [-m MOCK_CONFIG] - url (required - unless infile is passed) tarball URL + url (required) tarball URL (e.g. http://example.com/downloads/mytar.tar.gz) optional arguments: @@ -85,8 +84,6 @@ optional arguments: attempt to verify package -p, --prep-only Only perform preparatory work on package --non_interactive Disable interactive mode for package verification - --infile INFILE Additional input to contribute to specfile creation. - Can be a url, directory of files, or a file. -C, --cleanup Clean up mock chroot after building the package -m MOCK_CONFIG, --mock-config MOCK_CONFIG Value to pass with Mock's -r option. Defaults to @@ -113,42 +110,6 @@ constitutes a license definition, for example:: 794a893e510ca5c15c9c97a609ce47b0df74fc1a, BSD-2-Clause -Infile option -============= -To provide additional build information for a package, a supplementary format -file may be used with the --infile command. The file is scraped and the data is -mapped to the appropriate location for the specfile build. A source URL is not -required when using the ``--infile`` argument, for it can be scraped from the -additional format file. - -Supported format types: - Currently autospec supports recipe / bitbake (``.bb``) filetypes, and their - include directives (``.inc``) - -Input type: - The --infile argument can parse a url to a file, a path to a directory of - files (that are the same format and support the same packages), or a path - to a file. - -Variables included: - All variables, and commands are scraped from the format file, however not all - are added to the specfile build process. The following are incorporated into - the specfile build flow, unless they already exist: - - * Source url - If a source url is not passed in, or already found, the tarball - used for building the package can be scraped from the infile. - * Summary - * Licenses - * Build dependencies - * Commands - These are appended to the associated files as comments - * ``configure`` - * ``prep_prepend`` - * ``build_prepend`` - * ``make_prepend`` - * ``install_prepend`` - * ``install_append`` - - Control files ============== It is possible to influence precisely how autospec will behave in order to gain @@ -358,7 +319,7 @@ series This file contains a list of patches to apply during the build, using the ``%patch`` macro. As such it is affected by ``-p1`` style modifiers. Arguments to patch can be added after the patch filename. For example: - + ``` 0001-my-awesome-patch.patch -d some/subdir -p1 ``` diff --git a/autospec/autospec.py b/autospec/autospec.py index 4241fb56..e8c3587a 100644 --- a/autospec/autospec.py +++ b/autospec/autospec.py @@ -31,8 +31,6 @@ import config import files import git -import infile_handler -import infile_update_spec import license from logcheck import logcheck import pkg_integrity @@ -40,7 +38,7 @@ import specdescription import specfiles import tarball -from util import binary_in_path, print_fatal, print_infile, write_out +from util import binary_in_path, print_fatal, write_out sys.path.append(os.path.dirname(__file__)) @@ -159,8 +157,6 @@ def main(): parser.add_argument("-C", "--cleanup", dest="cleanup", action="store_true", default=False, help="Clean up mock chroot after building the package") - parser.add_argument("--infile", action="store", dest="infile", default="", - help="type of input file for .specfile creation") parser.add_argument("-m", "--mock-config", action="store", default="clear", help="Value to pass with Mock's -r option. Defaults to " "\"clear\", meaning that Mock will use " @@ -175,21 +171,6 @@ def main(): name = args.name or name url = args.url or url archives = args.archives or archives - infile_dict = {} - - if args.infile: - infile_dict = infile_handler.infile_reader(args.infile, name) - if not url: - try: - url = infile_dict.get('URL') - except Exception: - pass - else: - print_infile("Source url found: {}".format(url)) - - if infile_dict.get("LICENSE"): - license.add_license(infile_dict.get("LICENSE")) - print_infile("License added: {}".format(infile_dict.get("LICENSE"))) if not args.target: parser.error(argparse.ArgumentTypeError( @@ -209,13 +190,13 @@ def main(): if args.prep_only: os.makedirs("workingdir", exists_ok=True) - package(args, url, name, archives, "./workingdir", infile_dict) + package(args, url, name, archives, "./workingdir") else: with tempfile.TemporaryDirectory() as workingdir: - package(args, url, name, archives, workingdir, infile_dict) + package(args, url, name, archives, workingdir) -def package(args, url, name, archives, workingdir, infile_dict): +def package(args, url, name, archives, workingdir): """Entry point for building a package with autospec.""" conf = config.Config(args.target) check_requirements(args.git) @@ -282,12 +263,6 @@ def package(args, url, name, archives, workingdir, infile_dict): filemanager.load_specfile(specfile) load_specfile(conf, specfile) - # - # If infile is passed, parse it and overwrite the specfile configurations - # with the newly found values. - # - if args.infile: - specfile = infile_update_spec.update_specfile(specfile, infile_dict, args.target) print("\n") if args.integrity: diff --git a/autospec/infile_bb_parser.py b/autospec/infile_bb_parser.py deleted file mode 100644 index cadb4299..00000000 --- a/autospec/infile_bb_parser.py +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/true -# -# infile_parser.py - part of autospec -# Copyright (C) 2017 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, or -# (at your option) any later version. -# -# 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 . -# - -import re - -# TODO: VAR_append = "" _append same functionality as += -operators_dict = { - "=": "{1}", - "=.": "{1}{0}", - ".=": "{0}{1}", - ":=": "{1}", - "=+": "{1} {0}", - "+=": "{0} {1}", - "??=": "{1}", - "?=": "{1}" -} - - -def scrape_version(bb_dict): - """ - Get the package version from the bb filename. - - Return None if filename doesn't exist, or there is no version - within the filename. Otherwise, return the version. - """ - try: - return bb_dict.get('filename')[-1].split('_', 1,)[1].rsplit('.', 1)[0] - except Exception: - return None - - -def replace_bb_variable_names(bb_dict): - """ - Replace bitbake variable name with values. - - Bitbake files use various variable names defined by a string - surrounded by ${}. - Variables able for replacement: - - ${PV} with version - - ${ROS_SPN} with name, or actual value if defined in .bb - """ - def replace_var(bb_dict, val): - if bb_dict.get("VERSION"): - val = val.replace("${PV}", bb_dict.get('VERSION')) - - if "ROS_SPN" in bb_dict: - val = val.replace("${ROS_SPN}", bb_dict.get("ROS_SPN")) - elif "NAME" in bb_dict: - val = val.replace("${ROS_SPN}", bb_dict.get('NAME')) - - return val - - for k, v in bb_dict.items(): - if isinstance(v, list): - for i, j in enumerate(v): - v[i] = replace_var(bb_dict, j) - elif isinstance(v, str): - v = replace_var(bb_dict, v) - - bb_dict[k] = v - - -def get_src_url(bb_dict): - """Return the tarball url of the package source from the bb file.""" - if bb_dict.get('SRC_URI'): - bb_dict["URL"] = bb_dict.get("SRC_URI").split('\\')[0].split(';')[0] - - -def clean_values(value): - """Remove quotations and line continuations from values.""" - # remove beginning and end quote - value = value.strip('"') - - # remove line continuations - value = value.replace("\\", "") - - return value - - -def read_in_command(line, depth): - """ - Determine if a line is a part of a command. - - If it returns a depth of 0, then the command has been read completely - from the file. - """ - for c in line: - if c == '{': - depth += 1 - if c == '}' and depth > 0: - depth -= 1 - if c != "\n": - continue - return depth - - -def pattern_match_regex(): - """ - Build regex patterns for a defined set of operators. - - Compile the regular expression to determine the operation being used by - the line to perform the correct task on the variable. - - Returns the match object from searching a string - for the correct pattern as: [key, operator, value]. - """ - # escape operators for regex handling - operators = ["\\??\\=", "\\?\\=", "\\:\\=", - "\\+\\=", "\\=\\+", "\\.\\=", - "\\=\\.", "\\="] - - # Split line to be [Key, operator, value] if in operators list - oper_pattern = r"(^[A-Z]+[_\-${}\[\]A-Za-z0-9]*)\s(" + '|'.join( - operators) + r")\s(\".*\")" - - return re.compile(oper_pattern) - - -def evaluate_expr(op, cur_val, assignment): - """ - Get values based on operation and context for a given expression. - - Using the operators_dict. get the correct value from the expression. This - function returns the syntactically correct value for the bb_dict key. For - example, if the op is "=", and the assignment is "value", the return will - be "value". However, if the op is "+=" and the cur_value is "first", and - the assignment is "second" this function will return the appending of - second to first: "first second". - - :param op: The operation (The key from the operators_dict) - :param cur_val: The current value of the key within in the bb_dict - :param assignment: The new value from the line that will be assigned to the - bb_dict key. - """ - if not cur_val: - return assignment - return operators_dict.get(op).format(cur_val, assignment) - - -def write_to_dict(bb_dict, m): - """ - Update bb_dict based on bitbake input file. - - Store the correct information to the bb_dict that is correctly parsed from - the bitbake file. This function uses the "evaluate_expr" function heavily - to ensure that the values are correctly parsed. - """ - if len(m.groups()) == 3: - key = m.group(1) - value = clean_values(m.group(3)) - op = m.group(2) - - # - # ??= is the weakest variable assignment, so if that variable already - # has an assignment, do not overwrite it. = has the highest precedence - # and ?= is between the two. - # - if key in bb_dict and op == "??=": - return bb_dict - elif key in bb_dict and op == "?=": - if not isinstance(bb_dict[key], list): - return bb_dict - - if key in bb_dict and isinstance(bb_dict[key], list): - v = bb_dict[key] - del [v[1]] - bb_dict[key] = "".join(v) - try: - bb_dict[key] = evaluate_expr(op, bb_dict.get(key), value) - if op == "??=": - bb_dict[key] = [bb_dict[key], 1] - except AttributeError as error: - print("Missing operation functionality: {}".format(error)) - - return bb_dict - - -def bb_scraper(bb_fp, bb_dict): - """Scrapes data from a filepointer (to a bitbake or .inc file) and stores the values in a dictionary.""" - bb_dict["VERSION"] = scrape_version(bb_dict) - bb_dict["inherits"] = [] - - # compile the regex once, prior to the line parsing for faster searching - line_regex = pattern_match_regex() - - for line in bb_fp: - line = line.strip() - if not line or line.startswith('#'): - continue - - # If line is a command, create array of command lines - # TODO: command could be python code - if line.startswith('do_'): - cmd_name = line.split('()')[0].strip() - cmd = [] - depth = 0 - while 1: - depth = read_in_command(line, depth) - if line: - cmd.append("# " + line) - - if depth == 0: - break - else: - line = next(bb_fp).strip() - - # Remove the 'do_command {' and '}' from the list, so that - # the dict value is a list of the commands. - if cmd[0].startswith("# " + cmd_name) and cmd[-1] == '# }': - cmd = cmd[1:-1] - - # Some bitbake files have tasks with prepend or append operations. - # Perform the logic to store all tasks with the same 'core' command - # name in the dictionary. - if not bb_dict.get(cmd_name): - bb_dict[cmd_name] = cmd - elif cmd_name.rsplit('_') == 'prepend': - cmd.extend(bb_dict.get(cmd_name)) - bb_dict[cmd_name] = cmd - else: - bb_dict.get(cmd_name).extend(cmd) - - continue - - # If a line continuation, create a string that can easily be split - # by '\' for src_uri and other variables. - elif line[-1] == '\\': - lines = [] - while 1: - lines.append(line) - line = next(bb_fp).strip() - if line[-1] != '\\': - lines.append(line) - break - - line = " ".join(lines) - - if line.startswith('inherit'): - bb_dict['inherits'].append(line.split(maxsplit=1)[1]) - continue - - match = line_regex.search(line) - if match: - bb_dict = write_to_dict(bb_dict, match) - - get_src_url(bb_dict) - replace_bb_variable_names(bb_dict) - - return bb_dict diff --git a/autospec/infile_handler.py b/autospec/infile_handler.py deleted file mode 100644 index 12809ecf..00000000 --- a/autospec/infile_handler.py +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/true -# -# infile_parser.py - part of autospec -# Copyright (C) 2017 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, or -# (at your option) any later version. -# -# 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 . -# - -import os -import re -import tempfile -from urllib.request import urlretrieve - -import infile_bb_parser - -import requests - -import util - - -# filetypes and their parse order (lower parsed first) -parsable_filetypes = {'.inc': 1, '.bb': 2} - - -def parse_ext(path): - """ - Check if a file can be parsed based on its extension. - - Gets the extension of a file and determines if the filetype can be handled - by the infile_parser. If so, it returns the extension. If not, it returns - nothing, which will cause the file_handler to return and infile parsing - will NOT be used on that file. - """ - ext = os.path.splitext(path)[1] - if ext not in parsable_filetypes: - util.print_warning("Cannot parse infile \"{}\" type. From input: {}." - " \nContinuing with the execution of " - "autospec".format(ext, path)) - return None - - return ext.lstrip('.') - - -def check_url_content(url): - """ - Check that the url to the infile file is raw or in plaintext. - - This function checks the header content-type for a request to the infile - url. If it is html it converts eith a github url to point to the raw file, - a git url to point to the plaintext file, or returns None with a statement - that the file must be in plaintext or raw. - """ - if "text/html" in requests.head(url).headers['content-type']: - if re.match(r'^(http)s?://github.com(.*)', url): - url = url.replace("github", "raw.githubusercontent").replace("blob/", "") - elif 'git' in url and "/tree/" in url: - url = url.replace("/tree/", "/plain/", 1) - else: - util.print_fatal("infile url has an html content-type, " - "please use plaintext.") - return None - - return url - - -def sort_files(x): - """Sorts files depending on their priority in the parsable_filetypes dict.""" - return parsable_filetypes.get(os.path.splitext(x)[1]) - - -def parse_infile(bb_fp, output_dict, parse_type): - """Scrape and parse the infile file returning the dictionary of collected data based on its type.""" - if parse_type == "bb": - return infile_bb_parser.bb_scraper(bb_fp, output_dict) - elif parse_type == "inc": - return infile_bb_parser.bb_scraper(bb_fp, output_dict) - - -def file_handler(indata, output_dict): - """ - File or url parsing frontend. - - This function determines whether the input is a file or a url. If it is a - url it checks that it is in the correct format (plaintext), downloads the - url to a temporary file and passes the file handler to be scraped. - If the input is a file, then it opens the file and passes the handler to - be scraped. - - The type of parsing bitbake, inc, deb, etc is based on the file extension. - """ - # If ext is not parsable, return from using infile parser on that file. - parse_type = parse_ext(indata) - if not parse_type: - return - - if output_dict.get('filename'): - output_dict['filename'].append(indata) - else: - output_dict['filename'] = [indata] - - if not os.path.isfile(indata): - # check that input is plain or raw text and not html - indata = check_url_content(indata) - with tempfile.NamedTemporaryFile() as tmpfile: - try: - tmp, _ = urlretrieve(indata, tmpfile.name) - with open(tmp, 'r') as bb_fp: - output_dict = parse_infile(bb_fp, output_dict, parse_type) - except Exception as e: - util.print_warning("Infile was unable to be parsed with the " - "error: \"{}\". \nContinuing with the " - "execution of autospec.".format(e)) - else: - with open(indata, 'r') as bb_fp: - output_dict = parse_infile(bb_fp, output_dict, parse_type) - return output_dict - - -def infile_reader(indata, name): - """ - Parse an infile. - - The infile parser can take 3 different inputs: - A url to a file - A directory with multiple files or urls - A path or filename - - Each file in the directory should scraped to the same dictionary instance. - """ - output_dict = {"NAME": name} - - if os.path.isdir(indata): - files = [f for f in os.listdir(indata) if os.path.isfile( - os.path.join(indata, f)) and not f.startswith('.')] - for f in sorted(files, key=sort_files): - output_dict = file_handler(os.path.join(indata, f), output_dict) - else: - output_dict = file_handler(indata, output_dict) - - return output_dict diff --git a/autospec/infile_update_spec.py b/autospec/infile_update_spec.py deleted file mode 100644 index d7bd43d1..00000000 --- a/autospec/infile_update_spec.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/true -# -# infile_parser.py - part of autospec -# Copyright (C) 2017 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, or -# (at your option) any later version. -# -# 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 . -# - -import os -import re - -from util import print_infile - - -cmd_mappings = { - "do_configure": "configure", - "do_configure_prepend": "configure", - "do_configure_append": "configure", - "EXTRA_OECONF": "configure", - "do_install": "install_append", - "do_install_append": "install_append", - "do_install_prepend": "install_prepend" -} - - -def update_summary(bb_dict, specfile): - """Update the default summary to the summary or description scraped from the bitbake file. - - The bitbake "SUMMARY" variable is first priority, then the "DESCRIPTION" variable. If neither - exist, set set it back to the specfile value. - """ - specfile.default_sum = bb_dict.get("SUMMARY") or \ - bb_dict.get("DESCRIPTION") or specfile.default_sum - - if specfile.default_sum == bb_dict.get("SUMMARY") or \ - specfile.default_sum == bb_dict.get("DESCRIPTION"): - print_infile("Summary updated: {}".format(specfile.default_sum)) - - -def update_licenses(bb_dict, specfile): - """Add the bitbake license if it is not included in the specfile.""" - if "LICENSE" in bb_dict: - if bb_dict.get("LICENSE").lower() not in [license.lower() for license in specfile.licenses]: - specfile.licenses.append(bb_dict.get("LICENSE")) - print_infile("License added: {}".format(bb_dict.get("LICENSE"))) - - -def update_build_deps(bb_dict, specfile): - """Add build dependencies to the buildreq set, if the bb_dict scraped build time dependencies.""" - if bb_dict.get('DEPENDS'): - for dep in bb_dict.get('DEPENDS').split(): - dep = re.match(r"(\$\{PYTHON_PN\}\-)?([a-zA-Z0-9\-]+)", dep).group(2) - if dep.endswith('-native'): - dep = dep[:-7] - - specfile.buildreqs.add(dep) - print_infile("Build dependency added: {}".format(dep)) - - -def write_cmd_files(bb_dict, dirname): - """Add commented out do_ commands to their autospec equivalent files. - - Append "do_" task commands that are scraped from the bitbake file(s). Some - of these commands have append/prepend. These operations are performed - prior to being added to the dict. This function appends all commands to - as comments to their mapped file within the target directory. - """ - for cmd_name, cmd in bb_dict.items(): - if cmd_name.startswith("do_"): - filename = os.path.join(dirname, cmd_mappings.get(cmd_name)) - with open(filename, 'a') as cmdfp: - cmdfp.write("# Infile parser added the following lines:\n") - cmdfp.write("\n".join(cmd) + "\n") - print_infile("Suggestions added to the {} file".format( - cmd_mappings.get(cmd_name))) - - -def update_specfile(specfile, bb_dict, dirname): - """Update specifle based on bitbake configuration.""" - update_summary(bb_dict, specfile) - update_licenses(bb_dict, specfile) - update_build_deps(bb_dict, specfile) - write_cmd_files(bb_dict, dirname) - - return specfile diff --git a/autospec/util.py b/autospec/util.py index 703ece1b..b89552b8 100644 --- a/autospec/util.py +++ b/autospec/util.py @@ -136,11 +136,6 @@ def print_success(message): _print_message(message, 'SUCCESS', 'green') -def print_infile(message): - """Print INFILE content, color coded for TTYs.""" - _print_message(message, 'INFILE', 'blue') - - def binary_in_path(binary): """Determine if the given binary exists in the provided filesystem paths.""" global os_paths diff --git a/tests/test_infile_bb_parser.py b/tests/test_infile_bb_parser.py deleted file mode 100644 index 871dca57..00000000 --- a/tests/test_infile_bb_parser.py +++ /dev/null @@ -1,288 +0,0 @@ -import unittest -import os - -import infile_handler - - -class TestParseBitBakeFile(unittest.TestCase): - def test_scrape_version_htop(self): - """" - Test that the version is correctly scraped from the file name - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "1.0.3" - self.assertEqual(expect, bb_dict.get('VERSION')) - - def test_scrape_version_vim(self): - """" - Test that the version is correctly scraped from the file name - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "8.0.0983" - self.assertEqual(expect, bb_dict.get('VERSION')) - - def test_scrape_version_catkin_runtime(self): - """" - Test that the version is correctly scraped from the file name - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'catkin-runtime_0.6.19.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "0.6.19" - self.assertEqual(expect, bb_dict.get('VERSION')) - - def test_scrape_url_catkin(self): - bb_file = os.path.join('tests', 'testfiles', 'bb', 'catkin.inc') - bb_dict = infile_handler.file_handler(bb_file, {"NAME": "catkin"}) - - expect = "https://github.com/ros/catkin/archive/${PV}.tar.gz" - self.assertEqual(expect, bb_dict.get('URL')) - - def test_scrape_src_uri_htop(self): - """ - Test that the occurance of ${PV} is replaced by the scraped version. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "http://hisham.hm/htop/releases/1.0.3/htop-1.0.3.tar.gz" - self.assertEqual(expect, bb_dict.get('SRC_URI')) - - def test_scrape_inherits_htop(self): - """ - Test that the package inherits are correctly scraped as a list with - only one line/inherit - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = ["autotools"] - self.assertEqual(expect, bb_dict.get('inherits')) - - def test_scrape_inherits_vim(self): - """ - Test that the package inherits are correctly scraped as a list with - multiple lines/inherits - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = ["autotools update-alternatives", "autotools-brokensep"] - self.assertEqual(expect, bb_dict.get('inherits')) - - def test_scrape_summary_htop(self): - """ - Test that the package summary is correctly scraped - from the bitbake file. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "htop process monitor" - self.assertEqual(expect, bb_dict.get('SUMMARY')) - - def test_scrape_section_htop(self): - """ - Test that the package section is correctly scraped - from the bitbake file. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "console/utils" - self.assertEqual(expect, bb_dict.get('SECTION')) - - def test_scrape_license_htop(self): - """ - Test that the package license is correctly scraped - from the bitbake file. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "GPLv2" - self.assertEqual(expect, bb_dict.get('LICENSE')) - - def test_scrape_depends_htop(self): - """ - Test that the package depends is correctly scraped - from the bitbake file. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "ncurses" - self.assertEqual(expect, bb_dict.get('DEPENDS')) - - def test_scrape_rdepends_htop(self): - """ - Test that the package rsuggests_${PN} is correctly scraped - from the bitbake file. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "ncurses-terminfo" - self.assertEqual(expect, bb_dict.get('RDEPENDS_${PN}')) - - def test_scrape_lic_files_chksum_htop_double_eq(self): - """ - Test that the package license file checksum is correctly scraped - from the bitbake file. This line contains two equal signs - which - will test pattern matching identifies the correct one. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'htop_1.0.3.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "file://COPYING;md5=c312653532e8e669f30e5ec8bdc23be3" - self.assertEqual(expect, bb_dict.get('LIC_FILES_CHKSUM')) - - def test_scrape_s_variable_vim(self): - """ - Test that the s variable is correctly scraped from the bitbake file. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "${WORKDIR}/git/src" - self.assertEqual(expect, bb_dict.get('S')) - - def test_scrape_vimdir_vim(self): - """ - Test that the vimdir variable is correctly scraped from the bitbake - file. This value contains multile 'PV' variables. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "vim${@d.getVar('PV').split('.')[0]}${@d.getVar('PV').split('.')[1]}" - self.assertEqual(expect, bb_dict.get('VIMDIR')) - - def test_scrape_packageconfig_gtkgui_vim(self): - """ - Test that packageconfig[gtkgui] returns the correct value scraped with - the parser. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "--enable-gtk2-test --enable-gui=gtk2,--enable-gui=no,gtk+," - self.assertEqual(expect, bb_dict.get('PACKAGECONFIG[gtkgui]')) - - def test_scrape_packageconfig_tiny_vim(self): - """ - Test that packageconfig[tiny] returns the correct value scraped with - the parser. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "--with-features=tiny,--with-features=big,," - self.assertEqual(expect, bb_dict.get('PACKAGECONFIG[tiny]')) - - def test_scrape_alternative_link_name_vim(self): - """ - Test that ALTERNATIVE_LINK_NAME[vim] is correctly scraped from the - bitbake file. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "${bindir}/vim" - self.assertEqual(expect, bb_dict.get('ALTERNATIVE_LINK_NAME[vim]')) - - def test_scrape_files_tutor_has_hyphen_vim(self): - """ - Test that FILES_${PN}-tutor is correctly scraped. It contains a hyphen - in the variable name. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "${datadir}/${BPN}/${VIMDIR}/tutor ${bindir}/${BPN}tutor" - self.assertEqual(expect, bb_dict.get('FILES_${PN}-tutor')) - - def test_scrape_packageconfig_x11_has_digits_vim(self): - """ - Test that PACKAGECONFIG[x11] is correctly scraped. It contains digits - in the variable name. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "--with-x,--without-x,xt," - self.assertEqual(expect, bb_dict.get('PACKAGECONFIG[x11]')) - - def test_concatenation_op_packageconfig_vim(self): - """ - Test that the resulting value for the PACKAGECONFIG variable, is - the += of the initialization with ??= "". - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" - self.assertEqual(expect, bb_dict.get('PACKAGECONFIG')) - - def test_operations_one(self): - """ - Test that the operations result in the correct assignments in the - bb_dict - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'op_tests.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "second value" - self.assertEqual(expect, bb_dict.get('ONE')) - - def test_operations_two(self): - """ - Test that the operations result in the correct assignments in the - bb_dict - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'op_tests.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "first value" - self.assertEqual(expect, bb_dict.get('TWO')) - - def test_operations_three(self): - """ - Test that the operations result in the correct assignments in the - bb_dict - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'op_tests.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "third value" - self.assertEqual(expect, bb_dict.get('THREE')) - - def test_operations_four(self): - """ - Test that the operations result in the correct assignments in the - bb_dict - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'op_tests.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "third value first value second value" - self.assertEqual(expect, bb_dict.get('FOUR')) - - def test_operations_five(self): - """ - Test that the operations result in the correct assignments in the - bb_dict - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'op_tests.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = "third valuefirst valuesecond value" - self.assertEqual(expect, bb_dict.get('FIVE')) - - def test_line_continuation_src_uri_vim(self): - """ - Test that when there is a line continuation, the entire line is - appended to a single string value. - """ - - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = 'git://github.com/vim/vim.git ' \ - ' file://disable_acl_header_check.patch;patchdir=.. ' \ - ' file://vim-add-knob-whether-elf.h-are-checked.patch;patchdir=.. ' - self.assertEqual(expect, bb_dict.get('SRC_URI')) - - def test_command_scraping_do_configure_vim(self): - """ - Test that when a line starts with do_ it is scraped as a command and - stored as a string. - """ - bb_file = os.path.join('tests', 'testfiles', 'bb', 'vim_8.0.0983.bb') - bb_dict = infile_handler.file_handler(bb_file, {}) - expect = ["# rm -f auto/*", "# touch auto/config.mk", "# aclocal", - "# autoconf", "# oe_runconf", "# touch auto/configure", - "# touch auto/config.mk auto/config.h" ] - self.assertEqual(expect, bb_dict.get('do_configure')) - - -if __name__ == '__main__': - unittest.main(buffer=True) diff --git a/tests/test_infile_handler.py b/tests/test_infile_handler.py deleted file mode 100644 index 04b7a863..00000000 --- a/tests/test_infile_handler.py +++ /dev/null @@ -1,46 +0,0 @@ -import unittest - -import infile_handler - - -class TestInputReader(unittest.TestCase): - def test_sort_files_with_inc_and_bb(self): - """ - Test that the sort_files key to the sorted function, returns the - correct order when multiple bb files and an inc file are passed. - The correct output should be the .inc file first, and then the .bb - files. - """ - files = ['catkin-runtime_0.6.19.bb', 'catkin.inc', 'catkin_0.6.19.bb'] - sorted_files = sorted(files, key=infile_handler.sort_files) - - expect = ['catkin.inc', 'catkin-runtime_0.6.19.bb', 'catkin_0.6.19.bb'] - self.assertEqual(expect, sorted_files) - - def test_parse_ext_bb(self): - path = "cython_7.8.1.bb" - - ext = infile_handler.parse_ext(path) - expect = "bb" - - self.assertEqual(expect, ext) - - def test_parse_ext_inc(self): - path = "cython.inc" - - ext = infile_handler.parse_ext(path) - expect = "inc" - - self.assertEqual(expect, ext) - - def test_parse_ext_none(self): - path = "cython.deb" - - ext = infile_handler.parse_ext(path) - expect = None - - self.assertEqual(expect, ext) - - -if __name__ == '__main__': - unittest.main(buffer=True) diff --git a/tests/test_infile_update_spec.py b/tests/test_infile_update_spec.py deleted file mode 100644 index 094983cc..00000000 --- a/tests/test_infile_update_spec.py +++ /dev/null @@ -1,100 +0,0 @@ -import unittest - -import buildreq -import config -import infile_update_spec -import specfiles -import tarball - - -class TestUpdateSpecfile(unittest.TestCase): - def setUp(self): - # url, version, name, release - url = "http://www.testpkg.com/testpkg/pkg-1.0.tar.gz" - conf = config.Config("") - content = tarball.Content('', '', '', [], conf, "") - conf.content = content - self.specfile = specfiles.Specfile(url, '1.1.1', 'test_pkg', '1', conf, buildreq.Requirements(url), content) - - self.bb_dict = { - "DEPENDS": "ncurses gettext-native", - "LICENSE": "new" - } - - def test_update_summary_if_bb_summary(self): - """ - Test that if a bitbake file has a summary variable it overwrites - the specfile - even if there is a description too. - """ - self.specfile.default_sum = "No detailed summary available" - self.bb_dict["SUMMARY"] = "Vi IMproved - enhanced vi editor" - self.bb_dict["DESCRIPTION"] = "Super awesome VIM description" - infile_update_spec.update_summary(self.bb_dict, self.specfile) - self.assertEqual(self.specfile.default_sum, - "Vi IMproved - enhanced vi editor") - - def test_update_summary_if_not_default(self): - """ - Test that if a bitbake file does NOT have a summary variable, but - instead has a description variable, that overwrites the specfile" - """ - self.specfile.default_sum = "No detailed summary available" - self.bb_dict["DESCRIPTION"] = "Super awesome VIM description" - infile_update_spec.update_summary(self.bb_dict, self.specfile) - self.assertEqual(self.specfile.default_sum, - "Super awesome VIM description") - - def test_update_summary_if_no_bb_summary_or_description(self): - """ - Test that if a bitbake file has neither a summary or description - that the default specfile summary is written - """ - self.specfile.default_sum = "No detailed summary available" - infile_update_spec.update_summary(self.bb_dict, self.specfile) - self.assertEqual(self.specfile.default_sum, - "No detailed summary available") - - def test_update_license_if_not_in_licenses_list(self): - """ - Test that if a license is scraped from the bb file, and not in the - licenses specfile list, that it should be added to the list. - """ - self.specfile.licenses = ['random', 'license'] - infile_update_spec.update_licenses(self.bb_dict, self.specfile) - self.assertEqual(self.specfile.licenses, ['random', 'license', 'new']) - - def test_update_license_if_in_license_list_case(self): - """ - Test that if a license is already in the specfile licenses list, not - case sensitive, then it should not be duplicated. - """ - self.specfile.licenses = ['random', 'New'] - infile_update_spec.update_licenses(self.bb_dict, self.specfile) - self.assertEqual(self.specfile.licenses, ['random', 'New']) - - def test_update_build_deps_append_normal(self): - """ - Test that if a set if multiple items are scraped from the bb file, and - they are not already in the specfile, they will be added to the set of - buildreqs. If the bb depends ends in '-native' that should be removed - as well. - """ - self.specfile.buildreqs = {'gmp-dev', 'lua-dev'} - infile_update_spec.update_build_deps(self.bb_dict, self.specfile) - self.assertEqual(self.specfile.buildreqs, {'gmp-dev', 'lua-dev', - 'ncurses', 'gettext'}) - - def test_update_build_deps_append_duplicates(self): - """ - Test that if a set if multiple items are scraped from the bb file, and - they are already in the specfile, the resulting set with be the union - of set 1 and set 2. - """ - self.specfile.buildreqs = {'gmp-dev', 'ncurses'} - infile_update_spec.update_build_deps(self.bb_dict, self.specfile) - self.assertEqual(self.specfile.buildreqs, {'gmp-dev', 'ncurses', - 'gettext'}) - - -if __name__ == '__main__': - unittest.main(buffer=True) From 0212146e11e9d4089eafec38d73f3b8a6f51e6dd Mon Sep 17 00:00:00 2001 From: Lucius Hu Date: Tue, 1 Sep 2020 19:34:05 -0400 Subject: [PATCH 2/2] removed testfiles for BitBake modules --- tests/testfiles/bb/catkin-runtime_0.6.19.bb | 30 ------ tests/testfiles/bb/catkin.inc | 32 ------ tests/testfiles/bb/catkin_0.6.19.bb | 20 ---- tests/testfiles/bb/htop_1.0.3.bb | 22 ---- tests/testfiles/bb/op_tests.bb | 17 --- tests/testfiles/bb/vim_8.0.0983.bb | 112 -------------------- 6 files changed, 233 deletions(-) delete mode 100644 tests/testfiles/bb/catkin-runtime_0.6.19.bb delete mode 100644 tests/testfiles/bb/catkin.inc delete mode 100644 tests/testfiles/bb/catkin_0.6.19.bb delete mode 100644 tests/testfiles/bb/htop_1.0.3.bb delete mode 100644 tests/testfiles/bb/op_tests.bb delete mode 100644 tests/testfiles/bb/vim_8.0.0983.bb diff --git a/tests/testfiles/bb/catkin-runtime_0.6.19.bb b/tests/testfiles/bb/catkin-runtime_0.6.19.bb deleted file mode 100644 index 55617cca..00000000 --- a/tests/testfiles/bb/catkin-runtime_0.6.19.bb +++ /dev/null @@ -1,30 +0,0 @@ -ROS_SPN = "catkin" - -require catkin.inc - -SRC_URI += "\ - file://0001-ignore-LD_LIBRARY_PATH-set-in-environment_cache.py.patch \ - " - -S = "${WORKDIR}/catkin-${PV}" - -# This package includes ONLY the python packages AND catkin_find -# The catkin_${PV} package includes all other files -# from the catkin tool. -FILES_${PN} = "${PYTHON_SITEPACKAGES_DIR} ${ros_bindir}/catkin_find" - -RDEPENDS_${PN}_class-native = "" -RDEPENDS_${PN} = "\ - ${PYTHON_PN}-catkin-pkg ${PYTHON_PN}-argparse ${PYTHON_PN}-misc ${PYTHON_PN}-multiprocessing \ - ${PYTHON_PN}-shell ${PYTHON_PN}-subprocess ${PYTHON_PN}-xml ${PYTHON_PN}-pkgutil" - -# Delete everything but the python packages in order to avoid -# that the QA error [installed-vs-shipped] hits on us. -do_install_append() { - rm ${D}${ros_bindir}/catkin_*_* - rm ${D}${ros_bindir}/catkin_make - rm -rf ${D}${ros_datadir} - rm -rf ${D}${ros_libdir}/pkgconfig -} - -BBCLASSEXTEND += "native" diff --git a/tests/testfiles/bb/catkin.inc b/tests/testfiles/bb/catkin.inc deleted file mode 100644 index 157c931c..00000000 --- a/tests/testfiles/bb/catkin.inc +++ /dev/null @@ -1,32 +0,0 @@ -DESCRIPTION = "Low-level build system macros and infrastructure for ROS" -SECTION = "devel" -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5" - -DEPENDS = "cmake ${PYTHON_PN}-empy-native ${PYTHON_PN}-catkin-pkg-native" - -SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz" -SRC_URI[md5sum] = "d58460cc9112812d8c4e6ecf98bbcc85" -SRC_URI[sha256sum] = "90a639d67db7f9039487af555e432a5b4b6e339f22892d75d03b823b3f38c947" - -SRC_URI += "\ - file://0001-CATKIN_WORKSPACES-Don-t-require-.catkin-file.patch \ - file://0001-use-python-provided-by-environment-instead-of-the-ge.patch \ - file://0001-avoid-using-host-s-paths-when-cross-compiling.patch \ - file://0001-relocate-dependency-s-headers-to-current-sysroot.patch \ - ${@'file://0001-python.cmake-look-for-python3-first.patch' if d.getVar('PYTHON_PN', True) == 'python3' else ''} \ - " - -inherit catkin - -FILES_${PN}-dev += "\ - ${ros_datadir}/eigen/cmake \ - ${ros_datadir}/ros/cmake \ - ${ros_datadir}/.catkin \ - ${ros_prefix}/.catkin \ - ${ros_prefix}/.rosinstall \ - ${ros_prefix}/_setup_util.py \ - ${ros_prefix}/env.sh \ - ${ros_prefix}/setup.* \ - " - diff --git a/tests/testfiles/bb/catkin_0.6.19.bb b/tests/testfiles/bb/catkin_0.6.19.bb deleted file mode 100644 index c74f9989..00000000 --- a/tests/testfiles/bb/catkin_0.6.19.bb +++ /dev/null @@ -1,20 +0,0 @@ -require catkin.inc - -DEPENDS_class-native += "catkin-runtime" - -RDEPENDS_${PN}_class-native = "${PYTHON_PN}-catkin-pkg" -RDEPENDS_${PN} = "cmake make binutils binutils-symlinks gcc gcc-symlinks g++ g++-symlinks \ - catkin-runtime" - -# The files in ${PYTHON_SITEPACKAGES_DIR} and catkin_find are -# installed by the catkin-runtime package. Therefore, we remove -# them here so that they are not installed. -# Moreover: the ${ros_libdir}/python2.7 is empty. We need to -# remove it, otherwise the QA error [installed-vs-shipped] will hit on us. -do_install_append() { - rm ${D}${ros_bindir}/catkin_find - rm -rf ${D}${PYTHON_SITEPACKAGES_DIR} - rmdir ${D}${ros_libdir}/${PYTHON_DIR} -} - -BBCLASSEXTEND += "native" diff --git a/tests/testfiles/bb/htop_1.0.3.bb b/tests/testfiles/bb/htop_1.0.3.bb deleted file mode 100644 index 181661af..00000000 --- a/tests/testfiles/bb/htop_1.0.3.bb +++ /dev/null @@ -1,22 +0,0 @@ -SUMMARY = "htop process monitor" -HOMEPAGE = "http://htop.sf.net" -SECTION = "console/utils" -LICENSE = "GPLv2" - -LIC_FILES_CHKSUM = "file://COPYING;md5=c312653532e8e669f30e5ec8bdc23be3" - -DEPENDS = "ncurses" -RDEPENDS_${PN} = "ncurses-terminfo" - -SRC_URI = "http://hisham.hm/htop/releases/${PV}/htop-${PV}.tar.gz" - -SRC_URI[md5sum] = "e768b9b55c033d9c1dffda72db3a6ac7" -SRC_URI[sha256sum] = "055c57927f75847fdc222b5258b079a9542811a9dcf5421c615c7e17f55d1829" - -LDFLAGS_append_libc-uclibc = " -lubacktrace" - -do_configure_prepend () { - rm -rf ${S}/config.h -} - -inherit autotools diff --git a/tests/testfiles/bb/op_tests.bb b/tests/testfiles/bb/op_tests.bb deleted file mode 100644 index 5b506e99..00000000 --- a/tests/testfiles/bb/op_tests.bb +++ /dev/null @@ -1,17 +0,0 @@ -ONE ??= "first value" -ONE ?= "second value" - -TWO ?= "first value" -TWO ??= "second value" - -THREE ??= "first value" -THREE ?= "second value" -THREE = "third value" - -FOUR = "first value" -FOUR += "second value" -FOUR =+ "third value" - -FIVE = "first value" -FIVE .= "second value" -FIVE =. "third value" diff --git a/tests/testfiles/bb/vim_8.0.0983.bb b/tests/testfiles/bb/vim_8.0.0983.bb deleted file mode 100644 index 407ce5e7..00000000 --- a/tests/testfiles/bb/vim_8.0.0983.bb +++ /dev/null @@ -1,112 +0,0 @@ -SUMMARY = "Vi IMproved - enhanced vi editor" -SECTION = "console/utils" -DEPENDS = "ncurses gettext-native" -# vimdiff doesn't like busybox diff -RSUGGESTS_${PN} = "diffutils" -LICENSE = "vim" -LIC_FILES_CHKSUM = "file://../runtime/doc/uganda.txt;md5=eea32ac1424bba14096736a494ae9045" - -SRC_URI = "git://github.com/vim/vim.git \ - file://disable_acl_header_check.patch;patchdir=.. \ - file://vim-add-knob-whether-elf.h-are-checked.patch;patchdir=.. \ -" -SRCREV = "3f9a1ff141412e9e85f7dff47d02946cb9be9228" - -S = "${WORKDIR}/git/src" - -VIMDIR = "vim${@d.getVar('PV').split('.')[0]}${@d.getVar('PV').split('.')[1]}" - -inherit autotools update-alternatives -inherit autotools-brokensep - -# vim configure.in contains functions which got 'dropped' by autotools.bbclass -do_configure () { - rm -f auto/* - touch auto/config.mk - aclocal - autoconf - oe_runconf - touch auto/configure - touch auto/config.mk auto/config.h -} - -#Available PACKAGECONFIG options are gtkgui, acl, x11, tiny -PACKAGECONFIG ??= "" -PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" - -PACKAGECONFIG[gtkgui] = "--enable-gtk2-test --enable-gui=gtk2,--enable-gui=no,gtk+," -PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," -PACKAGECONFIG[x11] = "--with-x,--without-x,xt," -PACKAGECONFIG[tiny] = "--with-features=tiny,--with-features=big,," -PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux," -PACKAGECONFIG[elfutils] = "--enable-elf-check,,elfutils," - -EXTRA_OECONF = " \ - --disable-gpm \ - --disable-gtktest \ - --disable-xim \ - --disable-netbeans \ - --with-tlib=ncurses \ - ac_cv_small_wchar_t=no \ - vim_cv_getcwd_broken=no \ - vim_cv_memmove_handles_overlap=yes \ - vim_cv_stat_ignores_slash=no \ - vim_cv_terminfo=yes \ - vim_cv_tgent=non-zero \ - vim_cv_toupper_broken=no \ - vim_cv_tty_group=world \ - STRIP=/bin/true \ -" - -do_install() { - autotools_do_install - - # Work around file-rdeps picking up csh, awk, perl or python as a dep - chmod -x ${D}${datadir}/${BPN}/${VIMDIR}/tools/vim132 - chmod -x ${D}${datadir}/${BPN}/${VIMDIR}/tools/mve.awk - chmod -x ${D}${datadir}/${BPN}/${VIMDIR}/tools/*.pl - chmod -x ${D}${datadir}/${BPN}/${VIMDIR}/tools/*.py - - # Install example vimrc from runtime files - install -m 0644 ../runtime/vimrc_example.vim ${D}/${datadir}/${BPN}/vimrc - - # we use --with-features=big as default - mv ${D}${bindir}/${BPN} ${D}${bindir}/${BPN}.${BPN} -} - -PARALLEL_MAKEINST = "" - -PACKAGES =+ "${PN}-common ${PN}-syntax ${PN}-help ${PN}-tutor ${PN}-vimrc ${PN}-tools" -FILES_${PN}-syntax = "${datadir}/${BPN}/${VIMDIR}/syntax" -FILES_${PN}-help = "${datadir}/${BPN}/${VIMDIR}/doc" -FILES_${PN}-tutor = "${datadir}/${BPN}/${VIMDIR}/tutor ${bindir}/${BPN}tutor" -FILES_${PN}-vimrc = "${datadir}/${BPN}/vimrc" -FILES_${PN}-data = "${datadir}/${BPN}" -FILES_${PN}-tools = "${datadir}/${BPN}/${VIMDIR}/tools" -FILES_${PN}-common = " \ - ${datadir}/${BPN}/${VIMDIR}/*.vim \ - ${datadir}/${BPN}/${VIMDIR}/autoload \ - ${datadir}/${BPN}/${VIMDIR}/colors \ - ${datadir}/${BPN}/${VIMDIR}/compiler \ - ${datadir}/${BPN}/${VIMDIR}/ftplugin \ - ${datadir}/${BPN}/${VIMDIR}/indent \ - ${datadir}/${BPN}/${VIMDIR}/keymap \ - ${datadir}/${BPN}/${VIMDIR}/lang \ - ${datadir}/${BPN}/${VIMDIR}/macros \ - ${datadir}/${BPN}/${VIMDIR}/plugin \ - ${datadir}/${BPN}/${VIMDIR}/print \ - ${datadir}/${BPN}/${VIMDIR}/spell \ - ${datadir}/icons \ -" - -RDEPENDS_${BPN} = "ncurses-terminfo-base" -# Recommend that runtime data is installed along with vim -RRECOMMENDS_${BPN} = "${PN}-syntax ${PN}-help ${PN}-tutor ${PN}-vimrc ${PN}-common" - -ALTERNATIVE_${PN} = "vi vim" -ALTERNATIVE_TARGET = "${bindir}/${BPN}.${BPN}" -ALTERNATIVE_LINK_NAME[vi] = "${base_bindir}/vi" -ALTERNATIVE_LINK_NAME[vim] = "${bindir}/vim" -ALTERNATIVE_PRIORITY = "100" - -BBCLASSEXTEND = "native"