#!/bin/bash

# 150216 updated for version suse11_3
set -ax;
TBZDIR=/ul/tbz;
REPO=suse13_1
LAST=suse11_3
DOKS="a2e_pari_pub mktdir";
DOKS="a2e_bin"
# for S in $(grep -vl Requires */*.spec);do B=$(dirname $S);echo $B;done; # FIXME: grep -v does not find the files that do not contain a Require
# DOKS="a2e_conkeror_pub a2e_dtaus_pub a2e_hanzi_pub a2e_hanzi_pub a2e_mailcrypt_pub a2e_pari_pub perl_appconfig_pub perl_params_validate_pub perl_cache_cache_pub perl_class_container_pub perl_class_data_inheritable_pub perl_class_errorhandler_pub perl_class_inner_pub perl_class_loader_pub perl_convert_ascii_armour_pub perl_convert_asn1_pub perl_convert_pem_pub perl_crypt_blowfish_pub perl_crypt_cast5_pub perl_crypt_cast5_pp_pub perl_crypt_cbc_pub perl_crypt_des_ede3_pub perl_crypt_des_pub perl_crypt_dsa_pub perl_crypt_idea_pub perl_crypt_openpgp_pub perl_crypt_primes_pub perl_crypt_random_pub perl_crypt_rijndael_pub perl_crypt_ripemd160_pub perl_crypt_rsa_pub perl_crypt_twofish_pub perl_data_buffer_pub perl_data_dumper_pub perl_datetime_format_mail_pub perl_datetime_format_w3cdtf_pub perl_datetime_locale_pub perl_datetime_pub perl_datetime_timezone_pub perl_devel_stacktrace_pub perl_devel_symdump_pub perl_email_abstract_pub perl_email_filter_pub perl_email_simple_pub perl_error_pub perl_extutils_autoinstall_pub perl_html_parser_pub perl_io_pub perl_io_stty_pub perl_list_moreutils_pub perl_mail_box_pub perl_math_pari_pub perl_mime_types_pub perl_module_install_pub perl_net_ping_pub perl_ole_storage_lite_pub perl_ole_storage_pub perl_psh_pub perl_return_value_pub perl_scalar_util_pub perl_exception_class_pub perl_parse_excel_pub perl_template_dbi_pub perl_template_multilingual_pub perl_test_class_pub perl_test_simple_pub perl_test_unit_pub perl_tie_encryptedhash_pub perl_unix_configfile_pub perl_xml_rss_pub wordnet_pub"
# DOKS=$(for S in $(grep -l Requires */*.spec);do B=$(dirname $S);(cd $B && get_dok);done)
# DOKS="a2e_conkeror_pub a2e_dtaus_pub a2e_hanzi_pub a2e_mailcrypt_pub a2e_pari_pub perl_appconfig_pub perl_cache_cache_pub perl_class_container_pub perl_class_data_inheritable_pub perl_class_errorhandler_pub perl_class_inner_pub perl_class_loader_pub perl_convert_ascii_armour_pub perl_convert_asn1_pub perl_convert_pem_pub perl_crypt_blowfish_pub perl_crypt_cast5_pub perl_crypt_cast5_pp_pub perl_crypt_cbc_pub perl_crypt_des_ede3_pub perl_crypt_des_pub perl_crypt_dsa_pub perl_crypt_idea_pub perl_crypt_openpgp_pub perl_crypt_primes_pub perl_crypt_random_pub perl_crypt_rijndael_pub perl_crypt_ripemd160_pub perl_crypt_rsa_pub perl_crypt_twofish_pub perl_data_buffer_pub perl_data_dumper_pub perl_datetime_format_mail_pub perl_datetime_format_w3cdtf_pub perl_datetime_locale_pub perl_datetime_pub perl_datetime_timezone_pub perl_devel_stacktrace_pub perl_devel_symdump_pub perl_email_abstract_pub perl_email_filter_pub perl_email_simple_pub perl_error_pub perl_exception_class_pub perl_extutils_autoinstall_pub perl_html_mason_pub perl_io_stty_pub perl_list_moreutils_pub perl_mail_box_pub perl_math_pari_pub perl_mime_types_pub perl_module_install_pub perl_net_ping_pub perl_ole_storage_lite_pub"
DOKS="mktdir perl_a2e_pub a2e_bin"
{ test /repos || sudo ln -s /ul/repos /; } &&
cd /repos &&
{ test -d $REPO || mkdir $REPO; } &&
{ sudo rm -fv /repo || sudo ln -s /repos/$REPO /repo; } &&
cd /repos/$LAST && { for SUB in *;do (cd $SUB && { test -e /repo/$SUB || mkdir /repo/$SUB; } && test -r Makefile && { test -r /repo/$SUB/Makefile || sed -e "s|$LAST|$REPO|g" Makefile > /repo/$SUB/Makefile; }; );done; };
cd /repo && for SUB1 in *;do (cd $SUB1 && for SUB2 in repodata src noarch i586;do test -d $SUB2 || mkdir $SUB2;done);done;
# for DOK in $DOKS;do (cd $(dokdir $DOK) && make repo);done;

#EOF
