packaging_rake_tasks 1.4.7 → 1.4.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61dce2a4d63cf7d18fc08f8ad82bbff0e5216fca3c867deb41f80fddbd6c0fea
4
- data.tar.gz: 10ba682006cf40fea5a7aaf0806d557fc35e906fa57e04bdc61136ec20154749
3
+ metadata.gz: 21fc4c918f4cd24e55fe122412f6b066cb8fb66b1c84772e83d925af1e90f5b9
4
+ data.tar.gz: 122ea8f7be3eefe6fb7435f05fae84d2f7e1072293ed4fca0af08a08f44f46a3
5
5
  SHA512:
6
- metadata.gz: '007299d639cfc4f78b213df4a0ef67cb6aaf54a81878db61234a4f77943a51fbb3fc880117a451c723e1867de77c27a678641b546d9df9b90db58bad2faa795b'
7
- data.tar.gz: 4df18d98c34639c0bfcb0077e3af75ece264352258220a109e8a5f53f6b1fe9d544fbf3b8eff4155694f2a5df84550175cb2d58c7b4c614cbb1ead047bf1797a
6
+ metadata.gz: 407ca2694fdcf64bfd7be9e01f627d003ed5f7f56265f093407022cd3b7063d6fc75e6467fe304af08e5bda098958a4ab736962f4f3a69a38e154e5970a88482
7
+ data.tar.gz: 534d101ab268287dba9b3df19847e7130dd80d13250251baa8747238cc44539a3453c1bb469244be8c1583679c05698225986881b8cb97afe60be9ad33cf6116
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.7
1
+ 1.4.12
@@ -0,0 +1,110 @@
1
+ #--
2
+ # Rake helpers
3
+ #
4
+ # Copyright (C) 2019 SUSE Linux LLC
5
+ # This library is free software; you can redistribute it and/or modify
6
+ # it only under the terms of version 2.1 of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful, but WITHOUT
10
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12
+ # details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ #++
18
+
19
+ module Packaging
20
+ #
21
+ # Helpers around various git commands
22
+ module GitHelpers
23
+ # Create a git tag based on the version and the current branch.
24
+ #
25
+ # The optional block can specify the version number to use. If no block
26
+ # is given, this uses spec_version, i.e. the version number of the first
27
+ # .spec file in the package/ subdirectory.
28
+ #
29
+ # @return [Boolean] true if the tag was created, false if it already existed
30
+ #
31
+ def create_version_tag(&block)
32
+ name = tag_name(&block)
33
+ if tag_exists?(name)
34
+ puts "Tag #{name} already exists"
35
+ false
36
+ else
37
+ puts "Creating tag #{name}"
38
+ git("tag #{name}")
39
+ true
40
+ end
41
+ end
42
+
43
+ # Check if a tag exists.
44
+ #
45
+ # @return Boolean
46
+ #
47
+ def tag_exists?(name = nil)
48
+ name ||= tag_name
49
+ git("tag").include?(name)
50
+ end
51
+
52
+ # Read the package version from specfile_name. If specfile_name is 'nil',
53
+ # use the first .spec file in the packages/ subdirectory.
54
+ #
55
+ # @return String
56
+ #
57
+ def spec_version(specfile_name = nil)
58
+ specfile_name ||= Dir.glob("#{Packaging::Configuration.instance.package_dir}/*.spec").first
59
+ # use the first *.spec file found, assume all spec files
60
+ # contain the same version
61
+ File.readlines(specfile_name)
62
+ .grep(/^\s*Version:\s*/).first.sub("Version:", "").strip
63
+ end
64
+
65
+ # Return the name of the current git branch or "detached" if in "head
66
+ # detached" state.
67
+ #
68
+ # @return String
69
+ #
70
+ def branch_name
71
+ branch = git("branch").grep(/^\* /).first.sub(/^\* /, "")
72
+ return "detached" if branch =~ /HEAD detached/
73
+ branch
74
+ end
75
+
76
+ # Check if the current branch is "master".
77
+ #
78
+ # @return [Boolean]
79
+ #
80
+ def master?
81
+ branch_name == "master"
82
+ end
83
+
84
+ # Return a suitable tag name based on version and branch.
85
+ # For "master", this is only the version number.
86
+ # For branches, this is "branchname-version".
87
+ # If in "detached head" state, this is "detached-version".
88
+ #
89
+ # Like in create_version_tag, the optional block can specify the version
90
+ # number to use. If no block is given, this uses spec_version, i.e. the
91
+ # version number of the first .spec file in the package/ subdirectory.
92
+ #
93
+ # @return String
94
+ #
95
+ def tag_name(&block)
96
+ branch = branch_name
97
+ version = block_given? ? block.call : spec_version
98
+ return version if branch == "master"
99
+ branch + "-" + version
100
+ end
101
+
102
+ # Call a git subcommand and return its output as an array of strings.
103
+ #
104
+ # @return Array<String>
105
+ #
106
+ def git(subcmd)
107
+ `/usr/bin/git #{subcmd}`.split("\n")
108
+ end
109
+ end
110
+ end
@@ -54,7 +54,8 @@ namespace :build_dependencies do
54
54
  if escaped_list.empty?
