Check-in [adc3cb9bcc]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge pull request #772 from djhaskin987/feature/661 Feature/661 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
adc3cb9bccb2f655820492d3a247795a |
User & Date: | jls@semicomplete.com 2014-10-16 18:47:06 |
Context
2014-10-16
| ||
18:48 | Merge pull request #787 from djhaskin987/feature/786 Check first for Build.PL, then for Makefile.PL check-in: 9aaf818223 user: jls@semicomplete.com tags: trunk | |
18:47 | Merge pull request #772 from djhaskin987/feature/661 Feature/661 check-in: adc3cb9bcc user: jls@semicomplete.com tags: trunk | |
2014-10-15
| ||
18:29 | Add --log=xxx support Supported log levels: error, warn, info, debug. --verbose is the same as --log=info --debug is the same as --log=debug --log=warn is the default Requested by mattgreenrocks on irc. check-in: e40c10b115 user: jls@semicomplete.com tags: trunk | |
2014-09-19
| ||
13:23 | Merge into scriptmap in the name of elegance check-in: 7c35c9bf18 user: djhaskin987@gmail.com tags: trunk | |
Changes
Changes to CONTRIBUTORS.
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 | Luke Macken (github: lmacken) Matt Blair (github: mblair) Thomas Meson (github: zllak) Oliver Hookins (github: ohookins) llasram sbuss Brett Gailey (github: dnbert) If you have contributed (bug reports, feature requests, help in IRC, blog posts, code, etc) and aren't listed here, please let me know if you wish to be added! | > | 15 16 17 18 19 20 21 22 23 24 25 26 | Luke Macken (github: lmacken) Matt Blair (github: mblair) Thomas Meson (github: zllak) Oliver Hookins (github: ohookins) llasram sbuss Brett Gailey (github: dnbert) Daniel Haskin (github: djhaskin987) If you have contributed (bug reports, feature requests, help in IRC, blog posts, code, etc) and aren't listed here, please let me know if you wish to be added! |
Changes to lib/fpm/command.rb.
︙ | ︙ | |||
95 96 97 98 99 100 101 | option "--no-depends", :flag, "Do not list any dependencies in this package", :default => false option "--no-auto-depends", :flag, "Do not list any dependencies in this" \ "package automatically", :default => false option "--provides", "PROVIDES", | | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | option "--no-depends", :flag, "Do not list any dependencies in this package", :default => false option "--no-auto-depends", :flag, "Do not list any dependencies in this" \ "package automatically", :default => false option "--provides", "PROVIDES", "What this package provides (usually a name). This flag can be " \ "specified multiple times.", :multivalued => true, :attribute_name => :provides option "--conflicts", "CONFLICTS", "Other packages/versions this package conflicts with. This flag can " \ "specified multiple times.", :multivalued => true, :attribute_name => :conflicts option "--replaces", "REPLACES", "Other packages/versions this package replaces. This flag can be " \ "specified multiple times.", :multivalued => true, :attribute_name => :replaces option "--config-files", "CONFIG_FILES", "Mark a file in the package as being a config file. This uses 'conffiles'" \ " in debs and %config in rpm. If you have multiple files to mark as " \ "configuration files, specify this flag multiple times. If argument is " \ |
︙ | ︙ | |||
148 149 150 151 152 153 154 | option "--url", "URI", "Add a url for this package.", :default => "http://example.com/no-uri-given" option "--inputs", "INPUTS_PATH", "The path to a file containing a newline-separated list of " \ "files and dirs to use as input." option "--post-install", "FILE", | | | | | | | | | | > > > > > > > > > > > > > > > > > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | option "--url", "URI", "Add a url for this package.", :default => "http://example.com/no-uri-given" option "--inputs", "INPUTS_PATH", "The path to a file containing a newline-separated list of " \ "files and dirs to use as input." option "--post-install", "FILE", "(DEPRECATED, use --after-install) A script to be run after " \ "package installation" do |val| @after_install = File.expand_path(val) # Get the full path to the script end # --post-install (DEPRECATED) option "--pre-install", "FILE", "(DEPRECATED, use --before-install) A script to be run before " \ "package installation" do |val| @before_install = File.expand_path(val) # Get the full path to the script end # --pre-install (DEPRECATED) option "--post-uninstall", "FILE", "(DEPRECATED, use --after-remove) A script to be run after " \ "package removal" do |val| @after_remove = File.expand_path(val) # Get the full path to the script end # --post-uninstall (DEPRECATED) option "--pre-uninstall", "FILE", "(DEPRECATED, use --before-remove) A script to be run before " \ "package removal" do |val| @before_remove = File.expand_path(val) # Get the full path to the script end # --pre-uninstall (DEPRECATED) option "--after-install", "FILE", "A script to be run after package installation" do |val| File.expand_path(val) # Get the full path to the script end # --after-install option "--before-install", "FILE", "A script to be run before package installation" do |val| File.expand_path(val) # Get the full path to the script end # --before-install option "--after-remove", "FILE", "A script to be run after package removal" do |val| File.expand_path(val) # Get the full path to the script end # --after-remove option "--before-remove", "FILE", "A script to be run before package removal" do |val| File.expand_path(val) # Get the full path to the script end # --before-remove option "--after-upgrade", "FILE", "A script to be run after package upgrade. If not specified,\n" \ "--before-install, --after-install, --before-remove, and \n" \ "--after-remove wil behave in a backwards-compatible manner\n" \ "(they will not be upgrade-case aware).\n" \ "Currently only supports deb and rpm packages." do |val| File.expand_path(val) # Get the full path to the script end # --after-upgrade option "--before-upgrade", "FILE", "A script to be run before package upgrade. If not specified,\n" \ "--before-install, --after-install, --before-remove, and \n" \ "--after-remove wil behave in a backwards-compatible manner\n" \ "(they will not be upgrade-case aware).\n" \ "Currently only supports deb and rpm packages." do |val| File.expand_path(val) # Get the full path to the script end # --before-upgrade option "--template-scripts", :flag, "Allow scripts to be templated. This lets you use ERB to template your " \ "packaging scripts (for --after-install, etc). For example, you can do " \ "things like <%= name %> to get the package name. For more information, " \ "see the fpm wiki: " \ "https://github.com/jordansissel/fpm/wiki/Script-Templates" |
︙ | ︙ | |||
390 391 392 393 394 395 396 397 398 399 400 401 402 403 | input.scripts[scriptname] = File.read(path) end setscript.call(:before_install) setscript.call(:after_install) setscript.call(:before_remove) setscript.call(:after_remove) # Bail if any setscript calls had errors. We don't need to log # anything because we've already logged the error(s) above. return 1 if script_errors.any? # Validate the package if input.name.nil? or input.name.empty? | > > | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | input.scripts[scriptname] = File.read(path) end setscript.call(:before_install) setscript.call(:after_install) setscript.call(:before_remove) setscript.call(:after_remove) setscript.call(:before_upgrade) setscript.call(:after_upgrade) # Bail if any setscript calls had errors. We don't need to log # anything because we've already logged the error(s) above. return 1 if script_errors.any? # Validate the package if input.name.nil? or input.name.empty? |
︙ | ︙ |
Changes to lib/fpm/package/deb.rb.
︙ | ︙ | |||
326 327 328 329 330 331 332 | # Abort if the target path already exists. # create 'debian-binary' file, required to make a valid debian package File.write(build_path("debian-binary"), "2.0\n") # If we are given --deb-shlibs but no --after-install script, we # should implicitly create a before/after scripts that run ldconfig | | > > > > > > > > > > > > > > > | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | # Abort if the target path already exists. # create 'debian-binary' file, required to make a valid debian package File.write(build_path("debian-binary"), "2.0\n") # If we are given --deb-shlibs but no --after-install script, we # should implicitly create a before/after scripts that run ldconfig if attributes[:deb_shlibs] if !script?(:after_install) @logger.info("You gave --deb-shlibs but no --after-install, so " \ "I am adding an after-install script that runs " \ "ldconfig to update the system library cache") scripts[:after_install] = template("deb/ldconfig.sh.erb").result(binding) end if !script?(:after_remove) @logger.info("You gave --deb-shlibs but no --after-remove, so " \ "I am adding an after-remove script that runs " \ "ldconfig to update the system library cache") scripts[:after_remove] = template("deb/ldconfig.sh.erb").result(binding) end end if script?(:before_upgrade) or script?(:after_upgrade) if script?(:before_install) or script?(:before_upgrade) scripts[:before_install] = template("deb/preinst_upgrade.sh.erb").result(binding) end if script?(:before_remove) scripts[:before_remove] = template("deb/prerm_upgrade.sh.erb").result(binding) end if script?(:after_install) or script?(:after_upgrade) scripts[:after_install] = template("deb/postinst_upgrade.sh.erb").result(binding) end if script?(:after_remove) scripts[:after_remove] = template("deb/postrm_upgrade.sh.erb").result(binding) end end write_control_tarball # Tar up the staging_path into data.tar.{compression type} case self.attributes[:deb_compression] when "gz", nil datatar = build_path("data.tar.gz") |
︙ | ︙ |
Added templates/deb/postinst_upgrade.sh.erb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | after_upgrade() { <% if script?(:after_upgrade) -%> <%= script(:after_upgrade) %> <% end -%> } after_install() { <% if script?(:after_install) -%> <%= script(:after_install) %> <% end -%> } if [ "${1}" = "configure " -a -z "${2}" ] then # "after install" here after_install elif [ "${1}" = "configure" -a -n "${2}" ] then upgradeFromVersion="${2}" # "after upgrade" here # NOTE: This slot is also used when deb packages are removed, # but their config files aren't, but a newer version of the # package is installed later, called "Config-Files" state. # basically, that still looks a _lot_ like an upgrade to me. after_upgrade "${2}" elif echo "${1}" | grep -E -q "(abort|fail)" then echo "Failed to install before the post-installation script was run." >&2 exit 1 fi |
Added templates/deb/postrm_upgrade.sh.erb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | after_remove() { <% if script?(:after_remove) -%> <%= script(:after_remove) %> <% end -%> } dummy() { } if [ "${1}" = "remove" ] then # "after remove" goes here after_remove elif [ "${1}" = "purge" -a -z "${2}" ] then # like "on remove", but executes after dpkg deletes config files # 'apt-get purge' runs 'on remove' section, then this section. # Maybe we ignore this; it seems really fine-grained. # There is no equivalent in RPM or ARCH. A debian-specific argument # might perhaps be used here, but most people # probably don't need it. dummy elif [ "${1}" = "upgrade" ] then # This represents the case where the old package's postrm is called after # the 'preinst' script is called. # We should ignore this and just use 'preinst upgrade' and # 'postinst configure'. The newly installed package should do the # upgrade, not the uninstalled one, since it can't anticipate what new # things it will have to do to upgrade for the new version. dummy elif echo "${1}" | grep -E -q '(fail|abort)' then echo "Failed to install before the post-removal script was run." >&2 exit 1 fi |
Added templates/deb/preinst_upgrade.sh.erb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | before_upgrade() { <% if script?(:before_upgrade) -%> <%= script(:before_upgrade) %> <% end -%> } before_install() { <% if script?(:before_install) -%> <%= script(:before_install) %> <% end -%> } if [ "${1}" = "install" -a -z "${2}" ] then before_install elif [ "${1}" = "upgrade" -a -n "${2}" ] then upgradeFromVersion="${2}" before_upgrade "${2}" elif [ "${1}" = "install" -a -n "${2}" ] then upgradeFromVersion="${2}" # Executed when a package is removed but its config files aren't, # and a new version is installed. # Looks a _lot_ like an upgrade case, I say we just execute the # same "before upgrade" script as in the previous case before_upgrade "${2}" elif echo "${1}" | grep -E -q '(fail|abort)' then echo "Failed to install before the pre-installation script was run." >&2 exit 1 fi |
Added templates/deb/prerm_upgrade.sh.erb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | before_remove() { <% if script?(:before_remove) -%> <%= script(:before_remove) %> <% end -%> } dummy() { } if [ "${1}" = "remove" -a -z "${2}" ] then # "before remove" goes here before_remove elif [ "${1}" = "upgrade" ] then upgradeVersionTo="${2}" # Executed before the old version is removed # upon upgrade. # We should generally not do anything here. The newly installed package # should do the upgrade, not the uninstalled one, since it can't anticipate # what new things it will have to do to upgrade for the new version. dummy "${2}" elif echo "${1}" | grep -E -q "(fail|abort)" then echo "Failed to install before the pre-removal script was run." >&2 exit 1 fi |
Changes to templates/rpm.erb.
︙ | ︙ | |||
105 106 107 108 109 110 111 | %install # noop %clean # noop <%# This next section puts any %pre, %post, %preun, %postun, %verifyscript, %pretrans or %posttrans scripts %> | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < | | > > | | < | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | %install # noop %clean # noop <%# This next section puts any %pre, %post, %preun, %postun, %verifyscript, %pretrans or %posttrans scripts %> <% scriptmap = { :rpm_verifyscript => "verifyscript", :rpm_posttrans => "posttrans", :rpm_pretrans => "pretrans" } -%> <% if script?(:before_upgrade) or script?(:after_upgrade) -%> <% if script?(:before_upgrade) or script?(:before_install) -%> %pre upgrade() { <% if script?(:before_upgrade) -%> <%= script(:before_upgrade) %> <% end -%> } install() { <% if script?(:before_install) -%> <%= script(:before_install) %> <% end -%> } if [ "${1}" -eq 1 ] then install # "before install" goes here elif [ "${1}" -gt 1 ] then upgrade fi <% end -%> <% if script?(:after_upgrade) or script?(:after_install) -%> %pre upgrade() { <% if script?(:after_upgrade) -%> <%= script(:after_upgrade) %> <% end -%> } install() { <% if script?(:after_install) -%> <%= script(:after_install) %> <% end -%> } if [ "${1}" -eq 1 ] then install # "before install" goes here elif [ "${1}" -gt 1 ] then upgrade fi <% end -%> <% if script?(:before_remove) -%> %preun if [ "${1}" -eq 0 ] then <%= script(:before_remove) %> fi <% end -%> <% if script?(:after_remove) -%> %postun if [ "${1}" -eq 0 ] then <%= script(:after_remove) %> fi <% end -%> <% else -%> <% other_scriptmap = { :before_install => "pre", :after_install => "post", :before_remove => "preun", :after_remove => "postun", } scriptmap.merge!(other_scriptmap) -%> <% end -%> <% scriptmap.each do |name, rpmname| <% if script?(name) -%> %<%= rpmname %> <%= script(name) %> <% end -%> <% end -%> %files %defattr(<%= attributes[:rpm_defattrfile] %>,<%= attributes[:rpm_user] || "root" %>,<%= attributes[:rpm_group] || "root" %>,<%= attributes[:rpm_defattrdir] %>) <%# Output config files and then regular files. -%> <% config_files.each do |path| -%> |
︙ | ︙ |