Commit 5fbb171d authored by Manuel's avatar Manuel

Remove scripts

parent 6a6288c0
#!/bin/bash
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
# (c) 2011 - Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
#
# global vars
#
_script_name="Copy «Any» Package(s)"
_ver="1.0"
_args=$(echo $1)
_dest_repo=$(echo $2)
_cur_repo=$(pwd | awk -F '/' '{print $NF}')
_needed_functions="config_handling helpers messages"
_build_arch="$_arch"
_carch="x86_64"
[[ ${_arch} = *x*64* ]] && _carch="i686"
# helper functions
for subroutine in ${_needed_functions} ; do
source _buildscripts/functions/${subroutine}
done
for cr in core platform desktop apps games ; do
if [ "$(echo "${_cur_repo}" | cut -d- -f1)" == ${cr} ] ; then
_cur=$(echo "${_cur_repo}" | cut -d- -f2)
fi
if [ "$(echo "${_dest_repo}" | cut -d- -f1)" == ${cr} ] ; then
_dest=$(echo "${_dest_repo}" | cut -d- -f2)
fi
done
if [ "$_cur" == "" ] ; then
_cur=$_cur_repo
fi
if [ "$_dest" == "" ] ; then
_dest=$_dest_repo
fi
#
# Functions
#
lock_repo()
{
newline
status_start "locking «$(echo "${1}" | sed 's/ /» «/g' | sed 's/+/» «/g')» i686 and x86_64"
locker="$(echo "${_packer}" | cut -d ' ' -f1)+$(echo "${_packer}" | cut -d ' ' -f2)"
lock=$(curl --silent --data "r=$(echo "${1}" | sed 's/ /+/g')&a=both&u=${_up}&n=${locker}" http://chakra-project.org/packages/add-lock.php)
if [ "$lock" = "ok" ] ; then
status_ok
else
status_fail
error "${lock}"
newline
exit 1
fi
}
unlock_repo()
{
newline
status_start "unlocking «$(echo "${1}" | sed 's/ /» «/g' | sed 's/+/» «/g')» i686 and x86_64"
unlock=$(curl --silent --data "r=$(echo "${1}" | sed 's/ /+/g')&a=both&u=${_up}" http://chakra-project.org/packages/remove-lock.php)
if [ "$unlock" = "ok" ] ; then
status_ok
else
status_fail
error "${unlock}"
fi
}
repo_clean()
{
newline
status_start "cleanning «$1-${_carch}»"
recreate_db=$(curl --silent --data "r=$1&a=${_carch}&u=${_up}" http://chakra-project.org/packages/repo-clean.php)
if [ "$recreate_db" = "ok" ] ; then
status_done
else
status_fail
error "${recreate_db}"
fi
}
copy_packages_from_target()
{
lock_repo "${final_dest}"
newline
for pkg in $copy_list ; do
status_start "copying «$pkg» from «${final_dest}-${_arch}» to «${final_dest}-${_carch}»"
unset copypkg
#stripped_pkg_name=$(echo "${pkg}" | sed 's/\.pkg\.tar\..z//g')
copypkg=$(curl --silent --data "r=${final_dest}&a=${_arch}&u=${_up}&n=${pkg}" http://chakra-project.org/packages/copy-any-pkg.php)
if [ "$copypkg" = "ok" ] ; then
status_done
else
status_fail
error "${copypkg}"
fi
done
repo_clean "${final_dest}"
unlock_repo "${final_dest}"
}
check_available_repos()
{
msg "Checking repos"
unset checktr
checktr=$(curl --silent --data "u=${_up}" http://chakra-project.org/packages/available-repos.php)
if [ "$(echo "$checktr" | cut -d+ -f1)" = 'ok' ] ; then
for _repo_check in ${checktr} ; do
if [ "${_repo_check}" = "${_dest}" ] ; then
repo_exist="yes"
fi
done
if [ "${repo_exist}" != "yes" ] ; then
newline
error "the target repo «${_dest}» it is unknown"
error "$(echo "$checktr" | sed 's/ok+/available repos:/g')"
newline
exit 1
fi
else
newline
error "unable to check available repos"
if [ "$checktr" != "" ] ; then
error "$checktr"
fi
newline
exit 1
fi
}
copy_any_packages()
{
if [ "${_dest}" != "" ] ; then
check_available_repos
final_dest=${_dest}
else
final_dest=${_cur}
fi
newline
msg "searching for «${_args}» in «${final_dest}-${_arch}»"
export RSYNC_PASSWORD=$(echo ${_rsync_pass})
repo_files=$(rsync -avh --list-only ${_rsync_user}@${_rsync_server}::dev/${final_dest}/${_arch}/ | cut -d ":" -f 3 | cut -d " " -f 2)
# Parses more than an arg separated by comma
parse_args=$(echo "${_args}" | sed 's/,/\n/g')
for each_arg in $parse_args ; do
partial_list=$(echo "$repo_files" | grep ${each_arg} | grep 'any.pkg.tar..*z$')
parse_list=$(echo ${partial_list} ${parse_list})
done
copy_list=''
for each_file in $parse_list ; do
file_exist='false'
for each_add in $copy_list ; do
if [ "${each_file}" = "${each_add}" ] ; then
file_exist='true'
fi
done
if [ "${file_exist}" = "false" ] ; then
copy_list=$(echo "${copy_list} ${each_file}")
fi
done
unset how_mani
for count in $copy_list ; do
((how_mani++))
done
if [ "$copy_list" != "" ] ; then
newline
warning "(${how_mani}) packages match your search criteria:"
newline
echo "$(echo ${copy_list} | tr ' ' '\012')"
newline
question "Do you really want to copy the package(s)? (y/n) "
while true ; do
read yn
case ${yn} in
[yY]* )
time copy_packages_from_target
newline
title "All done"
break
;;
[nN]* )
newline
title "no packages are copied"
newline
break
;;
* )
echo "Enter (y)es or (n)o"
;;
esac
done
else
newline
error "no packages match your search criteria"
newline
exit 1
fi
}
#
# startup
#
clear
title "${_script_name} v${_ver} - $_cur_repo-$_build_arch"
if [ "${_args}" = "" ] ; then
error " !! You need to specify a target to copy,"
error " single names like «attica» or simple regexp like ^kde are allowed."
newline
exit 1
fi
load_configs
check_rsync
check_accounts
# NOTE: Don't move this variable, need to be here.
_up=$(echo -n "$(date -u +%W)${_rsync_user}$(echo -n "${_rsync_pass}"|sha1sum|awk '{print $1}')"|sha1sum|awk '{print $1}')
copy_any_packages
newline
#!/bin/sh
#
# Fakeuname - fakes the uname system value
#
# usage example: ../fakeuname -r 2.6.33-CHAKRA ../makepkg
#
uname=$(which uname)
dir=$(mktemp -d --tmpdir uname.XXXXXXXX)
kernel=$($uname -s)
nodename=$($uname -n)
kernel_rel=$($uname -r)
kernel_ver=$($uname -v)
machine=$($uname -m)
processor=$($uname -p)
hw=$($uname -i)
os=$($uname -o)
# print usage
usage() {
echo "Usage: $( basename "$0" ) [options] [ -- ] command"
echo "Options:"
echo " -s kernel-name"
echo " -n nodename"
echo " -r kernel-release"
echo " -v kernel-version"
echo " -m machine"
echo " -p processor"
echo " -i hardware-platform"
echo " -o operating-system"
exit 0
}
cleanup() {
rm -rf -- "$dir"
}
# always clean up temporary folder
trap 'cleanup' EXIT TERM HUP QUIT INT
[ $# -eq 0 ] && usage
current=""
for arg in "$@"; do
case "$arg" in
-s|--kernel-name) shift ; current=kernel ;;
-n|--nodename) shift ; current=nodename ;;
-r|--kernel-release) shift ; current=kernel_rel ;;
-v|--kernel-version) shift ; current=kernel_ver ;;
-m|--machine) shift ; current=machine ;;
-p|--processor) shift ; current=processor ;;
-i|--hardware-platform) shift ; current=hw ;;
-o|--operating-system) shift ; current=os ;;
--) shift ; break ;;
-*) echo -e >&2 "$( basename "$0" ): Invalid option \`$arg' found\n" && usage ;;
*) [ -n "$current" ] && eval "$current='$arg'" && current="" && shift || break ;;
esac
done
for arg in "$@"; do
cmd="$cmd '$arg'"
done
# write uname file
cat > "$dir/uname" <<EOF
#!/bin/sh
uname_output() {
$uname "\$1";
exit \$?
}
for arg in "\$@"; do
if [ "\${arg:0:1}" = "-" ]; then
case "\$arg" in
--help) uname_output "\$arg" ;;
--version) uname_output "\$arg" ;;
-a|--all)
echo "$kernel $nodename $kernel_rel $kernel_ver $machine $processor $hw $os"
exit \$? ;;
-s|--kernel-name) ;;
-n|--nodename) ;;
-r|--kernel-release) ;;
-v|--kernel-version) ;;
-m|--machine) ;;
-p|--processor) ;;
-i|--hardware-platform) ;;
-o|--operating-system) ;;
*) uname_output "\$arg" ;;
esac
else
uname_output "\$arg"
fi
done
for arg in "\$@"; do
case "\$arg" in
-s|--kernel-name) echo -n "$kernel";;
-n|--nodename) echo -n "$nodename";;
-r|--kernel-release) echo -n "$kernel_rel";;
-v|--kernel-version) echo -n "$kernel_ver";;
-m|--machine) echo -n "$machine";;
-p|--processor) echo -n "$processor";;
-i|--hardware-platform) echo -n "$hw";;
-o|--operating-system) echo -n "$os";;
esac
done
# new line
echo
EOF
chmod a+x "$dir/uname"
export PATH="$dir/:$PATH"
eval $cmd
\ No newline at end of file
#!/bin/bash
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
# (c) 2011 - Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
#
# global vars
#
_script_name="Get «Any» Package(s)"
_ver="1.0"
_args=$(echo $1)
_dest_repo=$(echo $2)
_cur_repo=$(pwd | awk -F '/' '{print $NF}')
_needed_functions="config_handling helpers messages"
_build_arch="$_arch"
_carch="x86_64"
[[ ${_arch} = *x*64* ]] && _carch="i686"
# helper functions
for subroutine in ${_needed_functions} ; do
source _buildscripts/functions/${subroutine}
done
for cr in core platform desktop apps games ; do
if [ "$(echo "${_cur_repo}" | cut -d- -f1)" == ${cr} ] ; then
_cur=$(echo "${_cur_repo}" | cut -d- -f2)
fi
if [ "$(echo "${_dest_repo}" | cut -d- -f1)" == ${cr} ] ; then
_dest=$(echo "${_dest_repo}" | cut -d- -f2)
fi
done
if [ "$_cur" == "" ] ; then
_cur=$_cur_repo
fi
if [ "$_dest" == "" ] ; then
_dest=$_dest_repo
fi
#
# Functions
#
lock_repo()
{
newline
status_start "locking «$(echo "${1}" | sed 's/ /» «/g' | sed 's/+/» «/g')» i686 and x86_64"
locker="$(echo "${_packer}" | cut -d ' ' -f1)+$(echo "${_packer}" | cut -d ' ' -f2)"
lock=$(curl --silent --data "r=$(echo "${1}" | sed 's/ /+/g')&a=both&u=${_up}&n=${locker}" http://chakra-project.org/packages/add-lock.php)
if [ "$lock" = "ok" ] ; then
status_ok
else
status_fail
error "${lock}"
newline
exit 1
fi
}
unlock_repo()
{
newline
status_start "unlocking «$(echo "${1}" | sed 's/ /» «/g' | sed 's/+/» «/g')» i686 and x86_64"
unlock=$(curl --silent --data "r=$(echo "${1}" | sed 's/ /+/g')&a=both&u=${_up}" http://chakra-project.org/packages/remove-lock.php)
if [ "$unlock" = "ok" ] ; then
status_ok
else
status_fail
error "${unlock}"
fi
}
repo_clean()
{
newline
status_start "cleanning «$1-${_arch}»"
recreate_db=$(curl --silent --data "r=$1&a=${_arch}&u=${_up}" http://chakra-project.org/packages/repo-clean.php)
if [ "$recreate_db" = "ok" ] ; then
status_done
else
status_fail
error "${recreate_db}"
fi
}
copy_packages_from_target()
{
lock_repo "${final_dest}"
newline
for pkg in $copy_list ; do
status_start "copying «$pkg» from «${final_dest}-${_carch}» to «${final_dest}-${_arch}»"
unset copypkg
#stripped_pkg_name=$(echo "${pkg}" | sed 's/\.pkg\.tar\..z//g')
copypkg=$(curl --silent --data "r=${final_dest}&a=${_carch}&u=${_up}&n=${pkg}" http://chakra-project.org/packages/copy-any-pkg.php)
if [ "$copypkg" = "ok" ] ; then
status_done
else
status_fail
error "${copypkg}"
fi
done
repo_clean "${final_dest}"
unlock_repo "${final_dest}"
}
check_available_repos()
{
msg "Checking repos"
unset checktr
checktr=$(curl --silent --data "u=${_up}" http://chakra-project.org/packages/available-repos.php)
if [ "$(echo "$checktr" | cut -d+ -f1)" = 'ok' ] ; then
for _repo_check in ${checktr} ; do
if [ "${_repo_check}" = "${_dest}" ] ; then
repo_exist="yes"
fi
done
if [ "${repo_exist}" != "yes" ] ; then
newline
error "the target repo «${_dest}» it is unknown"
error "$(echo "$checktr" | sed 's/ok+/available repos:/g')"
newline
exit 1
fi
else
newline
error "unable to check available repos"
if [ "$checktr" != "" ] ; then
error "$checktr"
fi
newline
exit 1
fi
}
copy_any_packages()
{
if [ "${_dest}" != "" ] ; then
check_available_repos
final_dest=${_dest}
else
final_dest=${_cur}
fi
newline
msg "searching for «${_args}» in «${final_dest}-${_carch}»"
export RSYNC_PASSWORD=$(echo ${_rsync_pass})
repo_files=$(rsync -avh --list-only ${_rsync_user}@${_rsync_server}::dev/${final_dest}/${_carch}/ | cut -d ":" -f 3 | cut -d " " -f 2)
# Parses more than an arg separated by comma
parse_args=$(echo "${_args}" | sed 's/,/\n/g')
for each_arg in $parse_args ; do
partial_list=$(echo "$repo_files" | grep ${each_arg} | grep 'any.pkg.tar..*z$')
parse_list=$(echo ${partial_list} ${parse_list})
done
copy_list=''
for each_file in $parse_list ; do
file_exist='false'
for each_add in $copy_list ; do
if [ "${each_file}" = "${each_add}" ] ; then
file_exist='true'
fi
done
if [ "${file_exist}" = "false" ] ; then
copy_list=$(echo "${copy_list} ${each_file}")
fi
done
unset how_mani
for count in $copy_list ; do
((how_mani++))
done
if [ "$copy_list" != "" ] ; then
newline
warning "(${how_mani}) packages match your search criteria:"
newline
echo "$(echo ${copy_list} | tr ' ' '\012')"
newline
question "Do you really want to copy the package(s)? (y/n) "
while true ; do
read yn
case ${yn} in
[yY]* )
time copy_packages_from_target
newline
title "All done"
break
;;
[nN]* )
newline
title "no packages are copied"
newline
break
;;
* )
echo "Enter (y)es or (n)o"
;;
esac
done
else
newline
error "no packages match your search criteria"
newline
exit 1
fi
}
#
# startup
#
clear
title "${_script_name} v${_ver} - $_cur_repo-$_build_arch"
if [ "${_args}" = "" ] ; then
error " !! You need to specify a target to copy,"
error " single names like «attica» or simple regexp like ^kde are allowed."
newline
exit 1
fi
load_configs
check_rsync
check_accounts
# NOTE: Don't move this variable, need to be here.
_up=$(echo -n "$(date -u +%W)${_rsync_user}$(echo -n "${_rsync_pass}"|sha1sum|awk '{print $1}')"|sha1sum|awk '{print $1}')
copy_any_packages
newline
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# rebuildorder.py - find the order to build a list of packages
#
# Copyright (c) 2010 by Mark Pustjens <pustjens@dds.nl>
# Copyright (c) 2009 by Allan McRae <allan@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#