packaging_rake_tasks 1.4.6 → 1.4.11

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: 8180c1847defd9c47b81a576fb6acb895854a07879a6526cb8cb5d10e230d2a7
4
- data.tar.gz: a09a7a77f6cb47b2c2c58d52ed6e820fc4c8b0cf25c32086efced624c3a6edeb
3
+ metadata.gz: d02ef0977f43dd5efd93ebe2b4ec40a61415ac8012413478a326917fcab8182e
4
+ data.tar.gz: d05332e52a13152900bf4300a920ce989212ff47c283b62b67b67dd9bc663337
5
5
  SHA512:
6
- metadata.gz: dc475a47e7c01fb8b51d8ce630aa954f44b8ad2b330f3442101cac71cd388c897d37f0ec18ab76938f681ca5dbe0e986863b48ae01bebca331b50306f14e51f6
7
- data.tar.gz: c547a1184272ac40847269b21d2f768b492c167c8e65818e51c19e5c93ac1dc039258479724ca18cec1366bc9e1dc9c9570ddb4d09319ea5618424a91d3fd44e
6
+ metadata.gz: e66cf2ab83c82d3f1e70af85a5ead91bb9eafcc81e8f08efa314e71a8c3f37346f6806bcd69f2de969f54b9e0b4d5d9d142c8d88450d1c221c0c0a0ebb89c01f
7
+ data.tar.gz: 160211ee2b33de61e5817c5162b5bbbfedb48999fd41be8d3d0117106e217dccd368eeacc993f6487ddbeae85955118fa71f705130cb85f9f2e80f4e85ac6cc7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.6
1
+ 1.4.11
@@ -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
@@ -44,7 +44,10 @@ ID_MATCHERS = [
44
44
  /bxo#(\d+)/,
45
45
  /obs#(\d+)/,
46
46
  /build#(\d+)/,
47
- /osc#(\d+)/
47
+ /osc#(\d+)/,
48
+ /jsc#([[:alpha:]]+\-\d+)/,
49
+ /lf#(\d+)/,
50
+ /(?:gh|github)#([a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}\/[\w.-]+#\d+)/i
48
51
  ]
49
52
 
50
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.6
4
+ version: 1.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Reidinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-16 00:00:00.000000000 Z
11
+ date: 2020-06-23 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
@@ -65,8 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
66
  - !ruby/object:Gem::Version
66
67
  version: '0'
67
68
  requirements: []
68
- rubyforge_project:
69
- rubygems_version: 2.7.3
69
+ rubygems_version: 3.1.2
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: Rake tasks providing tasks to package project in git and integration with