simp-rake-helpers 5.3.0 → 5.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -2
  3. data/.travis.yml +54 -37
  4. data/CHANGELOG.md +40 -2
  5. data/Gemfile +1 -0
  6. data/README.md +70 -82
  7. data/lib/simp/rake/build/auto.rb +6 -0
  8. data/lib/simp/rake/build/pkg.rb +2 -2
  9. data/lib/simp/rake/build/rpmdeps.rb +6 -3
  10. data/lib/simp/rake/helpers/assets/rpm_spec/simpdefault.spec +284 -71
  11. data/lib/simp/rake/helpers/version.rb +1 -1
  12. data/lib/simp/rake/pkg.rb +38 -18
  13. data/lib/simp/rake/rubygem.rb +1 -1
  14. data/lib/simp/rpm.rb +49 -6
  15. data/spec/acceptance/00_pkg_rpm_custom_scriptlets_spec.rb +117 -0
  16. data/spec/acceptance/10_pkg_rpm_spec.rb +153 -0
  17. data/spec/acceptance/20_pkg_rpm_safely_upgrading_obsolete_modules_spec.rb +175 -0
  18. data/spec/acceptance/development/docker_env.sh +29 -0
  19. data/spec/acceptance/development/rerun_acceptance_tests.sh +15 -0
  20. data/spec/acceptance/development/vagrant_rsync.sh +23 -0
  21. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/CHANGELOG +2 -0
  22. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/Rakefile +3 -0
  23. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/custom/overrides +14 -0
  24. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/build/rpm_metadata/requires +1 -0
  25. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-2.1/metadata.json +33 -0
  26. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/CHANGELOG +2 -0
  27. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/Rakefile +3 -0
  28. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/custom/overrides +14 -0
  29. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/build/rpm_metadata/requires +1 -0
  30. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-new-package-3.0/metadata.json +33 -0
  31. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/CHANGELOG +2 -0
  32. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/Rakefile +3 -0
  33. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/build/rpm_metadata/requires +1 -0
  34. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-1.0/metadata.json +33 -0
  35. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/CHANGELOG +2 -0
  36. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/Rakefile +3 -0
  37. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/build/rpm_metadata/requires +1 -0
  38. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.0/metadata.json +33 -0
  39. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/CHANGELOG +2 -0
  40. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/Rakefile +3 -0
  41. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/custom/overrides +14 -0
  42. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/build/rpm_metadata/requires +1 -0
  43. data/spec/acceptance/files/custom_scriptlet_triggers/pupmod-old-package-2.2/metadata.json +33 -0
  44. data/spec/acceptance/files/mock_packages/pupmod-puppetlabs-stdlib.spec +32 -0
  45. data/spec/acceptance/files/mock_packages/pupmod-simp-foo.spec +32 -0
  46. data/spec/acceptance/files/mock_packages/pupmod-simp-simplib.spec +32 -0
  47. data/spec/acceptance/files/mock_packages/rpmbuild.sh +25 -0
  48. data/spec/acceptance/files/mock_packages/simp-adapter/etc/simp/adapter_config.yaml +3 -0
  49. data/spec/acceptance/files/mock_packages/simp-adapter/usr/local/sbin/simp_rpm_helper +406 -0
  50. data/spec/acceptance/files/mock_packages/simp-adapter.spec +43 -0
  51. data/spec/acceptance/files/testpackage_custom_scriptlet/CHANGELOG +2 -0
  52. data/spec/acceptance/files/testpackage_custom_scriptlet/Rakefile +3 -0
  53. data/spec/acceptance/files/testpackage_custom_scriptlet/build/rpm_metadata/custom/overrides +18 -0
  54. data/spec/acceptance/files/testpackage_custom_scriptlet/build/rpm_metadata/requires +1 -0
  55. data/spec/acceptance/files/testpackage_custom_scriptlet/metadata.json +33 -0
  56. data/spec/acceptance/nodesets/default.yml +2 -4
  57. data/spec/acceptance/support/pkg_rpm_helpers.rb +81 -0
  58. data/spec/lib/simp/rake/build/files/unmanaged_mod/build/rpm_metadata/requires +2 -1
  59. data/spec/lib/simp/rake/build/rpmdeps_spec.rb +2 -1
  60. data/spec/spec_helper_acceptance.rb +20 -1
  61. metadata +44 -17
  62. data/spec/acceptance/pkg_rpm_spec.rb +0 -164
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "new-package",
3
+ "version": "2.1.0",
4
+ "author": "simp",
5
+ "summary": "A SIMP test module for upgrading obsoleted packages",
6
+ "license": "Apache-2.0",
7
+ "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
+ "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
+ "issues_url": "https://simp/project.atlassian.net",
10
+ "tags": [ "simp", "test", "package"],
11
+ "dependencies": [
12
+ {
13
+ "name": "simp/simplib",
14
+ "version_requirement": ">= 1.1.0"
15
+ }
16
+ ],
17
+ "operatingsystem_support": [
18
+ {
19
+ "operatingsystem": "CentOS",
20
+ "operatingsystemrelease": [
21
+ "6",
22
+ "7"
23
+ ]
24
+ },
25
+ {
26
+ "operatingsystem": "RedHat",
27
+ "operatingsystemrelease": [
28
+ "6",
29
+ "7"
30
+ ]
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,2 @@
1
+ * Sat Dec 13 2014 Richard Stallman <rms@gnu.org> - 0.0.1-0
2
+ - Behold, there was a brave GNU world....
@@ -0,0 +1,3 @@
1
+ require 'simp/rake/pkg'
2
+
3
+ Simp::Rake::Pkg.new( File.dirname( __FILE__ ) )
@@ -0,0 +1,14 @@
1
+ %triggerpostun -- pupmod-old-package
2
+
3
+ echo
4
+ echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
5
+ echo "@@@@@@ Executing SIMP-3895 workaround @@@@@@"
6
+ echo "@@@@@@ @@@@@@"
7
+ echo "@@@@@@ upgrading from obsoleted pkg @@@@@@"
8
+ echo "@@@@@@ 'pupmod-old-package' @@@@@@"
9
+ echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
10
+ echo
11
+ echo "pupmod-new-package: post 1=2 (triggered by: %triggerpostun -- pupmod-old-package)"
12
+
13
+ # re-send the 'post' message
14
+ /usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/package --rpm_section='post' --rpm_status=2
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "new-package",
3
+ "version": "3.0.0",
4
+ "author": "simp",
5
+ "summary": "A SIMP test module for upgrading obsoleted packages",
6
+ "license": "Apache-2.0",
7
+ "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
+ "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
+ "issues_url": "https://simp/project.atlassian.net",
10
+ "tags": [ "simp", "test", "package"],
11
+ "dependencies": [
12
+ {
13
+ "name": "simp/simplib",
14
+ "version_requirement": ">= 1.1.0"
15
+ }
16
+ ],
17
+ "operatingsystem_support": [
18
+ {
19
+ "operatingsystem": "CentOS",
20
+ "operatingsystemrelease": [
21
+ "6",
22
+ "7"
23
+ ]
24
+ },
25
+ {
26
+ "operatingsystem": "RedHat",
27
+ "operatingsystemrelease": [
28
+ "6",
29
+ "7"
30
+ ]
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,2 @@
1
+ * Sat Dec 13 2014 Richard Stallman <rms@gnu.org> - 0.0.1-0
2
+ - Behold, there was a brave GNU world....
@@ -0,0 +1,3 @@
1
+ require 'simp/rake/pkg'
2
+
3
+ Simp::Rake::Pkg.new( File.dirname( __FILE__ ) )
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "old-package",
3
+ "version": "1.0.0",
4
+ "author": "simp",
5
+ "summary": "A SIMP test module for upgrading obsoleted packages",
6
+ "license": "Apache-2.0",
7
+ "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
+ "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
+ "issues_url": "https://simp/project.atlassian.net",
10
+ "tags": [ "simp", "test", "package"],
11
+ "dependencies": [
12
+ {
13
+ "name": "simp/simplib",
14
+ "version_requirement": ">= 1.1.0"
15
+ }
16
+ ],
17
+ "operatingsystem_support": [
18
+ {
19
+ "operatingsystem": "CentOS",
20
+ "operatingsystemrelease": [
21
+ "6",
22
+ "7"
23
+ ]
24
+ },
25
+ {
26
+ "operatingsystem": "RedHat",
27
+ "operatingsystemrelease": [
28
+ "6",
29
+ "7"
30
+ ]
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,2 @@
1
+ * Sat Dec 13 2014 Richard Stallman <rms@gnu.org> - 0.0.1-0
2
+ - Behold, there was a brave GNU world....
@@ -0,0 +1,3 @@
1
+ require 'simp/rake/pkg'
2
+
3
+ Simp::Rake::Pkg.new( File.dirname( __FILE__ ) )
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "old-package",
3
+ "version": "2.0.0",
4
+ "author": "simp",
5
+ "summary": "A SIMP test module for upgrading obsoleted packages",
6
+ "license": "Apache-2.0",
7
+ "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
+ "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
+ "issues_url": "https://simp/project.atlassian.net",
10
+ "tags": [ "simp", "test", "package"],
11
+ "dependencies": [
12
+ {
13
+ "name": "simp/simplib",
14
+ "version_requirement": ">= 1.1.0"
15
+ }
16
+ ],
17
+ "operatingsystem_support": [
18
+ {
19
+ "operatingsystem": "CentOS",
20
+ "operatingsystemrelease": [
21
+ "6",
22
+ "7"
23
+ ]
24
+ },
25
+ {
26
+ "operatingsystem": "RedHat",
27
+ "operatingsystemrelease": [
28
+ "6",
29
+ "7"
30
+ ]
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,2 @@
1
+ * Sat Dec 13 2014 Richard Stallman <rms@gnu.org> - 0.0.1-0
2
+ - Behold, there was a brave GNU world....
@@ -0,0 +1,3 @@
1
+ require 'simp/rake/pkg'
2
+
3
+ Simp::Rake::Pkg.new( File.dirname( __FILE__ ) )
@@ -0,0 +1,14 @@
1
+ %triggerpostun -- pupmod-new-package
2
+
3
+ echo
4
+ echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
5
+ echo "@@@@@@ Executing SIMP-3895 workaround @@@@@@"
6
+ echo "@@@@@@ @@@@@@"
7
+ echo "@@@@@@ upgrading from obsoleted pkg @@@@@@"
8
+ echo "@@@@@@ 'pupmod-new-package' @@@@@@"
9
+ echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
10
+ echo
11
+ echo "pupmod-old-package: post 1=2 (triggered by: %triggerpostun -- pupmod-new-package)"
12
+
13
+ # re-send the 'post' message
14
+ /usr/local/sbin/simp_rpm_helper --rpm_dir=/usr/share/simp/modules/package --rpm_section='post' --rpm_status=2
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "old-package",
3
+ "version": "2.2.0",
4
+ "author": "simp",
5
+ "summary": "A SIMP test module for upgrading obsoleted packages",
6
+ "license": "Apache-2.0",
7
+ "source": "https://github.com/simp/rubygem-simp-rake-helpers",
8
+ "project_page": "https://github.com/simp/rubygem-simp-rake-helpers",
9
+ "issues_url": "https://simp/project.atlassian.net",
10
+ "tags": [ "simp", "test", "package"],
11
+ "dependencies": [
12
+ {
13
+ "name": "simp/simplib",
14
+ "version_requirement": ">= 1.1.0"
15
+ }
16
+ ],
17
+ "operatingsystem_support": [
18
+ {
19
+ "operatingsystem": "CentOS",
20
+ "operatingsystemrelease": [
21
+ "6",
22
+ "7"
23
+ ]
24
+ },
25
+ {
26
+ "operatingsystem": "RedHat",
27
+ "operatingsystemrelease": [
28
+ "6",
29
+ "7"
30
+ ]
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,32 @@
1
+ Name: pupmod-puppetlabs-stdlib
2
+ Version: 5.9.9
3
+ Release: 9
4
+ Summary: mock simplib test package
5
+ BuildArch: noarch
6
+
7
+ License: Apache-2.0
8
+ URL: http://foo.bar
9
+
10
+ %description
11
+ A mock RPM package used for acceptance tests
12
+
13
+ %prep
14
+ exit 0
15
+
16
+ %build
17
+ exit 0
18
+
19
+
20
+ %install
21
+ exit 0
22
+
23
+ %clean
24
+ exit 0
25
+
26
+ %files
27
+ %doc
28
+
29
+
30
+ %changelog
31
+ * Fri Feb 23 2018 nobody
32
+ - some comment
@@ -0,0 +1,32 @@
1
+ Name: pupmod-simp-foo
2
+ Version: 1.9.9
3
+ Release: 9
4
+ Summary: mock foo test package
5
+ BuildArch: noarch
6
+
7
+ License: Apache-2.0
8
+ URL: http://foo.bar
9
+
10
+ %description
11
+ A mock RPM package used for acceptance tests
12
+
13
+ %prep
14
+ exit 0
15
+
16
+ %build
17
+ exit 0
18
+
19
+
20
+ %install
21
+ exit 0
22
+
23
+ %clean
24
+ exit 0
25
+
26
+ %files
27
+ %doc
28
+
29
+
30
+ %changelog
31
+ * Fri Feb 23 2018 nobody
32
+ - some comment
@@ -0,0 +1,32 @@
1
+ Name: pupmod-simp-simplib
2
+ Version: 1.9.9
3
+ Release: 9
4
+ Summary: mock simplib test package
5
+ BuildArch: noarch
6
+
7
+ License: Apache-2.0
8
+ URL: http://foo.bar
9
+
10
+ %description
11
+ A mock RPM package used for acceptance tests
12
+
13
+ %prep
14
+ exit 0
15
+
16
+ %build
17
+ exit 0
18
+
19
+
20
+ %install
21
+ exit 0
22
+
23
+ %clean
24
+ exit 0
25
+
26
+ %files
27
+ %doc
28
+
29
+
30
+ %changelog
31
+ * Fri Feb 23 2018 nobody
32
+ - some comment
@@ -0,0 +1,25 @@
1
+ spec_file=$1
2
+
3
+ FAKE_RPM_SRC_DIR=${FAKE_RPM_SRC_DIR:-${PWD}/pkg}
4
+ FAKE_RPM_BUILD_DIR=${FAKE_RPM_BUILD_DIR:-${FAKE_RPM_SRC_DIR}/rpmbuild}
5
+
6
+ # clean up old builds
7
+ rm -rf "${FAKE_RPM_BUILD_DIR}"/{BUILDROOT,BUILD,SOURCES}/** &> /dev/null :
8
+ mkdir -p "${FAKE_RPM_BUILD_DIR}"/{BUILDROOT,BUILD,SOURCES}
9
+
10
+
11
+ # if there is a directory with the same name as the spec file, build a tar ball
12
+ # from it and stage it under SOURCES
13
+ source_dir=`echo ${spec_file}| sed -e 's/.spec$//'`
14
+ if [ -d "${source_dir}" ]; then
15
+ echo "Found a directory named '${source_dir}'; building tarball"
16
+ pushd "${source_dir}" > /dev/null
17
+ tar -zcv --exclude=.*.swp -f "${FAKE_RPM_BUILD_DIR}/SOURCES/files.tar.gz" *
18
+ popd > /dev/null
19
+ else
20
+ echo "NOTE: no source directory ar '${source_dir}'"
21
+ fi
22
+
23
+
24
+ # rpmbuild
25
+ rpmbuild -D "buildroot ${FAKE_RPM_BUILD_DIR}/BUILDROOT" -D "builddir ${FAKE_RPM_BUILD_DIR}/BUILD" -D "_sourcedir ${FAKE_RPM_BUILD_DIR}/SOURCES" -D "_rpmdir ${FAKE_RPM_SRC_DIR}/dist" -D "_srcrpmdir ${FAKE_RPM_SRC_DIR}/dist" -D "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" -ba $@ "${spec_file}"
@@ -0,0 +1,3 @@
1
+ ---
2
+ copy_rpm_data: true
3
+ target_directory: /opt/test/puppet/code