This commit is contained in:
Timothy N. Tsvetkov 2011-04-11 21:06:32 +04:00
commit c7b19db4b6
10 changed files with 369 additions and 3 deletions

View File

@ -1,6 +1,7 @@
class ProductsController < ApplicationController
before_filter :authenticate_user!, :except => [:product_begin, :product_end]
before_filter :find_product_by_name, :only => [:product_begin, :product_end]
before_filter :find_platform, :except => [:product_begin, :product_end]
def product_begin
@product.build_status = Product::STATUS::BUILDING
@ -17,10 +18,33 @@ class ProductsController < ApplicationController
render :nothing => true, :status => 200
end
def new
@product = @platform.products.new
@product.ks = DEFAULT_KS
@product.menu = DEFAULT_MENU
@product.counter = DEFAULT_COUNTER
@product.build = DEFAULT_BUILD
end
def create
@product = @platform.products.new params[:product]
if @product.save
flash[:notice] = ''
redirect_to @platform
else
flash[:error] = ''
render :action => :new
end
end
protected
def find_product_by_name
@product = Product.find_by_name params[:product_name]
end
def find_platform
@platform = Platform.find params[:platform_id]
end
end

View File

@ -8,6 +8,7 @@ class Platform < ActiveRecord::Base
before_create :xml_rpc_create
before_destroy :xml_rpc_destroy
before_update :check_freezing
def path
@ -65,4 +66,10 @@ class Platform < ActiveRecord::Base
raise "Failed to delete platform #{name}."
end
end
def check_freezing
if released_changed?
BuildServer.freeze_platform self.name
end
end
end

View File

@ -8,4 +8,6 @@ class Product < ActiveRecord::Base
validates :build_status, :inclusion => { :in => [ NEVER_BUILT, BUILD_COMPLETED, BUILD_FAILED ] }
belongs_to :platform
scope :recent, order("name ASC")
end

View File

@ -60,5 +60,27 @@
.actions-bar.wat-cf
.actions
%a{ :name => "producs" }
.block
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.products.list"), platform_path(@platform) + "#products"
%li= link_to t("layout.products.new"), new_platform_product_path(@platform)
.content
%h2.title
= t("layout.products.list_header")
.inner
%table.table
%tr
%th.first= t("activerecord.attributes.product.name")
%th.last &nbsp;
- @platform.products.recent.each do |product|
%tr{:class => cycle("odd", "even")}
%td
= link_to product.name, platform_product_path(@platform, product)
%td.last
#{link_to t("layout.show"), platform_product_path(@platform, product)} | #{link_to t("layout.delete"), platform_product_path(@platform, product), :method => :delete, :confirm => t("layout.products.confirm_delete")}
.actions-bar.wat-cf
.actions
-#- content_for :sidebar do

View File

@ -0,0 +1,23 @@
.group
= f.label :name, t("activerecord.attributes.product.name"), :class => :label
= f.text_field :name, :class => 'text_field'
.group
= f.label :build, t("activerecord.attributes.product.build"), :class => :label
= f.text_area :build, :class => 'text_field', :cols => 80
.group
= f.label :counter, t("activerecord.attributes.product.counter"), :class => :label
= f.text_area :counter, :class => 'text_field', :cols => 80
.group
= f.label :ks, t("activerecord.attributes.product.ks"), :class => :label
= f.text_area :ks, :class => 'text_field', :cols => 80
.group
= f.label :menu, t("activerecord.attributes.product.menu"), :class => :label
= f.text_area :menu, :class => 'text_field', :cols => 80
.group.navform.wat-cf
%button.button{:type => "submit"}
= image_tag("web-app-theme/icons/tick.png", :alt => t("layout.save"))
= t("layout.save")
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), platform_path(@platform), :class => "text_button_padding link_button"

View File

@ -0,0 +1,12 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to @platform.name, platform_path(@platform) + "#products"
%li.active= link_to t("layout.products.new"), new_platform_product_path(@platform)
.content
%h2.title= t("layout.products.new_header")
.inner
= form_for [@platform, @product], :html => { :class => :form } do |f|
= render :partial => "form", :locals => {:f => f}
-#- content_for :sidebar, render(:partial => 'sidebar')

View File

