release.sh: Support mesa/glu
[xorg-util-modular.git] / release.sh
blob04c78cce3ce914e67c9f13849f94b22ae0519e01
1 #!/bin/bash
3 # Creates and upload a git module tarball
5 # Note on portability:
6 # This script is intended to run on any platform supported by X.Org.
7 # Basically, it should be able to run in a Bourne shell.
11 export LC_ALL=C
13 #------------------------------------------------------------------------------
14 # Function: check_local_changes
15 #------------------------------------------------------------------------------
17 check_local_changes() {
18 git diff --quiet HEAD > /dev/null 2>&1
19 if [ $? -ne 0 ]; then
20 echo ""
21 echo "Uncommitted changes found. Did you forget to commit? Aborting."
22 echo ""
23 echo "You can perform a 'git stash' to save your local changes and"
24 echo "a 'git stash apply' to recover them after the tarball release."
25 echo "Make sure to rebuild and run 'make distcheck' again."
26 echo ""
27 echo "Alternatively, you can clone the module in another directory"
28 echo "and run ./configure. No need to build if testing was finished."
29 echo ""
30 return 1
32 return 0
35 #------------------------------------------------------------------------------
36 # Function: check_option_args
37 #------------------------------------------------------------------------------
39 # perform sanity checks on cmdline args which require arguments
40 # arguments:
41 # $1 - the option being examined
42 # $2 - the argument to the option
43 # returns:
44 # if it returns, everything is good
45 # otherwise it exit's
46 check_option_args() {
47 option=$1
48 arg=$2
50 # check for an argument
51 if [ x"$arg" = x ]; then
52 echo ""
53 echo "Error: the '$option' option is missing its required argument."
54 echo ""
55 usage
56 exit 1
59 # does the argument look like an option?
60 echo $arg | $GREP "^-" > /dev/null
61 if [ $? -eq 0 ]; then
62 echo ""
63 echo "Error: the argument '$arg' of option '$option' looks like an option itself."
64 echo ""
65 usage
66 exit 1
70 #------------------------------------------------------------------------------
71 # Function: check_gpgkey
72 #------------------------------------------------------------------------------
74 # check if the gpg key provided is known/available
75 # arguments:
76 # $1 - the gpg key
77 # returns:
78 # if it returns, everything is good
79 # otherwise it exit's
80 check_gpgkey() {
81 arg=$1
83 $GPG --list-keys "$arg" &>/dev/null
84 if [ $? -ne 0 ]; then
85 echo ""
86 echo "Error: the argument '$arg' is not a known gpg key."
87 echo ""
88 usage
89 exit 1
93 #------------------------------------------------------------------------------
94 # Function: check_modules_specification
95 #------------------------------------------------------------------------------
97 check_modules_specification() {
99 if [ x"$MODFILE" = x ]; then
100 if [ x"${INPUT_MODULES}" = x ]; then
101 echo ""
102 echo "Error: no modules specified (blank command line)."
103 usage
104 exit 1
110 #------------------------------------------------------------------------------
111 # Function: generate_announce
112 #------------------------------------------------------------------------------
114 generate_announce()
116 cat <<RELEASE
117 Subject: [ANNOUNCE] $pkg_name $pkg_version
118 To: $list_to
119 Cc: $list_cc
121 `git log --no-merges "$tag_range" | git shortlog`
123 git tag: $tag_name
125 RELEASE
127 for tarball in $tarbz2 $targz $tarxz; do
128 cat <<RELEASE
129 https://$host_current/$section_path/$tarball
130 MD5: `$MD5SUM $tarball`
131 SHA1: `$SHA1SUM $tarball`
132 SHA256: `$SHA256SUM $tarball`
133 SHA512: `$SHA512SUM $tarball`
134 PGP: https://${host_current}/${section_path}/${tarball}.sig
136 RELEASE
137 done
140 #------------------------------------------------------------------------------
141 # Function: read_modfile
142 #------------------------------------------------------------------------------
144 # Read the module names from the file and set a variable to hold them
145 # This will be the same interface as cmd line supplied modules
147 read_modfile() {
149 if [ x"$MODFILE" != x ]; then
150 # Make sure the file is sane
151 if [ ! -r "$MODFILE" ]; then
152 echo "Error: module file '$MODFILE' is not readable or does not exist."
153 exit 1
155 # read from input file, skipping blank and comment lines
156 while read line; do
157 # skip blank lines
158 if [ x"$line" = x ]; then
159 continue
161 # skip comment lines
162 if echo "$line" | $GREP -q "^#" ; then
163 continue;
165 INPUT_MODULES="$INPUT_MODULES $line"
166 done <"$MODFILE"
168 return 0
171 #------------------------------------------------------------------------------
172 # Function: print_epilog
173 #------------------------------------------------------------------------------
175 print_epilog() {
177 epilog="======== Successful Completion"
178 if [ x"$NO_QUIT" != x ]; then
179 if [ x"$failed_modules" != x ]; then
180 epilog="======== Partial Completion"
182 elif [ x"$failed_modules" != x ]; then
183 epilog="======== Stopped on Error"
186 echo ""
187 echo "$epilog `date`"
189 # Report about modules that failed for one reason or another
190 if [ x"$failed_modules" != x ]; then
191 echo " List of failed modules:"
192 for mod in $failed_modules; do
193 echo " $mod"
194 done
195 echo "========"
196 echo ""
200 #------------------------------------------------------------------------------
201 # Function: process_modules
202 #------------------------------------------------------------------------------
204 # Loop through each module to release
205 # Exit on error if --no-quit was not specified
207 process_modules() {
208 for MODULE_RPATH in ${INPUT_MODULES}; do
209 if ! process_module ; then
210 echo "Error: processing module \"$MODULE_RPATH\" failed."
211 failed_modules="$failed_modules $MODULE_RPATH"
212 if [ x"$NO_QUIT" = x ]; then
213 print_epilog
214 exit 1
217 done
220 #------------------------------------------------------------------------------
221 # Function: get_section
222 #------------------------------------------------------------------------------
223 # Code 'return 0' on success
224 # Code 'return 1' on error
225 # Sets global variable $section
226 get_section() {
227 local module_url
228 local full_module_url
230 # Obtain the git url in order to find the section to which this module belongs
231 full_module_url=`git config --get remote.$remote_name.url | sed 's:\.git$::'`
232 if [ $? -ne 0 ]; then
233 echo "Error: unable to obtain git url for remote \"$remote_name\"."
234 return 1
237 # The last part of the git url will tell us the section. Look for xorg first
238 module_url=`echo "$full_module_url" | $GREP -o "xorg/.*"`
239 if [ $? -eq 0 ]; then
240 module_url=`echo $module_url | rev | cut -d'/' -f1,2 | rev`
241 else
242 # The look for mesa, xcb, etc...
243 module_url=`echo "$full_module_url" | $GREP -o -e "mesa/.*" -e "/xcb/.*" -e "/xkeyboard-config" -e "/nouveau/xf86-video-nouveau" -e "/libevdev" -e "/wayland/.*" -e "/evemu"`
244 if [ $? -eq 0 ]; then
245 module_url=`echo $module_url | cut -d'/' -f2,3`
246 else
247 echo "Error: unable to locate a valid project url from \"$full_module_url\"."
248 echo "Cannot establish url as one of xorg, mesa, xcb, xf86-video-nouveau, xkeyboard-config or wayland"
249 cd $top_src
250 return 1
254 # Find the section (subdirs) where the tarballs are to be uploaded
255 # The module relative path can be app/xfs, xserver, or mesa/drm for example
256 section=`echo $module_url | cut -d'/' -f1`
257 if [ $? -ne 0 ]; then
258 echo "Error: unable to extract section from $module_url first field."
259 return 1
262 if [ x"$section" = xmesa ]; then
263 section=`echo $module_url | cut -d'/' -f2`
264 if [ $? -ne 0 ]; then
265 echo "Error: unable to extract section from $module_url second field."
266 return 1
267 elif [ x"$section" != xdrm ] &&
268 [ x"$section" != xmesa ] &&
269 [ x"$section" != xglu ] &&
270 [ x"$section" != xdemos ]; then
271 echo "Error: section $section is not supported, only libdrm, mesa, glu and demos are."
272 return 1
276 if [ x"$section" = xwayland -o x"$section" = xxorg ]; then
277 section=`echo $module_url | cut -d'/' -f2`
278 if [ $? -ne 0 ]; then
279 echo "Error: unable to extract section from $module_url second field."
280 return 1
284 return 0
287 # Function: sign_or_fail
288 #------------------------------------------------------------------------------
290 # Sign the given file, if any
291 # Output the name of the signature generated to stdout (all other output to
292 # stderr)
293 # Return 0 on success, 1 on fail
295 sign_or_fail() {
296 if [ -n "$1" ]; then
297 sig=$1.sig
298 rm -f $sig
299 $GPG -b $GPGKEY $1 1>&2
300 if [ $? -ne 0 ]; then
301 echo "Error: failed to sign $1." >&2
302 return 1
304 echo $sig
306 return 0
309 #------------------------------------------------------------------------------
310 # Function: process_module
311 #------------------------------------------------------------------------------
312 # Code 'return 0' on success to process the next module
313 # Code 'return 1' on error to process next module if invoked with --no-quit
315 process_module() {
317 top_src=`pwd`
318 echo ""
319 echo "======== Processing \"$top_src/$MODULE_RPATH\""
321 # This is the location where the script has been invoked
322 if [ ! -d $MODULE_RPATH ] ; then
323 echo "Error: $MODULE_RPATH cannot be found under $top_src."
324 return 1
327 # Change directory to be in the git module
328 cd $MODULE_RPATH
329 if [ $? -ne 0 ]; then
330 echo "Error: failed to cd to $MODULE_RPATH."
331 return 1
334 # ----- Now in the git module *root* directory ----- #
336 # Check that this is indeed a git module
337 # Don't assume that $(top_srcdir)/.git is a directory. It may be
338 # a gitlink file if $(top_srcdir) is a submodule checkout or a linked
339 # worktree.
340 if [ ! -e .git ]; then
341 echo "Error: there is no git module here: `pwd`"
342 return 1
345 # Determine what is the current branch and the remote name
346 current_branch=`git branch | $GREP "\*" | sed -e "s/\* //"`
347 remote_name=`git config --get branch.$current_branch.remote`
348 remote_branch=`git config --get branch.$current_branch.merge | cut -d'/' -f3,4`
349 echo "Info: working off the \"$current_branch\" branch tracking the remote \"$remote_name/$remote_branch\"."
351 # Obtain the section
352 get_section
353 if [ $? -ne 0 ]; then
354 cd $top_src
355 return 1
358 # Check for uncommitted/queued changes.
359 check_local_changes
360 if [ $? -ne 0 ]; then
361 return 1
364 # If AC_CONFIG_AUX_DIR isn't set, libtool will search down to ../.. for
365 # install-sh and then just guesses that's the aux dir, dumping
366 # config.sub and other files into that directory. make distclean then
367 # complains about leftover files. So let's put our real module dir out
368 # of reach of libtool.
370 # We use release/$section/$build_dir because git worktree will pick the
371 # last part as branch identifier, so it needs to be random to avoid
372 # conflicts.
373 build_dir="release/$section"
374 mkdir -p "$build_dir"
376 # Create tmpdir for the release
377 build_dir=`mktemp -d -p "$build_dir" build.XXXXXXXXXX`
378 if [ $? -ne 0 ]; then
379 echo "Error: could not create a temporary directory for the release"
380 echo "Do you have coreutils' mktemp ?"
381 return 1
384 # Worktree removal is intentionally left to the user, due to:
385 # - currently we cannot select only one worktree to prune
386 # - requires to removal of $build_dir which might contradict with the
387 # user decision to keep some artefacts like tarballs or other
388 echo "Info: creating new git worktree."
389 git worktree add $build_dir
390 if [ $? -ne 0 ]; then
391 echo "Error: failed to create a git worktree."
392 cd $top_src
393 return 1
396 cd $build_dir
397 if [ $? -ne 0 ]; then
398 echo "Error: failed to cd to $MODULE_RPATH/$build_dir."
399 cd $top_src
400 return 1
403 echo "Info: running autogen.sh"
404 ./autogen.sh >/dev/null
405 if [ $? -ne 0 ]; then
406 echo "Error: failed to configure module."
407 cd $top_src
408 return 1
411 # Run 'make dist/distcheck' to ensure the tarball matches the git module content
412 # Important to run make dist/distcheck before looking in Makefile, may need to reconfigure
413 echo "Info: running \"make $MAKE_DIST_CMD\" to create tarballs:"
414 ${MAKE} $MAKEFLAGS $MAKE_DIST_CMD > /dev/null
415 if [ $? -ne 0 ]; then
416 echo "Error: \"$MAKE $MAKEFLAGS $MAKE_DIST_CMD\" failed."
417 cd $top_src
418 return 1
421 # Find out the tarname from the makefile
422 pkg_name=`$GREP '^PACKAGE = ' Makefile | sed 's|PACKAGE = ||'`
423 pkg_version=`$GREP '^VERSION = ' Makefile | sed 's|VERSION = ||'`
424 tar_name="$pkg_name-$pkg_version"
425 targz=$tar_name.tar.gz
426 tarbz2=$tar_name.tar.bz2
427 tarxz=$tar_name.tar.xz
429 [ -e $targz ] && ls -l $targz || unset targz
430 [ -e $tarbz2 ] && ls -l $tarbz2 || unset tarbz2
431 [ -e $tarxz ] && ls -l $tarxz || unset tarxz
433 if [ -z "$targz" -a -z "$tarbz2" -a -z "$tarxz" ]; then
434 echo "Error: no compatible tarballs found."
435 cd $top_src
436 return 1
439 # wayland/weston/libinput tag with the version number only
440 tag_name="$tar_name"
441 if [ x"$section" = xwayland ] ||
442 [ x"$section" = xweston ] ||
443 [ x"$section" = xlibinput ]; then
444 tag_name="$pkg_version"
447 # evemu tag with the version number prefixed by 'v'
448 if [ x"$section" = xevemu ]; then
449 tag_name="v$pkg_version"
452 gpgsignerr=0
453 siggz="$(sign_or_fail ${targz})"
454 gpgsignerr=$((${gpgsignerr} + $?))
455 sigbz2="$(sign_or_fail ${tarbz2})"
456 gpgsignerr=$((${gpgsignerr} + $?))
457 sigxz="$(sign_or_fail ${tarxz})"
458 gpgsignerr=$((${gpgsignerr} + $?))
459 if [ ${gpgsignerr} -ne 0 ]; then
460 echo "Error: unable to sign at least one of the tarballs."
461 cd $top_src
462 return 1
465 # Obtain the top commit SHA which should be the version bump
466 # It should not have been tagged yet (the script will do it later)
467 local_top_commit_sha=`git rev-list --max-count=1 HEAD`
468 if [ $? -ne 0 ]; then
469 echo "Error: unable to obtain the local top commit id."
470 cd $top_src
471 return 1
474 # Check that the top commit looks like a version bump
475 git diff --unified=0 HEAD^ | $GREP -F $pkg_version >/dev/null 2>&1
476 if [ $? -ne 0 ]; then
477 # Wayland repos use m4_define([wayland_major_version], [0])
478 git diff --unified=0 HEAD^ | $GREP -E "(major|minor|micro)_version" >/dev/null 2>&1
479 if [ $? -ne 0 ]; then
480 echo "Error: the local top commit does not look like a version bump."
481 echo " the diff does not contain the string \"$pkg_version\"."
482 local_top_commit_descr=`git log --oneline --max-count=1 $local_top_commit_sha`
483 echo " the local top commit is: \"$local_top_commit_descr\""
484 cd $top_src
485 return 1
489 # Check that the top commit has been pushed to remote
490 remote_top_commit_sha=`git rev-list --max-count=1 $remote_name/$remote_branch`
491 if [ $? -ne 0 ]; then
492 echo "Error: unable to obtain top commit from the remote repository."
493 cd $top_src
494 return 1
496 if [ x"$remote_top_commit_sha" != x"$local_top_commit_sha" ]; then
497 echo "Error: the local top commit has not been pushed to the remote."
498 local_top_commit_descr=`git log --oneline --max-count=1 $local_top_commit_sha`
499 echo " the local top commit is: \"$local_top_commit_descr\""
500 cd $top_src
501 return 1
504 # If a tag exists with the tar name, ensure it is tagging the top commit
505 # It may happen if the version set in configure.ac has been previously released
506 tagged_commit_sha=`git rev-list --max-count=1 $tag_name 2>/dev/null`
507 if [ $? -eq 0 ]; then
508 # Check if the tag is pointing to the top commit
509 if [ x"$tagged_commit_sha" != x"$remote_top_commit_sha" ]; then
510 echo "Error: the \"$tag_name\" already exists."
511 echo " this tag is not tagging the top commit."
512 remote_top_commit_descr=`git log --oneline --max-count=1 $remote_top_commit_sha`
513 echo " the top commit is: \"$remote_top_commit_descr\""
514 local_tag_commit_descr=`git log --oneline --max-count=1 $tagged_commit_sha`
515 echo " tag \"$tag_name\" is tagging some other commit: \"$local_tag_commit_descr\""
516 cd $top_src
517 return 1
518 else
519 echo "Info: module already tagged with \"$tag_name\"."
521 else
522 # Tag the top commit with the tar name
523 if [ x"$DRY_RUN" = x ]; then
524 git tag $GPGKEY -s -m $tag_name $tag_name
525 if [ $? -ne 0 ]; then
526 echo "Error: unable to tag module with \"$tag_name\"."
527 cd $top_src
528 return 1
529 else
530 echo "Info: module tagged with \"$tag_name\"."
532 else
533 echo "Info: skipping the commit tagging in dry-run mode."
537 # --------- Now the tarballs are ready to upload ----------
539 # The hostname which is used to connect to the development resources
540 hostname="annarchy.freedesktop.org"
542 # Some hostnames are also used as /srv subdirs
543 host_fdo="www.freedesktop.org"
544 host_xorg="xorg.freedesktop.org"
545 host_dri="dri.freedesktop.org"
546 host_mesa="mesa.freedesktop.org"
547 host_wayland="wayland.freedesktop.org"
549 # Mailing lists where to post the all [Announce] e-mails
550 list_to="xorg-announce@lists.x.org"
552 # Mailing lists to be CC according to the project (xorg|dri|xkb)
553 list_xorg_user="xorg@lists.x.org"
554 list_dri_devel="dri-devel@lists.freedesktop.org"
555 list_mesa_announce="mesa-announce@lists.freedesktop.org"
556 list_mesa_devel="mesa-dev@lists.freedesktop.org"
558 list_xkb="xkb@listserv.bat.ru"
559 list_xcb="xcb@lists.freedesktop.org"
560 list_nouveau="nouveau@lists.freedesktop.org"
561 list_wayland="wayland-devel@lists.freedesktop.org"
562 list_input="input-tools@lists.freedesktop.org"
564 host_current=$host_xorg
565 section_path=archive/individual/$section
566 srv_path="/srv/$host_current/$section_path"
567 list_cc=$list_xorg_user
569 # Handle special cases such as non xorg projects or migrated xorg projects
570 # Nouveau has its own list and section, but goes with the other drivers
571 if [ x"$section" = xnouveau ]; then
572 section_path=archive/individual/driver
573 srv_path="/srv/$host_current/$section_path"
574 list_cc=$list_nouveau
577 # Xcb has a separate mailing list
578 if [ x"$section" = xxcb ]; then
579 list_cc=$list_xcb
582 # Module mesa/drm goes in the dri "libdrm" section
583 if [ x"$section" = xdrm ]; then
584 host_current=$host_dri
585 section_path=libdrm
586 srv_path="/srv/$host_current/www/$section_path"
587 list_cc=$list_dri_devel
588 elif [ x"$section" = xmesa ]; then
589 host_current=$host_mesa
590 section_path=archive
591 srv_path="/srv/$host_current/www/$section_path"
592 list_to=$list_mesa_announce
593 list_cc=$list_mesa_devel
594 elif [ x"$section" = xdemos ] || [ x"$section" = xglu ]; then
595 host_current=$host_mesa
596 section_path=archive/$section
597 srv_path="/srv/$host_current/www/$section_path"
598 list_to=$list_mesa_announce
599 list_cc=$list_mesa_devel
602 # Module xkeyboard-config goes in a subdir of the xorg "data" section
603 if [ x"$section" = xxkeyboard-config ]; then
604 host_current=$host_xorg
605 section_path=archive/individual/data/$section
606 srv_path="/srv/$host_current/$section_path"
607 list_cc=$list_xkb
610 if [ x"$section" = xlibevdev ]; then
611 host_current=$host_fdo
612 section_path="software/$section"
613 srv_path="/srv/$host_current/www/$section_path"
614 list_to=$list_input
615 unset list_cc
618 if [ x"$section" = xwayland ] ||
619 [ x"$section" = xweston ]; then
620 host_current=$host_wayland
621 section_path="releases"
622 srv_path="/srv/$host_current/www/$section_path"
623 list_to=$list_wayland
624 unset list_cc
625 elif [ x"$section" = xlibinput ]; then
626 host_current=$host_fdo
627 section_path="software/libinput"
628 srv_path="/srv/$host_current/www/$section_path"
629 list_to=$list_wayland
630 unset list_cc
631 elif [ x"$section" = xevemu ]; then
632 host_current=$host_fdo
633 section_path="software/evemu"
634 srv_path="/srv/$host_current/www/$section_path"
635 list_to=$list_input
636 unset list_cc
639 # Use personal web space on the host for unit testing (leave commented out)
640 # srv_path="~/public_html$srv_path"
642 # Check that the server path actually does exist
643 echo "Info: checking if path exists on web server:"
644 ssh $USER_NAME$hostname ls $srv_path >/dev/null 2>&1
645 if [ $? -ne 0 ]; then
646 echo "Error: the path \"$srv_path\" on the web server does not exist."
647 cd $top_src
648 return 1
651 # Check for already existing tarballs
652 for tarball in $targz $tarbz2 $tarxz; do
653 echo "Info: checking if tarball $tarball already exists on web server:"
654 ssh $USER_NAME$hostname ls $srv_path/$tarball >/dev/null 2>&1
655 if [ $? -eq 0 ]; then
656 if [ "x$FORCE" = "xyes" ]; then
657 echo "Warning: overwriting released tarballs due to --force option."
658 else
659 echo "Error: tarball $tar_name already exists. Use --force to overwrite."
660 cd $top_src
661 return 1
664 done
666 # Upload to host using the 'scp' remote file copy program
667 if [ x"$DRY_RUN" = x ]; then
668 echo "Info: uploading tarballs to web server:"
669 scp $targz $tarbz2 $tarxz $siggz $sigbz2 $sigxz $USER_NAME$hostname:$srv_path
670 if [ $? -ne 0 ]; then
671 echo "Error: the tarballs uploading failed."
672 cd $top_src
673 return 1
675 else
676 echo "Info: skipping tarballs uploading in dry-run mode."
677 echo " \"$srv_path\"."
680 # Pushing the top commit tag to the remote repository
681 if [ x$DRY_RUN = x ]; then
682 echo "Info: pushing tag \"$tag_name\" to remote \"$remote_name\":"
683 git push $remote_name $tag_name
684 if [ $? -ne 0 ]; then
685 echo "Error: unable to push tag \"$tag_name\" to the remote repository."
686 echo " it is recommended you fix this manually and not run the script again"
687 cd $top_src
688 return 1
690 else
691 echo "Info: skipped pushing tag \"$tag_name\" to the remote repository in dry-run mode."
694 MD5SUM=`which md5sum || which gmd5sum`
695 SHA1SUM=`which sha1sum || which gsha1sum`
696 SHA256SUM=`which sha256sum || which gsha256sum`
697 SHA512SUM=`which sha512sum || which gsha512sum`
699 # --------- Generate the announce e-mail ------------------
700 # Failing to generate the announce is not considered a fatal error
702 # Git-describe returns only "the most recent tag", it may not be the expected one
703 # However, we only use it for the commit history which will be the same anyway.
704 tag_previous=`git describe --abbrev=0 HEAD^ 2>/dev/null`
705 # Git fails with rc=128 if no tags can be found prior to HEAD^
706 if [ $? -ne 0 ]; then
707 if [ $? -ne 0 ]; then
708 echo "Warning: unable to find a previous tag."
709 echo " perhaps a first release on this branch."
710 echo " Please check the commit history in the announce."
713 if [ x"$tag_previous" != x ]; then
714 # The top commit may not have been tagged in dry-run mode. Use commit.
715 tag_range=$tag_previous..$local_top_commit_sha
716 else
717 tag_range=$tag_name
719 generate_announce > "$tar_name.announce"
720 echo "Info: [ANNOUNCE] template generated in \"$build_dir/$tar_name.announce\" file."
721 echo " Please pgp sign and send it."
723 # --------- Update the JH Build moduleset -----------------
724 # Failing to update the jh moduleset is not considered a fatal error
725 if [ x"$JH_MODULESET" != x ]; then
726 for tarball in $targz $tarbz2 $tarxz; do
727 if [ x$DRY_RUN = x ]; then
728 sha1sum=`$SHA1SUM $tarball | cut -d' ' -f1`
729 $top_src/util/modular/update-moduleset.sh $JH_MODULESET $sha1sum $tarball
730 echo "Info: updated jh moduleset: \"$JH_MODULESET\""
731 else
732 echo "Info: skipping jh moduleset \"$JH_MODULESET\" update in dry-run mode."
735 # $tar* may be unset, so simply loop through all of them and the
736 # first one that is set updates the module file
737 break
738 done
742 # --------- Successful completion --------------------------
743 cd $top_src
744 return 0
748 #------------------------------------------------------------------------------
749 # Function: usage
750 #------------------------------------------------------------------------------
751 # Displays the script usage and exits successfully
753 usage() {
754 basename="`expr "//$0" : '.*/\([^/]*\)'`"
755 cat <<HELP
757 Usage: $basename [options] path...
759 Where "path" is a relative path to a git module, including '.'.
761 Options:
762 --dist make 'dist' instead of 'distcheck'; use with caution
763 --distcheck Default, ignored for compatibility
764 --dry-run Does everything except tagging and uploading tarballs
765 --force Force overwriting an existing release
766 --gpgkey <key> Specify the key used to sign the git tag/release tarballs
767 --help Display this help and exit successfully
768 --modfile <file> Release the git modules specified in <file>
769 --moduleset <file> The jhbuild moduleset full pathname to be updated
770 --no-quit Do not quit after error; just print error message
771 --user <name>@ Username of your fdo account if not configured in ssh
773 Environment variables defined by the "make" program and used by release.sh:
774 MAKE The name of the make command [make]
775 MAKEFLAGS: Options to pass to all \$(MAKE) invocations
777 HELP
780 #------------------------------------------------------------------------------
781 # Script main line
782 #------------------------------------------------------------------------------
785 # Choose which make program to use (could be gmake)
786 MAKE=${MAKE:="make"}
788 # Choose which grep program to use (on Solaris, must be gnu grep)
789 if [ "x$GREP" = "x" ] ; then
790 if [ -x /usr/gnu/bin/grep ] ; then
791 GREP=/usr/gnu/bin/grep
792 else
793 GREP=grep
797 # Find path for GnuPG v2
798 if [ "x$GPG" = "x" ] ; then
799 if [ -x /usr/bin/gpg2 ] ; then
800 GPG=/usr/bin/gpg2
801 else
802 GPG=gpg
806 # Avoid problems if GPGKEY is already set in the environment
807 unset GPGKEY
809 # Set the default make tarball creation command
810 MAKE_DIST_CMD=distcheck
812 # Process command line args
813 while [ $# != 0 ]
815 case $1 in
816 # Use 'dist' rather than 'distcheck' to create tarballs
817 # You really only want to do this if you're releasing a module you can't
818 # possibly build-test. Please consider carefully the wisdom of doing so.
819 --dist)
820 MAKE_DIST_CMD=dist
822 # Use 'distcheck' to create tarballs
823 --distcheck)
824 MAKE_DIST_CMD=distcheck
826 # Does everything except uploading tarball
827 --dry-run)
828 DRY_RUN=yes
830 # Force overwriting an existing release
831 # Use only if nothing changed in the git repo
832 --force)
833 FORCE=yes
835 # Allow user specified GPG key
836 --gpgkey)
837 check_option_args $1 $2
838 shift
839 check_gpgkey $1
840 GPGKEY="-u $1"
842 # Display this help and exit successfully
843 --help)
844 usage
845 exit 0
847 # Release the git modules specified in <file>
848 --modfile)
849 check_option_args $1 $2
850 shift
851 MODFILE=$1
853 # The jhbuild moduleset to update with relase info
854 --moduleset)
855 check_option_args $1 $2
856 shift
857 JH_MODULESET=$1
859 # Do not quit after error; just print error message
860 --no-quit)
861 NO_QUIT=yes
863 # Username of your fdo account if not configured in ssh
864 --user)
865 check_option_args $1 $2
866 shift
867 USER_NAME=$1
869 --*)
870 echo ""
871 echo "Error: unknown option: $1"
872 echo ""
873 usage
874 exit 1
877 echo ""
878 echo "Error: unknown option: $1"
879 echo ""
880 usage
881 exit 1
884 if [ x"${MODFILE}" != x ]; then
885 echo ""
886 echo "Error: specifying both modules and --modfile is not permitted"
887 echo ""
888 usage
889 exit 1
891 INPUT_MODULES="${INPUT_MODULES} $1"
893 esac
895 shift
896 done
898 # If no modules specified (blank cmd line) display help
899 check_modules_specification
901 # Read the module file and normalize input in INPUT_MODULES
902 read_modfile
904 # Loop through each module to release
905 # Exit on error if --no-quit no specified
906 process_modules
908 # Print the epilog with final status
909 print_epilog