diff options
author | Rob Funk <rfunk@funknet.net> | 2004-06-18 04:17:07 +0000 |
---|---|---|
committer | Rob Funk <rfunk@funknet.net> | 2004-06-18 04:17:07 +0000 |
commit | 4f40dc60c125ad1e14071c234b67315fab6c6fc3 (patch) | |
tree | c98e66addc90bb61fb448e9dbc458cc3ec7915e4 /dist-tools/shipper | |
parent | e2fbba91f98b2270da86d6cde1d680ff57aca077 (diff) | |
download | fetchmail-4f40dc60c125ad1e14071c234b67315fab6c6fc3.tar.gz fetchmail-4f40dc60c125ad1e14071c234b67315fab6c6fc3.tar.bz2 fetchmail-4f40dc60c125ad1e14071c234b67315fab6c6fc3.zip |
Move shipper to dist-tools directory
svn path=/trunk/; revision=3889
Diffstat (limited to 'dist-tools/shipper')
-rw-r--r-- | dist-tools/shipper/COPYING | 340 | ||||
-rw-r--r-- | dist-tools/shipper/Makefile | 38 | ||||
-rw-r--r-- | dist-tools/shipper/README | 7 | ||||
-rwxr-xr-x | dist-tools/shipper/buildrpms | 41 | ||||
-rwxr-xr-x | dist-tools/shipper/rpm2lsm | 108 | ||||
-rw-r--r-- | dist-tools/shipper/rpm2lsm.1 | 95 | ||||
-rw-r--r-- | dist-tools/shipper/rpm2lsm.xml | 135 | ||||
-rwxr-xr-x | dist-tools/shipper/shipper | 583 | ||||
-rw-r--r-- | dist-tools/shipper/shipper.1 | 294 | ||||
-rw-r--r-- | dist-tools/shipper/shipper.spec | 69 | ||||
-rw-r--r-- | dist-tools/shipper/shipper.xml | 752 |
11 files changed, 2462 insertions, 0 deletions
diff --git a/dist-tools/shipper/COPYING b/dist-tools/shipper/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/dist-tools/shipper/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/dist-tools/shipper/Makefile b/dist-tools/shipper/Makefile new file mode 100644 index 00000000..1e6f6896 --- /dev/null +++ b/dist-tools/shipper/Makefile @@ -0,0 +1,38 @@ +# Makefile for the shipper project + +VERS=$(shell sed <shipper.spec -n -e '/Version: \(.*\)/s//\1/p') + +MANDIR=$(DESTDIR)/usr/share/man/man1 +BINDIR=$(DESTDIR)/usr/bin + +DOCS = README COPYING shipper.xml rpm2lsm.xml shipper.1 rpm2lsm.1 +SOURCES = shipper buildrpms rpm2lsm Makefile $(DOCS) shipper.spec + +all: shipper-$(VERS).tar.gz + +install: shipper.1 rpm2lsm.1 + cp shipper buildrpms rpm2lsm $(BINDIR) + gzip <shipper.1 >$(MANDIR)/shipper.1.gz + gzip <rpm2lsm.1 >$(MANDIR)/rpm2lsm.1.gz + +shipper.1: shipper.xml + xmlto man shipper.xml +shipper.html: shipper.xml + xmlto html-nochunks shipper.xml + +rpm2lsm.1: rpm2lsm.xml + xmlto man rpm2lsm.xml +rpm2lsm.html: rpm2lsm.xml + xmlto html-nochunks rpm2lsm.xml + +shipper-$(VERS).tar.gz: $(SOURCES) + @mkdir shipper-$(VERS) + @cp $(SOURCES) shipper-$(VERS) + @tar -czf shipper-$(VERS).tar.gz shipper-$(VERS) + @rm -fr shipper-$(VERS) + +dist: shipper-$(VERS).tar.gz + +release: shipper-$(VERS).tar.gz shipper.html rpm2lsm.html + shipper -f; rm CHANGES ANNOUNCE* *.html *.lsm *.1 + diff --git a/dist-tools/shipper/README b/dist-tools/shipper/README new file mode 100644 index 00000000..c06f813a --- /dev/null +++ b/dist-tools/shipper/README @@ -0,0 +1,7 @@ + README for shipper + +shipper automates the tedious process of shipping a software release to +several standard places, including ibiblio, the Red Hat submission directory, +and your own hosted website. It also knows how to post a release announcement +to freshmeat.net via freshmeat-submit. Two auxiliary tools, buildrpms and +rpm2lsm, build RPMs and generate LSM files from them respectively. diff --git a/dist-tools/shipper/buildrpms b/dist-tools/shipper/buildrpms new file mode 100755 index 00000000..22086d01 --- /dev/null +++ b/dist-tools/shipper/buildrpms @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Build RPMs from the source in the current directory. This script sets +# up an RPM "_topdir" and builds the RPMs under there, then copies the +# binary and source RPMs to the current directory. +# +# Written by Sean Reifschneider <jafo-rpms@tummy.com>, 2003 + +TARBALL=$1 # tarball to build from + +# set up temporary directory +TMPDIR=`pwd`/rpm-build.$$ +[ ! -z "$TMPDIR" -a "$TMPDIR" != / ] && rm -rf "$TMPDIR" +mkdir -p "$TMPDIR"/BUILD +mkdir -p "$TMPDIR"/RPMS +mkdir -p "$TMPDIR"/SOURCES +mkdir -p "$TMPDIR"/SPECS +mkdir -p "$TMPDIR"/SRPMS + +# set up rpmmacros file +MACROFILE="$TMPDIR"/rpmmacros +RCFILE="$TMPDIR"/rpmrc +sed "s|~/.rpmmacros|$MACROFILE|" /usr/lib/rpm/rpmrc >"$RCFILE" +echo "%_topdir $TMPDIR" >"$MACROFILE" +echo "%_topdir $TMPDIR" >"$MACROFILE" + +# build RPMs +rpmbuild --rcfile "$RCFILE" $ARCH -ta $TARBALL +status=$? + +if [ $status = '0' ] +then + # copy RPMs to this directory + cp "$TMPDIR"/RPMS/*/*.rpm . + cp "$TMPDIR"/SRPMS/*.rpm . +fi + +# clean up build directory +[ ! -z "$TMPDIR" -a "$TMPDIR" != / ] && rm -rf "$TMPDIR" + +exit $status diff --git a/dist-tools/shipper/rpm2lsm b/dist-tools/shipper/rpm2lsm new file mode 100755 index 00000000..6a05d6c7 --- /dev/null +++ b/dist-tools/shipper/rpm2lsm @@ -0,0 +1,108 @@ +#/bin/sh +# +# rpm2lsm -- generate Linux Software Map file from RPM meta information +# +# Author: Eric S. Raymond <esr@thyrsus.com>, 31 July 2002 +# Project page: http://www.catb.org/~esr/ +# +# Requires fmt(1), awk(1), and rpm(8). + +while getopts a:m:k:p: c; +do + case $c in + 'a') author=$OPTARG;; + 'm') maintainer=$OPTARG;; + 'k') keywords=$OPTARG;; + 'p') platforms=$OPTARG;; + '?') echo "rpm2lsm: invalid switch specified - aborting."; exit 1;; + esac +done +shift `expr $OPTIND - 1` + +# If no RPM was given, look in the current directory and pick the last +# one in sort order. That's likely to be the most recent. +if [ -z "$1" ] +then + set -- *.rpm + while [ "$2" ] + do + shift + done +fi + +# Mine out all the single-token fields we'll need +rpm=$1 +set -- `rpm --queryformat="%{name} %{version} %{release}" -qp $rpm` +name=$1 +version=$2 +release=$3 + +# Extract and reformat the desciption +description=`rpm --queryformat="%{description}" -qp $rpm | fmt -w 65 | sed '2,$s/^/ /'` + +# Who am I? +fullname=`cat /etc/passwd | awk -F : "/^${USER}/ "'{print $5}'` +fullname="${USER}@${HOSTNAME} ($fullname)" + +if [ -z "$author" ] +then + if [ -f AUTHORS ] + then + author=`cat AUTHORS` + else + author=$fullname + fi +fi + +# Fill in keywords if present +if [ -n "$keywords" ] +then + keywords="Keywords: $keywords\n" +fi + +# Default the maintainer field properly +if [ -z "$maintainer" ] +then + maintainer=`rpm --queryformat="%{packager}" -qp $rpm` + if [ "$maintainer" = "(none)" ] + then + maintainer=$author + fi +fi + +# The date +date=`date '+%Y-%m-%d'` + +cat >/usr/tmp/rpm2lsm.$$ <<EOF +Begin3 +Title: %{name} +Version: %{version} +Entered-date: ${date} +Description: ${description} +${keywords}Author: ${author} +Maintained-by: ${maintainer} +Primary-site: %{url} +EOF + +# File patterns that we ship +tarballs="${name}-${version}.tar.gz ${name}-${version}.tgz" +rpms=${name}-${version}-${release}.*.rpm + +trap "rm -f /usr/tmp/rpm2lsm.$$" 0 2 15 +for file in $tarballs $rpms +do + if [ -f $file ] + then + set -- `du $file`; size=$1 + echo " ${size} ${file}" >>/usr/tmp/rpm2lsm.$$ + fi +done + +cat >>/usr/tmp/rpm2lsm.$$ <<EOF +Platforms: ${platforms:-All} +Copying-policy: %{license} +End +EOF + +format=`cat /usr/tmp/rpm2lsm.$$` +rpm --queryformat="$format" -qp $rpm diff --git a/dist-tools/shipper/rpm2lsm.1 b/dist-tools/shipper/rpm2lsm.1 new file mode 100644 index 00000000..d11df03e --- /dev/null +++ b/dist-tools/shipper/rpm2lsm.1 @@ -0,0 +1,95 @@ +.\"Generated by db2man.xsl. Don't modify this, modify the source. +.de Sh \" Subsection +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.TH "RPM2LSM" 1 "" "" "" +.SH NAME +rpm2lsm \- generate Linux Software Map entries from RPMs +.SH "SYNOPSIS" + +.nf +\fBrpm2lsm\fR [-a \fIauthor\fR] [-k \fIkeywords\fR] [-p \fIplatforms\fR] [-m \fImaintainer\fR] + \fIrpmfile\fR +.fi + +.SH "DESCRIPTION" + +.PP +This tool extracts tag information from an RPM file to generate a Linux Software Map (version 3) entry on standard output. Command-line switches support adding LSM fields that have no equivalents in RPMs. Here are the field-generation rules: + +.TP +Title: +Taken straight from the RPM Name field. + +.TP +Version: +Taken straight from the RPM Version field. + +.TP +Entered-Date: +LSM-generation time in YYYY-MM-DD format. + +.TP +Description: +Taken straight from the RPM Description field. + +.TP +Keywords: +Taken from the value of the \fB-k\fR command-line option. If no such option is given, it is omitted. + +.TP +Author: +Taken from the value of the \fB-a\fR command-line option. If no such option is given, it looks for an AUTHORS file in the current directory (GNU convention) and uses that. If no AUTHORS file is present, your email addess and full name from the password file + +.TP +Maintained-By: +Taken from the value of the \fB-m\fR command-line option. If that was not given, taken from the RPM Packager field. If that was not given, fill in the Author name. + +.TP +Primary-Site: +The first (site) line is taken from the RPM URL field. Second and subsequent lines list tarballs and RPMs that match on name, version number, and release number with the RPM algument. For each file, size in 1K blocks is filled in. + +.TP +Alternate-Site: +This field is not generated. + +.TP +Original-Site: +This field is not generated. + +.TP +Platforms: +Taken from the value of the \fB-p\fR command-line option. If no such option is given, 'All' is filled in. + +.TP +Copying-Policy: +Taken straight from the RPM License field. + +.PP +These are all the fields supported in LSM version 3. You can see the : LSM template http://ibiblio.org/pub/Linux/LSM-TEMPLATE for full details. + +.SH "AUTHOR" + +.PP +Eric S. Raymond <esr@thyrsus.com>. For updates, see : http://www.catb.org/~esr/software.htmlhttp://www.catb.org/~esr/software.html. + +.SH "SEE ALSO" + +.PP +\fBrpm\fR(8). + diff --git a/dist-tools/shipper/rpm2lsm.xml b/dist-tools/shipper/rpm2lsm.xml new file mode 100644 index 00000000..6856cbab --- /dev/null +++ b/dist-tools/shipper/rpm2lsm.xml @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<refentry id='rpm2lsm.1'> +<refmeta> +<refentrytitle>rpm2lsm</refentrytitle> +<manvolnum>1</manvolnum> +</refmeta> +<refnamediv id='name'> +<refname>rpm2lsm</refname> +<refpurpose>generate Linux Software Map entries from RPMs</refpurpose> +</refnamediv> +<refsynopsisdiv id='synopsis'> + +<cmdsynopsis> + <command>rpm2lsm</command> + <arg choice='opt'>-a <replaceable>author</replaceable></arg> + <arg choice='opt'>-k <replaceable>keywords</replaceable></arg> + <arg choice='opt'>-p <replaceable>platforms</replaceable></arg> + <arg choice='opt'>-m <replaceable>maintainer</replaceable></arg> + <arg choice='plain'><replaceable>rpmfile</replaceable></arg> +</cmdsynopsis> + +</refsynopsisdiv> + +<refsect1 id='description'><title>DESCRIPTION</title> +<para>This tool extracts tag information from an RPM file to generate a +Linux Software Map (version 3) entry on standard output. Command-line +switches support adding LSM fields that have no equivalents in RPMs. +Here are the field-generation rules:</para> +<variablelist remap='TP'> +<varlistentry> +<term>Title:</term> +<listitem> +<para>Taken straight from the RPM Name field.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Version:</term> +<listitem> +<para>Taken straight from the RPM Version field.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Entered-Date:</term> +<listitem> +<para>LSM-generation time in YYYY-MM-DD format.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Description:</term> +<listitem> +<para>Taken straight from the RPM Description field.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Keywords:</term> +<listitem> +<para>Taken from the value of the <option>-k</option> command-line option. +If no such option is given, it is omitted.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Author:</term> +<listitem> +<para>Taken from the value of the <option>-a</option> command-line +option. If no such option is given, it looks for an AUTHORS file in +the current directory (GNU convention) and uses that. If no AUTHORS +file is present, your email addess and full name from the password +file</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Maintained-By:</term> +<listitem> +<para>Taken from the value of the <option>-m</option> command-line +option. If that was not given, taken from the RPM Packager field. +If that was not given, fill in the Author name.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Primary-Site:</term> +<listitem> +<para>The first (site) line is taken from the RPM URL field. Second +and subsequent lines list tarballs and RPMs that match on name, version +number, and release number with the RPM algument. For each file, +size in 1K blocks is filled in. +</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Alternate-Site:</term> +<listitem> +<para>This field is not generated.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Original-Site:</term> +<listitem> +<para>This field is not generated.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Platforms:</term> +<listitem> +<para>Taken from the value of the <option>-p</option> command-line option. +If no such option is given, 'All' is filled in.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>Copying-Policy:</term> +<listitem> +<para>Taken straight from the RPM License field.</para> +</listitem> +</varlistentry> +</variablelist> + +<para>These are all the fields supported in LSM version 3. You can see the +<ulink url='http://ibiblio.org/pub/Linux/LSM-TEMPLATE'> +LSM template +</ulink> +for full details.</para> +</refsect1> + +<refsect1 id='author'><title>AUTHOR</title> +<para>Eric S. Raymond <email>esr@thyrsus.com</email>. +For updates, see <ulink url="http://www.catb.org/~esr/software.html"> +http://www.catb.org/~esr/software.html</ulink>.</para> +</refsect1> + +<refsect1 id='see_also'><title>SEE ALSO</title> +<para><citerefentry><refentrytitle>rpm</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para> +</refsect1> +</refentry> + diff --git a/dist-tools/shipper/shipper b/dist-tools/shipper/shipper new file mode 100755 index 00000000..9d5ce1b3 --- /dev/null +++ b/dist-tools/shipper/shipper @@ -0,0 +1,583 @@ +#!/usr/bin/env python +# +# shipper -- a tool for shipping software + +import sys, os, readline, re, commands, time, glob, optparse, stat + +# +# State variables +# +destinations = [] # List of remote directories to update +channels = ['ibiblio', 'redhat', 'freshmeat'] +whoami = None # Who am I? (Used for FTP logins) +date = None # User has not yet set a date +package = None # Nor a package name +homepage = None # Nor a home page +arch = None # The machine architecture +keywords = None # Keywords for LSMs +freshmeat_name = None # Name of the project ob Freshmeat +changelog = None # Project changelog +lastchange = None # Last entry in changelog +summary = None # One-line summary of the package +description = None # Nor a description + +indextemplate = """ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' + 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> +<html> +<head> +<link rel='stylesheet' href='/~esr/sitestyle.css' type='text/css' /> +<meta name='description' content='Resource page for %(package)s' /> +<meta name='generator' content='shipper' /> +<meta name='MSSmartTagsPreventParsing' content='TRUE' /> +<title>Resource page for %(package)s %(version)s</title> +</head> +<body> + +<h1>Resource page for %(package)s %(version)s</td></h1> + +<p>%(description)s</p> + +<br /> +%(resourcetable)s +<br /> + +<p>Last modified %(date)s.</p> + +</div> +</body> +</html> +""" +mailtemplate = """Subject: Announcing release %(version)s of %(package)s + +Release %(version)s of %(package)s is now available at: + + %(homepage)s + +Here are the most recent changes: + +%(lastchange)s +-- + shipper, acting for %(whoami)s +""" + +# It's unpleasant that we have to include these here, but +# the freshmeat release focus has to be validated even if the +# user is offline and the XML-RPC service not accessible. +freshmeat_focus_types = ( +"N/A", +"Initial freshmeat announcement", +"Documentation", +"Code cleanup", +"Minor feature enhancements", +"Major feature enhancements", +"Minor bugfixes", +"Major bugfixes", +"Minor security fixes", +"Major security fixes", +) + +def croak(msg): + sys.stderr.write("shipper: " + msg + "\n") + sys.exit(1) + +# +# Shipping methods +# + +def do_or_die(cmd): + "Wither execute a command or fail noisily" + if options.verbose: + print "***", cmd + if os.system(cmd): + croak("command '%s' failed!" % cmd) + +def upload_or_die(cmd): + if options.noupload: + print cmd + else: + do_or_die(cmd) + +def upload(destination, files): + # Upload a file via ftp or sftp, handles + print "# Uploading to %s" % destination + files = filter(os.path.exists, files) + if destination.startswith("ftp://"): + destination = destination[6:].split("/") + host = destination.pop(0) + directory = "/".join(destination) + commands = ["lftp", "open -u anonymous," + whoami + " " + host + "\n"] + if directory: + commands.append("cd " + directory + "\n") + commands.append("mput " + " ".join(files) + "\n") + commands.append("close\n") + if options.noupload: + print "".join(commands) + else: + pfp = os.popen(commands.pop(0), "w") + pfp.writelines(commands) + pfp.close() + elif destination.find("::") > -1: + upload_or_die("rsync " + " ".join(files) + " " + destination) + elif destination.find(":") > -1: + (host, directory) = destination.split(":") + for file in files: + # This is a really ugly way to deal with the problem + # of write-protected files in the remote directory. + # Unfortunately, sftp(1) is rather brain-dead -- no + # way to ignore failure on a remove, and refuses to + # do renames with an obscure error message. + remote = os.path.join(directory, package, file) + upload_or_die("scp " + file + " " + host + ":" + remote+".new;") + upload_or_die("ssh %s 'mv -f %s.new %s'" % (host, remote, remote)) + else: + sys.stderr.write("Don't know what to do with destination %s!") + +def freshmeat_ship(manifest): + "Ship a specified update to freshmeat." + if options.verbose: + print "Announcing to freshmeat..." + upload_or_die("freshmeat-submit <" + manifest[0]) + +# +# Metadata extraction +# + +def grep(pattern, file): + "Mine for a specified pattern in a file." + fp = open(file) + try: + while True: + line = fp.readline() + if not line: + return None + m = re.search(pattern, line) + if m: + return m.group(1) + finally: + fp.close() + return None + +class Specfile: + def __init__(self, filename): + self.filename = filename + self.type = None + if filename.endswith(".spec"): + self.type = "RPM" + self.package = self.extract("Name") + self.version = self.extract("Version") + self.homepage = self.extract("URL") + self.summary = self.extract("Summary") + self.arch = self.extract("BuildArch") or commands.getoutput("rpm --showrc | sed -n '/^build arch/s/.* //p'") + self.description = self.rpm_get_multiline("description") + self.changelog = self.rpm_get_multiline("changelog") + elif filename == "control": + self.type = "deb" + self.name = self.extract("Package") + self.version = self.extract("Version").split("-")[0] + self.homepage = self.extract("XBS-Home-Page") + self.summary = self.extract("Description") + self.arch = self.extract("Architecture") + if not self.arch: + croak("this control file lacks an Architecture field") + # FIXME: parse Debian description entries and changelog file + self.description = self.changelog = None + def extract(self, fld): + "Extract a one-line field, possibly embedded as a magic comment." + if self.type == "RPM": + return grep("^#?"+fld+":\s*(.*)", self.filename) + elif self.type == "deb": + return grep("^(?:XBS-)?"+fld+": (.*)", self.filename) + def rpm_get_multiline(self, fieldname): + "Grab everything from leader line to just before the next leader line." + global desc + fp = open(self.filename) + desc = "" + gather = False + while True: + line = fp.readline() + if not line: + break + # Pick up fieldnames *without* translation options. + if line.strip() == "%" + fieldname: + gather = True + continue + elif line[0] == "%": + gather = False + if gather: + desc += line + fp.close() + if desc: + return desc.strip() + "\n" + else: + return None +# +# Main sequence +# + +try: + # + # Process options + # + + parser = optparse.OptionParser(usage="%prog: [-h] [-n] [-f] [-v]") + parser.add_option("-v", "--verbose", + action="store_true", dest="verbose", default=False, + help="print progress messages to stdout") + parser.add_option("-n", "--noupload", + action="store_true", dest="noupload", default=False, + help="don't do uploads, just build deliverables") + parser.add_option("-N", "--nobuild", + action="store_true", dest="nobuild", default=False, + help="dump configuration only, no builds or uploads") + parser.add_option("-f", "--force", + action="store_true", dest="force", default=False, + help="force rebuilding of all local deliverables") + (options, args) = parser.parse_args() + + # + # Extract metadata and compute control information + # + + def disable(s): channels.remove(s) + + # Security check, don't let an attacker elevate privileges + def securecheck(file): + if stat.S_IMODE(os.stat(file).st_mode) & 00002: + croak("%s must not be world-writeable!" % file) + + # Read in variable overrides + securecheck(".") + home_profile = os.path.join(os.getenv('HOME'), ".shipper") + if os.path.exists(home_profile): + securecheck(home_profile) + execfile(home_profile) + here_profile = ".shipper" + if os.path.exists(here_profile): + securecheck(here_profile) + execfile(here_profile) + + # Set various sensible defaults + if not whoami: + whoami = os.getenv('USERNAME') + "@" + os.getenv('HOSTNAME') + + # Where to get the metadata + specfiles = glob.glob("*.spec") + if len(specfiles) == 1: + metadata = Specfile(specfiles[0]) + elif os.path.exists("control"): + metadata = Specfile("control") + else: + croak("must be exactly one RPM or dpkg specfile in the directory!") + + # Get the package name + if not package: + package = metadata.package + if not package: + croak("can't get package name!") + + # Extract the package vers from the specfile or Makefile + specvers = metadata.version + makevers = None + if os.path.exists("Makefile"): + makevers = grep("^VERS[A-Z]* *= *(.*)", "Makefile") + # Maybe it's a shell command intended to extract version from specfile + if makevers and makevers[0] == '$': + makevers = commands.getoutput(makevers[7:-1]) + if specvers != makevers: + croak("specfile version %s != Makefile version %s"%(specvers,makevers)) + elif specvers == None: + croak("can't get package version") + elif specvers[0] not in "0123456789": + croak("package version %s appears garbled" % specvers) + else: + version = specvers + + # Specfiles may set their own destinations + local_destinations = metadata.extract("Destinations") + if local_destinations: + local_destinations = map(lambda x: x.strip(), local_destinations.split(",")) + destinations += local_destinations + if not destinations: + print "warning: destinations empty, shipping to public channels only." + + print"# Uploading version %s of %s" % (version, package) + + # Extract remaining variables for templating + if not homepage: + homepage = metadata.homepage + if not date: + date = time.asctime() + if not summary: + summary = metadata.summary + if not description: + description = metadata.description + if not arch: + arch = metadata.arch + if not keywords: + keywords = metadata.extract("Keywords") + if not freshmeat_name: + freshmeat_name = metadata.extract("Freshmeat-Name") + + # Finally, derive the change log and lastchange entry; + # we'll need the latter for freshmeat.net + freshmeat_lastchange = lastchange = changelog = None + # ChangeLog, if present, takes precedence; + # we assume if both are present that the specfile log is about packaging. + if os.path.exists("ChangeLog"): + ifp = open("ChangeLog", "r") + changelog = ifp.read() + ifp.close() + lastchange = "" + for line in changelog.split("\n"): + while line.strip() or not "*" in lastchange: + lastchange += line + "\n" + else: + break + # freshmeat.net doesn't like bulleted items in a changes field. + freshmeat_lastchange = "See the ChangeLog file for recent changes." + elif metadata.changelog: + changelog = metadata.changelog + lastchange = "" + for line in changelog.split("\n"): + if not lastchange and (not line.strip() or line[0] == '*'): + continue + elif line.strip(): + lastchange += line + "\n" + else: + break + # This usually produces a lastchange entry that freshmeat will take. + freshmeat_lastchange = lastchange + + # + # Now compute the names of deliverables + # + + # These are all potential deliverable files that include the version number + tarball = package + "-" + version + ".tar.gz" + srcrpm = package + "-" + version + "-1.src.rpm" + binrpm = package + "-" + version + "-1." + arch + ".rpm" + zip = package + "-" + version + ".zip" + lsm = package + "-" + version + ".lsm" + + # Map web deliverables to explanations for the resource table + # Stuff not included here: ANNOUNCE.EMAIL, ANNOUNCE.FRESHMEAT, lsm. + stock_deliverables = [ + ("README", "roadmap file"), + (tarball, "source tarball"), + (zip, "ZIP archive"), + (binrpm, "installable RPM"), # Generated + (srcrpm, "source RPM"), # Generated + ("ChangeLog", "change log"), + ("CHANGES", "change log"), # Generated + ("NEWS", "Project news"), + ("HISTORY", "Project history"), + ("BUGS", "Known bugs"), + ("TODO", "To-do file"), + ] + + # + # Might be time to dump + # + if options.nobuild: + for variable in ('destinations', 'channels', 'whoami', 'date', + 'package', 'homepage', 'arch', 'keywords', \ + 'freshmeat_name', 'summary'): + print "%s = %s" % (variable, `eval(variable)`) + for variable in ('description', 'changelog', 'lastchange', 'mailtemplate', 'indextemplate'): + if not eval(variable): + print "No %s" % variable + else: + print "%s = <<EOF\n%sEOF" % (variable, eval(variable)) + sys.exit(0) + # + # Build deliverables + # + + suppress = " >/dev/null 2>&1" + if options.verbose: + suppress = "" + + # Sanity checks + if not os.path.exists(tarball): + croak("no tarball %s!" % tarball) + if metadata.type == "RPM" and not metadata.extract("BuildRoot"): + croak("specfile %s doesn't have a BuildRoot!" % metadata.filename) + + def newer(f1, f2): + return os.path.exists(f1) and (os.stat(f1).st_mtime > os.stat(f2).st_mtime) + + # Compute the deliverables, we need this even if not rebuilding the index + web_deliverables = [] + # Anything in the list of standard deliverables is eligible. + for (file, explanation) in stock_deliverables: + if os.path.exists(file): + web_deliverables.append((file, explanation)) + # So is anything with an HTML extendion + for file in glob.glob('*.html'): + if file == 'index.html': + continue + stem = file[:-4] + for ext in ("man", "1", "2", "3", "4", "5", "6", "7", "8", "9", "xml"): + if os.path.exists(stem + ext): + explanation = "HTML rendering of " + stem + ext + break + else: + explanation = "HTML page." + web_deliverables.append((file, explanation)) + # Compute final deliverables + deliverables = map(lambda x: x[0], web_deliverables)+["index.html"] + + try: + delete_at_end = [] + + # RPMs first. + if options.force or \ + (not os.path.exists(binrpm) or not os.path.exists(srcrpm)): + print "# Building RPMs..." + if newer(srcrpm, tarball) and newer(binrpm, tarball): + print "RPMs are up to date" + else: + do_or_die("buildrpms %s %s" % (tarball, suppress)) + delete_at_end.append(srcrpm) + delete_at_end.append(binrpm) + + # Next, the LSM if needed + if 'ibiblio' in channels and \ + (options.force or not os.path.exists(lsm)): + print "# Building LSM..." + if keywords: + do_or_die("rpm2lsm -k '"+keywords+"' "+binrpm+" >"+lsm) + else: + print "# Warning: LSM being built with no keywords." + do_or_die("rpm2lsm " + binrpm + ">" + lsm) + delete_at_end.append(lsm) + + # Next the index page if it doesn't exist. + if homepage and (options.force or not os.path.exists("index.html")): + print "# Building index page..." + # Now build the resource table + resourcetable = '<table border="1" align="center" summary="Downloadable resources">\n' + for (file, explanation) in web_deliverables: + resourcetable += "<tr><td><a href='%s'>%s</a></td><td>%s</td></tr>\n" % (file,file,explanation) + resourcetable += "</table>" + # OK, now build the index page itself + ofp = open("index.html", "w") + ofp.write(indextemplate % globals()) + ofp.close() + delete_at_end.append("index.html") + + # Next the CHANGES file. Build this only if (a) there is no ChangeLog, + # and (b) there is a specfile %changelog. + if not os.path.exists("ChangeLog") and \ + (options.force or not os.path.exists("CHANGES")) and changelog: + print "# Building CHANGES..." + ofp = open("CHANGES", "w") + ofp.write(" Changelog for " + package + "\n\n") + ofp.write(changelog) + ofp.close() + delete_at_end.append("CHANGES") + + # The freshmeat announcement + if 'freshmeat' in channels \ + and options.force or not os.path.exists("ANNOUNCE.FRESHMEAT"): + print "# Building ANNOUNCE.FRESHMEAT..." + if not homepage: + print "# Can't announce to freshmeat without a primary website!" + elif not lastchange: + print "# Can't announce to freshmeat without a changes field!" + else: + while True: + focus = raw_input("# freshmeat.net release focus (? for list): ") + if focus == '?': + i = 0 + for f in freshmeat_focus_types: + print "%d: %s" % (i, f) + i += 1 + elif focus in "0123456789": + print "# OK:", freshmeat_focus_types[int(focus)] + break + elif focus.lower() in map(lambda x: x.lower(), freshmeat_focus_types): + break + else: + croak("not a valid freshmeat.net release focus!") + ofp = open("ANNOUNCE.FRESHMEAT", "w") + ofp.write("Project: %s\n"%(freshmeat_name or package)) + ofp.write("Version: %s\n"% version) + ofp.write("Release-Focus: %s\n" % focus) + ofp.write("Home-Page-URL: %s\n" % homepage) + if os.path.exists(tarball): + ofp.write("Gzipped-Tar-URL: %s\n" % os.path.join(homepage,tarball)) + if os.path.exists(zip): + ofp.write("Zipped-Tar-URL: %s\n" % os.path.join(homepage, zip)) + if os.path.exists("CHANGES"): + ofp.write("Changelog-URL: %s\n" % os.path.join(homepage, "CHANGES")) + if os.path.exists(binrpm): + ofp.write("RPM-URL: %s\n" % os.path.join(homepage, binrpm)) + # freshmeat.net doesn't like bulleted entries. + freshmeatlog = lastchange[2:].replace("\n ", "\n") + ofp.write("\n" + freshmeatlog) + ofp.close() + delete_at_end.append("ANNOUNCE.FRESHMEAT") + + # Finally, email notification + if filter(lambda x: x.startswith("mailto:"), destinations) \ + and (options.force or not os.path.exists("ANNOUNCE.EMAIL")): + print "# Building ANNOUNCE.EMAIL..." + ofp = open("ANNOUNCE.EMAIL", "w") + ofp.write(mailtemplate % globals()) + ofp.close() + delete_at_end.append("ANNOUNCE.FRESHMEAT") + + # + # Now actually ship + # + + # Shipping methods, locations, and deliverables for public channels. + hardwired = { + 'freshmeat' : (lambda: freshmeat_ship(("ANNOUNCE.FRESHMEAT",))), + 'ibiblio' : (lambda: upload("ftp://ibiblio.org/incoming/linux", + (tarball, binrpm, srcrpm, lsm))), + 'redhat' : (lambda: upload("ftp://incoming.redhat.com/libc6", + (tarball, binrpm, srcrpm))), + } + + + # First ship to private channels. Order is important here, we + # need to hit the user's primary website first so everything + # will be in place when announcements are generated. + for destination in destinations: + if destination.startswith("ftp:"): + upload(destination, (tarball, binrpm, srcrpm,)) + elif destination.startswith("mailto:"): + print "# Mailing to %s" % destination + command = "sendmail -i -oem -f %s %s <ANNOUNCE.EMAIL" % (whoami, destination[7:]) + if options.noupload: + print command + else: + do_or_die(command) + else: + upload(destination, deliverables) + + # Now ship to public channels + for channel in channels: + print "# Shipping to public channel", channel + apply(hardwired[channel]) + finally: + cleanup = "rm -f " + " ".join(delete_at_end) + if options.noupload: + print cleanup + else: + for file in delete_at_end: + os.system(cleanup) + print "# Done" +except KeyboardInterrupt: + print "# Bye!" + + + +# The following sets edit modes for GNU EMACS +# Local Variables: +# mode:python +# End: diff --git a/dist-tools/shipper/shipper.1 b/dist-tools/shipper/shipper.1 new file mode 100644 index 00000000..a2ca011d --- /dev/null +++ b/dist-tools/shipper/shipper.1 @@ -0,0 +1,294 @@ +.\"Generated by db2man.xsl. Don't modify this, modify the source. +.de Sh \" Subsection +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.TH "SHIPPER" 1 "" "" "" +.SH NAME + shipper \- automatic drop-shipping of project releases +.SH "SYNOPSIS" + +.nf +\fBshipper\fR [-h] [-n] [-N] [-f] [-v] +.fi + +.nf +\fBbuildrpms\fR {\fItarball\fR} +.fi + +.SH "DESCRIPTION" + +.PP +shipper is a tool for shipping project releases. Its job is to make it possible for you to run the command \fBshipper\fR in the top-level directory of a project and have a release be properly exported to all the places that you normally deliver it -- your personal website, Linux source code archive sites, and distribution submission queues. A second goal is to arrange your shipping process in such a way that metadata like your project version only have to be kept in one place and modified once per release. The overall goal is to reduce the friction cost of shipping releases to as near zero as possible. + +.PP +buildrpms is a helper script that builds source and binary RPMs from a specified tarball with a BuildRoot field. shipper also calls \fBrpm2lsm\fR(1) to do part of its work. + +.PP +As much as possible, shipper tries to deduce what it should do rather than requiring you to tell it. In order to do this, it relies on your project obeying standard GNU-like naming conventions. It also relies on being able to mine project metadata out of a package specfile. (Presently the only variety of package specfile supported is an RPM spec; this may change in the future, when we fully support shipping Debian packages.) + +.PP +In normal use, you need set only one configuration variable, which is the list of private destinations to ship to. You may also want to add some magic ``Keywords'' comments to your project specfiles. Once you have shipper up and running, you can experiment with more advanced features such as having the program generate project web pages for you. + +.SH "THEORY OF OPERATION" + +.PP +shipper pushes deliverables out to destinations. Deliverables include: source tarballs, source zip archives, source RPMs, binary RPMs, ChangeLog files, README files, LSM files, and various other project metadata files. Destinations include both private destinations like websites, FTP archive sites and mailing lists, and public channels like ibiblio, freshmeat.net, and the submission queues for various well-known operating-system distributions. The shipper framework is extensible and it is relatively easy to add new channel types and new deliverables; in the future, we hope to support (for example) Debian packages as deliverables and SourceForge as a channel. + +.PP +shipper's first step is to find the project name and version, then to check that the minimum set of files that shipper requires to continue is in place. To start with, shipper needs a source tarball and a specfile. Once it knows those are in place, it can extract various pieces of information it will need to do its real work. It also reads in a handful of configuration variables. The -N (nobuild) option causes it to dump all configuration values and stop there. + +.PP +The first real work that gets done is finding or building local deliverables. These are either generated deliverables (like RPMs) that can be rebuilt automatically, or or stock deliverables (like a README file) that have to be changed by hand. shipper rebuilds any generated deliverable that doesn't exist when it starts up. Building local deliverables is separated from uploading because it means that you can stop and inspect what you're going to ship before committing to an upload. + +.PP +The -n (noupload) option stops before uploading, leaving all local deliverables in place but displaying the exact upload commands that would have been used to ship them. The -f (force) option forces a rebuild of all generated deliverables, even those that already exist. The command \fBshipper -f -n\fR will show you exactly what shipper would do for a real upload. + +.PP +Once all local deliverables have been built, shipper can begin uploading files and posting announcements. It does private destinations first, then public channels. This means, for example, that if you give shipper your personal website as a destination, the website will get updated each time before any submissions or announcements are sent to public sites like ibiblio.org or freshmeat.net. + +.PP +When uploads are complete, shipper cleans up after itself by deleting any deliverables it created for this run. Deliverables that were found and up to date are not removed. + +.PP +Finally, note that shipper makes one important assumption about the structure of your website(s). Beneath each directory in your \fIdestinations\fR list, there will be one subdirectory for each project, with the directory leaf name being the same as the project. Thus, for example, if you have three projects named ruby, diamond and sapphire, and your personal site is at \fIgemstones.net:/public/www/precious/\fR, shipper will expect to be able to drop deliverables in three directories \fIgemstones.net:/public/www/precious/ruby\fR, \fIgemstones.net:/public/www/precious/diamond/\fR, and \fIgemstones.net:/public/www/precious/sapphire/\fR. Note that shipper will not create these project directories for you if they're missing; this is deliberate, so that uploads to sites that are not prepared for them will fail noisily. + +.SH "HOW SHIPPER DEDUCES WHAT TO DO" + +.PP +The behavior of shipper depends on a handful of internal variables. Some of these variables have defaults computed at startup time. All can be set or overridden in the per-user \fI~/.shipper\fR file, and overridden in any per-project \fI.shipper\fR file. Both files are Python code and the syntax of variable settings is Python's. + +.PP +If a variable is set in a config file, that value is locked in (except for the \fIdestinations\fR variable which can be appended to from a specfile, see below) Variables that are not set in a config file may be set by the values of fields in your project specfile. + +.PP +For basic use, it is only necessary to set one such variable: \fIdestinations\fR, the list of destinations to ship to. Normally you'll set this globally, pointing all your projects at your main distribution website, in your \fI~/.shipper\fR file; it is also possible to add destinations on a per-project basis by giving a comma-separated list in a #Destinations: comment in the specfile. You can set the variable in a per-project \fI.shipper\fR to ignore your global destination list. + +.PP +The first thing shipper looks for is a specfile in the current directory; there must be exactly one. It extracts the project name from the Name field. Next step is to find the project version (the variable \fIpackage\fR). This is extracted from the specfile, or by looking for a makefile macro with a name beginning with VERS; if the value of that macro is a shell command wrapped in $(shell ...), it is executed and the output is captured to yield the version. If both versions are present, they are consistency-checked. + +.PP +shipper gets most of the rest of the data it uses to decide what to do from headers in the specfile. The following table lists all the variables and their corresponding specfile fields. shipper uses the RPM spec file fields: the Debian entries are informational only. +VariableRPM specfile fieldDebian specfile fieldMeaning\fIdestinations\fR#Destinations:XBS-Destinations: +.PP +A list of remote directories to ship to using \fBscp\fR(1). Each location is a place to drop deliverables: either a [user@]site:path destination that \fBscp\fR(1) can use, or an FTP url that \fBlftp\fR(1) can use. Note that actual project directories are computed by appending the value of \fIpackage\fR to the destination you're shipping to. + +.PP +There is no default.. If you do not set this variable, shipper will ship only to public channels. +\fIchannels\fR-- +.PP +The list of public channels to be shipped to after the private channels in the \fIdestination\fR list. You can disable one or more of these in a config file by calling the function \fBdisable()\fR; for example with \fBdisable('freshmeat')\fR. +\fIwhoami\fR-- +.PP +A plausible email address for the user. If not specified in the config file, it's generated from \fB$USERNAME\fR and \fB$HOSTNAME\fR. +\fIdate\fR-- +.PP +The program's startup time. This can be used in the web page and email announcement templates. + +.PP +You can use the Python function time.strftime("...") in your \fI~/.shipper\fR file to format this date to your taste. If you don't set this in the config file, the program will set it for you. +\fIindextemplate\fR-- +.PP +Template HTML from which to generate index.html for shipping. There is a default which generates a very simple page containing a title, a date, and a table listing downloadable resources. This is used when shipping to a web directory, if no index page exists when shipper is run. +\fImailtemplate\fR-- +.PP +Template text from which to generate the file ANNOUNCE.EMAIL to be shipped to destinations that are mailto URLs. There is a default which generates a very simple email containing a subject, a pointer to the project web page, and the last entry in the project changelog. +\fIpackage\fRName:Package: +.PP +Project name, used to generate the stem part of the names of RPMs and other deliverables that shipper builds. If the specfile is a Debian control file, the Debian-specific part of the version number (after the dash) is removed. +\fIversion\fRVersion:Version: +.PP +Project version, used in generating the names of RPMs and other deliverables that shipper builds. +\fIhomepage\fRURL:XBS-Home-Page: +.PP +Project home page URL. Used when generating project announcements. +\fIarch\fRBuildArch:Architecture: +.PP +Build architecture. If this field is ``noarch'', noarch rather than binary RPMs will be built. +\fIkeywords\fR#Keywords:XBS-Keywords: +.PP +Topic keywords. Used when generating LSM files. +\fIfreshmeat_name\fR#Freshmeat-Name:XBS-Freshmeat-Name: +.PP +Freshmeat shortname, used in generating freshmeat.net announcements. If this isn't present, it defaults to the project name; you only need to set it if they differ. +\fIsummary\fRSummaryDescription: +.PP +The one-line project summary field from your specfile. +\fIdescription\fR%descriptionDescription: +.PP +The Description field from your specfile. +\fIchangelog\fRChangeLog or %changelog- +.PP +If a \fIChangeLog\fR file exists in the project directory, its entire contents. Otherwise, if it exists, the entire changelog section from the specfile. +\fIlastchange\fRChangeLog or %changelog- +.PP +If the source of your changlog was your specfile, this is the most recent entry from your changelog without its date/author/release header. If the source was Changelog, a line of text directing the user to see the ChangeLog file. This becomes the Changes field in your freshmeat.net announcement, and freshmeat.net doesn't like the bulleted format of GNU ChangeLog entries. +\fIresourcetable\fR-- +.PP +The HTML table of links to downloadable resources. This variable is only computed if the index page is built. Any setting of it in the startup files is ignored. + +.PP +All these variables are available for substitution at the time a web page or email announcement is generated. In general, any variable you set in your \fI~/.shipper\fR file will be available at the time the web page or email announcement is generated. Use the Python "%(variable)s" syntax, not shell-substitution syntax. + +.SH "FINDING AND BUILDING LOCAL DELIVERABLES" + +.PP +The following files are considered stock deliverables and may be shipped if they are present when shipper starts up: +FileExplanationREADME +.PP +Project roadmap file. +tarball +.PP +The current source tarball, that is the file named ${package}-${version}.tar.gz. +zipfile +.PP +The current source zip archive, that is the file named ${package}-${version}.zip. +NEWS +.PP +Project news file. +ChangeLog +.PP +Project change log. +HISTORY +.PP +Project history file. +BUGS +.PP +Project bug list. +TODO +.PP +Current to-do list. +*.html +.PP +Any files with an .html extension will be shipped to all website destinations. + +.PP +Here are the generated deliverables that shipper will build and ship, if they don't exist when it starts up. Any of these that are created will be deleted after a successful upload. +TypeExplanationindex.html +.PP +An index web page, to be shipped to any website destination. +RPMs +.PP +Source and either binary or noarch RPMs. +LSM +.PP +If the ibiblio channel is enabled, shipper will generate a Linux Software Map file for it. +CHANGES +.PP +If there is no ChangeLog file but there was a %changelog in your specfile, shipper will generate a CHANGES from the changelog entries in the specfile and ship that. +ANNOUNCE.FRESHMEAT +.PP +If there is no ANNOUNCE.FRESHMEAT file, shipper will generate one. It will be a job card that can be fed to freshmeat.net's XML-RPC interface via \fBfreshmeat-submit\fR(1). +ANNOUNCE.EMAIL +.PP +If there is no ANNOUNCE.EMAIL file, shipper will generate one to be emailed to destinations that are mailto URLs. + +.SH "SHIPPING TO DESTINATIONS" + +.PP +In operation, shipper walks through a list of destinations, building the required deliverables for each one and performing the required shipping actions to push them out to the destination. Here are the channel types shipper knows about: +Channel TypeDeliverablesSpecified byExplanationibibliotarball, RPMs, LSM file- +.PP +If the ibiblio channel is enabled (it is by default), shipper will attempt to ship a source tarball, RPMs, and an an LSM file to ibiblio.org via FTP. The LSM file will be automatically generated. +redhatRPMs- +.PP +If the Red Hat channel is enabled (it is by default), shipper will attempt to ship source and binary RPMs to the Red Hat submission directory via FTP. +freshmeatANNOUNCE.FRESHMEAT- +.PP +If the freshmeat channel is enabled (it is by default), shipper will attempt to post a release announcement on freshmeat.net using \fBfreshmeat-submit\fR(1). The announcement will include URLs for whichever of the following deliverables are shipped, using the URL field from your specfile: tarball, zipfile, RPMs, CHANGES. The user will be prompted for a Freshmeat release-focus. This announcement is generated into the local deliverable ANNOUNCE.FRESHMEAT. +Generic Web siteREADME, tarball, zipfile, RPMs, CHANGES, NEWS, HISTORY, *.html, +BUGS, TODO.scp destination ([user@]host:dir) +.PP +This channel type represents a website. shipper uses \fBscp\fR(1) to put deliverables on websites. If the user part of the scp destination is absent, it will be taken from the environment variable \fBUSERNAME\fR. + +.PP +No generic Web sites are shipped to by default. You must declare them by putting scp destinations in the \fIdestinations\fR variable. +Generic FTP sitetarball, RPMsFTP URL +.PP +Old-fashioned FTP site with no metadata. The FTP URL is parsed to get the sitename and directory where deliverables should be dropped. The FTP username to be used will be taken from the environment variable \fBUSERNAME\fR. The FTP password will be looked up in your \fI~/.netrc\fR file. + +.PP +No generic FTP sites are shipped to by default. You must declare them by putting FTP urls in the \fIdestinations\fR variable. +Email addressANNOUNCE.EMAILmailto URL +.PP +The contents of the generated ANNOUNCE.EMAIL file is emailed to each email address specified as a channel. + +.PP +No email channels are set up by default. You must declare them by putting mailto: urls in the \fIdestinations\fR variable. +rsync unitSRPMrsync address ([user@]host::unit) +.PP +An SRPM is shipped to each destination that is rcognized as an rsync address (by the double colon). + +.PP +No rsync channels are set up by default. You must declare them by putting rsync addresses in the \fIdestinations\fR variable. + +.SH "COMMAND-LINE OPTIONS" + +.PP +The -n option of shipper suppresses uploads, just building all deliverables locally. The -N option suppresses both uploads and builds, generating a configuration dumop instead. The -f option forces rebuilding of local deliverables even if they already exist. The -v option makes shipper chatty about what it's doing. The -h option prints a usage message and exits. + +.SH "HINTS AND TIPS" + +.PP +The following variable definition in your makefile will ensure that the makefile version is derived from (and thus always consistent with) the specfile version. + +.nf + +VERS=$(shell sed <*.spec -n -e '/Version: \\(.*\\)/s//\\1/p') + +.fi + +.PP +A makefile production like the following will allow you to type \fBmake release\fR and be sure that all the deliverables shipper knows about will be rebuilt before being shipped. + +.nf + +release: package-$(VERS).tar.gz package.html + shipper -f + +.fi + +.PP +You will want to change package to your project name. Note that you should not use this recipe if your project has its own (non-generated) index page, as the -f option will overwrite \fIindex.html\fR. + +.PP +To make \fBrpm\fR(1) build noarch rather than binary RPMs, insert the following header in your specfile: + +.nf + +BuildArch: noarch + +.fi + +.SH "AUTHOR" + +.PP +Eric S. Raymond <esr@thyrsus.com>. The buildrpms script was originally by Sean Reifschneider. + +.PP +There is a project web page at : http://www.catb.org/~esr/shipper/http://www.catb.org/~esr/shipper/. + +.SH "BUGS" + +.PP +The rsync channel type is untested. Shipping Debian packages should be supported. + +.SH "SEE ALSO" + +.PP + \fBfreshmeat-submit\fR(1), \fBlftp\fR(1), \fBrpm2lsm\fR(1), \fBscp\fR(1), \fBssh\fR(1). + diff --git a/dist-tools/shipper/shipper.spec b/dist-tools/shipper/shipper.spec new file mode 100644 index 00000000..3a3646a5 --- /dev/null +++ b/dist-tools/shipper/shipper.spec @@ -0,0 +1,69 @@ +Name: shipper +Version: 0.5 +Release: 1 +URL: http://www.catb.org/~esr/shipper/ +Source0: %{name}-%{version}.tar.gz +License: GPL +Group: Utilities +Summary: automated shipping of open-source project releases +Requires: lftp, openssh-clients, freshmeat-submit +BuildRoot: %{_tmppath}/%{name}-root +BuildArch: noarch +#Keywords: packaging, distribution + +%description +shipper is a power distribution tool for developers with multiple +projects who do frequent releases. It automates the tedious process +of shipping a software release to several standard places, including +ibiblio, the Red Hat submission directory, and your own hosted +website. It also knows how to post a release announcement to +freshmeat.net via freshmeat-submit. Two auxiliary tools, buildrpms +and rpm2lsm, build RPMs and generate LSM files from them respectively. + +%prep +%setup -q + +%build +make %{?_smp_mflags} shipper.1 rpm2lsm.1 + +%install +[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" +mkdir -p "$RPM_BUILD_ROOT"%{_bindir} +mkdir -p "$RPM_BUILD_ROOT"%{_mandir}/man1/ +cp shipper rpm2lsm buildrpms "$RPM_BUILD_ROOT"%{_bindir} +cp shipper.1 rpm2lsm.1 "$RPM_BUILD_ROOT"%{_mandir}/man1/ + +%clean +[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" + +%files +%defattr(-,root,root,-) +%doc README COPYING +%{_bindir}/shipper +%{_bindir}/rpm2lsm +%{_bindir}/buildrpms +%{_mandir}/man1/shipper.1* +%{_mandir}/man1/rpm2lsm.1* + +%changelog +* Fri Feb 6 2004 Eric S. Raymond <esr@snark.thyrsus.com> 0.5-1 +- Added security check so the ~/.shipper and .shipper files can't be used + for privilege elevation. Fixed upload omission bug in case where neither + -n nor -f was on and the webpage wasn't being built. Deliverables + created for upload are deleted at end of run. + +* Sun Jan 11 2004 Eric S. Raymond <esr@snark.thyrsus.com> 0.4-1 +- Correct extraction of freshmeat name. Build generated deliverables + only if we know they will be needed. Help is now available at the + freshmeat-focus prompt. + +* Sat Jan 10 2004 Eric S. Raymond <esr@snark.thyrsus.com> 0.3-1 +- First alpha release of unified shipper package. It can ship itself. + +* Wed Dec 17 2003 Eric S. Raymond <esr@snark.thyrsus.com> +- rpm2lsm now grabs an RPM from the current directory if no argument, + and parses an AUTHORS file if present (GNU convention). Also, + this release fixes a bug in USERNAME handling. + +* Thu Aug 1 2002 Eric S. Raymond <esr@snark.thyrsus.com> +- Initial release of rpm2lsm, since folded into shipper package. diff --git a/dist-tools/shipper/shipper.xml b/dist-tools/shipper/shipper.xml new file mode 100644 index 00000000..765f0f54 --- /dev/null +++ b/dist-tools/shipper/shipper.xml @@ -0,0 +1,752 @@ +<!DOCTYPE refentry PUBLIC + "-//OASIS//DTD DocBook XML V4.1.2//EN" + "docbook/docbookx.dtd"> +<refentry id='shipper.1'> +<refmeta> +<refentrytitle>shipper</refentrytitle> +<manvolnum>1</manvolnum> +</refmeta> +<refnamediv id='name'> +<refname> shipper</refname> +<refpurpose>automatic drop-shipping of project releases</refpurpose> +</refnamediv> +<refsynopsisdiv id='synopsis'> + +<cmdsynopsis> + <command>shipper</command> + <arg choice='opt'>-h</arg> + <arg choice='opt'>-n</arg> + <arg choice='opt'>-N</arg> + <arg choice='opt'>-f</arg> + <arg choice='opt'>-v</arg> +</cmdsynopsis> +<cmdsynopsis> + <command>buildrpms</command> + <arg choice='req'><replaceable>tarball</replaceable></arg> +</cmdsynopsis> +</refsynopsisdiv> + +<refsect1><title>Description</title> + +<para><application>shipper</application> is a tool for shipping +project releases. Its job is to make it possible for you to run the +command <command>shipper</command> in the top-level directory of a +project and have a release be properly exported to all the places that +you normally deliver it — your personal website, Linux source +code archive sites, and distribution submission queues. A second goal +is to arrange your shipping process in such a way that metadata like +your project version only have to be kept in one place and modified +once per release. The overall goal is to reduce the friction cost +of shipping releases to as near zero as possible.</para> + +<para><application>buildrpms</application> is a helper script that +builds source and binary RPMs from a specified tarball with a +BuildRoot field. <application>shipper</application> also calls +<citerefentry> +<refentrytitle>rpm2lsm</refentrytitle> +<manvolnum>1</manvolnum></citerefentry> to do part of its work.</para> + +<para>As much as possible, <application>shipper</application> tries to +deduce what it should do rather than requiring you to tell it. In +order to do this, it relies on your project obeying standard GNU-like +naming conventions. It also relies on being able to mine project +metadata out of a package specfile. (Presently the only variety of +package specfile supported is an RPM spec; this may change in the future, +when we fully support shipping Debian packages.)</para> + +<para>In normal use, you need set only one configuration variable, +which is the list of private destinations to ship to. You may also +want to add some magic <quote>Keywords</quote> comments to your +project specfiles. Once you have <application>shipper</application> +up and running, you can experiment with more advanced features +such as having the program generate project web pages for you.</para> +</refsect1> + +<refsect1><title>Theory of Operation</title> + +<para><application>shipper</application> pushes +<emphasis>deliverables</emphasis> out to +<emphasis>destinations</emphasis>. Deliverables include: source tarballs, +source zip archives, source RPMs, binary RPMs, ChangeLog files, README +files, LSM files, and various other project metadata files. Destinations +include both <emphasis>private destinations</emphasis> like websites, FTP +archive sites and mailing lists, and <emphasis>public +channels</emphasis> like ibiblio, freshmeat.net, and the submission +queues for various well-known operating-system distributions. The +shipper framework is extensible and it is relatively easy to add new +channel types and new deliverables; in the future, we hope to support +(for example) Debian packages as deliverables and SourceForge as a +channel.</para> + +<para><application>shipper</application>'s first step is to find the +project name and version, then to check that the minimum set of files that +<application>shipper</application> requires to continue is in place. +To start with, <application>shipper</application> needs a source +tarball and a specfile. Once it knows those are in place, it +can extract various pieces of information it will need to do its +real work. It also reads in a handful of configuration variables. +The -N (nobuild) option causes it to dump all configuration values and +stop there.</para> + +<para>The first real work that gets done is finding or building local +deliverables. These are either <emphasis>generated +deliverables</emphasis> (like RPMs) that can be rebuilt automatically, +or or <emphasis>stock deliverables</emphasis> (like a README file) +that have to be changed by hand. <application>shipper</application> +rebuilds any generated deliverable that doesn't exist when it starts +up. Building local deliverables is separated from uploading because +it means that you can stop and inspect what you're going to ship +before committing to an upload.</para> + +<para>The -n (noupload) option stops before uploading, leaving all +local deliverables in place but displaying the exact upload commands +that would have been used to ship them. The -f (force) option forces +a rebuild of all generated deliverables, even those that already +exist. The command <command>shipper -f -n</command> will show you +exactly what <application>shipper</application> would do for a real +upload.</para> + +<para>Once all local deliverables have been built, +<application>shipper</application> can begin uploading files and +posting announcements. It does private destinations first, then public +channels. This means, for example, that if you give +<application>shipper</application> your personal website as a destination, the +website will get updated each time <emphasis>before</emphasis> +any submissions or announcements are sent to public sites like +ibiblio.org or freshmeat.net.</para> + +<para>When uploads are complete, <application>shipper</application> +cleans up after itself by deleting any deliverables it created for +this run. Deliverables that were found and up to date are not +removed.</para> + +<para>Finally, note that <application>shipper</application> makes one +important assumption about the structure of your website(s). Beneath +each directory in your <varname>destinations</varname> list, there +will be one subdirectory for each project, with the directory leaf +name being the same as the project. Thus, for example, if you have +three projects named ruby, diamond and sapphire, and your personal +site is at <filename>gemstones.net:/public/www/precious/</filename>, +<application>shipper</application> will expect to be able to drop +deliverables in three directories +<filename>gemstones.net:/public/www/precious/ruby</filename>, +<filename>gemstones.net:/public/www/precious/diamond/</filename>, and +<filename>gemstones.net:/public/www/precious/sapphire/</filename>. +Note that <application>shipper</application> will not create these +project directories for you if they're missing; this is deliberate, so +that uploads to sites that are not prepared for them will fail +noisily.</para> + +</refsect1> + +<refsect1><title>How Shipper Deduces What To Do</title> + +<para>The behavior of shipper depends on a handful of internal +variables. Some of these variables have defaults computed at startup +time. All can be set or overridden in the per-user +<filename>~/.shipper</filename> file, and overridden in any +per-project <filename>.shipper</filename> file. Both files are Python +code and the syntax of variable settings is Python's.</para> + +<para>If a variable is set in a config file, that value is locked in +(except for the <varname>destinations</varname> variable which can be +appended to from a specfile, see below) Variables that are +<emphasis>not</emphasis> set in a config file may be set by the values +of fields in your project specfile.</para> + +<para>For basic use, it is only necessary to set one such variable: +<varname>destinations</varname>, the list of destinations to ship to. +Normally you'll set this globally, pointing all your projects at your +main distribution website, in your <filename>~/.shipper</filename> +file; it is also possible to add destinations on a per-project basis +by giving a comma-separated list in a #Destinations: comment in the +specfile. You can set the variable in a per-project +<filename>.shipper</filename> to ignore your global destination +list.</para> + +<para>The first thing shipper looks for is a specfile in the +current directory; there must be exactly one. It extracts the project +name from the Name field. Next step is to find the project version +(the variable <varname>package</varname>). This is extracted from the +specfile, or by looking for a makefile macro with a name +beginning with VERS; if the value of that macro is a shell command +wrapped in $(shell ...), it is executed and the output is captured to +yield the version. If both versions are present, they are +consistency-checked.</para> + +<para><application>shipper</application> gets most of the rest of the +data it uses to decide what to do from headers in the specfile. +The following table lists all the variables and their corresponding +specfile fields. <application>shipper</application> uses the RPM spec +file fields: the Debian entries are informational only.</para> + +<informaltable> +<tgroup cols="4"> +<thead> +<row> +<entry>Variable</entry> +<entry>RPM specfile field</entry> +<entry>Debian specfile field</entry> +<entry>Meaning</entry> +</row> +</thead> +<tbody> +<row> +<entry><varname>destinations</varname></entry> +<entry>#Destinations:</entry> +<entry>XBS-Destinations:</entry> +<entry> +<para>A list of remote directories to ship to using +<citerefentry> +<refentrytitle>scp</refentrytitle> <manvolnum>1</manvolnum> +</citerefentry>. Each location is a place to drop deliverables: +either a [user@]site:path destination that +<citerefentry> +<refentrytitle>scp</refentrytitle> <manvolnum>1</manvolnum> +</citerefentry> can use, or an FTP url that +<citerefentry> +<refentrytitle>lftp</refentrytitle> <manvolnum>1</manvolnum> +</citerefentry> +can use. Note that actual project directories are computed by +appending the value of <varname>package</varname> to +the destination you're shipping to.</para> + +<para><emphasis role='bold'>There is no default.</emphasis>. If you +do not set this variable, <application>shipper</application> will +ship only to public channels.</para> +</entry> +</row> +<row> +<entry><varname>channels</varname></entry> +<entry align='center'>-</entry> +<entry align='center'>-</entry> +<entry> +<para>The list of public channels to be shipped to after the private +channels in the <varname>destination</varname> list. You can disable +one or more of these in a config file by calling the function +<function>disable()</function>; for example with +<command>disable('freshmeat')</command>.</para> +</entry> +</row> +<row> +<entry><varname>whoami</varname></entry> +<entry align='center'>-</entry> +<entry align='center'>-</entry> +<entry> +<para>A plausible email address for the user. If not specified in the +config file, it's generated from +<envar>$USERNAME</envar> and <envar>$HOSTNAME</envar>.</para> +</entry> +</row> +<row> +<entry><varname>date</varname></entry> +<entry align='center'>-</entry> +<entry align='center'>-</entry> +<entry> +<para>The program's startup time. This can be used in the web page and +email announcement templates.</para> + +<para>You can use the Python function time.strftime("...") in your +<filename>~/.shipper</filename> file to format this date to your +taste. If you don't set this in the config file, the program will +set it for you.</para> +</entry> +</row> +<row> +<entry><varname>indextemplate</varname></entry> +<entry align='center'>-</entry> +<entry align='center'>-</entry> +<entry> +<para>Template HTML from which to generate index.html for shipping. There is a +default which generates a very simple page containing a title, a +date, and a table listing downloadable resources. This is used when +shipping to a web directory, if no index page exists when shipper +is run.</para> +</entry> +</row> +<row> +<entry><varname>mailtemplate</varname></entry> +<entry align='center'>-</entry> +<entry align='center'>-</entry> +<entry> +<para>Template text from which to generate the file ANNOUNCE.EMAIL to be +shipped to destinations that are mailto URLs. There is a default which +generates a very simple email containing a subject, a pointer to the +project web page, and the last entry in the project changelog.</para> +</entry> +</row> +<row> +<entry><varname>package</varname></entry> +<entry>Name:</entry> +<entry>Package:</entry> +<entry> +<para>Project name, used to generate the stem part of the names of RPMs and +other deliverables that <application>shipper</application> +builds. If the specfile is a Debian control file, the Debian-specific +part of the version number (after the dash) is removed.</para> +</entry> +</row> +<row> +<entry><varname>version</varname></entry> +<entry>Version:</entry> +<entry>Version:</entry> +<entry> +<para>Project version, used in generating the names of RPMs and +other deliverables that <application>shipper</application> +builds.</para> +</entry> +</row> +<row> +<entry><varname>homepage</varname></entry> +<entry>URL:</entry> +<entry>XBS-Home-Page:</entry> +<entry> +<para>Project home page URL. Used when generating project +announcements.</para> +</entry> +</row> +<row> +<entry><varname>arch</varname></entry> +<entry>BuildArch:</entry> +<entry>Architecture:</entry> +<entry> +<para>Build architecture. If this field is <quote>noarch</quote>, +noarch rather than binary RPMs will be built.</para> +</entry> +</row> +<row> +<entry><varname>keywords</varname></entry> +<entry>#Keywords:</entry> +<entry>XBS-Keywords:</entry> +<entry> +<para>Topic keywords. Used when generating LSM files.</para> +</entry> +</row> +<row> +<entry><varname>freshmeat_name</varname></entry> +<entry>#Freshmeat-Name:</entry> +<entry>XBS-Freshmeat-Name:</entry> +<entry> +<para>Freshmeat shortname, used in generating freshmeat.net +announcements. If this isn't present, it defaults to the project +name; you only need to set it if they differ.</para> +</entry> +</row> +<row> +<entry><varname>summary</varname></entry> +<entry>Summary</entry> +<entry>Description:</entry> +<entry> +<para>The one-line project summary field from your specfile.</para> +</entry> +</row> +<row> +<entry><varname>description</varname></entry> +<entry>%description</entry> +<entry>Description:</entry> +<entry> +<para>The Description field from your specfile.</para> +</entry> +</row> +<row> +<entry><varname>changelog</varname></entry> +<entry>ChangeLog or %changelog</entry> +<entry align='center'>-</entry> +<entry> +<para>If a <filename>ChangeLog</filename> file exists in the project +directory, its entire contents. Otherwise, if it exists, +the entire changelog section from the specfile.</para> +</entry> +</row> +<row> +<entry><varname>lastchange</varname></entry> +<entry>ChangeLog or %changelog</entry> +<entry align='center'>-</entry> +<entry> +<para> +If the source of your changlog was your specfile, this is the +most recent entry from your changelog without +its date/author/release header. If the source was Changelog, a +line of text directing the user to see the ChangeLog file. +This becomes the Changes field in your freshmeat.net announcement, +and freshmeat.net doesn't like the bulleted format of GNU ChangeLog +entries.</para> +</entry> +</row> +<row> +<entry><varname>resourcetable</varname></entry> <entry +align='center'>-</entry> <entry align='center'>-</entry> +<entry> +<para>The HTML table of links to downloadable resources. This +variable is only computed if the index page is built. Any setting +of it in the startup files is ignored.</para> +</entry> +</row> +</tbody> +</tgroup> +</informaltable> + +<para>All these variables are available for substitution at the time a +web page or email announcement is generated. In general, any variable +you set in your <filename>~/.shipper</filename> file will be available +at the time the web page or email announcement is generated. Use the +Python "%(variable)s" syntax, not shell-substitution syntax.</para> + +</refsect1> + +<refsect1><title>Finding and Building Local Deliverables</title> + +<para>The following files are considered stock deliverables and may be +shipped if they are present when <application>shipper</application> +starts up:</para> + +<informaltable> +<tgroup cols="2"> +<thead> +<row> +<entry>File</entry> +<entry>Explanation</entry> +</row> +</thead> +<tbody> +<row> +<entry>README</entry> +<entry> +<para>Project roadmap file.</para> +</entry> +</row> +<row> +<entry>tarball</entry> +<entry> +<para>The current source tarball, that is the file named ${package}-${version}.tar.gz.</para> +</entry> +</row> +<row> +<entry>zipfile</entry> +<entry> +<para>The current source zip archive, that is the file named ${package}-${version}.zip.</para> +</entry> +</row> +<row> +<entry>NEWS</entry> +<entry> +<para>Project news file.</para> +</entry> +</row> +<row> +<entry>ChangeLog</entry> +<entry> +<para>Project change log.</para> +</entry> +</row> +<row> +<entry>HISTORY</entry> +<entry> +<para>Project history file.</para> +</entry> +</row> +<row> +<entry>BUGS</entry> +<entry> +<para>Project bug list.</para> +</entry> +</row> +<row> +<entry>TODO</entry> +<entry> +<para>Current to-do list.</para> +</entry> +</row> +<row> +<entry>*.html</entry> +<entry> +<para>Any files with an .html extension will be shipped to all +website destinations.</para> +</entry> +</row> +</tbody> +</tgroup> +</informaltable> + +<para>Here are the generated deliverables that +<application>shipper</application> will build and ship, if they don't +exist when it starts up. Any of these that are created will be +deleted after a successful upload.</para> + +<informaltable> +<tgroup cols="2"> +<thead> +<row> +<entry>Type</entry> +<entry>Explanation</entry> +</row> +</thead> +<tbody> +<row> +<entry>index.html</entry> +<entry> +<para>An index web page, to be shipped to any website destination.</para> +</entry> +</row> +<row> +<entry>RPMs</entry> +<entry> +<para>Source and either binary or noarch RPMs.</para> +</entry> +</row> +<row> +<entry>LSM</entry> +<entry> +<para>If the ibiblio channel is enabled, +<application>shipper</application> will generate a Linux Software Map +file for it.</para> +</entry> +</row> +<row> +<entry>CHANGES</entry> +<entry> +<para>If there is no ChangeLog file but there was a %changelog in your +specfile, <application>shipper</application> will generate a CHANGES +from the changelog entries in the specfile and ship that.</para> +</entry> +</row> +<row> +<entry>ANNOUNCE.FRESHMEAT</entry> +<entry> +<para>If there is no ANNOUNCE.FRESHMEAT file, +<application>shipper</application> will generate one. It will be a +job card that can be fed to freshmeat.net's XML-RPC interface via +<citerefentry><refentrytitle>freshmeat-submit</refentrytitle><manvolnum>1</manvolnum></citerefentry>. +</para> +</entry> +</row> +<row> +<entry>ANNOUNCE.EMAIL</entry> +<entry> +<para>If there is no ANNOUNCE.EMAIL file, <application>shipper</application> +will generate one to be emailed to destinations that are mailto URLs.</para> +</entry> +</row> +</tbody> +</tgroup> +</informaltable> +</refsect1> + +<refsect1><title>Shipping to Destinations</title> +<para>In operation, <application>shipper</application> walks through a +list of destinations, building the required deliverables for each one and +performing the required shipping actions to push them out to the +destination. Here are the channel types +<application>shipper</application> knows about:</para> + +<informaltable> +<tgroup cols="4"> +<colspec align='left'/> +<colspec align='left'/> +<colspec align='center'/> +<colspec align='left'/> +<thead> +<row> +<entry>Channel Type</entry> +<entry>Deliverables</entry> +<entry>Specified by</entry> +<entry>Explanation</entry> +</row> +</thead> +<tbody> +<row> +<entry>ibiblio</entry> +<entry>tarball, RPMs, LSM file</entry> +<entry>-</entry> +<entry> +<para>If the ibiblio channel is enabled (it is by default), +<application>shipper</application> will attempt to ship a source +tarball, RPMs, and an an LSM file to ibiblio.org via FTP. The LSM +file will be automatically generated.</para> +</entry> +</row> +<row> +<entry>redhat</entry> +<entry>RPMs</entry> +<entry>-</entry> +<entry> +<para>If the Red Hat channel is enabled (it is by default), +<application>shipper</application> will attempt to ship source +and binary RPMs to the Red Hat submission directory via FTP.</para> +</entry> +</row> +<row> +<entry>freshmeat</entry> +<entry>ANNOUNCE.FRESHMEAT</entry> +<entry>-</entry> +<entry> +<para>If the freshmeat channel is enabled (it is by default), +<application>shipper</application> will attempt to post a release +announcement on freshmeat.net using +<citerefentry><refentrytitle>freshmeat-submit</refentrytitle><manvolnum>1</manvolnum></citerefentry>. +The +announcement will include URLs for whichever of the following +deliverables are shipped, using the URL field from your specfile: tarball, +zipfile, RPMs, CHANGES. The user will be +prompted for a Freshmeat release-focus. This announcement is +generated into the local deliverable ANNOUNCE.FRESHMEAT.</para> +</entry> +</row> +<row> +<entry>Generic Web site</entry> +<entry>README, tarball, zipfile, RPMs, CHANGES, NEWS, HISTORY, *.html, +BUGS, TODO.</entry> +<entry>scp destination ([user@]host:dir)</entry> +<entry> +<para>This channel type represents a website. +<application>shipper</application> uses +<citerefentry><refentrytitle>scp</refentrytitle><manvolnum>1</manvolnum></citerefentry> +to put deliverables on websites. If the user part of the scp +destination is absent, it will be taken from the environment variable +<envar>USERNAME</envar>.</para> + +<para>No generic Web sites are shipped to by default. You must declare +them by putting scp destinations in the <varname>destinations</varname> +variable.</para> +</entry> +</row> +<row> +<entry>Generic FTP site</entry> +<entry>tarball, RPMs</entry> +<entry>FTP URL</entry> +<entry> +<para>Old-fashioned FTP site with no metadata. The FTP URL is parsed +to get the sitename and directory where deliverables should be dropped. The +FTP username to be used will be taken from the environment variable +<envar>USERNAME</envar>. The FTP password will be looked up in your +<filename>~/.netrc</filename> file.</para> + +<para>No generic FTP sites are shipped to by default. You must +declare them by putting FTP urls in the +<varname>destinations</varname> variable.</para> +</entry> +</row> +<row> +<entry>Email address</entry> +<entry>ANNOUNCE.EMAIL</entry> +<entry>mailto URL</entry> +<entry> +<para>The contents of the generated ANNOUNCE.EMAIL file is emailed to +each email address specified as a channel.</para> + +<para>No email channels are set up by default. You must +declare them by putting mailto: urls in the +<varname>destinations</varname> variable.</para> +</entry> +</row> +<row> +<entry>rsync unit</entry> +<entry>SRPM</entry> +<entry>rsync address ([user@]host::unit)</entry> +<entry> +<para>An SRPM is shipped to each destination that is rcognized as +an rsync address (by the double colon).</para> + +<para>No rsync channels are set up by default. You must +declare them by putting rsync addresses in the +<varname>destinations</varname> variable.</para> +</entry> +</row> +</tbody> +</tgroup> +</informaltable> +</refsect1> + +<refsect1><title>Command-line Options</title> + +<para>The -n option of <application>shipper</application> suppresses +uploads, just building all deliverables locally. The -N option +suppresses both uploads and builds, generating a configuration dumop +instead. The -f option forces rebuilding of local deliverables even +if they already exist. The -v option makes +<application>shipper</application> chatty about what it's doing. The +-h option prints a usage message and exits.</para> + +</refsect1> + +<refsect1><title>Hints and Tips</title> +<para>The following variable definition in your makefile will ensure +that the makefile version is derived from (and thus always consistent +with) the specfile version.</para> + +<programlisting> +VERS=$(shell sed <*.spec -n -e '/Version: \(.*\)/s//\1/p') +</programlisting> + +<para>A makefile production like the following will allow +you to type <command>make release</command> and be sure that all +the deliverables <application>shipper</application> knows about +will be rebuilt before being shipped.</para> + +<programlisting> +release: <emphasis>package</emphasis>-$(VERS).tar.gz <emphasis>package</emphasis>.html + shipper -f +</programlisting> + +<para>You will want to change <emphasis>package</emphasis> to your +project name. Note that you should not use this recipe if your +project has its own (non-generated) index page, as the -f option will +overwrite <filename>index.html</filename>.</para> + +<para>To make +<citerefentry> +<refentrytitle>rpm</refentrytitle><manvolnum>1</manvolnum> +</citerefentry> +build noarch rather than binary RPMs, insert the following header in +your specfile:</para> + +<programlisting> +BuildArch: noarch +</programlisting> +</refsect1> + +<refsect1><title>Author</title> +<para>Eric S. Raymond <email>esr@thyrsus.com</email>. The buildrpms +script was originally by Sean Reifschneider.</para> + +<para>There is a project web page at +<ulink +url="http://www.catb.org/~esr/shipper/">http://www.catb.org/~esr/shipper/</ulink>.</para> +</refsect1> + +<refsect1><title>Bugs</title> +<para>The rsync channel type is untested. Shipping Debian packages +should be supported.</para> +</refsect1> + +<refsect1><title>See Also</title> + +<para> +<citerefentry> +<refentrytitle>freshmeat-submit</refentrytitle> +<manvolnum>1</manvolnum> +</citerefentry>, +<citerefentry> +<refentrytitle>lftp</refentrytitle> +<manvolnum>1</manvolnum> +</citerefentry>, +<citerefentry> +<refentrytitle>rpm2lsm</refentrytitle> +<manvolnum>1</manvolnum> +</citerefentry>, +<citerefentry> +<refentrytitle>scp</refentrytitle> +<manvolnum>1</manvolnum> +</citerefentry>, +<citerefentry> +<refentrytitle>ssh</refentrytitle> +<manvolnum>1</manvolnum> +</citerefentry>.</para> +</refsect1> +</refentry> + +<!-- +Local Variables: +compile-command: "make shipper.html" +End: +--> |