Skip to content
Snippets Groups Projects
Commit a32e092a authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Remove ed completely from set-revisions, set version and remote differently.

parent bdb41dd8
No related branches found
No related tags found
1 merge request!605Component versions
Loading
Loading
@@ -16,10 +16,10 @@
# limitations under the License.
#
require "#{Omnibus::Config.project_root}/lib/gitlab/version"
version = Gitlab::Version.new("GITLAB_VERSION").print
version = Gitlab::Version.new("GITLAB_VERSION")
 
name "gitlab-rails"
default_version version
default_version version.print
 
EE = system("#{Omnibus::Config.project_root}/support/is_gitlab_ee.sh")
 
Loading
Loading
@@ -35,7 +35,7 @@ dependency "python-docutils"
dependency "mysql-client" if EE
dependency "krb5"
 
source :git => "git@dev.gitlab.org:gitlab/gitlabhq.git"
source :git => version.remote
 
build do
env = with_standard_compiler_flags(with_embedded_path)
Loading
Loading
Loading
Loading
@@ -16,15 +16,15 @@
##
#
require "#{Omnibus::Config.project_root}/lib/gitlab/version"
version = Gitlab::Version.new("GITLAB_SHELL_VERSION").print
version = Gitlab::Version.new("GITLAB_SHELL_VERSION")
 
name "gitlab-shell"
default_version version
default_version version.print
 
dependency "ruby"
dependency "rsync"
 
source :git => "git@dev.gitlab.org:gitlab/gitlab-shell.git"
source :git => version.remote
 
build do
command "mkdir -p #{install_dir}/embedded/service/gitlab-shell"
Loading
Loading
Loading
Loading
@@ -15,12 +15,13 @@
# limitations under the License.
#
require "#{Omnibus::Config.project_root}/lib/gitlab/version"
version = Gitlab::Version.new("GITLAB_WORKHORSE_VERSION").print
version = Gitlab::Version.new("GITLAB_WORKHORSE_VERSION")
 
name "gitlab-workhorse"
default_version version
default_version version.print
source :git => version.remote
 
source :git => "git@dev.gitlab.org:gitlab/gitlab-workhorse.git"
 
build do
make "install PREFIX=#{install_dir}/embedded"
Loading
Loading
module Gitlab
class Version
 
def initialize(filename)
filepath = File.expand_path(filename, Omnibus::Config.project_root)
@filename = filename
filepath = File.expand_path(@filename, Omnibus::Config.project_root)
@read_version = File.read(filepath).chomp
rescue Errno::ENOENT
# Didn't find the file
Loading
Loading
@@ -19,5 +19,22 @@ module Gitlab
@read_version
end
end
def remote
case @filename
when "GITLAB_VERSION"
if @read_version.include?('-ee')
"git@dev.gitlab.org:gitlab/gitlab-ee.git"
else
"git@dev.gitlab.org:gitlab/gitlabhq.git"
end
when "GITLAB_SHELL_VERSION"
"git@dev.gitlab.org:gitlab/gitlab-shell.git"
when "GITLAB_WORKHORSE_VERSION"
"https://gitlab.com/gitlab-org/gitlab-workhorse.git"
else
nil
end
end
end
end
Loading
Loading
@@ -20,31 +20,18 @@ main() {
gitlab_workhorse_oid=$(fetch_oid gitlab_workhorse)
assert_non_empty gitlab_workhorse_oid
 
set_source_and_version gitlab_rails config/software/gitlab-rails.rb
set_source_and_version gitlab_shell config/software/gitlab-shell.rb
set_source_and_version gitlab_workhorse config/software/gitlab-workhorse.rb
set_source_and_version $gitlab_rails_ref GITLAB_VERSION
set_source_and_version $gitlab_shell_ref GITLAB_SHELL_VERSION
}
 
# set_source_and_version foo file.rb
# Will look for variables $foo_ref, $foo_repo and $foo_oid. Fills them in in
# file.rb.
# set_source_and_version foo_ref file
# Will look for variable $foo_ref. Adds it to
# file.
set_source_and_version() {
# Change (c) the first line starting with 'default_version '. Jump back to
# the beginning of the file with '1'. Change the first line starting with
# 'source '.
ed -s "$2" <<EOF
H
/^default_version /c
default_version "$(eval echo \$${1}_oid)" # $(eval echo \$${1}_ref)
.
1
/^source /c
source :git => "$(eval echo \$${1}_repo)"
.
wq
EOF
echo "$1" > "$2"
if [ $? -ne 0 ] ; then
warn "Error: ed -s $2 failed"
warn "Error: adding to $2 failed"
exit 1
fi
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment