[Rpm-maint] [rpm-software-management/rpm] [Proposal] Adding style and pytest environment on tox for rpm python bindings module. (#303)

2017-08-16 Thread Jun Aruga
## Motivation

I want to add style (static code analysis) test and pytest for the python code.
When I did debug the python code for the issue related to library path: 
https://github.com/rpm-software-management/rpm/issues/130 , I thought adding 
those was useful.

## Detail

We have tests/rpmpython.at for the rpm python binding.
However I think that using pytest is also good to maintain and customize the 
detail of the test easily.

The style check for python code is one of the merit to keep the python code 
clean.

- Style check by `flake8`.
  - I used `flake8` because `flake8` is better than pylint simple style check.
and it is also used in `rpmlint` project.
  - I used `python/.flake8` as a compromise to warnings from "import *".
In the future, we can do below style removing the `.flake8` file.
> http://docs.python-guide.org/en/latest/writing/structure/#modules
> import modu
> [...]
> x = modu.sqrt(4)  # sqrt is visibly part of modu's namespace

- Test for python binding by pytest.
  The test is here `python/tests/test_rpm.py`.
  Right now only 1 test case as a proposal.

- python/setup.py.in
  In the tox test, `pytyhon setup.py build` is run under 
`/tmp/pip-l2s21mdp-build`.
  So, previous logic to check parent directory's `Makefile.am` file
  does not work in this case.

  In the case of that there is no parent directory for build directory,
  users can build with specifying include and library direcotory.

``` 
RPM_NO_SEARCH_BUILD_DIR=1 python3 setup.py build \
  --include-dirs=/path/to/include/ --library-dirs=/path/to/libs/
```

- ci/Dockerfile
  Added the logic to run the pytest and the style test.


## Workflow example

### Build

```
$ ./autogen.sh --noconfigure

$ ./configure --prefix="$(pwd)/dest"

$ make
```

### Tox test and build for the python module.

```
$ cd python

$ tox

$ python setup.py build

$ python3 setup.py build

$ cd ..
```

### Install

```
$ make install
```

### Check linked libraries.

```
$ LD_LIBRARY_PATH="$(pwd)/dest/lib" \
ldd python/build/lib.*/rpm/*.so
python/build/lib.linux-x86_64-2.7/rpm/_rpmb.so:
linux-vdso.so.1 (0x7ffdd5e68000)
librpm.so.8 => /home/jaruga/git/rpm/dest/lib/librpm.so.8 
(0x7f6681393000)
librpmio.so.8 => /home/jaruga/git/rpm/dest/lib/librpmio.so.8 
(0x7f6681164000)
librpmbuild.so.8 => /home/jaruga/git/rpm/dest/lib/librpmbuild.so.8 
(0x7f6680f3a000)
...
```

See https://gist.github.com/junaruga/789866509a21afb32e3c1ab40b48120a to check 
full result of the `ldd` command.

You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/303

-- Commit Summary --

  * Add pytest and style environment for rpm python bindings module.

-- File Changes --

M ci/Dockerfile (14)
A python/.flake8 (5)
M python/.gitignore (1)
M python/rpm/__init__.py (4)
M python/setup.py.in (76)
A python/test-requirements.txt (2)
A python/tests/test_rpm.py (6)
A python/tox.ini (19)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/303.patch
https://github.com/rpm-software-management/rpm/pull/303.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/303
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Run binary package generation via thread pools (#226)

2017-08-16 Thread ニール・ゴンパ
@kanavin Now that rpm 4.14 has been branched, could you rebase them for review 
to merge into master?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/226#issuecomment-322755160___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Fail to check signature (#270)

2017-08-16 Thread Panu Matilainen
FWIW that --delsign corruption is of course a bug in <= 4.13.0 someplace, if it 
can't handle it should at least refuse to touch it. That corruption longer 
happens in 4.13.90 (once patched to accept the package in the first place) so 
it's gotten fixed somewhere along the road, whatever it is. Bisecting that is a 
bit of a PITA as there are other related bugs present during development...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/270#issuecomment-322708117___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Fail to check signature (#270)

2017-08-16 Thread Panu Matilainen
Oh, sorry for missed that. But now the question is, what rpm version is used to 
*sign* that package? 

It doesn't seem like any rpm.org upstream version because deleting the 
signature (with rpm <= 4.13.0) corrupts the package beyond recognition of those 
older versions too:
```
[pmatilai@sopuli rpm-4.13.x]$ cp 
~/Downloads/intel-aero-repo-1.4-r0.corei7_64.rpm /tmp/
[pmatilai@sopuli rpm-4.13.x]$ ./rpmkeys -Kv 
/tmp/intel-aero-repo-1.4-r0.corei7_64.rpm 
/tmp/intel-aero-repo-1.4-r0.corei7_64.rpm:
Header V3 RSA/SHA1 Signature, key ID bb0396db: NOKEY
Header SHA1 digest: OK (3066ac48fef77e939547216732d92bb047eb85b6)
V3 RSA/SHA1 Signature, key ID bb0396db: NOKEY
MD5 digest: OK (cf96418cf798c2ef1351fb012e7a6b7e)
[pmatilai@sopuli rpm-4.13.x]$ ./rpmsign --delsign 
/tmp/intel-aero-repo-1.4-r0.corei7_64.rpm
/tmp/intel-aero-repo-1.4-r0.corei7_64.rpm:
[pmatilai@sopuli rpm-4.13.x]$ ./rpmkeys -Kv 
/tmp/intel-aero-repo-1.4-r0.corei7_64.rpm 
error: /tmp/intel-aero-repo-1.4-r0.corei7_64.rpm: sigh data: BAD, no. of  
bytes(8900) out of range
```

If this is signed with an rpm.org release, a reproducer please.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/270#issuecomment-322698252___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint