Generally the code looks fairly ok. I'm not sure how well this would work for spec files which use a lot of macros, but then there is the --force to ignore the warning, so it should be okay.
--force
I would however really like to see some unit tests to make sure this does not break the push functionality.
push
Pull-Request has been rebased
s/chceck/check/
LGTM
spec files which use a lot of macros
Parsing spec includes, among others, evaluation of all the macros, no matter how complex they are, correct? It would be a faulty parser otherwise.
What I mostly meant by that comment is that rpkg has no way of knowing all macros that are (or will be) defined in the buildroot and what their values are. I don't think many people are actually using constructions like that to list patches in their spec file, but theoretically it could happen. I believe it is fine to report a false positive error as long as there is a way to ignore it.
@cqi There seems to be something going on with this patch. When I test it locally, the tests are passing. Once I merge it to master (either with a merge commit or rebase), the tests start to fail with seeming unrelated message:
====================================================================== ERROR: <nose.suite.ContextSuite context=test.test_commands> test suite for <module 'test.test_commands' from '/home/lsedlar/repos/rpkg/test/test_commands.py'> ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/nose/suite.py", line 209, in run self.setUp() File "/usr/lib/python2.7/site-packages/nose/suite.py", line 292, in setUp self.setupContext(ancestor) File "/usr/lib/python2.7/site-packages/nose/suite.py", line 315, in setupContext try_run(context, names) File "/usr/lib/python2.7/site-packages/nose/util.py", line 471, in try_run return func() File "/home/lsedlar/repos/rpkg/test/test_commands.py", line 77, in setup_module index.add([spec_file_path]) File "/usr/lib/python2.7/site-packages/git/index/base.py", line 726, in add entries_added.extend(self._entries_for_paths(paths, path_rewriter, fprogress, entries)) File "/usr/lib/python2.7/site-packages/git/util.py", line 54, in wrapper return func(self, *args, **kwargs) File "/usr/lib/python2.7/site-packages/git/index/util.py", line 81, in set_git_working_dir cur_wd = os.getcwd() OSError: [Errno 2] No such file or directory
A somewhat minimal process to replicate is:
$ git checkout -b test-fail araszka/bz879634 $ git cherry-pick 7b62400 $ python setup.py test
This is interesting, and obviously, confused. I tried other ways to run all or partial tests instead of python setup.py test, for example, nosetests test/test_*.py test/commands/ and even nosetests test/test_commands.py test/commands/test_push.py, all pass. So far, still have no idea what causes this issue. Keep looking into this issue.
python setup.py test
nosetests test/test_*.py test/commands/
nosetests test/test_commands.py test/commands/test_push.py
GitPython version is 1.0.1
Pull-Request has been merged by lsedlar