@ -0,0 +1,238 @@
DEFAULT_KS = <<-eos
timezone Europe/Moscow
auth --useshadow --enablemd5
selinux --disabled
firewall --enabled
firstboot --enabled
part / --size 8692
services --enabled=acpid,alsa,atd,atieventsd,avahi-daemon,dm,haldaemon,iptables,ip6tables,irqbalance,mandi,messagebus,msec,netfs,network,network-up,numlock,partmon,resolvconf,rpcbind,rsyslog,shorewall,sound,stop-bootlogd,udev-post,cups,mandrake_everytime,mandrake_firsttime
services --disabled=kudzu,sshd,crond,auditd,autofs,fuse,pptp,pppoe,ntpd
repo --name=Main --baseurl=http://10.3.0.12/iso/repository/rpm/external/mdv/cooker/cooker/media/main/release/
#repo --name=Non-Free --baseurl=file:///mnt/BIG/devel/cooker/#ARCH#/media/non-free/release
#repo --name=Livecd --baseurl=file:///home/LIVE/rpm/i586/
repo --name=Rosa.add --baseurl=http://10.3.0.12/iso/repository/Projects/mdv/sasha/ROSA.add.2011/RPMS
#repo --name=Contrib --baseurl=http://10.3.0.12/iso/repository/rpm/external/mdv/cooker/cooker/media/contrib/release/
%packages
%include #PATH#/mdv-kde-one.lst.3
#%include #PATH#/mdv-base.lst
%end
%post
echo "ROSA Desktop 2011.beta" > /etc/redhat-release
echo "ROSA Desktop 2011.beta" > /etc/issue
echo "ROSA Desktop 2011.beta" > /etc/issue.net
echo "ROSA Desktop 2011.beta" > /etc/system-release
#### WORKAROUND FOR DBUS ###
/usr/sbin/useradd messagebus -d / -s /bin/false
#### END OF IT ####
echo ""
/bin/ls -l /boot/
echo ""
echo "###################################### Make initrd symlink >> "
echo ""
/usr/sbin/update-alternatives --set mkinitrd /sbin/mkinitrd-dracut
rm -rf /boot/initrd-*
# adding life user
/usr/sbin/adduser live
/usr/bin/passwd -d live
/bin/mkdir -p /home/live
/bin/cp -rfT /etc/skel /home/live/
/bin/chown -R live:live /home/live
# ldetect stuff
/usr/sbin/update-ldetect-lst
# setting up network manager by default
pushd /etc/sysconfig/network-scripts
for iface in eth0 wlan0; do
cat > ifcfg-$iface << EOF
DEVICE=eth0
ONBOOT=yes
NM_CONTROLLED=yes
EOF
done
popd
#### workaround for NETWORKMANAGER
systemctl enable networkmanager.service
### END OF IT
# kde look-and-feel, should do into kde-common package
#sed -i 's/widgetStyle=iaorakde/widgetStyle=qtcurve/g' /var/lib/mandriva/kde4-profiles/common/share/config/kdeglobals
#sed -i 's/colorScheme=Ia Ora Smooth/colorScheme=Norway/g' /var/lib/mandriva/kde4-profiles/common/share/config/kdeglobals
# default background
pushd /usr/share/mdk/backgrounds/
ln -s rosa.jpg default.jpg
#popd
# mtab
pushd /etc/
ln -sf /proc/mounts mtab
popd
#
#
# kernel
#
#
# Sysfs must be mounted for dracut to work!
#
mount -t sysfs /sys /sys
pushd /lib/modules/
KERNEL=$(echo *)
popd
echo
echo Generating kernel. System kernel is `uname -r`, installed kernels are:
rpm -qa kernel-*
echo Detected kernel version: $KERNEL
/sbin/dracut --add-drivers "sr-mod" /boot/initramfs-$KERNEL.img $KERNEL
ls -l /boot/
echo
#
#
#
# echo
# echo
# echo "Giving you a shell to fix stuff, good luck!"
# echo
# echo
# echo
# /bin/bash
echo ""
echo "###################################### Build ISO >> "
echo ""
%post --nochroot
cp -rfT #PATH#/extraconfig/etc $INSTALL_ROOT/etc/
cp -f #PATH#/root/GPL $LIVE_ROOT/
mkdir -p $LIVE_ROOT/Addons
cp /usr/bin/livecd-iso-to-disk $LIVE_ROOT/Addons/
chmod +x $LIVE_ROOT/Addons/livecd-iso-to-disk
rpm --root $INSTALL_ROOT -qa | sort > $LIVE_ROOT/rpm.lst
%end
eos
DEFAULT_MENU=<<-eos
<?xml version="1.0"?>
<menu_config>
<welcome_message>
Welcome to
</welcome_message>
<product_name>
ROSA 2011 Beta
</product_name>
<item name="Launch system">
vga=788
desktop
nopat
rd_NO_LUKS
rd_NO_MD
noiswmd
splash=silent
</item>
<item name="Install system">
vga=788
desktop
nopat
rd_NO_LUKS
rd_NO_MD
noiswmd
splash=silent
install
</item>
<background_img_path>
/home/LIVE/ROSA.2011/welcome.jpg
</background_img_path>
<font_path>
/home/LIVE/ROSA.2011/cyra8x16.psf
</font_path>
</menu_config>
eos
DEFAULT_COUNTER=<<-eos
63
eos
DEFAULT_BUILD=<<-eos
#!/bin/sh
#ARCHS="i586 x86_64"
#ARCHS="i586"
#if [ ! "$UID" = "0" ]; then#
# echo "Restarting as root.."
# exec sudo $0
#fi
# a temporary hack to make python 2.6 work
export PYTHONPATH=/usr/lib/python2.6/site-packages/
DIRNAME=$(dirname $0)
cd $DIRNAME
build_root="/home/LIVE/"
d=`date +%Y.%m.%d-%H.%M`
product_id="ROSA.2011"
product_name_file="${build_root}/${product_id}/.name.txt" ; touch ${product_name_file}
#ks="${build_root}/${product_id}/.ks"
ks="${build_root}/${product_id}/.ks"
counter="${build_root}/${product_id}/.counter"
menu="${build_root}/${product_id}/.menu.xml"
touch ${counter}
i=`cat ${counter}`
i=`expr $i + 1`
echo $i > ${counter}
echo "$i.$d" > ${build_root}/${product_id}/version.txt
# build different architectures
#for arch in $ARCHS; do
cp -f ${ks}.template ${ks}
# sed -i -e "s:#ARCH#:$arch:g" ${ks}
sed -i -e "s:#PATH#:${build_root}/${product_id}:g" ${ks}
sed -i -e "s:#PATH#:${build_root}/${product_id}:g" ${menu}
mkdir -p $build_root/iso/${product_id}/
# run with lower priority
livecd-creator --config=${ks} --fslabel=${product_id}.$i --menu-config=${build_root}/${product_id}/.menu.xml
mv ${product_id}.$i.iso $build_root/iso/${product_id}/
#md5sum /iso/${product_id}/${product_id}.$i.iso > /iso/${product_id}/${product_id}.$i.iso.md5sum
echo ""
echo " ALL DONE! $build_root/iso/${product_id}/${product_id}.$i.iso"
echo ""
eos

