summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Gemfile2
-rw-r--r--Makefile3
-rw-r--r--update.rb30
4 files changed, 36 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index f05a7493bf44..62844c527a03 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
/src/
/*.deb
/*.tar.xz
+Gemfile.lock
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 000000000000..383c431e141f
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,2 @@
+gem "mixlib-install"
+
diff --git a/Makefile b/Makefile
index 5d790d5aee1d..96551fb80c3c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,9 @@
default: clean build
build: namcap
+ rm Gemfile.lock
+ bundle install
+ bundle exec ruby update.rb
makepkg
makepkg --printsrcinfo > .SRCINFO
diff --git a/update.rb b/update.rb
new file mode 100644
index 000000000000..0ec5f1e8a2a4
--- /dev/null
+++ b/update.rb
@@ -0,0 +1,30 @@
+require 'mixlib/install'
+require 'json'
+
+options = {
+ channel: :stable,
+ product_name: 'chefdk',
+ platform: "debian",
+ platform_version: "9",
+ architecture: "x86_64"
+}
+
+artifact = Mixlib::Install.new(options).artifact_info
+pkgbuild = File.read("PKGBUILD")
+pkgbuild.split("\n").each do |line|
+ if line =~ /pkgver=(.*)/
+ puts "#{$1} → #{artifact.version}"
+ if $1 == artifact.version
+ puts "This version is already current!"
+ exit 1
+ end
+ break
+ end
+end
+
+pkgbuild = pkgbuild.gsub(/pkgver=.*/, "pkgver=#{artifact.version}").
+ gsub(/sha256sums=.*/, "sha256sums=('#{artifact.sha256}')").
+ gsub(/source=.*/, "source=('#{artifact.url}')").
+ gsub(/arch=.*/, "arch=('#{artifact.architecture}')")
+
+File.open("PKGBUILD", "w") { |f| f.write(pkgbuild) }