Changes between Version 3 and Version 4 of Ticket #18818, comment 2
- Timestamp:
- Aug 10, 2019 11:41:05 AM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #18818, comment 2
v3 v4 1 {{{ 2 I've looked into the RPM packaging background on 3 this issue a bit, for the record here are the 4 details discussed in the proposed change, 1 I've looked into the RPM packaging background on this issue for a bit, here are the details regarding the proposed change, 5 2 just in case we have to do it that way: 6 3 … … 8 5 9 6 http://ftp.rpm.org/max-rpm/s1-rpm-specref-files-list.html 7 10 8 http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list.html 9 11 10 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/rpm_packaging_guide/index#files 11 12 12 https://docs.fedoraproject.org/ro/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s05.html 13 13 14 https://wiki.mageia.org/en/Packagers_RPM_tutorial#Files_section 14 https://www.techrepublic.com/article/making-rpms-part-3-installing-files/15 15 16 <snip> 17 "The %files list indicates which files on the build 18 system are to be packaged. The list consists of 19 one file per line. If a directory is specified, 20 by default all files and subdirectories will be packaged." 16 https://www.techrepublic.com/article/making-rpms-part-3-installing-files 21 17 22 "%files The list of files that will be installed in their final resting place in the context of the target system." 18 From there: 23 19 24 " The %files section holds a list of all the files that RPM should install from the package. This list should be exhaustive, so that the RPM system knows exactly what your package installs. There are some options, though, to name all the files within a directory to help with packages containing hundreds of files. 20 "The %files list indicates which files on the build system are to be packaged. The list consists of one file per line. If a directory is specified, by default all files and subdirectories will be packaged." 21 22 "%files The list of files that will be installed in their final resting place in the context of the target system." 23 24 "The %files section holds a list of all the files that RPM should install from the package. This list should be exhaustive, so that the RPM system knows exactly what your package installs. There are some options, though, to name all the files within a directory to help with packages containing hundreds of files. 25 25 In the default case, each line under the %files section names a separate file with its full path" 26 <snip end>27 26 28 27 %install: 29 28 30 29 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/rpm_packaging_guide/index 31 https://www.techrepublic.com/article/making-rpms-part-3-installing-files/ 30 31 https://www.techrepublic.com/article/making-rpms-part-3-installing-files 32 32 33 https://unix.stackexchange.com/questions/180666/rpm-install-section 34 33 35 https://rpm-guide.readthedocs.io/en/latest/rpm-guide.html 36 34 37 https://wiki.mageia.org/en/Packagers_RPM_tutorial#Install_section 35 https://www.techrepublic.com/article/making-rpms-part-3-installing-files/36 38 37 <snip> 38 " %install 39 Command or series of commands for copying the desired build artifacts from the %builddir (where the build happens) to the %buildroot directory (which contains the directory structure with the files to be packaged). This usually means copying files from ~/rpmbuild/BUILD to ~/rpmbuild/BUILDROOT and creating the necessary directories in ~/rpmbuild/BUILDROOT. This is only run when creating a package, not when the end-user installs the package. See Section 5.1.7, “Working with SPEC files” for details." 39 https://www.techrepublic.com/article/making-rpms-part-3-installing-files 40 40 41 "%install Command or series of commands used to actually install the various artifacts into a resulting location in the FHS. Something to note is that this is done within the relative context of the %buildroot (more on that later)." 41 From there: 42 43 "%install Command or series of commands for copying the desired build artifacts from the %builddir (where the build happens) to the %buildroot directory (which contains the directory structure with the files to be packaged). This usually means copying files from ~/rpmbuild/BUILD to ~/rpmbuild/BUILDROOT and creating the necessary directories in ~/rpmbuild/BUILDROOT. This is only run when creating a package, not when the end-user installs the package. See Section 5.1.7, “Working with SPEC files” for details." 44 45 "%install Command or series of commands used to actually install the various artifacts into a resulting location in the FHS. Something to note is that this is done within the relative context of the %buildroot (more on that later)." 42 46 43 47 "in the %install section, you are supposed to install all your files in the %{buildroot] directory; just the way they will be installed on the final system." 44 48 45 49 "This section will contain the script responsible for actually installing the package in the simulated installation directory: %{buildroot}, or the equivalent $RPM_BUILD_ROOT. 46 It will contain all the commands necessary to make the software ready to run on the user's system. 47 " 48 <snip end> 50 It will contain all the commands necessary to make the software ready to run on the user's system." 49 51 50 The proposal: 51 52 <snip> 53 just add: 52 The proposal is to just add: 54 53 55 54 touch $RPM_BUILD_ROOT/var/log/vbox-setup.log 56 55 57 to the %install section of the spec file 58 <snip end> 56 to the %install section of the spec file. 59 57 60 So as the touch in the build area (which is when the 61 %install section is executed) is unlikely going to 62 have the proper set of permissions that we want to 63 have on the final install destination, we'd also need 64 to add an %attr or %defattr% directive to the %files 65 section to manage proper install permissions. 58 So the touch in the build area (which is when the %install section is executed) is unlikely going to have the proper set of owner and permissions that we want to have on the final install destination, thus we'd also need to add an %attr or %defattr% directive to the %files section to manage proper install permissions. 66 59 67 The %files section will pull into the binary RPM package 68 from the build directory. So the %files section would 69 need to make sure to use a permission directive for the 70 empty log %file using%attr and %defattr when deploying 71 the package on the destination: 60 As %files section will pull into the binary RPM package from the build directory. So the %files section would need to make sure to use a permission directive for the empty log %file using%attr and %defattr when deploying the package on the destination: 72 61 73 62 http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html#S3-RPM-INSIDE-FLIST-DEFATTR-DIRECTIVE … … 77 66 https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Reference_Guide/s1-filesystem-fhs.html 78 67 79 <snip> 80 3.2.1.14. The /var/ Directory 68 "3.2.1.14. The /var/ Directory 81 69 Since the FHS requires Linux to mount /usr/ as read-only, any programs that write log files or need spool/ or lock/ directories should write them to the /var/ directory. The FHS states /var/ is for: 82 83 ...variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files. 84 System log files, such as messages and lastlog, go in the /var/log/ directory. The /var/lib/rpm/ directory contains RPM system databases. Lock files go in the /var/lock/ directory, usually in directories for the program using the file. The /var/spool/ directory has subdirectories for programs in which data files are stored. 85 <snip end> 86 }}} 70 ...variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files. 71 System log files, such as messages and lastlog, go in the /var/log/ directory. The /var/lib/rpm/ directory contains RPM system databases. Lock files go in the /var/lock/ directory, usually in directories for the program using the file. The /var/spool/ directory has subdirectories for programs in which data files are stored."