Created attachment 477865 [details] Fix error message while `_name_from_spec' can't parse spec file I have encountered following error, while running $ fedpkg local on branch with "broken" .spec file which was missing first date line. $ fedpkg local Traceback (most recent call last): File "/usr/bin/fedpkg", line 1259, in <module> args.command(args) File "/usr/bin/fedpkg", line 569, in local mymodule = pyfedpkg.PackageModule(args.path, args.dist) File "/usr/lib/python2.7/site-packages/pyfedpkg/__init__.py", line 1083, in __init__ self.module = _name_from_spec(os.path.join(self.path, self.spec)) File "/usr/lib/python2.7/site-packages/pyfedpkg/__init__.py", line 111, in _name_from_spec return output.split()[0] IndexError: list index out of range With the provided patch I get following output (it actually tells what to do): $ fedpkg local error: %changelog entries must start with * error: query of specfile /home/vvitek/work/less/master/less.spec failed, can't parse Could not build locally: Could not parse spec file. But anyway, I find very annoying that $ fedpkg local parses spec file just for the name of module (def _name_from_spec), that could be actually parsed from the filename itself (convention of <module>.spec). In other words, there is no need of spec file to make local build from archive, is it?
There have been a few cases where the spec file doesn't match the name of the package. I wanted to make fedpkg work in this scenario. RPM is going to parse the specfile when it builds, so if the specfile is broken, the build is going to fail too. The parsing is very quick, so I don't really see why it is a problem to parse it. I'll be looking into the patch today, thanks!
Just committed something upstream that fixes this in the coding style we use.
Thank you, Jesse! > There have been a few cases where the spec file doesn't match the name > of the package. I didn't know there could be such files. I thought we had strict policy without any exceptions. http://fedoraproject.org/wiki/Packaging:NamingGuidelines#Spec_file_name Actually, if we could rely on the package name, the patch could be even simpler: --- __init__.py.orig 2011-02-09 17:37:10.660506442 +0100 +++ __init__.py 2011-02-10 10:14:23.891256705 +0100 @@ -765,7 +765,7 @@ def sources(path, outdir=None): break if not spec: raise FedpkgError('%s is not a valid repo' % path) - module = _name_from_spec(os.path.join(path, spec)) + module = spec[0:-5] # Strip ".spec" suffix try: archives = open(os.path.join(path, 'sources'), 'r').readlines()
We have the policy yes, but that doesn't mean the policy is always followed. It is better to be flexible in what input is accepted. Getting the name via parsing the spec is the proper way to do this, and it takes a fraction of a second, I really don't understand why you have a problem with this.
fedpkg local does a (In reply to comment #0) > > But anyway, I find very annoying that > $ fedpkg local > parses spec file just for the name of module (def _name_from_spec), that could > be actually parsed from the filename itself (convention of <module>.spec). > > In other words, there is no need of spec file to make local build from archive, > is it? fedpkg local should be doing a rpmbuild -ba <spec> not unpacking the tarball and building in it. it does it locally on the system using rpm not from the archive so yes there is a need to parse the spec file. Dennis
fedora-packager-0.5.5.0-1.fc14 has been submitted as an update for Fedora 14. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-1.fc14
fedora-packager-0.5.5.0-1.fc13 has been submitted as an update for Fedora 13. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-1.fc13
fedora-packager-0.5.5.0-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-1.el5
fedora-packager-0.5.5.0-1.el6 has been submitted as an update for Fedora EPEL 6. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-1.el6
fedora-packager-0.5.5.0-1.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-1.fc15
fedora-packager-0.5.5.0-1.fc15 has been pushed to the Fedora 15 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update fedora-packager'. You can provide feedback for this update here: https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-1.fc15
(In reply to comment #4) > I really don't understand why you have a problem with this. It's all about git workflow. I always do separate changes in separate commits, which means "broken" %changelog section until the final commit with "name-modify-line" and increased release version. (In reply to comment #5) > fedpkg local > > should be doing a rpmbuild -ba <spec> not unpacking the tarball and building > in it. it does it locally on the system using rpm not from the archive so yes > there is a need to parse the spec file. Well, this probably killed my arguments.. Seems like I have to add the line every time (or use git stash).
There are some projects around that can create rpm changelog lines based on git commit messages from a previous point. I'll be looking at moving something like that into fedpkg itself, so that you can avoid doing the spec changelog entries until you're ready to bump n-v-r and build.
fedora-packager-0.5.5.0-2.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-2.fc15
fedora-packager-0.5.5.0-2.fc14 has been submitted as an update for Fedora 14. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-2.fc14
fedora-packager-0.5.5.0-2.fc13 has been submitted as an update for Fedora 13. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-2.fc13
fedora-packager-0.5.5.0-2.el6 has been submitted as an update for Fedora EPEL 6. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-2.el6
fedora-packager-0.5.5.0-2.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/fedora-packager-0.5.5.0-2.el5
fedora-packager-0.5.5.0-2.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.
fedora-packager-0.5.5.0-2.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report.
fedora-packager-0.5.5.0-2.el5 has been pushed to the Fedora EPEL 5 stable repository. If problems still persist, please make note of it in this bug report.
fedora-packager-0.5.5.0-2.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.
fedora-packager-0.5.5.0-2.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report.