Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 586282 Details for
Bug 661242
Suggestion for development workflow
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Newer patch
commits.patch (text/plain), 10.74 KB, created by
Bruno Pinto
on 2019-08-09 03:33:56 UTC
(
hide
)
Description:
Newer patch
Filename:
MIME Type:
Creator:
Bruno Pinto
Created:
2019-08-09 03:33:56 UTC
Size:
10.74 KB
patch
obsolete
>From 5b61b05c34f09b8e81643880fca655cf8547a292 Mon Sep 17 00:00:00 2001 >From: Bruno Pinto <brunoferreirapinto@gmail.com> >Date: Thu, 8 Aug 2019 23:01:19 -0300 >Subject: [PATCH 1/4] Improvements to development workflow > >Run ./script/setup.sh to initialize or update the environment. > >Signed-off-by: Bruno Pinto <brunoferreirapinto@gmail.com> >--- > Dockerfile | 1 - > bin/update-changelogs.sh | 1 + > bin/update-md5.sh | 1 + > config/initializers/kkuleomi_config.rb.dist | 2 +- > docker-compose.override.yml | 21 ++++++ > lib/tasks/kkuleomi.rake | 5 ++ > script/setup.sh | 79 +++++++++++++++++++++ > 7 files changed, 108 insertions(+), 2 deletions(-) > create mode 100644 docker-compose.override.yml > create mode 100755 script/setup.sh > >diff --git a/Dockerfile b/Dockerfile >index d54d9fa..ae4e124 100644 >--- a/Dockerfile >+++ b/Dockerfile >@@ -23,7 +23,6 @@ RUN bundler install > > # Git clones here. > RUN cp /var/www/packages.gentoo.org/htdocs/config/secrets.yml.dist /var/www/packages.gentoo.org/htdocs/config/secrets.yml >-RUN sed -i 's/set_me/ENV["SECRET_KEY_BASE"]/'g /var/www/packages.gentoo.org/htdocs/config/secrets.yml > > # Precompile our assets. > RUN rake assets:precompile >diff --git a/bin/update-changelogs.sh b/bin/update-changelogs.sh >index ae64050..b21678a 100755 >--- a/bin/update-changelogs.sh >+++ b/bin/update-changelogs.sh >@@ -1,5 +1,6 @@ > #!/bin/bash > >+mkdir /var/cache/pgo-egencache || exit 1 > cd /mnt/packages-tree/gentoo/ || exit 1 > egencache -j 6 --cache-dir /var/cache/pgo-egencache --repo gentoo --repositories-configuration '[gentoo] > location = /mnt/packages-tree/gentoo' --update-changelogs >diff --git a/bin/update-md5.sh b/bin/update-md5.sh >index 05eca90..643d6d1 100755 >--- a/bin/update-md5.sh >+++ b/bin/update-md5.sh >@@ -1,5 +1,6 @@ > #!/bin/bash > >+mkdir /var/cache/pgo-egencache || exit 1 > cd /mnt/packages-tree/gentoo/ || exit 1 > egencache -j 6 --cache-dir /var/cache/pgo-egencache --repo gentoo --repositories-configuration '[gentoo] > location = /mnt/packages-tree/gentoo' --update >diff --git a/config/initializers/kkuleomi_config.rb.dist b/config/initializers/kkuleomi_config.rb.dist >index d288581..ec8bbaf 100644 >--- a/config/initializers/kkuleomi_config.rb.dist >+++ b/config/initializers/kkuleomi_config.rb.dist >@@ -2,7 +2,7 @@ > KKULEOMI_PORTDIR='/usr/portage' > > # The location of the repository used for gathering runtime information >-KKULEOMI_RUNTIME_PORTDIR='/usr/portage' >+KKULEOMI_RUNTIME_PORTDIR = ENV['KKULEOMI_RUNTIME_PORTDIR'] || '/usr/portage' > > # The first actual git commit > # Set this to the second commit in the repo to avoid long changelog generation times >diff --git a/docker-compose.override.yml b/docker-compose.override.yml >new file mode 100644 >index 0000000..45a45e5 >--- /dev/null >+++ b/docker-compose.override.yml >@@ -0,0 +1,21 @@ >+version: '2' >+ >+services: >+ http-serving: >+ environment: >+ - RAILS_ENV=development >+ - KKULEOMI_RUNTIME_PORTDIR=/mnt/packages-tree/gentoo >+ ports: >+ - "5000:5000" >+ volumes: >+ - .:/var/www/packages.gentoo.org/htdocs/ >+ - packages_tree:/mnt/packages-tree/gentoo/ >+ sidekiq: >+ environment: >+ - RAILS_ENV=development >+ volumes: >+ - .:/var/www/packages.gentoo.org/htdocs/ >+ - packages_tree:/mnt/packages-tree/gentoo/ >+ >+volumes: >+ packages_tree: >diff --git a/lib/tasks/kkuleomi.rake b/lib/tasks/kkuleomi.rake >index 9b8bca0..94049a7 100644 >--- a/lib/tasks/kkuleomi.rake >+++ b/lib/tasks/kkuleomi.rake >@@ -4,6 +4,11 @@ namespace :kkuleomi do > task init: :environment do > Kkuleomi::Store.create_index true > end >+ >+ desc 'Updates the ElasticSearch index' >+ task update: :environment do >+ Kkuleomi::Store.create_index false >+ end > end > > namespace :update do >diff --git a/script/setup.sh b/script/setup.sh >new file mode 100755 >index 0000000..ab1078c >--- /dev/null >+++ b/script/setup.sh >@@ -0,0 +1,79 @@ >+#!/usr/bin/env bash >+ >+set -o pipefail >+set -o errexit >+set -o nounset >+ >+error() { >+ echo -e "\e[31m$1" >+} >+ >+info() { >+ echo -e "\e[0m$1" >+} >+ >+success() { >+ echo -e "\e[32m$1" >+} >+ >+info 'Copying configuration...' >+if test -e config/initializers/kkuleomi_config.rb; then >+ success ' File "config/secrets.yml" already exists.' >+else >+ cp -n config/initializers/kkuleomi_config.rb.dist config/initializers/kkuleomi_config.rb >+fi >+ >+info 'Copying secrets...' >+if test -e config/secrets.yml; then >+ success ' File "config/secrets.yml" already exists.' >+else >+ cp -n config/secrets.yml.dist config/secrets.yml >+fi >+ >+info 'Installing gems...' >+if bundle install --quiet; then >+ success ' Installed.' >+else >+ error ' Installation failed.' >+ exit 1 >+fi >+ >+info 'Updating gentoo packages tree...' >+if git -C /mnt/packages-tree/gentoo pull --rebase &>/dev/null; then >+ success ' Updated.' >+else >+ error ' Update failed.' >+ exit 1 >+fi >+ >+info 'Updating md5...' >+if bin/update-md5.sh; then >+ success ' Updated.' >+else >+ error ' Update failed.' >+ exit 1 >+fi >+ >+info 'Updating USE flags...' >+if bin/update-use.sh; then >+ success ' Updated.' >+else >+ error ' Update failed.' >+ exit 1 >+fi >+ >+info 'Creating indexes...' >+if rake kkuleomi:index:update; then >+ success ' Created.' >+else >+ error ' Creation failed.' >+ exit 1 >+fi >+ >+info 'Seeding packages...' >+if rake kkuleomi:update:all; then >+ success ' Seeded.' >+else >+ error ' Packages seed failed.' >+ exit 1 >+fi >-- >2.21.0 > > >From 1ec968d17f2d002a03ee42c06ad66033ba557cb3 Mon Sep 17 00:00:00 2001 >From: Bruno Pinto <brunoferreirapinto@gmail.com> >Date: Thu, 8 Aug 2019 23:17:14 -0300 >Subject: [PATCH 2/4] migrate gentoo portage location to default > /var/db/repos/gentoo > >Signed-off-by: Bruno Pinto <brunoferreirapinto@gmail.com> >--- > Dockerfile | 4 ++-- > config/initializers/kkuleomi_config.rb.dist | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/Dockerfile b/Dockerfile >index ae4e124..e94538b 100644 >--- a/Dockerfile >+++ b/Dockerfile >@@ -2,9 +2,9 @@ FROM gentoo/portage:latest as portage > FROM gentoo/stage3-amd64 > > # Need a portage tree to build, use last nights. >-COPY --from=portage /usr/portage /usr/portage >-# Sandbox doesn't work well in docker. >+COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo > >+# Sandbox doesn't work well in docker. > ENV FEATURES="-userpriv -usersandbox -sandbox" > ENV USE="-bindist" > >diff --git a/config/initializers/kkuleomi_config.rb.dist b/config/initializers/kkuleomi_config.rb.dist >index ec8bbaf..c35ccb6 100644 >--- a/config/initializers/kkuleomi_config.rb.dist >+++ b/config/initializers/kkuleomi_config.rb.dist >@@ -1,8 +1,8 @@ > # The location of the repository used for the indexer >-KKULEOMI_PORTDIR='/usr/portage' >+KKULEOMI_PORTDIR='/var/db/repos/gentoo' > > # The location of the repository used for gathering runtime information >-KKULEOMI_RUNTIME_PORTDIR = ENV['KKULEOMI_RUNTIME_PORTDIR'] || '/usr/portage' >+KKULEOMI_RUNTIME_PORTDIR = ENV['KKULEOMI_RUNTIME_PORTDIR'] || KKULEOMI_PORTDIR > > # The first actual git commit > # Set this to the second commit in the repo to avoid long changelog generation times >-- >2.21.0 > > >From 41ce2e44bacb16b9e9fb22d299a1700763326106 Mon Sep 17 00:00:00 2001 >From: Bruno Pinto <brunoferreirapinto@gmail.com> >Date: Fri, 9 Aug 2019 00:30:16 -0300 >Subject: [PATCH 3/4] Convert tab into spaces > >Signed-off-by: Bruno Pinto <brunoferreirapinto@gmail.com> >--- > lib/kkuleomi/store.rb | 68 +++++++++++++++++++++---------------------- > 1 file changed, 34 insertions(+), 34 deletions(-) > >diff --git a/lib/kkuleomi/store.rb b/lib/kkuleomi/store.rb >index a1a2d93..4b0185e 100644 >--- a/lib/kkuleomi/store.rb >+++ b/lib/kkuleomi/store.rb >@@ -4,44 +4,44 @@ module Kkuleomi::Store > end > > def self.create_index(force = false) >- types = [ >- Category, >- Package, >- Version, >- Change, >- Useflag, >- ] >+ types = [ >+ Category, >+ Package, >+ Version, >+ Change, >+ Useflag, >+ ] > > base_settings = { >- analysis: { >- filter: { >- autocomplete_filter: { >- type: 'edge_ngram', >- min_gram: 1, >- max_gram: 20, >- } >- }, >- analyzer: { >- autocomplete: { >- type: 'custom', >- tokenizer: 'standard', >- filter: %w(lowercase autocomplete_filter) >- } >- } >+ analysis: { >+ filter: { >+ autocomplete_filter: { >+ type: 'edge_ngram', >+ min_gram: 1, >+ max_gram: 20, >+ } > }, >- index: { mapper: { dynamic: false } }, >- mapping: { total_fields: { limit: 50000 } } >+ analyzer: { >+ autocomplete: { >+ type: 'custom', >+ tokenizer: 'standard', >+ filter: %w(lowercase autocomplete_filter) >+ } >+ } >+ }, >+ index: { mapper: { dynamic: false } }, >+ mapping: { total_fields: { limit: 50000 } } > } > >- # In ES 1.5, we could use 1 mega-index. But in ES6, each model needs its own. >- types.each { |type| >- client = type.gateway.client >- client.indices.delete(index: type.index_name) rescue nil if force >- body = { >- settings: type.settings.to_hash.merge(base_settings), >- mappings: type.mappings.to_hash >- } >- client.indices.create(index: type.index_name, body: body) >- } >+ # In ES 1.5, we could use 1 mega-index. But in ES6, each model needs its own. >+ types.each { |type| >+ client = type.gateway.client >+ client.indices.delete(index: type.index_name) rescue nil if force >+ body = { >+ settings: type.settings.to_hash.merge(base_settings), >+ mappings: type.mappings.to_hash >+ } >+ client.indices.create(index: type.index_name, body: body) >+ } > end > end >-- >2.21.0 > > >From 9a690aa3ca7a81c0f07119dcee84eba8060e3f3a Mon Sep 17 00:00:00 2001 >From: Bruno Pinto <brunoferreirapinto@gmail.com> >Date: Fri, 9 Aug 2019 00:30:52 -0300 >Subject: [PATCH 4/4] Create indices that do not exist > >Signed-off-by: Bruno Pinto <brunoferreirapinto@gmail.com> >--- > lib/kkuleomi/store.rb | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > >diff --git a/lib/kkuleomi/store.rb b/lib/kkuleomi/store.rb >index 4b0185e..905414a 100644 >--- a/lib/kkuleomi/store.rb >+++ b/lib/kkuleomi/store.rb >@@ -37,11 +37,15 @@ module Kkuleomi::Store > types.each { |type| > client = type.gateway.client > client.indices.delete(index: type.index_name) rescue nil if force >+ > body = { > settings: type.settings.to_hash.merge(base_settings), > mappings: type.mappings.to_hash > } >- client.indices.create(index: type.index_name, body: body) >+ >+ unless client.indices.exists? index: type.index_name >+ client.indices.create index: type.index_name, body: body >+ end > } > end > end >-- >2.21.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 661242
:
539678
|
539688
| 586282