Spec URL: https://trb143.fedorapeople.org/python3-pysword.spec SRPM URL: https://trb143.fedorapeople.org/python-pysword-0.2.1-1.fc23.src.rpm Description: A set of python utilities which will read Sword bible files without the need to install Sword software. Fedora Account System TRB143:
The spec name should match the %name parameter according to the guidelines (https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Spec_File_Naming) rpmlint shows 2 errors on the srpm: > rpmlint python-pysword-0.2.1-1.fc23.src.rpm python-pysword.src: W: non-standard-group Unspecified python-pysword.src: E: invalid-spec-name python-pysword.src:39: E: files-attr-not-set python-pysword.src: W: no-cleaning-of-buildroot %install python-pysword.src: W: no-cleaning-of-buildroot %clean python-pysword.src: W: no-buildroot-tag python-pysword.src: W: no-%clean-section 1 packages and 0 specfiles checked; 2 errors, 5 warnings.
Drop %gittag0, just specify the version in Version. You have python-pysword (the main src package), and python3-pysword (the only binary package). So there should be just on summary. Put it in Summary, drop %sum, and use Summary: %summary later on. %description makes no sense.
Looking at the packaging again I can see errors. The inital question is the upstream package is called pysword and that is how it is built. Should I package it as pysword or python3-pysword. To move to python3-pysword I would need to rebuild a copy of the upstream packaging.
1) Rename the spec file to python-pysword.spec 2) You only need these two globals: %global srcname pysword %global commit 50a1b1a526e5d6511555c458df754498aaa3185f 3) Tags: Version: 0.2.3 Source0: https://gitlab.com/tgc-dk/%{srcname}/repository/archive.tar.gz?ref=%{version}#/%{srcname}-%{version}.tar.gz 4) Description expands upon summary. 5) Instead of `sum` macro use `summary`: %package -n python3-%{srcname} Summary: %{summary} %{?python_provide:%python_provide python3-%{srcname}} 6) Prepare section: %prep %autosetup -n %{srcname}-%{version}-%{commit} 7) Missing doc and license file: %files -n python3-%{srcname} %license LICENSE %doc README.rst %{python3_sitelib}/* 8) Email address should be in `<>`. See: https://fedoraproject.org/wiki/Packaging:Guidelines#Changelogs
Update files as per review comments a uploaded a revised version. https://trb143.fedorapeople.org/python-pysword-0.2.3-0.fc25.src.rpm https://trb143.fedorapeople.org/python-pysword.spec
*This is un-official review of the package.* `rpmlint -iv *.rpm` gives two errors ...... python-pysword.noarch: I: checking-url https://gitlab.com/tgc-dk/pysword (timeout 10 seconds) python-pysword.noarch: E: wrong-script-interpreter /usr/lib/python3.6/site-packages/pysword/canon-parser.py /usr/bin/env python3 python-pysword.noarch: E: non-executable-script /usr/lib/python3.6/site-packages/pysword/canon-parser.py 644 /usr/bin/env python3 ...... python-pysword.src: W: invalid-url Source0: https://gitlab.com/tgc-dk/python-pysword/repository/archive.tar.gz?ref=0.2.3#/python-pysword-0.2.3.tar.gz HTTP Error 401: Unauthorized The value should be a valid, public HTTP, HTTPS, or FTP URL. 1) change shebang '/usr/bin/env python3' to '/usr/bin/python3' 2) You may should add 'chmod a+x canon-parser.py' after %setup command. 3) the 'Source0' tag has authentication problem.
Hello, - Group: and Buildroot: are not used in Fedora. See: https://fedoraproject.org/wiki/Packaging:Guidelines#Tags_and_Sections - %clean is not needed either. Nor is rm -rf %{buildroot} in %install. - This is wrong: %global srcname python-pysword It should be: %global srcname pysword
Another set of updates https://trb143.fedorapeople.org/python-pysword.spec https://trb143.fedorapeople.org/python-pysword-0.2.3-0.fc25.src.rpm
%{__python3} setup.py build → %py3_build %{__python3} setup.py install --skip-build -O1 --root %{buildroot} → %py3_install Also you should provide packages for both python2 and python3
https://trb143.fedorapeople.org/python-pysword-0.2.3-1.fc27.src.rpm https://trb143.fedorapeople.org/python-pysword.spec Sorry wrong files uploaded.
https://trb143.fedorapeople.org/python-pysword.spec https://trb143.fedorapeople.org/python-pysword-0.2.4-1.fc27.src.rpm New 0.2.4 release
You should provide Python 2 and Python 3 versions. If you only provide Python 3 you should still make a Python 3 subpackage to the main one.
I only want a python3 version. Do you have an example of a spec file as I am very confused as this is based on other packages I have found.
(In reply to TR Bentley from comment #13) > I only want a python3 version. I recommend you to move %description to %global desc xxxxx \ xxxx \ xxxx and use %description %{desc} %package -n python3-pysword Summary: %{sum} %description -n python3-pysword %{desc} %files -n python3-pysword
(In reply to TR Bentley from comment #13) > I only want a python3 version. > Do you have an example of a spec file as I am very confused as this is based > on other packages I have found. As Itamar said or look at https://fedoraproject.org/wiki/Packaging:Python#Example_common_spec_file Just don't add the python2 subpackage.
Revised based on the previous comments. https://trb143.fedorapeople.org/python-pysword-0.2.4-1.fc27.src.rpm https://trb143.fedorapeople.org/python-pysword.spec Thanks for the pointers.
%description -n python3-%{srcname} %{desc} desc must be defined beforehand, otherwise this macro is empty. For example, in the header you define it: %global desc %{expand: A native Python reader of the SWORD Project Bible Modules. Reads SWORD bible files (not commentaries etc.) Detection of locally installed Swrod bible modules. Supports all known SWORD module formats (ztext, ztext4, rawtext, rawtext4) Read from zipped modules, like those available from http://www.crosswire.org/sword/modules/ModDisp.jsp?modType=Bibles Cleans the extracted text of OSIS, GBF or ThML tags. Supports both python 2 and 3 (tested with 2.7 and 3.5).} Then you reuse it twice: %description %{desc} %package -n python3-%{srcname} Summary: %{sum} %{?python_provide:%python_provide python3-%{srcname}} %description -n python3-%{srcname} %{desc} I'm busy right now, I'll look at it this evening or tonight, looks good otherwise.
https://trb143.fedorapeople.org/python-pysword-0.2.4-1.fc27.src.rpm https://trb143.fedorapeople.org/python-pysword.spec Should have fixed the desc issue.
You don't need \ at the end of the line if you use %{expand: - Build error: + cd pysword-0.2.4 BUILDSTDERR: /var/tmp/rpm-tmp.if9CI4: line 40: cd: pysword-0.2.4: No such file or directory Seems the directory is suffixed by the commit hash: %prep %autosetup -n %{srcname}-%{version}-%{commit} - Date is incorrect in %changelog: * Sun Mar 17 2018 Should be: Sat Mar 17 - Tests fail BUILDSTDERR: ====================================================================== BUILDSTDERR: ERROR: test_load_bsv_zip (tests.test_files.TestModules) BUILDSTDERR: ---------------------------------------------------------------------- BUILDSTDERR: Traceback (most recent call last): BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/test_files.py", line 78, in test_load_bsv_zip BUILDSTDERR: found_modules = modules.parse_modules() BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/pysword/modules.py", line 83, in parse_modules BUILDSTDERR: zipped_module = zipfile.ZipFile(self._sword_path) BUILDSTDERR: File "/usr/lib64/python3.6/zipfile.py", line 1090, in __init__ BUILDSTDERR: self.fp = io.open(file, filemode) BUILDSTDERR: FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/resources/bsv.zip' BUILDSTDERR: ====================================================================== BUILDSTDERR: ERROR: test_load_chipinyin_zip (tests.test_files.TestModules) BUILDSTDERR: ---------------------------------------------------------------------- BUILDSTDERR: Traceback (most recent call last): BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/test_files.py", line 60, in test_load_chipinyin_zip BUILDSTDERR: found_modules = modules.parse_modules() BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/pysword/modules.py", line 83, in parse_modules BUILDSTDERR: zipped_module = zipfile.ZipFile(self._sword_path) BUILDSTDERR: File "/usr/lib64/python3.6/zipfile.py", line 1090, in __init__ BUILDSTDERR: self.fp = io.open(file, filemode) BUILDSTDERR: FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/resources/chipinyin.zip' BUILDSTDERR: ====================================================================== BUILDSTDERR: ERROR: test_load_finpr_zip (tests.test_files.TestModules) BUILDSTDERR: ---------------------------------------------------------------------- BUILDSTDERR: Traceback (most recent call last): BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/test_files.py", line 42, in test_load_finpr_zip BUILDSTDERR: found_modules = modules.parse_modules() BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/pysword/modules.py", line 83, in parse_modules BUILDSTDERR: zipped_module = zipfile.ZipFile(self._sword_path) BUILDSTDERR: File "/usr/lib64/python3.6/zipfile.py", line 1090, in __init__ BUILDSTDERR: self.fp = io.open(file, filemode) BUILDSTDERR: FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/resources/FinPR.zip' BUILDSTDERR: ====================================================================== BUILDSTDERR: ERROR: test_parse_modules_folder (tests.test_swordModules.TestSwordModules) BUILDSTDERR: ---------------------------------------------------------------------- BUILDSTDERR: Traceback (most recent call last): BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/test_swordModules.py", line 41, in test_parse_modules_folder BUILDSTDERR: mods_metadata = modules.parse_modules() BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/pysword/modules.py", line 89, in parse_modules BUILDSTDERR: for f in os.listdir(conf_folder): BUILDSTDERR: FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/resources/mods.d' BUILDSTDERR: ====================================================================== BUILDSTDERR: ERROR: test_parse_modules_zip (tests.test_swordModules.TestSwordModules) BUILDSTDERR: ---------------------------------------------------------------------- BUILDSTDERR: Traceback (most recent call last): BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/test_swordModules.py", line 60, in test_parse_modules_zip BUILDSTDERR: mods_metadata = modules.parse_modules() BUILDSTDERR: File "/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/pysword/modules.py", line 83, in parse_modules BUILDSTDERR: zipped_module = zipfile.ZipFile(self._sword_path) BUILDSTDERR: File "/usr/lib64/python3.6/zipfile.py", line 1090, in __init__ BUILDSTDERR: self.fp = io.open(file, filemode) BUILDSTDERR: FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/pysword-0.2.4-46d3425a888c0667e726f6e0c7e2031daef81251/tests/resources/FinPR.zip' BUILDSTDERR: ---------------------------------------------------------------------- BUILDSTDERR: Ran 33 tests in 0.034s BUILDSTDERR: FAILED (errors=5, skipped=2) It seems test data is missing from the archive. From the website main page it says: Run tests To run the testsuite, first run the script that download the files used for testing, and then use nosetests to run the testsuite: $ python3 tests/resources/download_bibles.py $ nosetests -v tests/ The tests should run and pass using both python 2 and 3. Since Internet is not available from Koji/Mock, you need to download them beforehand: python3 tests/resources/download_bibles.py tar the whole: tar --exclude='tests/resources/download_bibles.py' -zcvf testdata-0.2.4.tar.gz tests/resources/ and add the tarball as a Source: Source1: testdata-0.2.4.tar.gz Then you extract it in %prep: %prep %autosetup -n %{srcname}-%{version}-%{commit} %autosetup -N -T -D -a 1 -n %{srcname}-%{version}-%{commit} (explanation for the switches here: http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html) Voilà, tests can now run. Pre-review: Package Review ============== Legend: [x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated [ ] = Manual review needed ===== MUST items ===== Generic: [x]: Package is licensed with an open-source compatible license and meets other legal requirements as defined in the legal section of Packaging Guidelines. [x]: License field in the package spec file matches the actual license. Note: Checking patched sources after %prep for licenses. Licenses found: "GPL (v2)", "Unknown or generated", "*No copyright* GPL". 28 files have unknown license. Detailed output of licensecheck in /home/bob/packaging/review/python-pysword/review-python- pysword/licensecheck.txt [x]: Package does not own files or directories owned by other packages. Note: Dirs in package are owned also by: /usr/lib/python3.6/site- packages(python3-libs) [x]: Package contains no bundled libraries without FPC exception. [x]: Changelog in prescribed format. [x]: Sources contain only permissible code or content. [-]: Package contains desktop file if it is a GUI application. [-]: Development files must be in a -devel package [x]: Package uses nothing in %doc for runtime. [x]: Package consistently uses macros (instead of hard-coded directory names). [x]: Package is named according to the Package Naming Guidelines. [x]: Package does not generate any conflict. [x]: Package obeys FHS, except libexecdir and /usr/target. [-]: If the package is a rename of another package, proper Obsoletes and Provides are present. [x]: Requires correct, justified where necessary. [x]: Spec file is legible and written in American English. [-]: Package contains systemd file(s) if in need. [x]: Package is not known to require an ExcludeArch tag. [-]: Large documentation must go in a -doc subpackage. Large could be size (~1MB) or number of files. Note: Documentation size is 10240 bytes in 1 files. [x]: Package complies to the Packaging Guidelines [x]: Package successfully compiles and builds into binary rpms on at least one supported primary architecture. [x]: Package installs properly. [x]: Rpmlint is run on all rpms the build produces. Note: There are rpmlint messages (see attachment). [x]: If (and only if) the source package includes the text of the license(s) in its own file, then that file, containing the text of the license(s) for the package is included in %license. [x]: Package requires other packages for directories it uses. [x]: Package must own all directories that it creates. [x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT [x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the beginning of %install. [x]: Macros in Summary, %description expandable at SRPM build time. [x]: Dist tag is present. [x]: Package does not contain duplicates in %files. [x]: Permissions on files are set properly. [x]: Package use %makeinstall only when make install DESTDIR=... doesn't work. [x]: Package is named using only allowed ASCII characters. [x]: Package does not use a name that already exists. [x]: Package is not relocatable. [x]: Sources used to build the package match the upstream source, as provided in the spec URL. [x]: Spec file name must match the spec package %{name}, in the format %{name}.spec. [x]: File names are valid UTF-8. [x]: Packages must not store files under /srv, /opt or /usr/local Python: [x]: Python eggs must not download any dependencies during the build process. [x]: A package which is used by another package via an egg interface should provide egg info. [x]: Package meets the Packaging Guidelines::Python [x]: Package contains BR: python2-devel or python3-devel [x]: Binary eggs must be removed in %prep ===== SHOULD items ===== Generic: [-]: If the source package does not include license text(s) as a separate file from upstream, the packager SHOULD query upstream to include it. [x]: Final provides and requires are sane (see attachments). [?]: Package functions as described. [x]: Latest version is packaged. [x]: Package does not include license text files separate from upstream. [-]: Description and summary sections in the package spec file contains translations for supported Non-English languages, if available. [x]: Package should compile and build into binary rpms on all supported architectures. [x]: %check is present and all tests pass. [x]: Packages should try to preserve timestamps of original installed files. [x]: Reviewer should test that the package builds in mock. [x]: Buildroot is not present [x]: Package has no %clean section with rm -rf %{buildroot} (or $RPM_BUILD_ROOT) [x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin. [x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file [x]: Sources can be downloaded from URI in Source: tag [x]: SourceX is a working URL. [x]: Spec use %global instead of %define unless justified. ===== EXTRA items ===== Generic: [x]: Rpmlint is run on all installed packages. Note: There are rpmlint messages (see attachment). [x]: Spec file according to URL is the same as in SRPM. Rpmlint ------- Checking: python-pysword-0.2.4-1.fc29.noarch.rpm python-pysword-0.2.4-1.fc29.src.rpm python-pysword.noarch: W: spelling-error %description -l en_US ztext -> text, z text python-pysword.noarch: W: spelling-error %description -l en_US rawtext -> raw text, raw-text, extra python-pysword.src: W: spelling-error %description -l en_US ztext -> text, z text python-pysword.src: W: spelling-error %description -l en_US rawtext -> raw text, raw-text, extra python-pysword.src: E: specfile-error warning: bogus date in %changelog: Sun Mar 17 2018 Tim Bentley <Tim.Bentley> - 0.2.4-1 2 packages and 0 specfiles checked; 1 errors, 4 warnings.
https://trb143.fedorapeople.org/python-pysword-0.2.5-1.fc27.src.rpm https://trb143.fedorapeople.org/python-pysword.spec Tried to fix the issues identified above. Not sure the test file is correct.
You didn't fix this: - Build error: + cd pysword-0.2.5 BUILDSTDERR: /var/tmp/rpm-tmp.if9CI4: line 40: cd: pysword-0.2.5: No such file or directory Seems the directory in the archive is suffixed by the commit hash: %prep %autosetup -n %{srcname}-%{version}-%{commit}
https://trb143.fedorapeople.org/python-pysword-0.2.5-1.fc27.src.rpm https://trb143.fedorapeople.org/python-pysword.spec Rebuilt from scratch using fedpkg. Unable to find any reference to {commit} if this is still wrong what commands are you using to test so I can test my self.
When I download https://gitlab.com/tgc-dk/%{srcname}/repository/archive.tar.gz?ref=%{version}#/%{srcname}-%{version}.tar.gz, the root folder of the archive I get is named %{srcname}-%{version}-%{commit}, not %{srcname}-%{version}.
Ah got it now, I think https://trb143.fedorapeople.org/python-pysword-0.2.5-1.fc27.src.rpm https://trb143.fedorapeople.org/python-pysword.spec I build the tar from git clone, not the archive download which is why we had the missing commit.
You need to add commit to the second autosetup, otherwise it won't extract to the right directory: %autosetup -n %{srcname}-%{version}-%{commit} %autosetup -N -T -D -b 1 -n %{srcname}-%{version}-%{commit}
%autosetup -N -T -D -b 1 -n %{srcname}-%{version} This is correct as this tar.gz only contains the test files which Koji is unable to download. These are not version controlled. If this is the case I would need to modify the zip file each time I run as these files are not in the upstream git repository.
-n %{srcname}-%{version} indicates the directory to change to before -b 1 extract the second sources, thus it needs to be the same as the previous directory in order to be extracted in the correct directory. It doesn't have to do with the zip file structure.
https://trb143.fedorapeople.org/python-pysword-0.2.5-1.fc27.src.rpm https://trb143.fedorapeople.org/python-pysword.spec Next attempt.
Ok, package is approved.
(fedrepo-req-admin): The Pagure repository was created at https://src.fedoraproject.org/rpms/python-pysword