source: trunk/_ADMIN/create-main-dev-package.sh@ 110035

Last change on this file since 110035 was 110035, checked in by hbfl, 3 months ago

create-main-dev-package.sh: drop ldconfig

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 35.3 KB
Line 
1#!/usr/bin/sh
2#----------------------------------------------------------------------------
3# create-main-dev-package.sh - creates an eisfair-package
4#
5# Creation : 2007-04-19 hbfl
6# Last Update: $Id: create-main-dev-package.sh 110035 2024-03-30 13:58:45Z hbfl $
7#
8# Copyright (c) 2007-2016 the eisfair team, team(at)eisfair(dot)org
9#
10# Usage : create-main-dev-package.sh
11#
12# -p , --package PACKAGE
13# -v , --version Version [Version from original package,
14# like -> 0.6.3]
15# -s , --section Section
16# -d , --dev create also Developer package
17# -a , --static create also Developer and static package
18# -od , --only-dev create only the dev package
19# -oa , --only-static create only the static package
20#
21# create multi package folder
22#
23# -mm , --multi-main create multiple folder with ',' separated
24# -md , --multi-dev create multiple folder with ',' separated
25# -ma , --multi-static create multiple folder with ',' separated
26#
27# -m64 create eisfair-64 folder
28#
29# -vs , --version-separator value
30# version separator
31# u => use underline (_)
32# c => use colon (:)
33# Example:
34# -vs u => bin_rsyslogd_8_30_0
35# -vs c => bin_rsyslogd:8_30_0
36#
37# Example: ${0} -p urt -v 3.1b -s utils
38# ${0} -mm mysql,libmysql -md libmysql -p mysql -v 5.1.77 -s database
39#
40# This program is free software; you can redistribute it and/or modify
41# it under the terms of the GNU General Public License as published by
42# the Free Software Foundation; either version 2 of the License, or
43# (at your option) any later version.
44#----------------------------------------------------------------------------
45
46#exec 2> main-package-trace$$.log
47#set -x
48
49
50# set default value
51base_version='3.4.4'
52glibc_version='3.4.2'
53author='the eisfair team, team(at)eisfair(dot)org'
54
55
56# ---------------------------------------------------------------------------
57# ask: get answer
58# ---------------------------------------------------------------------------
59ask()
60{
61 echo -n "$1 (y/n)? "
62 read a
63 case "$a" in
64 y | Y | yes) a=y; ;;
65 n | N | no) a=n; ;;
66 esac
67}
68
69# ---------------------------------------------------------------------------
70# create folder
71# ---------------------------------------------------------------------------
72create_folder()
73{
74 local package=${1}
75 local version="$(echo ${2} | tr '.-' '_')"
76 local build=${3}
77
78 case ${build} in
79 main)
80 bin_folder="${package} main"
81 folder_list="${package}"
82 ;;
83 dev)
84 bin_folder="${package}_dev dev"
85 folder_list="${package}-dev"
86 ;;
87 static)
88 bin_folder="${package}_dev_static static"
89 folder_list="${package}-dev-static"
90 ;;
91 *-dev)
92 bin_folder="${build%-dev}_dev dev"
93 folder_list="${build}"
94 ;;
95 *-static)
96 bin_folder="${build%-dev-static}_dev_static static"
97 folder_list="${build}"
98 ;;
99 *)
100 bin_folder="${build} main"
101 folder_list="${build}"
102 ;;
103 esac
104
105 main="_ADMIN
106 usr/lib${eis_version}"
107
108 dev="_ADMIN
109 usr/lib${eis_version}
110 usr/include"
111
112 static="_ADMIN
113 usr/lib${eis_version}"
114
115
116 echo "${bin_folder}" |
117 while read folder subfolder
118 do
119 folder=$(echo ${folder} | tr '.-' '_')
120
121 mkdir -p -m 0755 ${start_dir}/${section}/${package}/${eis_bin}bin_${folder}${v_sep}${version}
122
123 for f in $(eval "echo \$${subfolder}")
124 do
125 mkdir -p -m 0755 ${start_dir}/${section}/${package}/${eis_bin}bin_${folder}${v_sep}${version}/${f}
126 done
127
128 # create empty files.list
129 touch ${start_dir}/${section}/${package}/${eis_bin}bin_${folder}${v_sep}${version}/_ADMIN/${folder_list}-files.txt
130
131 done
132}
133
134# ---------------------------------------------------------------------------
135# create eis folder
136# ---------------------------------------------------------------------------
137create_eis_folder()
138{
139 local package=${1}
140 local build=${2}
141 local eis_folder
142
143 case ${build} in
144 main)
145 eis_folder="eis${eis_version} eis"
146 folder_list="${package}"
147 ;;
148 dev)
149 eis_folder="eis${eis_version}_dev eis"
150 folder_list="${package}-dev"
151 ;;
152 static)
153 eis_folder="eis${eis_version}_dev_static eis"
154 folder_list="${package}-dev-static"
155 ;;
156 *-dev)
157 eis_folder="eis${eis_version}_$(echo "${build}" | tr '-' '_') eis"
158 folder_list="${build}"
159 ;;
160 *-static)
161 eis_folder="eis${eis_version}_$(echo "${build}" | tr '-' '_') eis"
162 folder_list="${build}"
163 ;;
164 *)
165 eis_folder="eis${eis_version}_$(echo "${build}" | tr '-' '_') eis"
166 folder_list="${build}"
167 ;;
168 esac
169
170 eis='_ADMIN
171 tmp
172 var/install/deinstall
173 var/install/packages'
174
175 echo "${eis_folder}" |
176 while read folder subfolder
177 do
178 mkdir -p -m 0755 ${start_dir}/${section}/${package}/${folder}
179
180 for f in $(eval "echo \$${subfolder}")
181 do
182 mkdir -p -m 0755 ${start_dir}/${section}/${package}/${folder}/${f}
183 done
184
185 # create empty files.list
186 touch ${start_dir}/${section}/${package}/${folder}/_ADMIN/${folder_list}-files.txt
187 done
188}
189
190# ---------------------------------------------------------------------------
191# create scripts
192# ---------------------------------------------------------------------------
193create_scripts()
194{
195 local package=${1}
196 local version="$(echo ${2} | tr '_-' '.')"
197 local f_version="$(echo ${2} | tr '.-' '_')"
198 local build=${3}
199 local pkg
200 local eis_folder
201
202 cd ${start_dir}/${section}/${package}
203
204
205 # populate eis scripts
206 case ${build} in
207 main)
208 pkg=${package}
209 eis_folder=eis${eis_version}
210 sec=${section}
211 short='Library'
212 do_action='main'
213 ;;
214 dev)
215 pkg=${package}-dev
216 eis_folder=eis${eis_version}_dev
217 sec='devel'
218 short='HEADER'
219 do_action='dev'
220 info_line='Note:'
221 info_line1='This package contains development libraries and header files'
222 info_line2='needed to compile and link programs that use XXXX.'
223 ;;
224 static)
225 pkg=${package}-dev-static
226 eis_folder=eis${eis_version}_dev_static
227 sec='devel'
228 short='STATIC-Library'
229 do_action='dev'
230 info_line='Note:'
231 info_line1='This package contains static development library files needed to'
232 info_line2='compile and link programs that use XXXX statically linked.'
233 ;;
234 *-dev)
235 pkg=${build}
236 eis_folder=eis${eis_version}_$(echo "${build}" | tr '-' '_')
237 sec='devel'
238 short='HEADER'
239 do_action='dev'
240 info_line='Note:'
241 info_line1='This package contains development libraries and header files'
242 info_line2='needed to compile and link programs that use XXXX.'
243 ;;
244 *-static)
245 pkg=${build}
246 eis_folder=eis${eis_version}_$(echo "${build}" | tr '-' '_')
247 sec='devel'
248 short='STATIC-Library'
249 do_action='dev'
250 info_line='Note:'
251 info_line1='This package contains static development library files needed to'
252 info_line2='compile and link programs that use XXXX statically linked.'
253 ;;
254 *)
255 pkg=${build}
256 eis_folder=eis${eis_version}_$(echo "${build}" | tr '-' '_')
257 sec=${section}
258 short='Library'
259 do_action='main'
260 ;;
261 esac
262
263
264
265 # populate var/install/packages/$package info file
266 cat >${eis_folder}/var/install/packages/${pkg} <<EOFG
267<package>
268<name>${pkg}</name>
269<short>${short}: ${pkg}</short>
270<version>0.0.1</version>
271<date>${DATUM}</date>
272<system>eisfair-${eis_version:-1}</system>
273<author>${author}</author>
274<status>unstable</status>
275<section>${sec}</section>
276<require-package>glibc ${glibc_version}</require-package>
277<description>
278Internal Program Version: ${package} ${version}
279
280${info_line}
281${info_line1}
282${info_line2}
283
284
285</description>
286</package>
287EOFG
288
289 chmod 0644 ${eis_folder}/var/install/packages/${pkg}
290
291
292
293 # populate tmp/install.sh
294 print_gpl "/tmp/install.sh - ${pkg} installation" >${eis_folder}/tmp/install.sh
295 cat >>${eis_folder}/tmp/install.sh <<EOFG
296# set package name
297package_name=${pkg}
298
299
300exit 0
301# ---------------------------------------------------------------------------
302# end
303# ---------------------------------------------------------------------------
304EOFG
305
306 chmod 0755 ${eis_folder}/tmp/install.sh
307
308
309
310 # populate tmp/preinstall.sh
311 print_gpl "/tmp/preinstall.sh - ${pkg} preinstallation" >${eis_folder}/tmp/preinstall.sh
312 cat >>${eis_folder}/tmp/preinstall.sh <<EOFG
313# set package name
314package_name=${pkg}
315
316
317exit 0
318# ---------------------------------------------------------------------------
319# end
320# ---------------------------------------------------------------------------
321EOFG
322
323 chmod 0755 ${eis_folder}/tmp/preinstall.sh
324
325
326
327 # populate var/install/deinstall
328 print_gpl "/var/install/deinstall/${pkg} - deinstall script" >${eis_folder}/var/install/deinstall/${pkg}
329 cat >>${eis_folder}/var/install/deinstall/${pkg} <<EOFG
330# set package name
331package_name=${pkg}
332
333# check for update is given
334if [ "\${1}" = "--update" ]
335then
336 update=true
337fi
338
339exit 0
340# ---------------------------------------------------------------------------
341# end
342# ---------------------------------------------------------------------------
343EOFG
344
345 chmod 0600 ${eis_folder}/var/install/deinstall/${pkg}
346
347
348
349# ---------------------------------------------------------------------------
350# scripts for _ADMIN
351# ---------------------------------------------------------------------------
352
353 # list pack folder
354 package_folder=$(echo "${bin_folder% *}" | tr '.-' '_')
355
356
357
358 cat >_ADMIN/${eis_script}${pkg} <<EOFG
359#----------------------------------------------------------------------------
360# ${pkg} - list of all dir's of package '${pkg}'
361#
362# Creation : ${DATUM} $(whoami)
363# Last update: \$Id\$
364#----------------------------------------------------------------------------
365${eis_bin}bin_${package_folder}${v_sep}${f_version}
366${eis_folder}
367EOFG
368
369 chmod 0644 _ADMIN/${eis_script}${pkg}
370
371 # added to package-list
372 # check if file package-list exists
373 if [ -f _ADMIN/package-list ]
374 then
375 # check if line ${pkg} already listed
376 if ! grep -qw "^${pkg}$" _ADMIN/package-list
377 then
378 echo "${pkg}" >> _ADMIN/package-list
379 fi
380 else
381 echo "${pkg}" >> _ADMIN/package-list
382 fi
383 chmod 0644 _ADMIN/package-list
384
385 # do script
386 cat >_ADMIN/_do_${eis_script}${pkg} <<EOFG
387#!/usr/bin/sh
388#----------------------------------------------------------------------------
389# _do_${pkg} - joblist to do befor mktarball.sh work
390#
391# Creation : ${DATUM} $(whoami)
392# Last update: \$Id\$
393#----------------------------------------------------------------------------
394
395#exec 2> ${pkg}-trace\$\$.log
396#set -x
397
398# backup path
399call_dir=\$(pwd)
400
401# set package name
402package_name="${pkg}"
403package_folder="${package}"
404package_internal_name="${package}"
405package_lib=false
406lib_folder=no
407eis_folder=${eis_folder}
408${bin_prefix}
409
410# change into \$package
411cd ${section}/\${package_folder}/_ADMIN
412
413. ../../../_ADMIN/_do_${do_action}_package
414
415# change to old path from backup
416cd \${call_dir}
417EOFG
418
419 chmod 0755 _ADMIN/_do_${eis_script}${pkg}
420
421
422
423
424standort=$(pwd)
425
426 # add folder and set svn props
427 svn -q add --force ${eis_folder} _ADMIN
428
429 svn -q propset -R svn:keywords "Id" ${eis_folder} _ADMIN
430 svn -q propset -R svn:eol-style "native" ${eis_folder} _ADMIN
431
432
433 case ${build} in
434 main)
435
436 main_entry=$(grep -w "${section} -" ${start_dir}/_ADMIN/folder-list.txt)
437 sed -i -e"/^${main_entry}/a\\" -e"${eis_script}${package}:${section}:${package}" ${start_dir}/_ADMIN/folder-list.txt
438
439 sed -i -e"/^exit 0/i\\" -e"# --------------------------------------------------------------------------- \n\
440# stop for update only \n\
441# --------------------------------------------------------------------------- \n\
442if \${update:-false} \n\
443then \n\
444 exit 0\n\
445fi\n\ " ${start_dir}/${section}/${package}/eis${eis_version}/var/install/deinstall/${package}
446
447 ;;
448 dev)
449
450 main_entry=$(grep "^${eis_script}${package}:" ${start_dir}/_ADMIN/folder-list.txt)
451
452 if [ -z "${main_entry}" ]
453 then
454 main_entry=$(grep -w "${section} -" ${start_dir}/_ADMIN/folder-list.txt)
455 fi
456 sed -i -e"/^${main_entry}/a\\" -e"${eis_script}${package}-dev:${section}:${package}" ${start_dir}/_ADMIN/folder-list.txt
457
458 sed -i -e"/^exit 0/i\\" -e"# --------------------------------------------------------------------------- \n\
459# stop for update only \n\
460# --------------------------------------------------------------------------- \n\
461if \${update:-false} \n\
462then \n\
463 exit 0\n\
464fi\n\ " ${start_dir}/${section}/${package}/eis${eis_version}/var/install/deinstall/${package}
465 ;;
466 static)
467
468 main_entry=$(grep "^${eis_script}${package}-dev:" ${start_dir}/_ADMIN/folder-list.txt)
469
470 if [ -z "${main_entry}" ]
471 then
472 main_entry=$(grep -w "${section} -" ${start_dir}/_ADMIN/folder-list.txt)
473 fi
474 sed -i -e"/^${main_entry}/a\\" -e"${eis_script}${package}-dev-static:${section}:${package}" ${start_dir}/_ADMIN/folder-list.txt
475
476
477
478 sed -i -e"/^exit 0/i\\" -e"# --------------------------------------------------------------------------- \n\
479# stop for update only \n\
480# --------------------------------------------------------------------------- \n\
481if \${update:-false} \n\
482then \n\
483 exit 0\n\
484fi\n\
485\n\ " ${start_dir}/${section}/${package}/eis${eis_version}_dev/var/install/deinstall/${package}-dev
486
487 ;;
488
489 *-dev)
490
491 main_entry=$(grep "^${eis_script}${build%-dev}:" ${start_dir}/_ADMIN/folder-list.txt)
492
493 if [ -z "${main_entry}" ]
494 then
495 main_entry=$(grep -w "${section} -" ${start_dir}/_ADMIN/folder-list.txt)
496 fi
497 sed -i -e"/^${main_entry}/a\\" -e"${eis_script}${build}:${section}:${package}" ${start_dir}/_ADMIN/folder-list.txt
498
499
500 if [ -f "${start_dir}/${section}/${package}/eis${eis_version}_$(echo ${build%-dev} | tr '-' '_')/var/install/deinstall/${build%-dev}" ]
501 then
502
503 sed -i -e"/^exit 0/i\\" -e"# --------------------------------------------------------------------------- \n\
504# stop for update only \n\
505# --------------------------------------------------------------------------- \n\
506if \${update:-false} \n\
507then \n\
508 exit 0\n\
509fi\n\
510\n\ " ${start_dir}/${section}/${package}/eis${eis_version}_$(echo ${build%-dev} | tr '-' '_')/var/install/deinstall/${build%-dev}
511 fi
512
513 ;;
514
515
516 *-static)
517
518 main_entry=$(grep "^${eis_script}${build%-static}:" ${start_dir}/_ADMIN/folder-list.txt)
519
520 if [ -z "${main_entry}" ]
521 then
522 main_entry=$(grep -w "${section} -" ${start_dir}/_ADMIN/folder-list.txt)
523 fi
524 sed -i -e"/^${main_entry}/a\\" -e"${eis_script}${build}:${section}:${package}" ${start_dir}/_ADMIN/folder-list.txt
525
526
527
528 sed -i -e"/^exit 0/i\\" -e"# --------------------------------------------------------------------------- \n\
529# stop for update only \n\
530# --------------------------------------------------------------------------- \n\
531if \${update:-false} \n\
532then \n\
533 exit 0\n\
534fi\n\
535\n\ " ${start_dir}/${section}/${package}/eis${eis_version}_$(echo ${build%-static} | tr '-' '_')/var/install/deinstall/${build%-static}
536 ;;
537
538 *)
539
540 main_entry=$(grep -w "${section} -" ${start_dir}/_ADMIN/folder-list.txt)
541 sed -i -e"/^${main_entry}/a\\" -e"${eis_script}${build}:${section}:${package}" ${start_dir}/_ADMIN/folder-list.txt
542
543 ;;
544 esac
545
546
547 # create eis /_ADMIN/file-list
548 ${start_dir}/_ADMIN/create-list.sh -q -p ${eis_folder} ${eis_script}${pkg}
549
550 # delete backup file-list
551 rm -f ${start_dir}/${section}/${package}/${eis_folder}/_ADMIN/${pkg}-files.txt.backup
552
553
554 cd ${start_dir}
555
556}
557
558# ---------------------------------------------------------------------------
559# gpl header
560# ---------------------------------------------------------------------------
561print_gpl()
562{
563echo "#!/usr/bin/sh"
564echo "#----------------------------------------------------------------------------"
565echo "# $1"
566echo "#"
567echo "# Creation : ${DATUM} $(whoami)"
568echo "# Last update: \$Id\$"
569echo "#"
570echo "# Copyright (c) $(date +%Y)-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net"
571echo "#"
572echo "# This program is free software; you can redistribute it and/or modify"
573echo "# it under the terms of the GNU General Public License as published by"
574echo "# the Free Software Foundation; either version 2 of the License, or"
575echo "# (at your option) any later version."
576echo "#----------------------------------------------------------------------------"
577echo
578}
579
580# ---------------------------------------------------------------------------
581# create admin scripts
582# ---------------------------------------------------------------------------
583create_admin_scripts()
584{
585
586 local package=${1}
587 local version=${2}
588 local f_version="$(echo ${2} | tr '.-' '_')"
589 local build=${3}
590
591
592
593print_gpl "${start_dir}/${section}/${package}/_ADMIN/${package}-folder.sh - create ${package} folder" >${start_dir}/${section}/${package}/_ADMIN/${package}-folder.sh
594cat >>${start_dir}/${section}/${package}/_ADMIN/${package}-folder.sh <<EOFG
595#----------------------------------------------------------------------------
596#
597# usage
598# ${package}-folder.sh
599# -v, --version set package version
600# -w, --work [create|add|list]
601# -p, --package [optional] if multi binarie package
602#
603# -m64 create eisfair-64 folder
604#
605# Example: ${package}-folder.sh -v 1.2.16 -w create
606#
607#----------------------------------------------------------------------------
608
609#exec 2> ${package}-folder-trace\$\$.log
610#set -x
611
612
613# ---------------------------------------------------------------------------
614# create folder
615# ---------------------------------------------------------------------------
616create_folder()
617{
618 local version="\$(echo \${1} | tr '.-' '_')"
619 local build=\${2}
620 local package=\${3}
621
622 case \${build} in
623 *-dev)
624 bin_folder="\${build%-dev}_dev dev"
625 folder_list="\${package:-\${build}}"
626 ;;
627 *-static)
628 bin_folder="\${build%-dev-static}_dev_static static"
629 folder_list="\${package:-\${build}}"
630 ;;
631 *)
632 bin_folder="\${build} main"
633 folder_list="\${package:-\${build}}"
634 ;;
635 esac
636
637 main="_ADMIN
638 usr/lib\${eis_version}"
639
640 dev="_ADMIN
641 usr/lib\${eis_version}
642 usr/include"
643
644 static="_ADMIN
645 usr/lib\${eis_version}"
646
647
648 echo "\${bin_folder}" |
649 while read folder subfolder
650 do
651 folder=\$(echo \${folder} | tr '.-' '_')
652
653 if [ -d ../\${eis_bin}bin_\${folder}${v_sep}\${version} ]
654 then
655 echo " ../\${eis_bin}bin_\${folder}${v_sep}\${version} already exist, creation aborted." >&2
656 exit 1
657 else
658 mkdir -p -m 0755 ../\${eis_bin}bin_\${folder}${v_sep}\${version}
659
660 for f in \$(eval "echo \\$\${subfolder}")
661 do
662 mkdir -p -m 0755 ../\${eis_bin}bin_\${folder}${v_sep}\${version}/\${f}
663 done
664
665 # create empty files.list
666 touch ../\${eis_bin}bin_\${folder}${v_sep}\${version}/_ADMIN/\${folder_list}-files.txt
667 fi
668 done
669}
670
671#----------------------------------------------------------------------------
672# add folder
673#----------------------------------------------------------------------------
674add_folder()
675{
676 local version="\$(echo \${1} | tr '.-' '_')"
677 local build=\${2}
678 local package=\${3}
679
680 case \${build} in
681 *-dev)
682 bin_folder="\${build%-dev}_dev dev"
683 folder_list="\${package:-\${build}}"
684 ;;
685 *-static)
686 bin_folder="\${build%-dev-static}_dev_static static"
687 folder_list="\${package:-\${build}}"
688 ;;
689 *)
690 bin_folder="\${build} main"
691 folder_list="\${package:-\${build}}"
692 ;;
693 esac
694
695 echo "\${bin_folder}" |
696 while read folder subfolder
697 do
698 folder=\$(echo \${folder} | tr '.-' '_')
699
700 # Strip ELF binaries
701 for filename in \$(find ../\${eis_bin}bin_\${folder}${v_sep}\${version} \\
702 -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \\
703 -exec file {} \; |
704 grep -v "^../bin_\${folder}${v_sep}\${version}/\?usr/lib/debug" |
705 grep -v ' shared object,' |
706 grep -v '/lib/modules/' |
707 sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p')
708 do
709 echo "Strip: \${filename}"
710 if echo "\${filename}" | grep -q '\.so'
711 then
712 strip --strip-unneeded "\${filename}"
713 chmod 0644 "\${filename}"
714 else
715 strip -R .note -R .comment "\${filename}"
716 fi
717 done
718
719 # Strip ELF shared objects
720 # Please note we don't restrict our search to executable files because
721 # our libraries are not (should not be, at least) +x.
722 for filename in \$(find ../\${eis_bin}bin_\${folder}${v_sep}\${version} \\
723 -type f -a \\
724 -exec file {} \; |
725 grep -v "^../bin_\${folder}${v_sep}\${version}/\?usr/lib/debug" |
726 grep ' shared object,' |
727 sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p')
728 do
729 echo "Strip: \${filename}"
730 strip --strip-unneeded "\${filename}"
731 if echo "\${filename}" | grep -q '\.so'
732 then
733 chmod 0644 "\${filename}"
734 fi
735 done
736
737 if ! "\${no_checkin:-false}"
738 then
739 svn -q add --force ../\${eis_bin}bin_\${folder}${v_sep}\${version}
740
741 svn -q propset svn:keywords "Id" ../\${eis_bin}bin_\${folder}${v_sep}\${version}/_ADMIN/\${folder_list}-files.txt
742 svn -q propset svn:eol-style "native" ../\${eis_bin}bin_\${folder}${v_sep}\${version}/_ADMIN/\${folder_list}-files.txt
743 fi
744 done
745}
746
747# ---------------------------------------------------------------------------
748# list folder
749# ---------------------------------------------------------------------------
750list_folder()
751{
752 local version="\$(echo \${1} | tr '.-' '_')"
753 local build=\${2}
754 local package=\${3}
755
756 case \${build} in
757 *-dev)
758 bin_folder="\${build%-dev}_dev dev"
759 folder_list="\${package:-\${build}}"
760 ;;
761 *-static)
762 bin_folder="\${build%-dev-static}_dev_static static"
763 folder_list="\${package:-\${build}}"
764 ;;
765 *)
766 bin_folder="\${build} main"
767 folder_list="\${package:-\${build}}"
768 ;;
769 esac
770
771 package_path=\$(pwd | sed 's|^.*/trunk/||; s|_ADMIN||')
772
773 echo "\${bin_folder}" |
774 while read folder subfolder
775 do
776 folder=\$(echo \${folder} | tr '.-' '_')
777
778 admin_dir="../../../_ADMIN"
779
780 \${admin_dir}/create-list.sh -f -q -p \${eis_bin}bin_\${folder}${v_sep}\${version} \${eis_script}\${folder_list}
781
782 rm -f ../\${eis_bin}bin_\${folder}${v_sep}\${version}/_ADMIN/\${folder_list}-files.txt.backup
783
784 if "\${no_checkin:-false}" &&
785 [ -f \${admin_dir}/_user.copy_dir ]
786 then
787 . \${admin_dir}/_user.copy_dir
788 fi
789 done
790}
791
792# ---------------------------------------------------------------------------
793# main
794# ---------------------------------------------------------------------------
795
796work='' # create|add|list
797version=''
798package=''
799eis_bin=''
800eis_script=''
801no_checkin=false
802
803usage()
804{
805cat <<EOF
806
807 Usage:
808 \${0}
809 -v, --version set library version
810 -w, --work [create|add|list]
811 create -> the folder and files
812 add -> svn add folder and files set props
813 list -> create-list.sh work in this place-
814 -p, --package [optional] if multi binarie package
815
816 -m64 create eisfair-64 folder
817
818 Example: \${0}-folder.sh -v 1.2.16 -w create
819
820EOF
821}
822
823
824case \${#} in
825 0)
826 usage
827 exit 1
828 ;;
829esac
830
831
832
833### read parameters
834while [ \$# -ne 0 ]
835do
836 case \${1} in
837 -v|--version)
838 version="\${2}"
839 shift; shift
840 ;;
841 -w|--work)
842 work="\${2}"
843 shift; shift
844 ;;
845 -p|--package)
846 package="\${2}"
847 shift; shift
848 ;;
849 -m64)
850 eis_version='64'
851 eis_bin='eis64_'
852 eis_script='eis64+'
853 shift
854 ;;
855 *)
856 usage
857 exit 1
858 ;;
859 esac
860done
861
862if [ -z "\${version}" ]
863then
864 echo
865 echo "No version is given, ship aborted!"
866 usage
867
868 exit 1
869fi
870
871if [ -f ./no_checkin ]
872then
873 no_checkin=true
874fi
875
876
877folder_create=\$(cat ./package-list | grep -v '^#')
878
879case \${work} in
880 create)
881 for build in \${folder_create}
882 do
883 create_folder "\${version}" "\${build}" \${package}
884 done
885 ;;
886
887 add)
888 for build in \${folder_create}
889 do
890 add_folder "\${version}" "\${build}" \${package}
891 done
892 ;;
893
894 list)
895 for build in \${folder_create}
896 do
897 list_folder "\${version}" "\${build}" \${package}
898 done
899 ;;
900
901 *)
902 echo "only '-w create|add|list' allowed"
903 ;;
904esac
905
906
907# ---------------------------------------------------------------------------
908# end
909# ---------------------------------------------------------------------------
910EOFG
911
912chmod 0755 ${start_dir}/${section}/${package}/_ADMIN/${package}-folder.sh
913
914mkdir -p "${start_dir}/${section}/${package}/$(echo ${version} | tr '.' '_')/"{x86_32,x86_64}
915
916mkdir -p "${start_dir}/${section}/${package}/_ADMIN/binaries_howto"
917
918build_info="${start_dir}/${section}/${package}/_ADMIN/binaries_howto/build_${package}.txt"
919
920if [ ! -f "${build_info}" ]
921then
922
923 cat > ${build_info} <<EOFG
924#----------------------------------------------------------------------------
925# build_${package}.txt - how to build the ${package} binaries and create folder and packages
926#
927# Creation : ${DATUM} $(whoami)
928# Last update: \$Id\$
929#
930# !!! this is not a script but an step-by-step howto !!!
931#----------------------------------------------------------------------------
932exit 1
933
934### download the source code from the internet, e.g.
935# http:// ${package}
936
937# ${package}-${version}.tar.bz2
938
939### extract file in a temporary location
940tar -xf ${package}-${version}.tar.bz2
941
942cd ${package}-${version}
943
944### build
945
946export CFLAGS='-O2 -march=i586'
947export CXXFLAGS="\${CFLAGS}"
948
949
950./configure \\
951--prefix=/usr \\
952--build=i586-pc-linux-gnu \\
953--host=i586-pc-linux-gnu
954
955make
956make check
957make DESTDIR=/public/${package} install
958
959# strip files/binarys
960for filename in \$(find /public/${package}/usr/{bin/*,lib/*.so.*} -type f)
961do
962 echo \$filename
963 strip -R .note -R .comment "\$filename"
964done
965
966# copy files
967cp *** <svn-root>/lib/${package}/bin_**_${package}${v_sep}${f_version}/***
968
969
970#----------------------------------------------------------------------------
971
972create folder
973
974Um die Folder im Hauptverszeichnis zu erstellen gibt es das Script '${package}-folder.sh'
975unter ${package}/_ADMIN/
976
977mit
978${package}-folder.sh -v ${version} -w create
979
980 wird die folder Struktur fuer die lib Version ${version} erstellt
981
982 nun koennen die files aus dem compilat eingefuegt werden.
983
984mit
985${package}-folder.sh -v ${version} -w add
986
987 wird ein svn add auf die erzeugten Folder durchgefuehrt.
988
989mit
990${package}-folder.sh -v ${version} -w list
991
992 wird fuer jeden Folder die files-list.txt erzeugt, add muss zwingend
993 vorher ausgefuehrt worden sein
994
995
996In den eis und eis_dev Foldern muessen keine Anpassungen vorgenommen werden.
997Diese Anpassungen erfolgen beim packen der packages durch mktarball.sh
998mit den _do_ Scripten unter _ADMIN automatisch.
999
1000In den Pack-Scripten unter _ADMIN muss dann noch die Pfadangabe geaendert werden,
1001auf den soeben erzeugten Pfad und ein commit ausgefuehrt werden.
1002
1003
1004Nach dem checkout auf eisler koennen nun die packages erzeugt werden.
1005
1006die wichtigsten Parameter fuer mktarball.sh sind dann
1007
1008 -setdate now
1009 -setversion \${version}
1010mktarball.sh - home -setdate now -setversion [version angeben] ${package} ${package}-dev
1011
1012duch die Angabe von -home werden die packages in die
1013Folder Struktur /home/user/public_html/packages/ kopiert und koennen von da
1014direkt auf Pack-Eis geladen werden.
1015
1016wichtig ist noch, dass unbedingt die 'lib' Version zuerst gebaut werden muss, da fuer
1017die 'dev' Version Informationen aus der 'lib' Info Datei gelesen werden.
1018EOFG
1019
1020 chmod 0644 ${build_info}
1021fi
1022
1023
1024
1025# add folder and set svn props
1026svn -q add --force ${start_dir}/${section}/${package}/_ADMIN/
1027
1028svn -q propset -R svn:keywords "Id" ${start_dir}/${section}/${package}/_ADMIN
1029svn -q propset -R svn:eol-style "native" ${start_dir}/${section}/${package}/_ADMIN
1030
1031}
1032
1033# ---------------------------------------------------------------------------
1034# main
1035# ---------------------------------------------------------------------------
1036
1037rtc=0
1038
1039package=''
1040version=''
1041section=''
1042DATUM=$(date +%Y-%m-%d)
1043_dev=false
1044_dev_only=false
1045_static=false
1046_static_only=false
1047_main=true
1048eis_version=''
1049eis_bin=''
1050eis_script=''
1051bin_prefix=''
1052
1053build_package=''
1054multi=false
1055
1056usage()
1057{
1058cat <<EOF
1059
1060 Usage:
1061 ${0}
1062 -p , --package PACKAGE
1063 -v , --version Version [Version from original package,
1064 like -> 0.6.3]
1065 -s , --section Section
1066 -d , --dev create also Developer package
1067 -a , --static create also Developer and static package
1068 -od , --only-dev create only the dev package
1069 -oa , --only-static create only the static package
1070
1071 create multi package folder
1072
1073 -mm , --multi-main create multiple folder with ',' separated
1074 -md , --multi-dev create multiple folder with ',' separated
1075 -ma , --multi-static create multiple folder with ',' separated
1076
1077 -m64 create eisfair-64 folder
1078
1079 Example: ${0} -p urt -v 3.1b -s utils
1080 ${0} -mm mysql,libmysql -md libmysql -p mysql -v 5.1.77 -s database
1081
1082EOF
1083}
1084
1085
1086if [ $# -lt 6 ]
1087then
1088 usage
1089 exit 1
1090fi
1091
1092# default version separator
1093v_sep=':'
1094
1095while [ ${#} -ne 0 ]
1096do
1097 case ${1} in
1098 -p|--package)
1099 package="${2}"
1100 shift 2
1101 ;;
1102 -v|--version)
1103 version="${2}"
1104 shift 2
1105 ;;
1106 -s|--section)
1107 section="${2}"
1108 shift 2
1109 ;;
1110 -d|--dev)
1111 _dev=true
1112 shift
1113 ;;
1114 -a|--static)
1115 _dev=true
1116 _static=true
1117 shift
1118 ;;
1119 -od|-do|--only-dev)
1120 _dev_only=true
1121 _dev=true
1122 _main=false
1123 shift
1124 ;;
1125 -oa|-ao|--only-static)
1126 _static_only=true
1127 _static=true
1128 _main=false
1129 shift
1130 ;;
1131 -mm|--multi-main)
1132 multi=true
1133 build_package="$(echo "${2}" | tr ',' ' ')"
1134 shift 2
1135 ;;
1136 -md|--multi-dev)
1137 multi=true
1138 b_package="$(echo "${2}" | tr ',' ' ')"
1139 shift 2
1140 for name in ${b_package}
1141 do
1142 build_package="${build_package} "${name}-dev
1143 done
1144 ;;
1145 -ma|--multi-static)
1146 multi=true
1147 b_package="$(echo "${2}" | tr ',' ' ')"
1148 shift 2
1149 for name in ${b_package}
1150 do
1151 build_package="${build_package} "${name}-dev-static
1152 done
1153 ;;
1154 -m64)
1155 eis_version='64'
1156 eis_bin='eis64_'
1157 eis_script='eis64+'
1158 bin_prefix="bin_prefix='eis64_'"
1159 shift
1160 ;;
1161 -vs)
1162 ver_sep="${2}"
1163 case "${ver_sep}" in
1164 u) v_sep='_'
1165 ;;
1166 c) v_sep=':'
1167 ;;
1168 *) echo "wrong or missing version separator (${ver_sep})"
1169 exit 1
1170 ;;
1171 esac
1172 shift 2
1173 ;;
1174 *)
1175 echo "unused parameter ${1}"
1176 exit 1
1177 ;;
1178 esac
1179done
1180
1181# get current directory
1182call_dir=$(pwd)
1183
1184# get start directory
1185start_dir=$(dirname $0)/..
1186cd $start_dir
1187start_dir=$(pwd)
1188
1189. ${start_dir}/_ADMIN/eislerlib
1190
1191# overwrite the default value with entry from _user.info
1192if [ -f ${start_dir}/_ADMIN/_user.info ]
1193then
1194 . ${start_dir}/_ADMIN/_user.info
1195fi
1196
1197# if folderlist eixt then check for package
1198folder_list=${start_dir}/_ADMIN/folder-list.txt
1199
1200
1201# check if list file exists
1202if [ ! -f ${folder_list} ]
1203then
1204 echo "file '${folder_list}' not found, creation aborted." >&2
1205 exit 1
1206fi
1207
1208
1209# create package
1210# check if package in folder-list exists
1211if ! ${multi:-false}
1212then
1213 # create standard package
1214 if ${_main}
1215 then
1216 if grep -q "^${eis_script}${package}:" ${folder_list}
1217 then
1218 # entry found
1219 echo "! ${eis_script}${package} already exists in '${folder_list}', creation aborted." >&2
1220 exit 1
1221 fi
1222 build_package=main
1223 fi
1224
1225 if ${_dev}
1226 then
1227 if grep -q "^${eis_script}${package}-dev:" ${folder_list}
1228 then
1229 # entry found
1230 echo "! ${eis_script}${package}-dev already exists in '${folder_list}', creation aborted." >&2
1231 exit 1
1232 fi
1233 build_package="${build_package} "dev
1234 fi
1235
1236 if ${_static}
1237 then
1238 if grep -q "^${eis_script}${package}-dev-static:" ${folder_list}
1239 then
1240 # entry found
1241 echo "! ${eis_script}${package}-dev-static already exists in '${folder_list}', creation aborted." >&2
1242 exit 1
1243 fi
1244 build_package="${build_package} "static
1245 fi
1246else
1247 for m_package in ${build_package}
1248 do
1249 if grep -q "^${eis_script}${m_package}:" ${folder_list}
1250 then
1251 # entry found
1252 echo "! ${eis_script}${m_package} already exists in '${folder_list}', creation aborted." >&2
1253 exit 1
1254 fi
1255 done
1256fi
1257
1258
1259## check if package directory exists
1260#if ${check_main}
1261#then
1262# folder="${section}/${package}"
1263# if [ -d ${folder} ]
1264# then
1265# # folder exist
1266# echo "! folder '${folder}' already exist, creation aborted." >&2
1267# exit 1
1268# fi
1269#fi
1270
1271if ! grep -qw "${section} -" ${start_dir}/_ADMIN/folder-list.txt
1272then
1273 echo "! section '${section}' does not exist, creation aborted." >&2
1274 exit 1
1275fi
1276
1277len_print_project=$((${#package} + ${#version} + ${#section} + 48))
1278
1279# set length of underline the output
1280underline=$(printf "%.${len_print_project}s" "=========================================================================")
1281
1282# output message
1283cat <<EOF
1284
1285 Ok, now I will create a eisfair '${section}' package '${package}' '${version}'
1286 ${underline}
1287
1288EOF
1289
1290
1291ask ' Continue? '
1292if [ "${a}" != "y" ]
1293then
1294 exit 1
1295fi
1296
1297
1298if [ ! -d ${start_dir}/${section}/${package} ]
1299then
1300 mkdir -p -m 0755 ${start_dir}/${section}/${package}
1301 mkdir -p -m 0755 ${start_dir}/${section}/${package}/_ADMIN/binaries_howto
1302 svn -q add ${start_dir}/${section}/${package}
1303fi
1304
1305# create package
1306for build in ${build_package}
1307do
1308 create_folder ${package} ${version} ${build}
1309
1310 create_eis_folder ${package} ${build}
1311
1312 create_scripts ${package} ${version} ${build}
1313
1314 create_admin_scripts ${package} ${version} ${build}
1315done
1316
1317#echo 'remove me when binarie checkin wonted' > ${start_dir}/${section}/${package}/_ADMIN/no_checkin
1318#svn -q add --force ${start_dir}/${section}/${package}/_ADMIN/no_checkin
1319
1320# return to previous directory
1321cd ${call_dir}
1322
1323exit ${rtc}
1324# ---------------------------------------------------------------------------
1325# end
1326# ---------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.