Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed infile features #647

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
45 changes: 3 additions & 42 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>

url (required - unless infile is passed) tarball URL
url (required) tarball URL
(e.g. http://example.com/downloads/mytar.tar.gz)

optional arguments:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
```
Expand Down
33 changes: 4 additions & 29 deletions autospec/autospec.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
import config
import files
import git
import infile_handler
import infile_update_spec
import license
from logcheck import logcheck
import pkg_integrity
import pkg_scan
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__))

Expand Down Expand Up @@ -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 "
Expand All @@ -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(
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
Loading