55
55
  puts "Nothing to install, *.spec file not found or no build dependencies defined"
56
56
  else
57
- cmd = "sudo zypper install #{escaped_list}"
57
+ sudo = Process.euid.zero? ? "" : "sudo"
58
+ cmd = "#{sudo} zypper install #{escaped_list}"
58
59
  sh(cmd)
59
60
  end
60
61
  end
@@ -46,6 +46,8 @@ ID_MATCHERS = [
46
46
  /build#(\d+)/,
47
47
  /osc#(\d+)/,
48
48
  /jsc#([[:alpha:]]+\-\d+)/,
49
+ /lf#(\d+)/,
50
+ /(?:gh|github)#([a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}\/[\w.-]+#\d+)/i
49
51
  ]
50
52
 
51
53
  namespace "check" do
@@ -113,9 +113,9 @@ def license_report
113
113
  if ! report[:missing].empty?
114
114
  raise "\nMissing license:\n#{report[:missing].join("\n")}"
115
115
  end
116
- puts "\nSkipped files:\n#{report[:skipped].join("\n")}" if verbose
117
- puts "\nCopyright found in these files:\n#{report[:seen].join("\n")}" if verbose
118
- puts "\nCopyright detected as not needed in these files:\n#{report[:unneeded].join("\n")}" if verbose
116
+ puts "\nSkipped files:\n#{report[:skipped].join("\n")}" if verbose == true
117
+ puts "\nCopyright found in these files:\n#{report[:seen].join("\n")}" if verbose == true
118
+ puts "\nCopyright detected as not needed in these files:\n#{report[:unneeded].join("\n")}" if verbose == true
119
119
  puts "\nAll files have proper license reference." if verbose
120
120
  end
121
121
 
@@ -52,7 +52,8 @@ namespace :osc do
52
52
  end
53
53
 
54
54
  def checkout
55
- sh "osc -A '#{obs_api}' --traceback --verbose checkout '#{obs_project}' #{package_name}"
55
+ osc_verbose = (verbose == true) ? "--verbose" : ""
56
+ sh "osc -A '#{obs_api}' --traceback #{osc_verbose} checkout '#{obs_project}' #{package_name}"
56
57
  end
57
58
 
58
59
  def osc_checkout_dir
@@ -36,8 +36,10 @@ def remove_old_packages
36
36
  # remove the old tarball - all versions
37
37
  config = Packaging::Configuration.instance
38
38
  package_glob = File.join(Dir.pwd,config.package_dir,"#{config.package_name}-*.tar.bz2")
39
- Dir[package_glob].each do |d|
40
- rm d
39
+ verbose(verbose == true) do
40
+ Dir[package_glob].each do |d|
41
+ rm d
42
+ end
41
43
  end
42
44
  end
43
45
 
@@ -88,10 +90,17 @@ task :tarball do
88
90
  config = Packaging::Configuration.instance
89
91
  target = File.join(config.package_dir, package_file_name)
90
92
  begin
91
- Rake::Task[target].invoke
92
- build_tarball
93
+ puts "* Making tarball #{package_file_path} ..." if verbose
94
+ # collapse the middle state to false to silence FileUtils
95
+ verbose(verbose == true) do
96
+ Rake::Task[target].invoke
97
+ build_tarball
98
+ end
99
+ puts "* ...Done" if verbose
93
100
  ensure
94
- rm_rf target
101
+ verbose(verbose == true) do
102
+ rm_rf target
103
+ end
95
104
  end
96
105
  end
97
106
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packaging_rake_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Reidinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-10 00:00:00.000000000 Z
11
+ date: 2020-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -35,6 +35,7 @@ files:
35
35
  - VERSION
36
36
  - lib/packaging.rb
37
37
  - lib/packaging/configuration.rb
38
+ - lib/packaging/git_helpers.rb
38
39
  - lib/packaging/tasks.rb
39
40
  - lib/tasks/build_dependencies.rake
40
41
  - lib/tasks/check_changelog.rake
@@ -66,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
67
  version: '0'
67
68
  requirements: []
68
69
  rubyforge_project:
69
- rubygems_version: 2.7.3
70
+ rubygems_version: 2.7.6.2
70
71
  signing_key:
71
72
  specification_version: 4
72
73
  summary: Rake tasks providing tasks to package project in git and integration with