View File

@ -54,6 +54,12 @@ ru:
back_to_the_list: К списку репозиториев
confirm_delete: Вы уверены, что хотите удалить этот репозиторий?
current_repository_header: Текущий репозиторий
products:
list: Список
new: Новый продукт
list_header: Продукты
new_header: Новый продукт
confirm_delete: Вы уверены, что хотите удалить этот продукт?
projects:
list: Список
list_header: Проекты
@ -166,8 +172,9 @@ ru:
project: Проект
rpm: RPM
user: Пользователь
product: Продукт
build_list: Сборочный лист
build_list item: Элемент сборочного листа
build_list_item: Элемент сборочного листа
attributes:
repository:
@ -175,8 +182,20 @@ ru:
platform_id: Платформа
platform: Платформа
unixname: Unixname
created_at: Создана
updated_at: Обновлена
created_at: Создан
updated_at: Обновлен
product:
name: Название
platform_id: Платформа
build_status: Статус последней сборки
build_path: Путь к iso
created_at: Создан
updated_at: Обновлен
ks: Содержимое .ks.template
counter: Содержимое .counter
build: Содержимое build
menu: Содержимое .menu.xml
arch:
name: Название

View File

@ -0,0 +1,15 @@
class AddFieldsToProducts < ActiveRecord::Migration
def self.up
add_column :products, :build, :text
add_column :products, :counter, :text
add_column :products, :ks, :text
add_column :products, :menu, :text
end
def self.down
remove_column :products, :menu
remove_column :products, :ks
remove_column :products, :counter
remove_column :products, :build
end
end

View File

@ -89,6 +89,10 @@ ActiveRecord::Schema.define(:version => 20110411160955) do
t.string "build_path"
t.datetime "created_at"
t.datetime "updated_at"
t.text "build"
t.text "counter"
t.text "ks"
t.text "menu"
end
create_table "projects", :force => true do |t|