commit aa237198c24778780882950f6049de9d27989217 Author: Silvan Calarco Date: Tue Apr 26 21:39:44 2011 +0200 Initial commit diff --git a/.directory b/.directory new file mode 100644 index 0000000..5a9030c --- /dev/null +++ b/.directory @@ -0,0 +1,2 @@ +[Desktop Entry] +Icon=folder-favorites diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..00c91d7 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,16 @@ +Davide Madrisan + main developer + frontend, plugins, libraries, documentation + porting to the libspec.lib architecture + +Stefano Cotta Ramusino aka "whitone" + patch to check for OSI approved licenses + list of OSI approved licenses + autospec package search engine (APSE) + typo fixes in the documentation and more + +Silvan Calarco + heavy bug tester + sparse patches + code for building the list of build requirements + support for the multi-architecture diff --git a/BUGS b/BUGS new file mode 100644 index 0000000..2ab5c6b --- /dev/null +++ b/BUGS @@ -0,0 +1,110 @@ +********************************* +* KNOWN BUGS / MISSING FEATURES * +********************************* + +* pck-update plugin + [bug] if the download fails, a HTML file is downloaded. See for instance: + http://kent.dl.sourceforge.net/sourceforge/inkscape/inkscape-0.44.tar.bz2 + [security] evaluation of `%define' directives could lead to security issues + (the problem exists in the rpm itself) + [bug] '/usr/share/linuxdoc-tools/dist/linuxdoc-tools/info/mapping' + should not be considered an info page + hint: grep '/info/' is a broken test; the `file' tool cannot be used + because info pages are compressed + [bug] [silvan@buddha SPECS]$ autospec -u apt -a3 0.5.15cnc7 + aggiornamento del pacchetto apt alla versione 0.5.15cnc7... + [step 3] -- dowload dei nuovi file sorgente + [1] https://moin.conectiva.com.br/AptRpm/apt-0.5.15cnc7.tar.bz2 + --> /usr/src/RPM/SOURCES/apt-0.5.15cnc7.tar.bz2 + + curl: (60) SSL certificate problem, verify that the CA cert is OK. Details: + error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify + failed + More details here: http://curl.haxx.se/docs/sslcerts.html + + curl performs SSL certificate verification by default, using a "bundle" + of Certificate Authority (CA) public keys (CA certs). The default + bundle is named curl-ca-bundle.crt; you can specify an alternate file + using the --cacert option. + If this HTTPS server uses a certificate signed by a CA represented in + the bundle, the certificate verification probably failed due to a + problem with the certificate (it might be expired, or the name might + not match the domain name in the URL). + If you'd like to turn off curl's verification of the certificate, use + the -k (or --insecure) option. + autospec: impossibile scaricare: `apt-0.5.15cnc7.tar.bz2' + + TRY USING THE CURL OPION "--no-check-certificate" (?) -- hint by Silvan Calarco + + [bug] Il seguente comando: + autospec -u bbpress -a1,5,10 + causa l'errore: + ERROR: pacchetto non trovato: + `/usr/src/RPM/RPMS/noarch/%sitename-website-}bbpress-0.8.2.1-2mamba.noarch.rpm' + in fase di upload. + Causa: parsing non corretto della riga (se "sitename" non รจ definito?) + Name: %{?sitename:%sitename-website-}bbpress + [feature] autoformat "make install" if lines are too long (like "configure") + [feature] action 8, test 4 + should check if `/usr/lib/libpopt.so' --> `libpopt.so.0.0.0' is a valid link + should display a warning on broken symlinks + [feature] support the gpg signatures of rpm packages + +* libspec + [feature] specfile.getvars(): missing implementation for `%ifarch' and `%ifdef' + [feature] add support for commands like: + %{expand:%%define kernel_minor_version %(echo %version | cut -d. -f3)} + + example: lilo.spec + %{!?latex_doc: %define latex_doc 1} + DEBUG: resolve_rpmvars: conditional block (%if) [level#1] -- %if %latex_doc + DEBUG: resolve_boolexpr: boolean expression [ %latex_doc ] + DEBUG: resolve_boolexpr: expanding boolexpr using: name (lilo) + DEBUG: resolve_boolexpr: expanding boolexpr using: version (22.7) + DEBUG: resolve_boolexpr: boolexpr nullified -- [ %latex_doc ] + DEBUG: resolve_boolexpr: set: $1 = "%latex_doc", $2 = "", $3 = "" + expr: sintax error + + example nagios.spec + %{!?EMBPERL: %define EMBPERL 0} + DEBUG: : set: $1 = "%{EMBPERL}", $2 = "", $3 = "" + expr: sintax error + +* spec-create plugin + [bug] libmpcdec and http://www.directfb.org/download/DirectFB/DirectFB-0.9.22.tar.gz + do not properly detect headers path + [feature] (python specfiles) + in the `%install' block, just after the lines + python setup.py install \ + --root=%{buildroot} \ + --install-headers=%{_includedir}/python \ + --install-lib=%{_libdir}/site-python + this command should be perhaps used + python -O %{_libdir}/python%{pyver}/compileall.py \ + %{buildroot}%{_libdir}/python%{pyver}/site-packages + to optimize the python compiled code + [feature] check for non standard (/usr/lib) library files path + [feature] man pages should be splitted between main and devel packages + o man1: User programs -- main + o man2: System calls -- (kernel related --> not in standard packages) + o man3: Library functions and subroutines -- *** devel *** + o man4: Special files -- (system --> not in standard packages) + o man5: File formats -- main + o man6: Games -- main + o man7: Miscellaneous -- main (?) + o man8: System administration -- main + +* missing english translation of `rpm4QiLinux-it-HOWTO', a tedious effort to + translate a doc that nobody is going to actually read. + *** NEED EXTERNAL HELP *** + +****************** +* IMPORTANT NOTE * +****************** + +Have you found a bug not listed above? +Please post a description and possibly a way to reproduce the bug to + + +If you're feeling especially nice, you should make a patch to fix the flaw. +Sending patches as attachments is preferred, but not required. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/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. + + + Copyright (C) + + 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. + + , 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/ChangeLog b/ChangeLog new file mode 100644 index 0000000..7cf6840 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,3550 @@ +Changes in version 1.8.0 +Sat Apr 02 2011 Davide Madrisan + ++ bugfix + * pck-update - Silvan Calarco: + Action 6: Fix automatic build requirements detection with rpm 5. + ++ update + * templates/perl - Davide Madrisan: + Pass 'OPTIMIZE="%{optflags}"' to perl when building perl modules. + ++ improvement + * templates/standard-daemon - Davide Madrisan: + New template for packages providing a system/network service. + ++ update + * templates/standard - Davide Madrisan: + Remove code used by services (moved to the 'standard-daemon' template). + + * templates/Makefile - Davide Madrisan: + Updated. + + * pck-update - Davide Madrisan: + Update Copyleft. + + * autospec - Davide Madrisan: + Update Copyleft. + + * spec-create - Davide Madrisan: + Update Copyleft. + + * spec-create - Davide Madrisan: + Update help message. + + * i18n - Davide Madrisan: + Updated. + ++ documentation + * italian manpage: + Document the new template 'standard-daemon'. + ++ update + * lib/libcfg.lib - Davide Madrisan: + Update Copyleft. + ++ improvement + * lib/libcfg.lib - Davide Madrisan: + Support modularized configuration files (`~/.autospec.d/*.conf'). + (Based on an idea developed by Stefano Cotta Ramusino.) + ++ update + * config-getvar - Davide Madrisan: + Minor fix: remove the always unset variable `cfg_file'. + + * config-getvar - Davide Madrisan: + Update Copyleft. + + * lib/libcfg.lib - Davide Madrisan: + Unset "cfg_file" before exiting because the same variable is also used in + the plugin "config-getvar". + + * config-getvar - Davide Madrisan: + Correctly display variables splitted into several configuration files. + ++ documentation + * italian manpage: + Document usage of configuration files `~/.autospec.d/*.conf'. + +-------------------------------------------------------------------------------- + +Changes in version 1.7.3 +Sun Mar 20 2011 Davide Madrisan + ++ bugfix + * templates/kde4 - Davide Madrisan: + Remove the duplicate %posttrans block. + + * templates/python - Davide Madrisan: + Remove the trailing " character in the sed command. + (Pointed out by Silvan Calarco) + + * libspec - Davide Madrisan: + Workaround the segmentation fault of "rpm --eval" while parsing an internet + address (like rpm --eval 'http://ftp.gnu.org'). + (Pointed out by Silvan Calarco) + +-------------------------------------------------------------------------------- + +Changes in version 1.7.2 +Sat Dec 15 2010 Davide Madrisan + ++ update + * spec-create - Davide Madrisan: + Better debug messages. + + * spec-create - Davide Madrisan: + Do not exit with error when the compression method is unsupported; try to + create a specfile as complete as possible. + + * i18n - Davide Madrisan: + Updated. + + * templates/library - Davide Madrisan: + Updated. + ++ bugfix + * autospec.spec - Davide Madrisan: + Fixed the requirement loops detected by rpm5. + + * spec-create - Davide Madrisan: + Fixed expansion of source and license tags. + ++ update + * templates/perl - Davide Madrisan: + Use the perl default licence ('perl_License_default') set in the + configuration file. + + * spec-create - Davide Madrisan: + Better output for the 'Summary' tag when processing perl archives which have + 'WriteMakefile' data blocks containing the 'NAME' variable. + ++ bugfix + * pck-update - Davide Madrisan: + action 1: Display the right installation path for files extracted from a + srpm archive. + +-------------------------------------------------------------------------------- + +Changes in version 1.7.1 +Wed Dec 29 2010 Davide Madrisan + ++ bugfix + * spec-create - Davide Madrisan: + Fix expansion of '@standard_docs@' (do use '%doc' instead of '%docs'.) + (Thanks to Silvan Calarco for pointing out this regression.) + ++ update + * spec-create - Davide Madrisan: + Updated help message. + + * i18n - Davide Madrisan: + Updated. + + * spec-create - Davide Madrisan: + Add support for jar archives. (Feature asked by Gil.) + ++ bugfix + * templates/{standard,perl} - Davide Madrisan: + Various fixes. + +-------------------------------------------------------------------------------- + +Changes in version 1.7.0 - Christmas Release +Wed Dec 22 2010 Davide Madrisan + ++ update + * spec-create - Davide Madrisan: + A completely rewritten plugin based on the templates available in the + templates directory. The previous was renamed as spec-create-old. + + * templates/* - Davide Madrisan: + Updated to be used by the new spec-create plugin. + + * autospec.conf - Davide Madrisan: + New variable `rpm_default_buildroot'. + + * autospec.spec - Davide Madrisan: + Updated. + + * spec-create - Davide Madrisan: + Support conditional (boolean) directives present in templates. + Example: @i18n@%files -f %{name}.lang@%files@ + + * templates/librarytools - Davide Madrisan: + Deleted. + + * spec-create - Davide Madrisan: + usage(): update the usage output; librarytools does not exist any more. + + * i18n - Davide Madrisan: + Updated. + +-------------------------------------------------------------------------------- + +Changes in version 1.6.3 +Tue Nov 28 2010 Davide Madrisan + ++ update + * libnetwork.lib - Davide Madrisan: + repository.get_SRPMS_name(), repository.get_RPMS_name(): do not exit with + error when curl cannot download the list of files available in a given + repository. + + * libnetwork.lib - Davide Madrisan: + repository.get_SRPMS_name(), repository.get_RPMS_name(): do print all the + curl commands in debug mode. + + * i18n - Davide Madrisan: + Minor updates to the italian translation. + ++ bugfix + * libcfg.lib - Davide Madrisan: + Display a correct error message when the user configuration file is not + available. + ++ update + * pck-extract - Davide Madrisan: + Move config.check4user check after command line options parsing to let + pck-extract --help work even when $HOME/.autospec does not exist. + + * pck-extract - Davide Madrisan: + version(): Update Copyleft message. + + * pck-update - Davide Madrisan: + version(): Update Copyleft message. + + * pck-update - Davide Madrisan: + New option '--force-download': download the source files even if found in + the SOURCE directory. + + * po/it/pck-update.po - Davide Madrisan: + Updated. + ++ bugfix + * pck-update - Davide Madrisan: + Always force the download of the srpms files. + (Feature asked by Silvan Calarco). + ++ documentation + * italian manpage: + Document the new option '--force-download'. + Minor updates. + +-------------------------------------------------------------------------------- + +Changes in version 1.6.2.1 +Tue Nov 09 2010 Davide Madrisan + ++ bugfix + * po/libnetwork.po - Davide Madrisan: + Fixed typo. + + * libnetwork.po - Davide Madrisan: + curl.ftp_command(): the option `rename-to' requires an argument. + Fixed sintax in getopt. + +-------------------------------------------------------------------------------- + +Changes in version 1.6.2 +Tue Nov 02 2010 Davide Madrisan + ++ update + * lib{repository,curl}.lib,spec-create,pck-extract,pck-update - Davide Madrisan: + Move all the functions from libcurl.lib to librepository.lib. + Remove libcurl.lib. + + * i18n - Davide Madrisan: + Updated italian translation. + + * pck-update - Davide Madrisan: + Action 0: display the name of the distribution in the main message. + + * libnetwork.lib - Davide Madrisan: + New library, formerly known as librepository.lib. + +-------------------------------------------------------------------------------- + +Changes in version 1.6.1 +Sun Oct 17 2010 Davide Madrisan + ++ update + * libspec.lib, pck-update - Davide Madrisan: + Move debug code from pck-update to libspec.lib (`curl.upload()'). + + * libspec.lib - Davide Madrisan: + curl.upload(): new options `--debug-unsecure'. + ++ improvement + * pck-update - Davide Madrisan: + Action 3: if no version is specified at command line, do use the package + version set in the specfile instead of exit the script with an error + message. + + * pck-update - Davide Madrisan: + Action 5: display a warning message if "PYTHONDONTWRITEBYTECODE" is set. + (required by Stefano Cotta Ramusino) + ++ update + * i18n - Davide Madrisan: + Updated italian translation. + ++ improvement + * libcurl - Davide Madrisan: + New function 'curl.ftp_command()'. + + * pck-update - Davide Madrisan: + Remove all the curl code. Use 'curl.ftp_command()' instead. + 'curl' is not required any more. + ++ bugfix + * pck-update - Davide Madrisan: + Fixed incorrect path of the srpm package to be deleted. + + * autospec.conf - Davide Madrisan: + Fixed and simplified the example for the ftp repository configuration. + + * libcurl - Davide Madrisan: + curl.ftp_command(): do not pass the `--progress-bar' option to curl because + it doesn't make sense in this context. + + * autospec.conf - Davide Madrisan: + New value for `patch_name_structure' (`{',`}' --> `\{',`\}'). + ++ update + * librepository.lib - Davide Madrisan: + Replace `notify.warning' by `notify.error' when curl exit with an error. + ++ improvement + * pck-update - Davide Madrisan: + Action 10: While uploading and removing rpm packages, do also display the + `ftp_alias', if this paramether is set. + ++ improvement + * libcurl - Davide Madrisan: + curl.upload(): check if the file to be uploaded exists. + + * pck-update - Davide Madrisan: + Action 10: Do not check if the file to be uploaded exists when uploading + files. This check is now in curl.upload(). + + * libcurl - Davide Madrisan: + curl.upload(): move here the code that visually display the source and + destination files. + + * libcurl, pck-update - Davide Madrisan: + Action 1: Move the notifications to `curl.download()' in order to avoid + code duplication in `pck-update'. + +-------------------------------------------------------------------------------- + +Changes in version 1.6.0 +Sun Oct 03 2010 Davide Madrisan + ++ bugfix + * autospec.spec - Silvan Calarco: + Added PreReq for rpm also to autospec-plugins package + ++ improvement + * pck-update - Silvan Calarco: + (autospec-1.5.0-install_srpms_with_nodeps.patch) + Added patch install_srpms_with_nodeps for compatibility with rpm5. + + * autospec.conf - Davide Madrisan: + New option `srpm_install_options' with default value '--nodeps'. + + * pck-update - Davide Madrisan: + Install srpms packages using the user configurable `srpm_install_options' + option. + In debug mode do print the rpm command used when installing the srpm packages. + ++ update + * autospec.conf - Silvan Calarco: + (autospec-1.5.0-use_smart_for_rpm_download_and_install.patch) + Added patch to replace apt with smart in default configured application for + rpm download and installation. + ++ bugfix + * pck-update - Silvan Calarco: + (autospec-1.5.0-autobuildreq_use_whatprovides.patch) + Use rpm option --whatprovides to find unidentified requirements. + ++ improvement + * pck-update - Silvan Calarco: + (autospec-1.5.0-dont_backup_srpm_with_nosrpm_option.patch) + Added patch dont_backup_srpm_with_nosrpm_option to make it work better with + multiarch uploads. + ++ update + * pck-update - Silvan Calarco: + (autospec-1.5.0-hidden_spec_old_files.patch) + Create specfile backups as old files (i.e. prefixed by '.'). + + * autospec.conf - Davide Madrisan: + New options `spec_backup_extension' (default value: `.old') and + `spec_backup_attr' (default value: `hidden') + + * pck-update - Davide Madrisan: + specfile.rotate_bck(): requires as argument the specfile name with path. + + * pck-update - Davide Madrisan: + Move all code related to specfile rotation to the 'specfile.rotate_bck' + function. + + * pck-update - Davide Madrisan: + Create backup files according to the user defined preferences + 'spec_backup_extension' and 'spec_backup_attr'. + ++ bugfix + * pck-update - Silvan Calarco: + (autospec-1.5.0-fix_undefined_SPECFILE_PREPROCESSED.patch) + infofile.create(): fix bug when 'specfile_preprocessed' already exists. + ++ update + * autospec.spec - Silvan Calarco: + * pck-update - Silvan Calarco: + * spec-create - Silvan Calarco: + * tests/test01_pkgquality - Silvan Calarco: + * unmaintained/mbrowse.spec - Silvan Calarco: + (patch replace_obsolete_PreReq.patch) + Replace obsolete PreReq tags with Requires(pre) or Requires(post). + ++ bugfix + * pck-update - Silvan Calarco: + (autospec-1.5.0-noarch_allow_upload_to_given_arch_only.patch) + Support configuration of @arch@ in arch_no_arch_upload + + * pck-update - Silvan Calarco: + (autospec-1.5.0-noarch_allow_upload_to_given_arch_only-2.patch) + Noarch support also for operations 6, 9, and 11. + + * pck-update - Davide Madrisan: + Noarch support also for operations 7, and 8. + + * pck-update - Silvan Calarco: + (autospec-1.5.0-get_default_arch_from_rpm.patch) + Add rpm --eval `%_host_cpu' to find default architecture. + ++ update + * autospec.conf - Davide Madrisan: + rpm_approved_licenses[]: add 'IEEE' and 'Copyright only' licenses. + ++ improvement + * i18n - Davide Madrisan: + Better message displayed when different a version or a release is specified + at command line. + + * spec-create - Davide Madrisan: + Add support for '.lz' and '.7z' compressed archives. + + * libspec.lib - Davide Madrisan: + specfile.getvars(): better output for 'SPEC_LICENSE' (debug message). + + * libspec.lib - Davide Madrisan: + specfile.getvars(): get the values of the licenses set in all the + subpackages. + ++ improvement + * libcurl - Davide Madrisan: + New library containing the new function 'curl.download()'. + + * po/it/libcurl - Davide Madrisan: + Italian translation of all the english messages contained in libcurl. + + * spec-create, pck-extract - Davide Madrisan: + Replace the curl command with a call to 'curl.download()'. + Do not check for the availability of curl. + + * spec-update - Davide Madrisan: + Replace the curl command used to download with a call to 'curl.download()'. + ++ bugfix + * spec-create - Davide Madrisan: + Do not try to change file mode bits (chmod) over non-regular files. + ++ update + * libspec.lib - Davide Madrisan: + Move 'sourcefile.download()' to 'libcurl' and rename this function + 'curl.download_sourcefile()'. + ++ improvement + * spec-update - Davide Madrisan: + Display an error message if the specfile cannot be found instead of running + rpm and let it complain with the message "rpm exited with error code `1'". + ++ improvement + * spec-update - Davide Madrisan: + Convert all the calls to `curl.download_sourcefile()' into calls to the new + function `curl.download()'. + + * libspec.lib - Davide Madrisan: + Remove the now unused function 'curl.download_sourcefile()'. + ++ update + * autospec - Davide Madrisan: + Extend copyright to 2010. + ++ improvement + * libcurl.lib - Davide Madrisan: + New function `curl.upload()'. + + * spec-update - Davide Madrisan: + Convert the calls to 'curl' for uploading rpm and srpm packages into calls + to the new function 'curl.upload()'. + +-------------------------------------------------------------------------------- + +Changes in version 1.5.0 +Sat Jul 17 2010 Davide Madrisan + ++ bugfix + * autospec.spec: + Fix by Silvan Calarco. + Added PreReq for rpm for correct user configuration. + + * libapse.lib: + Patch provided by Silvan Calarco: + autospec-1.4.17-curl_pass_netlink_opts.patch + Do pass netlink options ('curl_opts_netlink') to curl in libapse too. + ++ improvement + * pck-update: + Patch provided by Silvan Calarco: + autospec-1.4.17-rpm-whatprovides-optimize.patch + ++ bugfix + * pck-update: + Patch provided by Silvan Calarco: autospec-1.4.17-fix_get_RPMS_name.patch + Fix identification of old packages to backup. + + * pck-update: + Patch provided by Silvan Calarco: + autospec-1.4.17-just_warn_if_host_fails.patch + Reduce severity from error to warning if host command fails as happens + using qemu-arm environment. + ++ improvement + * libspec.lib: + Patch provided by Silvan Calarco: + autospec-1.4.17-use_rpm_preprocessor_to_solve_vars + Use rpm preprocessor to solve the variables used in a specfile. + Requires rpm --specfile --specedit feature added to rpm 4.4.9-15mamba + ++ update + * libspec.lib: + specfile.getvars(): do not forge a default specfile name. + + * pck-update: + infofile.create(): new infofile variable: 'SRPM_SPECFILE_WITH_PATH'. + + * pck-update: + Use '$SRPM_SPECFILE_WITH_PATH' instead of '$spec_dir/$SRPM_SPECFILE' when + possible. + ++ improvement + * libspec.lib: + rpmvars.solve(): skip the variable substitution process if the input string + does not contain any variable. + rpmvars.solve(): end the variable substitution process if the output string + does not contain any more variable. + + * libspec.lib: + sourcefile.download(): in debug mode do print the full curl command. + ++ bugfix + * pck-update: + package.update(): remove duplicate definition of 'rpmdefine_opts'. + ++ update + * pck-update: + infofile.create(): do not redefine 'SRPM_SPECFILE_WITH_PATH' at every + function call. + + * pck-update: + infofile.create(): set 'USER_RPMDEFINE_OPTS' (list of all the 'rpm --define' + command-line options defined by the user) in the infofile. + + * libspec.lib: always use the USER_RPMDEFINE_OPTS value instead of recreating + the list ot the rpm --define commands every time they're needed. + + * pck-update: + infofile.create(): add the variable 'SPECFILE_PREPROCESSED' in the infofile + and create this file using the rpm options '-q --specfile --specedit'. + + * pck-update: + infofile.create(): use the preprocessed specile instead of the original one + when calling 'specfile.getvars()', except when running in '--verbatim' mode. + + * libspec.lib: + specfile.getvars(): always use the 'specfile' name passed as paramether + instead of 'SPECFILE_PREPROCESSED' or 'SRPM_SPECFILE_WITH_PATH'. + ++ update + * autospec.conf: + add "Delopment/Debug" to 'rpm_allowed_groups'. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.17 +Wed Maj 12 2010 Davide Madrisan + ++ bugfix + * libspec.lib: + * pck-update: + (Bug noticed by Silvan Calarco when cross-compiling packages via autospec) + Honour user defined macros when expanding rpm variables. + Save user defined macros in the variable 'define_list_name' using a syntax + accepted by the rpm tool. + + * libspec.lib: + Fixed typo (FUCNAME --> FUNCNAME). + + * pck-update: + (patch provided by Silvan Calarco: + autospec-1.4.16-pass_root_opts_to_whatprovides.patch) + + Use alternative root directory, if provided, for build requirements check. + + * pck-update: + (patch provided by Silvan Calarco: + autospec-1.4.16-dont_pass_root_to_rpmbuild.patch) + + Don't pass alternative root directory to rpmbuild except when running + rpmbuild --nobuild to check dependencies. As the dependencies check is done + before, it is safe to pass --nodeps to non-simulated build commands. + This is needed because rpm has a strange behaviour when both --root is + passed and %_builddir is defined, as it uses passed %_builddir in prepare + phase, but adds root directory to %_builddir in the build phase. + + * test01_pkgquality: + (problem noticed by Stefano Cotta Ramusino) + Do not check for `%buildroot' strings when 'rpm_ignores_buildroot' is true. + + * test01_pkgquality.po: + Updated. + + * test01_pkgquality: + * tests/test02_pkgsecurity: + Colorize all the messages describing the tests to be run. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.16 +Mon Apr 12 2010 Davide Madrisan + ++ improvement + * spec-create: + specfile.create(): support lzma compressed archives. + ++ bugfix + * templates/kde4: + Add a missing '/sbin/ldconfig' in the %posttrans scriplet. + + * pck-update: + (patch provided by Silvan Calarco: + autospec-1.4.15-pass_target_before_defines) + Pass '--target=' to rpm before the '--define' directives otherwise + rpm will silently discard it. + ++ improvement + * autospec.conf: + New variable 'rpm_ignores_buildroot' set to '1' by default. + Silvan Calarco noticed that the 'BuildRoot' tag of a specfile is ignored by + several vesions of rpm. + + * libspec.lib: + Do not consider mandatory the 'BuildRoot' tag os a specfile when the + variable 'rpm_ignores_buildroot' is true. + + * templates/python: + * spec-create: + Use the setup.py '--record' directive to automatically get the complete list + of the installed files . + (Thanks to Stefano Cotta Ramusino for pointing out this improvement.) + + * libapse.lib.in: + (patch by Stefano Cotta Ramusino: autospec-1.4.15-libapse_sourceforge.patch) + Check for new software at sourceforge.net/sf.net sites. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.15 +Wed Mar 24 2010 Davide Madrisan + ++ improvement + * templates/kde4: + Add update-desktop-database, update-mime-database, and gtk-update-icon-cache + calls to rpm scriplets. + + * pck-update: + (patch provided by Silvan Calarco: autospec-1.4.14-add_rpm_root_option.patch) + New option '--root=DIRECTORY': use the file system tree rooted at DIRECTORY + for all rpm operations. + Use the root directive when running 'rpm -U --test'; + Use the root directive when installing the rpm packages. + ++ bugfix + * pck-update: + (patch provided by Silvan Calarco: autospec-1.4.14-add_rpm_root_option.patch) + Do not overwrite the '--define' directives saved in 'rpmbuild_opts' when + cross-compiling. + ++ documentation + * italian manpage: + Document the new option '--root'. + ++ bugfix + * pck-update: + Correctly display the '\n' character in the debug message showing the curl + command used for uploading the rpm and srpm packages. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.14 +Fri Mar 12 2010 Davide Madrisan + ++ bugfix + * pck-update: + Fixed several variable substitutions using 'upload_ftp_port': + ${upload_ftp_port:+:upload_ftp_port} >> + ${upload_ftp_port:+:$upload_ftp_port} + + * pck-update: + (autospec-1.4.13-rpmbuild_test_pass_variables.patch) + Pass build options and defines to rpmbuild --nobuild to prevent it from + failing when it shouldn't. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.13 +Wed Feb 17 2010 Davide Madrisan + ++ improvement + * spec-create: + specfile.create(): add support for the xz compressed archives. + ++ bugfix + * spec-create: + specfile.write_clean(): always end '%post' and '%preun' blocks containing + multiple statements with an 'exit 0' command. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.12 +Wed Feb 17 2010 Davide Madrisan + ++ bugfix + * libapse.lib: + Fix the error message: + /usr/share/autospec/lib/libspec.lib: line 1018: [: too many arguments + + * tools/kde4-flist2rpmvars: + Correcty handle the '%{_kde4_xdgappsdir}' and '%{_kde4_xdgmimedir}' + macros. + + * tools/kde4-flist2rpmvars: + Do not skip the first line of the input to process. + + * spec-create: + Do not add an empty line after the '%prep' directive. + ++ improvement + * spec-create: + Improved creation of python specfiles: + - update the '%install' block; + - fill the package description when a description is available; + +-------------------------------------------------------------------------------- + +Changes in version 1.4.11 +Tue Jan 12 2010 Davide Madrisan + ++ bugfix + (reported by Silvan Calarco) + * libapse.lib: + Fix regression bug introduced in 1.4.9 with a mispaced "notify.debug" + statement that prevented libapse from finding lots of software updates. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.10 +Thu Jan 10 2010 Davide Madrisan ++ update + * templates/python: + (patch provided by Silvan Calarco: autospec-1.4.9-python_template.patch) + Use %{__python} instead of python. + + * templates/python: + (patch provided by Stefano Cotta Ramusino: autospec-1.4.9-python_opt.patch) + Do not rebuild the python modules in the %install block (do use the option + `--skip-build' to avoid this). + Do use the optimization flag `-O1'. + ++ bugfix + * pck-update: + (reported by Stefano Cotta Ramusino) + If a description begins with a '%' character, do not pretend that the + "`%description' has empty body". + +-------------------------------------------------------------------------------- + +Changes in version 1.4.9 +Fri Oct 23 2009 Davide Madrisan ++ update + (by Stefano Cotta Ramusino) + * autospec.conf: + New list of OSI approved licenses ('rpm_approved_licenses') + ++ improvement + * libcfg.lib: + config.check4user(): declare as 'local' all the variables used in this + function. + Try to get the email address also looking at emaildefaults in $HOME/.kde4. + ++ bugfix + * spec-create: + Call 'config.check4user()' before proceeding with the specfile creation. + (bug noticed by Stefano Cotta Ramusino) + ++ improvement + (patch provided by Silvan Calarco: autospec-1.4.8-distrowatch_apse_grep.patch) + * autospec.conf: + New value for 'apse_grep[5]' to improve the Autospec Package Search Engine. + + (patch provided by Silvan Calarco: + autospec-1.4.8-libapse_candidate_versions.patch) + * libapse.lib: + Support more extensions for software archives; + Use the 'candidate_versions[]' vector to save a list of candidate new + versions and search for the better candidate according to the current + version scheme. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.8 +Wed Oct 14 2009 Davide Madrisan ++ bugfix + (patch provided by Silvan Calarco: autospec-1.4.7-builddir_conf_default.patch) + * autospec.conf: + Also set 'build_dir'. + ++ improvement + (patch provided by Silvan Calarco: + autospec-1.4.7-libapse_better_source0_scrape.patch) + * libapse.lib: + Improved package version detection. + ++ new feature + * autospec.conf: + New variable 'rpm_debug_package_macro' containing the macro provided by + rpm to build debug packages (default value: "%debug_package"); + New variable 'rpm_macro_debug_package_suffix' (default value: "debug"). + + * libspec.lib: + specfile.getvars(): support debug packages. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.7 +Sun Jul 05 2009 Davide Madrisan + ++ new feature + (patch provided by Silvan Calarco: autospec-1.4.6-relocate_RPM_dirs.patch) + * pck-update: + Integrated the relocate_RPM_dirs patch by Silvan Calarco. + ++ bugfix + (patch provided by Silvan Calarco: + autospec-1.4.6-libapse_remove_sourceforge.patch) + * libapse.lib: + Update the Autospec Package Search Engine for the site + (a specific code for this site is no longer required.) + + * pck-update: + Fix the update of packages when the package name contains a relative or + absoute path ('spec_dir' was not set correctly). + + * pck-update: + Fix the initialisation of the specfile directory when the '-S/--specfile' + option is specified ('spec_dir' was not set correctly). + +-------------------------------------------------------------------------------- + +Changes in version 1.4.6 +Fri Apr 10 2009 Davide Madrisan + ++ bugfix + (patch provided by Silvan Calarco: autospec-1.4.5-scrape_regexp.patch) + * autospec.conf: + Updated `apse_grep' and `apse_uri' variables + ++ bugfix + (patches provided by Silvan Calarco: + autospec-1.4.5-scrape_source0_fix.patch, + autospec-1.4.5-scrape_source0_fix2.patch) + * libapse.lib: + apse.scrapeversion(): fixed the `pcknameregexp' regexpr and the parser that + initialize the `new_version' variable. + +-------------------------------------------------------------------------------- + +Changes in version 1.4.5 +Sun Feb 15 2009 Davide Madrisan + ++ bugfix + (reported by Silvan Calarco) + * autospec.spec: + Added missing `%defattr' for subpackage `plugins'. + ++ new feature + (patch provided by Silvan Calarco: autospec-1.4.4-scrape_source0_dir.patch) + * libapse.lib: + apse.scrapeversion(): new option `--pckurlverbatim'. + apse.scrapeversion(): added `source0' url based search. + * pck-update: + Action 2: use the `--pckurlverbatim' option when calling the function + `apse.scrapeversion'. + ++ bugfix + * libapse.lib: + apse.scrapeversion(): handle specfiles with no url specified in source0 + (like autospec). Better output message. Do not display proxy login and + password in debug mode. Update help message. + ++ bugfix + (patch provided by Silvan Calarco: autospec-1.4.4-fix_sourceforge.patch) + * libapse.lib: + apse.scrapeversion(): fix regexpr used for parsing sourceforge.net pages. + ++ update + * libapse.lib, pck-update: update Copyright messages. + ++ bugfix + (patch by Silvan Calarco: autospec-1.4.4-fix_perl_pkgs_scraping.patch) + * libapse.lib: + apse.scrapeversion(): fix perl packages scraping. + ++ new feature + (patch provided by Silvan Calarco: + autospec-1.4.4-access_private_repositories.patch) + * libreposirory.lib: + repository.get_SRPMS_name(), repository.get_RPMS_name(): new option + '-l|--user' (login user) for repositories that require authentication even + in readonly mode + ++ bugfix + (reported by Silvan Calarco) + * pck-update: + Action 4: Fixed regression: do not always display the message + `Source[0]': does not point to a valid internet address + +-------------------------------------------------------------------------------- + +Changes in version 1.4.4 (Christmas Release!) +Thu Dec 25 2008 Davide Madrisan + ++ new feature + * building infrastructure: + New makefiles '{plugin,template,test,tool}/Makefile' + ++ new feature (asked by Silvan Calarco) + * pck-update: + Action 1: do not remove the SRPMS package after download and installation + ++ new feature (patch provided by Silvan Calarco) + * pck-update: + Action 2: exit with exit code 4 if the package is already the latest + version + ++ improvement (issue reported by Silvan Calarco) + * librepository: + repository.get_SRPMS_name(): only download the repository web pages only + once per repository + ++ bugfix (issue reported by Silvan Calarco) + * libspec.lib: + specfile.getvars(): support non standard package names like: + - foo2zjs.tar.gz + - pdf417_enc.4.4.tar.gz + - slib3a4.zip + ++ bugfix + * pck-update: + infofile.create(): check the optional specfile path entered by users via + command line options (only the path set in the rpm configuration files is + supported) + * po/it/spec-create.po: + Updated + ++ bugfix (issue discovered and reported by Silvan Calarco) + * pck-update - action 2: + When a newer version of the package is available on the web, put its value + in the infofile (SPEC_VERSION_FORCED) + * pck-update - infofile.create(): + Honour SPEC_VERSION_FORCED when calling rpmvars.init() + * libspec.lib - rpmvars.init(): + rpmvars.init(): new option '--pckver' to force the version number that + will be stored in the variable 'rpmvar_value[1]' instead of using the + value provided by the specfile itself + ++ update + * libapse.lib: + Removed "Copyright (C) Davide Madrisan" and "Copyright (C) Silvan Calarco" + +-------------------------------------------------------------------------------- + +Changes in version 1.4.3 +Thu Nov 20 2008 Davide Madrisan + +* librepository.lib: + - Use a general regular expression in 'repository.get_pckname_from_HTML()' + (this should fix all the issues recently spotted by Silvan Calarco) + +* spec-create: + - Add support for 'https' protocol when downloading source files + +* po/it/spec-create.po: + - Updated + +-------------------------------------------------------------------------------- + +Changes in version 1.4.2 +Fri Nov 14 2008 Davide Madrisan + +* pck-update: + - The function 'repository.resolveURL()' is now called 'specfile.resolveURL()' + - 'repository.get_SRPMS_name()', 'repository.get_RPMS_name()', and + 'repository.is_reachable()' has been moved to the new library librepository + - The function 'specfile.resolveURL()' has been moved to 'librepository' and + renamed to 'repository.resolveURL()' + - Fixed the 'ftp_alias' support (thanks to Silvan Calarco for the bug report) + +* libspec.lib: + - Do accept also the " <= " syntax when parsing the list of the + build requirements (thanks to Silvan Calarco for reporting this issue) + +* librepository.lib: + - New library + - New command line options '--proxy' and '--proxy-user' for the library + function 'repository.get_SRPMS_name()' + - Function 'repository.get_SRPMS_name()': option '-u' renamed to '-r' + - New command line options '--proxy', '--proxy-user', and 'target_cpu' for the + library function 'repository.get_RPMS_name()' + +* Makefile: + - Minor fixes + - Makefile logic reworked (added 'Makefile.env', 'po/it/Makefile', and + '/man/it/Makefile') to also work with the 'dash' (Debian Almquist SHell) + shell used as /bin/sh replacement by Ubuntu since the 6.10 release + - Updated target 'uninstall' + - Use "/usr/local" as default prefix instead of "/usr" + +* autospec.spec + - If '%_localedir' is undefined in the rpm macros do use the path defined by + the Filesystem Hierarchy Standard (FHS) document + +-------------------------------------------------------------------------------- + +Changes in version 1.4.1 +Wed Oct 29 2008 Davide Madrisan + +* autospec.spec: + - Added italian tranlations to subpackages descriptions + - New subpackage 'tests' + +* plugins/pck-extract: + - Load libmsgmng.lib + - Use the builtin bash operator '=~' instead of the a call to the external + tool 'grep' when possibile + - Check for bash version 3 or better + +* plugins/config-getvar: + - Use the builtin bash operator '=~' instead of the a call to the external + tool 'grep' when possibile + - Check for bash version 3 or better + +* plugins/spec-create: + - Use the builtin bash operator '=~' instead of the a call to the external + tool 'grep' when possibile + - Check for bash version 3 or better + +* plugins/pck-update: + - Use the builtin bash operator '=~' instead of the a call to the external + tool 'grep' when possibile + - Check for bash version 3 or better + +* Makefile: + - Install the plugins in '$(bindir)' instead of '$(datadir)/autospec/plugins' + - New target 'check' for checking libraries and scripts for syntax errors + - Add targets and instructions to build and install the autospec tests + +* lib/libapse: + - Use when possible the construct 'for i in ${!Array[@]}; ...' to expand the + values saved in a vector + +* autospec.conf: + - New variable 'testdir' + - New variables + - 'rpm_install_noinstall_mask' + - 'rpm_install_l10n_pck_mask' + - 'rpm_install_l10n_pck_allow_lang_mask' + used to control which localization and development packages will be + installed by the plugin 'pck-update' (feature asked by Silvan Calarco) + + Ex1. rpm_install_noinstall_mask='' + rpm_install_l10n_pck_mask='-i18n-|-help-' + rpm_install_l10n_pck_allow_lang_mask='.*' + In this example all the packages will be installed (default configuration) + + Ex2. rpm_install_noinstall_mask='-apidocs-' + rpm_install_l10n_pck_mask='-i18n-|-help-' + rpm_install_l10n_pck_allow_lang_mask='it' + In this example the apidocs packages will never installed and only the + localization packages for the italian language will be installed + +* tests: + - Add 'test01_pkgquality' and 'test02_pkgsecurity' + - Other tests can now be easily added in '$testdir' directory (see above) + +* i18n: + - New po files for core tests + +-------------------------------------------------------------------------------- + +Changes in version 1.4.0 +Mon Oct 13 2008 Davide Madrisan + +* autospec: + - Added the missing entry for the '--update' option in the help message + - Added the missing entry for the '--eval' option in the help message + - The '--eval' option now works again + +* pck-update: + - Make a backup copy of the old specfiles when executing action 1 instead of + action 4. This seems more useful for developers and for the automatic + upgrading tool used in openmamba. Feature asked by Silvan Calarco + - Do not try to backup a specfile if it does not exists (!) + +* autospec.spec: + - Updated + +* i18n: + - The po file is now splitted into nine separate files + - po/autospec_fe-it.po frontend + - po/config-getvar-it.po plugin config-getvar + - po/libapse-it.po library libapse.lib + - po/libcfg-it.po library libcfg.lib + - po/libmsgmng-it.po library libmsgmng.lib + - po/libspec-it.po library libspec.lib + - po/pck-extract-it.po plugin pck-extract + - po/pck-update-it.po plugin pck-update + - po/spec-create-it.po plugin spec-create + +* Makefile: + - updated + +* autobuild: + - This tool has been removed because it hasn't been developed and maintained + for a long time and it has been now superceeded by `autodist', written by + Silvan Calarco for the openmamba distribution + +* libapse: + - Merged patch "autospec-trver.patch" by Silvan Calarco + - Merged patch "autospec-install.patch" by Silvan Calarco + +* autospec.conf: + - Removed the variable 'plugin_autobuild' + +* libcfg.lib: + - Do not verify if 'plugin_autobuild' is set + +-------------------------------------------------------------------------------- + +Changes in version 1.3.2 +Fri Oct 03 2008 Davide Madrisan + +* autospec.conf + - New vector variable 'ftp_alias[]' + +* pck-update: + - Merged "autospec-1.2.2-localedir.patch" by Silvan Calarco: this patch + improves the detection of locales files performed by autospec + - Support a package name matching the regex "-svn-<...>.rpm" + - Implemented aliases for ftp repositories (using the new vector variable + 'ftp_alias' in the autospec configuration file). Affects both the options + '--server-download' and '--server-upload'. Feature asked by Silvan Calarco + + ftp_alias[0]="devel" + ftp_alias[1]="contrib" + + ftpurl_ro_rpms[0]="http://<...>/devel/RPMS.@arch@" + ftpurl_ro_rpms[1]="http://<...>/devel-contrib/RPMS.@arch@" + ftpurl_ro_srpms[0]="http://<...>/devel/SRPMS.base" + ftpurl_ro_srpms[1]="http://<...>/devel-contrib/SRPMS.base" + ftp_rw_server[0]="<...>" + ... + + With a similar configuration you can select a repository the old way: + autospec -u -a0 --server=1 + or using the configured alias: + autospec -u -a0 --server=contrib + +-------------------------------------------------------------------------------- + +Changes in version 1.3.1 +Tue Sep 30 2008 Davide Madrisan + +* autospec: + - More code cleanups + - Fixed a typo error in the help message + - -V|--version option: Only print the version number in quiet mode + +* spec-create: + - Display the help message when the following command-line arguments are used: + "-s --help", "-s -h", "--help -s", and "-h -s" + +* libapse.lib: + - Exit with return value "3" if a new version of the given package cannot be + found (thanks to Silvan Calarco:silvan.calarco(a)mambasoft.it for the patch) + - Merged "autospec-1.2.2-sourceforge_fix_group_id.patch" by Silvan Calarco + +* pck-update: + - New option "--force-update" (thanks to Silvan Calarco for the patch) + - Fixed a regression in the '--changelog' option (thank to Silvan again for + spotting this) + - Fixed openmamba bug #83 (http://bugs.openmamba.org/view.php?id=83) open by + skiver: remote patches are not automatically downloaded + +* Makefile: + - Create the source tarball in the `history' folder + +* i18n: + - Minor fixes + - Updated italian catalog + +* documentation: + - Updated the italian man page and the document `autospec-it-HOWTO' + +-------------------------------------------------------------------------------- + +Changes in version 1.3.0 +Mon Sep 01 2008 Davide Madrisan + +* libspec.lib: + - sourcefile.download(): display "skipped" also for remote files already + found in the local disk (that is previously downloaded) + +* Makefile: + - plugins are now installed with execution rights + +* autospec: + - autospec now acts as a real front-end. The plugins are not loaded but just + executed with the correct options + - removed compatibility assignments for long-time obsoleted variables + - do not check for rpm: it's only used in 'pck-update' where the same check is + already performed + - functions 'autospec.check_4user_config' and 'autospec.security_checks' moved + to 'libcfg.lib' and renamed to 'config.check4user' and 'config.security' + +* pck-extract: + - modified to work as a standalone script + +* autospec.conf: + - definitions for 'srpms_dir', 'rpms_dir', 'spec_dir', 'source_dir', and + 'tmppath_dir' moved from 'autospec' to the main configuration file + +* libcfg.lib: + - new library for loading the configuration file(s) + +* spec-create: + - modified to work as a standalone script + +* autobuild plugin: + - modified to work as a standalone script + +* config-getvar: + - modified to work as a standalone script + +* i18n: + - updated italian catalog + +-------------------------------------------------------------------------------- + +Changes in version 1.2.2 +Fri Aug 15 2008 Davide Madrisan + +* pck-update + - action 5: install all the missing build requirements in a single (usually + "apt-get") command to speed up the installation process + +-------------------------------------------------------------------------------- + +Changes in version 1.2.1 +Fri Jun 13 2008 Davide Madrisan + +* pck-extract + - preserve modification times in the files extracted from an archive + +* Makefile + - fixed variables substitution in the `.in' files ('pck_lib' instead of + 'pck_libs'): this bug only affected the man page for autospec + +* libspec.lib + - support specfiles with licenses containing one or more spaces + (i.e. "Apache License 2.0") + (thanks to silvan for reporting this issue) + +* pck-update + - infofile.create: support licenses (`SPEC_LICENSE') with spaces + +-------------------------------------------------------------------------------- + +Changes in version 1.2.0 +Sun May 11 2008 Davide Madrisan + +* Makefile + - plugins moved to @datadir@/autospec/plugins + - add support for autospec templates + +* autospec.conf + - new variable 'templatedir' + +* spec-create + - new specfile tipologies: librarytool, kde3, kde4 + - update description for 'specfile.create()' + - use libspec.lib + +* templates + - created the following templates: + templates/gnome + templates/kde3 + templates/kde4 + templates/library + templates/librarytool + templates/perl + templates/python + templates/standard + +* tools + - updated email adresses + +* pck-update + - action 10: fix typo (proxy user is set by 'proxy_user', not 'proxyuser') + +* libspec.lib + - new functions 'getnamefromtarball()' and 'getversionfromtarbal()' + +* i18n + - updated italian catalog + +-------------------------------------------------------------------------------- + +Changes in version 1.1.9 +Wed Jan 30 2008 Davide Madrisan + +* autospec.conf + curl_options: always use the `-R' option (curl will attempt to figure out the + timestamp of the remote file, and if that is available make the local file + get that same timestamp) + +* pck-update + action 6: committed patches written by silvan.calarco(a)mambasoft.it + - autospec-1.1.8-buildreq_ldconfig_warning.patch + - autospec-1.1.8-buildreq_ignore_file_requirements.patch + - autospec-1.1.8-buildreq_executable.patch + +* autospec + - updated copyleft message + +* documentation + - italian man page: updated copyleft message + +-------------------------------------------------------------------------------- + +Changes in version 1.1.8 +Wed Jan 30 2008 Davide Madrisan + +* autospec.spec + removed a duplicate entry in the changelog + +* pck-update + - action 11: fixed an issue related to the recent rpm version upgrade + - action 11: added a debugging message to print the command executed while + installing the rpm packages + +-------------------------------------------------------------------------------- + +Changes in version 1.1.7 +Sat Dec 29 2007 Davide Madrisan + +* autospec.conf + new variables `rpm_macro_cmake' and `rpm_macro_makeinstall_cmake'; + current settings: + - rpm_macro_cmake="%cmake -d build" + - rpm_macro_makeinstall_cmake="%makeinstall -C build" + to enable by default out-of-source builds if the cmake packaging system has + been detected; + use: + - rpm_macro_cmake="%cmake" + - rpm_macro_makeinstall_cmake="%makeinstall" + for in-source builds + +* spec-create + support the cmake building technology + +-------------------------------------------------------------------------------- + +Changes in version 1.1.6 +Sat Dec 22 2007 Davide Madrisan + +* libspec.lib + (feature asked by Silvan Calarco: support the `dreadful' mantis.spec syntax) + - rpmvars.init: use a better regexp to catch `Name' and `Version' variables + - boolexpr.solve: print a warning message when a specfile with unsupported + syntax is detected while performing variables expansion + - rpmvars.init: should now support expansion of variables in the quite + generic form "string0%{?varname:%varname-string1-}string2" + - specfile.getvars: use a better regexp to catch `Name' and `Version' + - rpmvars.solve: support variables matching the generic form + "string0%{?varname:%varname-string1-}string2" + +-------------------------------------------------------------------------------- + +Changes in version 1.1.5 +Fri Dec 14 2007 Davide Madrisan + +* libapse.lib + - fixed a bug introduced by the 1.1.4 update (thanks to Stefano Cotta Ramusino + (aka whitone) for the patch) + +* autospec.conf + - arrays moved from libapse.lib to the configuration file (patch by whitone) + +* spec-create + - specfile.write_setup: minor fix for package that requires "%setup -c" + (thanks to Silvan Calarco for reporting this bug) + +-------------------------------------------------------------------------------- + +Changes in version 1.1.4 +Mon Dec 10 2007 Davide Madrisan + +* libapse.lib + - merged patch provided by Stefano Cotta Ramusino (main author of libapse) + (removed from the original patch all the api changes, for compatibility) + +* libspec.lib + - specfile.getvars: modified help message + +* autospec.conf + - fixed some typos in the comment lines + +* i18n + - updated italian catalog (libapse: translated all strings) + +-------------------------------------------------------------------------------- + +Changes in version 1.1.3 +Sun Dec 02 2007 Davide Madrisan + +* autospec.conf + - added "Graphical Desktop/Applications/Security" to `rpm_allowed_groups' + +* pck-update + - action 4: do not strip out all the make commands but the last one in + specfiles containing multiple occurrences of `make' in their %build + sections, when autoformatting is enabled + - action 6: do not try to be too clever, if the specfile is newer than the + rpm and/or srpm packages just print a warning message + - action 2: exit from autospec unless libapse is able to found a package + update with a release number greater than the current installed one + +* libapse.lib + - apse.scrapeversion: return the following exit codes: + 0 : package is already the latest version + 1 : a package with newer version is already installed + 2 : a new version is available + +* i18n + - updated italian catalog (libapse: translated all strings) + +-------------------------------------------------------------------------------- + +Changes in version 1.1.2 +Wed Nov 28 2007 Davide Madrisan + +* libspec.lib + - specfile.getvars: variable `var' declared as local (this function can + be executed recursively so a global definition leads to bad side effects) + - specfile.getvars: fixed the regexpr used to set `SPEC_SOURCE0_PCKNAME' when + the tarball name match the `_' scheme + +* config-getvar + - support variables in the form + varname=\" + ... + ..." + - print a bug message when a variable structure does not match any known + pattern + +* autospec.conf + - updated `format_extra_rules' to automatically format old perl specfiles + with the last coded scheme + - `format_description_width' by default set to `0' (unlimited length for + description lines) + +* autospec.spec + - updated package description in english + +* documentation + - italian man page: minor changes + +-------------------------------------------------------------------------------- + +Changes in version 1.1.1 +Mon Nov 26 2007 Davide Madrisan + +* pck-update + - action 6: merged changes made by silvan.calarco(a)mambasoft.it + - action 11: just print a warning message (instead of an error) when too many + srpm candidates are found in the repositories if `--force' is used + +* autospec.spec + - add requirement for ftp + (thanks again to silvan.calarco(a)mambasoft.it for reporting the problem) + +-------------------------------------------------------------------------------- + +Changes in version 1.1.0 +Tue Nov 20 2007 Davide Madrisan + +* pck-update + - action 6: merged the `find_buildrequirements' script written by + silvan.calarco(a)mambasoft.it + - if the specfile has been modified, force rebuild of rpm and srpm packages + +* spec-create + - fixed a regression bug: do not always insert the line + PreReq: /sbin/install-info + while creating a specfile preamble + (thanks to silvan.calarco(a)mambasoft.it for reporting the problem) + +* autospec + - document the new action 6 feature in `autospec.usage()' + +* i18n + - updated italian catalog + +* documentation + - italian man page, AUTHORS, and autospec-it-HOWTO updated + +-------------------------------------------------------------------------------- + +Changes in version 1.0.2 +Tue Nov 13 2007 Davide Madrisan + +* pck-update + - add debug code when removing remote files using curl + - test 12 (action 8) is now correctly numbered as test 12 instead of test 11 + - new test: check if a package that do not contains binaries is tagged `noarch' + - if the rpm packages are rebuilt force the repackaging of the srpm package too + (thanks to silvan.calarco(a)mambasoft.it for reporting the problem) + +* spec-create + - better support for perl modules using the more recent `Module::Build' + building, testing, and installing system + - do not insert an extra space character when formatting the preamble of a + newly created specfile + - new default `spec_source' for perl packages: + http://www.cpan.org/modules/by-module/.../$pck_tarball_4spec" + - try to automagically complete the package source of perl module + +* configuration file + - new variable `perl_License_default' unset by default + +* documentation + - italian man page: updated and improved + - BUGS: updated + +-------------------------------------------------------------------------------- + +Changes in version 1.0.1 +Fri Oct 26 2007 Davide Madrisan + +* autospec.spec + - do not truncate lines in the package description + - do not use the %makeinstall macro for compatibility with other distros + +* pck-update + - repository.get_RPMS_name(): use a better regexpr for parsing the list of + files found in a repository + +* configuration file + - update `allowed_libdirs': fixed entry for kde3 libs; support kde4 + +* documentation + - updated autospec-it-HOWTO (formerly known as `rpm4QiLinux-it-HOWTO') + +-------------------------------------------------------------------------------- + + +Changes in version 1.0 +Wed Sep 26 2007 Davide Madrisan + +* autospec + - allow execution of the `pck-extract' and `spec-create' plugins by root + - do not require a valid `/root/.autospec' file when running `pck-extract' + and `spec-create' plugins by root + +* pck-update + - repository.is_reachable(): remove protocol prefix (http:// ftp://) before + checking server dns reachability (thanks to silvan.calarco(a)mambasoft.it + for providing the patch) + - fixed warning message about deprecated options `-u -a6' + +* spec-create + - do not reject *.tbz2 file archives + (thanks again to silvan.calarco(a)mambasoft.it for reporting the problem) + +* i18n + - updated english and italian catalogs + +-------------------------------------------------------------------------------- + +Changes in version 0.9.99 +Tue Sep 04 2007 Davide Madrisan + +* pck-update + - if `arch_list[]' is unset do not report it's a program bug, just say that + the variable is unset - probably because of a buggy user configuration + file (reported by Stefano Cotta Ramusino ) + - updated copyright informations + - update 2: moved almost all the code to `libapse.lib:apse.find4updates()' + - fixed some issues related to the new openmamba web infrastructure + - update 10: do not display any html output when uploading packages with curl + +* libspec.lib + - `SPEC_SOURCE0_NAME' renamed to `SPEC_SOURCE0_PCKNAME' + +* libapse.lib + - new function `apse.scrapeversion()' + - apse.scrapeversion: all internal variables are now declared local + - apse.scrapeversion: detect network problems when calling curl + - apse.scrapeversion: code reworked to make it more robust in case of errors + - apse.scrapeversion: set `APSE_LAST_VERSION' with the last available version + found on the web + - apse.scrapeversion: do not modify the global variable `pck_newver' to avoid + side effects + - apse.scrapeversion: code cleanup + +* configuration file + - add some documentation for `--limit-rate' in `curl_opts_netlink' + - modified the default settings for `ftp_rw_server', `ftp_rw_rpms_dir', and + `ftp_rw_srpms_dir' to reflect the new openmamba web infrastructure + +* rpm4QiLinux-it-HOWTO + - updated email address + +* i18n + - updated english and italian catalogs + - minor fixes + +-------------------------------------------------------------------------------- + +Changes in version 0.9.98 +Wed Jun 06 2007 Davide Madrisan + +* pck-update + - do not display usernames and passwords in the debug messages unless + `debug_print_private_user_infos' is set (hardcoded) to `1' + - merged another patch provided by whitone(a)gmail.com which fix some issues + in the engine used to look for package updates on the web + - `repository.get_SRPMS_name()', `repository.get_RPMS_name()': enable url + redirection in all the calls to curl + (thanks to silvan.calarco(a)mambasoft.it for reporting the problem) + - `repository.get_SRPMS_name()', `repository.get_RPMS_name()': use a better + regexpr for parsing the list of files found in a repository + - the backup of old packages should now work again + (this issue was reported by silvan.calarco(a)mambasoft.it) + +* spec-create + - write './Build install destdir=\"%{buildroot}\"' instead of 'DESTDIR=..' + (problem reported by silvan.calarco(a)mambasoft.it) + +* libspec.lib + - specfile.getvars: partial support for `%ifnarch' + - specfile.getvars(): new query `SPEC_SOURCE0_NAME' available + - sourcefile.download(): added the necessary options to support a proxy + server (`--proxy', `proxy-user') + +* libapse.lib + new library "Autospec Package Search Engine (APSE)" with `cmpversion' + function written by Stefano Cotta Ramusino + +* configuration file + - updated list of osi-approved licenses (patch by whitone(a)gmail.com) + - new variable `curl_opts_netlink' used to set connection timeout and number + of retries for curl when downloading files + +* i18n + - updated english and italian catalogs + +-------------------------------------------------------------------------------- + +Changes in version 0.9.97 +Sat May 05 2007 Davide Madrisan + +* autospec + - removed default setting for `format_unix_tools' + - removed default setting for the unused variable `format_extrarules' + - removed default setting for the obsolete variable `description_width' + +* pck-update + - repository.get_SRPMS_name(): new options '--urllist' + - repository.get_SRPMS_name(): the options '--server' is now called '--urlnum' + - repository.is_reachable(): fixed wrong check for nonvoid arg#1 + - when uploading packages do not report that a repository with no read-write + access is unreacheable, just tell it is unreachable.. + - repository.get_RPMS_name(): new option '--archlist' + +* spec-create + - initialize the variable `perl_Makefile_generator' if unset + +* libspec.lib + - honour command line LANG setting + - updated copyright info + +* configuration file + - `arch_list' and `arch_noarch_upload' are now vectors because the branches + defined in the configuration file could support different architectures + +-------------------------------------------------------------------------------- + +Changes in version 0.9.96 +Tue Apr 24 2007 Davide Madrisan + +* configuration file + - new default values for `ftpurl_ro_rpms[]', `ftpurl_ro_srpms[]', and + `ftp_rw_*[]' to match the tree of the openmamba repository + - removed `System/Configuration/QiLinux' from the list of the allowed package + groups (`rpm_allowed_groups[]') + - updated the list of the approved licenses (thanks to whitone(a)gmail.com + for providing the patch) + +* pck-update + - modified `changelog_new' string (trailing string "by autospec" removed) + - `sourceforge.net' is now also scanned while finding for available packages + over the web (patch provided by whitone(a)gmail.com) + - fixed paths used when uploading files to the openmamba repositories (thanks + again to whitone(a)gmail.com for reporting the problem and sending a patch) + +-------------------------------------------------------------------------------- + +Changes in version 0.9.95 +Tue Mar 27 2007 Davide Madrisan + +* Makefile + - updated copyright info + +* configuration file + - new default value for DISTRO: "openmamba" + - new default value for VENDOR: "openmamba" + - new default value for DISTRO_rpm: "mamba" + +- spec-create + - updated copyright info + +* pck-update + - function `specfile.newrelease': code and regexpr's modified to support the + upgrade of packages when switching between two different linux distributions + (that is a package upgrade where the source and destination specfiles will + have different 'DISTRO_rpm' entries) + +* documentation + - rpm4QiLinux-it-HOWTO: UTF8 fixes; synchronized with previous release + +-------------------------------------------------------------------------------- + +Changes in version 0.9.94 +Thu Mar 01 2007 Davide Madrisan + +* pck-update + - check for desktop files installed in `/usr/share/applnk/' (that is the + non-standard location used by kde in the old times) + - remove (again) the trailing `.spec' string from the package name if any + - fixed the regular expression used when updating the `Release' and `Version' + entries (this fixes a bug reported by silvan.calarco(a)mambasoft.it) + - the elements of `SPEC_BUILDREQUIRES' in the info file need to be quoted + (now the package `perl-MIME-tools' which contains a build requirement for + `perl(MIME::Base64)' can be updated whitout errors; this issue was reported + by silvan.calarco(a)mambasoft.it) + +* autospec + - updated copyleft message + +* i18n + - updated english and italian catalogs + +-------------------------------------------------------------------------------- + +Changes in version 0.9.93 +Fri Feb 09 2007 Davide Madrisan + +* libspec + - sourcefile.download(): added '--force' option to force file download, even + if a local file with the same name has been found + - sourcefile.download(): do not download remote files if forcing is unset + (thanks to silvan.calarco(a)mambasoft.it for reporting this issue) + +* pck-update + - update code used to append multiline changelog entries in the specfiles; + was affected by a strange bug apparently caused by a bash version upgrade + (thanks again to silvan.calarco(a)mambasoft.it for reporting the problem) + +* configuration file + - do not set `python_module_name_structure' by default + +-------------------------------------------------------------------------------- + +Changes in version 0.9.92 +Thu Gen 09 2007 Davide Madrisan + +* configuration file + - added the `/usr/lib/qt4/lib' path to the variable `allowed_libdirs' + - default settings for + . summary_defvalue + . group_defvalue + . url_defvalue + . license_defvalue + . description_defval, description_devel_defval + . changelog_[samever,rebuild]_defvalue, changelog_userdef + moved from the autospec script to the configuration file (code cleanup) + - new entry in rpm_allowed_groups[]: 'System/Hardware' + +* config-getvar + - new plugin created from code by the autospec script (code cleanup). + This plugin implements the `--eval' option provided by autospec + +* autospec + - do really check for plugins availability + - be paranoid when loading plugins using bash variables + - updated copyright info + +* pck-extract + - added support for `nosrc' packages + - updated copyright info + +* pck-update + - do not always say that the installation of the given packages is forced, + just print the message in the case + - updated copyright info + - action `0': http sites are now correctly handled + +* i18n + - updated english and italian catalogs + +-------------------------------------------------------------------------------- + +Changes in version 0.9.91 +Thu Gen 09 2007 Davide Madrisan + +* configuration file + - added the architectures "arm" and "x86_64" to the default configuration + (asked by silvan.calarco(a)mambasoft.it) + +* libspec + - fixed expansion of define directives that refer to other define directives + ex. %define gnomever %(echo `rpm -q --queryformat '%{VERSION}' libglib`) + %define gnomemajver %(echo %gnomever | cut -d. -f 1-2) + - updated copyright info + +* pck-update + - do not check for uninstalled build requirements and source files if nor + the srpm not the rpm packages need to be built + - updated copyright info + +-------------------------------------------------------------------------------- + +Changes in version 0.9.90 +Thu Dec 21 2006 Davide Madrisan + +* pck-update + - use the curl tool instead of an ftp command when uploading rpm/srpm files + - added a timeout to curl when uploading files + - fixed some issues for connections trough a proxy server when uploading + packages and installing the build requirements + +* documentation + - rpm4QiLinux-it-HOWTO: updated + +-------------------------------------------------------------------------------- + +Changes in version 0.9.15 +Wed Dec 12 2006 Davide Madrisan + +* autospec.conf + - new options `proxy' and `proxy_user' for connections trough a proxy server + +* libspec + - fixed copyright printed by `specfile.getvars()' + - added proxy support + +* autospec + - added proxy support + +* pck-extract + - added proxy support + +* pck-update + - added proxy support + - integrated and reworked the Autospec Package Search Engine (APSE) code + developed by Stefano Cotta aka whitone (stefano.cotta(a)qilinux.it); + now autospec can automatically search for updates looking at + . http://fileforum.betanews.com/ + . http://linux.softpedia.com/ + . http://www.gnomefiles.org/ + . http://freshmeat.net/ + ! + - added proxy support and debug infos to APSE + +* spec-create + - added proxy support + +* i18n + - updated english and italian catalogs + +-------------------------------------------------------------------------------- + +Changes in version 0.9.14 +Mon Nov 29 2006 Davide Madrisan + +* pck-update plugin + - display a warning message if `LD_LIBRARY_PATH' is defined when building a + package (security/functionality check) + - the test that checks for the presence of the install/uninstall code for + info pages has been improved, at least for LSB compliant systems + (thanks to "whitone" (stefano.cotta(a)qilinux.it) for providing a patch) + +* spec-create plugin + - do not require the uncompress utility because it is now obsolete and some + distros do not provides it; just display an error message if a .Z file is + found and the uncomress utility is not installed + +* autospec + - some portability fixes + - do not perform the checks related to the `packager_group' group variable + when is unset + - new option `--ignore-test': it's now possibile to tell autospec to skip a + given list of tests (i.e. --ignore-test=5,6) + +* autospec.spec + - ncompress tool removed from the list of static requirements + - /bin/mktemp is now required instead of /usr/bin/mktemp for portability + +* i18n + - updated english and italian catalogs + +* documentation + - rpm4QiLinux-it-HOWTO: updated + - italian manpage: in sync with the autospec help + +-------------------------------------------------------------------------------- + +Changes in version 0.9.13 +Mon Nov 06 2006 Davide Madrisan + +* autospec.conf + - new entry 'System/Clustering' for 'rpm_allowed_groups[]' + - new option '-T/--target' available in the 'autobuild' plugin + +* pck-update plugin + - minor typo fixes in some error messages + - when listing the available versions of a given package found in the + repositories (--action=0), the server number is now also displayed + +* libspec.lib + - expand all the rpm variables found in the build requirements, not only + the variables at the very begin of the name + (thanks to silvan.calarco(a)mambasoft.it for reporting this issue) + +* autobuild plugin + - several bug fixes + - better error messages printed when parsing problems are detected + +* configuration file + - new configuration variable 'python_install_lib_path' with default value + '%{python_sitearch}' + +* i18n + - updated english and italian strings + +* documentation + - rpm4QiLinux-it-HOWTO: updated + - italian manpage: documented the new option '--target' for autobuild + +-------------------------------------------------------------------------------- + +Changes in version 0.9.12 +Mon Jun 19 2006 Davide Madrisan + +* autospec.conf + - added `-L' to `curl_options' to allow redirects + (thanks to stefano (stefano.cotta(a)qilinux.it) for reporting the problem + and giving me the fix) + +* spec-create plugin + - use "%{buildroot}" instead of %{buildroot} everywere + +* pck-update plugin + - action 1: if `force_install' is set the srpm file is downloaded and + installed even if a local srpm has been detected + +* autospec + - do not overwrite the `packager_email' variable is already set + +* libspec.lib + - boolexpr.solve() now supports conditional expressions with only one + operand, like '%if "%{?stage1}"' (thanks to silvan + (silvan.calarco(a)mambasoft.it) for reporting the problem) + +* tools/mbrowse.spec: updated + +* configuration file + - fixed rpm_approved_licenses (some space characters were not escaped) + +-------------------------------------------------------------------------------- + +Changes in version 0.9.11 +Sun Jun 11 2006 Davide Madrisan + +* autospec (frontend) + - new options `--force-build' and `--force-install'; the previous ambiguous + option `--force' is now a shortcut to enable both these options + - help message updated to document these new options + - display a better help message if the user configuration file for autospec + is not found; also try to catch the user email address looking at the kde + configuration file `emaildefaults' + - fixed the check for configuration errors concerning `ftp_rw_server[]' + - new options `--server-download' (to select a server from where to + download srpm packages) and `--server-upload' (to select a server where to + upload packages; the previous ambiguous option `--server' can now be used + to select a server to be used for both download and upload of packages + +* pck-update plugin + - modified to support `--force-build' and `--force-install' + - if one or more lines in a specfile must be ignored by autospec, a command + block 'AUTOSPEC-OFF' - 'AUTOSPEC-ON' can now be used; an example follows: + + ## *AUTOSPEC-OFF* + Obsoletes: %{name}-tools + ## *AUTOSPEC-ON* + + - stop with an error message if the command line version and/or release + entered by user differ from the ones set in the specfile when building + rpm/srpm packages + - if a source file cannot be found in the source directory before the build + of the rpm/srpm packages, autospec now try to download it + (suggested by ) + - yet another fix to permit the use of multiple actions on the same command + line while upgrading a package to a different package version + - fixed a bug in the autoformatting feature occurring when formatting the + requirements coded as follows + + Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + + in a `%package' section related to a subpackage only + +* autobuild plugin + - modified to support `--force-build' and `--force-install' + - added support for `update = rebuild' and `update = false' + - added support for `download_server' and `upload_server' + +* libspec + - new function `sourcefile.download()' usefull to download source files + +* Makefile + - fixed the error message coded in the target `dist-rpm' + +* autospec.conf + - new entry "Applications/Scientific" in rpm_allowed_groups + +* new documentation file `test/autobuild_example.rules' + +* documentation + - rpm4QiLinux-it-HOWTO: updated + - italian manpage: updated + +-------------------------------------------------------------------------------- + +Changes in version 0.9.10 +Sun May 21 2006 Davide Madrisan + +* autospec (frontend) + - honour ftp users and passwords set in the configuration file + +* pck-update plugin + - the logging file name has a new format: + _-.log + here an example: 20060521_112318-mbrowse.log + - do not send curl stderr messages to /dev/null because this way the progress + bar will never be diplayed (thanks to stefano (stefano.cotta(a)qilinux.it) + for reporting the issue) + - create info files at every step adding the missing variables if any + +* pck-extract plugin + - do not send curl stderr messages to /dev/null (see above) + +* libmsgmng.lib + - new function 'notify.disable_colors' + +* configuration file + - garbage stuff used for tests while developing last release removed + +* autobuild plugin + - a new plugin for batch processing via rules files: this plugin can parse + text files written with a specific syntax and execute shell commands, + build, upgrade, install, and upload rpm and srpm packages + (for an example of a rules file see the file `test/autobuild.rules') + +* i18n + - updated english and italian strings + +* documentation + - rpm4QiLinux-it-HOWTO: updated + - italian manpage: updated + +-------------------------------------------------------------------------------- + +Changes in version 0.9.9 +Tue May 16 2006 Davide Madrisan + +* pck-update plugin + - fixed a bug in the feature that prevent the creation of rpm and srpm + packages if already found on the local disk + - fixed an obscure bug occurring when both --server and --define options were + used and caused the server option to be set with the tenth token of the + define list + - package names can now have a trailing '.spec' in all the contexts + +* autospec.spec + - do not inconditionanlly set the variable 'curl_options' (thanks to + stefano (stefano.cotta(a)qilinux.it) for reporting the problem and the way + to fix it) + +* tools/mbrowse.spec: minor updates + +-------------------------------------------------------------------------------- + + +Changes in version 0.9.8 +Sun May 07 2006 Davide Madrisan + +* configuration file + - list of approved licenses ('rpm_approved_licenses') updated + - list of allowed packages groups ('rpm_allowed_groups') updated + +* pck-update plugin + - the rpm and srpm packages are not built if they are found on the local + disk; to force the rebuild the `--force' can be used + (this feature has been asked by silvan.calarco(a)qilinux.it) + +* autospec.spec + - updated help message + +* i18n + - updated english and italian strings + +* documentation + - updated italian manpage + +* Makefile + - modified to automatically set the date of the italian manpage + +-------------------------------------------------------------------------------- + +Changes in version 0.9.7 +Sun Apr 16 2006 Davide Madrisan + +* configuration file + - new variable `rpm_install_force' used to to force the installation of rpm + packages (default value: "sudo rpm -hUv --force --nodeps") + +* pck-update plugin + - action 10: fixed some typo and sintax errors + - action 11: force the installation of the rpm given packages if `--force' is + selected by user + - remove any trailing ".spec" in the package names entered by user (just to + make autospec a bit less pedantic) + +* i18n + - updated english and italian strings + +* documentation + - italian manpage: updated + +-------------------------------------------------------------------------------- + +Changes in version 0.9.6 +Sun Mar 19 2006 Davide Madrisan + +* pck-extract plugin + - patches compressed with gzip (*.{diff|patch}.gzip) are automatically + decompressed + +* pck-update plugin + - action 0: check for the given srpm package in all the configured + repositories instead of stopping the search at the first occurrence found + (this is required now because a package can be located in different + repositories, even with a different version number) + - action 10: packages backup/cleanup is now performed correctly when the + `--server' option is specified by user + +* tools/mbrowse.spec: minor updates + +-------------------------------------------------------------------------------- + +Changes in version 0.9.5 +Sat Mar 05 2006 Davide Madrisan + +* pck-update plugin + - check for the structure of the 'Source[0]' entry only if a '%setup' + block has been found (problem notified by silvan.calarco(a)qilinux.it) + +* libspec.lib library + - specfile.getvars: 'SPEC_SOURCE' is not a mandatory variable + +-------------------------------------------------------------------------------- + +Changes in version 0.9.4 +Fri Feb 03 2006 Davide Madrisan + +* spec-create + - fixed creation of specfiles for source tarballs without a unique root + directory (thanks to Alessandro (alessandro.ramazzina(a)qilinux.it) for + reporting the problem) + +* pck-extract plugin + - bzip2-compressed patches (*.diff.bz2) are now automatically decompressed + +* configuration file + - rpm_approved_licenses: new entry "non-OSI" for non OSI licenses + +-------------------------------------------------------------------------------- + +Changes in version 0.9.3 +Sat Jan 13 2006 Davide Madrisan + +* pck-update plugin + - function `specfile.newrelease` fixed + +* spec-create plugin + - add the commands needed to remove the files `perllocal.pod' and `.packlist' + when a specfile for a perl module is generated; remove empty directories in + %%perl_sitelib + - modified requirement for devel packages + Requires: %{name} = %{?epoch:%epoch:}%{version} + to be fully compliant with rpm 4.4.x + - perl specfiles: license entry modified to be OSI standard compliant + - do not insert a space character after `%setup -q' + - use `%find_lang' instead of `%{find_lang}' + - do use the values provided by the configuration variables + `$rpm_macro_uninstallinfo' and `$rpm_macro_installinfo', insted of the + hardcoded values `%install_info' and `%uninstall_info' + +* configuration file + - new value for `rpm_macro_pyver' + rpm_macro_pyver="%python_version" + provided by rpm 4.4.x. (the previous value was: `pyver') + +* autospec.spec + - requires: rpm >= 4.4.4 + +-------------------------------------------------------------------------------- + +Changes in version 0.9.2 +Sun Jan 01 2006 Davide Madrisan + +* configuration file + - updated `rpm_allowed_groups' + +* pck-extract plugin + - the bzip2-compressed patches (*.patch.bz2) are now automatically + decompressed + - srpm packages can now be remote files (will be dowloaded) + +* pck-update plugin + - added a trap command to remove temporary info files + - the function `specfile.newrelease()' has been generalized to work with + release numbers in the format `[0-9]*.[0-9]*' + +* i18n + - updated english and italian strings + +* documentation + - italian manpage: indentation fix, some small changes + +-------------------------------------------------------------------------------- + +Changes in version 0.9.1 +Sun Dec 18 2005 Davide Madrisan + +* libspec.lib + - made `rpmvars.init()' a public function; it's currently called by the + function `infofile.create()' instead of `rpmvars.solve()' to workaround a + crazy bug occurring while running autospec under bash 3.1 + +* pck-update plugin + - the function `repository.get_SRPMS_name()' has a new option `--server' to + set a single repository where to look for available packages; + this feature will permit autospec to manage a given set of ftp repositories + where SRPMS packages could be duplicated (even with different version + and/or release numbers) + +* spec-create + - when creating a specfile preamble do substitute all the occurrences of the + package version with the string `%{version}` in the value automatically + assigned to `Source:' + +* autospec (frontend) + - do exist with an error message if the configuration file `~/.autospec' is + not found or not readable by the user running autospec + +* documentation + - rpm4QiLinux-it-HOWTO: an example of a working personal configuration file + for QiLinux contributors has been added + +* configuration file + - added a short help message at the top of the file + +* Makefile + - make dist-rpm rule: do not copy the tarball created by `make dist' to the + source directory for rpm, do move it + +-------------------------------------------------------------------------------- + +Changes in version 0.9.0 +Sat Dec 10 2005 Davide Madrisan + +* configuration file + - the variables listed below are now vectors + - ftp_rw_server + - ftp_rw_user + - ftp_rw_passwd + - ftp_rw_port + - ftp_rw_passive_mode + to support multiple repositories (both servers and directories) while + uploading packages + - for the same reason the variable `ftpdir_rw_old' is now a vector + - `ftpdir_rw_rpms' renamed to `ftp_rw_rpms_dir' + - `ftpdir_rw_srpms' renamed to `ftp_rw_srpms_dir' + - new numeric variable `ftp_rw_server_num_default', pointing to the server + where new born packages will be uploaded + - fixed default values for `ftp_rw_srpms_dir' and `ftp_rw_rpms_dir' + (thanks to Alessandro Secco (alessandro.secco(a)tiscali.it) for notifying + me of the problem) + +-------------------------------------------------------------------------------- + +* pck-update plugin + - action 10: do use the `delete' command instead of `rm' + (thanks to Alessandro Secco for identifying the problem and fixing it) + - small fix required by bash 3.1 + +* autospec + - yet another (small) fix for the `--eval' command + - added the `--server' option which tells autospec what repository must be + selected when uploading packages + (i.e. --server=n, where n is a positive interger, means that `n' is the + (zero-based) index of the ftp server set via the configuration variable + `ftp_rw_server', that is `ftp_rw_server[n]') + +* Makefile + - exit with error if the NEWS file has not been updated + - fixed target `uninstall' (was out of synk) + - most of targets reworked + +* i18n + - english and italian translation updated + +* documentation + - rpm4QiLinux-it-HOWTO: updated + - italian manpage: updated + +-------------------------------------------------------------------------------- + +Changes in version 0.8.9 +Sat Dec 03 2005 Davide Madrisan + +* autospec + - implementation of `--eval' command rewritten to work when invoked for + multiline vectors (for instance: autospec --eval=rpm_approved_licenses) + +* configuration file + - rpm_allowed_groups: fixed some typos + - rpm_allowed_groups: updated + - new variable `rpm_approved_licenses', a list of OSI approved licenses + written by "whitone" (whitone(a)gmail.com) + +* pck-update plugin + - added a test (#9) to check if all the licenses listed in the `License' + specfile entry are approved licenses according the configuration variable + `rpm_allowed_groups' + note: based on a patch written by "whitone" + - added two messages for test 8 and 9 to give some help to users + +* libspec.lib + - specfile.getvars: SPEC_LICENSE' is now a vector + The patch was done by "whitone" + +-------------------------------------------------------------------------------- + +Changes in version 0.8.8 +Sat Nov 26 2005 Davide Madrisan + +* pck-update plugin + - building (-a5) now supports both the options `--norpm' and `--nosrpm' + - modified (again) regexpr to catch uninstalled info pages + - user defined values set via the `--define' command are now passed to rpm + when building a specfile; a feature required by Silvan Calarco + (silvan.calarco(a)qilinux.it) + - new format for `ftpdir_pckbak' (date and time is appended): + $ftpdir_rw_old/${SPEC_NAME}_$(date +%y%m%d.%H%M%S) + +* rpm4QiLinux-it-HOWTO + - updated, typo fixed + +* Makefile + - fixed make target + - partially rewritten to make it usable in a standard way ('make' to 'build' + files, 'make install' to install files, ...) + +* autoupdate-kde, autoupdate-perl_modules, and extract-spec tools + - do not overwrite LANG environment variable at startup + - added requirement for bash version 2 or better + +-------------------------------------------------------------------------------- + +Changes in version 0.8.7 +Thu Nov 24 2005 Davide Madrisan + +* pck-update plugin + - checking code for correct groups updated to handle groups with spaces + +* spec-create plugin + - option `-s' has been enhanced: if its argument is a URL, the package is + dowloaded and the URL used to set the `Source' entry in the specfile; + feature required by Silvan Calarco (silvan.calarco(a)qilinux.it) + +* autospec (frontend) + - updated help message + +* manpages + - updated + +-------------------------------------------------------------------------------- + +Changes in version 0.8.6 +Sat Nov 19 2005 Davide Madrisan + +* spec-create plugin + - typo fixes + +* libspec.lib + - specfile.getvars: `SPEC_GROUP' is now a vector + - specfile.getvars: better debug code and messages when vectors are parsed + +* pck-update plugin + - code using SPEC_GROUP updated + - specfile.checksintax: (test#7) regexpr modified to avoid false positive + results when testing for info pages not correctly installed or uninstalled + +* i18n + - updated and converted to UTF-8 charset + +* rpm4QiLinux-it-HOWTO + - synchronized with current release + +* manpages + - added the manpage man1/it/autospec.1 + +-------------------------------------------------------------------------------- + +Changes in version 0.8.5 +Tue Nov 15 2005 Davide Madrisan + +* configuration file + - variable `rpm_allowed_groups' updated + - new value for `library_group_perl' : "System/Libraries/Perl" + - new value for `python_modules_group' : "System/Libraries/Python" + - new variable `rpm_specfile_mode' (default value is "644") + +* pck-update plugin + - set the permissions of the specfiles according to `rpm_specfile_mode' + - requires the chmod tool + +* spec-create plugin + - specfile are now created with the permissions set in `rpm_specfile_mode' + - requires the chmod tool + +* libspec.lib + - boolexpr.solve(): expand rpm variables at the end of the expansion chain + - specfile.getvars(): new query `SPEC_LICENSE' available + This was a patch from "whitone" (whitone(a)gmail.com) + +* pck-extract plugin + - do not use a pipe command when extracting files from a srpm archive + (revert the change made in release 0.7.3) to fix some (apparently input + (cpio archive) dependant) failures + +-------------------------------------------------------------------------------- + +Changes in version 0.8.4 +Thu Nov 10 2005 Davide Madrisan + +* autospec.spec + - requires: host +* pck-update plugin + - requires: host, cpio, and rpm2cpio + - also support "Url" in the specfile preamble (only "URL" was supported) + - exit with error if the files cannot be extracted from the rpm/cpio archives + before performing quality and security tests + - specfile.checksintax(): added a check to see if the `Group' entry specified + in the spefile is a known one, according to the configuration variable + `rpm_allowed_groups' +* configuration file + - new variable `rpm_allowed_groups' +* spec-create plugin + - typo fix +* libspec.lib + - specfile.getvars(): new query SPEC_GROUP' available + +-------------------------------------------------------------------------------- + +Changes in version 0.8.3 ("whitone") +Sat Nov 05 2005 Davide Madrisan + +* autospec + - checks for needed tools customized and moved at the top of each plugin body + to permit users to view help instructions, check configuration files and + execute some plugins even if not all the system tools required by autospec + are available + - load /etc/sysconfig/i18n only if the environment variable LANG is undefined +* autospec.spec + - requires: cpio + - do not require sudo; use it only if installed on the current system and + configured in the autospec configuration file + (see: `rpm_download_and_install' and `rpm_install') +* pck-update plugin + - specfile tests (action 2) merged at the end of action 4 (specfile update) + - perform more strict sintax checks before updating specfiles + +-------------------------------------------------------------------------------- + +Changes in version 0.8.2 +Sun Oct 30 2005 Davide Madrisan + +* libspec.lib + - rpmvars.solve(): double-level rpm variables are now correctly expanded + example: + %define kernel_ver 2.6.13 + Version: %{kernel_ver} + - specfile.getvars() + - new query `SPEC_URL' available + - nested conditional blocks (%if ... %else ... %endif) for SPEC_TARGET + are now supported; warning message removed + - rpmvars.init(): nested conditional blocks now supported; warning removed +* autospec + - the `--eval' command can now be executed in quiet mode (`-q' option) + - option `--norpm' now available for action 5 (packages building action) +* spec-create plugin + - minor fixes +* pck-update plugin + - only remove the build directory if the `--clear' command is selected + (thanks to , for the bugreport) + - recreate the info file when the specfile has been modified by the action 4 + (this fixes a long standing bug when autospec was used to execute action 4 + followed by other actions) +* configuration file + - new value for `format_buildroot_value modified' : + %{_tmppath}/%{name}-%{version}-root-%(id -u -n) + +-------------------------------------------------------------------------------- + +Changes in version 0.8.1 +Sun Oct 16 2005 Davide Madrisan + +* libspec.lib + - display a warning if an expression like "%{!?:" is found + - specfile.getvars(): new query `SPEC_BUILDREQUIRES' now available + - rpmvars.solve() now expands the rpm variables + - specfile.getvars(): display a warning if `%ifarch' is found (it's not + implemented yet and may lead to problems with conditional blocks) + - specfile.getvars(): do not exit with error if `SPEC_BUILDREQUIRES' is a + null string (thanks to "whitone" (whitone(a)gmail.com) for reporting the + problem) +* configuration file + - new configuration variable `rpm_install' (default value: "sudo rpm -hUv") +* pck-update plugin + - new option `11' usefull to install the rpm files created by a given package +* rpm4QiLinux-it-HOWTO + - synchronized with current release +* Makefile + - install autospec tools with execution permissions + +-------------------------------------------------------------------------------- + +Changes in version 0.8.0 +Sun Oct 9 2005 Davide Madrisan + +* pck-update plugin + - installation of build requirements moved to action 5 (build section) + - fixed cross-compiling regressions issues + - new option `--changelog' to set a user defined changelog entry + (multiline entries are allowed, using eol ('\n') characters) +* Makefile + - several changes to install libraries and compile .in files in each target +* libraries + - new shared libraries `libspec.lib' and `libmsgmng.lib', usefull to access + autospec's features by external scripts + +-------------------------------------------------------------------------------- + +Changes in version 0.7.3 +Sun Oct 02 2005 Davide Madrisan + +* pck-update plugin + - operator `!' supported in boolean expression (function `resolve_boolexpr') + - check if the architecture set by the `--arch' command is a legal one + looking at the configuration variable `arch_list[]' + - ignore the architecture set by user via command line if `BuildArch' is found + in the specfile preamble (a warning message is printed anyway) +* pck-extract plugin + - do not convert rpm packages to temporary cpio archives using the disk, + just make use of a pipe command + - display extracted files with the `--destdir' path + - check for required external unix tools + - code cleanups +* spec-create plugin + - check for required external unix tools + - use `sed 1q' instead of `head' to minimize the number of external tools + required + - perl modules: use + perl Makefile.PL INSTALLDIRS=vendor + in the `%build' section instead of `perl Makefile.PL' +* autospec + - exit with an appropriate return value, not always `0' + - do use the bash built-in command `type -p' instead of `which' + +-------------------------------------------------------------------------------- + +Changes in version 0.7.2 +Fri Sep 30 2005 Davide Madrisan + +* pck-update plugin + - action 2 : new test to check if the macro %find_lang is used when + localization files are detected + - action 4 : take care of packages that provide the specfile-harcoded build + requirements (i.e. `zlib-devel' is provided by `libz-devel') + - action 4 : automatically install all the declared build requirements if + `rpm_download_and_install' is set (see configuration file) + - resolve_rpmvars(): make blank the undefined rpm variables beginning by `?' + - action 8, test 11 : run `id -un', `id -gn' just once +* configuration file + - new configuration variables `rpm_download_and_install' + (default value: "sudo apt-get -y install") +* rpm4QiLinux-it-HOWTO + - synchronized with current release + - added a note about sudo usage/configuration + +-------------------------------------------------------------------------------- + +Changes in version 0.7.1 +Wed Sep 28 2005 Davide Madrisan + +* pck-update plugin + - `specfile.getvars()': new option `--verbatim' + - action 2 : new test to check if the install/uninstall code is present +* spec-create plugin + - use `rpm_macro_installinfo_binary' if defined in the configuration file +* configuration file + - new configuration variables `rpm_macro_installinfo_binary' + (default value: "%{__install_info}") + +-------------------------------------------------------------------------------- + +Changes in version 0.7.0 +Sat Sep 24 2005 Davide Madrisan + +* pck-update plugin + - the function `resolve_rpmvars' now expands rpm variables like `%_target_cpu' + - added support for conditional definitions like: + %if "%{?cross_target_cpu}" != "" + %define target_platform %{cross_target_cpu}-qilinux-linux-gnu + %define target_cpu %{cross_target_cpu} + %else + %define target_platform %{_target_platform} + %define target_cpu %{_target_cpu} + %endif + where `cross_target_cpu' may be set via a `--define' command + - allow void strings in user definitions (--define) + ( i.e. : --define cross_target_cpu="" ) + - more debug verbosity while performing rpm variables expansion + - new function `resolve_boolexpr' to calculate boolean expressions like: + %if "%{?cross_target_cpu}" != "" + %if %{use_gcc_33} + - rpm variables with prefix `?' are now supported + - autoformatting now also support `Serial', `NoSource', `NoPatch', `Prefix', + `ExclusiveArch', `ExclusiveOs', `ExcludeArch', `ExcludeOs, `BuildArch' + - backup/cleanup of old packages now also take care of the `Obsoletes' tags + - code cleanups in function `specfile.update()' + - action 8: new check for files with wrong user and/or group ownership + - action 10: noarch packages are now copied in all the repository branches + set in the new configuration variable `arch_noarch_upload[]' + - new internal function `repository.obsoletes_pcks()' + - action 10: code cleanups + - action 8: test performance dramatically improved + - action 10: new options `--nosrpm', `--norpm' + - print a warning message is the ftp upload has been disabled in the source + code via the boolean variable `do_ftp_upload' + - create the logging directory (`logging_dir') if not found + - the command `-S|--specfile' accepts now a specfile name with optional path + - action 2 now checks for sintax errors/non-standard stuff in the specfile + (was part of action 4) + - several bugfixes +* spec-create plugin + - when creating the specfile for a python package do use + `python setup.py install --install-lib=%{_libdir}/site-python' + instead of + `python setup.py install --install-lib=%{_libdir}/python' + and + `CFLAGS=\"%{optflags}\" python setup.py build' + instead of + `python setup.py build' + if C files have to be compiled during the build process +* autospec + - `autospec --eval=' now correctly display the values of variables + like `ftpdir_rw_rpms' (a vector) and `ftpdir_rw_rpms[0]' +* configuration file + - new configuration variables: + `arch_list' (list of all supported architectures) + `arch_noarch_upload' (where noarch packages will be uploaded) + - `ftpdir_rw_rpms' and `ftpdir_rw_srpms' are now vectors and MUST have their + entries ordered as in `ftpurl_ro_rpms' and `ftpurl_ro_srpms' + - `format_extra_rules' updated + - new default value for `logging_dir' +* extract-specs + - a new script usefull to extract specfiles from srpms archives (does not + create temporary files) +* Makefile + - added `install-tools' label +* i18n + - added missing strings, several updates +* rpm4QiLinux-it-HOWTO + - synchronized with current release + +-------------------------------------------------------------------------------- + +Changes in version 0.6.4 +Wed Aug 31 2005 Davide Madrisan + +* pck-update plugin + - updated regexp in action 10 to support composite release numbers + (like `1.4qilnx') + - fixed a regression bug in function `resolve_rpmvars' + +-------------------------------------------------------------------------------- + +Changes in version 0.6.3 +Wed Aug 03 2005 Davide Madrisan + +* pck-update + - new option `--rebuild/-R' + - new action `0': checks for available version(s) of a given package in the + repositories set in the configuration file(s) + - new option `--arch'/`-A' usefull to force a value for the architecture + instead of using the autodetection feature (needed when cross compiling) + - action `2' partially implemented +* rpm4QiLinux-it-HOWTO + - sync with current release + +-------------------------------------------------------------------------------- + +Changes in version 0.6.2 +Fri Jul 29 2005 Davide Madrisan + +* spec-create + - correctly write configure scripts found in folders different from the + package root directory + - do not write + `%install_info *' + and + `%uninstall_info *' + if the info page name(s) cannot be automatically detected + - use `$rpm_macro_makeinstall_perl' if set in the configuration file +* pck-update + - release numbers in the form n1.n2[.n3] are now supported + - modified specfile parsing in `resolve_rpmvars()' to support rpm definitions + like %define label str1,str2,str3 + - fix in the autoformatting feature for `%build' blocks + - use "%make test" instead of "make test" if "%make" is defined +* configuration file + - new variable `rpm_macro_makeinstall_perl' (def. value: "%makeinstall_perl") + +-------------------------------------------------------------------------------- + +Changes in version 0.6.1 +Sat Maj 28 2005 Davide Madrisan + +* pck-update + - named piped files hang autospec: skip them while running checks for known + vulnerabilities + - check if the ftp server is reachable before trying to upload the new + packages or move the old ones to the backup folder, to avoid annoying and + repetitive error messages printed by the ftp tool + - quality package checks: do not warn for executables found in + `/etc/rc.d/init.d/' + - major changes in the autoformatting algorithm to avoid stripping of + conditional directives + - allow leading spaces in the preamble entries + - autoformatting feature: reordering of preamble lines is only performed if + no conditional directives ('%if' commands) has been found + - autoformatting feature: comment lines are now not stripped out but appended + at the end of the preamble (sorry, autospec is not cleaver enought to do + something better for now) + - package version entered by user at command line is cosidered now when + expanding rpm '%define' commands, to fix this bug: + + %define majversion %(echo %version | cut -d. -f 1-2) + Name: libgtkhtml + Version: 2.4.1 + Source: http://ftp.gnome.org/pub/GNOME/sources/%{name}/%{majversion}/%{name}-%{version}.tar.bz2 + ... + + $ autospec -u libgtkhtml 2.6.3 -a3 + ... + 1] http://ftp.gnome.org/pub/GNOME/sources/libgtkhtml/2.4/libgtkhtml-2.6.3.tar.bz2 + ERROR: should be 2.6 --> ^^^ + - minor fixes +* configuration file + - removed variables + - ftp_ro_server + - ftp_ro_port + - ftpurl_ro (was: ftp://ftp.qilinux.it:21/pub/QiLinux/devel) + - modified the meaning/name of + - ftpurl_ro_rpms + from : ${ftpurl_ro[0]}/RPMS + to : ftp://ftp.qilinux.it:21/pub/QiLinux/devel/RPMS + - ftpurl_ro_srpms + from : ${ftpurl_ro[0]}/SRPMS + to : ftp://ftp.qilinux.it:21/pub/QiLinux/devel/SRPMS + - new variable: `rpm_macro_pyver' : python version + - new variable `format_autoformat' + - the boolean variable `format_extra_rules' is now a list of sed command + distro specific. For QiLinux, now the rules are: + format_extra_rules="\ + s,\(%{_mandir}/.*man[0-9]/.*\.\)[0-8]$man_compress_ext.*,\1\*, + s,\(/usr/share/man/.*man[0-9]/.*\.\)[0-8]$man_compress_ext.*,\1\*, + s,\(%{_infodir}/.*\.\)info$man_compress_ext.*,\1\*, + s,\(/usr/share/info/.*\.\)info$man_compress_ext.*,\1\*, + s,\&\& rm -rf %{buildroot},\&\& rm -rf \"%{buildroot}\", + s,test x\"%{buildroot}\" != x/,[ \"%{buildroot}\" != / ], + s,make[ \t]*%[{]*[?]*_smp_mflags[}]*,$rpm_macro_make, + s,^[ \t]*\([%]*make\)[ \t]*pure_install[ \t]*$,\1 pure_install DESTDIR=%{buildroot}," + - new variable: `curl_options': options used by curl while dowloading source files. + The default value is: "-O -f --connect-timeout 15 --retry 2 --progress-bar" +* spec-create + - when a specfile for a python package is created, the requirement for python + is added + - specfile for perl updated + make pure_install --> make pure_install DESTDIR=%{buildroot} +* rpm4QiLinux-it-HOWTO + - in sync with current release +* i18n + - fixed a typo error + +-------------------------------------------------------------------------------- + +Changes in version 0.6.0 +Mon Apr 25 2005 Davide Madrisan + +* configuration file + - new default configuration for `ftpurl_ro' and `ftpurl_ro_[s]rpms' vectors: + when downloading files, first search in the devel tree and the files are + not found try with devel-contrib + - new variables: + - `ftp_ro_server' : server from where packages are downloaded + - `ftp_rw_server' : server where packages are uploaded + - new variables: `ftp_ro_port' and `ftp_rw_port' + `ftp_port' is an alias for `ftp_ro_port' and `ftp_rw_port' if the latter + variables are not set + - new variables: `ftp_rw_passive_mode' + `ftp_passive_mode' is an alias for `ftp_rw_passive_mode' if this variable + is not set + - new variables: + format_preamble_tab + format_description_width (was `description_width') + format_unix_tools (was `use_rpm_vars_for_tools') + format_buildroot_value (was `BuildRoot_stdvalue') + format_buildroot (default value: "%{buildroot}") + format_builddir (default value: "%{_builddir}") + format_extrarules + path_ldconfig (was `ldconfig_path') + path_installinfo (was `installinfo_path') +* autospec + - code updates to support the new configuration variables (see above) + - short option for `--debug' is now `-D' (was `-d') + - a few changes in the online help +* pck-update + - code updates to support the new configuration variables (see above) + - better help message when code to [un]install info pages is not detected + - implemented support for conditional definition of rpm variables in the + specfile preamble + %define use_gcc33 0 + %if %{use_gcc33} + %define BUILD_CC "ccache gcc33" + %else + %define BUILD_CC "ccache gcc" + %endif + - exit with error when a bad specfile is detected (mostly duplicate entries) + - fixed a long standing bug occurring when invoking the autoformatting + feature over a specfile preamble with one or more blank lines + - exit with error if a `%description' with no body is detected + - if `format_description_width' is `0', the description body is not formatted + (verbatim copy) + - few other improvements and bugfixes in the autoformatting feature + - correctly parse URLs with space characters + - download of multiple source files (`Source[0-9]*') implemented + - broken `--specfile' option fixed + - new `--define' option: usefull to set one or more rpm variables used in + the specfile, for instance the version number of extra source files + [specfile] + %define addons_ver 1.2.3 + Source0: http://www.website1.net/%{name}-%{version}.tar.gz + Source1: http://www.website2.net/addons-%{addons_ver}.tar.gz + [user command] + autospec -u ... --define addons_ver=1.2.4 +* i18n + - updates, strings optimisation +* rpm4QiLinux-it-HOWTO + - in sync with current release + - added more informations about the rpm macros available in QiLinux +-------------------------------------------------------------------------------- + +Changes in version 0.5.4 +Sun Apr 10 2005 Davide Madrisan + +* spec-create plugin + - add `PreReq: /sbin/install-info' if info pages are found + - `%post' and `%preun' scripts have now the needed commands used to install + and remove info pages using the `install-info' tool +* configuration file + - new variables `rpm_macro_installinfo', `rpm_macro_uninstallinfo' + - new variable `installinfo_path' (default value: /sbin/install-info) +* pck-extract plugin + - if the `-F' is not specified all the files are extracted (a statistically + better choice) not only the specfile +* pck-update plugin + - added support for boolean variables used in the `%files' blocks + %define foo 1 + ... + %if %foo + %files foo_pck + ... + %endif + - minor fixes + - check if info pages are installed and removed via rpm scriplets +* rpm4QiLinux-it-HOWTO + - in sync with current release +* i18n + - updates +* Makefile + - fixed to remove the boring error message print by tar + tar: --exclude=autospec-0.5.4.tar.bz2: Cannot stat: No such file or directory + tar: Error exit delayed from previous errors +-------------------------------------------------------------------------------- + +Changes in version 0.5.3 +Fri Mar 25 2005 Davide Madrisan + +* pck-extract plugin + - fixed the srpm file check regexpr + - fixed a couple of problems in the i18n support +* pck-update plugin + - do not execute `eval' on every `%define' directive: it give no usable info + and could lead to security issues + - fixed the regexpr used to set the `SRPM_PATCH' variable when the right + value in the specfile is an URL +-------------------------------------------------------------------------------- + +Changes in version 0.5.2 +Mon Mar 21 2005 Davide Madrisan + +* pck-update plugin + - added support for conditional rpm variable (like `%{?foo}') + - updated `resolve_rpmvars()' to support a specfile scenario like this: + + %define majversion %(echo %version | cut -d. -f 1-2) + Name: libavifile + Version: 0.7.41 + ... + http://ovh.dl.sourceforge.net/avifile/avifile-%majversion-%version.tar.gz + + ... + %files + %defattr(-,root,root) + %dir %{_libdir}/avifile-%{majversion} + %{_libdir}/avifile-%{majversion}/* + + - better debug messages in `resolve_rpmvars()' + - display a warning if the `%{expand:%%define ...}' directive is found; + (implementation is yet missing) + - fixed the new upload scheme when uploading the same package (same version + and release numbers) multiple times +-------------------------------------------------------------------------------- + +Changes in version 0.5.1 +Sun Mar 13 2005 Davide Madrisan + +* pck-update plugin + - display a warning if the rpm macros `%configure', `%make', `%makeinstall' + `%makeoldinstall' are not used (but enabled in the configuration file) + while updating the specfile (--action 4) + - cosmetic changes in the output messages + - the code now does not assume that the specfile name is `%{name}.spec', but + looks in the srpm package for the real name + - once a rpm variable has been set, its value is used and never recalculated + looking in the specfile (optimization) + - the backup copies of old specfiles are now rotated before `--action 1' is + executed; this way an existing specfile is not overwritten in this step + (thanks to Massimo Pintore (massimo.pintore(a)qilinux.it) for the bug report) + - modified the regular expression used to find if every `%files' block has a + `%defattr' directive + - fixed package upload when no old copy of that package exists in the + repository +* autospec + - new option `-S|--specfile' to let the user specify the name of the specfile +* i18n + - updates, strings optimisation +-------------------------------------------------------------------------------- + +Changes in version 0.5.0 +Fri Mar 11 2005 Davide Madrisan + +* autospec + - removed the `--info', and `--no-info' options + - 2nd action in autospec 0.4.15 is now action 1st + - new action number 2, currently unimplemented + - added a check for `curl' binary presence in PATH folders +* pck-update plugin + - make SRPMS installation more verbose (list of installed files) + - added a short documentation for all implemented functions + - action 11 removed: backup, or removing of old packages from repository + has been moved to action 10 (upload of new packages to the given repository) + - exit with error if more than one candidate is found on the repository when + looking for the current srpm package +* spec-create plugin + - exit with error if the package name and/or version cannot be autodected + and the user has not provided their value(s) +* pck-extract plugin + - exit with error if on try to extract files from a non-srpms package +* configuration file + - removed the variables: `ftpurl_ro_info', `use_infofile', `info_tmpdir' +* i18n + - updated +* rpm4QiLinux-it-HOWTO + - updated +-------------------------------------------------------------------------------- + +Changes in version 0.4.15 +Wed Mar 02 2005 Davide Madrisan + +* pck-update plugin + - fixed again the regexpr used in `specfile.getvars SRPM_TARGET' + - added a check to verify if both `ftp_rw_user' and `ftp_rw_passwd' are set + or unset + - if `Source[0]' does not point to an internet address, a warning message + is now printed (instead of the previous blocking error message) + - fixes to let autospec work when the `info_files' option is set to `0' + - code cleanups +* autospec + - colorized input enabled by default +* rpm4QiLinux-it-HOWTO + - updated +-------------------------------------------------------------------------------- + +Changes in version 0.4.14 +Tue Feb 15 2005 Davide Madrisan + +* pck-update plugin + - fixed warnings generated by the new version of findutils (4.2.15) + - `ftpurl_ro' is now a vector to permit download from multiple ftp sites + and/or branches (for instance autospec can forst try from the update branch + and then, if the file has not been found, from the main branch) + - minor fixes +* spec-create plugin + - fixed warnings generated by the new version of findutils (4.2.15) + - fixed a bug in the function `expand.variables()': if more than one candidate + is found in the `configure', just choose the first. +* configuration file + - `ftpurl_ro' is now a vector (see above) + - new boolean variable `use_infofile' (default value `0', that is: do not use + the info files by default; do read all the informations in the specfile) +* rpm4QiLinux-it-HOWTO + - updated +-------------------------------------------------------------------------------- + +Changes in version 0.4.13 +Sat Jan 29 2005 Davide Madrisan + +* pck-update plugin + - `Epoch' is not a mandatory entry in the specfile; do not exit if not found + - minor fixes +* spec-create plugin + - code cleanups +* autospec + - the option `-C' (`--config`) can be only used now when looking for the + value of a configuration variable used by autospec + - do not overwrite the option set via command line with the values found in + the configuration file(s) +* configuration file + - new variable `use_infofile' with default value "0": by default do not use + info files when updating packages (info files are not always available) +-------------------------------------------------------------------------------- + +Changes in version 0.4.12 +Mon Jan 24 2005 Davide Madrisan + +* pck-update plugin + - fixed the regexpr used in `specfile.getvars SRPM_TARGET' + - added support for `Epoch' + - print a warning if `%setup -q -D -T' or a similar command is found +* spec-create plugin + - added experimental code to support building and installing processes via + `Build.PL' scripts, i.e.: + perl Build.PL + ./Build, ./Build test, ./Build install + - automatically build the list of perl files when using `Build.PL' +-------------------------------------------------------------------------------- + +Changes in version 0.4.11 +Sun Jan 16 2005 Davide Madrisan + +* pck-update plugin + - removed the default action (some users dislike this behaviour) +* autospec + - new `--eval' command, used to get the value of the given configuration + variable set in at least one of the configuration files used by autospec + - disable colorize output if logging is enabled +* configuration file + - modified `source0_name_structure' to catch all the supported compressed + archives + - new default (/var/tmp) for logging directory `logging_dir'; was `/tmp' + - new variable `info_tmpdir' with default value `/tmp', used to set the + directory where info files will be saved +* rpm4QiLinux-it-HOWTO + - fixed some typos and mispellings (thanks to "whitone" (whitone(a)gmail.com) + for reporting the problem) + - updated +-------------------------------------------------------------------------------- + +Changes in version 0.4.10 +Sun Jan 09 2005 Davide Madrisan + +* pck-update plugin + - modified behaviour of action 11: erase packages from ftp site if + `ftpdir_rw_old' is unset in the configuration file, otherwise do a backup + copy in the `ftpdir_rw_old' directory + - fixed sed substitution in function `resolve_rpmvars': was broken for rpm + variables like + %define kde_groups audio,floppy,cdrecordings,dialout,camera,tty.scanner + where the rvalue has "," characters + - fixed initialisation of `SRPM_TARGET' when one or more rpm variables + different from `%name', `%version', `%release' are used + - made install simulation a bit more verbose + - added a check for suspicious binary/library files with wrong permissions + (that is non executable files) + - check for `%buildroot' strings improved +* autospec + - modified help (see above) + - copyright info updated +* spec-create plugin + - when looking for a GNU generic INSTALL document do ignore directories, + thanks to Massimo Pintore (massimo.pintore(a)qilinux.it) for reporting the + problem + - added the internal variable `tar_compability_mode' (default value = '0') + in the `autospec' script if someone has a tar tool that do not support the + commands 'xjf', 'xzf', 'xZf' (gnu tar ver 1.14 and above do support them) + - added a partial and experimental support for python modules + - added support for the rpm macros + `%configure', `%make', `%makeinstall', `%makeoldinstall' + configurable via configuration file entries (see below) +* configuration file + - new variables `python_module_name_structure' to check the sintax of python + modules names and the , and `python_modules_group' + - new variables + `rpm_macro_configure', `rpm_macro_makeinstall', + `rpm_macro_make', and `rpm_macro_makeoldinstall' + used to configure the rpm macros + `%configure', `%makeinstall', `%make', `%makeoldinstall'. + the default values: + rpm_macro_configure="%configure" (standard rpm macro) + rpm_macro_makeinstall="%makeinstall" (standard rpm macro) + rpm_macro_make="%make" (NOT a standard rpm macro) + rpm_macro_makeoldinstall="%makeoldinstall" (NOT a standard rpm macro) + are correct for the QiLinux distro (rpm >= 4.0.4-21qilnx) +* i18n + - updated +* rpm4QiLinux-it-HOWTO + - updated +-------------------------------------------------------------------------------- + +Changes in version 0.4.9 +Wed Dec 15 2004 2004 Davide Madrisan + +* autospec + - new option `-L (--log)' to enable output logging; the log files will be + created in the directory `$logging_dir' (see configuration file) +* configuration file + - new (non mandatory) variable `logging_dir', with default value `/tmp', + used by autospec to store the log files +* spec-create plugin + - added autodetection of W3C licenses + - removed duplicates in the list of directories for header files + - better output for debug messages when looking for header files paths + - fixed detection of header files paths in `specfile.includedir' + - added a function for configure/makefile variable expansion + this way list of manpages, pkgconfig files, header files directory, etc. + built using configure/makefile variables (@var@/$(var)|${var}) are now + supported by this plugin + some examples: + @includedir@/opensc --> ${_prefix}/include/opens + $(includedir)/pygtk-$(PLATFORM_VERSION)/pygtk --> + %{_includedir}/pygtk-2.0/pygtk + - run unzip with the '-q' option to avoid trash lines on top of the specfile + - do not add in the `%doc' list the GNU generic INSTALL file and empty docs + - minor fixes +* pck-update plugin + - small changes required by the new logging option + - the insecure temporary file creation vulnerability check should work also + for perl scripts + - new subpackages added during the upgrade process are now uploaded to the + ftp site even if `--no-info' is unselected (new subpackages are not yet + listed in the info file) + - if the package is vulnerable to the insecure creation of temporary files + bug, some hints for packagers are printed +-------------------------------------------------------------------------------- + +Changes in version 0.4.8 +Sun Nov 14 2004 Davide Madrisan + +* spec-create plugin + - exit if `Makefile.PL' (`$perl_Makefile_generator') is not found. + - all the occurrences of `Makefile.PL' substituted with the new variable + `$perl_Makefile_generator' (I've found a package (`SDL_perl') that uses + `BUILD.PL' instead of the standard perl script `Makefile.PL') +* pck-extract plugin + - added the new option `--destdir' to save extracted files in a folder + different from `$PWD' + - made more robust to system errors +* pck-update plugin + - fixed detection of lines before the specfile preamble (typo fix) + - added more debugging messages + - don't tell it's an autospec bug, if a user enter a value for --action + that is out of range (i.e. 'autospec -u autospec 0.4.8 -a99') + - only print the pre-preamble lines when debug mode is enabled + - fixed a sequence of multiple errors messages displayed when the user + manually modify the info file in a broken way + - made more verbose when saving backup copies on the ftp server + - added a check for the `%buildroot' strings in the packaged files + (can be usefull to detect wrong paths in scripts dinamically created) + - added code to support specfiles with package names, versions, releases, + sources, patches, and URLs set using rpm variables + (i.e. `%define major_ver 0.7 + Patch: %{name}-%{major_ver}-0.7.38-libdir.patch') + note: conditional variables are not (yet) supported + - only check for RPATH vulnerabilies ELF binaries and libraries + - check for setuid binaries while looking for security problems + - added a check for unsecure use of `$$' as random source in shell scripts + - check if all the `%files' blocks have a `%defattr' directive +* i18n + - minor changes +* configuration file + - new (non mandatory) variables: + - `description_width' with default value `80' + - `perl_Makefile_generator' with default value `Makefile.PL' +* Makefile updated +-------------------------------------------------------------------------------- + +Changes in version 0.4.7 +Tue Nov 02 2004 Davide Madrisan + +* spec-create plugin + - fixed the autodetection of the package name and version, when the tarball + has a non standard format, like 'GubedServer0.1.2.tar.bz2', 'tidy_src.tgz' + - fixed an error in the code for perl specfiles creation ("%doc" --> "%dir") + - modified default 'Source' for perl modules. Old one was: + 'http://search.cpan.org/CPAN/authors/id/.../$pck_tarball_4spec' + New 'Source' is: + 'http://www.cpan.org/authors/id/.../$pck_tarball_4spec' + - fixed the regular expression that autodetects the 'perl_module_name' to + handle both \' and \" characters + Thanks to Mirko Cortillaro (mirko.cortillaro(a)qilinux.it) for the bug + report + - remove duplicated entries from the list of the man pages created in some + untested situations (thanks to Silvan Calarco (silvan.calarco(a)qilinux.it) + for reporting this bug) + - minor fixes +* pck-update plugin + - let autospec be a bit more verbose when uploading packages; + feature required by Silvan Calarco (silvan.calarco(a)qilinux.it) + - inserted a check in 'specfile.getvars()' to stop execution if the function + fails to initialize a requested variable + - the package number set by the user via the command line is now not required + by the actions that doesn't need it + - it's now possibile to specify the version and the release of a package via + the command line options + - do not delete lines (%define, comments, ecc.) before the specfile preamble + - better algorithm for specfile %descriptions autoformatting ('-f' option), + but there are yet some situations it cannot handle correctly (anyway they + should only be related to opefully unusual and badly formatted specfiles) + - added experimental code to autoformat ('-f' option) %build sections + - minor fixes +* autospec + - modified 'autospec --help' output to document the sintax extension for + the 'pck-update' plugin +* rpm4QiLinux-it-HOWTO + - updated +* new file TODO with development notes +-------------------------------------------------------------------------------- + +Changes in version 0.4.6 +Tue Oct 19 2004 Davide Madrisan + +* spec-create plugin + - cleanups and fixes in the includedir path discovery algorithm +* pck-update plugin + - checks if the value of 'Name' and 'Version' are coded using rpm variables + - checks if *.so files in devel packages seems to be pure plugins and not + symbolic links to dynamic libraries (pure plugins must be in the main + package, not in devel) + - checks for some wrong symbolic links (link starting by '%_{tmppath}') + - modified the default action when the '--action' command in not specified by + the user (previously was: do all the steps, now is: "1:5,7,8" (see the + builtin variable 'default_action') + - checks if 'Source' is defined using rpm variables and try to resolve these + variables into their values looking at the '%define' commands + - minor fixes +* autospec + - fix a typo error in the --help ('md5' --> 'md5/sha1') + - modified the logic used by autospec when loading the configuration files: + autospec first try to load the main configuration file (/etc/autospec.conf), + then try to load '~/.autospec' if the user has not set a different file + using the available command line option + (feature requured by Silvan Calarco (silvan.calarco(a)qilinux.it)) + - 'autospec --help' and 'autospec --version' can now be executed by the + user root +* i18n + - small fixes in it.po +* rpm4QiLinux-it-HOWTO + - updated +-------------------------------------------------------------------------------- + +Changes in version 0.4.5 +Thu Oct 14 2004 Davide Madrisan + +* spec-create plugin + - added some warnings about data initialized with default values that must + be replaced with real values by the packager + - added experimental support for includedir path discovery in case of + libraries and when the Makefiles have been generated by automake + If necessary, the code try to expand the Makefile variables used, looking + into the Makefiles and the (main) configure script + - when a 'standard' specfile is created and has some header files declared + in one of its Makefile.am files, the devel %package and %description stuff + is added to the generated specfile + - added experimental support for includedir path discovery in case of + 'standard' specfiles + - preliminary support for pkgconfig files (*.pc) when creating a specfile + for Makefiles not generated via GNU automake and for non library packages +* pck-update plugin + - sintax of the '--action' command extended + - various fixes when the '--no-info' command is used + - added a command to calculate md5 and sha1 checksums + - added support for the 'ExclusiveArch' id + - the srpm and the tarball packages are now downloaded only if they are not + found in the local filesystem; + feature required by Silvan Calarco (silvan.calarco(a)qilinux.it) +* autospec + - modified the examples in 'autospec --help' to show the new sintax for the + command '--action' + - minor fixes +* configuration file + - new variable 'ldconfig_path' with default value set to '/sbin/ldconfig' + - new variable 'patch_name_structure' used to check the structure of the + patches names that may be present in the Patch[0-9]* ids + - added the variable 'use_rpm_vars_for_tools' with default value set to '0', + that permit the packager to select or unselect the use the rpm variables for + the some common Unix tools (i.e. %{_make}, %{__rm}, %{__ln_s}, ...) + - new variable 'source0_name_structure' used to check the structure of the id + 'Source' or 'Source0' (the default value find for valid internet addresses) +* i18n + - fixed a typo error in it.po + - some strings have been simplified + - different sintax for the internal errors (bugs) + - added some missing messages used when debugging is enabled +* rpm4QiLinux-it-HOWTO + - updated +-------------------------------------------------------------------------------- + +Changes in version 0.4.4 +Wed Oct 06 2004 Davide Madrisan + +* spec-create plugin + - added support for pkgconfig files (*.pc) when creating a specfile for a + library when Makefiles are generated via GNU automake + - fixed wrong warning about Makefile[.in] files not found when generating + a specfile for a perl module (they use Makefile.PL) + - added auto-detection of the perl module name (looking into Makefile.PL) +* configuration file + - new variables + * library_name_structure (default value: "^lib") + * perl_module_name_structure (default value: "^perl-") + They define the structure of libraries and perl module names +-------------------------------------------------------------------------------- + +Changes in version 0.4.3 +Tue Oct 05 2004 Davide Madrisan + +* help message modified to show the use of the '--no-info' option +* the configuration variable 'ftpdir_rw_old' is no more mandatory because + external contributors generally have no access to this directory +* default configuration file modified to be as ready as possible for external + contributors +* added the HOWTO (italian language) `rpm4QiLinux-it-HOWTO' +-------------------------------------------------------------------------------- + +Changes in version 0.4.2 +Mon Oct 04 2004 Davide Madrisan + +* fixed 'ftp_rw_user' and 'ftp_rw_passwd' initialization when the '-l' command + line option is used +* added the command line option '--no-info' to tell autospec to try to + update a package even if its info file is unavailable. + This option is usefull if a specfile has just been created using the + spec-create plugin and we want to create and test the (s)rpm packages + automatically using the pck-update plugin +-------------------------------------------------------------------------------- + +Changes in version 0.4.1 +Mon Sep 13 2004 Davide Madrisan + +* spec-create plugin + - get the correct name for packages with one or more hyphens in their names + - fixed the check for makefiles in the '%build' section + - removed the (not so easy to read) rpm variables (like '%{__make}'); + feature required by Silvan Calarco (silvan.calarco(a)qilinux.it) + - fixed the error: missing `specfile.write_build' command +* pck-update plugin + - fixed a sed error message shown when the option '-f' is selected + - the value of 'BuildRoot' is overwritten with the string found in the + configuration file, or "%{_tmppath}/%{name}-%{version}-build"} if such a + value is undefind + - added support for the 'Obsoletes' id in the specfile preamble + - removed the (not so easy to read) rpm variables (like '%{__make}') when + substitution when the '-f' flag is used + - yet some fixes and improvements in the autoformatting code +* fixed a typo error in it.po +* added the file BUGS +-------------------------------------------------------------------------------- + +Changes in version 0.4.0 +Mon Sep 13 2004 Davide Madrisan + +* spec-create plugin + - do not write "%doc" if no standard documents are found +* pck-update plugin + - don't display commented build requiremnts as real build requirements + - when autoformatting is enabled overwrite the values of "Vendor" and + "Distribution" using the values found in the configuration file + - new algorithm for update with autoformatting flag enabled + - added code to format the text in the "%description" blocks + - fixed wrong substitution when "%{__make} install" is found +* pck-extract plugin (new name for the old 'spec-extract' plugin) + - new command line sintax and one more option (-F) + - every file in the package can be extracted, not only the specfile +* 'colorized' option added in the configuration file +* added italian localization +-------------------------------------------------------------------------------- + +Changes in version 0.3.9 +Wed Sep 01 2004 Davide Madrisan + +* pck-update plugin + - added a check for wrong duplicate entries in the specfile preamble + - fixed bad substitution of rpm variables (like '%{__make}') +* spec-create plugin + - fixed specfile creation errors when no Makefile exists in the tarball + - i18n files are now processed using the rpm macro '%find_lang' +* autospec, autospec.conf, and autospec.spec now autogenerated by make using + the *.in files +-------------------------------------------------------------------------------- + +Changes in version 0.3.8 +Fri Aug 27 2004 Davide Madrisan + +* added a Makefile to build, install, and uninstall autospec from sources +* added a command option to enable colorized output +-------------------------------------------------------------------------------- + +Changes in version 0.3.7 +Wed Aug 25 2004 Davide Madrisan + +* function specfile.create + - fixed license type scanning in 'specfile.write_preamble' when no COPYING + file is found in the tarball + - added the missing "Version" directive in 'specfile.write_preamble()' +* function package.update + - fixed rpm install simulation with multiple rpm packages + - fixed the download of new source files when there's not a "Source" directive + in the specfile but several "Section[0-9]" ones + - fixed preamble reformatting code to support tags repeated on multiple + lines (like for instance 'BuildRequires') +* added the "ftp_passive_mode" option in the configuration file +-------------------------------------------------------------------------------- + +Changes in version 0.3.6 +Fri Aug 20 2004 Davide Madrisan + +* function package.update + - fixed broken checks for '%setup' and '%setup -q' specfile options + - fixed rpm install simulation and upload steps +* autospec script slitted into a main script and three plugins +* added initial i18n support (gettext) +-------------------------------------------------------------------------------- + +Changes in version 0.3.5 +Mon Aug 09 2004 Davide Madrisan + +* function specfile.create + - handle correctly relative paths to source tarballs (`-s' option) + - added list of common `%docs' entries found in the package root directory + - autodetect of prefix variable used by makefiles (`prefix' or `DESTDIR') + - autodetect of i18n files, man pages, and info pages + - full list of man pages available for makefiles generated by automake + (there's even support for the unusual macro 'manSECTIONdir_MANS') and + for manually build makefiles ('manpagename.manSECTIONdir' files only) + - full list of info pages list available for makefiles generated by automake +* function package.update + - added security checks for RPATH vulnerabilities + - added support for updates with same version number + - autoformatting fixes (`-f' option) +* added the `-x' option to extract specfile from srpm packages +* various bugfixes and code cleanups +* added checks to catch some wrong command line input +* added sintax check of info files when they are loaded +-------------------------------------------------------------------------------- + +Changes in version 0.3.4 +Thu Aug 05 2004 Davide Madrisan + +* first public release diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dfbe6a0 --- /dev/null +++ b/Makefile @@ -0,0 +1,197 @@ +# Makefile for autospec +# Copyright (C) 2004-2008 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +include VERSION +include Makefile.env + +PACKAGE = autospec +FRONTEND = $(PACKAGE) +PACKAGE_LIB = libspec.lib + +LOCALES = it + +srcdir = . + +distdir = $(PACKAGE)-$(VERSION) +dist_archive = $(distdir).tar.bz2 + +DESTDIR = + +pck_conf = $(PACKAGE).conf +pck_libs := $(sort $(patsubst %.in,%,$(wildcard lib/*))) +pck_manpages := $(patsubst %.in,%,$(wildcard man/*.in man/*/*.in)) +pck_plugins := $(sort $(patsubst %.in,%,$(wildcard plugins/*))) +pck_templates := $(sort $(patsubst %.in,%,$(wildcard templates/*))) +pck_tests := $(sort $(patsubst %.in,%,$(wildcard tests/*))) +pck_tools := $(sort $(patsubst %.in,%,$(wildcard tools/*))) + +pck_infiles := $(wildcard *.in lib/*.in man/*.in man/*/*.in plugins/*.in templates/.in tests/* tools/*.in) + +.SUFFIXES: +.SUFFIXES: .in + +.in:; @echo "Generating $@...";\ + sed "s,@package@,$(PACKAGE),g;\ + s,@version@,$(VERSION),g;\ + s,@release@,$(RELEASE),g;\ + s,@frontend@,$(FRONTEND),g;\ + s,@pck_lib@,$(PACKAGE_LIB),g;\ + s,@pck_conf@,$(pck_conf),g;\ + s,@libdir@,$(libdir),g;\ + s,@sysconfdir@,$(sysconfdir),g;\ + s,@plugindir@,$(plugindir),g;\ + s,@templatedir@,$(templatedir),g;\ + s,@testdir@,$(testdir),g;\ + s,@date@,`LC_ALL="C" date "+%a %b %d %Y"`,g;\ + s,@date_my@,`LC_ALL="C" date "+%B %Y"`," $< > $@ + +all: dist-update locales check + +check: dist-update + @echo "Checking libraries and scripts for syntax errors..." + @$(MAKE) check -C plugins || exit 1 + @$(MAKE) check -C tests || exit 1 + @$(MAKE) check -C tools || exit 1 + +dist-update: $(pck_infiles:.in=) + +locales: + @for loc in $(LOCALES); do\ + $(MAKE) -C po/$$loc || exit 1;\ + done + +install-frontend: $(PACKAGE) $(pck_conf) + @echo "Installing frontend..." + @$(INSTALL_DIR) $(DESTDIR)$(bindir) + $(INSTALL_SCRIPT) $(PACKAGE) $(DESTDIR)$(bindir)/$(PACKAGE) + @echo "Installing configuration file..." + @$(INSTALL_DIR) $(DESTDIR)$(sysconfdir) + $(INSTALL_DATA) $(pck_conf) $(DESTDIR)$(sysconfdir)/$(pck_conf) + +install-libs: $(pck_libs) + @echo "Installing libraries..." + @$(MAKE) install -C lib || exit 1 + +install-locales: locales + @echo "Installing localization files..." + @for loc in $(LOCALES); do\ + $(MAKE) install -C po/$$loc || exit 1;\ + done + +install-manpages: $(pck_manpages) + @echo "Installing manpages..." + @for loc in $(LOCALES); do\ + $(MAKE) install -C man/$$loc || exit 1;\ + done + +install-plugins: $(pck_plugins) + @echo "Installing plugins..." + @$(MAKE) install -C plugins || exit 1 + +install-templates: $(pck_templates) + @echo "Installing templates..." + @$(MAKE) install -C templates || exit 1 + +install-tests: $(pck_tests) + @echo "Installing tests..." + $(MAKE) install -C tests || exit 1 + +install-tools: $(pck_tools) + @echo "Installing tools..." + $(MAKE) install -C tools || exit 1 + +install: install-frontend \ + install-libs \ + install-manpages \ + install-plugins \ + install-templates \ + install-tests \ + install-tools \ + install-locales + +uninstall: + @echo "Uninstalling all the files..." + rm -f $(DESTDIR)$(bindir)/$(PACKAGE) + rm -f $(DESTDIR)$(sysconfdir)/$(pck_conf) + @for f in $(pck_libs); do\ + echo "rm -f $(DESTDIR)$(libdir)/$${f##*/}";\ + rm -f $(DESTDIR)$(libdir)/$${f##*/};\ + done + @for f in $(pck_plugins); do\ + echo "rm -f $(DESTDIR)$(plugindir)/$${f##*/}";\ + rm -f $(DESTDIR)$(plugindir)/$${f##*/};\ + done + @for f in $(pck_templates); do\ + echo "rm -f $(DESTDIR)$(templatedir)/$${f##*/}";\ + rm -f $(DESTDIR)$(templatedir)/$${f##*/};\ + done + @for f in $(pck_tests); do\ + echo "rm -f $(DESTDIR)$(testdir)/$${f##*/}";\ + rm -f $(DESTDIR)$(testdir)/$${f##*/};\ + done + @for f in $(pck_tools); do\ + echo "rm -f $(DESTDIR)$(tooldir)/$${f##*/}";\ + rm -f $(DESTDIR)$(tooldir)/$${f##*/};\ + done + @for loc in $(LOCALES); do\ + $(MAKE) uninstall -C man/$$loc || exit 1;\ + $(MAKE) uninstall -C po/$$loc || exit 1;\ + done + +dist: clean + @for f in ChangeLog NEWS; do\ + case `sed 15q $$f` in \ + *"$(VERSION)"*) : ;; \ + *) \ + echo "$$f not updated; not releasing" 1>&2;\ + exit 1;; \ + esac; \ + done + @rm -f history/$(dist_archive) + @echo "Creating the compressed tarball..." + @$(INSTALL_DIR) history + tar cf - --exclude=history -C .. $(distdir) |\ + bzip2 -9 -c > history/$(dist_archive) + +dist-rpm: dist $(PACKAGE).spec + @echo "Creating rpm and srpm packages..." + @rpm_name=$(PACKAGE)-$(VERSION)-$(RELEASE);\ + rpm_sourcedir=`rpm --eval=%{_sourcedir} 2>/dev/null`;\ + rpm_specdir=`rpm --eval=%{_specdir} 2>/dev/null`;\ + for d in $$rpm_sourcedir $$rpm_specdir; do\ + [ -d "$$d" ] || \ + { echo "not found: $$d" 1>&2; exit 1; };\ + done;\ + (cp -p history/$(dist_archive) $$rpm_sourcedir &&\ + mv -f $(PACKAGE).spec $$rpm_specdir &&\ + rpmbuild --clean -ba $$rpm_specdir/$(PACKAGE).spec) || exit 1 + @echo "All done. Enjoy using $(PACKAGE)..." + +clean: mostlyclean + rm -f history/$(dist_archive) + +mostlyclean: + @echo "Cleaning up unpackaged files..." + @$(MAKE) clean -C lib || exit 1 + @$(MAKE) clean -C plugins || exit 1 + @$(MAKE) clean -C templates || exit 1 + @$(MAKE) clean -C tests || exit 1 + @$(MAKE) clean -C tools || exit 1 + @for loc in $(LOCALES); do\ + $(MAKE) clean -C man/$$loc || exit 1;\ + $(MAKE) clean -C po/$$loc || exit 1;\ + done + diff --git a/Makefile.env b/Makefile.env new file mode 100644 index 0000000..954397a --- /dev/null +++ b/Makefile.env @@ -0,0 +1,37 @@ +# Makefile for autospec +# Copyright (C) 2008 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +prefix = /usr/local +sysconfdir = /etc +tmpdir = /tmp +exec_prefix = $(prefix) +bindir = $(exec_prefix)/bin +datadir = $(prefix)/share +libdir = $(datadir)/autospec/lib +localedir = $(datadir)/locale +mandir = $(datadir)/man +#plugindir = $(datadir)/autospec/plugins +plugindir = $(bindir) +templatedir = $(datadir)/autospec/templates +testdir = $(datadir)/autospec/tests +tooldir = $(bindir) + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} -m 755 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_DIR = ${INSTALL} -d -m 755 + diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..278634c --- /dev/null +++ b/NEWS @@ -0,0 +1,1580 @@ +List of user visible changes in the release 1.8.0 + +-- Bug fixes + + * pck-update - Silvan Calarco: + Action 6: Fix automatic build requirements detection with rpm 5. + +-- Improvements + + * templates/{perl,standard} - Davide Madrisan: + Updated. + + * templates/standard-daemon - Davide Madrisan: + New template for packages providing a system/network service. + + * lib/libcfg.lib - Davide Madrisan: + Support modularized configuration files (`~/.autospec.d/*.conf'). + (Based on an idea developed by Stefano Cotta Ramusino.) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.7.3 + +-- Bug fixes + + * templates/{kde4,python} - Davide Madrisan: + Fixes. + + * libspec - Davide Madrisan: + Workaround the segmentation fault of "rpm --eval" while parsing an internet + address (like rpm --eval 'http://ftp.gnu.org'). + (Pointed out by Silvan Calarco) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.7.2 + +-- Bug fixes + + * spec-create - Davide Madrisan: + Fixed expansion of source and license tags. + + * pck-update - Davide Madrisan: + action 1: Display the right installation path for files extracted from a + srpm archive. + +-- Improvements + + * spec-create - Davide Madrisan: + Improvements in the specfiles created for perl archives. + + * templates/library - Davide Madrisan: + Improved template for library packages. + +-- Updates + + * Updated Italian translations. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.7.1 + +-- Bug fixes + + * spec-create - Davide Madrisan: + Fixed a regression in the expansion of the macro '@standard_docs@'. + + * templates/{standard,perl} - Davide Madrisan: + Various fixes. + +-- Updates + + * spec-create - Davide Madrisan: + Updated help message. + + * spec-create - Davide Madrisan: + Add support for jar archives. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.7.0 - Christmas Release + +-- Updates + + * spec-create - Davide Madrisan: + A completely rewritten plugin based on the templates available in the + templates directory. + + * templates/{gnome,kde*,library*,perl,python,standard} - Davide Madrisan: + All the template has been reworked to be used by the new spec-create engine. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.6.3 + +-- Updates + + * libnetwork.lib - Davide Madrisan: + Better output in debug mode. + + * pck-update - Davide Madrisan: + New option '--force-download': download the source files even if found in + the SOURCE directory. + +-- Bug fixes + + * libcfg.cfg - Davide Madrisan + Display a correct error message when the user configuration file is not + available. + +-- documentation + + * italian manpage: + Document the new option '--force-download'. + Minor updates. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.6.2.1 + +-- Bug fixes + + * libnetwork.lib - Davide Madrisan + Make the backup of old files working again. + (thanks to Silvan Calarco for reporting this problem) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.6.2 + +-- Updates + + * libnetwork.lib - Davide Madrisan + New library, formerly known as librepository.lib, contaning also all the + functions previously provided by libcurl.lib. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.6.1 + +-- Improvements + + * pck-update - Davide Madrisan + Action 3: download the source file(s) specified in the specfile (instead + okf exiting with and error message) when no package version is specified + at command line. + + * pck-update - Davide Madrisan + Action 5: display a warning message if "PYTHONDONTWRITEBYTECODE" is set. + (required by Stefano Cotta Ramusino) + + * pck-update, libcurl - Davide Madrisan + All the code related to curl has been moved from pck-update to libcurl. + Several cosmetic changes were made to remove all the code duplication in + pck-update. Now the code appears only once in libcurl :) + +-- Bug fixes + + * autospec.conf - Davide Madrisan + Fixed and simplified the example for the ftp repository configuration for + openmamba. + + * autospec.conf - Davide Madrisan + Update the `patch_name_structure' variable to fix the check of the patches + name structure. + + * pck-update, libcurl - Davide Madrisan + The deletion of the old srpm packages works again. + +-- Updates + + * librepository.lib - Davide Madrisan + Exit with an error message when a curl command doesn't succeed. + + * pck-update - Davide Madrisan + Several improvements in the messages shown while downloading and uploading + files (side effect of the moving of all the curl related code to libcurl). + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.6.0 + +-- Improvements + + * autospec.conf - Silvan Calarco, Davide Madrisan + New option `srpm_install_options' with default value `--nodeps': + by default the srpm packages are now installed without taking care of the + missing dependencies (for compatibility with rpm5). + + * pck-update - Silvan Calarco + Compatibility fixes to support rpm 5. + Better support with multiarch uploads. + The discovery of the default architecture was improved. + + * pck-update - Silvan Calarco, Davide Madrisan + By default do use smart for rpm download and install. + Create specfile backups as old files (i.e. prefixed by '.') by default. + Two new options (`spec_backup_extension' and `spec_backup_attr' was + introduced in autospec.conf to make this behaviour configurable. + Better support for `noarch packages'. + + * autospec.conf, libspec.lib - Davide Madrisan + Support 'IEEE' and 'Copyright only' licenses. + Support a list of licenses ending with the `, and' separator. + Now the licenses set in the subpackages are also scannned while looking for + syntax and quality issues in the specfiles. + + * spec-create - Davide Madrisan + Add support for '.lz' and '.7z' compressed archives. + + * libcurl - Davide Madrisan + New library containing all the code related to curl. + Available functions are for now: `curl.download()', and `curl.upload()'. + + * pck-update - Davide Madrisan + Extended code reworking to translate previous code into calls to the licurl + functions. + + * Several minor fixes and debug enhancements. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.5.0 + +-- Improvements + + * pck-update (patch by Silvan Calarco): + Speed optimization. + + * libspec.lib + Various speed improvements in the core function 'rpmvars.solve'. + + * libspec.lib + Use rpm preprocessor to solve the variables used in a specfile. + Initial patch by Silvan Calarco. Reworked to move all the code into the + pck-update plugin and to run the rpm preprocessor only once. + + * pck-update + When it make sense, do use the preprocessed specile instead of the original + one when parsing the specfile. + +-- Bug fixes + + * libapse.lib (patch by Silvan Calarco): + Honour the netlink option ('curl_opts_netlink'). + + * pck-update (patch by Silvan Calarco): + Fix identification of old packages to backup. + + * pck-update (patch by Silvan Calarco): + Reduce severity from error to warning if host command fails as happens + using qemu-arm environment. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.17 + +-- Bug fixes + + * pck-update: + Honour user defined macros when expanding rpm variables found in the + speciles. This problem was noticed by Silvan Calarco when cross-compiling + packages via autospec. + + * pck-update: + Use alternative root directory, if provided, for build requirements check. + + * pck-update: + Don't pass alternative root directory to rpmbuild except when running + rpmbuild --nobuild to check dependencies. + As the dependencies check is done before, it is safe to pass --nodeps to + non-simulated build commands. + + * test01_pkgquality: + Skip the `%buildroot' test whether 'rpm_ignores_buildroot' is true in the + configuration file. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.16 + +-- Improvements + + * spec-create: + Support lzma compressed archives. + + * templates/python: + Automatically build the full list if files + + * libapse.lib (patch by Stefano Cotta Ramusino: + Check for new software at sourceforge.net/sf.net sites. + +-- Bug fixes + + * pck-update (patch by Silvan Calarco): + Cross-compilation fix. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.15 + +-- Improvements + + * templates/kde4: + add update-desktop-database, update-mime-database, and gtk-update-icon-cache + calls to rpm scriplets. + + * pck-update (patch by Silvan Calarco): + new option '--root=DIRECTORY': use the file system tree rooted at DIRECTORY + for all rpm operations. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.14 + +-- Bug fixes + + * pck-update: + fix upload of rpm/srpm packages when 'ftp_rw_port[]' is set in the + configuration file + + * pck-update + (patch provided by Silvan Calarco): + pass build options and defines to rpmbuild --nobuild to prevent it from + failing when it shouldn't. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.13 + +-- Improvements + + * spec-create: + add support for xz compressed archives. + +-- Bug fixes + + * spec-create: + always end '%post' and '%preun' blocks containing multiple statements with + an 'exit 0' command. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.12 + +-- Bug fixes + + * libapse.lib: + fix the error message: + /usr/share/autospec/lib/libspec.lib: line 1018: [: too many arguments + + * tools/kde4-flist2rpmvars: + do not skip the first file of the list to process. + + * tools/kde4-flist2rpmvars: + correcty handle the '%{_kde4_xdgappsdir}' and '%{_kde4_xdgmimedir}' macros. + +-- Improvements + + * spec-create: + improved creation of python specfiles. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.11 + +-- Bug fixes + + * libapse.lib + (reported by Silvan Calarco): + fixed a nasty regression bug introduced in 1.4.9 that prevented libapse + from finding lots of software updates while looking on the internet. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.10 + +-- Update + + * templates/python + (patch provided by Silvan Calarco): + do use %{__python} instead of python in the specfiles of python packages. + + * templates/python + (patch provided by Stefano Cotta Ramusino: autospec-1.4.9-python_opt.patch): + do not build the python modules twice. Use the optimization flag `-O1'. + +-- Bug fixes + + * pck-update (reported by Stefano Cotta Ramusino): + if a description begins with a '%' character, do not pretend that the + "`%description' has empty body". + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.9 + +-- Update + + * autospec.conf (data by Stefano Cotta Ramusino): + new list of OSI approved licenses. + +-- Improvements + + * autospec.conf, libapse.lib + (patch provided by Silvan Calarco): + improvements in the Autospec Package Search Engine. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.8 + +-- Improvements + + * libapse (patch provided by Silvan Calarco): + improved package version detection. + + * libspec: + support debug packages. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.7 + +-- Improvements + + * pck-update (patch provided by Silvan Calarco): + integrated the relocate_RPM_dirs patch + +-- Bug fixes + + * libspec.lib (apse.scrapeversion()) (patch provided by Silvan Calarco): + update the Autospec Package Search Engine for the site + + * pck-update: fix the update of packages when the package name contains a + relative or absoute path. + + * pck-update: fix the initialisation of the specfile directory when the + '-S/--specfile' option is specified. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.6 + +-- Bug fixes + + * autospec.conf (patch provided by Silvan Calarco): + updated `apse_grep' and `apse_uri' variables + + * libspec.lib (apse.scrapeversion()) (patches provided by Silvan Calarco): + fix regexpr and code that check for a new version of a given package + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.5 + +-- Improvements + + * pck-update, libapse.lib (patch provided by Silvan Calarco): + new option '--pckurlverbatim' in apse.scrapeversion(); + added `source0' url based search + + * libreposirory.lib (repository.get_SRPMS_name(), repository.get_RPMS_name()): + new option '-l|--user' (login user) for repositories that require + authentication even in readonly mode + +-- Bug fixes + + * libspec.lib (apse.scrapeversion()): handle specfiles with no url specified + in source0 + + * libspec.lib (apse.scrapeversion()): fix regexpr used for parsing + sourceforge.net pages + + * libspec.lib (apse.scrapeversion()) (patch provided by Silvan Calarco): + fix perl packages scraping + + * pck-update (action 4): do not always display the warning message + `Source[0]': does not point to a valid internet address + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.4 (Christmas Release!) + +-- Bug fixes + + * libspec.lib (specfile.getvars()): support non-standard package names like + 'foo2zjs.tar.gz', 'pdf417_enc.4.4.tar.gz', and 'slib3a4.zip' + (issue reported by Silvan Calarco) + + * pck-update (infofile.create()): check the optional specfile path entered by + users via command line options (only the path set in the rpm configuration + files is supported) + + * pck-update (action 2): whether a newer version of a package is found on + the web, do use this version number instead of the version coded into the + specfile; this fixes an issue discovered by Silvan Calarco using the + autospec tool while performing multiple actions like '--action 2:4' + +-- Compatibility issues + + * pck-update (action 1): do not remove the SRPMS package after download and + installation (feature asked by Silvan Calarco) + + * pck-update (action 2): exit with exit code 4 (instead of error code 1) if + the current package is already the latest version (patch by Silvan Calarco) + +-- Improvements + + * librepository (repository.get_SRPMS_name()): only download the repository + web pages only once per repository (thanks to Silvan Calarco for reporting + this problem) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.3 + +-- Improvements + + * spec-create: added support for the 'https' protocol + +-- Bug fixes + + * librepository.lib: a more general regular expression is now used in the + function 'repository.get_pckname_from_HTML()' (this should fix all the + issues recently spotted by Silvan Calarco) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.2 + +-- Improvements + + * libspec.lib: the " <= " syntax in the build requirements + is now supported (thanks to Silvan Calarco for reporting the problem) + + * librepository.lib: new library with the repository/internet related code + (as usual it can be used in any third-part scripts) + + * Now autospec build and run on Ubuntu (tested on Ubuntu 8.04) plus rpm tools + (note: alien is not yet supported) + +-- Bug fixes + + * pck-update: fixed the 'ftp_alias' support (thanks to Silvan Calarco for the + bug report) + +-- Compatibility issues + + * Makefile: use "/usr/local" as default prefix instead of "/usr" + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.1 + +-- Improvements + + * autospec.spec: subpackages descriptions now have an italian tranlations + + * tests: the security and quality tests have been moved to external modules; + other tests can be added in a simpler way than before + + * autospec.conf: + new variables + - 'rpm_install_noinstall_mask' + - 'rpm_install_l10n_pck_mask' + - 'rpm_install_l10n_pck_allow_lang_mask' + used to control which localization/development packages will be installed + by the plugin 'pck-update' (feature asked by Silvan Calarco) + + ex. rpm_install_noinstall_mask='-apidocs-' + rpm_install_l10n_pck_mask='-i18n-|-help-' + rpm_install_l10n_pck_allow_lang_mask='it' + + in this example: + - the apidocs packages will never by installed + - only the localization packages for the italian language will be installed + +-- Compatibility issues + + * most plugins and libraries require now bash version 3 or better + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.4.0 + +-- Improvements + + * libapse: merged two pathes written by Silvan Calarco which increase + interoperability with the "autodist" tool written by Silvan Calarco for the + openmamba distribution + + * the localization files are now splitted into separate files (one for each + library and plugin, and one for the autospec frontend) + +-- Compatibility issues + + * pck-update: make a backup copy of the old specfiles when executing action 1 + (srpm download/install) instead of action 4 (specfile update). + This seems more useful for developers and for the automatic upgrading tool + used in openmamba. Feature asked by Silvan Calarco + + * autobuild: this tool has been removed because it hasn't been developed and + maintained for a long time and it has been now superceeded by `autodist', + written by Silvan Calarco for the openmamba distribution + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.3.2 + +-- Improvements + + * pck-update: merged "autospec-1.2.2-localedir.patch" by Silvan Calarco: + this patch improves the detection of locales files performed by autospec + + * pck-update: implemented aliases for ftp repositories (using the new vector + variable 'ftp_alias' in the autospec configuration file). + Affects both the options '--server-download' and '--server-upload'. + Feature asked by Silvan Calarco. + + With this configuration lines: + ftp_alias[0]="devel" + ftp_alias[1]="contrib" + + you can now select the second repository in the two ways: + autospec -u -a0 --server=1 + autospec -u -a0 --server=contrib + + * pck-update: support package names matching the regular expression + '-svn-<..>.rpm', like 'peercast-svn20070619-1mamba.src.rpm' + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.3.1 + +-- Bug fixes + + * autospec: Fixed typo in the help message + + * pck-update: Fixed a regression in the '--changelog' option (thank to + silvan.calarco(a)mambasoft.it for spotting this) + + * libapse.lib: updated to work again with the renewed sourceforge site + (patch by silvan.calarco(a)mambasoft.it) + + * several minor regressions have been fixed in all the plugins + +-- Improvements + + * pck-update: new option "--force-update" (silvan.calarco(a)mambasoft.it) + + * pck-update: fixed openmamba bug #83 reported by "skiver": remote patches + are not automatically downloaded + + * libapse.lib: exit with return value "3" if a new version of the given + package cannot be found (patch by silvan.calarco(a)mambasoft.it) + + * updated the italian man page and the document `autospec-it-HOWTO' + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.3.0 + +-- Improvements + + * libspec.lib: display "skipped" also for remote files already found in the + local disk (that is previously downloaded) + + * all the plugins can be now executed directly. The autospec frontend is not + necessary any more (it can be replaced by a graphical one, for instance;-) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.2.2 + +-- Improvements + + * pck-update, action 5: speed up installation of missing build requirements + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.2.1 + +-- Improvements + + * pck-extract: preserve timestamps when extracting files from a srpm archive + +-- Bug fixes + + * libspec.lib: support specfiles with licenses containing one or more spaces + (thanks to silvan for reporting this issue) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.2.0 + +-- Bug fixes + + * pck-update: a minor fix related to the 'proxy_user' variable + +-- Improvements + + * templates: created the following specfile templates + templates/gnome + templates/kde3 + templates/kde4 + templates/library + templates/librarytool + templates/perl + templates/python + templates/standard + + * libapse.lib: new functions + 'getnamefromtarball()' + 'getversionfromtarbal()' + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.9 + +-- Changes + + * autospec, italian man page: updated copyleft message + + * pck-update, action 6: committed patches by Silvan Calarco + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.8 + +-- Changes + + * pck-update + - action 11: fixed an issue related to the recent rpm version upgrade + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.7 + +-- Changes + + * autospec.conf: new variables `rpm_macro_cmake' and + `rpm_macro_makeinstall_cmake' + + * spec-create: support the cmake building technology + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.6 + +-- Changes + + * libspec.lib: various changes (see ChangeLog for details) to support `Name's + using variables, that is matching the following regexpr: + "string0%{?varname:%varname-string1-}string2" + (feature asked by Silvan Calarco) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.5 + +-- Changes + + * configuration data moved from libapse.lib to the configuration file + (patch by Stefano Cotta Ramusino, aka whitone) + +-- Bug fixes + + * fixed a bug introduced by the 1.1.4 update + (thanks to whitone for reporting this issue and providing a patch) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.4 + +-- Changes + + * libapse.lib: `apse.scrapeversion' updated to the latest version + (patch from Stefano Cotta Ramusino, the main author) + + * autospec.conf: fixed some typos in the comment lines + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.3 + +-- Changes + + * libapse.lib: `apse.scrapeversion' returns the following exit codes: + 0 : package is already the latest version + 1 : a package with newer version is already installed + 2 : a new version is available + +-- Bug fixes + + * autospec.conf: added "Graphical Desktop/Applications/Security" to + `rpm_allowed_groups' + + * pck-update, action 4: do not strip out all the make commands but the last + one in specfiles containing multiple occurrences of `make' in their + %build sections, when autoformatting is enabled + + * pck-update, action 6: do not be too clever, if the specfile is newer than + the rpm and/or srpm packages just print a warning message + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.2 + +-- Bug fixes + + * libspec.lib: fixed two minor issues with tarballs with the name matching + the `_' scheme + + * config-getvar (autospec --eval): fixed queries results + + * autospec.conf: updated `format_extra_rules' to automatically upgrade old + perl specfiles to the new scheme used in qilinux/openmamba distributions, + if the option `-f' is used + + * configuration file: the `format_description_width' variable is now set to + `0' by default (unlimited length for description lines) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.1 + +-- Changes + + * pck-update, action 6: merged changes made by silvan.calarco(a)mambasoft.it + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.1.0 + +-- Changes + + * pck-update, action 6: merged the `find_buildrequirements' script written + by silvan.calarco(a)mambasoft.it + +-- Bug fixes + + * spec-create: fixed a regression bug introduced in version 1.0.2 + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.0.2 + +-- Changes + + * Updated and improved italian man page + + * spec-create: better support for perl modules using the more recent + `Module::Build' building, testing, and installing system + + * spec-create: improved support for perl modules creation + + * pck-update, action 8: added a new test for checking whether a package + with no binary (elf) files has the BuildArch tag set to `noarch' + +-- Bug fixes + + * pck-update, action 5: if the rpm packages are rebuilt force the repackaging + of the srpm package too + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.0.1 + +-- Bug fixes + + * pck-update: use a better regexpr (in `repository.get_RPMS_name/()') when + parsing the list of files found in a given repository reached trough a + proxy server + + * support for kde4 libraries (see autospec.conf) + + * updated autospec-it-HOWTO (formerly known as `rpm4QiLinux-it-HOWTO') + +------------------------------------------------------------------------------- + +List of user visible changes in the release 1.0 + + After three years of work I am very happy to announce this + milestone release of autospec! + +-- Changes + + * tbz2 file archives (file archive compressed with both .TAR and .BZ2 + compression) are now supported (a most peculiar extension indeed) + + * pck-extract, spec-create: allow execution of these plugins by root even + if the configuration file `/root/.autospec' doesn't exist + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.99 + +-- Bug fixes + + * pck-update: fixed some issues related to the changes in the openmamba + website + + * configuration file: modified the default settings for `ftp_rw_server', + ftp_rw_rpms_dir', and `ftp_rw_srpms_dir' according to the new openmamba + web infrastructure + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.98 + +-- Bug fixes + + * pck-update, action 10: do not display usernames and passwords in the + debug messages + + * pck-update, action 0,10: url redirection is now supported when scanning + for rpm and srpms packages at http urls + + * pck-update, action 10: the backup of old packages should now work again + + * pck-update: the variable `curl_opts_netlink' can now be set in the user + configuration file to tune connection timeout and number of retries when + downloading files + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.97 + +-- Changes + + * configuration file: the list of the approved licenses has been updated + +-- Bug fixes + + * honour command line LANG setting + + * pck-update, action 10: more general approach when creating the urls where + the packages will be uploaded in order to support the url scheme used by + openmamba + +-- Compatibility issues + + * The syntax of the values of the configuration variables `ftpurl_ro_rpms' + and `ftp_rw_rpms_dir' has been modified to permit a different setup of the + architectures supported in the repositories. Here an example: + + ftpurl_ro_rpms[1]="http://www.openmamba.org/pub/openmamba/devel-contrib/RPMS.@arch@" + ftp_rw_rpms_dir[1]="/RPMS.@arch@" + arch_list[1]="i586" + arch_noarch_upload[1]="${arch_list[1]}" + + The string `@arch@' in the repository `n' means: every architecture listed + in `arch_list[n]'. + + arch_list @arch + ----------------------------- + "i586 ppc arm x86_64" "i586", "ppc", "arm", "x86_64" + "i586" "i586" + + See the global configuration file for details. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.96 + +-- Changes + + * configuration file: the list of the approved licenses has been updated + + * pck-update, action 2: `sourceforge.net' is now also scanned while finding + for available packages over the web + +-- Bug fixes + + * configuration file: do really support openmamba in the default settings + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.95 + +-- Changes + + * configuration file: default setting modified to support openmamba + + * update, action 4: support the upgrade of packages when switching between + two different linux distribution + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.94 + +-- Improvements + + * update, action 8: check for desktop files installed in /usr/share/applnk/ + (a non-standard location used by kde in the old times) + +-- Bug fixes + + * update, action 4: fixed some minor bugs (see ChangeLog for details) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.93 + +-- Improvements + + * libspec: now it's possible to force the download of a source file, + even if a local copy (can be corrupted) has been detected + +-- Bug fixes + + * libspec: do not dowload a remote file if a local copy is found + + * update, action 4: fixed code used to append multiline changelog entries in + the specfiles; was affected by a strange bug apparently caused by a bash + upgrade + +-- Other changes + + * configuration file: by default the variable `python_module_name_structure + is now unset. The python packages do not need now a mandatory `python-' + prefix in their names; the original names can be used. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.92 + +-- Improvements + + * update, action 0: added support for http repositories + +-- Bug fixes + + * this release contain several code cleanups and some minor bug fixes + especially in the main script + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.91 + +-- Improvements + + * update, action 5: do not check for uninstalled build requirements and + source files if nor the srpm not the rpm packages need to be built + +-- Bug fixes + + * libspec: fixed expansion of define directives found in a specfile that + refer to other define directives + + ex. %define gnomever %(echo `rpm -q --queryformat '%{VERSION}' libglib`) + %define gnomemajver %(echo %gnomever | cut -d. -f 1-2) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.90 + +-- Improvements + + * update, action 10: the code used to upload packages has been reworked to + be more robust and easier to debug + +-- Bug fixes + + * this release contains several bug fixes related to network connections + trough a proxy server + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.15 + +-- Improvements + + * autospec.conf: the new option `--proxy' and `proxy_user' are available so + now it's possibile to use autospec trough a proxy server + + * almost all the modules have been updated to support connections trough a + proxy server + + * update, action 2: integrated the package engine search code developed by + Stefano Cotta aka whitone (stefano.cotta(a)qilinux.it); now autospec can + automatically search for updates! + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.14 + +-- Improvements + + * update, action 4: the test that checks for the presence of the + install/uninstall code for info pages has been improved, at least for LSB + compliant systems (thanks to "whitone" (stefano.cotta(a)qilinux.it) for + providing a patch) + + * spec-create: the uncompress utility is not required now; an error message + is printed if a .Z file is found and the uncomress utility is not installed + + * autospec: the new option `--ignore-test' is available so now it's possibile + to tell autospec to skip a given list of tests + +-- Bug fixes + + * several portability fixes (tested on OpenSuSE 10.[0,1]) + + * the `packager_group' variable can be now unset (some distros do not have + such a group) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.13 + +-- Improvements + + * update, action 0: when listing the available versions of a given package + found in the repositories, the server number is now also displayed + + * new option '-T/--target' available in the `autobuild' plugin + +-- Bug fixes + + * minor fixes and documentation updates + + * a bunch of bug fixes and enhancements in the `autobuild' plugin + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.12 + +-- Improvements + + * update, action 1: if `force_install' is set by user the srpm file is + downloaded and installed even if a local srpm has been detected + + * update, action 3: redirect is now supported by default by autospec when + downloading files from remote ftp servers + + * specfiles with conditional expressions with one operand, like + + %if "%{?stage1}" + + are now supported (libspec.lib were extended to support them) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.11 + +-- Improvements + + * new option `--force-build' to force the rebuild of rpm(s) and srpm + packages detected on the local harddisk + + * new option `--force-install' to force the installation of the rpm packages + even if rpm complains for errors + + * the previous (ambiguous) option `--force' is now a shortcut that can be + used to enable both these options + + * new options `--server-download' to select a server from where to download + the srpm packages + + * new option `--server-upload' to select a server where to upload packages + + * the previous (ambiguous) option `--server' can now be used to select a + server to be used for both download and upload + + * autobuild plugin updated and improved + + * the help message displayed when the user configuration file for autospec + is not found has been improved + + * update, action 5: if a source file cannot be found in the source directory + autospec now try to download it before starting the build process + (feature suggested by ) + + * if one or more lines in a specfile must be ignored by autospec, a command + block 'AUTOSPEC-OFF' - 'AUTOSPEC-ON' can now be used; an example follows + + ## *AUTOSPEC-OFF* + Obsoletes: %{name}-tools + ## *AUTOSPEC-ON* + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.10 + +-- Improvements + + * new plugin autobuild for batch processing: this plugin can parse text + files written with a specific syntax and execute shell commands, build, + upgrade, install, and upload rpm and srpm packages + +-- Bug fixes + + * minor fixes in the update and extract plugins (see the Changelog file for + details) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.9 + +-- Improvements + + * no improvements: this release only fix a few bugs discovered in the update + plugin (see the ChangeLog file for details) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.8 + +-- Improvements + + * update, action 5: the rpm and srpm packages are not built if they are + found on the local disk; to force the rebuild of such packages, the + `--force' option can be used + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.7 + +-- Improvements + + * update, action 11: the new option `--force' can be used now to force the + installation of the rpm packages (the rpm command used by autospec is user + configurable by editing the new configration variable `rpm_install_force') + + * any trailing ".spec" string found in the package name entered by user is + stripped out to avoid a potentially frequent and boring error message + +-- Bug fixes + + * update, action 10: fixed some typo and sintax errors; the `--server' + option should now always work as expected + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.6 + +-- Improvements + + * patches compressed with the gzip tool (*.{diff|patch}.gzip) are now + automatically decompressed by the pck-update plugin + + * update, action 0: the given srpm package is now searched in all the + configured repositories (the searching process do not stops at the first + match) so it is possible to know if a packages has been updated to several + different repositories, like public and commercial ones, with the same or + different version and/or release + +-- Bug fixes + + * update, action 10: packages backup/cleanup is now performed correctly + even when the `--server' option is specified by user + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.5 + +-- Improvements + + * The pck-update plugin now supports specfiles with source0 unset + This is a feature needed when updating some very unusual packages + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.4 + +-- Improvements + + * no improvements, just small bugfixes + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.3 + +-- Improvements + + * spec-create plugin: several minor fixss (especially when creating + specfiles for perl modules) and a few updates to use the new features + provided by rpm 4.4.4 + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.2 + +-- Improvements + + * The pck-extract plugin now automatically decompress the patch compressed + with the bzip2 tool. + Source files can now be remote URLs (will be automatically downloaded) + + * The pck-update plugin now also supports release numbers in the format + `[0-9]*.[0-9]*' + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.1 + +-- Improvements + + * New option `--server' used by the `pck-update' module to permit users to + force the selection of a single repository where to look for available srpm + files and where to upload new or updated packages. + This feature will permit developers to manage a (configurable) set of ftp + repositories where srpm packages could be even duplicated, with the same or + a different version and/or release number. + + * Autospec now exit with an error message if the configuration file + `~/.autospec' is not found or not readable by the user running autospec. + + * When a specfile is generated by autospec, the value for `Source:' has now + all the occurrences of the version number substituded by the string + `%{version}'. + + * rpm4QiLinux-it-HOWTO: an example of a working configuration file to put in + the home directory of any QiLinux contributors has been added. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.9.0 + +-- Compatibility issues + + * The configuration variables used during the uploading process have been + slightly modified and some variables have been added to enhance this + feature (see below). + All the compatibility problems should have been addressed with warning and + error messages. + +-- Improvements + + * Autospec now supports a set of repositories where the packages can be + uploaded. By default new packages are uploaded to the server where an old + copy of the SRPMS package is found. If no old packages exist, a default + server is choosen by autospec, looking at the new configuration variable + + `ftp_rw_server_num_default'. + + Its value is the zero-based index pointing to the list of available servers + `ftp_rw_server'. + The backup of any old package, is now performed using the directory saved + in the configuration variable + + `ftpdir_rw_old[i]' + + where `i' is the zero-based index of the ftp server where the old packages + have been found. If `ftpdir_rw_old[i]' is not set (or set to ""), the old + packages are just removed, as usual. + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.9 + +-- Improvements + + * update, action 4: new test to check if all the licenses listed in the + `License' entry in the specfile are approved licenses + (patch by "whitone") + + * update, action 4: added two short messages if test 8 or 9 fail to help users + + * autospec: the `--eval' command now supports all the configuration variable + typologies (notably the multiline vectors) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.8 + +-- Improvements + + * update, action 5: now supports both the options `--norpm' and `--nosrpm' + + * update, action 5: user defined values set via the `--define' command are + now passed to rpm when building a specfile + + * update, action 6: has been obsoleted + + * the rpm4QiLinux-it-HOWTO document has been updated + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.7 + +-- Improvements + + * specfile creation: the `-s' option now also supports URLs; in this case + the package is dowloaded and the URL used to set the `Source' entry in the + specfile + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.6 + +-- Improvements + + * autospec is now fully UTF-8 compliant + + * update, action 4: the test for info pages installation/removal has + been enhanced, so no false positive errors should be generated now + + * created italian manpage for autospec + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.5 + +-- Improvements + + * libspec.lib: + specfile.getvars: new query `SPEC_LICENSE' (patch submitted by whitone) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.4 + +-- Improvements + + * update, action 4: added a check to see if the `Group' entry specified + in the spefile is a known one, according to the (new) configuration + variable `rpm_allowed_groups' + + * libspec.lib: + specfile.getvars: new query `SPEC_GROUP' + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.3 + +-- Compatibility issues + + * update: + the code from action 2 has been moved at the top of action 4 to give room + for future implementations (action 2 does nothing usefull now) + +-- Improvements + + * checks for needed tools customized and moved at the top of each plugin body + to permit users to view help instructions, check configuration files and + execute some plugins even if not all the system tools required by autospec + are available + + * update, action 4: strict specfile sintax checks are performed before + updating the specfile + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.2 + +-- Improvements + + * autospec: + the `--eval' command can now be executed in quiet mode (`-q' option) + + * libspec.lib: + specfile.getvars(): query `SPEC_URL' now available + nested conditional blocks (%if ... %else ... %endif) in the specfiles are + now supported + + * update: new modifier `--norpm' for action `5' to only create the srpm + package + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.1 + +-- Improvements + + * update: new action `11' to install the rpm files created by a given + package + + * libspec.lib: + specfile.getvars(): query `SPEC_BUILDREQUIRES' now available + rpmvars.solve(): rpm variables are now expanded + example: rpmvars.solve("%{__install_info}" mbrowse.spec) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.8.0 + +-- Improvements + + * part of code has been moved to shell shared libraries (`libspec.lib' and + `libmsgmng.lib' for now) that can be loaded by external scripts to use + the feature of the autospec program; + execute the commands + . /usr/share/autospec/lib/libspec.lib + EXIT_FUNC=return specfile.getvars --help + for a short help message + + * installation of build requirements moved to action 5 (build section) + + * update, action 4: new option `--changelog' to set a user defined changelog + entry (multiline entries are allowed, using eol ('\n') characters) + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.7.3 + +-- Improvements + + * `BuildArch' entries in the specfile are parsed and (the last) used as + target architecture + + * generation of specfile for perl modules updated + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.7.2 + +-- Improvements + + * update, action 2: new test to check if the macro `%find_lang' is used when + localization files are detected + + * update, action 4 now install all the declared build requirements if + `rpm_download_and_install' is defined in the configuration file + (default value for `rpm_download_and_install': "sudo -y apt-get install") + +-- Bug fixes + + * rpm variables with prefix `?' (like `%{?_smp_mflags}"') should now be fully + supported in all the specfile contexts + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.7.1 + +-- Improvements + + * specfile tests (update, action 2 ) improved + +------------------------------------------------------------------------------- + +List of user visible changes in the release 0.7.0 + +-- Compatibility issues + + * the configuration variables `ftpdir_rw_rpms' and `ftpdir_rw_srpms' are + now vectors and their entries MUST be ordered in the SAME WAY as in + `ftpurl_ro_rpms[]' and `ftpurl_ro_srpms[]' + default value (setup for QiLinux contributors) + ftpurl_ro_rpms[0]="ftp://ftp.qilinux.it:21/pub/QiLinux/devel/RPMS" + ftpurl_ro_rpms[1]="ftp://ftp.qilinux.it:21/pub/QiLinux/devel-contrib/RPMS" + ftpurl_ro_srpms[0]="ftp://ftp.qilinux.it:21/pub/QiLinux/devel/SRPMS" + ftpurl_ro_srpms[1]="ftp://ftp.qilinux.it:21/pub/QiLinux/devel-contrib/SRPMS" + ftpdir_rw_rpms[0]="" + ftpdir_rw_rpms[1]="/devel-contrib/RPMS" + ftpdir_rw_srpms[0]="" + ftpdir_rw_srpms[1]="/devel-contrib/SRPMS" + + * update, action 2 now checks for sintax errors/non-standard stuff in the given + specfile (this check was part of action 4) + +-- Improvements + + * added support for multiple architectures, configurable via the `arch_list' + vector in the configuration file (default value: ("i586" "ppc")) + * upload of noarch packages configurable via the `arch_noarch_upload' vector; + the noarch packages will be uploaded in the subfolder(s) specified by this + variable (default value: ("i586" "ppc")) + * new options `--nosrpm', `--norpm' for --update (action 10 only) + * rpm variables with prefix `?' (like `%{?_smp_mflags}"') are now supported + * %if statements using boolean expressions involving strings are now supported + %if "%{?cross_target_cpu}" != "" + ... + * backup/cleanup of old packages found in the ftp repositories now also take + care of the `Obsoletes' tags + * tests performance (--update --action 8) dramatically improved + * new shell script `extract-specs' usefull to extract specfiles from srpms + archives with no use of temporary files + * the command `-S|--specfile' accepts now a specfile name with path + +-- Bug fixes + + * void strings in user definitions (like `--define cross_target_cpu=""') are + now allowed + * the `--eval' option now works correctly when invoked with vectors + * several minor bugfixes + +------------------------------------------------------------------------------- diff --git a/TODO b/TODO new file mode 100644 index 0000000..366b080 --- /dev/null +++ b/TODO @@ -0,0 +1,168 @@ +-- autospec, plugins --------------------------------------------------------- + +Silvan Calarco 15 fรฉvrier 2007 03:00 +ร€ : Davide Madrisan + +E' possibile con autospec configurare l'accesso in lettura al repository con +password? +Perchรฉ per inviare utilizza le impostazioni in ftp_rw_*, si logga e manda, +mentre per ricevere utilizza ftpurl_ro_* che contiene solo una url e quindi +non funzionano autospec -a1 e il backup/cancellazione dei files vecchi della +funzione -a10. Si puรฒ provare a mettere username e password nella url in un +formato di curl? Attualmente cancello a mano i vecchi pacchetti dopo averli +mandati con autospec (per fortuna quelli nel repository privato si contano +sulle dita di una mano). +In ogni caso la configurazione degli host la vedrei piรน semplice se fosse +organizzata tipo cosรฌ: + +ftp_server[0]="ftp.qilinux.it" +ftp_port[0]= +ftp_passive_mode[0]=on +ftp_user[0]=ftpqilinux +ftp_passwd[0]=***** +ftp_rpms_dir[0]="/devel/RPMS" +ftp_srpms_dir[0]="/devel/SRPMS" +ftp_olddir[0]="/devel/old" +ftp_anonymous_url_prefix[0]="ftp://ftp.qilinux.it/pub/QiLinux" + +Se ftp_anonymous_url_prefix รจ vuota fa l'accesso con password anche in +lettura, altrimenti trova i repository accodandovi ftp_rpms_dir o +ftp_srpms_dir. + +ciao, +Silvan + +-- +mambaSoft di Silvan Calarco - http://www.mambasoft.it + + +-- spec-create plugin --------------------------------------------------------- + + +check for non standard (/usr/lib) library files path +==================================================== + +SOME EXAMPLES +============= + +software main-pck devel-pck +------------------------------------------------------------------------------- +a52dec-0.7.4 %{_libdir}/*.so.* %{_libdir}/*.a + %{_libdir}/*.la + %{_libdir}/*.so + +liba52/Makefile.am + lib_LTLIBRARIES = liba52.la + liba52_la_SOURCES = bitstream.c imdct.c bit_allocate.c parse.c downmix.c + liba52_la_LIBADD = @LIBA52_LIBS@ -lm + liba52_la_LDFLAGS = -no-undefined + +liba52/Makefile.am + noinst_LIBRARIES = libao.a + libao_a_SOURCES = audio_out.c float2s16.c ... \ ... + +src/Makefile.am + a52dec_LDADD = $(top_builddir)/liba52/liba52.la \ + $(top_builddir)/libao/libao.a @LIBAO_LIBS@ + +software main-pck devel-pck +--------------------------------------------------------------------------------------- +libavifile-0.7.41 %{_libdir}/*.so.* %{_libdir}/*.a + %{_libdir}/avifile-0-7/*.a %{_libdir}/*.la + %{_libdir}/avifile-0-7/*.la %{_libdir}/*.so + %{_libdir}/avifile-0-7/*.so %{_libdir}/pkgconfig/avifile.pc + %{_libdir}/avifile-0.7/vidix/*.a + %{_libdir}/avifile-0.7/vidix/*.la + %{_libdir}/avifile-0.7/vidix/*.so + +drivers/libdha/Makefile.am + if AMM_USE_VIDIX + if AMM_LINK_SHARED + lib_LTLIBRARIES = libaviplaydha.la + else + noinst_LTLIBRARIES = libdha.la + endif + endif + + libaviplaydha_la_SOURCES = $(DHA_SRC) + libaviplaydha_la_LDFLAGS = -release $(AVIFILE_MAJOR_VERSION).$(AVIFILE_MINOR_VERSION) -version-info 0:$(AVIFILE_MICRO_VERSION):0 + + libdha_la_SOURCES = $(DHA_SRC) + +drivers/vidix/drivers/Makefile.am + pkglibdir = $(libdir)/$(PACKAGE)/vidix + + if AMM_USE_VIDIX + VIDIX_DRIVERS = \ + libgenfb.la \ + libmach64.la \ + libmga_crtc2.la \ + libmga.la \ + libpm3.la \ + libradeon.la \ + librage128.la + endif + pkglib_LTLIBRARIES = $(VIDIX_DRIVERS) + + VIDLIBS = $(LINK_LIBDHA) -lm + VIDLDFLAGS = -module -avoid-version + libgenfb_la_SOURCES = genfb_vid.c + libgenfb_la_LIBADD = $(VIDLIBS) + libgenfb_la_LDFLAGS = $(VIDLDFLAGS) + + libmach64_la_SOURCES = mach64_vid.c + libmach64_la_LIBADD = $(VIDLIBS) + libmach64_la_LDFLAGS = $(VIDLDFLAGS) + + ... + +software main-pck devel-pck +--------------------------------------------------------------------------------------- +libimlib2-1.1.0 %{_libdir}/*.so.* %{_libdir}/*.a + %{_libdir}/loaders/filter/*.so %{_libdir}/*.la + %{_libdir}/loaders/image/*.so %{_libdir}/*.so + %{_libdir}/loaders/filter/*.a + %{_libdir}/loaders/filter/*.la + %{_libdir}/loaders/image/*.a + %{_libdir}/loaders/image/*.la + +libltdl/Makefile.am + if INSTALL_LTDL + include_HEADERS = ltdl.h + lib_LTLIBRARIES = libltdl.la + else + noinst_HEADERS = ltdl.h + endif + + if CONVENIENCE_LTDL + noinst_LTLIBRARIES = libltdlc.la + endif + + libltdl_la_SOURCES = ltdl.c + libltdl_la_LDFLAGS = -no-undefined -version-info 3:0:0 + libltdl_la_LIBADD = $(LIBADD_DL) + + libltdlc_la_SOURCES = ltdl.c + libltdlc_la_LIBADD = $(LIBADD_DL) + + ## Because we do not have automatic dependency tracking: + ltdl.lo: ltdl.h config.h + +src/Makefile.am + lib_LTLIBRARIES = libImlib2.la + libImlib2_la_SOURCES = scale.c ... \ ... + libImlib2_la_LDFLAGS = -version-info 2:0:1 + + if HAVE_MMX + libImlib2_la_LIBADD = $(X_OBJS) @DLLDFLAGS@ $(MMX_OBJS) \ + $(top_builddir)/libltdl/libltdlc.la \ + $(x_libs) $(freetype_libs) $(LDFLAGS) + libImlib2_la_DEPENDENCIES = $(top_builddir)/config.h $(X_OBJS) $(MMX_OBJS) + else + libImlib2_la_LIBADD = $(X_OBJS) @DLLDFLAGS@ \ + $(top_builddir)/libltdl/libltdlc.la \ + $(x_libs) $(freetype_libs) $(LDFLAGS) + libImlib2_la_DEPENDENCIES = $(top_builddir)/config.h $(X_OBJS) + endif + + SYS_LOADERS_PATH = @pkglibdir@ diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..14c6071 --- /dev/null +++ b/VERSION @@ -0,0 +1,2 @@ +VERSION=1.8.0 +RELEASE=1mamba diff --git a/autospec-it-HOWTO b/autospec-it-HOWTO new file mode 100644 index 0000000..367ce3b --- /dev/null +++ b/autospec-it-HOWTO @@ -0,0 +1,583 @@ + autospec HOWTO: Guida alla creazione e manutenzione di rpm con autospec + Davide Madrisan, 13 ottobre 2008 + + Questo documento descrive come creare ed aggiornare pacchetti rpm con + `autospec', la suite di script e moduli bash che permette di velocizzare ed + automatizzare una buona parte delle operazioni necessarie alla gestione dei + pacchetti rpm, nonchรจ al controllo del loro livello qualitativo ed alla + ricerca di comuni problemi di sicurezza. Autospec รจ stato utilizzato con + successo dagli sviluppatori delle distribuzione Linux + - QiLinux (http://www.qilinux.org) + - openmamba (http://www.openmamba.org). + + Aggiornato alla versione 1.4.0 di autospec + + + 1. Introduzione + + Autospec รจ nato con l'intento di facilitare e sveltire le attivitร  di + creazione e aggiornamento dei pacchetti di distribuzioni Linux basate sul + sistema di pacchettizzazione rpm. In particolare รจ stato in primis il tool + di QiLinux che ha permesso la creazione di specfile standard e + l'aggiornamento ed update (semi)automatico dei pacchetti giร  presenti nella + distribuzione QiLinux, in particolare dei pacchetti presenti nei rami + sviluppo `devel' e `devel-contrib', il ramo dei contributori esterni. + E' ora il sistema principale di manutenzione dei pacchetti adottato dagli + sviluppatori della distribuzione openmamba. + Autospec รจ stato strutturato in modo modulare e parametrizzato in ogni suo + aspetto e componente per permettere il suo utilizzo in qualsiasi + distribuzione basata sul sistema di pacchetti rpm, mediante la sola modifica + dei valori assegnate alle variabili presenti nel file di configurazione. + + + 1.1. Licenza + + autospec-it-HOWTO - copyright (C) 2004-2008 by Davide Madrisan. + + E' concessa la copia, la distribuzione e/o modifica di questo documento + nei termini della licenza `GNU Free Documentation License', versione 1.1 + od ogni successiva versione pubblicata dalla Free Software Foundation, + senza variazione delle sezioni, senza testi di Front-Cover o di + Back-Cover. + + Una copia della licenza รจ disponibile presso + + http://www.gnu.org/copyleft/fdl.html + + + 1.2. Perchรจ questo documento? + + Questo documento รจ stato creato per fornire alcune linee guida a coloro + che vogliono creare e mantenere pacchetti rpm con la suite di script + autospec. In particolare vengono descritte le procedure di creazione e di + upgrade dei pacchetti. Autospec risulta di particolare utilitร  nella + creazione di librerie e moduli perl ed in genere di rpm di software + pacchettizzati utilizzando gli autotools GNU (automake, autoconf, libtool). + + + 1.3. Nuove versioni di questo documento + + Il documento รจ archiviato sul sito FTP della distribuzione openmamba, in + particolare nel pacchetto sorgente (srpm) di autospec presente nel ramo + devel. + + Si รจ autorizzati ed incoraggiati a spedire domande o commenti su questo + HOWTO e su autospec a Davide Madrisan . + + + 2. Come installare il software autospec + + Autospec รจ disponibile in formato tarball ed in formato rpm. + In particolare gli utenti QiLinux 1.1 possono installare il pacchetto con il + comando, eseguito da utente root, + + yum install autospec + + ed aggiornarlo con il comando, sempre eseguito da utente root, + + yum update autospec. + + Per gli utenti di QiLinux-devel e QiLinux 1.2pre1 o successive release, e per + gli utenti openmamba รจ possibile installare o aggiornare autospec mediante il + seguente comando + + apt-get install autospec + + o alternativamente tramite l'interfaccia grafica `synaptic'. + + Durante l'installazione viene creato un file di configurazione + + /etc/autospec.conf + + che รจ consigliabile non modificare. Per rendere autospec funzionante e + per personalizzarne il comportamento รจ necessario creare manualmente il + file + + ~/.autospec + + nella propria cartella home inserendovi i **soli** dati personali e le + opzioni diverse dalle scelte di default presenti nel file principale. + + Riportiamo qui di seguito un esempio di file di configurazione utente per + autospec che potrร  essere utilizzato da un `contributor' come fac-simile + per creare il proprio file di configurazione personale. + + [~/.autospec] + + # [configuration file for `autospec'] + proxy= + proxy_user= + packager_fullname="" + packager_email="@openmamba.org" + ftp_rw_user[1]="" + ftp_rw_passwd[1]="" + arch_list=(i586 ppc arm x86_64) + curl_opts_netlink="--connect-timeout 15 --retry 3 --limit-rate 250k" + + 3. Funzionamento di autospec + + Autospec รจ costruito da uno script principale di frontend ed una serie di + plugin che effettuano le operazioni di creazione di specfile, di + aggiornamento di pacchetti rpm e di estrazione di file da pacchetti rpm e + srpm. Vi sono inoltre alcune `librerie', cioรจ moduli contenenti funzioni + utiizzate nei plugin o utilizzabili da script creati da terze parti, su + cui non ci soffermeremo. + + Autospec ed i suoi plugin sono script di shell che richiedono bash v2.0. + + Il comando + + autospec --help + + fornisce l'elenco dei comandi disponibili. Analizzaremo nelle sezioni + seguenti alcuni di tali comandi e forniremo esempi pratici di utilizzo + di tali opzioni. + + + 3.1. Come utilizzare autospec per la creazione di specfile + + Per creare uno specfile di partenza tramite autospec รจ necessario + avere il sorgente del software (tarball) che si vuole pacchettizzare. + Utilizzeremo come esempio il tarball del `autospec' stesso, salvato + nella cartella `/usr/src/RPM/SOURCES/'. + La sintassi generica di autospec per la creazione di uno specfile รจ la + seguente: + + autospec -s [-n ] [-v ] [-t ] [-o ] + + dove le precedenti opzioni significano, nell'ordine: + + -s, --source Cerca di creare uno specfile per il indicato + -n, --pck-name Nome del pacchetto (default: ricavato dal nome del tarball) + -v, --pck-version Versione del pacchetto (default: ricavato dal nome del tarball) + -t, --type Categoria dello specfile da generare + standard : specfile standard (default) + gnome : specfile per pacchetti gnome + kde3 : specfile per pacchetti kde3 + kde4 : specfile per pacchetti kde4 + library : specfile per librerie + librarytools: specfile per librerie con tool + perl : specfile per singoli moduli perl + python : specfile per moduli python + + -o, --output Redirige lo standard output sul file + + Le opzioni tra parentesi quadre sono opzionali. + + Generiamo lo specfile di esempio con il comando: + + autospec -s /usr/src/RPM/SOURCES/autospec-1.0.1.tar.bz2 \ + -t standard -o /usr/src/RPM/SPECS/autospec.spec + + o anche + + autospec -s http://ftp.qilinux.it/devel/tools/autospec/autospec-0.8.8.tar.bz2 \ + -t standard -o /usr/src/RPM/SPECS/autospec.spec + + Viene in questo modo creato il file `/usr/src/RPM/SPECS/autospec.spec' che + contiene le istruzioni per la generazione dei pacchetti rpm e srpm del tool + autospec stesso. Nel secondo caso viene effettuato il download del software + e quindi viene creato lo specfile. + + Si noti che nell'esempio รจ stato scelto il formato `standard' (formato di + default). Altre scelte di formato attualmente disponibili sono + - `library', per la generazione di specfile relativi a librerie, + - `perl', per la generazione di specfile relativi a moduli perl + - `python' per la creazione di specfile per pacchetti python. + + Nella directory + + /usr/share/autospec/templates + + sono presenti i templati degli specfile per le categorie di specfile di cui + sopra. + + Si noti ancora che se si omette il comando `-o', il listato dello specfile + verrร  visualizzato su standard output. + + Consideriamo come ulteriore esempio il comando di creazione dello specfile + della libreria avifile: + + autospec -s /usr/src/RPM/SOURCES/avifile-0.7-0.7.40.tar.gz \ + -t library -n libavifile -v 0.7.40 + + In questo caso sono state utilizzate le opzioni `-n' per forzare il nome di + specfile `libavifile' e l'opzione `-v' per forzare la versione `0.7.40'. + Tali parametri infatti non sono ricavabili da autospec in automatico + utilizzando il nome del tarball (avifile-0.7-0.7.40.tar.gz). + + Si noti che, trattandosi di una libreria, si รจ scelto di seguire lo standard + QiLinux/openmamba che richiede che tali pacchetti abbiano sempre il prefisso + `lib'. + + Completato manualmente lo specfile con un editor di testo, รจ possibile creare + i pacchetti rpm e srpm con il comando seguente: + + autospec -u libavifile -a5 + + ed effettuare i test di simulazione di installazione, verifica di presenza di + alcuni tipi di vulnerabilitร  ed i test di qualitร  dei pacchetti creati: + + autospec -u libavifile -a7,8 + + ed effettuare l'upload sul sito ftp di QiLinux, con il comando + + autospec -u -a10 libavifile + + se in possesso del necessario account sul branch `devel-contrib'. + Si noti che se una versione precedente รจ presente nel repository, questa + verrร  rimossa oppure verrร  spostata nella cartella `ftpdir_rw_old', se tale + variabile รจ definita nel/i file di configurazione. + + Si veda il paragrafo successivo dove l'opzione `-u' viene esaminata in + dettaglio. + + + 3.2. Come utilizzare autospec per aggiornare pacchetti rpm + + Il tool autospec รจ molto utile durante la fase di aggiornamento di pacchetti rpm. + La sintassi da utilizare รจ la seguente: + + autospec -u -a [] [] [-d v1=r1[,v2=r2,...]] \ + [-l usr:pswd] [-S ] [-A ] \ + [--server-download ] [--server-upload ] \ + [--changelog "msg" ] [--nosrpm|--norpm] \ + [--force-update] [--force-build] [--force-install] \ + [--ignore-test t1[,t2,...]] [-c] [-f] [-L] [-R] + + dove le opzioni significano: + + -u, --update Aggiorna automaticamente il pacchetto , versione + -a, --action Esegue la lista di azioni separate da virgole + 0. cerca se il pacchetto รจ disponibile nei repository + 1. download ed installazione del pacchetto srpm + 2. controlla se รจ disponibile un aggiornamento + 3. download dei nuovi file sorgente + 4. aggiornamento e controllo dello specfile + 5. creazione dei pacchetti rpm e srpm + 6. creazione della lista dei build requirement + 7. simulazione dell'installazione dei pacchetti rpm + 8. esecuzione dei test di qualitร  e sicurezza + 9. calcolo dei valori di hashing md5 e sha1 + 10. upload dei nuovi pacchetti sul sito ftp, + *rimozione* dei vecchi pacchetti dal sito ftp + (backup in `$ftp_rw_old_dir', se definita) + 11. installazione dei nuovi pacchetti rpm + --force-update Forza l'aggiornamento dei pacchetti rpm e srpm + --force-build Ricrea comunque i pacchetti rpm e srpm + --force-install Installa i nuovi pacchetti anche in caso di errori rpm + --force Cerca di eseguire comunque le azioni specificate + --ignore-test Non esegue i test indicati (t1[,t2,...]) + -d, --define Assegna alle variabili v1,v2,... i valori r1,r2,... + --server-download + Server da utilizzare nel download dei pacchetti + --server-upload Server dove effettuare l'upload dei pacchetti + --server Server per l'upload e il download dei pacchetti + -l, --login User (usr) e password (pswd) per l'upload sul sito FTP + -S, --specfile Nome dello specfile (default: .spec) + -A, --arch Forza un valore per l'architettura + --changelog Scrive il messaggio indicato nel changelog del pacchetto + --nosrpm azione 5: Crea soltanto i pacchetti rpm + azione 10: Non effettua l'upload del pacchetto srpm + --norpm azione 5: Crea soltanto il pacchetto srpm + azione 10: Non effettua l'upload dei pacchetti rpm + -c, --clear Rimuove tutti i file temporanei + -f, --format Abilita la riformattazione dello specfile + -L, --log Abilita il log su file (nella directory: `$logging_dir') + -R, --rebuild Attiva modalitร  ed impostazioni di rebuild (azione 4) + + Per aggiornare ad esempio ad esempio il pacchetto `util-linux' alla versione + 2.12b, si esegua il seguente comando: + + autospec -u -a1,3:5,7,8 util-linux 2.12b + + E' necessario avere una connessione attiva internet poichรจ verranno eseguiti + i seguenti download: + + step 1 : download del pacchetto corrente srpm di `util-linux' dal + primo sito indicato nei file di configurazione, o dal suo + successivo se non trovato, ecc. + step 3 : download del nuovo software, nell'esempio il tarball + `util-linux-2.12b.tar.bz2'. + + In particolare, affinchรจ lo step `3' abbia successo, รจ necessario che nello + specfile sia specificata una URL completo e valida alla voce `Source' o + `Source0'. + + Naturalmente รจ possibile eseguire solo alcuni degli step precedenti, + utilizzando l'opzione `-a' in modo opportuno. + + Segnaliamo in particolare l'opzione `-f' che forza l'autoformattazione dello + specfile secondo lo standard QiLinux. Si noti che viene creata una copia di + backup del precedente specfile, in caso si voglia o debba procedere ad un suo + ripristino. + + Se si ha un account in scrittura nel repository `devel' o `devel-contrib' o + un repository personale (come nel caso dei contributor in openmamba) รจ + possibile infine effettuare l'upload con il comando + + autospec -u -a10 util-linux 2.12b + + E' anche possibile utilizzare l'opzione `--server-upload' per indicare ad + autospec quale server utilizzare durante l'upload del pacchetti rpm e srpm. + Il parametro intero che questo comando richiede รจ l'indice del server nel + vettore `ftp_rw_server' (vedi file di configurazione). + + Nota: Si noti che il comportamento predefinito di autospec prevede la + rimozione automatica dei vecchi pacchetti dal repository ftp dopo avere + effettuato l'upload delle nuove versioni. + Se tuttavia i precedenti pacchetti sono stati trovati in + + `ftpurl_ro_srpms[n]' e `ftpurl_ro_rpms[n]' + + e se la variabile `ftpdir_rw_old[n]' รจ stata configurata con un valore + non vuoto (cioรจ non ""), invece della rimozione autospec effettuerร  il backup + dei pacchetti, utilizzando come directory radice il valore indicato in + `ftpdir_rw_old[n]'. Ad esempio se i pacchetti sono stati trovati in + + ftpurl_ro_srpms[0]="ftp://ftp.qilinux.it/pub/QiLinux/devel/SRPMS" + + e se sono state inizializzate in ~/.autospec le variabili seguenti + + ftp_rw_server[0]="ftp.qilinux.it" + ftpdir_rw_old[0]="/devel/old" + + verrร  effettuerร  il backup dei pacchetti sul server `ftp.qilinux.it' + nella directory /devel/old/_ + + + 4. Convenzioni relative agli specfile di QiLinux e openmamba + + Vengono qui elencate alcune convenzioni utilizzate negli specfile QiLinux e + openmamba che puntano ad ottenere principalmente una uniformitร  e facile + leggibilitร  degli stessi. + + 1. I file indicati in `Source', `Source0', `Source1', ..., che si + riferiscono a risorse internet (file presenti su server ftp o http) + devono avere indicata l'URL completa. Questo per permettere il loro + download automatico al tool `autospec' ed in generale l'immediata + reperibilitร  + 2. I nomi delle patch dovrebbero avere la seguente struttura: + + %{name}--.patch + + dove '' indica il numero di versione del software in cui la + patch รจ stata per la prima volta applicata, e `' indica + una stringa esplicativa dello scopo della patch. + + es. %{name}-20040813-winelauncher.patch (wine-20040813) + + %{name}-2.0-gcc34.patch (libfaad2-2.0) + + %{name}-3.00-freetype2.patch (xpdf-3.00) + %{name}-2.03-fonts.patch + %{name}-3.00-xpdfrc.patch + %{name}-3.00-can-2004-0888.patch + + Si noti un particolare l'ultima patch che si riferisce ad un fix di + sicurezza ed in cui รจ utilizzato come descrizione l'ID del progetto + Common Vulnerabilities and Exposures (CVE). + + 3. In caso di piรน patch puรฒ essere utile inserire una breve descrizione + delle stesse nel blocco `%prep', se possibile + + es. %patch0 -p1 -b .freetype2 (xpdf-3.00) + %patch1 -p1 -b .fonts + %patch2 -p1 -b .xpdfrc + %patch3 -p1 -b .can-2004-0888 + + 4. Nel preambolo dello specfile รจ necessario inserire tutti i + `BuildRequires' relativi ai pacchetti di sviluppo (devel) richiesti + durante il processo di compilazione. Per far questo occorre + controllare in modo molto attento l'output generato dallo script + `configure', se utilizzato, e la documentazione fornita con il sorgente + (generalmente i file REAME e/o REQUIREMENTS o simili). + Questo permette la ricompilazione dei pacchetti source rpm su computer + diversi da quelli su cui sono stati creati senza problemi e senza + perdita di feature (in molti casi infatti, i check falliti dello script + configure comportano la disabilitazione di feature altrimenti + supportate dal software che si desidera ricompilare). + + Nota: questa pratica puรฒ significare la necessitร  di dover creare anche + molti pacchetti supplementari, richiesti dal software principale che si + desidera compilare per inserirlo nella distribuzione. E' bene infatti + che il software abbia attive il maggior numero di feature, in modo da + permettere il suo utilizzo pi generale possibile da parte di un utente + generico. + + Nota: Se รจ installato il pacchetto `sudo' con una configurazione in cui + siano presenti le seguenti righe (file `/etc/sudoers') + + # Cmnd alias specification + Cmnd_Alias DISTO_CMD = /usr/bin/apt-get, /bin/rpm + + %packager ALL = NOPASSWD: DISTO_CMD + + autospec sar๏ฟฝin grado di installare automaticamente i build requiremnts + indicati nello specfile. + + 5. I pacchetti devel devono generalmente avere la voce + `Requires: %{name} = %{version}' + + es. %package devel + Summary: Static libraries and headers for %{name} + Group: Development/Libraries + Requires: %{name} = %{version} + + 6. Utilizzare quando possibile le seguenti macro rpm + + %configure + %make + %makeinstall -oppure- %makeoldinstall + + in luogo rispettivamente di + + ./configure \ + --prefix %{_prefix} \ + --infodir %{_infodir} \ (se presente documentazione info) + --mandir %{_mandir} (se presente documentazione man) + ... + + make %{?_smp_mflags} + + make install DESTDIR=%{buildroot} + + make install \ + prefix=%{buildroot}%{_prefix} \ + exec_prefix=%{buildroot}%{_exec_prefix} \ + bindir=%{buildroot}%{_bindir} \ + ... + + Nota1: autospec v0.4.10 e successive versioni utilizzano queste macro + durante la creazione automatica degli specfile. + + Nota2: se occorresse utilizzare il compilatore gcc-3.3.x invece di + quello corrente (4.x), รจ possibile utilizzare in QiLinux e openmamba le + macro `%configure33' e `%make33'. + + Altre macro rpm disponibili sono + + %install_info + %uninstall_info + + Occorre utilizzarle quando nel pacchetto sono presenti pagine info. + Ad esempio (pacchetto `coreutils') + + %post + %install_info coreutils.info + + %preun + %uninstall_info coreutils.info + exit 0 + + Ed infine: + + %find_lang + + da utilizzarsi se il pacchetto supporta l'internazionalizzazione via + `gettext' (file /usr/share/locale/*/LC_MESSAGES/*.mo). + Ad esempio (pacchetto `tar') + + %install + [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + %makeinstall + ... + %find_lang %{name} + + %files -f %{name}.lang + %defattr(-,root,root) + /bin/tar + ... + + Si noti come l'argomento `%{name}' della macro `%find_lang' vada + sostituito dal nome effettivo dei file *.mo creati, in quei rari casi + in cui tali file hanno un nome diverso da `%{name}'. + Ad esempio (pacchetti libgtk-2.6.x) + + %find_lang gtk20 + ... + %files -f gtk20.lang + ... + + Nota: E' necessario utilizzare rpm versione 4.0.4-22qilnx o successive + per potere utilizzare le macro rpm qui descritte. + + 7. Se si sta creando un pacchetto per modulo perl, sono disponibili + le macro rpm `%perl_sitearch' e `%perl_archlib'. + Il valore di tali variabili si puรฒ ottenere con il comando + `rpm --eval='. + Ad esempio: + + $ rpm --eval=%perl_archlib + /usr/lib/perl5/5.8.8/i386-linux-thread-multi + + Se si sta creando un pacchetto python รจ possibile utilizzare la + macro `%python_version' + + $ rpm --eval=%python_version + 2.3 + + 8. Per motivi di sicurezza รจ opportuno inserire nei blocchi `%prep' e + `%clear' il comando + + [ "%buildroot" != / ] && rm -rf "%buildroot" + + in luogo dell'istruzione `rm -rf "%buildroot"' o simili. + Questa pratica previente spiacevoli situazioni nel caso in cui i + pacchetti vengano creati dall'utente root (pratica comunque + **assolutamente sconsigliata**) e la variabile `%buildroot' sia + settata in modo errato. + + 9. Quando si elencano i file contenuto nei vari sottopacchetti, + utilizzare le variabili rpm, se non i nomi delle directory. + Ad esempio, utilizzare `%{_bindir}' in luogo di `/usr/bin', + `%{sbindir}' invece di `/usr/sbin'. + + Per sapere quali sono le variabili rpm disponibili, utilizzare il + comando + + rpm --showrc + + 10. Le entry del blocco '%changelog' devono rispettare la struttura + indicata dal seguente esempio: + + %changelog + * Thu Aug 26 2004 Davide Madrisan 20040813-1qilnx + - udpate to 20040813 + + In particolare deve cioรจ essere presente il nome e l'indirizzo + mail del packager, seguito dalla versione corrente del pacchetto. + + Nota importante: della maggior parte delle convenzioni indicate nei + punti precedenti si occupa 'autospec' in modo automatico. + + + 5. Come contribuire allo sviluppo di autospec + + Autospec รจ un tool in fase di sviluppo e seppur testato lungamente potrete + imbatterervi in bachi oppure trovare che alcune feature che voi reputate + utili siano mancanti. + E' possibile inviare sia bugreport che commenti e suggerimenti per + migliorare autospec al seguente indirizzo + + + + I bug report devono essere dettagliati (versione di autospec, comando + eseguito, file di configurazione se necessario, URL del software, se il + problema riscontrato riguarda la creazione di uno specfile, il suo + aggiornamento, ecc.), in modo da permettere la riproducibilitร  del problema. + Si veda anche il file BUGS contenente un elenco dei bachi noti e feature da + implementare. + + Sono naturalmente ben accette anche le patch. + + Per il debugging di un problema potrebbe essere utile utilizzare l'opzione + `--debug' di autospec. + + Se si desidera infine contribuire allo sviluppo diretto del tool autospec, + inviare una mail all'indirizzo indicato sopra. + + + 6. Traduzioni + + . English diff --git a/autospec.conf.in b/autospec.conf.in new file mode 100644 index 0000000..3a0ca94 --- /dev/null +++ b/autospec.conf.in @@ -0,0 +1,561 @@ +# [main configuration file for `@package@'] +# SECURITY WARNING: if `ftp_rw_user[*]' and `ftp_rw_passwd[*]' are set, +# this file should be only readable by the `$packager_group' group, if any +# +# *** DO NOT EDIT THIS FILE *** +# *** It will be overwritten at the next update *** +# +# Create a configuration file (.autospec) in your home directory instead, +# like this one (please customize all the values) +# +# proxy="proxyhost:8080" +# proxy_user="user:password" +# packager_fullname="Your Name" +# packager_email="email@domain" +# ftp_rw_user[1]="user" +# ftp_rw_passwd[1]="passwd" +# arch_list=(i686 ppc) +# rpm_download_and_install="sudo apt-get --quiet --yes install" +# rpm_install="sudo rpm -hUv" +# rpm_install_force="sudo rpm -hUv --force --nodeps" +# curl_opts_netlink="--connect-timeout 15 --retry 3 --limit-rate 250k" + +# Name of the distribution (i.e. "openmamba") +DISTRO="openmamba" +# RPM distribution id (i.e. "mamba" --> pck-1.0-1mamba.i586.rpm) +DISTRO_rpm="mamba" +# Vendor name (i.e. "openmamba") +VENDOR="openmamba" + +# Packager full name and email address (used in the Changelog) +packager_fullname= +packager_email= +# System group name for RPM packagers +packager_group="packager" + +#------------------------------------------------------------------------------ + +# Aliases for server numbers (repositories) +ftp_alias[0]="" +ftp_alias[1]="contrib" + +# Enable/Disable switch for repositories (enable by default when unset) +ftp_enable[0]=1 +ftp_enable[1]=1 + +# FTP path of RPMS packages (i.e. "ftp://ftp.qilinux.it/pub/QiLinux/devel/RPMS") +# note: you can specify multiple choices: ftpurl_ro_rpms[0] .. ftpurl_ro_rpms[n] +ftpurl_ro_rpms[0]="http://www.openmamba.org/pub/openmamba/devel/RPMS.@arch@" +ftpurl_ro_rpms[1]="http://www.openmamba.org/pub/openmamba/devel-contrib/RPMS.@arch@" + +# FTP path of SRPMS packages (i.e. "ftp://ftp.qilinux.it/pub/QiLinux/devel/SRPMS") +# note: you can specify multiple choices: ftpurl_ro_srpms[0] .. ftpurl_ro_srpms[n] +ftpurl_ro_srpms[0]="http://www.openmamba.org/pub/openmamba/devel/SRPMS.base" +ftpurl_ro_srpms[1]="http://www.openmamba.org/pub/openmamba/devel-contrib/SRPMS.base" + +# FTP setup data needed when uploading RPMS and SRPMS packages +# - ftp_rw_server : name of the ftp server where package will be uploaded +# (i.e. "ftpcontrib.qilinux.it" or "ftp.qilinux.it") +# - ftp_rw_user : username to gain write access to ftp server, if any +# - ftp_rw_passwd : password to gain write access to ftp server, if any +# - ftp_rw_port : ftp port (set if a non standard ftp port is used) +# - ftp_rw_passive_mode : passive mode (can be "on" or "off" (the default)) +# - ftp_rw_rpms_dir : ftp path where RPMS packages will be uploaded +# (i.e. "/RPMS", "/devel-contrib/RPMS") +# - ftp_rw_srpms_dir : ftp path where SRPMS packages will be uploaded +# (i.e. "/SRPMS", "/devel-contrib/RPMS") +# +# WARNING: the entries MUST respect the order used in `ftpurl_ro_rpms' +ftp_rw_server[0]= +ftp_rw_port[0]= +ftp_rw_passive_mode[0]= +ftp_rw_user[0]= +ftp_rw_passwd[0]= +ftp_rw_rpms_dir[0]= +ftp_rw_srpms_dir[0]= + +ftp_rw_server[1]="ftp://ftpaccounts.openmamba.org" +ftp_rw_port[1]= +ftp_rw_passive_mode[1]=on +ftp_rw_user[1]="devel-contrib" +ftp_rw_passwd[1]="" +ftp_rw_rpms_dir[1]="/RPMS.@arch@" +ftp_rw_srpms_dir[1]="/SRPMS.base" + +# if no old version of the packages are found in the repositories +# `ftpurl_ro_srpms', use this one as default repository +# (its value is the index of `ftp_rw_server', default: `1') +ftp_rw_server_num_default=1 + +# FTP directories where old packages will be moved for backup +# (i.e. "/devel/old", "") +# IMPORTANT: SAME SIZE and ORDER as `ftp_rw_rpms_dir[]' +ftpdir_rw_old[0]="" +ftpdir_rw_old[1]="" + +# list of all supported architectures (note: 'noarch' is *not* a valid arch) +arch_list[0]="i586 ppc arm x86_64" +arch_list[1]="i586" + +# where to upload noarch packages +# (should be "noarch" to upload them only to the noarch subtree, or +# "${arch_list[n]}" to upload them to all the architecture subtrees +# defined for the branch +arch_noarch_upload[0]="${arch_list[0]}" +arch_noarch_upload[1]="${arch_list[1]}" + +#------------------------------------------------------------------------------ + +# Options used by curl while dowloading source files +# (default: "--connect-timeout 15 --retry 3") +# If you'd like your transfer not use your entire bandwidth you can use the +# `--limit-rate' option (for instance `--limit-rate 250k') +curl_opts_netlink="--connect-timeout 15 --retry 3" +# (default: "-L --remote-name --fail --progress-bar $curl_opts_netlink") +curl_options="-R -L --remote-name --fail --progress-bar $curl_opts_netlink" +# Sintax for 'proxy': "proxyhost:port" +proxy="" +# Sintax for 'proxy_user': "user:password" +proxy_user="" + +# Commands to run when a rpm package must be automatically installed +# (NOTE: it could be necessary to manually configure sudo +# here an example (works for QiLinux and openmamba): +# Cmnd_Alias DISTRO_CMD = /usr/bin/apt-get, /bin/rpm +# %packager ALL = NOPASSWD: DISTRO_CMD +# (of course your user must belong to the `packager' group) +# Examples: +# apt : rpm_download_and_install="sudo apt-get --quiet --yes install" +# smart: rpm_download_and_install="sudo smart install --yes" +rpm_download_and_install="sudo smart install --yes" +rpm_install="sudo rpm -hUv" +rpm_install_force="sudo rpm -hUv --force --nodeps" + +# Never install packages matching this regular expression +# - default value='' (can be for instance '-apidocs-') +rpm_install_noinstall_mask='' + +# Mask that identify packages providing localization... +# - default value='-i18n-|-help-' +rpm_install_l10n_pck_mask='-i18n-|-help-' +# ...and only install localization packages matching this regular expression +# - default value='.*' (can be for instance 'it|pl') +rpm_install_l10n_pck_allow_lang_mask='.*' + +# Options passed to rpm when installing a source rpm (srpm) +# - default value='--nodeps' +srpm_install_options='--nodeps' + +# Path of the some tools commonly used in the specfiles +path_ldconfig="/sbin/ldconfig" +path_installinfo="/sbin/install-info" + +#------------------------------------------------------------------------------ + +# Default values for some strings used in the plugins +# - default value for `Summary id' +summary_defvalue="... package summary" +# - default value for `Group id' +group_defvalue="... package group" +# - default value for `URL id' +url_defvalue="... package URL" +# - default value for `License id' +license_defvalue="... package license" +# - default value for `%description' +description_defval="... package description" +# - default value for `%description devel' +description_devel_defval="... devel package description" +# - default value for `%changelog' +changelog_samever_defvalue="... add a changelog entry" +# - default value for `%changelog' when updating a package to the same version +changelog_rebuild_defvalue="rebuilt" +changelog_userdef="" + +# Allowed paths for system libraries +allowed_libdirs="\ +/lib:/usr/lib:/usr/lib/qt3/lib:/usr/lib/qt4/lib:/opt/kde3/lib:/opt/kde4/lib" + +# Some specfile groups and summary entries +library_group="System/Libraries" +library_summary="Static libraries and headers for %{name}" +library_group_devel="Development/Libraries" +library_group_perl="System/Libraries/Perl" +python_modules_group="System/Libraries/Python" + +# Paths used in the autogenerated specfiles +#python_install_lib_path="%{_libdir}/site-python" +python_install_lib_path="%{python_sitearch}" + +# File extensions for compressed man/info pages (`/usr/lib/rpm/brp-compress') +man_compress_ext=".gz" +info_compress_ext=$man_compress_ext + +# Set to modify the way man pages in the autogenerated specfile are written +# "0" : all the entries (this is the default) +# "1" : one entry for each man page section +# "2" : only one entry for all the man pages +man_condensed_list=0 +# Set to modify the way info pages in the autogenerated specfile are written +# "0" : all the entries (this is the default) +# "2" : only one entry for all the info pages +info_condensed_list=0 + +# Libraries, perl, and python modules names should have a fixed structure? +# Default values are "^lib" for libraries, "^perl-" for perl modules, and +# "^python-" for python modules. If you don't want to fix a structure for +# one of these packages, set the corresponding variable to "" +library_name_structure="^lib" +perl_module_name_structure="^perl-" +#python_module_name_structure="^python-" +python_module_name_structure="" + +# Structure for the names of the patches (Patch[0-9]* ids) +# Default value: "^%\{name\}-[0-9][\.0-9a-z]*-[a-zA-Z0-9_-]+*.patch[\.gzb2]*", +# that is '%{name}-pck_version_when_first_applied-short_description.patch' +# If you don't want to fix a structure use "" +patch_name_structure="^%\{name\}-[0-9][\.0-9a-z]*-[a-zA-Z0-9_-]+*.patch[\.gzb2]*" + +# Structure for the 'Source'/'Source0' id +# Default value: "\(http\|ftp\):\/\/.*\.\(tar\.gz\|tgz\|tar\.bz2\|tar\.Z\|shar\.gz\|zip\)" +# that is a full internet address of a tarball package compressed with +# either gzip or bzip2 +# If you don't want to fix a structure use "" +source0_name_structure="\(http\|ftp\):\/\/.*\.\(tar\.gz\|tgz\|tar\.bz2\|tar\.Z\|shar\.gz\|zip\)" + +# RPM macros for common packaging actions +rpm_macro_configure="%configure" +rpm_macro_makeinstall="%makeinstall" +# NOTE: the `make' and `makeoldinstall' are not standard rpm macros +# if are unsupported in the rpm tool you're using, you may use these settings: +# - rpm_macro_make="" +# - rpm_macro_makeoldinstall="%makeinstall" +rpm_macro_make="%make" +rpm_macro_makeoldinstall="%makeoldinstall" +# A (non standard) macro for perl modules (unset if not used) +rpm_macro_makeinstall_perl="%makeinstall_perl" + +# RPM macros used to install and remove info pages +rpm_macro_installinfo="%install_info" +rpm_macro_uninstallinfo="%uninstall_info" +rpm_macro_installinfo_binary="%{__install_info}" + +# RPM macros for cmake +# Default value: "%cmake -d build" (out-of-source builds) +# NOTE (in-source builds) +# rpm_macro_cmake="%cmake" +# rpm_macro_makeinstall_cmake="%makeinstall" +rpm_macro_cmake="%cmake -d build" +rpm_macro_makeinstall_cmake="%makeinstall -C build" + +# RPM macros miscellaneous +# - rpm_macro_pyver: python version number +rpm_macro_pyver="%python_version" + +# allowed groups +rpm_allowed_groups=( +Applications/Accessibility +Applications/Archiving +Applications/Communication +Applications/Databases +Applications/Development +Applications/Educational +Applications/Emulators +Applications/File +Applications/Fonts +Applications/Games +Applications/Graphics +Applications/Mathematics +Applications/Multimedia +Applications/Networking +Applications/Publishing +Applications/Scientific +Applications/Security +Applications/Shells +Applications/Spelling\ Checker +Applications/Text +Applications/Web +Development/Applications +Development/Bindings +Development/Debug +Development/Kernel +Development/Languages +Development/Libraries +Development/Libraries/Java +Development/Libraries/Perl +Development/Libraries/Python +Development/Tools +Documentation +Graphical\ Desktop/Applications/Accessibility +Graphical\ Desktop/Applications/Administration +Graphical\ Desktop/Applications/Archiving +Graphical\ Desktop/Applications/Configuration +Graphical\ Desktop/Applications/Databases +Graphical\ Desktop/Applications/Development +Graphical\ Desktop/Applications/Educational +Graphical\ Desktop/Applications/Environment +Graphical\ Desktop/Applications/Games +Graphical\ Desktop/Applications/Graphics +Graphical\ Desktop/Applications/Internet +Graphical\ Desktop/Applications/Multimedia +Graphical\ Desktop/Applications/Networking +Graphical\ Desktop/Applications/Office +Graphical\ Desktop/Applications/Other +Graphical\ Desktop/Applications/Publishing +Graphical\ Desktop/Applications/Scientific +Graphical\ Desktop/Applications/Security +Graphical\ Desktop/Applications/Utilities +Graphical\ Desktop/Fonts +Graphical\ Desktop/Libraries/GNOME +Graphical\ Desktop/Libraries/QT +Graphical\ Desktop/Libraries/KDE +Graphical\ Desktop/Look\ \'n\'\ feel +Graphical\ Desktop/Look\ \'n\'\ feel/Themes +Graphical\ Desktop/Look\ \'n\'\ feel/Screensavers +Installation/Update +Network/File\ Transfer +Network/File\ Systems +Network/High Availability +Network/Libraries +Network/Monitoring +Network/Routing +Network/Security +System/Benchmarks +System/Clustering +System/Configuration +System/Database +System/Kernel\ and\ Hardware +System/Kernel\ and\ Hardware/Drivers +System/Fonts +System/Hardware +System/Internationalization +System/Libraries +System/Libraries/Java +System/Libraries/Perl +System/Libraries/PHP +System/Libraries/Python +System/Management +System/Multimedia +System/Servers +System/Spooling +System/Telephony +System/Tools +System/X11) + +# approved licenses +rpm_approved_licenses=( +Academic\ Free\ License\ 3.0 +Adaptive\ Public\ License +Affero\ GNU\ Public\ License +Apache\ License +Apache\ License\ 2.0 +Apple\ Public\ Source\ License +Artistic +Attribution\ Assurance\ Licenses +Boost\ Software\ License +BSD +Common\ Development\ and\ Distribution\ License +Common\ Public\ Attribution\ License\ 1.0 +Computer\ Associates\ Trusted\ Open\ Source\ License\ 1.1 +Copyright\ only +CUA\ Office\ Public\ License\ 1.0 +Eclipse\ Public\ License +Educational\ Community\ License +Eiffel\ Forum\ License\ 2.0 +Entessa\ Public\ License +EU\ Datagrid\ Software\ License +European\ Union\ Public\ License +Fair\ License +Frameworx\ License +GPL +Historical\ Permission\ Notice\ and\ Disclaimer +IBM\ Public\ License +IEEE +IPA\ Font\ License +ISC\ License +LGPL +Lucent\ Public\ License\ 1.02 +Microsoft\ Public\ License +Microsoft\ Reciprocal\ License +MirOS Licence +MIT +Motosoto\ License +MPL\ 1.1 +NASA\ Open\ Source\ Agreement\ 1.3 +Naumen\ Public\ License +Nethack\ License +Nokia\ Open\ Source\ License +Non-Profit\ Open\ Software\ License\ 3.0 +NTP\ License +OCLC\ Research\ Public\ License\ 2.0 +Open\ Font\ License\ 1.1 +Open\ Group\ Test\ Suite\ License +Open\ Software\ License\ 3.0 +PHP\ License +Python +Python\ Software\ Foundation\ License +QPL +RealNetworks\ Public\ Source\ License\ 1.0 +Reciprocal\ Public\ License\ 1.5 +Ricoh\ Source\ Code\ Public\ License +Simple\ Public\ License\ 2.0 +Sleepycat\ License +Sun\ Public\ License +Sybase\ Open\ Watcom\ Public\ License\ 1.0 +University\ of\ Illinois/NCSA\ Open\ Source\ License +Vovida\ Software\ License\ 1.0 +W3C\ License +wxWindows\ Library\ License +X.Net\ License +zlib/libpng +Zope\ Public\ License +OSI\ Approved +no\ OSI\ Approved +) + +#------------------------------------------------------------------------------ +# APSE arrays +apse_site_name[0]="http://fileforum.betanews.com" +apse_uri[0]="http://fileforum.betanews.com/search?search_advanced=Search+FileForum&os%5B%5D=12&alphabeta=R&title=" +apse_put_fields[0]="" +apse_error_msg[0]="No results found\. Please try another search\." +apse_grep[0]="" +apse_sed[0]="s,.*1. \${search_name}[^<]*[ ]\([^ <]*\).*,\1,pi" + +apse_site_name[1]="http://linux.softpedia.com" +apse_uri[1]="http://linux.softpedia.com/progSearch" +apse_put_fields[1]="src=" +apse_error_msg[1]="No results found" +apse_grep[1]="\([^ <]*\).*,\1,pi" + +apse_site_name[4]="http://sourcewell.berlios.de" +apse_uri[4]="http://sourcewell.berlios.de/appsearch.php?by=Importance&search=" +apse_put_fields[4]="" +apse_error_msg[4]="No Application found" +apse_grep[4]="appbyid.*\${search_name}[^a-zA-Z].*Stable" +apse_sed[4]="s,.*\${search_name} \([^ <]*\).*,\1,pi" + +apse_site_name[5]="http://distrowatch.com" +apse_uri[5]="http://distrowatch.com/packages.php?" +apse_put_fields[5]="" +apse_error_msg[5]="is currently being redesigned" +apse_grep[5]="td.*/\${search_name}[-_][0-9]" +apse_sed[5]="s,.*td><[^>]*>\([^ <]*\)<.*,\1,pi" + +#------------------------------------------------------------------------------ + +# mode to be used when creating and updating the specfiles +rpm_specfile_mode="644" + +# macro used to automatically build debug packages +rpm_macro_debug_package="%debug_package" +rpm_macro_debug_package_suffix="debug" + +rpm_default_buildroot="%{_tmppath}/%{name}-%{version}-root" + +# Set these variables to modify the autoformatting behaviour +# - width of the `%description blocks' +# (default: 0 (unlimited line length); was `80') +format_description_width=0 +# - tab size for the entries in the specfile preamble (default: 14) +format_preamble_tab=14 +# format_buildroot, format_builddir: leave blank to disable any substitutions +format_buildroot="%{buildroot}" +format_builddir="%{_builddir}" +# Use the rpm variable names for common Unix tools (default is: 0) +# i.e. %{_make}, %{__rm}, %{__ln_s}, %{__mkdir_p}, ... +format_unix_tools=0 +# Extra-formatting rules (distro-specific) +format_extra_rules="\ +s,\(%{_mandir}/.*man[0-9]/.*\.\)[0-8]$man_compress_ext.*,\1\*, +s,\(/usr/share/man/.*man[0-9]/.*\.\)[0-8]$man_compress_ext.*,\1\*, +s,\(%{_infodir}/.*\.\)info$man_compress_ext.*,\1\*, +s,\(/usr/share/info/.*\.\)info$man_compress_ext.*,\1\*, +s,\$RPM_BUILD_ROOT,%{buildroot},g +s,%perl_major_ver,%{perl_major_ver},g +s,%buildroot,%{buildroot},g;s,#%{buildroot}},#%buildroot},g +s,\&\& rm -rf %{buildroot},\&\& rm -rf \"%{buildroot}\", +s,test x\"%{buildroot}\" != x/,[ \"%{buildroot}\" != / ], +s,[\[]* [\"]*%{buildroot}[\"]* []]* && rm -.*,\ +[ \"%{buildroot}\" != / ] \&\& rm -rf \"%{buildroot}\", +s,echo \"%doc \(\${dir#%.*\),echo \"%dir \1, +s,make[ \t]*%[{]*[?]*_smp_mflags[}]*,%make, +s,^[ \t]*\([%]*make\)[ \t]*pure_install[ \t]*$,%makeinstall_perl, +s,^perl Makefile.PL$,perl Makefile.PL PREFIX=%{_prefix} INSTALLDIRS=vendor, +s,\[\[ -z \"\$packlist\" \]\],\[ -z \"\$packlist\" \]," +# The standard values for the `BuildRoot' id +format_buildroot_value="%{_tmppath}/%{name}-%{version}-root" +# Enable autoformatting (disabled by default) +format_autoformat=0 + +# set this variable to '1' if rpm ignores the BuildRoot tag of a specfile +rpm_ignores_buildroot=1 + +#------------------------------------------------------------------------------ + +# Name of the PERL script used to generate the Makefile in perl packages +# (default is "Makefile.PL", but at least one package uses "BUILD.PL") +perl_Makefile_generator="Makefile.PL" + +# Default License for perl packages +# (default is "", but can be normally set to "Artistic") +perl_License_default="" + +#------------------------------------------------------------------------------ + +# Number of old SPEC files to keep as backup copies (history of modifications) +spec_backup_numbers=5 +# Filename extension appended to backup copies ('old' by default) +spec_backup_extension="old" +# Create "hidden" (default) or "visible" backup copies +spec_backup_attr="hidden" + +# Output with ascii colors (enabled by default) +# Default colors are: +# CRIT="${ESC}[1;31m" (red) +# NOTE="${ESC}[1;33m" (yellow) +# WARN="${ESC}[1;31m" +# EXIT="${ESC}[1;31m" +colorize=1 + +# Logging directory (default is /var/tmp/@package@) +logging_dir="/var/tmp/@package@" + +#------------------------------------------------------------------------------ + +# List of plugins +plugindir=@plugindir@ +plugin_pck_update="$plugindir/pck-update" +plugin_spec_create="$plugindir/spec-create" +plugin_pck_extract="$plugindir/pck-extract" +plugin_config_getvar="$plugindir/config-getvar" + +# List of templates +templatedir="@templatedir@" + +# List of tests +testdir="@testdir@" + +#------------------------------------------------------------------------------ + +# Directories used by the rpm tool to read and save files to +srpms_dir="`rpm --eval %_srcrpmdir 2>/dev/null`" +rpms_dir="`rpm --eval %_rpmdir 2>/dev/null`" +spec_dir="`rpm --eval %_specdir 2>/dev/null`" +source_dir="`rpm --eval %_sourcedir 2>/dev/null`" +build_dir="`rpm --eval %_builddir 2>/dev/null`" +tmppath_dir="`rpm --eval %_tmppath 2>/dev/null`" diff --git a/autospec.in b/autospec.in new file mode 100644 index 0000000..f76eeb5 --- /dev/null +++ b/autospec.in @@ -0,0 +1,170 @@ +#!/bin/bash +# _\|/_ +# (o o) +# +----oOO-{_}-OOo-----------------------------------------------------------+ +# | | +# | $0 -- help creating rpm specfiles and automatically update rpm packages | +# | Copyright (C) 2004-2011 Davide Madrisan | +# | | +# | This program is free software; you can redistribute it and/or modify it | +# | under the terms of the GNU General Public License version 2 as published | +# | by the Free Software Foundation. There is NO warranty; not even for | +# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | +# | | +# | Report bugs to | +# | | +# +--------------------------------------------------------------------------+ + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + { echo $"this script requires bash version 2 or better" >&2 && exit 1; } + +me=(${0##*/} "@version@" "@date@") + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="@package@_fe"; export TEXTDOMAIN + +# default values +let "pck_update = 0" +let "pck_extract = 0" +let "spec_create = 0" +let "config_getvar = 0" +let "print_help = 0" +let "print_version = 0" + +function autospec.version() { + echo "\ +${me[0]} ${me[1]} +Copyright (C) 2004-2011 Davide Madrisan " +} + +function autospec.copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function autospec.usage() { + # $1: optional exit code (default is '1') + autospec.version + echo " +"$"Automatically update rpm packages and help creating new specfiles."" + +"$"Operation modes"": + -u, --update "$"Update the given package to a specified version and release"" + -s, --source "$"Try to create a specfile for the specified tarball"" + -x, --extract "$"Extract a given file or list of files from a srpm archive"" + --eval "$"Print the value of the given configuration variable"" + -h, --help "$"Print this help, then exit"" + -V, --version "$"Print version number, then exit"" + -q, --quiet "$"Run in quiet mode"" + -r, --colorize "$"Enable the colorized output"" + -D, --debug "$"Run in debugging mode (very verbose output)"" + +"$"Usage"": + "$"Use '-u -h', '-s -h', '-x -h', and '--eval -h' to display specific command line options."" + +"$"Report bugs to ." + + exit ${1:-1} +} + +[ $# -eq 0 ] && autospec.usage + +# load the warning/error/debug/ message handling library +# to define the 'notify()' function + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } + +. @libdir@/libmsgmng.lib +notify.disable_colors + +# load the configuration file(s) +[ -r @libdir@/libcfg.lib ] || + { echo "$me: "$"library not found"": @libdir@/libcfg.lib" 1>&2 + exit 1; } + +. @libdir@/libcfg.lib + +for arg in $@; do + case $arg in + -u|--update) + let "pck_update = 1" ;; + -s|--source) + let "spec_create = 1" ;; + -x|--extract) + let "pck_extract = 1" ;; + --eval|--eval=*) + let "config_getvar = 1" ;; + -D|--debug) + let "verbose = 2" ;; + -q|--quiet) + let "verbose = 0" ;; + -r|--colorize) + let "colorize = 1" ;; + -h|--help) + let "print_help = 1" ;; + -V|--version) + let "print_version = 1" ;; + *) ;; + esac +done + +case "$(( $pck_update + $spec_create + $pck_extract + $config_getvar ))" in + 0) [ "$print_help" = "1" ] && autospec.usage 0 + if [ "$print_version" = "1" ]; then + # only print the version number in quiet mode + [ "$verbose" = 0 ] && { echo "${me[1]}"; exit 0; } + autospec.version; + autospec.copying + exit 0; + fi + autospec.usage 1 ;; + 1) ;; + *) autospec.usage 1 ;; +esac + +[ "$logging" = "1" ] && let "colorize = 0" +[ "$colorize" = "1" ] && notify.enable_colors + +notify.debug "[${me[0]}, "$"version"" ${me[1]}]" + +# checking for errors in the configuration file +[ "$config_getvar" = 1 ] || config.integrity + +# load and execute the required plugin... + +[ "$config_getvar" = 1 ] && plugin_to_run="$plugin_config_getvar" +[ "$pck_extract" = 1 ] && plugin_to_run="$plugin_pck_extract" +[ "$spec_create" = 1 ] && plugin_to_run="$plugin_spec_create" +[ "$pck_update" = 1 ] && plugin_to_run="$plugin_pck_update" + +[ -n "$plugin_to_run" ] || + notify.error "\`$plugin_to_run': "$"unset in the configuration files" +[ -x "$plugin_to_run" ] || + notify.error $"plugin not found"": \`$plugin_to_run'" + +tmpargfile=$(mktemp -q -t $me.XXXXXXXX) +[ $? -eq 0 ] || notify.error $"can't create temporary files" +notify.debug "tmpargfile = \`${NOTE}$tmpargfile${NORM}'" + +# workaround to bypass the issues related to bash expansion in multi-word +# strings (ex: autospec -u s.spec -a4 1.0 --changelog "here's the problem") +echo -n "set -- " > $tmpargfile +while [ $# -gt 0 ]; do + echo -n "\"$1\" " >> $tmpargfile + shift +done +echo >> $tmpargfile + +notify.debug "\ +running: \`$plugin_to_run --autospec-args-file=$tmpargfile'" +$plugin_to_run --autospec-args-file=$tmpargfile + +exit $? diff --git a/autospec.spec.in b/autospec.spec.in new file mode 100644 index 0000000..09fa5bb --- /dev/null +++ b/autospec.spec.in @@ -0,0 +1,568 @@ +# please customize this directive (or use root if your distro does not have +# such a group) +%define packager_group packager + +Name: autospec +Version: @version@ +Release: @release@ +Summary: Create specfiles and automatically update/check/fix rpm packages +Summary(it): Crea specfile ed aggiorna/controlla/corregge in modo automatico pacchetti rpm +Group: Development/Tools +Vendor: openmamba +Distribution: openmamba +Packager: Davide Madrisan +URL: http://www.openmamba.org/packages.html +Source: autospec-%{version}.tar.bz2 +Requires(pre): rpm +Requires: cpio, coreutils, curl, findutils, grep, sed +Requires: /bin/mktemp +Requires: /usr/bin/getopt +Requires: /usr/bin/host +Requires: bzip2 +Requires: gzip +Requires: unzip +#Requires: sudo +Requires: ftp +Requires: %{name}-plugins = %{?epoch:%epoch:}%{version}-%{release} +License: GPL +BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +Autospec is a tool for automatically generating specfiles and updating rpm packages. +Install autospec if you are a packager or you just want to build/upgrade rpm packages in an easy and quick way. + +%description -l it +Autospec รจ un tool in grado di generare in modo automatico specfile ed aggiornare pacchetti rpm. +Installa autospec se sei un packager o se vuoi creare/aggiornare pacchetti rpm in modo semplice e rapido. + +%package plugins +Summary: Autospec plugins +Summary(it): Plugin di autospec +Group: Development/Tools +Requires: %{name}-libs = %{?epoch:%epoch:}%{version}-%{release} +Requires: %{name}-tests = %{?epoch:%epoch:}%{version}-%{release} +Requires(pre): rpm + +%description plugins +This package contains the plugins needed for generating specfiles, updating rpm packages, and extracting files from a source rpm package. + +%description -l it plugins +Questo pacchetto contiene i plugin necessari per generare specfile, aggiornare pacchetti rpm, estrarre file da pacchetti source rpm (srpm). + +%package libs +Summary: Autospec libraries +Summary(it): Librerie di autospec +Group: Development/Tools + +%description libs +This package contains the library functions needed by autospec, and their plugins. +They can be used by external tools that manage rpm packages and specfiles. + +%description -l it libs +Questo pacchetto contiene le librerie necessarie al funzionamento di autospec e dei suoi plugin. +Possono anche essere stilizzate da tool esterni che lavorano su rpm e specfile. + +%package tests +Summary: Autospec tests +Summary(it): Test per autospec +Group: Development/Tools + +%description tests +This package contains the tests to check rpm packages for quality and security issues. + +%description -l it tests +Questo pacchetto contiene i test per il controllo di qualitร  e sicurezza dei pacchetti rpm. +Possono anche essere stilizzate da tool esterni che lavorano su rpm e specfile. + +%package tools +Summary: Autospec extra tools +Summary(it): Programmi extra basati su autospec +Group: Development/Tools +Requires: %{name}-libs = %{?epoch:%epoch:}%{version}-%{release} + +%description tools +This package contains some extra tools. + +%description -l it tools +Questo pacchetto contiene alcuni script extra. + +%prep +%setup -q + +%build +make prefix=%{_prefix} + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +make install DESTDIR=%{buildroot} prefix=%{_prefix} + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +%{_bindir}/%{name} +%lang(it) %{_mandir}/it/man1/autospec.* +%lang(it) %{?_localedir:%{_localedir}}%{!?_localedir:%_datadir/locale}/it/LC_MESSAGES/autospec_fe.mo +%doc AUTHORS BUGS ChangeLog COPYING NEWS TODO +%doc autospec-it-HOWTO + +%files plugins +%defattr(-,root,root) +%{_bindir}/config-getvar +%{_bindir}/pck-extract +%{_bindir}/pck-update +%{_bindir}/spec-create-old +%{_bindir}/spec-create +%if %{packager_group} == "root" +%config %attr(644,root,root) %{_sysconfdir}/%{name}.conf +%else +%config %attr(640,root,%{packager_group}) %{_sysconfdir}/%{name}.conf +%endif +%{_datadir}/%{name}/templates/* +%lang(it) %{?_localedir:%{_localedir}}%{!?_localedir:%_datadir/locale}/it/LC_MESSAGES/config-getvar.mo +%lang(it) %{?_localedir:%{_localedir}}%{!?_localedir:%_datadir/locale}/it/LC_MESSAGES/pck-extract.mo +%lang(it) %{?_localedir:%{_localedir}}%{!?_localedir:%_datadir/locale}/it/LC_MESSAGES/pck-update.mo +%lang(it) %{?_localedir:%{_localedir}}%{!?_localedir:%_datadir/locale}/it/LC_MESSAGES/spec-create.mo + +%files libs +%defattr(-,root,root) +%{_datadir}/%{name}/lib/* +%lang(it) %{?_localedir:%{_localedir}}%{!?_localedir:%_datadir/locale}/it/LC_MESSAGES/lib*.mo + +%files tests +%defattr(-,root,root) +%{_datadir}/%{name}/tests +%lang(it) %{?_localedir:%{_localedir}}%{!?_localedir:%_datadir/locale}/it/LC_MESSAGES/test??_*.mo + +%files tools +%defattr(-,root,root) +%{_bindir}/extract-specs +%{_bindir}/autoupdate-* +%{_bindir}/kde4-flist2rpmvars + +%changelog +* @date@ Davide Madrisan @version@-@release@ +- update to @version@ + +* Thu Feb 10 2011 Silvan Calarco 1.7.2-2mamba +- restored requirements for autospec-plugins, autospec-libs and autospec-tests +- removed %dir entry for non empty directories + +* Sat Dec 15 2010 Davide Madrisan 1.7.2-1mamba +- update to 1.7.2 + +* Wed Dec 29 2010 Davide Madrisan 1.7.1-1mamba +- update to 1.7.1 + +* Wed Dec 22 2010 Davide Madrisan 1.7.0-1mamba +- update to 1.7.0 + +* Tue Nov 28 2010 Davide Madrisan 1.6.3-1mamba +- update to 1.6.3 + +* Tue Nov 02 2010 Davide Madrisan 1.6.2-1mamba +- update to 1.6.2 + +* Fri Oct 22 2010 Davide Madrisan 1.6.1-1mamba +- update to 1.6.1 + +* Wed Oct 06 2010 Davide Madrisan 1.6.0-1mamba +- update to 1.6.0 + +* Sat Aug 21 2010 Silvan Calarco 1.5.0-11mamba +- added patch get_default_arch_from_rpm that uses rpm --eval %%{_host_cpu} to find default architecture + +* Mon Aug 16 2010 Silvan Calarco 1.5.0-10mamba +- added noarch_allow_upload_to_given_arch_only-2 patch to fix noarch support also for operations 6,7 and 11 + +* Thu Aug 12 2010 Silvan Calarco 1.5.0-9mamba +- patch noarch_allow_upload_to_given_arch_only: support configuration of @arch@ in arch_no_arch_upload + +* Mon Aug 09 2010 Silvan Calarco 1.5.0-8mamba +- patch replace_obsolete_PreReq: replace obsolete PreReq tags with Requires(pre) or Requires(post) + +* Sun Aug 08 2010 Silvan Calarco 1.5.0-7mamba +- added hidden_spec_old_file patch: create specfile backups as old files (i.e. prefixed by '.') +- patch fix_undefined_SPECFILE_PREPROCESSED: infofile.create bug when specfile_preprocessed already exists + +* Wed Aug 04 2010 Silvan Calarco 1.5.0-6mamba +- added PreReq for rpm also to autospec-plugins package + +* Wed Aug 04 2010 Silvan Calarco 1.5.0-5mamba +- added patch dont_backup_srpm_with_nosrpm_option to make it work better with multiarch uploads + +* Mon Aug 02 2010 Silvan Calarco 1.5.0-4mamba +- added patch: use rpm option --whatprovides to find unidentified requirements + +* Mon Aug 02 2010 Silvan Calarco 1.5.0-3mamba +- added patch to replace apt with smart in default configured application for rpm download and installation + +* Sat Jul 31 2010 Silvan Calarco 1.5.0-2mamba +- added patch install_srpms_with_nodeps for compatibility with rpm5 + +* Mon Jul 19 2010 Davide Madrisan 1.5.0-1mamba +- update to 1.5.0 + +* Thu Jul 01 2010 Silvan Calarco 1.4.17-4mamba +- patch: reduce severity from error to warning if host command fails as happens using qemu-arm environment + +* Thu Jul 01 2010 Silvan Calarco 1.4.17-3mamba +- added fix_get_RPMS_name patch to fix identification of old packages to backup + +* Thu Jun 17 2010 Silvan Calarco 1.4.17-2mamba +- added PreReq for rpm for correct user configuration +- added patches: curl_pass_netlink_opts and rpm-whatprovides-optimize + +* Fri May 14 2010 Davide Madrisan 1.4.17-1mamba +- update to 1.4.17 + +* Thu Apr 15 2010 Davide Madrisan 1.4.16-1mamba +- update to 1.4.16 + +* Wed Mar 24 2010 Davide Madrisan 1.4.15-1mamba +- update to 1.4.15 + +* Sat Mar 13 2010 Davide Madrisan 1.4.14-1mamba +- update to 1.4.14 + +* Wed Feb 17 2010 Davide Madrisan 1.4.13-1mamba +- update to 1.4.13 + +* Wed Feb 17 2010 Davide Madrisan 1.4.12-1mamba +- update to 1.4.12 + +* Tue Jan 12 2010 Davide Madrisan 1.4.11-1mamba +- update to 1.4.11 + +* Thu Jan 10 2010 Davide Madrisan 1.4.10-1mamba +- update to 1.4.10 + +* Fri Oct 23 2009 Davide Madrisan 1.4.9-1mamba +- update to 1.4.9 + +* Wed Oct 14 2009 Davide Madrisan 1.4.8-1mamba +- update to 1.4.8 + +* Sun Jul 05 2009 Davide Madrisan 1.4.7-1mamba +- update to 1.4.7 + +* Sun Apr 19 2009 - Silvan Calarco (1.4.6-3mamba) +- applied a fix to the relocate_RPM_dirs patch + +* Sat Apr 18 2009 - Silvan Calarco (1.4.6-2mamba) +- added relocate_RPM_dirs patch + +* Fri Apr 10 2009 Davide Madrisan 1.4.6-1mamba +- update to 1.4.6 + +* Sun Feb 15 2009 Davide Madrisan 1.4.5-1mamba +- update to 1.4.5 +- add missing %%defattr in 'plugins' subpackage + +* Thu Dec 23 2008 Davide Madrisan 1.4.4-1mamba +- update to 1.4.4 (Christmas Release) + +* Thu Nov 20 2008 Davide Madrisan 1.4.3-1mamba +- update to 1.4.3 + +* Fri Nov 14 2008 Davide Madrisan 1.4.2-1mamba +- update to 1.4.2 + +* Wed Oct 29 2008 Davide Madrisan 1.4.1-1mamba +- update to 1.4.1 + +* Mon Oct 13 2008 Davide Madrisan 1.4.0-1mamba +- update to 1.4.0 +- new subpackages plugins libs tools + +* Fri Oct 03 2008 Davide Madrisan 1.3.2-1mamba +- update to 1.3.2 + +* Tue Sep 30 2008 Davide Madrisan 1.3.1-1mamba +- update to 1.3.1 + +* Mon Sep 01 2008 Davide Madrisan 1.3.0-1mamba +- update to 1.3.0 + +* Fri Aug 15 2008 Davide Madrisan 1.2.2-1mamba +- update to 1.2.2 + +* Fri Jun 13 2008 Davide Madrisan 1.2.1-1mamba +- update to 1.2.1 + +* Sun May 11 2008 Davide Madrisan 1.2.0-1mamba +- update to 1.2.0 +- plugins moved to %{_datadir}/%{name}/plugins +- install autospec templates %{_datadir}/%{name}/templates + +* Fri Feb 29 2008 Davide Madrisan 1.1.9-1mamba +- update to 1.1.9 + +* Wed Jan 30 2008 Davide Madrisan 1.1.8-1mamba +- update to version 1.1.8 + +* Sat Dec 31 2007 Davide Madrisan 1.1.7-1mamba +- update to version 1.1.7 + +* Sun Dec 23 2007 Davide Madrisan 1.1.6-1mamba +- update to version 1.1.6 + +* Fri Dec 14 2007 Davide Madrisan 1.1.5-1mamba +- update to version 1.1.5 + +* Mon Dec 10 2007 Davide Madrisan 1.1.4-1mamba +- update to version 1.1.4 + +* Sun Dec 02 2007 Davide Madrisan 1.1.3-1mamba +- update to version 1.1.3 + +* Thu Nov 29 2007 Davide Madrisan 1.1.2-1mamba +- update to version 1.1.2 + +* Mon Nov 26 2007 Davide Madrisan 1.1.1-1mamba +- update to version 1.1.1 +- add requirement for ftp + +* Tue Nov 20 2007 Davide Madrisan 1.1.0-1mamba +- update to version 1.1.0 + +* Tue Nov 13 2007 Davide Madrisan 1.0.2-1mamba +- update to version 1.0.2 + +* Fri Oct 26 2007 Davide Madrisan 1.0.1-1mamba +- update to version 1.0.1 +- do not use the %%makeinstall macro for compatibility with other distros + +* Wed Sep 26 2007 Davide Madrisan 1.0-1mamba +- update to version 1.0 + +* Sat Sep 08 2007 Silvan Calarco 0.9.99-2mamba +- patch: remove protocol prefix (http:// ftp://) before checking server dns reachability + +* Thu Sep 06 2007 Davide Madrisan 0.9.99-1mamba +- update to version 0.9.99 by autospec + +* Thu Jun 07 2007 Davide Madrisan 0.9.98-1mamba +- update to version 0.9.98 by autospec + +* Sat May 05 2007 Davide Madrisan 0.9.97-1mamba +- update to version 0.9.97 by autospec + +* Tue Apr 24 2007 Davide Madrisan 0.9.96-1mamba +- update to version 0.9.96 by autospec + +* Tue Mar 27 2007 Davide Madrisan 0.9.95-1mamba +- update to version 0.9.95 by autospec + +* Thu Mar 01 2007 Davide Madrisan 0.9.94-1qilnx +- update to version 0.9.94 by autospec + +* Fri Feb 09 2007 Davide Madrisan 0.9.93-1qilnx +- update to version 0.9.93 by autospec + +* Mon Jan 29 2007 Davide Madrisan 0.9.92-1qilnx +- update to version 0.9.92 by autospec + +* Tue Jan 09 2007 Davide Madrisan 0.9.91-1qilnx +- update to version 0.9.91 by autospec + +* Thu Dec 21 2006 Davide Madrisan 0.9.90-1qilnx +- update to version 0.9.90 by autospec + +* Wed Nov 29 2006 Davide Madrisan 0.9.14-1qilnx +- update to version 0.9.14 by autospec +- ncompress tool removed from the list of static requirements +- do require /bin/mktemp instead of /usr/bin/mktemp for portability + +* Mon Nov 06 2006 Davide Madrisan 0.9.13-1qilnx +- update to version 0.9.13 by autospec + +* Mon Jun 19 2006 Davide Madrisan 0.9.12-1qilnx +- update to version 0.9.12 by autospec + +* Sun Jun 11 2006 Davide Madrisan 0.9.11-1qilnx +- update to version 0.9.11 by autospec +- new documentation file `autobuild_example.rules' + +* Wed May 31 2006 Davide Madrisan 0.9.10-1qilnx +- update to version 0.9.10 by autospec + +* Tue May 16 2006 Davide Madrisan 0.9.9-1qilnx +- update to version 0.9.9 by autospec + +* Mon May 08 2006 Davide Madrisan 0.9.8-1qilnx +- update to version 0.9.8 by autospec + +* Mon Apr 17 2006 Davide Madrisan 0.9.7-1qilnx +- update to version 0.9.7 by autospec + +* Mon Mar 20 2006 Davide Madrisan 0.9.6-1qilnx +- update to version 0.9.6 by autospec + +* Sun Mar 05 2006 Davide Madrisan 0.9.5-1qilnx +- update to version 0.9.5 by autospec + +* Fri Feb 03 2006 Davide Madrisan 0.9.4-1qilnx +- update to version 0.9.4 by autospec + +* Sat Jan 14 2006 Davide Madrisan 0.9.3-1qilnx +- update to version 0.9.3 by autospec +- requires rpm >= 4.4.4 + +* Sun Jan 01 2006 Davide Madrisan 0.9.2-1qilnx +- update to version 0.9.2 by autospec + +* Sun Dec 18 2005 Davide Madrisan 0.9.1-1qilnx +- update to version 0.9.1 by autospec + +* Thu Dec 15 2005 Davide Madrisan 0.9.0-1qilnx +- update to version 0.9.0 + +* Sat Dec 03 2005 Davide Madrisan 0.8.9-1qilnx +- update to version 0.8.9 + +* Sat Nov 26 2005 Davide Madrisan 0.8.8-qilnx +- update to version 0.8.8 + +* Thu Nov 24 2005 Davide Madrisan 0.8.7-qilnx +- update to version 0.8.7 +- fixed typo in license tag + +* Sun Nov 20 2005 Davide Madrisan 0.8.6-qilnx +- update to version 0.8.6 + +* Tue Nov 15 2005 Davide Madrisan 0.8.5-qilnx +- update to version 0.8.5 + +* Thu Nov 10 2005 Davide Madrisan 0.8.4-qilnx +- update to version 0.8.4 +- requires host + +* Sun Nov 06 2005 Davide Madrisan 0.8.3-1qilnx +- update to version 0.8.3 +- requires cpio + +* Sun Oct 30 2005 Davide Madrisan 0.8.2-1qilnx +- update to version 0.8.2 + +* Sun Oct 16 2005 Davide Madrisan 0.8.1-1qilnx +- update to version 0.8.1 + +* Mon Oct 09 2005 Davide Madrisan 0.8.0-1qilnx +- update to version 0.8.0 + +* Sun Oct 02 2005 Davide Madrisan 0.7.3-1qilnx +- update to version 0.7.3 +- added more runtime requirements + +* Fri Sep 30 2005 Davide Madrisan 0.7.2-1qilnx +- update to version 0.7.2 +- requires sudo + +* Wed Sep 28 2005 Davide Madrisan 0.7.1-1qilnx +- update to version 0.7.1 + +* Sat Sep 24 2005 Davide Madrisan 0.7.0-1qilnx +- update to version 0.7.0 + +* Wed Aug 31 2005 Davide Madrisan 0.6.4-1qilnx +- update to version 0.6.4 + +* Fri Aug 05 2005 Davide Madrisan 0.6.3-1qilnx +- update to version 0.6.3 + +* Fri Jul 29 2005 Davide Madrisan 0.6.2-1qilnx +- update to version 0.6.2 + +* Sat May 28 2005 Davide Madrisan 0.6.1-1qilnx +- update to version 0.6.1 + +* Mon Apr 25 2005 Davide Madrisan 0.6.0-1qilnx +- update to version 0.6.0 + +* Sat Apr 09 2005 Davide Madrisan 0.5.4-1qilnx +- update to version 0.5.4 + +* Fri Mar 25 2005 Davide Madrisan 0.5.3-1qilnx +- update to version 0.5.3 + +* Sun Mar 21 2005 Davide Madrisan 0.5.2-1qilnx +- update to version 0.5.2 + +* Sun Mar 13 2005 Davide Madrisan 0.5.1-1qilnx +- update to version 0.5.1 + +* Fri Mar 11 2005 Davide Madrisan 0.5.0-1qilnx +- update to version 0.5.0 + +* Fri Mar 02 2005 Davide Madrisan 0.4.15-1qilnx +- update to version 0.4.15 + +* Tue Feb 15 2005 Davide Madrisan 0.4.14-1qilnx +- update to version 0.4.14 + +* Sat Jan 29 2005 Davide Madrisan 0.4.13-1qilnx +- update to version 0.4.13 + +* Mon Jan 24 2005 Davide Madrisan 0.4.12-1qilnx +- update to version 0.4.12 + +* Sun Jan 16 2005 Davide Madrisan 0.4.11-1qilnx +- update to version 0.4.11 + +* Sun Jan 09 2005 Davide Madrisan 0.4.10-1qilnx +- update to version 0.4.10 + +* Thu Dec 16 2004 Davide Madrisan 0.4.9-2qilnx +- added BUGS to %%docs + +* Wed Dec 15 2004 Davide Madrisan 0.4.9-1qilnx +- update to version 0.4.9 + +* Sun Nov 14 2004 Davide Madrisan 0.4.8-1qilnx +- update to version 0.4.8 + +* Sun Oct 24 2004 Davide Madrisan 0.4.7-1qilnx +- update to version 0.4.7 by autospec + +* Tue Oct 19 2004 Davide Madrisan 0.4.6-1qilnx +- update to version 0.4.6 by autospec + +* Thu Oct 14 2004 Davide Madrisan 0.4.5-1qilnx +- update to version 0.4.5 by autospec + +* Wed Oct 06 2004 Davide Madrisan 0.4.4-1qilnx +- update to version 0.4.4 by autospec + +* Tue Oct 05 2004 Davide Madrisan 0.4.3-1qilnx +- update to version 0.4.3 by autospec +- added the document rpm4QiLinux-it-HOWTO + +* Mon Oct 04 2004 Davide Madrisan 0.4.2-1qilnx +- update to version 0.4.2 by autospec + +* Fri Oct 01 2004 Davide Madrisan 0.4.1-1qilnx +- update to version 0.4.1 + +* Mon Sep 13 2004 Davide Madrisan 0.4.0-1qilnx +- update to version 0.4.0 + +* Tue Sep 01 2004 Davide Madrisan 0.3.9-1qilnx +- update to version 0.3.9 + +* Fri Aug 27 2004 Davide Madrisan 0.3.8-1qilnx +- update to version 0.3.8 + +* Wed Aug 25 2004 Davide Madrisan 0.3.7-1qilnx +- update to version 0.3.7 + +* Wed Aug 20 2004 Davide Madrisan 0.3.6-1qilnx +- update to version 0.3.6 + +* Sat Aug 09 2004 Davide Madrisan 0.3.5-1qilnx +- update to version 0.3.5 + +* Thu Aug 05 2004 Davide Madrisan 0.3.4-1qilnx +- first public release diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000..8794488 --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,45 @@ +# Makefile for autospec +# Copyright (C) 2008,2010 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +srcdir = .. + +include $(srcdir)/Makefile.env + +pck_libs := libapse.lib libcfg.lib libmsgmng.lib libnetwork.lib libspec.lib README.API +pck_libs_infiles := $(wildcard *.in) + +all: + +check: $(pck_libs) + @for f in $(pck_libs); do\ + echo -n "checking $$f... ";\ + bash -n $$f \ + && echo "[PASSED]" || { echo "[FAILED]"; exit 1; };\ + done + +install: $(pck_libs) + @$(INSTALL_DIR) $(DESTDIR)$(libdir) + for f in $(pck_libs); do\ + $(INSTALL_DATA) $${f} $(DESTDIR)$(libdir)/$${f};\ + done + +uninstall: + for f in $(pck_libs); do\ + rm -f $(DESTDIR)$(libdir)/$${f};\ + done + +clean: + rm -f $(patsubst %.in,%,$(pck_libs_infiles)) diff --git a/lib/README.API.in b/lib/README.API.in new file mode 100644 index 0000000..e49e4b8 --- /dev/null +++ b/lib/README.API.in @@ -0,0 +1,6 @@ +# TO DO, sorry... + +# try with: +# . @libdir@/libspec.lib +# EXIT_FUNC=return +# specfile.getvars --help diff --git a/lib/libapse.lib.in b/lib/libapse.lib.in new file mode 100644 index 0000000..9ea49b8 --- /dev/null +++ b/lib/libapse.lib.in @@ -0,0 +1,533 @@ +#!/bin/bash +# libapse.lib -- Autospec Package Search Engine library +# Copyright (C) 2007 Stefano Cotta Ramusino +# Copyright (C) 2008,2009,2010 Silvan Calarco + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +[ -r @libdir@/libspec.lib ] || + { echo "$me: "$"library not found"": /usr/share/autospec/lib/libspec.lib" 1>&2 + exit 1; } +. @libdir@/libspec.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="libapse"; export TEXTDOMAIN + +# function apse.cmpversion() +# compare two version +# args: +# $1 : first version +# $2 : second version +# $3 : changelog of first version +# $4 : changelog of second version +# returns: +# 0 : same version +# 1 : first version is greater than the second one +# 2 : second version is greater than the first one +function apse.cmpversion() { + local retval=1 + + [ "$1" = "$2" ] && retval=0 + + if [ "$retval" = "0" ]; then + notify.debug "$FUNCNAME: retval = \"$retval\"" + return $retval + fi + + local vcs prealpha beta rc stable precedence \ + version1 version2 minfield maxfield field1 field2 \ + retval code1 code2 subarra1 position + + let "position = 7" + + vcs=(\ + "cvs" "svn" "git" "rcs" "bzr" "mtn" "ae") + prealpha=(\ + "prealpha" "nightlybuild" "development" "dev" ${vcs[*]}) + beta=(\ + "beta" "preview" "pre" "prototype" "proto" "tp" "ctp" "ea" "test" "milestone") + rc=(\ + "rc" "gm" "gamma") + stable=(\ + "stable" "gold" "gar" "rtm" "rtw" "rel") + precedence=(\ + "prealpha[*]" "alpha" "beta[*]" "rc[*]" "delta" "omega" "stable[*]") + + # TODO: if there isn't in this list compare alphabetically + + # TODO: if in both there is vcs compare, if only in one of them watch changelog or/and data + + version1=($(echo $1 | tr '[:punct:]' ' ' | \ + sed -e "s,\([a-zA-Z^ ]*\)\([0-9^ ]*\)\([a-zA-Z^ ]*\),\1 \2 \3,g")) + notify.debug "$FUNCNAME: version1 = ${version1[*]}" + + version2=($(echo $2 | tr '[:punct:]' ' ' | \ + sed -e "s,\([a-zA-Z^ ]*\)\([0-9^ ]*\)\([a-zA-Z^ ]*\),\1 \2 \3,g")) + notify.debug "$FUNCNAME: version2 = ${version2[*]}" + + minfield=${#version1[*]} + maxfield=${#version2[*]} + + echo ${version2[*]} ${version1[*]} | grep -i '[a-z]' &>/dev/null + + if [ $? -eq 1 ]; then + if [[ ${#version2[*]} -lt ${#version1[*]} ]]; then + minfield=${#version2[*]} + maxfield=${#version1[*]} + fi + else + field1=$(echo ${version1[0]} | grep -i '[a-z]' &>/dev/null; echo $?) + field2=$(echo ${version2[0]} | grep -i '[a-z]' &>/dev/null; echo $?) + + if [ $field1 -gt $field2 ]; then + retval=1 + notify.debug "$FUNCNAME: retval = $retval" + return $retval + elif [ $field1 -lt $field2 ]; then + retval=2 + notify.debug "$FUNCNAME: retval = $retval" + return $retval + fi + fi + + for i in $(seq 0 1 $[$minfield-1]); do + echo ${version2[$i]} | grep -i '[a-z]' &>/dev/null + + if [ $? -eq 0 ]; then + code2=${version2[$i]} + for t2 in ${!precedence[@]}; do + for arra2 in ${precedence[$t2]}; do + if [ "${version2[$i]}" = "$arra2" ]; then + version2[$i]=$[$t2+1] + break + else + for subarra2 in ${!arra2}; do + if [ "${version2[$i]}" = "$subarra2" ]; then + version2[$i]=$[$t2+1] + break + fi + done + fi + done + done + + echo ${version2[$i]} | grep -i '[a-z]' &>/dev/null + [ $? -eq 0 ] && version2[$i]=$position + + notify.debug "\ +$FUNCNAME: \`$code2' has position ${version2[$i]} in precedence" + fi + + echo ${version1[$i]} | grep -i '[a-z]' &>/dev/null + + if [ $? -eq 0 ]; then + code1=${version1[$i]} + for t1 in ${!precedence[@]}; do + for arra1 in ${precedence[$t1]}; do + if [ "${version1[$i]}" = "$arra1" ]; then + version1[$i]=$[$t1+1] + break + else + for subarra1 in ${!arra1}; do + if [ "${version1[$i]}" = "$subarra1" ]; then + version1[$i]=$[$t1+1] + break + fi + done + fi + done + done + + echo ${version1[$i]} | grep -i '[a-z]' &>/dev/null + [ $? -eq 0 ] && version1[$i]=$position + + notify.debug "\ +$FUNCNAME: \`$code1' has position ${version1[$i]} in precedence" + fi + + if [[ ${version2[$i]} -gt ${version1[$i]} ]]; then + retval=2 + break + elif [[ ${version2[$i]} -lt ${version1[$i]} ]]; then + retval=1 + break + else + if [ $i -eq $(($minfield-1)) ]; then + for j in $(seq $i 1 $[$maxfield-1]); do + if [[ ${#version2[*]} -eq ${#version1[*]} ]]; then + retval=0 + elif [[ ${version2[$j]} -ne 0 ]]; then + retval=2 + elif [[ ${version1[$j]} -ne 0 ]]; then + retval=1 + else + retval=0 + fi + done + fi + fi + done + + notify.debug "$FUNCNAME: retval = $retval" + + return $retval +} + +# function apse.scrapeversion() +# find for updates scanning the web +# args: +# -n|--pckname +# -s|--specname +# -w|--pckurl (optional) +# -p|--proxy (optional) +# -u|--proxy-user (optional) +# returns: +# 0 : package is already the latest version +# 1 : a newer version of the package is already installed +# 2 : a new version is available +# 3 : no information on latest available version +# sets up: +# APSE_LAST_VERSION : last available version + +function apse.scrapeversion() { + local me="$FUNCNAME" + local retval + + { # (to make 'usage' a local function) + function usage() { + echo "\ +$me, "$"version"" @version@"" +Copyright (C) 2007 Stefano Cotta Ramusino "" + +"$"Find for updates scanning the web."" + +"$"Usage"": + $me -n -s [-w ] [-p [-u ]] + +"$"where the above options mean"": + -n, --pckname "$"Name of the package"" + -s, --specname "$"Name of the spec file"" + -w, --pckurl "$"URL of the project home page"" + -v, --pckurlverbatim "$"URL with no variable expansion"" + -p, --proxy "$"Proxy"" + -u, --proxy-user "$"Proxy user"" + +"$"Operation modes"": + -h, --help "$"Print this help, then exit"" + +"$"Samples"": + $me -n autospec -s autospec + +"$"Report bugs to ." + } + } + + local ARGS + ARGS=`LANG=C getopt -o han:s:w:p:u: \ + --long help,allurl,pckname:,specname:,pckurl:,pckurlverbatim:,proxy:,proxy-user: \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error" + + eval set -- "$ARGS" + + local src0pckname specname pckurl pckurlverbatim proxy proxy_user + + while :; do + case "$1" in + -n|--pckname) + src0pckname="$2"; shift + notify.debug "$FUNCNAME: src0pckname = \"$src0pckname\"" + ;; + -s|--specname) + specname="$2"; shift + notify.debug "$FUNCNAME: specname = \"$specname\"" + ;; + -w|--pckurl) + pckurl="$2"; shift + notify.debug "$FUNCNAME: pckurl = \"$pckurl\"" + ;; + -v|--pckurlverbatim) + pckurlverbatim="$2"; shift + notify.debug "$FUNCNAME: pckurlverbatim = \"$pckurlverbatim\"" + ;; + -p|--proxy) + proxy="$2"; shift + notify.debug "$FUNCNAME: proxy = \"$proxy\"" + ;; + -u|--proxy-user) + proxy_user="$2"; shift + notify.debug "$FUNCNAME: proxy_user = \"***\"" + ;; + -h|--help) + usage + ${EXIT_FUNC:-"exit"} + ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error: bad command \`$1'" ;; + esac + shift + done + + [ "$src0pckname" ] || { usage; ${EXIT_FUNC:-"exit"} 1; } + # FIXME : should `specname' be an optional argument? + [ "$specname" ] || { usage; ${EXIT_FUNC:-"exit"} 1; } + + local fcurlout=$(mktemp -q -t fcurlout.XXXXXXXX) || + notify.error $"can't create temporary files" + + # SPEC_SOURCE0_PCKNAME --> src0pckname + # SPEC_NAME --> specname + # ${SPEC_SOURCE[0]} --> pckurl + + [ "$src0pckname" = "$specname" ] || + { src_name="$src0pckname" + notify.debug "src_name = \"$src_name\""; } + + local curr_curl_url pck_file new_version last_version + local curr_curl_proxy_opts="\ +${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}" + + # SOURCE0 url based search (only if 'pckurl' is a valid url) + if [[ "$pckurl" =~ .*://.* ]]; then + local pckurldir="`dirname $pckurl`/" + notify.debug "pckurldir = $pckurldir" + + local pcknameverbatim=`basename $pckurlverbatim` + notify.debug "pcknameverbatim = $pcknameverbatim" + + curr_curl_url="$pckurldir" + + notify.note $"looking at"" <${NOTE}$curr_curl_url${NORM}> (\`${NOTE}source0${NORM}')..." + + notify.debug "curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\"" + curl $curl_opts_netlink $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout + let "retval = $?" + + case "$retval" in + 0) ;; + 6) notify.warning $"couldn't resolve host" ;; + 7) notify.warning $"failed to connect to host" ;; + *) notify.warning $"curl error (exit code: $retval)" ;; + esac + + local svar svalue spck candidate_version + # filter "?var:" expressions + spck=`echo $pcknameverbatim | sed "s,%{?[A-Za-z0-9_]*:.*\(%[A-Za-z0-9_]*\)},\1,"` + + while true; do + svar=`echo $spck | sed "\ + s,.*%[{]*\([A-Za-z0-9_]*\)[}]*.*,\1,"` + [ "$svar" = "$spck" ] && break + if [ "$svar" = "version" ]; then + svalue="\\\([A-Za-z0-9._]*\\\)" + else + svalue=`rpmvars.solve "%$svar" "$spec_dir/$specname.spec"` + [ "$svalue" = "%$svar" ] && svalue= + fi + spck=`echo $spck | sed "\ + s,%[{]*$svar[}]*,$svalue,"` + done + + # remove archiver extension from rexexp to match changes + local pcknameregexp=$(echo [^A-Za-z0-9._-]$spck | sed "\ + s,\.gz$,\\\., + s,\.tgz$,\\\., + s,\.bz2$,\\\., + s,\.lzma$,\\\., + s,\.lz$,\\\., + s,\.tbz2$,\\\.,") + + local retval=$? + notify.debug "pcknameregexp = $pcknameregexp" + + if [ $retval -eq 0 ]; then + if [ "${pcknameregexp/(/}" = "${pcknameregexp}" ]; then + notify.warning "* "$"not parametric source0 name; cannot update" + else + candidate_versions=($(\ +grep -i "$pcknameregexp" $fcurlout | \ +sed "\ +s,.*$pcknameregexp.*,\1,g +s,.*\.md5,, +s,\.zip$,, +s,\.tar\.gz$,, +s,\.tar\.bz2$,, +s,\.gz$,, +s,\.tgz$,, +s,\.bz2$,, +s,\.lzma$,, +s,\.i386$,, +s,\.bin$,, +s,\.exe$,, +s,\.dmg$,, +s,\.tbz2$,, +s,\.lz$,," | +sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 )) + + local curr_version_dots new_version_dots candidate_version + curr_version_dots=`echo $SPEC_VERSION | tr -d [0-9][A-Z][a-z]_` + for candidate_version in ${candidate_versions[*]}; do + # skip version with no dots if current version has at least one + # (e.g. date release like 20000110) + new_version_dots=`echo $candidate_version | tr -d [0-9][A-Z][a-z]_` + [ "${#new_version_dots}" = 0 -a ${#curr_version_dots} -gt 0 ] && + continue + new_version="$candidate_version" + break + done + fi + fi + + if [ "$new_version" ]; then + notify.note "* "$"found version:"" \`${NOTE}$new_version${NORM}'" + last_version="$new_version" + fi + fi + + # sourceforge.net, sf.net + + local prj_name + + if [ "$(echo $pckurl | grep "sourceforge.net\|sf.net")" ]; then + notify.note $"looking at"" <${NOTE}http://sourceforge.net${NORM}>..." + + prj_name=$(echo "$pckurl" | sed -n 's,.*/\(.*\)/.*,\1,p') + [ "$prj_name" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"assertion failed:"" \"\$prj_name\" != \"\"" + + curr_curl_url="http://sourceforge.net/projects/$prj_name" + notify.debug "curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\"" + curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout + + let "retval = $?" + case "$retval" in + 0) ;; + 6) notify.warning $"couldn't resolve host" ;; + 7) notify.warning $"failed to connect to host" ;; + *) notify.warning $"curl error (exit code: $retval)" ;; + esac + + [ "$retval" = "0" ] && + if [ "$(sed -n "s,.*Invalid Project.*,error,pi" $fcurlout)" != \ + "error" ]; then + [ "$src_name" ] || src_name="$specname" + + pck_file=`grep -i -m1 "/download" $fcurlout | \ +grep -i "$src_name" | \ +sed -n "s,.*\"\([^\"]*\)\/download\".*,\1,pi"` + notify.debug "pck_file = \"$pck_file\"" + [ "$src_name" ] && unset src_name + + new_version=`echo $pck_file | sed -n "\ +/[0-9]/!q # return nothing if no number is found in the package name +s,.*/,, # remove directory name, if any +s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) +/-[0-9]*/{s/.*-\([0-9]*.*\)/\1/p;q} # - +/_[0-9]*/{s/.*_\([0-9]*.*\)/\1/p;q} # _ +/[^-\.][0-9]\./{s/.*[^-\.]\([0-9]\..*\)/\1/p;q} # +# (no version, but can end with numbers) +/^[^0-9]*[0-9]*$/q"` + fi + fi + + if [ "$new_version" ]; then + notify.note "* "$"found version:"" \`${NOTE}$new_version${NORM}'" + last_version="$new_version" + fi + + # look at the other supported web sites... + + # skip perl packages to prevent name confusion; these are checked above via Source0 + if [ ! "$(echo $pckurl | grep "cpan.org")" ]; then + for i in ${!apse_site_name[@]}; do + notify.note \ +$"looking at"" <${NOTE}${apse_site_name[$i]}${NORM}>..." + + for search_name in $src_name $specname; do + [ "${apse_put_fields[$i]}" ] && + curr_curl_url="${apse_uri[$i]}" || + curr_curl_url="${apse_uri[$i]}${search_name}" + + if [ "${apse_put_fields[$i]}" ]; then + notify.debug "\ +curl \$curr_curl_proxy_opts -s -L -F ${apse_put_fields[$i]}${search_name} \"$curr_curl_url\"" + curl $curr_curl_proxy_opts -s -L -F \ + ${apse_put_fields[$i]}${search_name} "$curr_curl_url" > $fcurlout + else + notify.debug "\ +curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\"" + curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout + fi + + let "retval = $?" + case "$retval" in + 0) ;; + 6) notify.warning $"couldn't resolve host" ;; + 7) notify.warning $"failed to connect to host" ;; + *) notify.warning $"curl error (exit code: $retval)" ;; + esac + + [ "$retval" = "0" ] || continue + + if [ "$(cat $fcurlout | sed -n "\ +s,.*${apse_error_msg[$i]}.*,error,pi")" != "error" ]; then + current_grep="$(echo "${apse_grep[$i]}" | sed -e "s,\${search_name},${search_name},g")" + current_sed="$(echo "${apse_sed[$i]}" | sed -e "s,\${search_name},${search_name},g")" + notify.debug "\ +grep -i -m1 \"$current_grep\" \$fcurlout | sed -n \"$current_sed\"" + new_version=$(grep -i -m1 "$current_grep" $fcurlout | sed -n "$current_sed") + if [ "$new_version" ]; then + notify.note "\ + * "$"found version:"" \`${NOTE}$new_version${NORM}'" + if [ "$last_version" ]; then + notify.debug "apse.cmpversion \"$last_version\" \"$new_version\"" + apse.cmpversion "$last_version" "$new_version" + [ $? -eq 2 ] && last_version="$new_version" + else + last_version="$new_version" + fi + fi + fi + done + done + fi + + unset APSE_LAST_VERSION + + if [ "$last_version" ]; then + APSE_LAST_VERSION="${last_version/-/.}" + notify.note $"\ +last version of \`${NOTE}$specname${NORM}' found:"" \ +\`${NOTE}${APSE_LAST_VERSION}${NORM}'" + + apse.cmpversion "$SPEC_VERSION" "$APSE_LAST_VERSION" + retval=$? + + if [ $retval -eq 0 ]; then + notify.note $"package \`${NOTE}$specname${NORM}' is already the latest version" + elif [ $retval -eq 2 ]; then + notify.note $"\ +a new version of \`${NOTE}$specname${NORM}' is available!" + else + notify.warning $"a newer version of \`${NOTE}$specname${NORM}' is already installed" + fi + else + notify.warning $"cannot find a new version of \`$specname'" + retval=3 + fi + + rm -f $fcurlout + + return $retval +} diff --git a/lib/libcfg.lib.in b/lib/libcfg.lib.in new file mode 100644 index 0000000..90a24e2 --- /dev/null +++ b/lib/libcfg.lib.in @@ -0,0 +1,120 @@ +#!/bin/bash +# libcfg.lib -- @package@ library for loading the configuration file(s) +# Copyright (C) 2008,2011 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="libcfg"; export TEXTDOMAIN + +# list of the configuration file(s) +default_cfg=(\ +`ls /etc/@package@.conf ~/.@package@ ~/.@package@.d/*.conf 2>/dev/null`) + +# check if the user configurations file for autospec is present +function config.check4user() { + local user_data=$(getent passwd 2>/dev/null | grep "x:$(id -u):") + local user_fullname=$(echo "$user_data" | cut -d: -f 5) + local email_infof_kde + + if [ -r "$HOME/.kde/share/config/emaildefaults" ]; then + email_infof_kde="$HOME/.kde/share/config/emaildefaults" + elif [ -r "$HOME/.kde4/share/config/emaildefaults" ]; then + email_infof_kde="$HOME/.kde4/share/config/emaildefaults" + fi + + if [[ -n "$email_infof_kde" && -z "$packager_email" ]]; then + packager_email="$(\ +sed -n "/EmailAddress/{s/.*=//p}" "$email_infof_kde" 2>/dev/null)" + fi + + [ -r ~/.@package@ ] || notify.error $"\ +configuration file not found"": ${HOME:-~}/.@package@ +--------------------------------------- +${NOTE}"$"Hint"":${NORM} +packager_fullname=\"${user_fullname:-Your Name}\" +packager_email=\"${packager_email:-email@domain}\" +ftp_rw_user[1]=\"user\" +ftp_rw_passwd[1]=\"passwd\" +--------------------------------------- +" +} + +function config.security() { + if [ -n "$packager_group" ]; then + [ "$(groups 2>/dev/null | grep $packager_group 2>/dev/null)" ] || + notify.error $"\ +user \`$(id -nu)' does not belong to group \`$packager_group'" + + # security check for configuration file(s) groups and permissions + for f in ${default_cfg[0]}; do + cfg_file_mod=(`find $f -printf "%g %m" 2>/dev/null`) + [[ ${cfg_file_mod[0]} = $packager_group && + "`expr ${cfg_file_mod[1]} : '.*\(.\)'`" = 0 ]] || + notify.warning $"\ +the file \`$f' should be readable only by the group \`$packager_group'" + done + else + notify.warning "\`packager_group' "$"unset in the configuration files" + fi +} + +# checking for errors in the configuration file +function config.integrity() { + mandatory_cfg_vars=' +DISTRO +DISTRO_rpm +VENDOR +packager_fullname +packager_email +ftpurl_ro_rpms +ftpurl_ro_srpms +packager_group +allowed_libdirs +library_group +library_summary +library_group_devel +library_group_perl +format_buildroot_value +man_compress_ext +info_compress_ext +library_name_structure +perl_module_name_structure +patch_name_structure +source0_name_structure +plugindir +plugin_pck_update +plugin_spec_create +plugin_pck_extract +plugin_config_getvar' + + # note: use indirect references to 'mandatory_cfg_vars' variables + for cfg_var in $mandatory_cfg_vars; do + (set -u; : ${!cfg_var}) 2>/dev/null || + notify.error $"\ +missing variable in the configuration file"" -- \`$cfg_var'" + done +} + +cfg_files_num=0 +for cfg_file in ${default_cfg[*]}; do + if [ -e "$cfg_file" ]; then + cfg_files_num=$(($cfg_files_num + 1)) + notify.debug $"loading"": \`$cfg_file'..." + [ -r "$cfg_file" ] || notify.error $"cannot read"" \`$cfg_file'" + . "$cfg_file" + fi +done + +[ "$cfg_files_num" = 0 ] && notify.error $"configuration file not found" + +unset cfg_file diff --git a/lib/libmsgmng.lib.in b/lib/libmsgmng.lib.in new file mode 100644 index 0000000..f7bcba7 --- /dev/null +++ b/lib/libmsgmng.lib.in @@ -0,0 +1,71 @@ +#!/bin/bash +# libmsgmng.lib -- @package@ library to manage debug/warning/error messages +# Copyright (C) 2005,2006,2008 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="libmsgmng"; export TEXTDOMAIN + +# function notify.enable_colors +# enable if possible the colorized output +# args: +# none +function notify.enable_colors() { + if [[ -t 1 && "$TERM" != raw && "$TERM" != dumb ]]; then + ESC=$(echo -en "\033") # ascii ESCape + CRIT="${ESC}[1;31m" # switch on red + NOTE="${ESC}[1;33m" # switch on yellow + WARN="${ESC}[1;31m" + EXIT="${ESC}[1;31m" + NORM=$(echo -en "${ESC}[m\017") + else + ESC= CRIT= NOTE= WARN= EXIT= NORM= + fi +} + +# function notify.disable_colors +# disable the colorized output +# args: +# none +function notify.disable_colors() { + ESC= CRIT= NOTE= WARN= EXIT= NORM= +} + +# notify family of message handling functions: +# - notify.warning +# - notify.error +# - notify.debug +# - notify.note +# args: +# $1 : message to print +# note: +# 1. debug messages are only printed if 'verbose' is great then '0' +# 2. error notifications are followed by a call to 'EXIT_FUNC' +# or 'exit' if this variable is unset +# (can set to 'return' for instance) + +notify_def_msg="<"$"no message"">" + +function notify.warning() { + echo -e "${WARN}WARNING${NORM}: ${1:-$notify_def_msg}" 1>&2 +} + +function notify.error() { + echo -e "${EXIT}ERROR${NORM}: ${EXIT}${1:-$notify_def_msg}${NORM}" 1>&2 + ${EXIT_FUNC:-"exit"} 1 +} + +function notify.debug() { + [ ${verbose:-0} -gt 1 ] || return + echo -e "${WARN}DEBUG${NORM}: ${1:-$notify_def_msg}" 1>&2 +} + +function notify.note() { + [ ${verbose:-0} -ge 0 ] || return + echo -e "${1:-$notify_def_msg}" +} diff --git a/lib/libnetwork.lib.in b/lib/libnetwork.lib.in new file mode 100644 index 0000000..a72d69b --- /dev/null +++ b/lib/libnetwork.lib.in @@ -0,0 +1,783 @@ +#!/bin/bash +# libnetwork.lib -- @package@ library to get info from internet repositories +# Copyright (C) 2008,2010 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] && + { echo $"this script requires bash version 3 or better" >&2 && exit 1; } + +me=(${0##*/} "@version@" "@date@") + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="libnetwork"; export TEXTDOMAIN + +# function repository.is_reachable() +# check if the server '$1' is reachable (test = DNS lookup query) +# args: +# $1 : server name +function repository.is_reachable() { + local ftpserver="${1/[a-z]*\:\/\//}" + [ "$ftpserver" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + + host -W3 $ftpserver >&/dev/null + return $? +} + +# function repository.get_pckname_from_HTML() +# ... ADDME ... +function repository.get_pckname_from_HTML() { + local pck_name="$1" + local infile="$2" + + [ "$pck_name" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + [ "$infile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#2)" + + notify.debug "$FUNCNAME: pck_name = \"$pck_name\"" + case "$pck_name" in */*) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"'\\' characters detected in \$pck_name" ;; esac + + notify.debug "$FUNCNAME: infile = \"$infile\"" + + local pckname_from_HTML=( $(sed -n "\ + # remove HTML tags --> get a better input + /0 otherwise +# example of output: +# got_RPM_FILENAME = ( +# i586:mbrowse-0.3.1-1qilnx.i586.rpm +# i586:mbrowse-contrib-0.3.1-1qilnx.noarch.rpm +# ppc:mbrowse-contrib-0.3.1-1qilnx.noarch.rpm ) +function repository.get_RPMS_name() { + ARGS=`LANG=C getopt \ + -o a:x:c:p:u: \ + --long archlist:,exclude:,target-cpu:,proxy:,proxy-user:,user: \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" + + eval set -- "$ARGS" + + local archlist excludeopt proxy proxy_user user target_cpu + while :; do + case $1 in + -a|--archlist) + archlist="$2"; shift + notify.debug "$FUNCNAME: archlist = \"$archlist\"" + ;; + -x|--exclude) + excludeopt="$2"; shift + notify.debug "$FUNCNAME: excludeopt = \"$excludeopt\"" + ;; + -c|--target-cpu) + target_cpu="$2"; shift + notify.debug "$FUNCNAME: target_cpu = \"$target_cpu\"" + ;; + -p|--proxy) + proxy="$2"; shift + notify.debug "$FUNCNAME: proxy = \"$proxy\"" + ;; + -u|--proxy-user) + proxy_user="$2"; shift + notify.debug "$FUNCNAME: proxy_user = \"$proxy_user\"" + ;; + -l|--user) + user="$2"; shift + notify.debug "$FUNCNAME: user = \"$user\"" + ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error" ;; + esac + shift + done + + local scanurl="$1" + [ "$scanurl" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + shift + + local pck_names="$@" + notify.debug "$FUNCNAME: pck_names = \"${pck_names[@]}\"" + [ "$pck_names" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#2)" + + [ "$archlist" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"no list of architectures set"" (\$archlist)" + + local flist=`mktemp -q -t flist.XXXXXXXX` || + notify.error $"can't create temporary files" + + local curr_arch errors pck_name curr_match + let "errors = 0" + + local curr_arch_list + case "$target_cpu" in + "") curr_arch_list=( $archlist ) ;; + "noarch") + #curr_arch_list=( ${arch_noarch_upload[*]} ) + # FIXME : if the noarch directory cannot be found a warning + # message is displayed + curr_arch_list=( $archlist noarch ) + ;; + *) # if the architecture is set by the user do ignore packages + # built for other architectures (aka: please do not remove + # packages built for other architectures!) + curr_arch_list="$target_cpu" + ;; + esac + notify.debug "\ +$FUNCNAME: curr_arch_list = ( ${curr_arch_list[*]} )" + + # FIXME: 'curl_opts_netlink' is an external variable + local curlopts="\ +-L --silent --list-only $curl_opts_netlink -o $flist\ +${user:+ --user $user}\ +${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}" + + local curlopts_debug="\ +-L --silent --list-only $curl_opts_netlink -o $flist\ +${user:+ --user ***}\ +${proxy:+ --proxy ***}${proxy_user:+ --proxy-user ***}" + + got_RPM_FILENAME= + for curr_arch in ${curr_arch_list[*]}; do + currurl="$(repository.resolveURL "$scanurl" "$curr_arch")" + #[ "$currurl" ] || notify.error $"(bug)"" -- $FUNCNAME: currurl = \"\"" + + # get the list of files from the repository + notify.note $"getting list of files from"" \`${NOTE}$currurl/${NORM}'..." + + > $flist + + # NOTE: the trailing slash is necessary, do not remote it + notify.debug "$FUNCNAME: curl $curlopts_debug --url $currurl/" + curl $curlopts --url $currurl/ + let "retval = $?" + notify.debug "$FUNCNAME: curl return code: $retval" + case "$retval" in + 0) ;; + 6) notify.warning $"couldn't resolve host" ;; + 7) notify.warning $"failed to connect to host" ;; + 56) notify.warning $"failure in receiving network data" ;; + *) notify.warning $"curl error (exit code: $retval)" ;; + esac + + if [ -s "$flist" ]; then + sed -i 's/\x0D$//' $flist + case $currurl in + ftp://*|http://*) + for pck_name in ${pck_names[@]}; do + got_RPM_FILENAME=( ${got_RPM_FILENAME[@]} $(\ + if [ -n "$excludeopt" ]; then + sed -n "\ + / $destdir/$file_name" + + pushd $destdir >/dev/null + + local retval + notify.debug "curl $curl_options\ +${proxy:+ --proxy $proxy}${proxyuser:+ --proxy-user $proxy_user} $file_url" + + curl $curl_options \ + ${proxy:+ --proxy $proxy} ${proxyuser:+ --proxy-user $proxy_user} \ + "$file_url" + retval=$? + + notify.debug "$FUNCNAME: curl return code: $retval" + case "$retval" in + 0) ;; + 6) notify.warning $"couldn't resolve host" ;; + 7) notify.warning $"failed to connect to host" ;; + 56) notify.warning $"failure in receiving network data" ;; + *) notify.warning $"curl error (exit code: $retval)" ;; + esac + + [ -e $destdir/$file_name ] || + if [ "$exitonerror" = 1 ]; then + notify.error $"cannot download"": \`$file_name'" + else + popd >/dev/null + notify.warning $"cannot download"": \`$file_name'" + return 1 + fi + + popd >/dev/null +} + +# function curl.upload +# upload a file using curl +# +function curl.upload() { + local ARGS + ARGS=`LANG=C getopt \ + -o f:l:o:p:u:x \ + --long upload-file:,user:,options:,proxy:,proxy-user:,\ +repository-alias:,exit-on-err,debug-unsecure \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" + + local upfile user options proxy proxy_user + local exitonerror=0 + local debug_unsecure=0 + + eval set -- "$ARGS" + while :; do + case "$1" in + -f|--upload-file) + upfile="$2"; shift + ;; + -l|--user) + user="$2"; shift + #notify.debug "$FUNCNAME: user = \"$user\"" + ;; + -o|--options) + options="$2"; shift + #notify.debug "$FUNCNAME: options = \"$options\"" + ;; + -p|--proxy) + proxy="$2"; shift + #notify.debug "$FUNCNAME: proxy = \"$proxy\"" + ;; + -u|--proxy-user) + proxy_user="$2"; shift + #notify.debug "$FUNCNAME: proxy_user = \"$proxy_user\"" + ;; + -x|--exit-on-err) + exitonerror="1" + #notify.debug "$FUNCNAME: exitonerror = \"$exitonerror\"" + ;; + --debug-unsecure) + debug_unsecure="1" + ;; + --) shift; break;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error: bad command \`$1'" ;; + esac + shift + done + + #notify.debug "$FUNCNAME: debug_unsecure = \"$debug_unsecure\"" + + local destfile="$1" + [ "$destfile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + + [ -e "$upfile" ] || notify.error $"package not found"": \`$upfile'" + + # add an extra newline to workaroung a bug in curl + notify.note " + * ${NOTE}$upfile${NORM} + --> $destfile" + + # option: --write-out [%{url_effective}]\\n + # the option '--progress-bar' is currently buggy in curl + local curr_curl_cmd="$options --progress-bar --fail -o /dev/null \ +${proxy:+ --proxy $proxy}${proxyuser:+ --proxy-user $proxy_user} \ +--upload-file $upfile $destfile" + + if [ "$debug_unsecure" = "1" ]; then + notify.debug "curl --user $user $curr_curl_cmd" + else + notify.debug "curl --user ***:*** $curr_curl_cmd" + fi + + curl --user $user $curr_curl_cmd + [ $? -eq 0 ] || { [ "$exitonerror" = 1 ] && exit 1 || return 1; } +} + +# function curl.ftp_command +# execute an ftp command (creating a directory, renamig a file, +# deleting) using curl +# +function curl.ftp_command() { + local ARGS + ARGS=`LANG=C getopt \ + -o l:o:p:u:a: \ + --long user:,options:,proxy:,proxy-user:,debug-unsecure,\ +action:,directory:,rename-from:,rename-to:,delete:,ftp-passive \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" + + local user options proxy proxy_user ftp_passive + local action directory fromfile tofile deletefile + local exitonerror=0 + + eval set -- "$ARGS" + while :; do + case "$1" in + -l|--user) + user="$2"; shift + #notify.debug "$FUNCNAME: user = \"$user\"" + ;; + -o|--options) + options="$2"; shift + #notify.debug "$FUNCNAME: options = \"$options\"" + ;; + -p|--proxy) + proxy="$2"; shift + #notify.debug "$FUNCNAME: proxy = \"$proxy\"" + ;; + -u|--proxy-user) + proxy_user="$2"; shift + #notify.debug "$FUNCNAME: proxy_user = \"$proxy_user\"" + ;; + --debug-unsecure) + debug_unsecure="1" + ;; + -a|--action) + action="$2"; shift + ;; + --directory) + directory="$2"; shift + ;; + --rename-from) + fromfile="$2"; shift + ;; + --rename-to) + tofile="$2"; shift + ;; + --delete) + deletefile="$2"; shift + ;; + --ftp-passive) + ftp_passive="--ftp-pasv" + ;; + -x|--exit-on-err) + exitonerror="1" + ;; + --) shift; break;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error: bad command \`$1'" ;; + esac + shift + done + + local backup_ftp_server="$1" + [ "$backup_ftp_server" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + + [ "$ftp_passive" ] && options="$options $ftp_passive" + + # NOTE: see RFC959 for the sintax of the 'quote' commands + # curl --ftp-pasv --user user:password \ + # -Q "MKD /devel/old/prova.dir" \ + # -Q "RNFR /devel/old/prova.tmp" \ + # -Q "RNTO /devel/old/prova.dir/prova.tmp" ftp.linuxdistro.org + case "$action" in + mkdir) + [ "$directory" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--directory)" + notify.debug "\ +curl $options --user \"***:***\" --quote \"MKD $directory\" $1" + + curl $options --user "$user" --quote "MKD $directory" $1 &>/dev/null + ;; + rename-file) + [ "$fromfile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--rename-from)" + [ "$tofile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--rename-to)" + notify.debug "curl $options --user \"***:***\"\ + --quote \"RNFR $fromfile\" --quote \"RNTO $tofile\" $1" + + curl $options --user "$user" \ + --quote "RNFR $fromfile" --quote "RNTO $tofile" $1 &>/dev/null + ;; + delete) + [ "$deletefile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--delete)" + + # example: + # curl -v --ftp-pasv --user "$user" \ + # --quote "CWD SRPMS.base" \ + # --quote "DELE filename-0.0.1-1distro.src.rpm" \ + # ftp://ftpaccounts.openmamba.org + # -or- + # curl -v --ftp-pasv --user "$user" \ + # --quote "DELE SRPMS.base/filename-0.0.1-1distro.src.rpm" \ + # ftp://ftpaccounts.openmamba.org + notify.debug "\ +curl $options --user \"***:***\" --quote \"DELE $deletefile\" $1" + curl $options --user "$user" --quote "DELE $deletefile" $1 &>/dev/null + ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"unknown action"": ($action)" + esac + retval=$? + + case "$retval" in + 0) ;; + 6) notify.warning $"couldn't resolve host" ;; + 7) notify.warning $"failed to connect to host" ;; + *) notify.warning $"curl error (exit code: $retval)" ;; + esac + + [[ "$retval" != "0" && "$exitonerror" = 1 ]] && exit 1 +} diff --git a/lib/libspec.lib.in b/lib/libspec.lib.in new file mode 100644 index 0000000..0264167 --- /dev/null +++ b/lib/libspec.lib.in @@ -0,0 +1,1216 @@ +#!/bin/bash -e +# libspec.lib -- @package@ library to manage rpm specfiles +# Copyright (C) 2004-2010 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="libspec"; export TEXTDOMAIN + +# function boolexpr.solve +# calculate the boolean expression `$1' expanding the variables +# found in `rpmvar_name[]' and `define_list_name[]' +# args: +# $1 : boolean expression to calculate +# return values: +# 0 : false +# 1 : true +# 2 : sintax error in expression `$1' +# note: +# tested families of boolean expressions: +# - %define use_gcc_33 0 +# %if [!] %{use_gcc_33} +# ... +# - %if "%{?cross_target_cpu}" != "" +function boolexpr.solve() { + local input="$1" boolexpr="$1" + + [[ "$boolexpr" ]] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + + notify.debug "\ +$FUNCNAME: boolean expression [ $boolexpr ]" + + local i + + # expand user --defined variables first... + for i in `seq 0 1 $(( ${#define_list_name[*]} - 1 ))`; do + notify.debug "\ +$FUNCNAME: expanding boolexpr using: \ +${define_list_name[$i]} (${define_list_value[$i]})" + + boolexpr=$(echo $boolexpr | sed "\ +s@%${define_list_name[$i]}@${define_list_value[$i]}@g +s@%?${define_list_name[$i]}@${define_list_value[$i]}@g +s@%{${define_list_name[$i]}}@${define_list_value[$i]}@g +s@%{?${define_list_name[$i]}}@${define_list_value[$i]}@g") + done + + # ...then expand known variables + for i in `seq 0 1 $(( ${#rpmvar_name[*]} - 1 ))`; do + notify.debug "\ +$FUNCNAME: expanding boolexpr using: \ +${rpmvar_name[$i]} (${rpmvar_value[$i]})" + + boolexpr=$(echo $boolexpr | sed "\ +s@%${rpmvar_name[$i]}@${rpmvar_value[$i]}@g +s@%?${rpmvar_name[$i]}@${rpmvar_value[$i]}@g +s@%{${rpmvar_name[$i]}}@${rpmvar_value[$i]}@g +s@%{?${rpmvar_name[$i]}}@${rpmvar_value[$i]}@g") + done + + # unexpanded variables beginning by '?' become void strings + # i.e. "%{?cross_target_cpu}" --> "" + case "$boolexpr" in + *%{?*|*%?*) + boolexpr=$(echo $boolexpr | \ + sed "s@%{?[^}]*}@@g;s@%?[a-zA-Z0-9_]*@@") + notify.debug "$FUNCNAME: boolexpr blanked -- [ $boolexpr ]" ;; + esac + + # expand rpm variables + # i.e. "%{_build_cpu}" + notify.debug "$FUNCNAME: expanding rpm variables, if any..." + boolexpr=$(eval "rpm $define_list_rpm --eval='"$boolexpr"'") + notify.debug "$FUNCNAME: boolexpr = \`$boolexpr'" + + # catch parsing errors + #[ "$boolexpr" 2>/dev/null ] + #[ $? -gt 1 ] && { echo "2"; return; } + + # note: rpm logic: "0" means false, everything else means "true" + + set -- $boolexpr + + local do_negate + [ "$1" = "!" ] && + { let "do_negate = 1"; shift; } || let "do_negate = 0" + notify.debug "$FUNCNAME: do_negate = $do_negate" + + if [[ ( "$1" = "0" || "$1" = "1" ) && -z "$2" ]]; then + let "retval = $1" + [[ "$do_negate" = "1" ]] && let "retval = $((! $1))" + else + notify.debug "\ +$FUNCNAME: set: \$1 = \"$1\", \$2 = \"$2\", \$3 = \"$3\"" + case "$2" in + "") # boolean expression with only one operand, i.e + # %if "%{?stage1}" + [ "${1//\"/}" ] && let "retval = 1" || let "retval = 0" #` + ;; + "<"|"<="|"="|"=="|"!="|">="|">") + # boolean expression with operator, i.e + # "%{?cross_target_cpu}" != "" + notify.debug "\ +$FUNCNAME: retval = \$( expr \"${1//\"/}\" \"$2\" \"${3//\"/}\" )" + retval=$( expr "${1//\"/}" "$2" "${3//\"/}" ) #` + ;; + *) # FIXME + notify.warning $"\ +detected a specfile with unsupported syntax:"" $1 $2 $3" + ;; + esac + [ "$do_negate" = "1" ] && let "retval = $((! $1))" + fi + + local boolstr; boolstr=(false true) + notify.debug "\ +$FUNCNAME: boolean expression [ $boolexpr ] --> ${boolstr[$retval]} ($retval)" + + echo "$retval" +} + +# function rpmvars.init +# set the vectors 'rpmvar_name[]', 'rpmvar_value[]', 'rpmvar_expr[]' +# args: +# --clear : clear all the rpmvar_* variables and exit +# --pckver : (force) version number of the package +# $1 : specfile name and path +# note: +# FIXME : unsupported expressions +# (see nagios.spec) +# %{!?EMBPERL: %define EMBPERL 0} +# DEBUG: : set: $1 = "%{EMBPERL}", $2 = "", $3 = "" +# expr: sintax error +function rpmvars.init() { + local ARGS pckver + ARGS=`LANG=C getopt -o cv: --long clear,pckver: -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error" + + eval set -- "$ARGS" + + while :; do + case "$1" in + -c|--clear) + unset rpmvar_name + unset rpmvar_value + unset rpmvar_expr + notify.debug "$FUNCNAME: variables \`rpmvar_*' cleared up" + return + ;; + -v|--pckver) + pckver="$2" + notify.debug "$FUNCNAME: pckver = $pckver (forced via --pckver)" + shift + ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error: bad command \`$1'" ;; + esac + shift + done + + local specfile="$1" + + [[ "$specfile" ]] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + + [[ -r $specfile ]] || + notify.error $"specfile not found"": \`$specfile'" + + local i j + + # if rpm variables have not been already set + if [[ -z "$rpmvar_name" || -z "$rpmvar_value" ]]; then + # set 'rpmvar_name' and 'rpmvar_value' + local line rpmvar_name rpmvar_value rpmvar_expr + + rpmvar_name[0]="name" + rpmvar_value[0]="\ +$(sed -n "/%description/q;{ # look in the spec preamble + /^Name/{s,Name[ \t]*:[ \t]*,,p}}" $specfile)" + rpmvar_expr[0]="0" + + rpmvar_name[1]="version" + if [ "$pckver" ]; then + rpmvar_value[1]="$pckver" + else + rpmvar_value[1]="\ +$(sed -n "/%description/q;{ # look in the spec preamble + /^Version/{s,Version[ \t]*:[ \t]*,,p}}" $specfile)" + fi + rpmvar_expr[1]="0" + + local ifexpr ifexpr_level boolexpr tok toksave level + let "ifexpr_level = 0" # level of nested %if statements + ifexpr[0]="1" # '[0]' means: out of any %if statement + + let "level = 0" + + local ignore_lines # support for '## *AUTOSPEC-{OFF,ON}*' + let "ignore_lines = 0" + + while read -r -a tok; do + if [ "${tok[0]}" = "##" ]; then + if [ "${tok[1]}" = "*AUTOSPEC-OFF*" ]; then + notify.debug "$FUNCNAME: found an AUTOSPEC-OFF command" + let "ignore_lines = 1" + continue + fi + + if [ "${tok[1]}" = "*AUTOSPEC-ON*" ]; then + notify.debug "$FUNCNAME: found an AUTOSPEC-ON command" + let "ignore_lines = 0" + continue + fi + elif [ "$ignore_lines" = "1" ]; then + # skip lines in the block "*AUTOSPEC-OFF*" .. "*AUTOSPEC-ON*" + notify.debug "$FUNCNAME: * line ignored -- ${tok[*]}" + continue + fi + + case "${tok[0]}" in + %description) + # skip all but the specfile preamble + break + ;; + %if) + #ifexpr=$(rpmvars.solve "${tok2}${fromtok3}" "$specfile") + # note: if <%var> is undefined (not present) or set to "0" + # then the conditional expression is false else is true + let "ifexpr_level += 1" + + # note: to implement %if statements we must take care of + # boolean values of all the previous ifexpr[] values, + # starting from 1 to '$ifexpr_level' +# [ "$ifexpr_level" -gt 1 ] && notify.warning "\ +#$FUNCNAME: "$"FIXME: sorry, not implemented yet..."" (nested \`%if')" + + notify.debug "\ +$FUNCNAME: conditional block (%if) [level#$ifexpr_level] -- ${tok[*]}" + + toksave=${tok[0]} + unset tok[0] + ifexpr[$ifexpr_level]=$(boolexpr.solve "${tok[*]}") + tok[0]=$toksave + ;; + %if[a-z]*) # %ifarch, %ifdef, ? + notify.warning "\ +$FUNCNAME: "$"FIXME: sorry, not implemented yet..."" (\`${tok[0]}')" + let "ifexpr_level += 1" + # FIXME: we should call 'boolexpr.solve' here: + # toksave=${tok[0]} + # unset tok[0] + # ifexpr[$ifexpr_level]=$(boolexpr.solve "${tok[*]}") + # tok[0]=$toksave + # for new we chooes a 50% right - 50% wrong approach :( + ifexpr[$ifexpr_level]=1 + ;; + %else) + notify.debug "\ +$FUNCNAME: conditional block (%else) [level#$ifexpr_level]" + #let "level = 0" + for level in $(seq 1 1 $ifexpr_level); do + # complement boolean values in %else blocks + if [ "${ifexpr[$level]}" = "0" ]; then + ifexpr[$level]=1 + notify.debug "$FUNCNAME: ifexpr[$level] = 0 --> 1" + else + ifexpr[$level]=0 + notify.debug "$FUNCNAME: ifexpr[$level] = 1 --> 0" + fi + done + ;; + %endif) + notify.debug "\ +$FUNCNAME: conditional block (%end) [level#$ifexpr_level]" + let "ifexpr_level -= 1" ;; + %end) + notify.warning $"\`%end' found; should perhaps be \`%endif'" + ;; + %define) + # note: we want to catch %define directives put in conditional blocks + # example: %define majversion + let "level = 0" + for level in $(seq 1 1 $ifexpr_level); do + notify.debug "$FUNCNAME: ifexpr[$level] = ${ifexpr[$level]}" + [ "${ifexpr[$level]}" = "0" ] && + { # found a false condition + let "level = $ifexpr_level + 1"; break; } + done + # not all the conditions are true: skip this definition + [ $level -gt $ifexpr_level ] && + { notify.debug "$FUNCNAME: ${tok[*]} ... skipped" + continue; } + + local tok0save tok1save tmpstr1 tmpstr2 + tok0save=${tok[0]} tok1save=${tok[1]} + unset tok[0] tok[1] + unset tmpstr tmpstr2 + + notify.debug "$FUNCNAME: $tok1save = \"${tok[*]}\"" + rpmvar_name[${#rpmvar_name[*]}]=$tok1save + case "${tok[*]}" in + %\(*\)) + # it's something like: + # %define major_ver %(echo %version | cut -d. -f 1-2) + # %define glibver %(echo `rpm -q --queryformat '%{VERSION}' libglib`) + +# rpmvar_value[${#rpmvar_value[*]}]="\ +#$( echo "${tok[*]}" | sed "s|%(\(.*\))|\1|" )" + + tmpstr="$(echo "${tok[*]}" | sed "s|%(\(.*\))|\1|")" + notify.debug "$FUNCNAME: tmpstr = $tmpstr" + # use the expanded value only if there's no rpm variables inside + tmpstr2="$(bash -c "$tmpstr" 2>/dev/null)" + if [ $? -eq 0 ]; then + echo "$tmpstr2" | grep -q -- '%' && + rpmvar_expr[${#rpmvar_expr[*]}]="1" || + { tmpstr="$tmpstr2" + rpmvar_expr[${#rpmvar_expr[*]}]="0" + notify.debug "$FUNCNAME: tmpstr = $tmpstr"; } + fi + rpmvar_value[${#rpmvar_value[*]}]="$tmpstr" + ;; + *) rpmvar_value[${#rpmvar_value[*]}]=${tok[*]} + rpmvar_expr[${#rpmvar_expr[*]}]="0" + ;; + esac + + tok[0]=$tok0save + tok[1]=$tok1save + ;; + # %define expanded directive + # example: + # %{expand:%%define kminver %(echo %version | cut -d. -f3)} + %{expand:*|%{expand) + notify.warning "\ +$FUNCNAME: "$"FIXME: sorry, not implemented yet..."" (\`%expand...')" + ;; + %{!?*:*%define*) + # %{!?EMBPERL: %define EMBPERL 0} + notify.warning "\ +$FUNCNAME: "$"FIXME: sorry, not implemented yet..."" (\`%{!?:')" +# +# # condvar_name = "EMBPERL" +# local condvar_name="$(\ +#echo "${tok[0]}" | sed 's,%{!?\(.*\):.*,\1,')" +# notify.debug "$FUNCNAME: condvar_name = $condvar_name" +# +# # condvar_expr = "EMBPERL 0" +# local condvar_expr="$(\ +#echo "${tok[0]}" | sed 's,.*%define[ \t]*\(.*\)},\1,')" +# notify.debug "$FUNCNAME: condvar_expr = $condvar_expr" + ;; + *) # not a definition: ignore the line + continue ;; + esac + done < $specfile + + # [1] variable expansion using user `--define' values + notify.debug "\ +$FUNCNAME: * variable expansion using user \`--define' values..." + local define_applied + for i in `seq 0 1 $(( ${#define_list_name[*]} - 1 ))`; do + let "define_applied = 0" + for j in `seq 0 1 $(( ${#rpmvar_name[*]} - 1 ))`; do + [[ "${rpmvar_name[$j]}" = "${define_list_name[$i]}" ]] && + { rpmvar_value[$j]="${define_list_value[$i]}" + let "define_applied = 1" + notify.debug "\ +$FUNCNAME: ${rpmvar_name[$j]} = \"${define_list_value[$i]}\" (forced by user)" + # FIXME : advanced users may --define variables by + # expressions, but for now expression are not supported by + # autospec, so we force '0' value + rpmvar_expr[$j]="0"; } + done + if [[ "$define_applied" = "0" ]]; then + notify.debug "\ +$FUNCNAME: added not existing user defined variable \`%${define_list_name[$i]}'" + rpmvar_name[${#rpmvar_name[*]}]="${define_list_name[$i]}" # ` + rpmvar_value[${#rpmvar_value[*]}]="${define_list_value[$i]}" # ` + # FIXME : user cannot --define expressions, just values + rpmvar_expr[${#rpmvar_expr[*]}]="0" + fi + done + notify.debug "\ +$FUNCNAME: [1] rpmvar_name = [ \ +$(for i in `seq 0 1 $(( ${#rpmvar_name[*]} - 1 ))`; do +echo -n "\"%${rpmvar_name[$i]}\" "; done)]" + notify.debug "\ +$FUNCNAME: [1] rpmvar_value = [ \ +$(for i in `seq 0 1 $(( ${#rpmvar_value[*]} - 1 ))`; do +echo -n "\"${rpmvar_value[$i]}\" "; done)]" + + # [2] variable expansion using 'rpmvar_value[]' + local tmpvar tmpval + notify.debug "\ +$FUNCNAME: * variable expansion using user \`rpmvar_value[]'..." + for i in $( seq 0 1 $(( ${#rpmvar_name[*]} - 1 )) ); do + for j in $( seq 0 1 $(( ${#rpmvar_name[*]} - 1 )) ); do + # do not expand one variable with itself + [[ $i -eq $j ]] && continue + + # use 'pck_newver' if defined + case "${rpmvar_name[$j]}" in + version) [[ "$pck_newver" ]] && + { rpmvar_value[$i]="$(\ +echo ${rpmvar_value[$i]} | sed "s#%[{]*version[}]*#$pck_newver#g")" + continue; } ;; + esac + # NOTE: old code +# rpmvar_value[$i]="$(\ +#echo ${rpmvar_value[$i]} | sed "\ +#s#%[{]*[?]*${rpmvar_name[$j]}[}]*#${rpmvar_value[$j]}#g")" + tmpvar="${rpmvar_name[$j]}"; tmpvalue="${rpmvar_value[$j]}" + notify.debug "\ +$FUNCNAME: * \`${rpmvar_value[$i]}' : \`$tmpvar' --> \`$tmpvalue'..." + rpmvar_value[$i]="$(\ +echo ${rpmvar_value[$i]} | sed -n "\ +/%{?$tmpvar:%$tmpvar.*}/{s#%{?$tmpvar:%$tmpvar\(.*\)}#$tmpvalue\1#gp;q}; +/%{?$tmpvar}/{s#%{?$tmpvar}#$tmpvalue#gp;q}; +/%{$tmpvar}/{s#%{$tmpvar}#$tmpvalue#gp;q}; +/%$tmpvar/{s#%$tmpvar#$tmpvalue#gp;q}; +p")" + done + notify.debug "\ +$FUNCNAME: result: \`${rpmvar_value[$i]}'" + done + notify.debug "\ +$FUNCNAME: [2] rpmvar_name = [ \ +$(for i in `seq 0 1 $(( ${#rpmvar_name[*]} - 1 ))`; do +echo -n "\"%${rpmvar_name[$i]}\" "; done)]" + notify.debug "\ +$FUNCNAME: [2] rpmvar_value = [ \ +$(for i in `seq 0 1 $(( ${#rpmvar_value[*]} - 1 ))`; do +echo -n "\"${rpmvar_value[$i]}\" "; done)]" + + # [3] expand rpm variables using 'rpm --eval=' + notify.debug "\ +$FUNCNAME: * variable expansion using \`rpm --eval='..." + local rpmvar_value_unexpanded + for i in $( seq 0 1 $(( ${#rpmvar_name[*]} - 1 )) ); do + case "${rpmvar_value[$i]}" in + %*) rpmvar_value_unexpanded="${rpmvar_value[$i]}" + rpmvar_value[$i]=$(\ +rpm --eval="${rpmvar_value[$i]}" 2>/dev/null) ;; + esac + done + notify.debug "\ +$FUNCNAME: [3] rpmvar_name = [ \ +$(for i in `seq 0 1 $(( ${#rpmvar_name[*]} - 1 ))`; do +echo -n "\"%${rpmvar_name[$i]}\" "; done)]" + notify.debug "\ +$FUNCNAME: [3] rpmvar_value = [ \ +$(for i in `seq 0 1 $(( ${#rpmvar_value[*]} - 1 ))`; do +echo -n "\"${rpmvar_value[$i]}\" "; done)]" + + for i in $( seq 0 1 $(( ${#rpmvar_name[*]} - 1 )) ); do + # note: we strip the '"' chars from 'rpmvar_value' because + # otherwise a definition like: 'BUILD_CC "ccache gcc33"' + # will be expanded into 'rpmvar_value[0]=""ccache gcc33""' + # and the error message: 'gcc33: no input files' will be + # printed to stderr at every '. infofile' command + echo "\ +rpmvar_name[$i]=\"${rpmvar_name[$i]}\" +rpmvar_value[$i]=\"${rpmvar_value[$i]//\"/}\" +rpmvar_expr[$i]=\"${rpmvar_expr[$i]}\"" >> ${infofile:-/dev/null} # ` + + if [[ "${rpmvar_expr[$i]}" = "1" ]]; then + notify.debug "$FUNCNAME: eval \"${rpmvar_value[$i]}\"" + # FIXME : the eval command could lead to security issues! + # ex. %define foo %(rm -f ) + # it's also a problem for rpm itself (at least for rpm 4.0.4) + eval "${rpmvar_value[$i]}" &>/dev/null + # note: %define BUILD_CC ccache gcc33 + # --> eval "ccache gcc33" --> $? == 1 + [[ $? -eq 0 ]] || notify.warning $"\ +cannot evaluate:"" \"${rpmvar_value[$i]}\"" + fi + done + fi +} + +# function rpmvars.solve +# convert the rpm variables found in the string '$1' with their +# values using the data vectors 'rpmvar_name' and 'rpmvar_value' +# args: +# $1 : string to expand +# $2 : specfile name and path +function rpmvars.solve() { + local i input="$1" output="$1" specfile="$2" + + # skip strings with no variables inside + case "$input" in *%*) ;; *) echo "$output"; return ;; esac + + [ "$input" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + [ "$specfile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#2)" + + [ -r "$specfile" ] || + notify.error $"specfile not found"": \`$specfile'" + + [[ "${rpmvar_name[@]}" ]] || notify.warning $"\ +(bug)"" -- $FUNCNAME: "$"assertion failed:"" \"\${rpmvar_name[@]}\" != \"\"" + + notify.debug "$FUNCNAME: input = $input" + + # convert the rpm variables found in 'output' + local tmpvar tmpvalue + for i in $(seq 0 1 $(( ${#rpmvar_name[@]} - 1 ))); do + notify.debug "\ +$FUNCNAME: trying with \"${rpmvar_name[$i]}\" (${rpmvar_value[$i]}) ..." + if [ "${rpmvar_expr[$i]}" = "0" ]; then + # ex: "/ruby/%{majorminor}/ruby-%{version}%{?pl:-p%pl}.tar.bz2" + tmpvar="${rpmvar_name[$i]}"; tmpvalue="${rpmvar_value[$i]}" + output="$( echo "$output" | sed -n "\ +/%{?$tmpvar:%$tmpvar.*}/{s#%{?$tmpvar:%$tmpvar\(.*\)}#$tmpvalue\1#gp;q}; +/%{?$tmpvar}/{s#%{?$tmpvar}#$tmpvalue#gp;q}; +/%{$tmpvar}/{s#%{$tmpvar}#$tmpvalue#gp;q}; +/%$tmpvar/{s#%$tmpvar#$tmpvalue#gp;q}; +p")" +# output="$( echo "$output" | sed "\ +#s|%[{]*?${rpmvar_name[$i]}:||g;\ +#s|%[{]*[?]*${rpmvar_name[$i]}[}]*|${rpmvar_value[$i]}|g" )" + else + # FIXME : the eval command could lead to security issues! + # so it should be executed in a resticted environment + j=$( eval "${rpmvar_value[$i]}" 2>/dev/null ) + + output="$( echo "$output" | sed "\ +s|%[{]*?${rpmvar_name[$i]}:||g;\ +s|%[{]*[?]*${rpmvar_name[$i]}[}]*|$j|g" )" + fi + notify.debug "$FUNCNAME: -${rpmvar_expr[$i]}-> '$output'" + + # skip strings with no more variables inside + case "$output" in + *%*) ;; + *) notify.debug "$FUNCNAME: output = \`$output'" + echo "$output"; return ;; + esac + done + notify.debug "$FUNCNAME: output = \`$output'" + + # unexpanded variables beginning by '?' must become blank strings + # i.e. "%{?cross_target_cpu}" --> "" + notify.debug "\ +$FUNCNAME: * blank unexpanded and undefined variables beginning by \`?'..." + output=$(echo $output | sed "s@%{?[^}]*}@@g;s@%?[a-zA-Z0-9_]*@@") + notify.debug "$FUNCNAME: output = \`$output'" + + # expand rpm variables + # i.e. 'rpmvars.solve(%{__install_info} $specfile)' + case "$output" in *%*) + notify.debug "$FUNCNAME: * expanding rpm variables, if any..." + output=$(rpm --eval "$output") + notify.debug "$FUNCNAME: output = \`$output'" ;; + esac + + echo "$output" +} + + +# function specfile.getvars +# set the variable(s) given as argument to the value(s) found +# in the specfile preamble +# args: +# $v_! .. $v_n : specfile variables to resolve +# --specfile : specfile name and path +# --verbatim : do not expand variables +# --help +# usage example: +# specfile.getvars SPEC_NAME SPEC_VERSION SPEC_RELEASE +function specfile.getvars() { + local me="$FUNCNAME" + + { # (to make 'usage' a local function) + function usage() { + echo "\ +$me, "$"version"" @version@"" +Copyright (C) 2005,2010 Davide Madrisan "" + +"$"Get informations from a given specfile."" + +"$"Usage"": + $me -s [-v] [ [...]] + +"$"where the above options mean"": + -s, --specfile "$"name (and patch) of the specfile"" + -v, --verbatim "$"do not try to expand variables"" + +"$"and belongs to the following list"": + SPEC_NAME Name + SPEC_VERSION Version + SPEC_RELEASE Release + SPEC_GROUP "$"list of package groups"" (Group) + SPEC_BUILDARCH BuildArch + SPEC_BUILDROOT BuildRoot + SPEC_FILENAME "$"full name of the srpm package"" + SPEC_PATCH "$"list of patches"" (Patch[0-9]*) + SPEC_URL URL + SPEC_SOURCE0 Source[0] + SPEC_SOURCE0_PCKNAME "$"name of the source0 file"" + SPEC_SOURCE "$"list of source files"" (Source[0-9]*) + SPEC_LICENSE License + SPEC_TARGET "$"list of all the generated rpm packages"" + SPEC_OBSOLETES "$"list of the obsoleted packages"" + SPEC_BUILDREQUIRES "$"list of the declared build requirements"" + +"$"Operation modes"": + -h, --help "$"Print this help, then exit"" + +"$"Samples"": + $me -s /var/tmp/specs/@package@.spec SPEC_TARGET SPEC_VERSION + echo \"\${SPEC_TARGET[@]}, \$SPEC_VERSION\" # @package@, @version@ + +"$"Report bugs to ." + } + } + + local ARGS + ARGS=`LANG=C getopt -o hs:v --long help,specfile:,verbatim \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error" + + local specfile verbatim=0 + + eval set -- "$ARGS" + + while :; do + case "$1" in + -s|--specfile) + specfile="$2"; shift + notify.debug "$FUNCNAME: specfile = \"$specfile\"" + ;; + -v|--verbatim) + let "verbatim = 1" + notify.debug "$FUNCNAME: verbatim = \"1\"" + ;; + -h|--help) + usage + ${EXIT_FUNC:-"exit"} + ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error: bad command \`$1'" ;; + esac + shift + done + + [ "$specfile" ] || { usage; ${EXIT_FUNC:-"exit"} 1; } + + [ -r "$specfile" ] || + { # 'return' is required when 'EXIT_FUNC' is equal to 'return' + notify.error $"specfile not found"": \`$specfile'"; return; } + + [ -r "$infofile" ] && . $infofile + + # when this library is used by external scripts this assertion always fails +# [[ "${rpmvar_name[@]}" ]] || notify.warning $"\ +#(bug)"" -- $FUNCNAME: "$"assertion failed:"" \"\${rpmvar_name[@]}\" != \"\"" + + local ignore_lines # support for '## *AUTOSPEC-{OFF,ON}*' + let "ignore_lines = 0" + local var + + for var in $@; do + notify.debug "$FUNCNAME: expanding \`$var'..." + + case $var in + SPEC_NAME) + [ "$SPEC_NAME" ] && continue + SPEC_NAME=$(sed -n "/%description/q;{ # look in the spec preamble + /^[ \t]*Name/{s,^[ \t]*Name[ \t]*:[ \t]*,,p}}" $specfile) + # FIXME (by whitone) + # /^[ \t]*Name/{s,[^:]*:[ \t]*,,p}}" $specfile) + [[ "$(echo "$SPEC_NAME" | wc -w)" != 1 ]] && + notify.error $"bad specfile preamble"" (Name)" + # resolve the rpm variables, if any + #[ "$(echo $SPEC_NAME | sed -n "s,.*%,%,p")" ] && + SPEC_NAME=$(rpmvars.solve "$SPEC_NAME" "$specfile") + notify.debug "$FUNCNAME: $var = \"$SPEC_NAME\"" + ;; + SPEC_VERSION) + [ "$SPEC_VERSION" ] && continue + SPEC_VERSION=$(sed -n "/%description/q;{ + /^[ \t]*Version/{s,^[ \t]*Version[ \t]*:[ \t]*,,p}}" $specfile) + [[ "$(echo "$SPEC_VERSION" | wc -w)" != 1 ]] && + notify.error $"bad specfile preamble"" (Version)" + # resolve the rpm variables, if any + #[ "$(echo $SPEC_VERSION | sed -n "s,.*%,%,p")" ] && + SPEC_VERSION="$(rpmvars.solve "$SPEC_VERSION" "$specfile")" + notify.debug "$FUNCNAME: $var = \"$SPEC_VERSION\"" + ;; + SPEC_RELEASE) + [ "$SPEC_RELEASE" ] && continue + SPEC_RELEASE=$(sed -n "/%description/q;{ + /^[ \t]*Release/{s,.*:[ \t]*,,p}}" $specfile) + [[ "$(echo "$SPEC_RELEASE" | wc -w)" != 1 ]] && + notify.error $"bad specfile preamble"" (Release)" + # resolve the rpm variables, if any + #[[ "$(echo $SPEC_RELEASE | sed -n "s,.*%,%,p")" ]] && + SPEC_RELEASE=$(rpmvars.solve "$SPEC_RELEASE" "$specfile") + notify.debug "$FUNCNAME: $var = \"$SPEC_RELEASE\"" + ;; + SPEC_GROUP) + [ "$SPEC_GROUP" ] && continue + local linenum=0 + while read -r -a tok; do + let "linenum += 1" + + # do support '## *AUTOSPEC-{OFF,ON}*' blocks + if [ "${tok[0]}" = "##" ]; then + if [ "${tok[1]}" = "*AUTOSPEC-OFF*" ]; then + notify.debug "$FUNCNAME: found an AUTOSPEC-OFF command" + let "ignore_lines = 1" + continue + fi + + if [ "${tok[1]}" = "*AUTOSPEC-ON*" ]; then + notify.debug "$FUNCNAME: found an AUTOSPEC-ON command" + let "ignore_lines = 0" + continue + fi + elif [ "$ignore_lines" = "1" ]; then + # skip lines in the block "*AUTOSPEC-OFF*" .. "*AUTOSPEC-ON*" + notify.debug "$FUNCNAME: * line ignored -- ${tok[*]}" + continue + fi + + case ${tok[0]} in + Group|Group:) + unset tok[0] + notify.debug "\ +$FUNCNAME: * entry found at line $linenum: \"${tok[*]}\"" + SPEC_GROUP[${#SPEC_GROUP[*]}]="${tok[*]}" #` +# notify.debug "\ +#$FUNCNAME: SPEC_GROUP = ( ${SPEC_GROUP[*]} )" + ;; + esac + done < $specfile + + notify.debug "$FUNCNAME: $var = ( ${SPEC_GROUP[*]} )" + ;; + SPEC_FILENAME) + [ "$SPEC_FILENAME" ] && continue + [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile" SPEC_NAME + [ "$SPEC_VERSION" ] || specfile.getvars -s "$specfile" SPEC_VERSION + [ "$SPEC_RELEASE" ] || specfile.getvars -s "$specfile" SPEC_RELEASE + SPEC_FILENAME="\ +${SPEC_NAME}-${SPEC_VERSION}-${SPEC_RELEASE}.src.rpm" + + notify.debug "$FUNCNAME: $var = \"$SPEC_FILENAME\"" + ;; + SPEC_PATCH) + if [ "$verbatim" = "1" ]; then + [ "$SPEC_PATCH_VERBATIM" ] || + { SPEC_PATCH_VERBATIM=($(\ + sed -n "/%description/q;{ + /^[ \t]*Patch[0-9]*/{s,^Patch[0-9]*[ \t]*:[ \t]*,,p}}" \ + $specfile)) + notify.debug "\ +$FUNCNAME: SPEC_PATCH_VERBATIM = ( ${SPEC_PATCH_VERBATIM[*]} )" + } + continue + fi + + [ "$SPEC_PATCH" ] && continue + + [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile" SPEC_NAME + [ "$SPEC_VERSION" ] || specfile.getvars -s "$specfile" SPEC_VERSION + SPEC_PATCH=($(sed -n "/%description/q;{ + /^[ \t]*Patch[0-9]*/{s,^Patch[0-9]*[ \t]*:[ \t]*,,p}}" \ + $specfile)) + for i in $(seq 0 1 $((${#SPEC_PATCH[*]}-1))); do + SPEC_PATCH[$i]=$(\ +rpmvars.solve "${SPEC_PATCH[$i]}" "$specfile" | \ + sed -n "\ + s,%[{]*name[}]*,$SPEC_NAME, + s,%[{]*version[}]*,$SPEC_VERSION,;p" ) + done + notify.debug "$FUNCNAME: $var = ( ${SPEC_PATCH[*]} )" + ;; + SPEC_SOURCE0) + if [ "$verbatim" = "1" ]; then + [ "$SPEC_SOURCE0_VERBATIM" ] || + { SPEC_SOURCE0_VERBATIM=$(\ + sed -n "/%description/q;{ + /^[ \t]*Source[0]*/{s,[ \t]*Source[0]*[ \t]*:[ \t]*,,p}}" \ + $specfile) + notify.debug "\ +$FUNCNAME: SPEC_SOURCE0_VERBATIM = \"$SPEC_SOURCE0_VERBATIM\"" + } + continue + fi + + [ "$SPEC_SOURCE0" ] && continue + SPEC_SOURCE0=$(sed -n "/%description/q;{ + /^[ \t]*Source[0]*/{ + s,[ \t]*Source[0]*[ \t]*:[ \t]*,, + p}}" $specfile) + SPEC_SOURCE0=$(rpmvars.solve "$SPEC_SOURCE0" "$specfile") + notify.debug "$FUNCNAME: $var = \"$SPEC_SOURCE0\"" + ;; + SPEC_SOURCE0_PCKNAME) + [ "$SPEC_SOURCE0_PCKNAME" ] && continue + [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile" SPEC_NAME + [ "$SPEC_VERSION" ] || specfile.getvars -s "$specfile" SPEC_VERSION + [ "$SPEC_SOURCE0" ] || specfile.getvars -s "$specfile" SPEC_SOURCE0 + + SPEC_SOURCE0_PCKNAME=$(echo $SPEC_SOURCE0 | sed -n "\ + s,%[{]*name[}]*,$SPEC_NAME, + s,%[{]*version[}]*,$SPEC_VERSION, + s/.*\/// # remove directory name, if any + s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) + # + /^${SPEC_NAME}${SPEC_VERSION}$/{s,$SPEC_VERSION,,p;q} + /[^-\.][0-9]\./{s/\(.*[^-\.]\)[0-9]\..*/\1/p;q} + # - + /^${SPEC_NAME}\-${SPEC_VERSION}$/{s,\-${SPEC_VERSION},,p;q} + /-[0-9]\+/{s/-[0-9].*//p;q} + # _ + /^${SPEC_NAME}_${SPEC_VERSION}$/{s,_${SPEC_VERSION},,p;q} + /_[0-9]\+/{s/_[0-9].*//p;q} + # . + /^${SPEC_NAME}\.${SPEC_VERSION}$/{s,\.${SPEC_VERSION},,p;q} + /^[a-zA-Z0-9_]\+\.[0-9\.]\+$/{s,\(^[a-zA-Z0-9_]\+\)\.[0-9\.]\+$,\1,p;q} + /^[a-zA-Z0-9]\+$/{p;q} # (with no version) + # (no version, but can end with numbers) + /^[^0-9]*[0-9]*$/p") + notify.debug "$FUNCNAME: $var = \"$SPEC_SOURCE0_PCKNAME\"" + ;; + SPEC_SOURCE) + if [ "$verbatim" = 1 ]; then + SPEC_SOURCE_VERBATIM=($(sed -n "/%description/q;{ + /^[ \t]*Source/{ + s,[ \t]*Source[0-9]*[ \t]*:[ \t]*,, + p}}" $specfile)) + notify.debug "\ +$FUNCNAME: SPEC_SOURCE_VERBATIM = ( ${SPEC_SOURCE_VERBATIM[*]} )" + continue + fi + + [ "$SPEC_SOURCE" ] && continue + [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile" SPEC_NAME + [ "$SPEC_VERSION" ] || specfile.getvars -s "$specfile" SPEC_VERSION + # FIXME : spaces in source URL are not supported + SPEC_SOURCE=($(sed -n "/%description/q;{ + /^[ \t]*Source/{ + s,[ \t]*Source[0-9]*[ \t]*:[ \t]*,, + s,%[{]*name[}]*,$SPEC_NAME, + s,%[{]*version[}]*,${pck_newver:-$SPEC_VERSION}, + p}}" $specfile)) + + for i in $(seq 0 1 $((${#SPEC_SOURCE[*]} - 1))); do + SPEC_SOURCE[$i]=$(\ +rpmvars.solve "${SPEC_SOURCE[$i]}" "$specfile") + done + + notify.debug "$FUNCNAME: $var = ( ${SPEC_SOURCE[*]} )" + ;; + SPEC_LICENSE) + [ "$SPEC_LICENSE" ] && continue + unset SPEC_LICENSE tmp_spec_license + i=0 + while read tmp_spec_license; do + SPEC_LICENSE[$i]="$tmp_spec_license" + let "i = i+1" + done < <(sed -n "\ +/^[ \t]*License[ \t]*:/{s,.*:[ \t]*,,; +s,\,[ \t]*and[ \t]*,\n,; # remove ', and' +s,\,[ \t]*,\n,g;p} # remove ',' +/^[ \t]*License[ \t]*:/{s,.*:[ \t]*,,;s,\,[ \t]*,\n,g;p}" $specfile) +#-or- +#/%description/q;{ # look in the spec preamble +#/^[ \t]*License/{s,.*:[ \t]*,,;s,\,[ \t]*,\n,g;p}}" $specfile) + [[ "$(echo "$SPEC_LICENSE" | wc -w)" = 0 ]] && + notify.error $"bad specfile preamble"" (License)" + + notify.debug "$FUNCNAME: $var = ( \ +$(for i in $(seq 0 1 $((${#SPEC_LICENSE[*]} - 1))); do + echo -n "\"${SPEC_LICENSE[$i]}\" "; done))" + ;; + SPEC_URL) # note: 'SPEC_URL' is not yet used in this script + [ "$SPEC_URL" ] && continue + SPEC_URL=$(sed -n "/%description/q;{ +/^[ \t]*\(Url\|URL\)[ \t]*:/{s,[ \t]*\(Url\|URL\)[ \t]*:[ \t]*,,p}}" $specfile) + [[ "$(echo "$SPEC_URL" | wc -w)" != 1 ]] && + notify.error $"bad specfile preamble"" (URL)" + [ "$SPEC_URL" ] && + SPEC_URL=$(rpmvars.solve "$SPEC_URL" "$specfile") + notify.debug "$FUNCNAME: $var = \"$SPEC_URL\"" + ;; + SPEC_TARGET) + [ "$SPEC_TARGET" ] && continue + [ "$SPEC_NAME" ] || + specfile.getvars -s "$specfile" SPEC_NAME + + local ifexpr ifexpr_level level boolexpr tok toksave filesname + let "ifexpr_level = 0" # level of nested %if statements + ifexpr[0]="1" # '0' means: out of any %if statement + + local linenum=0 + while read -r -a tok; do + let "linenum += 1" + + # do support '## *AUTOSPEC-{OFF,ON}*' blocks + if [ "${tok[0]}" = "##" ]; then + if [ "${tok[1]}" = "*AUTOSPEC-OFF*" ]; then + notify.debug "$FUNCNAME: found an AUTOSPEC-OFF command" + let "ignore_lines = 1" + continue + fi + + if [ "${tok[1]}" = "*AUTOSPEC-ON*" ]; then + notify.debug "$FUNCNAME: found an AUTOSPEC-ON command" + let "ignore_lines = 0" + continue + fi + elif [ "$ignore_lines" = "1" ]; then + # skip lines in the block "*AUTOSPEC-OFF*" .. "*AUTOSPEC-ON*" + notify.debug "$FUNCNAME: * line ignored -- ${tok[*]}" + continue + fi + + case ${tok[0]} in + %if) + #ifexpr=$(rpmvars.solve "${tok2}${fromtok3}" "$specfile") + # note: if <%var> is undefined (not present) or set to "0" + # then the conditional expression is false else is true + let "ifexpr_level += 1" + let "ifexpr[$ifexpr_level] = 0" + + # note: to implement %if statements we must take into account + # the boolean values of the all previous ifexpr[] values + # starting from 1 to '$ifexpr_level' +# [ "$ifexpr_level" -gt 1 ] && notify.warning "\ +#$FUNCNAME: "$"FIXME: sorry, not implemented yet..."" (nested \`%if')" + + notify.debug "\ +$FUNCNAME: ${tok[0]} [level#$ifexpr_level; lineno#$linenum] -- ${tok[*]}" + + toksave=${tok[0]} + unset tok[0] + ifexpr[$ifexpr_level]=$(boolexpr.solve "${tok[*]}") + tok[0]=$toksave + ;; + %if[a-z]*) # %ifarch|%ifnarch|%ifdef + notify.warning "\ +$FUNCNAME: "$"FIXME: sorry, not implemented yet..."" (\`${tok[0]}')" + let "ifexpr_level += 1" + # FIXME: we should call 'boolexpr.solve' here: + # toksave=${tok[0]} + # unset tok[0] + # ifexpr[$ifexpr_level]=$(boolexpr.solve "${tok[*]}") + # tok[0]=$toksave + # for new we chooes a 50% right - 50% wrong approach :( + ifexpr[$ifexpr_level]=1 + ;; + %else) + notify.debug "\ +$FUNCNAME: ${tok[0]} [level#$ifexpr_level; line#$linenum]" + let "level = 0" + for level in $(seq 1 1 $ifexpr_level); do + # complement boolean values in %else blocks + if [ "${ifexpr[$level]}" = "0" ]; then + ifexpr[$level]=1 + notify.debug "$FUNCNAME: ifexpr[$level] = 0 --> 1" + else + ifexpr[$level]=0 + notify.debug "$FUNCNAME: ifexpr[$level] = 1 --> 0" + fi + done + ;; + %endif) + notify.debug "\ +$FUNCNAME: ${tok[0]} [level#$ifexpr_level; line#$linenum]]" + let "ifexpr_level -= 1" + ;; + %end) + notify.warning $"\`%end' found; should perhaps be \`%endif'" + ;; + %files) + let "level = 0" + for level in $(seq 1 1 $ifexpr_level); do + notify.debug "$FUNCNAME: ifexpr[$level] = ${ifexpr[$level]}" + [ "${ifexpr[$level]}" = "0" ] && + { # found a false condition + let "level = $ifexpr_level + 1"; break; } + done + # not all the conditions are true: skip this definition + + [ $level -gt $ifexpr_level ] && + { notify.debug "\ +$FUNCNAME: %file block found (${tok[*]}) [line#$linenum] ... skipped" + continue; } + + notify.debug "\ +$FUNCNAME: %file block found (${tok[*]})[line#$linenum]" + filesname="$( \ + rpmvars.solve "${tok[*]}" "$specfile" | \ + sed -n ' + # remove "%files" and "-f file-name" option if present + s,%files[ \t]*,,;s,-f[ \t]\+[^ ]*[ \t]*,,;p' )" + + case "$filesname" in + "") # main package + SPEC_TARGET=( ${SPEC_TARGET[@]} "$SPEC_NAME" ) + ;; + -n*) # -n + filesname="$(echo $filesname | sed 's,-n[ \t]\+,,')" + SPEC_TARGET=( \ +${SPEC_TARGET[*]} \ +"$(rpmvars.solve "$filesname" "$specfile")" ) + ;; + *) SPEC_TARGET=(\ +${SPEC_TARGET[*]} "$SPEC_NAME-$(\ +rpmvars.solve "$filesname" "$specfile")" ) + ;; + esac + notify.debug "$FUNCNAME: $var = ( ${SPEC_TARGET[*]} )" + ;; + *) if [[ -n "$rpm_macro_debug_package" && \ + "${tok[0]}" = "$rpm_macro_debug_package" ]]; then + # rpm macro for creating debug packages + SPEC_TARGET=( ${SPEC_TARGET[@]} \ + "${SPEC_NAME}-${rpm_macro_debug_package_suffix}" ) + fi + ;; + esac + done < $specfile + #notify.debug "$FUNCNAME: $var = ( ${SPEC_TARGET[*]} )" + ;; + SPEC_OBSOLETES) + # FIXME : should populate a vector with length '${#SPEC_TARGET[*]}' + # and with the entries ordered as in 'SPEC_TARGET[]', with '(none)' + # entries when no obsolete labels are found + + [ "$SPEC_OBSOLETES" ] && continue + [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile" SPEC_NAME + + local linenum=0 + while read -r -a tok; do + let "linenum += 1" + # do support '## *AUTOSPEC-{OFF,ON}*' blocks + if [ "${tok[0]}" = "##" ]; then + if [ "${tok[1]}" = "*AUTOSPEC-OFF*" ]; then + notify.debug "$FUNCNAME: found an AUTOSPEC-OFF command" + let "ignore_lines = 1" + continue + fi + + if [ "${tok[1]}" = "*AUTOSPEC-ON*" ]; then + notify.debug "$FUNCNAME: found an AUTOSPEC-ON command" + let "ignore_lines = 0" + continue + fi + elif [ "$ignore_lines" = "1" ]; then + # skip lines in the block "*AUTOSPEC-OFF*" .. "*AUTOSPEC-ON*" + notify.debug "$FUNCNAME: * line ignored -- ${tok[*]}" + continue + fi + + case ${tok[0]} in + Obsoletes|Obsoletes:) + unset tok[0] + notify.debug "\ +$FUNCNAME: * entry found at line $linenum: \"${tok[*]}\"" + SPEC_OBSOLETES[${#SPEC_OBSOLETES[*]}]="\ +$(rpmvars.solve "${tok[*]}" "$specfile")" + + notify.debug "\ +$FUNCNAME: SPEC_OBSOLETES = ( ${SPEC_OBSOLETES[*]} )" + ;; + esac + done < $specfile + + # SPEC_OBSOLETES=($(sed -n "\ + # /^[ \t]*Obsoletes[ \t]*:/{ + # s,[ \t]*Obsoletes[ \t]*:[ \t]*,, + # s,%[{]*name[}]*,$SPEC_NAME,;p}" \ + # $specfile)) + + notify.debug "$FUNCNAME: $var = ( ${SPEC_OBSOLETES[*]} )" + ;; + SPEC_BUILDARCH) + # note: 'SPEC_BUILDARCH' can be a null string + [ "$SPEC_BUILDARCH" ] && continue + # find for the tokens 'BuildArch' and 'BuildArchitecture' + SPEC_BUILDARCH=($(sed -n "\ + /^[ \t]*BuildArch[a-z]*[ \t]*:/{ + s,[ \t]*BuildArch[a-z]*[ \t]*:[ \t]*,,;{p}}" \ + $specfile)) + # use only the last 'BuiltArch' entry (rpm behaviour) + [ ${#SPEC_BUILDARCH[*]} -gt 1 ] && + SPEC_BUILDARCH="${SPEC_BUILDARCH[${#SPEC_BUILDARCH[*]}-1]}" # ` + notify.debug "$FUNCNAME: $var = ( ${SPEC_BUILDARCH[*]} )" + ;; + SPEC_BUILDREQUIRES) + [ "$SPEC_BUILDREQUIRES" ] && continue + local f rpm_provided_by + SPEC_BUILDREQUIRES=(`sed -n \ +'/^BuildRequires/{s,BuildRequires[ \t]*:[ \t]*,,p}' $specfile | \ + (IFS="$IFS,"; while read -a buildreqs; do + let "isver = 0" + for f in ${buildreqs[@]}; do + [ "$isver" = "1" ] && + { let "isver = 0"; continue; } + case "$f" in + # skip '<', '<=', '>', '>=', '=' version or %variable + \<*|\>*|=*) + let "isver = 1" + ;; + *%*) # rpm variable(s) (ex. '%{__install_info}') + echo "$(rpmvars.solve "$f" $specfile) " + ;; + *) echo "$f " ;; + esac + done + done)`) + notify.debug "$FUNCNAME: $var = ( ${SPEC_BUILDREQUIRES[*]} )" + ;; + SPEC_BUILDROOT) + if [ "$rpm_ignores_buildroot" != 1 ]; then + [ "$SPEC_BUILDROOT" ] && continue + [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile" SPEC_NAME + [ "$SPEC_VERSION" ] || specfile.getvars -s "$specfile" SPEC_VERSION + SPEC_BUILDROOT=(`sed -n "/%description/q;{ + /^[ \t]*BuildRoot/{ + s,[^ ]*[ \t]*:[ \t]*,, + s,%[{]*name[}]*,$SPEC_NAME, + s,%[{]*version[}]*,$SPEC_VERSION, + s,%[{]*release[}]*,$SPEC_RELEASE, + s,%[{]*_tmppath[}]*,$(rpm --eval=%{_tmppath}),;p + }}" $specfile`) + [ "$(echo "$SPEC_BUILDROOT" | wc -w)" = 1 ] || + notify.error $"bad specfile preamble"" (BuildRoot)" + [ "$SPEC_BUILDROOT" ] && + SPEC_BUILDROOT=$(rpmvars.solve "$SPEC_BUILDROOT" $specfile) + fi + notify.debug "$FUNCNAME: $var = $SPEC_BUILDROOT" + ;; + *) notify.error $"(bug)"" -- $FUNCNAME: "$"bad arg \`$var'" ;; + esac + + # note: some entries are not mandatory in a specfile + case "$var" in + "SPEC_SOURCE"|"SPEC_PATCH"|\ + "SPEC_OBSOLETES"|"SPEC_BUILDARCH"|"SPEC_BUILDREQUIRES") + ;; + *) if [[ "$var" = "SPEC_BUILDROOT" && \ + "$rpm_ignores_buildroot" = 1 ]]; then + : + else + [[ -z "${!var}" ]] && notify.error $"\ +cannot initialize \`$var' from specfile data" + #notify.debug "$FUNCNAME: $var = \"${!var}\"" + fi + ;; + esac + done +} + +# note: some examples of real package names +# - automake 1.8.5 automake-1.8.5.tar.bz2 +# - Xorg 6.7.0 X11R6.7.0-src1.tar.gz +# - hotplug 20040329 hotplug-2004_03_29.tar.gz +# - perl-Tk 800.025 Tk800.025.tar.gz +# - webalizer 2.0.1 webalizer-2.01-10-src.tgz + +# function getnamefromtarball +# get the package name from the tarball name +# args: +# $1 : tarball name +function getnamefromtarball() { + local pck_name=`echo $1 | sed -n "\ + s,.*/,, # remove directory name, if any + s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) + /[^-]\+-[0-9]\+/{s/\([^-]*\)-[0-9].*/\1/p;q} # - + /[^-\.][0-9]\./{s/\(.*[^-\.]\)[0-9]\..*/\1/p;q} # + # (no version, but can end with numbers) + /^[^0-9]*[0-9]*$/p"` + + notify.debug "$FUNCNAME: pck_name = \"$pck_name\"" + echo "$pck_name" +} + +# function getversionfromtarball +# get the package version from the tarball name +# args: +# $1 : tarball name +function getversionfromtarball() { + local pck_version=`echo $1 | sed -n "\ + /[0-9]/!q # return nothing if no number is found in the package name + s,.*/,, # remove directory name, if any + s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) + /-[0-9]*/{s/.*-\([0-9]*.*\)/\1/p;q} # - + /[^-\.][0-9]\./{s/.*[^-\.]\([0-9]\..*\)/\1/p;q} # + # (no version, but can end with numbers) + /^[^0-9]*[0-9]*$/q"` + + notify.debug "$FUNCNAME: pck_version = \"$pck_version\"" + echo "$pck_version" +} diff --git a/man/it/Makefile b/man/it/Makefile new file mode 100644 index 0000000..e8dee2a --- /dev/null +++ b/man/it/Makefile @@ -0,0 +1,40 @@ +# Makefile for autospec +# Copyright (C) 2008 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +srcdir = ../.. + +include $(srcdir)/Makefile.env + +LANG=it + +pck_manpages := autospec.1 + +all: + +install: $(pck_manpages) + $(INSTALL_DIR) $(DESTDIR)$(mandir)/$(LANG)/man1;\ + for f in $(pck_manpages); do\ + $(INSTALL_DATA) $${f} $(DESTDIR)$(mandir)/$(LANG)/man1/$${f};\ + done + +uninstall: + @for f in $(pck_manpages); do\ + echo "rm -f $(DESTDIR)$(mandir)/$(LANG)/man1/$${f}";\ + rm -f $(DESTDIR)$(mandir)/$(LANG)/man1/$${f};\ + done + +clean: + rm -f $(pck_manpages) diff --git a/man/it/autospec.1.in b/man/it/autospec.1.in new file mode 100644 index 0000000..3d9c3a1 --- /dev/null +++ b/man/it/autospec.1.in @@ -0,0 +1,316 @@ +.TH AUTOSPEC "9" "@date_my@" "@package@ @version@" "User Commands" +.SH NOME +\fB@package@\fR - script di frontend per la creazione e l'aggiornamento e la verifica di pacchetti rpm. +.br +\fBconfig-getvar\fR - plugin per la visualizzazione di variabili presenti nei file di configurazione di autospec. +.br +\fBpck-extract\fR - plugin per l'estrazione di file da archivi srpm. +.br +\fBpck-update\fR - plugin per l'aggiornamento di archivi rpm. +.br +\fBspec-create\fR - plugin per la creazione di archivi rpm. +.br +\fB@pck_lib@\fR - libreria di funzioni per l'analisi degli specfile. + +.SH VERSIONE +Questo documento e' aggiornato alla versione 1.8.0 di @package@. + +.SH DESCRIZIONE +@package@ e' una suite di script che permette di velocizzare ed automatizzare una parte +delle operazioni necessarie alla creazione, al mantenimento (aggiornamento) dei pacchetti +rpm di una intera distribuzione ed al controllo di comuni errori e vulnerabilita'. +.br +@package@ e' modulare ed altamente configurabile e quindi facilmente adattabile alle +particolarita' specifiche di ogni distribuzione basata su pacchetti rpm. +.br +@package@ fornisce inoltre la libreria @pck_lib@, utilizzabile anche da script di shell +esterni per ricavare in modo semplice informazioni su un qualsiasi specfile dato in input. + +.SH FILE DI CONFIGURAZIONE +@package@ legge all'avvio in primo luogo il file globale \fI@sysconfdir@/@pck_conf@\fR +e quindi i file privati dell'utente: \fI~/.@package@\fR e/o \fI~/.@package@.d/*.conf\fR. +E' buona norma non modificare direttamente il file globale. +Utilizzare i file privati per tale scopo. + +.SH SINTASSI +@package@ e' lo script principale ed ha funzione di frontend per una serie di script e +librerie specializzate. +Per questo motivo sono possibili differenti modalita' distinte di utilizzo. +Si ricorda che le opzioni indicate tra parentesi quadre sono opzionali. + +.SS "Creazione di specfile" +\fB@package@\fR \ +\fB\-s\fR \fItarball\fR \ +[\fB\-n\fR \fIname\fR] \ +[\fB\-v\fR \fIver\fR] \ +[\fB\-t\fR \fItype\fR] \ +[\fB\-o\fR \fIoutfile\fR] +.TP +\fB\-s\fR, \fB\-\-source\fR +cerca di creare uno specfile per il \fItarball\fR indicato +.TP +\fB\-n\fR, \fB\-\-pck\-name\fR +nome del pacchetto (default: ricavato dal nome del tarball) +.TP +\fB\-v\fR, \fB\-\-pck\-version\fR +versione del pacchetto (default: ricavato dal nome del tarball) +.TP +\fB\-t\fR, \fB\-\-type\fR +categoria dello specfile da generare: +.br +\fIstandard\fR : specfile standard (default) +.br +\fIgnome\fR : specfile per pacchetti gnome +.br +\fIkde3\fR : specfile per pacchetti kde3 +.br +\fIkde4\fR : specfile per pacchetti kde4 +.br +\fIlibrary\fR : specfile per librerie +.br +\fIlibrarytools\fR : specfile per librerie con tool +.br +\fIperl\fR : specfile per singoli moduli perl +.br +\fIpython\fR : specfile per moduli python +.br +\fIstandard-daemon\fR : specfile per servizi di sistema/rete +.TP +\fB\-o\fR, \fB\-\-output\fR +redirige lo standard output sul file \fIoutfile\fR + +.SS "Aggiornamento di pacchetti rpm" +\fB@package@\fR \ +\fB\-u\fR \fIpck\fR \fB\-a\fR \fIlst\fR [\fIver\fR] [\fIrel\fR] \ +[\fB\-d\fR \fIv1=r1\fR[,\fIv2=r2\fR,...]] \ +[\fB\-\-server\-download\fR \fIint\fR] \ +[\fB\-\-server\-upload\fR \fIint\fR] \ +[\fB\-l\fR \fIusr\fR:\fIpswd\fR] \ +[\fB\-S\fR \fIspecfile\fR] \ +[\fB\-A\fR \fIarch\fR] \ +[\fB\-\-changelog\fR "\fImsg\fR" ] \ +[\fB\-\-nosrpm\fR|\fB\-\-norpm\fR] \ +[\fB\-\-force-update\fR] [\fB\-\-force-build\fR] [\fB\-\-force-install\fR] \ +[\fB\-\-ignore-test \fIt1\fR[,\fIt2\fR,...]\fR] \ +[\fB\-c\fR] [\fB\-f\fR] [\fB\-L\fR] [\fB\-R\fR] +.TP +\fB\-u\fR, \fB\-\-update\fR +aggiorna automaticamente il pacchetto \fIpck\fR, versione \fIver\fR, +release \fIrel\fR +.TP +\fB\-a\fR, \fB\-\-action\fR +Esegue la lista di azioni separate da virgole \fIlst\fR +.br +\fI0\fR. indica le versioni del pacchetto disponibili nei repository +.br +\fI1\fR. download ed installazione del pacchetto srpm +.br +\fI2\fR. controlla se e' disponibile un aggiornamento +.br +\fI3\fR. download dei nuovi file sorgente +.br +\fI4\fR. aggiornamento e controllo dello specfile +.br +\fI5\fR. creazione dei pacchetti rpm e srpm +.br +\fI6\fR. creazione della lista dei build requirement +.br +\fI7\fR. simulazione dell'installazione dei pacchetti rpm +.br +\fI8\fR. esecuzione dei test di qualita' e sicurezza +.br +\fI9\fR. calcolo dei valori di hashing md5 e sha1 +.br +\fI10\fR. upload dei nuovi pacchetti sul sito ftp, +rimozione dei vecchi pacchetti dal sito ftp +(backup in `$ftp_rw_old_dir', se la variabile e' definita) +.br +\fI11\fR. installazione dei nuovi pacchetti rpm +.TP +\fB\-\-force-update\fR +forza l'aggiornamento dei pacchetti rpm e srpm +.TP +\fB\-\-force-build\fR +ricrea comunque i pacchetti rpm e srpm +.TP +\fB\-\-force-install\fR +installa i nuovi pacchetti anche in caso di errori rpm +.TP +\fB\-\-force\-download +scarica i file sorgente anche se presenti in SOURCE +.TP +\fB\-\-force\fR +cerca di eseguire comunque le azioni specificate +.TP +\fB\-\-ignore-test +non esegue i test indicati (\fIt1\fR, \fIt2\fR,...) +.TP +\fB\-d\fR, \fB\-\-define\fR +assegna alle variabili \fIv1\fR, \fIv2\fR,... i valori \fIr1\fR, \fIr2\fR,... +.TP +\fB\-\-server\-download\fR +server da utilizzare nel download dei pacchetti +.TP +\fB\-\-server-upload\fR +server dove effettuare l'upload dei pacchetti +.TP +\fB\-\-server\fR +server per l'upload e il download dei pacchetti +.TP +\fB\-l\fR, \fB\-\-login\fR +user \fIusr\fR e password \fIpswd\fR per effettuare l'upload sul sito FTP +.TP +\fB\-S\fR, \fB\-\-specfile\fR +nome dello specfile (default: \fIname\fR.spec) +.TP +\fB\-A\fR, \fB\-\-arch\fR +forza un valore per l'architettura +.TP +\fB\-\-changelog\fR +scrive il messaggio \fImsg\fR nel changelog del pacchetto +(utilizzare `\en' come terminatore di linea in caso di messaggi multilinea) +.TP +\fB\-\-nosrpm\fR +crea soltanto i pacchetti rpm (azione 5) +.br +non effettua l'upload del pacchetto srpm (azione 10) +.TP +\fB\-\-norpm\fR +crea soltanto il pacchetto srpm (azione 5) +.br +non effettua l'upload dei pacchetti rpm (azione 10) +.TP +\fB\-c\fR, \fB\-\-clear\fR +rimuove tutti i file temporanei +.TP +\fB\-f\fR, \fB\-\-format\fR +abilita la riformattazione dello specfile +.TP +\fB\-L\fR, \fB\-\-log\fR +abilita il log su file (nella directory: `$logging_dir') +.TP +\fB\-R\fR, \fB\-\-rebuild\fR +attiva modalita' ed impostazioni di rebuild (azione 4) +.TP +\fB\-R\fR, \fB\-\-root\fR +definisce una root directory alternativa per rpm + +.SS "Estrazione di file da pacchetti srpm" +\fB@package@\fR \ +\fB\-x\fR \fB\-F\fR \fIfile(s)\fR [\fB\-\-destdir\fR=\fIdir\fR] \fIsrpm_pck\fR +.TP +\fB\-x\fR, \fB\-\-extract\fR +estrae dal pacchetto srpm \fIsrpm_pck\fR... +.TP +\fB\-F\fR, \fB\-\-files\fR +\&...il file o la lista di file \fIfile(s)\fR +.TP +\fB\-\-destdir\fR +salva i file estratti nella cartella \fIdir\fR + +.SS "Richiesta del valore di variabili presenti nei file di configurazione" +\fB@package@\fR \ +[\fB\-C\fR \fIconf_file\fR] \fB\-\-eval\fR=\fIvar\fR +.TP +\fB\-C\fR, \fB\-\-config\fR +utilizza un file di configurazione alternativo \fIconf_file\fR +.br +file di default: \fI@sysconfdir@/@pck_conf@\fR, \fI~/.@package@\fR +.TP +\fB\-\-eval\fR +stampa il valore che \fIvar\fR assume nei file di configurazione + +.SS "Modalita' operative" +Sono inoltre disponibili alcune opzioni standard ed alcune opzioni di uso generale +che influenzano il tipo di output generato. +.TP +\fB\-h\fR, \fB\-\-help\fR +stampa una schermata di aiuto e termina il programma +.TP +\fB\-V\fR, \fB\-\-version\fR +stampa il numero di versione e termina il programma +.TP +\fB\-q\fR, \fB\-\-quiet\fR +non stampa alcun dettaglio delle operazioni in esecuzione +.TP +\fB\-r\fR, \fB\-\-colorize\fR +abilita l'output colorato +.TP +\fB\-D\fR, \fB\-\-debug\fR +attiva la modalita' di debugging (output prolisso) + +.SH "ESEMPI" +.B +@package@ +\fB\-s\fR ~/software/@package@\-@version@.tar.bz2 \fB\-t\fR standard \fB\-o\fR @package@.spec +.br +.B +@package@ +\fB\-s\fR ftp://ftp.gnu.org/pub/gnu/bash/bash-3.2.tar.gz +.br +.B +@package@ +\fB\-u\fR @package@ @version@ \fB\-a\fR4 \fB\-f\fR \fB\-\-changelog\fR "changelog entry" +.br +.B +@package@ +\fB\-\-log\fR \fB\-u\fR @package@ \fB\-a\fR5,7:9 \fB\-\-define\fR addons_ver=0.9 +.br +.B +@package@ +\fB\-c\fR \fB\-u\fR \fB\-l\fR usr:pswd @package@ @version@ \fB\-a\fR10 \fB--server-upload\fR=0 +.br +.B +@package@ +\fB\-u\fR @package@ \fB\-a\fR1,4,5 \fB\-\-arch\fR=noarch \fB\-\-rebuild\fR \fB\-\-ignore-test\fR 6,7 +.br +.B +@package@ +\fB\-u\fR @package@ \fB\-a\fR10 \fB\-\-norpm\fR \fB\-S\fR /var/tmp/specs/@package@.spec +.br +.B +@package@ +\fB\-u\fR @package@ \fB\-a\fR11 \fB\-\-force\fR +.br +.B +@package@ +\fB\-x\fR @package@\-@version@\-1mamba.src.rpm \fB\-F\fR \e*.spec \fB\-\-destdir=\fR/tmp/specs +.br +.B +@package@ +\fB\-q\fR \fB\-C\fR @sysconfdir@/@package@.conf \fB\-\-eval=\fR"logging_dir" + +.SH AUTORI +Davide Madrisan +.br +Creatore e sviluppatore principale di @package@ (frontend, plugin, libspec.lib, documentazione). + +Stefano Cotta Ramusino (whitone) +.br +Patch varie. Controllo delle licenze indicati negli specfile. +Modulo \fIAPSE\fR (Autospec Package Search Engine). +Modularizzare dei file di configurazione personali di @package@. + +Silvan Calarco +.br +Diverse patch, attivita' diffusa di beta testing. +Codice per la generazione automatica della lista dei build requirements. +Mofiche per permettere l'utilizzo di autospec in multi-architettura. + +.SH VEDERE ANCHE +file:///usr/share/doc/@package@-@version@/@package@-it-HOWTO + +.SH "BACHI" +Inviare patch, segnalazioni di bachi, richieste di funzionalita' a . +.br +Nel caso di bachi riscontrati, effettuarne una descrizione accurata e possibilmente un modo per riprodurli. + +.SH COPYRIGHT +Copyright (C) 2004\-2011 Davide Madrisan +.br +.br +Questo e' software libero. E' possibile redistribuirlo e/o modificarlo nei termini +della GNU General Public License versione 2 cosi' come pubblicata dalla +Free Software Foundation. +Non e' fornita ALCUNA garanzia, neppure di NEGOZIABILITA' o di APPLICABILITA' +PER UN PARTICOLARE SCOPO. diff --git a/patches/.directory b/patches/.directory new file mode 100644 index 0000000..eefde69 --- /dev/null +++ b/patches/.directory @@ -0,0 +1,3 @@ +[Dolphin] +Timestamp=2010,5,12,21,50,33 +ViewMode=1 diff --git a/patches/Download di autospec-1.7.3-fix_autobuildreq_with_rpm5.patch openmamba.txt b/patches/Download di autospec-1.7.3-fix_autobuildreq_with_rpm5.patch openmamba.txt new file mode 100644 index 0000000..3dc5492 --- /dev/null +++ b/patches/Download di autospec-1.7.3-fix_autobuildreq_with_rpm5.patch openmamba.txt @@ -0,0 +1,21 @@ +diff -Nru autospec-1.7.3.orig//plugins/pck-update.in autospec-1.7.3/plugins/pck-update.in +--- autospec-1.7.3.orig//plugins/pck-update.in 2011-01-09 18:13:09.000000000 +0100 ++++ autospec-1.7.3/plugins/pck-update.in 2011-03-23 19:54:56.180218040 +0100 +@@ -2366,13 +2366,13 @@ + if [ ! -e $solibpath -a "${solibpath:0:5}" = "/lib/" ]; then + solibpath="/usr$solibpath" + fi +- buildreq=`rpm -qf $solibpath 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` +- if [ ! "$buildreq" ]; then ++ eval buildreq=`rpm -qf $solibpath 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` 2>/dev/null ++ if [ ! "$buildreq" -o $? -ne 0 ]; then + # let's try removing version extension in libname + # (eg. liblber-2.2.so => liblber.so) + solibpath=`echo $solibpath | sed "s|-[0-9.]*\.so|.so|"` +- buildreq=`rpm -qf $solibpath 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` +- [ ! "$buildreq" ] && echo "#$req: .so link not found" >> $frequires ++ eval buildreq=`rpm -qf $solibpath 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` 2>/dev/null ++ [ ! "$buildreq" -o $? -ne 0 ] && echo "#$req: .so link not found" >> $frequires + fi + else + echo "\ diff --git a/patches/autospec-1.2.2-localedir.patch b/patches/autospec-1.2.2-localedir.patch new file mode 100644 index 0000000..9bb55ff --- /dev/null +++ b/patches/autospec-1.2.2-localedir.patch @@ -0,0 +1,11 @@ +--- /usr/share/autospec/plugins/pck-update.orig 2008-10-02 10:20:52.000000000 +0200 ++++ /usr/share/autospec/plugins/pck-update 2008-09-26 18:19:05.000000000 +0200 +@@ -368,7 +368,7 @@ + + notify.note " * "$"running test"" $arg (%find_lang)..." + # FIXME : the test should perhaps be improved... +- grep -q "^[ ]*[^# ]*/locale/" $specfile || continue ++ grep -q "^[ ]*[^# ]*/share/locale/" $specfile || continue + + notify.error $"\ + "$"localization files must be packaged via \`%find_lang'""${NORM} diff --git a/patches/autospec-1.4.13-rpmbuild_test_pass_variables.patch b/patches/autospec-1.4.13-rpmbuild_test_pass_variables.patch new file mode 100644 index 0000000..9a9651e --- /dev/null +++ b/patches/autospec-1.4.13-rpmbuild_test_pass_variables.patch @@ -0,0 +1,50 @@ +--- pck-update 2010-03-07 17:26:00.653388973 +0100 ++++ /usr/bin/pck-update 2010-03-07 17:25:45.000000000 +0100 +@@ -2117,12 +2117,12 @@ + done + + local rpmbuild_opts="\ +- --define \"%_srcrpmdir $srpms_dir\" \ +- --define \"%_rpmdir $rpms_dir\" \ +- --define \"%_specdir $spec_dir\" \ +- --define \"%_sourcedir $source_dir\" \ +- --define \"%_builddir $build_dir\" \ +- --define \"%_tmppath $tmppath_dir\"" ++ --define=\"%_srcrpmdir $srpms_dir\" \ ++ --define=\"%_rpmdir $rpms_dir\" \ ++ --define=\"%_specdir $spec_dir\" \ ++ --define=\"%_sourcedir $source_dir\" \ ++ --define=\"%_builddir $build_dir\" \ ++ --define=\"%_tmppath $tmppath_dir\"" + + # check if we are cross-compiling + [ "$BUILD_ARCH" != "$target_cpu" ] && +@@ -2130,20 +2130,21 @@ + + [ "$cleanup" = "1" ] && rpmbuild_opts="$rpmbuild_opts --clean" + ++ local rpmdefine_opts="\ ++$(for i in `seq 1 1 ${#define_list_name[*]}`; do ++echo -n " --define=\"${define_list_name[$i-1]} ${define_list_value[$i-1]}\"" ++done)" ++ notify.debug "rpmdefine_opts = \"$rpmdefine_opts\"" ++ + # note: exit with error when build requirements are missing + notify.note "${NOTE}"$"testing out specfile""${NORM}..." +- rpmbuild --nobuild --define "%_sourcedir $source_dir" \ +- $spec_dir/$SRPM_SPECFILE 2>&1 || ++ eval "\ ++rpmbuild --nobuild $rpmbuild_opts $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" || + notify.error $"rpmbuild exited with error code \`$?'" + + notify.debug "define_list_name = (${define_list_name[*]})" + notify.debug "define_list_value = (${define_list_value[*]})" + +- local rpmdefine_opts="\ +-$(for i in `seq 1 1 ${#define_list_name[*]}`; do +-echo -n " --define=\"${define_list_name[$i-1]} ${define_list_value[$i-1]}\"" +-done)" +- notify.debug "rpmdefine_opts = \"$rpmdefine_opts\"" + + if [ "$norpms" = 1 ]; then + notify.note "\ diff --git a/patches/autospec-1.4.14-add_rpm_root_option.patch b/patches/autospec-1.4.14-add_rpm_root_option.patch new file mode 100644 index 0000000..b9f6e50 --- /dev/null +++ b/patches/autospec-1.4.14-add_rpm_root_option.patch @@ -0,0 +1,79 @@ +--- plugins/pck-update.in 2010-03-12 19:52:44.000000000 +0100 ++++ /usr/bin/pck-update 2010-03-22 00:56:15.000000000 +0100 +@@ -142,6 +142,7 @@ + -f, --format "$"Enable specfile autoformatting"" + -L, --log "$"Unable logging to file (logging dir: \`\$logging_dir')"" + -R, --rebuild "$"Enable rebuilding mode and settings (action 4 only)"" ++ --root "$"Specify an alternative root directory to rpm"" + + "$"Operation modes"": + -h, --help "$"Print this help, then exit"" +@@ -191,7 +192,7 @@ + force-update,force-build,force-install,force,\ + ignore-test:,clear,format,log,rebuild,\ + debug,quiet,colorize,help,version,\ +-frontend_opts: \ ++frontend_opts:,root: \ + -n "$me" -- "$@"` + [ $? = 0 ] || exit 1 + +@@ -263,6 +264,8 @@ + let "verbose = 0" ;; + -r|--colorize) + let "colorize = 1" ;; ++ --root) ++ rpm_root_opts="-r $2"; shift ;; + -h|--help) + usage 0 ;; + -V|--version) +@@ -2122,11 +2125,12 @@ + --define=\"%_specdir $spec_dir\" \ + --define=\"%_sourcedir $source_dir\" \ + --define=\"%_builddir $build_dir\" \ +- --define=\"%_tmppath $tmppath_dir\"" ++ --define=\"%_tmppath $tmppath_dir\" \ ++ $rpm_root_opts" + + # check if we are cross-compiling + [ "$BUILD_ARCH" != "$target_cpu" ] && +- rpmbuild_opts="--target $target_cpu" ++ rpmbuild_opts="$rpmbuild_opts --target $target_cpu" + + [ "$cleanup" = "1" ] && rpmbuild_opts="$rpmbuild_opts --clean" + +@@ -2140,7 +2144,6 @@ + notify.note "${NOTE}"$"testing out specfile""${NORM}..." + eval "rpmbuild --nobuild \ + $rpmbuild_opts $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" || +- $spec_dir/$SRPM_SPECFILE 2>&1 || + notify.error $"rpmbuild exited with error code \`$?'" + + notify.debug "define_list_name = (${define_list_name[*]})" +@@ -2140,7 +2144,6 @@ + notify.note "${NOTE}"$"testing out specfile""${NORM}..." + eval "rpmbuild --nobuild \ + $rpmbuild_opts $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" || +- $spec_dir/$SRPM_SPECFILE 2>&1 || + notify.error $"rpmbuild exited with error code \`$?'" + + notify.debug "define_list_name = (${define_list_name[*]})" +@@ -2362,7 +2365,7 @@ + notify.error $"package not found"": \`$filename'" + done + +- rpm -U --test \ ++ rpm -U --test $rpm_root_opts \ + $(for pck in ${SPEC_TARGET[*]}; do + echo -n "$rpms_dir/$target_cpu/\ + $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm " +@@ -3083,8 +3086,8 @@ + else + [ "$rpm_install" ] || notify.error "\ + \`rpm_install': "$"unset in the configuration files" +- notify.debug "$rpm_install $pck2install_list" +- $rpm_install $pck2install_list || ++ notify.debug "$rpm_install $pck2install_list $rpm_root_opts" ++ $rpm_install $pck2install_list $rpm_root_opts || + notify.error $"cannot install the new rpm packages" + fi + fi diff --git a/patches/autospec-1.4.15-libapse_sourceforge.patch b/patches/autospec-1.4.15-libapse_sourceforge.patch new file mode 100644 index 0000000..ce64091 --- /dev/null +++ b/patches/autospec-1.4.15-libapse_sourceforge.patch @@ -0,0 +1,59 @@ +--- autospec-1.4.15/lib/libapse.lib.in.orig 2010-01-12 22:46:27.000000000 +0100 ++++ autospec-1.4.15/lib/libapse.lib.in 2010-03-26 13:28:14.000000000 +0100 +@@ -397,6 +397,56 @@ + fi + fi + ++ # sourceforge.net, sf.net ++ ++ local prj_name ++ ++ if [ "$(echo $pckurl | grep "sourceforge.net\|sf.net")" ]; then ++ notify.note $"looking at"" <${NOTE}http://sourceforge.net${NORM}>..." ++ ++ prj_name=$(echo "$pckurl" | sed -n 's,.*/\(.*\)/.*,\1,p') ++ [ "$prj_name" ] || notify.error $"\ ++(bug)"" -- $FUNCNAME: "$"assertion failed:"" \"\$prj_name\" != \"\"" ++ ++ curr_curl_url="http://sourceforge.net/projects/$prj_name" ++ notify.debug "curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\"" ++ curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout ++ ++ let "retval = $?" ++ case "$retval" in ++ 0) ;; ++ 7) notify.warning $"failed to connect to host" ;; ++ *) notify.warning $"curl error (exit code: $retval)" ;; ++ esac ++ ++ [ "$retval" = "0" ] && ++ if [ "$(sed -n "s,.*Invalid Project.*,error,pi" $fcurlout)" != \ ++ "error" ]; then ++ [ "$src_name" ] || src_name="$specname" ++ ++ pck_file=`grep -i -m1 "/download" $fcurlout | \ ++grep -i "$src_name" | \ ++sed -n "s,.*\"\([^\"]*\)\/download\".*,\1,pi"` ++ notify.debug "pck_file = \"$pck_file\"" ++ [ "$src_name" ] && unset src_name ++ ++ new_version=`echo $pck_file | sed -n "\ ++/[0-9]/!q # return nothing if no number is found in the package name ++s,.*/,, # remove directory name, if any ++s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) ++/-[0-9]*/{s/.*-\([0-9]*.*\)/\1/p;q} # - ++/_[0-9]*/{s/.*_\([0-9]*.*\)/\1/p;q} # _ ++/[^-\.][0-9]\./{s/.*[^-\.]\([0-9]\..*\)/\1/p;q} # ++# (no version, but can end with numbers) ++/^[^0-9]*[0-9]*$/q"` ++ fi ++ fi ++ ++ if [ "$new_version" ]; then ++ notify.note "* "$"found version:"" \`${NOTE}$new_version${NORM}'" ++ last_version="$new_version" ++ fi ++ + # check at the other supported web sites... + + # skip perl packages to prevent name confusion; these are checked above via Source0 diff --git a/patches/autospec-1.4.15-pass_target_before_defines.patch b/patches/autospec-1.4.15-pass_target_before_defines.patch new file mode 100644 index 0000000..dc569ba --- /dev/null +++ b/patches/autospec-1.4.15-pass_target_before_defines.patch @@ -0,0 +1,12 @@ +diff -Nru autospec-1.4.15.orig//plugins/pck-update.in autospec-1.4.15/plugins/pck-update.in +--- autospec-1.4.15.orig//plugins/pck-update.in 2010-03-24 21:40:44.000000000 +0100 ++++ autospec-1.4.15/plugins/pck-update.in 2010-04-03 14:13:54.314056254 +0200 +@@ -2138,7 +2138,7 @@ + + # check if we are cross-compiling + [ "$BUILD_ARCH" != "$target_cpu" ] && +- rpmbuild_opts="$rpmbuild_opts --target $target_cpu" ++ rpmbuild_opts="--target $target_cpu $rpmbuild_opts" + + [ "$cleanup" = "1" ] && rpmbuild_opts="$rpmbuild_opts --clean" + diff --git a/patches/autospec-1.4.16-dont_pass_root_to_rpmbuild.patch b/patches/autospec-1.4.16-dont_pass_root_to_rpmbuild.patch new file mode 100644 index 0000000..d044ffe --- /dev/null +++ b/patches/autospec-1.4.16-dont_pass_root_to_rpmbuild.patch @@ -0,0 +1,41 @@ +diff -Nru autospec-1.4.16.orig//plugins/pck-update.in autospec-1.4.16/plugins/pck-update.in +--- autospec-1.4.16.orig//plugins/pck-update.in 2010-05-06 14:59:25.501216204 +0200 ++++ autospec-1.4.16/plugins/pck-update.in 2010-05-06 15:01:13.467091646 +0200 +@@ -2137,9 +2137,6 @@ + --define=\"%_builddir $build_dir\" \ + --define=\"%_tmppath $tmppath_dir\"" + +- [ "$rpm_rootdir" ] && +- rpmbuild_opts="$rpmbuild_opts $rpm_root_opts" +- + # check if we are cross-compiling + [ "$BUILD_ARCH" != "$target_cpu" ] && + rpmbuild_opts="--target $target_cpu $rpmbuild_opts" +@@ -2155,7 +2152,7 @@ + # note: exit with error when build requirements are missing + notify.note "${NOTE}"$"testing out specfile""${NORM}..." + eval "rpmbuild --nobuild \ +-$rpmbuild_opts $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" || ++$rpmbuild_opts $rpm_root_opts $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" || + notify.error $"rpmbuild exited with error code \`$?'" + + notify.debug "define_list_name = (${define_list_name[*]})" +@@ -2199,15 +2196,15 @@ + elif [ "$norpms" = 1 ]; then + notify.note "${NOTE}"$"building the srpm package""${NORM}..." + eval "\ +-rpmbuild -bs $rpmbuild_opts $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" ++rpmbuild -bs $rpmbuild_opts --nodeps $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" + elif [ "$nosrpm" = 1 ]; then + notify.note "${NOTE}"$"building the rpm packages""${NORM}..." + eval "\ +-rpmbuild -bb $rpmbuild_opts $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" ++rpmbuild -bb $rpmbuild_opts --nodeps $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" + else + notify.note "${NOTE}"$"building rpm and srpm packages""${NORM}..." + eval "\ +-rpmbuild -ba $rpmbuild_opts $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" ++rpmbuild -ba $rpmbuild_opts --nodeps $spec_dir/$SRPM_SPECFILE $rpmdefine_opts 2>&1" + fi + [ $? -eq 0 ] || + notify.error $"rpmbuild exited with error code \`$?'" diff --git a/patches/autospec-1.4.16-pass_root_opts_to_whatprovides.patch b/patches/autospec-1.4.16-pass_root_opts_to_whatprovides.patch new file mode 100644 index 0000000..6c2e0b2 --- /dev/null +++ b/patches/autospec-1.4.16-pass_root_opts_to_whatprovides.patch @@ -0,0 +1,15 @@ +diff -Nru autospec-1.4.16.orig//plugins/pck-update.in autospec-1.4.16/plugins/pck-update.in +--- autospec-1.4.16.orig//plugins/pck-update.in 2010-05-06 14:57:00.523842465 +0200 ++++ autospec-1.4.16/plugins/pck-update.in 2010-05-06 14:58:14.009216091 +0200 +@@ -2041,9 +2041,9 @@ + local f rpm_provided_by buildrequirements_to_install + for f in ${SPEC_BUILDREQUIRES[@]}; do + unset rpm_provided_by +- rpm --quiet -q --whatprovides $f &>/dev/null ++ rpm --quiet -q $rpm_root_opts --whatprovides $f &>/dev/null + [ $? -eq 0 ] && +- rpm_provided_by="$(rpm -q --whatprovides $f)" ++ rpm_provided_by="$(rpm -q $rpm_root_opts --whatprovides $f)" + + notify.note " * "$"\ + build requirement found"": \`${NOTE}$f${NORM}' ""\ diff --git a/patches/autospec-1.4.17-curl_pass_netlink_opts.patch b/patches/autospec-1.4.17-curl_pass_netlink_opts.patch new file mode 100644 index 0000000..a4eef0a --- /dev/null +++ b/patches/autospec-1.4.17-curl_pass_netlink_opts.patch @@ -0,0 +1,12 @@ +diff -Nru autospec-1.4.17.orig//lib/libapse.lib.in autospec-1.4.17/lib/libapse.lib.in +--- autospec-1.4.17.orig//lib/libapse.lib.in 2010-04-12 23:16:34.000000000 +0200 ++++ autospec-1.4.17/lib/libapse.lib.in 2010-06-03 03:02:59.489016996 +0200 +@@ -313,7 +313,7 @@ + notify.note $"looking at"" <${NOTE}$curr_curl_url${NORM}> (\`${NOTE}source0${NORM}')..." + + notify.debug "curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\"" +- curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout ++ curl $curl_opts_netlink $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout + let "retval = $?" + + case "$retval" in diff --git a/patches/autospec-1.4.17-fix_get_RPMS_name.patch b/patches/autospec-1.4.17-fix_get_RPMS_name.patch new file mode 100644 index 0000000..ba043db --- /dev/null +++ b/patches/autospec-1.4.17-fix_get_RPMS_name.patch @@ -0,0 +1,23 @@ +diff -Nru autospec-1.4.17.orig//lib/librepository.lib.in autospec-1.4.17/lib/librepository.lib.in +--- autospec-1.4.17.orig//lib/librepository.lib.in 2009-06-28 21:44:48.000000000 +0200 ++++ autospec-1.4.17/lib/librepository.lib.in 2010-07-01 03:46:25.369016704 +0200 +@@ -361,15 +361,15 @@ + sed -n "\ + //dev/null +- [ $? -eq 0 ] && +- rpm_provided_by="$(rpm -q $rpm_root_opts --whatprovides $f)" ++ rpm_provided_by="$(rpm -q $rpm_root_opts --whatprovides $f)" ++ [ $? -eq 0 ] || unset rpm_provided_by + + notify.note " * "$"\ + build requirement found"": \`${NOTE}$f${NORM}' ""\ diff --git a/patches/autospec-1.4.17-use_rpm_preprocessor_to_solve_vars.patch b/patches/autospec-1.4.17-use_rpm_preprocessor_to_solve_vars.patch new file mode 100644 index 0000000..f4242e2 --- /dev/null +++ b/patches/autospec-1.4.17-use_rpm_preprocessor_to_solve_vars.patch @@ -0,0 +1,130 @@ +diff -Nru autospec-1.4.17.org//lib/libspec.lib.in autospec-1.4.17/lib/libspec.lib.in +--- autospec-1.4.17.org//lib/libspec.lib.in 2010-05-02 22:17:42.000000000 +0200 ++++ autospec-1.4.17/lib/libspec.lib.in 2010-07-02 23:06:02.245892733 +0200 +@@ -657,6 +657,18 @@ + { # 'return' required if 'EXIT_FUNC' == 'return' + notify.error $"specfile not found"": \`$specfile'"; return; } + ++ # use rpm --specfile --specedit to create a preprocessed specfile ++ local specfile_preprocessed=$(mktemp -q -t libspec.XXXXXXXX) || ++ notify.error $"can't create temporary files" ++ ++ local rpmdefine_opts="\ ++$(for i in `seq 1 1 ${#define_list_name[*]}`; do ++echo -n " --define=\"${define_list_name[$i-1]} ${define_list_value[$i-1]}\"" ++done)" ++ ++ eval "rpm -q --specfile --specedit $specfile $rpmdefine_opts >> $specfile_preprocessed" || ++ notify.error $"rpm exited with error code \`$?'" ++ + [ -r "$infofile" ] && . $infofile + + # when this library is used by external scripts this assertion always fails +@@ -889,7 +901,7 @@ + ;; + SPEC_TARGET) + [ "$SPEC_TARGET" ] && continue +- [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile" SPEC_NAME ++ [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile_preprocessed" SPEC_NAME + + local ifexpr ifexpr_level level boolexpr tok toksave filesname + let "ifexpr_level = 0" # level of nested %if statements +@@ -920,7 +932,7 @@ + + case ${tok[0]} in + %if) +- #ifexpr=$(rpmvars.solve "${tok2}${fromtok3}" "$specfile") ++ #ifexpr=$(rpmvars.solve "${tok2}${fromtok3}" "$specfile_preprocessed") + # note: if <%var> is undefined (not present) or set to "0" + # then the conditional expression is false else is true + let "ifexpr_level += 1" +@@ -993,7 +1005,7 @@ + notify.debug "\ + $FUNCNAME: %file block found (${tok[*]})[line#$linenum]" + filesname="$( \ +- rpmvars.solve "${tok[*]}" "$specfile" | \ ++ rpmvars.solve "${tok[*]}" "$specfile_preprocessed" | \ + sed -n ' + # remove "%files" and "-f file-name" option if present + s,%files[ \t]*,,;s,-f[ \t]\+[^ ]*[ \t]*,,;p' )" +@@ -1006,11 +1018,11 @@ + filesname="$(echo $filesname | sed 's,-n[ \t]\+,,')" + SPEC_TARGET=( \ + ${SPEC_TARGET[*]} \ +-"$(rpmvars.solve "$filesname" "$specfile")" ) ++"$(rpmvars.solve "$filesname" "$specfile_preprocessed")" ) + ;; + *) SPEC_TARGET=(\ + ${SPEC_TARGET[*]} "$SPEC_NAME-$(\ +-rpmvars.solve "$filesname" "$specfile")" ) ++rpmvars.solve "$filesname" "$specfile_preprocessed")" ) + ;; + esac + notify.debug "$FUNCNAME: $var = ( ${SPEC_TARGET[*]} )" +@@ -1023,7 +1035,7 @@ + fi + ;; + esac +- done < $specfile ++ done < $specfile_preprocessed + #notify.debug "$FUNCNAME: $var = ( ${SPEC_TARGET[*]} )" + ;; + SPEC_OBSOLETES) +@@ -1032,7 +1044,7 @@ + # entries when no obsolete labels are found + + [ "$SPEC_OBSOLETES" ] && continue +- [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile" SPEC_NAME ++ [ "$SPEC_NAME" ] || specfile.getvars -s "$specfile_preprocessed" SPEC_NAME + + local linenum=0 + while read -r -a tok; do +@@ -1062,19 +1074,19 @@ + notify.debug "\ + $FUNCNAME: * entry found at line $linenum: \"${tok[*]}\"" + SPEC_OBSOLETES[${#SPEC_OBSOLETES[*]}]="\ +-$(rpmvars.solve "${tok[*]}" "$specfile")" ++$(rpmvars.solve "${tok[*]}" "$specfile_preprocessed")" + + notify.debug "\ + $FUNCNAME: SPEC_OBSOLETES = ( ${SPEC_OBSOLETES[*]} )" + ;; + esac +- done < $specfile ++ done < $specfile_preprocessed + + # SPEC_OBSOLETES=($(sed -n "\ + # /^[ \t]*Obsoletes[ \t]*:/{ + # s,[ \t]*Obsoletes[ \t]*:[ \t]*,, + # s,%[{]*name[}]*,$SPEC_NAME,;p}" \ +- # $specfile)) ++ # $specfile_preprocessed)) + + notify.debug "$FUNCNAME: $var = ( ${SPEC_OBSOLETES[*]} )" + ;; +@@ -1095,7 +1107,7 @@ + [ "$SPEC_BUILDREQUIRES" ] && continue + local f rpm_provided_by + SPEC_BUILDREQUIRES=(`sed -n \ +-'/^BuildRequires/{s,BuildRequires[ \t]*:[ \t]*,,p}' $specfile | \ ++'/^BuildRequires/{s,BuildRequires[ \t]*:[ \t]*,,p}' $specfile_preprocessed | \ + (IFS="$IFS,"; while read -a buildreqs; do + let "isver = 0" + for f in ${buildreqs[@]}; do +@@ -1107,7 +1119,7 @@ + let "isver = 1" + ;; + *%*) # rpm variable(s) (ex. '%{__install_info}') +- echo "$(rpmvars.solve "$f" $specfile) " ++ echo "$(rpmvars.solve "$f" $specfile_preprocessed) " + ;; + *) echo "$f " ;; + esac +@@ -1154,6 +1166,7 @@ + ;; + esac + done ++ [ -e $specfile_preprocessed ] && rm -f $specfile_preprocessed + } + + diff --git a/patches/autospec-1.4.4-access_private_repositories.patch b/patches/autospec-1.4.4-access_private_repositories.patch new file mode 100644 index 0000000..6efa209 --- /dev/null +++ b/patches/autospec-1.4.4-access_private_repositories.patch @@ -0,0 +1,246 @@ +diff -Nru autospec-1.4.4.orig/lib/librepository.lib.in autospec-1.4.4/lib/librepository.lib.in +--- autospec-1.4.4.orig/lib/librepository.lib.in 2008-12-08 19:35:19.000000000 +0100 ++++ autospec-1.4.4/lib/librepository.lib.in 2008-12-31 05:19:14.000000000 +0100 +@@ -84,11 +84,11 @@ + local ARGS + ARGS=`LANG=C getopt \ + -o n:r:p:u: \ +- --long urlnum:,urllist:,proxy:,proxy-user: \ ++ --long urlnum:,urllist:,proxy:,proxy-user:,user:,urllistrw: \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" + +- local i urlnum urllist proxy proxy_user ++ local i urlnum urllist proxy proxy_user user urllistrw + + eval set -- "$ARGS" + while :; do +@@ -111,6 +111,16 @@ + proxy_user="$2"; shift + notify.debug "$FUNCNAME: proxy_user = \"$proxy_user\"" + ;; ++ -l|--user) ++ user="$2"; shift ++ notify.debug "$FUNCNAME: user = \"$proxy_user\"" ++ ;; ++ -w|--urllistrw) ++ urllistrw=($2); shift ++ for i in `seq 1 1 ${#urllistrw[*]}`; do ++ notify.debug "$FUNCNAME: urllistrw[$(($i-1))] = ${urllistrw[$i-1]}" ++ done ++ ;; + --) shift; break ;; + *) notify.error $"\ + (bug)"" -- $FUNCNAME: "$"\`getopt' error: bad command \`$1'" ;; +@@ -135,10 +145,14 @@ + # FIXME: 'curl_opts_netlink' is an external variable + local curlopts="\ + -L --silent --list-only $curl_opts_netlink\ ++${user:+ --user $user} \ + ${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}" + + local flist currflist currurl + local errors=0 ++ ++ [ "${user}" ] && urllist=(${urllistrw[*]}) ++ + let "i = 0" + for currurl in ${urllist[*]}; do + # get the list of files from the repository +@@ -160,6 +174,8 @@ + #notify.debug "curl $curlopts --url $currurl/" + curl $curlopts --url $currurl/ -o $currflist + let "retval = $?" ++ ++ notify.debug "$FUNCNAME: curl $curlopts --url $currurl/ -o $currflist" + notify.debug "$FUNCNAME: curl return code: $retval" + + case "$retval" in +@@ -223,6 +239,7 @@ + # -c,--target-cpu : set the build architecture + # -p,--proxy : proxy server + # -u,--proxy-user : proxy user ++# -l,--user : login user + # return value: + # 0 on success, >0 otherwise + # example of output: +@@ -233,13 +250,13 @@ + function repository.get_RPMS_name() { + ARGS=`LANG=C getopt \ + -o a:x:c:p:u: \ +- --long archlist:,exclude:,target-cpu:,proxy:,proxy-user: \ ++ --long archlist:,exclude:,target-cpu:,proxy:,proxy-user:,user: \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"(bug)"" -- $FUNCNAME: "$"\`getopt' error" + + eval set -- "$ARGS" + +- local archlist excludeopt proxy proxy_user target_cpu ++ local archlist excludeopt proxy proxy_user user target_cpu + while :; do + case $1 in + -a|--archlist) +@@ -262,6 +279,10 @@ + proxy_user="$2"; shift + notify.debug "$FUNCNAME: proxy_user = \"$proxy_user\"" + ;; ++ -l|--user) ++ user="$2"; shift ++ notify.debug "$FUNCNAME: user = \"$proxy_user\"" ++ ;; + --) shift; break ;; + *) notify.error $"\ + (bug)"" -- $FUNCNAME: "$"\`getopt' error" ;; +@@ -309,6 +330,7 @@ + # FIXME: 'curl_opts_netlink' is an external variable + local curlopts="\ + -L --silent --list-only $curl_opts_netlink -o $flist\ ++${user:+ --user $user} \ + ${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}" + + got_RPM_FILENAME= +diff -Nru autospec-1.4.4.orig/plugins/pck-update.in autospec-1.4.4/plugins/pck-update.in +--- autospec-1.4.4.orig/plugins/pck-update.in 2008-12-18 20:49:37.000000000 +0100 ++++ autospec-1.4.4/plugins/pck-update.in 2008-12-31 05:20:28.000000000 +0100 +@@ -1053,16 +1053,53 @@ + notify.error $"can't create temporary files" + notify.debug "$FUNCNAME: infofile = $infofile" + ++ local upload_ftp_server ++ local upload_ftp_rpms_dir ++ local upload_ftp_srpms_dir ++ local upload_ftp_port ++ local upload_ftp_user ++ local upload_ftp_passwd ++ ++ # select the server where the new packages will be uploaded ++ upload_ftp_server=${ftp_rw_server[$ftp_server_upload_num]} ++ notify.debug "upload_ftp_server = \"$upload_ftp_server\"" ++ [ "$upload_ftp_server" ] || notify.error "\ ++\`ftp_rw_server[$ftp_server_upload_num]': "$"unset in the configuration files" ++ ++ # get the folder where the new rpm packages will be uploaded ++ upload_ftp_rpms_dir=${ftp_rw_rpms_dir[$ftp_server_upload_num]} ++ notify.debug "upload_ftp_rpms_dir = \"$upload_ftp_rpms_dir\"" ++ [ "$upload_ftp_rpms_dir" ] || notify.error "\ ++\`ftp_rw_rpms_dir[$ftp_server_upload_num]': "$"unset in the configuration files" ++ ++ # get the folder where the new srpm package will be uploaded ++ upload_ftp_srpms_dir=${ftp_rw_srpms_dir[$ftp_server_upload_num]} ++ notify.debug "upload_ftp_srpms_dir = \"$upload_ftp_srpms_dir\"" ++ [ "$upload_ftp_srpms_dir" ] || notify.error "\ ++\`ftp_rw_srpms_dir[$ftp_server_upload_num]': "$"unset in the configuration files" ++ ++ upload_ftp_port=${ftp_rw_port[$ftp_server_upload_num]} ++ [ "$ftp_rw_user_forced" ] && ++ upload_ftp_user="$ftp_rw_user_forced" || ++ upload_ftp_user="${ftp_rw_user[$ftp_server_upload_num]}" ++ [ "$ftp_rw_passwd_forced" ] && ++ upload_ftp_passwd="$ftp_rw_passwd_forced" || ++ upload_ftp_passwd="${ftp_rw_passwd[$ftp_server_upload_num]}" ++ + for step in ${steps[*]}; do + case $step in + 0) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ + check for available versions in the repositories""${NORM}" + + local srpm_pck_found=0 ++ + if [ "$ftp_server_download_num" ]; then + repository.get_SRPMS_name \ + --urllist "${ftpurl_ro_srpms[$ftp_server_download_num]}" \ + --urlnum "$ftp_server_download_num" \ ++ --user "$upload_ftp_user:$upload_ftp_passwd" \ ++ --urllistrw "$upload_ftp_server${upload_ftp_port:+:upload_ftp_port}/\ ++$upload_ftp_srpms_dir/" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "$pck_name" +@@ -1079,9 +1116,13 @@ + fi + else + for i in `seq 1 1 ${#ftp_rw_server[*]}`; do ++ + repository.get_SRPMS_name \ + --urllist "${ftpurl_ro_srpms[$(($i-1))]}" \ + --urlnum "$(($i-1))" \ ++ ${upload_ftp_user:+ --user "$upload_ftp_user:$upload_ftp_passwd"} \ ++ --urllistrw "$upload_ftp_server${upload_ftp_port:+:upload_ftp_port}/\ ++$upload_ftp_srpms_dir/" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "$pck_name" +@@ -1113,6 +1154,9 @@ + repository.get_SRPMS_name \ + --urllist "${ftpurl_ro_srpms[$ftp_server_download_num]}" \ + --urlnum "$ftp_server_download_num" \ ++ ${upload_ftp_user:+ --user "$upload_ftp_user:$upload_ftp_passwd"} \ ++ --urllistrw "$upload_ftp_server${upload_ftp_port:+:upload_ftp_port}/\ ++$upload_ftp_srpms_dir/" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "$pck_name" +@@ -1141,12 +1185,14 @@ + cd $srpms_dir + + curl $curl_options \ ++ ${upload_ftp_user:+ --user $upload_ftp_user:$upload_ftp_passwd} \ + ${proxy:+ --proxy $proxy}${proxyuser:+ --proxy-user $proxy_user} \ + $got_SPEC_FILENAME_URL/$got_SPEC_FILENAME + [[ $? -eq 0 ]] && + notify.note $"got from"" \`$got_SPEC_FILENAME_URL'" || + notify.debug "\ + curl $curl_options\ ++${upload_ftp_user:+ --user $upload_ftp_user:$upload_ftp_passwd} \ + ${proxy:+ --proxy $proxy}${proxyuser:+ --proxy-user $proxy_user} \ + $got_SPEC_FILENAME_URL/$got_SPEC_FILENAME: [${CRIT}FAILED${NORM}]" ) + +@@ -2552,6 +2598,9 @@ + repository.get_SRPMS_name \ + --urllist "${ftpurl_ro_srpms[$ftp_server_upload_num]}" \ + --urlnum "$ftp_server_upload_num" \ ++ ${upload_ftp_user:+ --user "$upload_ftp_user:$upload_ftp_passwd"} \ ++ --urllistrw "$upload_ftp_server${upload_ftp_port:+:upload_ftp_port}/\ ++$upload_ftp_srpms_dir/" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "$pck_name" ${SPEC_OBSOLETES[@]} +@@ -2662,38 +2711,6 @@ + [ "${ftp_rw_passive_mode[$ftp_server_upload_num]}" = "on" ] && + ftp_opts="$ftp_opts --ftp-pasv" + +- local upload_ftp_server +- local upload_ftp_rpms_dir +- local upload_ftp_srpms_dir +- local upload_ftp_port +- local upload_ftp_user +- local upload_ftp_passwd +- +- # select the server where the new packages will be uploaded +- upload_ftp_server=${ftp_rw_server[$ftp_server_upload_num]} +- notify.debug "upload_ftp_server = \"$upload_ftp_server\"" +- [ "$upload_ftp_server" ] || notify.error "\ +-\`ftp_rw_server[$ftp_server_upload_num]': "$"unset in the configuration files" +- +- # get the folder where the new rpm packages will be uploaded +- upload_ftp_rpms_dir=${ftp_rw_rpms_dir[$ftp_server_upload_num]} +- notify.debug "upload_ftp_rpms_dir = \"$upload_ftp_rpms_dir\"" +- [ "$upload_ftp_rpms_dir" ] || notify.error "\ +-\`ftp_rw_rpms_dir[$ftp_server_upload_num]': "$"unset in the configuration files" +- +- # get the folder where the new srpm package will be uploaded +- upload_ftp_srpms_dir=${ftp_rw_srpms_dir[$ftp_server_upload_num]} +- notify.debug "upload_ftp_srpms_dir = \"$upload_ftp_srpms_dir\"" +- [ "$upload_ftp_srpms_dir" ] || notify.error "\ +-\`ftp_rw_srpms_dir[$ftp_server_upload_num]': "$"unset in the configuration files" +- +- upload_ftp_port=${ftp_rw_port[$ftp_server_upload_num]} +- [ "$ftp_rw_user_forced" ] && +- upload_ftp_user="$ftp_rw_user_forced" || +- upload_ftp_user="${ftp_rw_user[$ftp_server_upload_num]}" +- [ "$ftp_rw_passwd_forced" ] && +- upload_ftp_passwd="$ftp_rw_passwd_forced" || +- upload_ftp_passwd="${ftp_rw_passwd[$ftp_server_upload_num]}" + + notify.note "\ + ${NOTE}"$"upload the new packages to the ftp repository"" \ diff --git a/patches/autospec-1.4.4-fix_perl_pkgs_scraping.patch b/patches/autospec-1.4.4-fix_perl_pkgs_scraping.patch new file mode 100644 index 0000000..4a1e45c --- /dev/null +++ b/patches/autospec-1.4.4-fix_perl_pkgs_scraping.patch @@ -0,0 +1,108 @@ +diff -Nru autospec-1.4.4.orig/lib/libapse.lib.in autospec-1.4.4/lib/libapse.lib.in +--- autospec-1.4.4.orig/lib/libapse.lib.in 2009-01-03 14:12:01.000000000 +0100 ++++ autospec-1.4.4/lib/libapse.lib.in 2009-01-03 14:13:26.000000000 +0100 +@@ -411,62 +411,64 @@ + last_version="$new_version" + fi + +- # check at the other supported web sites... +- for i in ${!apse_site_name[@]}; do +- notify.note \ ++ # check at the other supported web sites. ++ # Skip Perl packages to prevent name confusion; these are checked above via Source0 ++ if [ ! "$(echo $pckurl | grep "cpan.org")" ]; then ++ for i in ${!apse_site_name[@]}; do ++ notify.note \ + $"looking at"" <${NOTE}${apse_site_name[$i]}${NORM}>..." + +- for search_name in $src_name $specname; do +- [ "${apse_put_fields[$i]}" ] && +- curr_curl_url="${apse_uri[$i]}" || +- curr_curl_url="${apse_uri[$i]}${search_name}" ++ for search_name in $src_name $specname; do ++ [ "${apse_put_fields[$i]}" ] && ++ curr_curl_url="${apse_uri[$i]}" || ++ curr_curl_url="${apse_uri[$i]}${search_name}" + +- if [ "${apse_put_fields[$i]}" ]; then +- notify.debug "\ ++ if [ "${apse_put_fields[$i]}" ]; then ++ notify.debug "\ + curl \$curr_curl_proxy_opts -s -L -F ${apse_put_fields[$i]}${search_name} \"$curr_curl_url\"" +- curl $curr_curl_proxy_opts -s -L -F \ +- ${apse_put_fields[$i]}${search_name} "$curr_curl_url" > $fcurlout +- else +- notify.debug "\ ++ curl $curr_curl_proxy_opts -s -L -F \ ++ ${apse_put_fields[$i]}${search_name} "$curr_curl_url" > $fcurlout ++ else ++ notify.debug "\ + curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\"" +- curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout +- fi ++ curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout ++ fi + +- let "retval = $?" +- case "$retval" in +- 0) ;; +- 6) notify.warning $"couldn't resolve host" ;; +- 7) notify.warning $"failed to connect to host" ;; +- *) notify.warning $"curl error (exit code: $retval)" ;; +- esac ++ let "retval = $?" ++ case "$retval" in ++ 0) ;; ++ 6) notify.warning $"couldn't resolve host" ;; ++ 7) notify.warning $"failed to connect to host" ;; ++ *) notify.warning $"curl error (exit code: $retval)" ;; ++ esac + +- [ "$retval" = "0" ] || continue ++ [ "$retval" = "0" ] || continue + +- if [ "$(cat $fcurlout | sed -n "\ ++ if [ "$(cat $fcurlout | sed -n "\ + s,.*${apse_error_msg[$i]}.*,error,pi")" != \ +- "error" ]; then +- current_grep="$(echo "${apse_grep[$i]}" | sed -e "s,\${search_name},${search_name},g")" +- current_sed="$(echo "${apse_sed[$i]}" | sed -e "s,\${search_name},${search_name},g")" +- notify.debug "\ ++ "error" ]; then ++ current_grep="$(echo "${apse_grep[$i]}" | sed -e "s,\${search_name},${search_name},g")" ++ current_sed="$(echo "${apse_sed[$i]}" | sed -e "s,\${search_name},${search_name},g")" ++ notify.debug "\ + grep -i -m1 \"$current_grep\" \$fcurlout | sed -n \"$current_sed\"" +- new_version=$(grep -i -m1 "$current_grep" $fcurlout | sed -n "$current_sed") +- if [ "$new_version" ]; then +- notify.note "\ ++ new_version=$(grep -i -m1 "$current_grep" $fcurlout | sed -n "$current_sed") ++ if [ "$new_version" ]; then ++ notify.note "\ + * "$"found version:"" \`${NOTE}$new_version${NORM}'" +- if [ "$last_version" ]; then +- notify.debug "apse.cmpversion \"$last_version\" \"$new_version\"" +- apse.cmpversion "$last_version" "$new_version" +- [ $? -eq 2 ] && last_version="$new_version" +- else +- last_version="$new_version" ++ if [ "$last_version" ]; then ++ notify.debug "apse.cmpversion \"$last_version\" \"$new_version\"" ++ apse.cmpversion "$last_version" "$new_version" ++ [ $? -eq 2 ] && last_version="$new_version" ++ else ++ last_version="$new_version" ++ fi + fi + fi +- fi ++ done + done +- done ++ fi + + unset APSE_LAST_VERSION +- + if [ "$last_version" ]; then + APSE_LAST_VERSION="${last_version/-/.}" + notify.note $"\ diff --git a/patches/autospec-1.4.4-scrape_source0_dir.patch b/patches/autospec-1.4.4-scrape_source0_dir.patch new file mode 100644 index 0000000..4a4a0a4 --- /dev/null +++ b/patches/autospec-1.4.4-scrape_source0_dir.patch @@ -0,0 +1,105 @@ +diff -Nru autospec-1.4.4.orig/lib/libapse.lib.in autospec-1.4.4/lib/libapse.lib.in +--- autospec-1.4.4.orig/lib/libapse.lib.in 2008-12-18 23:01:10.000000000 +0100 ++++ autospec-1.4.4/lib/libapse.lib.in 2009-01-02 13:45:55.000000000 +0100 +@@ -230,7 +230,7 @@ + + local ARGS + ARGS=`LANG=C getopt -o han:s:w:p:u: \ +- --long help,allurl,pckname:,specname:,pckurl:,proxy:,proxy-user: \ ++ --long help,allurl,pckname:,specname:,pckurl:,pckurlverbatim:,proxy:,proxy-user: \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || notify.error $"\ + (bug)"" -- $FUNCNAME: "$"\`getopt' error" +@@ -253,6 +253,10 @@ + pckurl="$2"; shift + notify.debug "$FUNCNAME: pckurl = \"$pckurl\"" + ;; ++ -v|--pckurlverbatim) ++ pckurlverbatim="$2"; shift ++ notify.debug "$FUNCNAME: pckurlverbatim = \"$pckurlverbatim\"" ++ ;; + -p|--proxy) + proxy="$2"; shift + notify.debug "$FUNCNAME: proxy = \"$proxy\"" +@@ -291,12 +295,11 @@ + local curr_curl_proxy_opts="\ + ${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}" + +- # sourceforge.net, sf.net + ++ # sourceforge.net, sf.net + local prj_name prj_group_id + + if [ "$(echo $pckurl | grep "sourceforge.net\|sf.net")" ]; then +- notify.note $"looking at"" <${NOTE}http://sourceforge.net${NORM}>..." + + prj_name=$(echo "$pckurl" | sed -n 's,.*/\(.*\)/.*,\1,p') + [ "$prj_name" ] || notify.error $"\ +@@ -364,11 +367,48 @@ + fi + fi + fi ++ ++ else ++ ++ # SOURCE url based search ++ notify.note $"looking at"" "$"source0 base directory..." ++ local pckurldir="`dirname $pckurl`/" ++ local pcknameverbatim=`basename $pckurlverbatim` ++ ++ curr_curl_url="\ ++$pckurldir" ++ notify.debug "curl $curr_curl_proxy_opts -s -L \"$curr_curl_url\"" ++ ++ curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout ++ let "retval = $?" ++ case "$retval" in ++ 0) ;; ++ 6) notify.warning $"couldn't resolve host" ;; ++ 7) notify.warning $"failed to connect to host" ;; ++ *) notify.warning $"curl error (exit code: $retval)" ;; ++ esac ++ ++ local pcknameregexp=$(echo $pcknameverbatim | sed "\ ++ s,%[{]*name[}]*,$specname, ++ s,%{.*}*,[^[:space:]-]*,") ++ ++ if [ $? -eq 0 ]; then ++ ++ new_version=$(\ ++grep -i "$pcknameregexp" $fcurlout | sed "\ ++ s,.*\($pcknameregexp\).*,\1,g ++ s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) ++ s/.*-\([0-9]*.*\)/\1/ # - ++ s/.*_\([0-9]*.*\)/\1/ # _ ++ s/.+\([0-9]\..*\)/\1/g # ++ " | sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10| head -n1) ++ ++ fi + fi + + if [ "$new_version" ]; then +- notify.note "* "$"found version:"" \`${NOTE}$new_version${NORM}'" +- last_version="$new_version" ++ notify.note "* "$"found version:"" \`${NOTE}$new_version${NORM}'" ++ last_version="$new_version" + fi + + # check at the other supported web sites... +diff -Nru autospec-1.4.4.orig/plugins/pck-update.in autospec-1.4.4/plugins/pck-update.in +--- autospec-1.4.4.orig/plugins/pck-update.in 2009-01-01 23:01:36.000000000 +0100 ++++ autospec-1.4.4/plugins/pck-update.in 2009-01-01 23:04:59.000000000 +0100 +@@ -1253,9 +1253,13 @@ + unset SPEC_SOURCE0_PCKNAME + specfile.getvars SPEC_SOURCE0_PCKNAME + ++ unset SPEC_SOURCE0_VERBATIM ++ specfile.getvars --verbatim SPEC_SOURCE0 ++ + apse.scrapeversion \ + --pckname "$SPEC_SOURCE0_PCKNAME" \ + --pckurl "${SPEC_SOURCE[0]}" \ ++ --pckurlverbatim "${SPEC_SOURCE0_VERBATIM}" \ + --specname "$SPEC_NAME" \ + ${proxy:+ --proxy $proxy} \ + ${proxy_user:+ --proxy-user $proxy_user} diff --git a/patches/autospec-1.4.5-scrape_regexp.patch b/patches/autospec-1.4.5-scrape_regexp.patch new file mode 100644 index 0000000..a87d35c --- /dev/null +++ b/patches/autospec-1.4.5-scrape_regexp.patch @@ -0,0 +1,29 @@ +--- autospec.conf.in.orig 2009-02-24 01:58:37.000000000 +0100 ++++ autospec.conf.in 2009-02-24 01:58:49.000000000 +0100 +@@ -418,7 +418,7 @@ + apse_uri[1]="http://linux.softpedia.com/progSearch" + apse_put_fields[1]="src=" + apse_error_msg[1]="No results found" +-apse_grep[1]="\${search_name} \([^ <]*\).*,\1,pi" + + apse_site_name[5]="http://distrowatch.com" +-apse_uri[5]="http://distrowatch.com/packages.php ?" ++apse_uri[5]="http://distrowatch.com/packages.php?" + apse_put_fields[5]="" + apse_error_msg[5]="is currently being redesigned" +-apse_grep[5]="td.*\${search_name}" ++apse_grep[5]="td.*[^a-zA-Z]\${search_name}[^a-zA-Z0-9]" + apse_sed[5]="s,.*td><[^>]*>\([^ <]*\)<.*,\1,pi" + + #------------------------------------------------------------------------------ diff --git a/patches/autospec-1.4.5-scrape_source0_fix.patch b/patches/autospec-1.4.5-scrape_source0_fix.patch new file mode 100644 index 0000000..2c87f48 --- /dev/null +++ b/patches/autospec-1.4.5-scrape_source0_fix.patch @@ -0,0 +1,12 @@ +--- libapse.lib.in.2 2009-02-28 19:34:40.000000000 +0100 ++++ libapse.lib.in 2009-02-28 19:34:55.000000000 +0100 +@@ -392,7 +392,8 @@ + + local pcknameregexp=$(echo $pcknameverbatim | sed "\ + s,%[{]*name[}]*,$specname, +- s,%{.*}*,[^[:space:]-]*,") ++ s,%[{]*version[}]*,[A-Za-z0-9._]*, ++ s,%[{]*.*[}]*,[^[:space:]-]*,") + + if [ $? -eq 0 ]; then + new_version=$(\ diff --git a/patches/autospec-1.4.5-scrape_source0_fix2.patch b/patches/autospec-1.4.5-scrape_source0_fix2.patch new file mode 100644 index 0000000..de36001 --- /dev/null +++ b/patches/autospec-1.4.5-scrape_source0_fix2.patch @@ -0,0 +1,11 @@ +--- libapse.lib.in 2009-02-28 19:34:55.000000000 +0100 ++++ libapse.lib.in.new 2009-03-02 18:46:02.000000000 +0100 +@@ -403,7 +403,7 @@ + s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) + s/.*-\([0-9]*.*\)/\1/ # - + s/.*_\([0-9]*.*\)/\1/ # _ +-s/.+\([0-9]\..*\)/\1/g # " | \ ++s/[^0-9]*\([0-9]\..*\)/\1/g # | \ + sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 | head -n1) + fi + diff --git a/patches/autospec-1.4.6-libapse_remove_sourceforge.patch b/patches/autospec-1.4.6-libapse_remove_sourceforge.patch new file mode 100644 index 0000000..0f98311 --- /dev/null +++ b/patches/autospec-1.4.6-libapse_remove_sourceforge.patch @@ -0,0 +1,86 @@ +diff -Nru autospec-1.4.6.ori/lib/libapse.lib.in autospec-1.4.6/lib/libapse.lib.in +--- autospec-1.4.6.ori/lib/libapse.lib.in 2009-04-10 19:47:03.000000000 +0200 ++++ autospec-1.4.6/lib/libapse.lib.in 2009-07-01 02:29:14.912684915 +0200 +@@ -294,81 +294,8 @@ + local curr_curl_proxy_opts="\ + ${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}" + +- # sourceforge.net, sf.net +- +- local prj_name prj_group_id +- +- if [ "$(echo $pckurl | grep "sourceforge.net\|sf.net")" ]; then +- notify.note $"looking at"" <${NOTE}http://sourceforge.net${NORM}>..." +- +- prj_name=$(echo "$pckurl" | sed -n 's,.*/\(.*\)/.*,\1,p') +- [ "$prj_name" ] || notify.error $"\ +-(bug)"" -- $FUNCNAME: "$"assertion failed:"" \"\$prj_name\" != \"\"" +- +- curr_curl_url="http://sourceforge.net/projects/$prj_name" +- notify.debug "curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\"" +- curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout +- +- let "retval = $?" +- case "$retval" in +- 0) ;; +- 6) notify.warning $"couldn't resolve host" ;; +- 7) notify.warning $"failed to connect to host" ;; +- *) notify.warning $"curl error (exit code: $retval)" ;; +- esac +- +- [ "$retval" = "0" ] && +- if [ "$(sed -n "s,.*Invalid Project.*,error,pi" $fcurlout)" != \ +- "error" ]; then +- prj_group_id=$(\ +- sed -n "s,.*download\.php?group_id=\([0-9]*\).*,\1,pi" \ +- $fcurlout) +- [ "$prj_group_id" ] || notify.error $"\ +-(bug)"" -- $FUNCNAME: "$"assertion failed:"" \"\$prj_group_id\" != \"\"" +- +- curr_curl_url="\ +-http://sourceforge.net/export/rss2_projfiles.php?group_id=$prj_group_id" +- notify.debug "curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\"" +- +- curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout +- let "retval = $?" +- case "$retval" in +- 0) ;; +- 6) notify.warning $"couldn't resolve host" ;; +- 7) notify.warning $"failed to connect to host" ;; +- *) notify.warning $"curl error (exit code: $retval)" ;; +- esac +- +- if [ $? -eq 0 ]; then +- for search_name in $src_name $specname; do +- new_version=$(\ +-grep -i -m1 "$search_name [^ ]* released (.*)" $fcurlout | \ +-sed -n "s,.*$search_name \([^ ]*\) released (.*).*,\1,pi") +- [ "$new_version" ] && break +- done +- +- if [ -z "$new_version" ]; then +- [ "$src_name" ] || src_name="$specname" +- +- pck_file=`grep -i -m1 "Includes files: $src_name" $fcurlout | \ +-sed -n "s,.*Includes files: \($src_name[-_0-9]*[^ -]*\) .*,\1,pi"` +- notify.debug "pck_file = \"$pck_file\"" +- [ "$src_name" ] && unset src_name +- +- new_version=`echo $pck_file | sed -n "\ +-/[0-9]/!q # return nothing if no number is found in the package name +-s,.*/,, # remove directory name, if any +-s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) +-/-[0-9]*/{s/.*-\([0-9]*.*\)/\1/p;q} # - +-/_[0-9]*/{s/.*_\([0-9]*.*\)/\1/p;q} # _ +-/[^-\.][0-9]\./{s/.*[^-\.]\([0-9]\..*\)/\1/p;q} # +-# (no version, but can end with numbers) +-/^[^0-9]*[0-9]*$/q"` +- fi +- fi +- fi + # SOURCE0 url based search (only if 'pckurl' is a valid url) +- elif [[ "$pckurl" =~ .*://.* ]]; then ++ if [[ "$pckurl" =~ .*://.* ]]; then + local pckurldir="`dirname $pckurl`/" + notify.debug "pckurldir = $pckurldir" + diff --git a/patches/autospec-1.4.6-relocate_RPM_dirs.patch b/patches/autospec-1.4.6-relocate_RPM_dirs.patch new file mode 100644 index 0000000..a56c953 --- /dev/null +++ b/patches/autospec-1.4.6-relocate_RPM_dirs.patch @@ -0,0 +1,57 @@ +diff -Nru autospec-1.4.6.orig/autospec.conf.in autospec-1.4.6/autospec.conf.in +--- autospec-1.4.6.orig/autospec.conf.in 2009-02-25 22:42:41.000000000 +0100 ++++ autospec-1.4.6/autospec.conf.in 2009-04-19 14:47:37.000000000 +0200 +@@ -533,8 +533,9 @@ + #------------------------------------------------------------------------------ + + # Directories used by the rpm tool to read and save files to +-srpms_dir=`rpm --eval %_srcrpmdir 2>/dev/null` +-rpms_dir=`rpm --eval %_rpmdir 2>/dev/null` +-spec_dir=`rpm --eval %_specdir 2>/dev/null` +-source_dir=`rpm --eval %_sourcedir 2>/dev/null` +-tmppath_dir=`rpm --eval %_tmppath 2>/dev/null` ++srpms_dir="`rpm --eval %_srcrpmdir 2>/dev/null`" ++rpms_dir="`rpm --eval %_rpmdir 2>/dev/null`" ++spec_dir="`rpm --eval %_specdir 2>/dev/null`" ++source_dir="`rpm --eval %_sourcedir 2>/dev/null`" ++build_dir="`rpm --eval %_builddir 2>/dev/null`" ++tmppath_dir="`rpm --eval %_tmppath 2>/dev/null`" +diff -Nru autospec-1.4.6.orig/plugins/pck-update.in autospec-1.4.6/plugins/pck-update.in +--- autospec-1.4.6.orig/plugins/pck-update.in 2009-02-01 22:35:33.000000000 +0100 ++++ autospec-1.4.6/plugins/pck-update.in 2009-04-19 14:49:05.000000000 +0200 +@@ -1181,7 +1181,10 @@ + $spec_dir/${SRPM_SPECFILE}.0.old + fi + +- rpm -hiv $srpms_dir/$got_SPEC_FILENAME 2>&1 >/dev/null || ++ rpm -hiv \ ++ --define "%_specdir $spec_dir" \ ++ --define "%_sourcedir $source_dir" \ ++ $srpms_dir/$got_SPEC_FILENAME 2>&1 >/dev/null || + notify.error $"\ + an error occurred while installing \`$got_SPEC_FILENAME'" + +@@ -2106,7 +2109,13 @@ + $sdflag "$fullURL" "$source_dir" "$totfilenum" + done + +- local rpmbuild_opts ++ local rpmbuild_opts="\ ++ --define \"%_srcrpmdir $srpms_dir\" \ ++ --define \"%_rpmdir $rpms_dir\" \ ++ --define \"%_specdir $spec_dir\" \ ++ --define \"%_sourcedir $source_dir\" \ ++ --define \"%_builddir $build_dir\" \ ++ --define \"%_tmppath $tmppath_dir\"" + + # check if we are cross-compiling + [ "$BUILD_ARCH" != "$target_cpu" ] && +@@ -2116,7 +2125,7 @@ + + # note: exit with error when build requirements are missing + notify.note "${NOTE}"$"testing out specfile""${NORM}..." +- rpmbuild --nobuild $spec_dir/$SRPM_SPECFILE 2>&1 || ++ rpmbuild --nobuild --define "%_sourcedir $source_dir" $spec_dir/$SRPM_SPECFILE 2>&1 || + notify.error $"rpmbuild exited with error code \`$?'" + + notify.debug "define_list_name = (${define_list_name[*]})" diff --git a/patches/autospec-1.4.7-builddir_conf_default.patch b/patches/autospec-1.4.7-builddir_conf_default.patch new file mode 100644 index 0000000..51bd7a3 --- /dev/null +++ b/patches/autospec-1.4.7-builddir_conf_default.patch @@ -0,0 +1,9 @@ +diff -Nru autospec-1.4.7/autospec.conf.in autospec-1.4.7.patched/autospec.conf.in +--- autospec-1.4.7/autospec.conf.in 2009-06-28 20:18:14.000000000 +0200 ++++ autospec-1.4.7.patched/autospec.conf.in 2009-07-08 21:15:25.186969362 +0200 +@@ -537,4 +537,5 @@ + rpms_dir="`rpm --eval %_rpmdir 2>/dev/null`" + spec_dir="`rpm --eval %_specdir 2>/dev/null`" + source_dir="`rpm --eval %_sourcedir 2>/dev/null`" ++build_dir="`rpm --eval %_builddir 2>/dev/null`" + tmppath_dir="`rpm --eval %_tmppath 2>/dev/null`" diff --git a/patches/autospec-1.4.7-libapse_better_source0_scrape.patch b/patches/autospec-1.4.7-libapse_better_source0_scrape.patch new file mode 100644 index 0000000..66f596f --- /dev/null +++ b/patches/autospec-1.4.7-libapse_better_source0_scrape.patch @@ -0,0 +1,36 @@ +diff -Nru autospec-1.4.7/lib/libapse.lib.in autospec-1.4.7.patched/lib/libapse.lib.in +--- autospec-1.4.7/lib/libapse.lib.in 2009-07-05 19:23:29.000000000 +0200 ++++ autospec-1.4.7.patched/lib/libapse.lib.in 2009-07-12 14:16:29.000000000 +0200 +@@ -319,19 +319,24 @@ + + local pcknameregexp=$(echo $pcknameverbatim | sed "\ + s,%[{]*name[}]*,$specname, +- s,%[{]*version[}]*,[A-Za-z0-9._]*, +- s,%[{]*.*[}]*,[^[:space:]-]*,") ++ s,%[{]*version[}]*,\\\([A-Za-z0-9._]*\\\), ++ s,%[{]*.*[}]*,[A-Za-z0-9._]*, ++ s,\.gz$,., ++ s,\.tgz$,., ++ s,\.bz2$,., ++ s,\.lzma$,.,") + + if [ $? -eq 0 ]; then +- new_version=$(\ ++ ++ if [ "${pcknameregexp/(/}" = "${pcknameregexp}" ]; then ++ notify.warning "* "$"not parametric source0 name; cannot update" ++ else ++ new_version=$(\ + grep -i "$pcknameregexp" $fcurlout | \ + sed "\ +-s,.*\($pcknameregexp\).*,\1,g +-s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) +-s/.*-\([0-9]*.*\)/\1/ # - +-s/.*_\([0-9]*.*\)/\1/ # _ +-s/[^0-9]*\([0-9]\..*\)/\1/g # " | \ ++s,.*$pcknameregexp.*,\1,g" | + sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 | head -n1) ++ fi + fi + + if [ "$new_version" ]; then diff --git a/patches/autospec-1.4.8-distrowatch_apse_grep.patch b/patches/autospec-1.4.8-distrowatch_apse_grep.patch new file mode 100644 index 0000000..5388179 --- /dev/null +++ b/patches/autospec-1.4.8-distrowatch_apse_grep.patch @@ -0,0 +1,12 @@ +diff -Nru autospec-1.4.8.orig/autospec.conf.in autospec-1.4.8/autospec.conf.in +--- autospec-1.4.8.orig/autospec.conf.in 2009-10-14 21:24:36.000000000 +0200 ++++ autospec-1.4.8/autospec.conf.in 2009-10-16 12:03:40.000000000 +0200 +@@ -446,7 +446,7 @@ + apse_uri[5]="http://distrowatch.com/packages.php?" + apse_put_fields[5]="" + apse_error_msg[5]="is currently being redesigned" +-apse_grep[5]="td.*[^a-zA-Z]\${search_name}[^a-zA-Z0-9]" ++apse_grep[5]="td.*/\${search_name}[-_][0-9]" + apse_sed[5]="s,.*td><[^>]*>\([^ <]*\)<.*,\1,pi" + + #------------------------------------------------------------------------------ diff --git a/patches/autospec-1.4.8-libapse_candidate_versions.patch b/patches/autospec-1.4.8-libapse_candidate_versions.patch new file mode 100644 index 0000000..ca13dbe --- /dev/null +++ b/patches/autospec-1.4.8-libapse_candidate_versions.patch @@ -0,0 +1,93 @@ +--- lib/libapse.lib.in 2009-10-16 11:50:55.000000000 +0200 ++++ lib/libapse.lib.in 2009-07-23 00:16:29.000000000 +0200 +@@ -12,6 +12,12 @@ + + . /usr/share/autospec/lib/libmsgmng.lib + ++[ -r /usr/share/autospec/lib/libspec.lib ] || ++ { echo "$me: "$"library not found"": /usr/share/autospec/lib/libspec.lib" 1>&2 ++ exit 1; } ++ ++. /usr/share/autospec/lib/libspec.lib ++ + if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +@@ -317,24 +323,66 @@ + *) notify.warning $"curl error (exit code: $retval)" ;; + esac + +- local pcknameregexp=$(echo $pcknameverbatim | sed "\ +- s,%[{]*name[}]*,$specname, +- s,%[{]*version[}]*,\\\([A-Za-z0-9._]*\\\), +- s,%[{]*.*[}]*,[A-Za-z0-9._]*, +- s,\.gz$,., +- s,\.tgz$,., +- s,\.bz2$,., +- s,\.lzma$,.,") ++ local svar svalue spck candidate_version ++ # filter "?var:" expressions ++ spck=`echo $pcknameverbatim | sed "s,%{?[A-Za-z0-9_]*:.*\(%[A-Za-z0-9_]*\)},\1,"` ++ ++ while true; do ++ svar=`echo $spck | sed "\ ++ s,.*%[{]*\([A-Za-z0-9_]*\)[}]*.*,\1,"` ++ [ "$svar" = "$spck" ] && break ++ if [ "$svar" = "version" ]; then ++ svalue="\\\([A-Za-z0-9._]*\\\)" ++ else ++ svalue=`rpmvars.solve "%$svar" "$spec_dir/$specname.spec"` ++ [ "$svalue" = "%$svar" ] && svalue= ++ fi ++ spck=`echo $spck | sed "\ ++ s,%[{]*$svar[}]*,$svalue,"` ++ done + ++ # remove archiver extension from rexexp to match changes ++ local pcknameregexp=$(echo [^A-Za-z0-9._-]$spck | sed "\ ++ s,\.gz$,\\\., ++ s,\.tgz$,\\\., ++ s,\.bz2$,\\\., ++ s,\.lzma$,\\\., ++ s,\.lz$,\\\., ++ s,\.tbz2$,\\\.,") ++#echo $pcknameregexp + if [ $? -eq 0 ]; then + if [ "${pcknameregexp/(/}" = "${pcknameregexp}" ]; then + notify.warning "* "$"not parametric source0 name; cannot update" + else +- new_version=$(\ ++ candidate_versions=($(\ + grep -i "$pcknameregexp" $fcurlout | \ + sed "\ +-s,.*$pcknameregexp.*,\1,g" | \ +-sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 | head -n1) ++s,.*$pcknameregexp.*,\1,g ++s,.*\.md5,, ++s,\.zip$,, ++s,\.tar\.gz$,, ++s,\.tar\.bz2$,, ++s,\.gz$,, ++s,\.tgz$,, ++s,\.bz2$,, ++s,\.lzma$,, ++s,\.i386$,, ++s,\.bin$,, ++s,\.exe$,, ++s,\.dmg$,, ++s,\.tbz2$,, ++s,\.lz$,," | ++sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 )) ++ ++ local curr_version_dots new_version_dots candidate_version ++ curr_version_dots=`echo $SPEC_VERSION | tr -d [0-9][A-Z][a-z]_` ++ for candidate_version in ${candidate_versions[*]}; do ++ # skip version with no dots if current version has at least one (e.g. date release like 20000110) ++ new_version_dots=`echo $candidate_version | tr -d [0-9][A-Z][a-z]_` ++ [ ${#new_version_dots} = 0 -a ${#curr_version_dots} -gt 0 ] && continue ++ new_version=$candidate_version ++ break ++ done + fi + fi + diff --git a/patches/autospec-1.4.9-python_opt.patch b/patches/autospec-1.4.9-python_opt.patch new file mode 100644 index 0000000..635a569 --- /dev/null +++ b/patches/autospec-1.4.9-python_opt.patch @@ -0,0 +1,11 @@ +--- autospec-1.4.9/templates/python.orig 2010-01-07 13:40:56.000000000 +0100 ++++ autospec-1.4.9/templates/python 2010-01-07 13:44:18.000000000 +0100 +@@ -27,6 +27,8 @@ + %install + [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + python setup.py install \ ++ -O1 \ ++ --skip-build \ + --root="%{buildroot}" \ + --install-headers=%{_includedir}/python \ + --install-lib=%{python_sitearch} diff --git a/patches/autospec-1.4.9-python_template.patch b/patches/autospec-1.4.9-python_template.patch new file mode 100644 index 0000000..5d512fe --- /dev/null +++ b/patches/autospec-1.4.9-python_template.patch @@ -0,0 +1,17 @@ +diff -Nru autospec-1.4.9.orig/templates/python autospec-1.4.9/templates/python +--- autospec-1.4.9.orig/templates/python 2008-05-11 22:41:59.000000000 +0200 ++++ autospec-1.4.9/templates/python 2010-01-06 10:55:10.781675316 +0100 +@@ -22,11 +22,11 @@ + %setup -q + + %build +-CFLAGS=\"%{optflags}\" python setup.py build ++CFLAGS=\"%{optflags}\" %{__python} setup.py build + + %install + [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +-python setup.py install \ ++%{__python} setup.py install \ + --root="%{buildroot}" \ + --install-headers=%{_includedir}/python \ + --install-lib=%{python_sitearch} diff --git a/patches/autospec-1.5.0-autobuildreq_use_whatprovides.patch b/patches/autospec-1.5.0-autobuildreq_use_whatprovides.patch new file mode 100644 index 0000000..b0f74b2 --- /dev/null +++ b/patches/autospec-1.5.0-autobuildreq_use_whatprovides.patch @@ -0,0 +1,12 @@ +diff -Nru autospec-1.5.0.orig//plugins/pck-update.in autospec-1.5.0/plugins/pck-update.in +--- autospec-1.5.0.orig//plugins/pck-update.in 2010-08-02 17:29:37.430222332 +0200 ++++ autospec-1.5.0/plugins/pck-update.in 2010-08-02 17:30:44.363341447 +0200 +@@ -2353,7 +2353,7 @@ + buildreq=libpython-devel + else + # unidentified requirement +- buildreq=`rpm -q $req 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` ++ buildreq=`rpm -q --whatprovides $req 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` + [ "$buildreq" ] || echo "#$req: not found; what is this?" >> $frequires + fi + if [ "${buildreq}" -a "${buildreq/%-devel/}" = "${buildreq}" ]; then diff --git a/patches/autospec-1.5.0-dont_backup_srpm_with_nosrpm_option.patch b/patches/autospec-1.5.0-dont_backup_srpm_with_nosrpm_option.patch new file mode 100644 index 0000000..922dd59 --- /dev/null +++ b/patches/autospec-1.5.0-dont_backup_srpm_with_nosrpm_option.patch @@ -0,0 +1,11 @@ +diff -Nru autospec-1.5.0.orig//plugins/pck-update.in autospec-1.5.0/plugins/pck-update.in +--- autospec-1.5.0.orig//plugins/pck-update.in 2010-08-04 13:53:29.024307664 +0200 ++++ autospec-1.5.0/plugins/pck-update.in 2010-08-04 13:56:16.759307837 +0200 +@@ -2992,6 +2992,7 @@ + + # print the old SRPMS package... + [[ -n "$SPEC_FILENAME_old" && \ ++ "$nosrpm" != "1" && \ + "$SPEC_VERSION_old-$SPEC_RELEASE_old" != \ + "$SPEC_VERSION-$SPEC_RELEASE" ]] && + { let "srpm_pcks_to_backup = 1" diff --git a/patches/autospec-1.5.0-fix_undefined_SPECFILE_PREPROCESSED.patch b/patches/autospec-1.5.0-fix_undefined_SPECFILE_PREPROCESSED.patch new file mode 100644 index 0000000..0196d9b --- /dev/null +++ b/patches/autospec-1.5.0-fix_undefined_SPECFILE_PREPROCESSED.patch @@ -0,0 +1,15 @@ +diff -Nru autospec-1.5.0.orig//plugins/pck-update autospec-1.5.0/plugins/pck-update +--- autospec-1.5.0.orig//plugins/pck-update.in 2010-08-08 17:45:44.896183449 +0200 ++++ autospec-1.5.0/plugins/pck-update.in 2010-08-08 19:43:32.147316080 +0200 +@@ -436,9 +436,9 @@ + 2>/dev/null >> $specfile_preprocessed" || + notify.error $"rpm exited with error code \`$?'" + +- SPECFILE_PREPROCESSED="$specfile_preprocessed" +- notify.debug "SPECFILE_PREPROCESSED = \"$SPECFILE_PREPROCESSED\"" + fi ++ SPECFILE_PREPROCESSED="$specfile_preprocessed" ++ notify.debug "SPECFILE_PREPROCESSED = \"$SPECFILE_PREPROCESSED\"" + echo "SPECFILE_PREPROCESSED=\"$SPECFILE_PREPROCESSED\"" >> $infofile + + # set the variables 'rpmvar_name[]', 'rpmvar_value[]', 'rpmvar_expr[]' diff --git a/patches/autospec-1.5.0-get_default_arch_from_rpm.patch b/patches/autospec-1.5.0-get_default_arch_from_rpm.patch new file mode 100644 index 0000000..b2062c1 --- /dev/null +++ b/patches/autospec-1.5.0-get_default_arch_from_rpm.patch @@ -0,0 +1,13 @@ +diff -Nru autospec-1.5.0/plugins/pck-update.in autospec-1.5.0.orig//plugins/pck-update.in +--- autospec-1.5.0/plugins/pck-update.in 2010-08-21 19:13:06.294003023 +0200 ++++ autospec-1.5.0.orig//plugins/pck-update.in 2010-08-21 19:12:32.407002798 +0200 +@@ -896,8 +896,7 @@ + if [ ! "$target_cpu" ]; then + target_cpu="${SPEC_BUILDARCH:-$BUILD_ARCH}" + if [ "$target_cpu" == "noarch" ]; then ++ target_cpu=`rpm --eval %{_host_cpu}` +- set -- ${arch_list[@]} +- target_cpu=$1 + fi + fi + notify.debug "target_cpu = $target_cpu" diff --git a/patches/autospec-1.5.0-hidden_spec_old_files.patch b/patches/autospec-1.5.0-hidden_spec_old_files.patch new file mode 100644 index 0000000..7c8863e --- /dev/null +++ b/patches/autospec-1.5.0-hidden_spec_old_files.patch @@ -0,0 +1,43 @@ +diff -Nru autospec-1.5.0.orig//plugins/pck-update.in autospec-1.5.0/plugins/pck-update.in +--- autospec-1.5.0.orig//plugins/pck-update.in 2010-08-08 17:41:33.864557659 +0200 ++++ autospec-1.5.0/plugins/pck-update.in 2010-08-08 17:43:53.356307747 +0200 +@@ -880,11 +880,11 @@ + function specfile.rotate_bck() { + local v + for v in `seq $((${spec_backup_numbers:-5} - 2)) -1 0`; do +- [[ -e $spec_dir/${SRPM_SPECFILE}.$v.old ]] && ++ [[ -e $spec_dir/.${SRPM_SPECFILE}.$v.old ]] && + { notify.debug "\ +-[$spec_dir] ${SRPM_SPECFILE}.$v.old --> ${SRPM_SPECFILE}.$(($v + 1)).old" +- mv -f $spec_dir/${SRPM_SPECFILE}.$v.old \ +- $spec_dir/${SRPM_SPECFILE}.$(($v + 1)).old; } ++[$spec_dir] .${SRPM_SPECFILE}.$v.old --> .${SRPM_SPECFILE}.$(($v + 1)).old" ++ mv -f $spec_dir/.${SRPM_SPECFILE}.$v.old \ ++ $spec_dir/.${SRPM_SPECFILE}.$(($v + 1)).old; } + done + } + +@@ -1230,9 +1230,9 @@ + if [ -e "$spec_dir/$SRPM_SPECFILE" ]; then + notify.note $"\ + making a ${NOTE}backup copy${NORM} of the current specfile"" +- --> ${NOTE}$spec_dir/${SRPM_SPECFILE}.0.old${NORM}" ++ --> ${NOTE}$spec_dir/.${SRPM_SPECFILE}.0.old${NORM}" + cp -f $spec_dir/$SRPM_SPECFILE \ +- $spec_dir/${SRPM_SPECFILE}.0.old ++ $spec_dir/.${SRPM_SPECFILE}.0.old + fi + + rpm -hiv --nodeps \ +@@ -1372,9 +1372,9 @@ + # + # notify.note $"\ + #making a ${NOTE}backup copy${NORM} of the current specfile"" +-# --> ${NOTE}$spec_dir/${SRPM_SPECFILE}.0.old${NORM}" ++# --> ${NOTE}$spec_dir/.${SRPM_SPECFILE}.0.old${NORM}" + # cp -f $SRPM_SPECFILE_WITH_PATH \ +-# ${SRPM_SPECFILE_WITH_PATH}.0.old ++# .${SRPM_SPECFILE_WITH_PATH}.0.old + + notify.note $"${NOTE}updating${NORM} the new specfile \ + \`${NOTE}$spec_dir/$SRPM_SPECFILE${NORM}'""..." diff --git a/patches/autospec-1.5.0-install_srpms_with_nodeps.patch b/patches/autospec-1.5.0-install_srpms_with_nodeps.patch new file mode 100644 index 0000000..bb79350 --- /dev/null +++ b/patches/autospec-1.5.0-install_srpms_with_nodeps.patch @@ -0,0 +1,12 @@ +diff -Nru autospec-1.5.0.orig//plugins/pck-update.in autospec-1.5.0/plugins/pck-update.in +--- autospec-1.5.0.orig//plugins/pck-update.in 2010-07-17 23:00:50.000000000 +0200 ++++ autospec-1.5.0/plugins/pck-update.in 2010-07-31 19:55:55.222342783 +0200 +@@ -1235,7 +1235,7 @@ + $spec_dir/${SRPM_SPECFILE}.0.old + fi + +- rpm -hiv \ ++ rpm -hiv --nodeps \ + --define "%_specdir $spec_dir" \ + --define "%_sourcedir $source_dir" \ + $srpms_dir/$got_SPEC_FILENAME 2>&1 >/dev/null || diff --git a/patches/autospec-1.5.0-noarch_allow_upload_to_given_arch_only-2.patch b/patches/autospec-1.5.0-noarch_allow_upload_to_given_arch_only-2.patch new file mode 100644 index 0000000..7e0fcee --- /dev/null +++ b/patches/autospec-1.5.0-noarch_allow_upload_to_given_arch_only-2.patch @@ -0,0 +1,80 @@ +diff -Nru autospec-1.5.0.orig//plugins/pck-update.in autospec-1.5.0/plugins/pck-update.in +--- autospec-1.5.0.orig//plugins/pck-update.in 2010-08-16 14:02:21.485570021 +0200 ++++ autospec-1.5.0/plugins/pck-update.in 2010-08-16 14:03:53.353694250 +0200 +@@ -2269,8 +2269,13 @@ + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture +- filename="$rpms_dir/$target_cpu/\ ++ if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then ++ filename="$rpms_dir/noarch/\ ++$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" ++ else ++ filename="$rpms_dir/$target_cpu/\ + $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" ++ fi + #notify.note " * $filename" + [ -e $filename ] || + notify.error $"package not found"": \`$filename'" +@@ -2283,8 +2288,13 @@ + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture +- filename="$rpms_dir/$target_cpu/\ ++ if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then ++ filename="$rpms_dir/noarch/\ ++$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" ++ else ++ filename="$rpms_dir/$target_cpu/\ + $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" ++ fi + notify.note " * $filename" + #[ -e $filename ] || + # notify.error $"package not found"": \`$filename'" +@@ -2389,9 +2399,14 @@ + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture +- filename="$rpms_dir/$target_cpu/\ ++ if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then ++ filename="$rpms_dir/noarch/\ ++$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" ++ else ++ filename="$rpms_dir/$target_cpu/\ + $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" +- notify.note " * $filename" ++ fi ++ notify.note " * $filename" + [ -e $filename ] || + notify.error $"package not found"": \`$filename'" + done +@@ -2578,8 +2593,13 @@ + $tool -b $filename | sed "s,*.*/\(.*\),\1," + local i=0 + for pck in ${SPEC_TARGET[@]}; do +- filename="$rpms_dir/$target_cpu/\ ++ if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then ++ filename="$rpms_dir/noarch/\ ++$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" ++ else ++ filename="$rpms_dir/$target_cpu/\ + $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" ++ fi + [ -e "$filename" ] || + notify.error $"package not found"": \`$filename'" + $tool -b $filename | sed "s,*.*/\(.*\),\1," +@@ -3116,8 +3136,13 @@ + if [ "$rpm_download_and_install" ]; then + local pck2install_list="" + for pck in ${SPEC_TARGET[@]}; do +- filename="$rpms_dir/$target_cpu/\ ++ if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then ++ filename="$rpms_dir/noarch/\ ++$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" ++ else ++ filename="$rpms_dir/$target_cpu/\ + $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" ++ fi + + [[ -n "$rpm_install_noinstall_mask" && + $filename =~ $rpm_install_noinstall_mask ]] && continue diff --git a/patches/autospec-1.5.0-noarch_allow_upload_to_given_arch_only.patch b/patches/autospec-1.5.0-noarch_allow_upload_to_given_arch_only.patch new file mode 100644 index 0000000..7bb9479 --- /dev/null +++ b/patches/autospec-1.5.0-noarch_allow_upload_to_given_arch_only.patch @@ -0,0 +1,106 @@ +diff -Nru autospec-1.5.0.orig//plugins/pck-update.in autospec-1.5.0/plugins/pck-update.in +--- autospec-1.5.0.orig//plugins/pck-update.in 2010-08-12 12:13:49.374802087 +0200 ++++ autospec-1.5.0/plugins/pck-update.in 2010-08-12 12:22:00.533683095 +0200 +@@ -893,31 +893,23 @@ + # args: + # none + function target_cpu.set_and_check() { +- if [ "$target_cpu" ]; then +- # command '--arch' used by user to force the architecture +- # 'BuildArch' in the specfile takes precedence over cmdline +- if [[ -n "$SPEC_BUILDARCH" && \ +- "$target_cpu" != "$SPEC_BUILDARCH" ]]; then +- notify.warning $"\ +-command line architecture ignored, using:"\ +-" \`${NOTE}$SPEC_BUILDARCH${NORM}' (BuildArch)" +- target_cpu="$SPEC_BUILDARCH" +- fi +- else ++ if [ ! "$target_cpu" ]; then + target_cpu="${SPEC_BUILDARCH:-$BUILD_ARCH}" ++ if [ "$target_cpu" == "noarch" ]; then ++ set -- ${arch_list[@]} ++ target_cpu=$1 ++ fi + fi + notify.debug "target_cpu = $target_cpu" + +- if [ "$target_cpu" != "noarch" ]; then +- # check if the 'target_cpu' is an allowed architecture +- local arch_list_curr bad_arch=1 +- for arch_list_curr in ${arch_list[@]}; do +- [ "$arch_list_curr" = "$target_cpu" ] && +- { let "bad_arch = 0"; break; } +- done +- [ "$bad_arch" = 1 ] && +- notify.error $"unsupported architecture"": \`$target_cpu'" +- fi ++ # check if the 'target_cpu' is an allowed architecture ++ local arch_list_curr bad_arch=1 ++ for arch_list_curr in ${arch_list[@]}; do ++ [ "$arch_list_curr" = "$target_cpu" ] && ++ { let "bad_arch = 0"; break; } ++ done ++ [ "$bad_arch" = 1 ] && ++ notify.error $"unsupported architecture"": \`$target_cpu'" + } + + # function package.update() +@@ -2801,21 +2793,32 @@ + if [ "$norpms" = "0" ]; then + let "i = 0" + for pck in ${SPEC_TARGET[@]}; do +- filename="\ +-$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" +- [ -e $rpms_dir/$target_cpu/$filename ] && +- notify.note "\ +- * ${NOTE}$filename${NORM}" || +- notify.error $"\ +-package not found"": \`$rpms_dir/$target_cpu/$filename'" +- + # copy noarch packages to all the repository set in the + # configuration variable `arch_noarch_upload[]' +- if [ "$target_cpu" = "noarch" ]; then ++ if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" = "noarch" ]; then ++ filename="\ ++$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" ++ [ -e $rpms_dir/noarch/$filename ] && ++ notify.note "\ ++ * ${NOTE}$filename${NORM}" || ++ notify.error $"\ ++package not found"": \`$rpms_dir/noarch/$filename'" ++ + for upload_arch in \ + ${arch_noarch_upload[$ftp_server_upload_num]}; do +- currurl="\ ++ if [ "$upload_arch" == "@arch@" ]; then ++ if [ "$target_cpu" != "noarch" ]; then ++ currurl="\ ++$(repository.resolveURL "$upload_ftp_rpms_dir" "${target_cpu}")" ++ else ++ set -- ${arch_list[*]} ++ currurl="\ ++$(repository.resolveURL "$upload_ftp_rpms_dir" "$1")" ++ fi ++ else ++ currurl="\ + $(repository.resolveURL "$upload_ftp_rpms_dir" "$upload_arch")" ++ fi + notify.note "\ + --> ""$upload_ftp_server${upload_ftp_port:+:$upload_ftp_port} :: $currurl" + +@@ -2839,6 +2842,14 @@ + [ $? -eq 0 ] || exit 1 + done + else ++ filename="\ ++$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" ++ [ -e $rpms_dir/$target_cpu/$filename ] && ++ notify.note "\ ++ * ${NOTE}$filename${NORM}" || ++ notify.error $"\ ++package not found"": \`$rpms_dir/$target_cpu/$filename'" ++ + currurl="\ + $(repository.resolveURL "$upload_ftp_rpms_dir" "$target_cpu")" + notify.note "\ diff --git a/patches/autospec-1.5.0-replace_obsolete_PreReq.patch b/patches/autospec-1.5.0-replace_obsolete_PreReq.patch new file mode 100644 index 0000000..0567228 --- /dev/null +++ b/patches/autospec-1.5.0-replace_obsolete_PreReq.patch @@ -0,0 +1,75 @@ +diff -Nru autospec-1.5.0.orig//autospec.spec.in autospec-1.5.0/autospec.spec.in +--- autospec-1.5.0.orig//autospec.spec.in 2010-07-11 20:58:17.000000000 +0200 ++++ autospec-1.5.0/autospec.spec.in 2010-08-09 00:38:28.364052465 +0200 +@@ -13,7 +13,7 @@ + Packager: Davide Madrisan + URL: http://www.openmamba.org/packages.html + Source: autospec-%{version}.tar.bz2 +-PreReq: rpm ++Requires(pre): rpm + Requires: cpio, coreutils, curl, findutils, grep, sed + Requires: /bin/mktemp + Requires: /usr/bin/getopt +diff -Nru autospec-1.5.0.orig//plugins/pck-update.in autospec-1.5.0/plugins/pck-update.in +--- autospec-1.5.0.orig//plugins/pck-update.in 2010-08-09 00:37:02.782052085 +0200 ++++ autospec-1.5.0/plugins/pck-update.in 2010-08-09 00:39:07.550052253 +0200 +@@ -758,7 +758,7 @@ + notify.debug "rpm_macro_uninstallinfo check failed"; } + fi + if [ "$rpm_macro_installinfo_binary" ]; then +- grep -q "PreReq[ \t]*:[ \t]*${rpm_macro_installinfo_binary}" \ ++ grep -q "Requires(post)[ \t]*:[ \t]*${rpm_macro_installinfo_binary}" \ + $specfile || + { let "errors += 1" + notify.debug "rpm_macro_installinfo_binary check failed"; } +@@ -769,8 +769,8 @@ + --------------------------------------- + ${NOTE}"$"Hint"":${NORM} + $([[ "$rpm_macro_installinfo_binary" ]] && +- echo "PreReq: $rpm_macro_installinfo_binary" || +- echo "PreReq: ${path_installinfo:-/sbin/install-info}") ++ echo "Requires(post):$rpm_macro_installinfo_binary" || ++ echo "Requires(post):${path_installinfo:-/sbin/install-info}") + + %post [] + $([[ "$rpm_macro_installinfo" ]] && +diff -Nru autospec-1.5.0.orig//plugins/spec-create.in autospec-1.5.0/plugins/spec-create.in +--- autospec-1.5.0.orig//plugins/spec-create.in 2010-04-12 20:04:46.000000000 +0200 ++++ autospec-1.5.0/plugins/spec-create.in 2010-08-09 00:39:27.935677047 +0200 +@@ -782,8 +782,8 @@ + License: ${spec_license:-$license_defvalue}" + if [ "$(specfile.infopages --exist)" = 1 ]; then + [ "$rpm_macro_installinfo_binary" ] && +- echo "PreReq: ${rpm_macro_installinfo_binary}" || +- echo "PreReq: ${path_installinfo:-/sbin/install-info}" ++ echo "Requires(post):${rpm_macro_installinfo_binary}" || ++ echo "Requires(post):${path_installinfo:-/sbin/install-info}" + fi + [ "$spec_requires" ] && echo Requires: $spec_requires + [ "$spec_buildrequires" ] && echo BuildRequires: $spec_buildrequires +diff -Nru autospec-1.5.0.orig//tests/test01_pkgquality.in autospec-1.5.0/tests/test01_pkgquality.in +--- autospec-1.5.0.orig//tests/test01_pkgquality.in 2010-05-14 21:33:13.000000000 +0200 ++++ autospec-1.5.0/tests/test01_pkgquality.in 2010-08-09 00:40:03.792692378 +0200 +@@ -270,8 +270,8 @@ + --------------------------------------- + ${NOTE}"$"Hint"":${NORM} + $([[ "$rpm_macro_installinfo_binary" ]] && +- echo "PreReq: $rpm_macro_installinfo_binary" || +- echo "PreReq: ${path_installinfo:-/sbin/install-info}") ++ echo "Requires(post):$rpm_macro_installinfo_binary" || ++ echo "Requires(post):${path_installinfo:-/sbin/install-info}") + + %post [] + $([[ "$rpm_macro_installinfo" ]] && +diff -Nru autospec-1.5.0.orig//unmaintained/mbrowse.spec autospec-1.5.0/unmaintained/mbrowse.spec +--- autospec-1.5.0.orig//unmaintained/mbrowse.spec 2006-11-24 18:58:24.000000000 +0100 ++++ autospec-1.5.0/unmaintained/mbrowse.spec 2010-08-09 00:40:35.354052403 +0200 +@@ -59,7 +59,7 @@ + #Patch3: http://www.awebsiteintheworld.org/awebpatch-%{version}.patch + BuildRequires: net-snmp-devel >= 4.2 + BuildRequires: libopenssl-devel +-PreReq: %{__install_info} ++Requires(post):%{__install_info} + %if %with_gui + BuildRequires: libgtk1-devel >= 1.2.10 + #BuildRequires: libglib2-devel >= 2.1.5 diff --git a/patches/autospec-1.5.0-use_smart_for_rpm_download_and_install.patch b/patches/autospec-1.5.0-use_smart_for_rpm_download_and_install.patch new file mode 100644 index 0000000..e9ad509 --- /dev/null +++ b/patches/autospec-1.5.0-use_smart_for_rpm_download_and_install.patch @@ -0,0 +1,13 @@ +diff -Nru autospec-1.5.0.orig//autospec.conf.in autospec-1.5.0/autospec.conf.in +--- autospec-1.5.0.orig//autospec.conf.in 2010-07-17 23:09:02.000000000 +0200 ++++ autospec-1.5.0/autospec.conf.in 2010-08-02 13:10:25.213473018 +0200 +@@ -134,7 +134,8 @@ + # Cmnd_Alias DISTRO_CMD = /usr/bin/apt-get, /bin/rpm + # %packager ALL = NOPASSWD: DISTRO_CMD + # (of course your user must belong to the `packager' group) +-rpm_download_and_install="sudo apt-get --quiet --yes install" ++#rpm_download_and_install="sudo apt-get --quiet --yes install" ++rpm_download_and_install="sudo smart install --yes" + rpm_install="sudo rpm -hUv" + rpm_install_force="sudo rpm -hUv --force --nodeps" + diff --git a/patches/autospec-install.patch b/patches/autospec-install.patch new file mode 100644 index 0000000..e23b178 --- /dev/null +++ b/patches/autospec-install.patch @@ -0,0 +1,12 @@ +--- pck-update.orig 2008-10-11 15:55:53.000000000 +0200 ++++ pck-update 2008-10-11 15:56:00.000000000 +0200 +@@ -3608,8 +3608,7 @@ + [ "$rpm_install_force" ] || notify.error "\ + \`rpm_install_force': "$"unset in the configuration files" + notify.debug "$rpm_install_force $pck2install_list" +- $rpm_install_force $pck2install_list || +- notify.error $"cannot install the new rpm packages" ++ $rpm_install_force $pck2install_list + else + [ "$rpm_install" ] || notify.error "\ + \`rpm_install': "$"unset in the configuration files" diff --git a/patches/autospec-trver.patch b/patches/autospec-trver.patch new file mode 100644 index 0000000..950c724 --- /dev/null +++ b/patches/autospec-trver.patch @@ -0,0 +1,12 @@ +--- libapse.lib.orig 2008-10-10 01:39:44.000000000 +0200 ++++ libapse.lib 2008-10-10 01:50:06.000000000 +0200 +@@ -429,7 +429,8 @@ + unset APSE_LAST_VERSION + + if [ "$last_version" ]; then +- APSE_LAST_VERSION="$last_version" ++ last_version="${last_version/-/.}" ++ APSE_LAST_VERSION="${last_version}" + notify.note $"\ + last version of \`${NOTE}$specname${NORM}' found:"" \ + \`${NOTE}$last_version${NORM}'" diff --git a/plugins/Makefile b/plugins/Makefile new file mode 100644 index 0000000..3467ad0 --- /dev/null +++ b/plugins/Makefile @@ -0,0 +1,45 @@ +# Makefile for autospec +# Copyright (C) 2008 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +srcdir = .. + +include $(srcdir)/Makefile.env + +pck_plugins := config-getvar pck-extract pck-update spec-create-old spec-create +pck_plugins_infiles := $(wildcard *.in) + +all: + +check: $(pck_plugins) + @for f in $(pck_plugins); do\ + echo -n "checking $$f... ";\ + bash -n $$f \ + && echo "[PASSED]" || { echo "[FAILED]"; exit 1; };\ + done + +install: $(pck_plugins) + @$(INSTALL_DIR) $(DESTDIR)$(plugindir) + for f in $(pck_plugins); do\ + $(INSTALL_SCRIPT) $${f} $(DESTDIR)$(plugindir)/$${f};\ + done + +uninstall: + for f in $(pck_plugins); do\ + rm -f $(DESTDIR)$(plugindir)/$${f};\ + done + +clean: + rm -f $(patsubst %.in,%,$(pck_plugins_infiles)) diff --git a/plugins/config-getvar.in b/plugins/config-getvar.in new file mode 100644 index 0000000..272b418 --- /dev/null +++ b/plugins/config-getvar.in @@ -0,0 +1,234 @@ +#!/bin/bash +# config-getvar -- plugin for @package@ +# Copyright (C) 2007,2008,2010,2011 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] && + { echo $"this script requires bash version 3 or better" >&2 && exit 1; } + +me=(${0##*/} "@version@" "@date@") + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +# default values: +# - colorized output (disabled by default) +let "colorize = 0" +# - output verbosity +let "verbose = 1" + +# load the configuration file(s) +[ -r @libdir@/libcfg.lib ] || + { echo "$me: "$"library not found"": @libdir@/libcfg.lib" 1>&2 + exit 1; } +. @libdir@/libcfg.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="${me[0]}"; export TEXTDOMAIN + +function copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function version() { + echo "\ +${me[0]} ${me[1]} +Copyright (C) 2004-2008,2010,2011 Davide Madrisan " +} + +# $1: optional exit code (default is '1') +function usage() { + version + echo "\ +"$"Print the value of a given configuration variable"". + +"$"Usage"": + @frontend@ [-C ] --eval= + +"$"where the above options mean"": + --eval "$"Print the value of the configuration variable "" + -C, --config "$"Use an alternate configuration file"" "" + "$"Default files:"" ${default_cfg[0]}, ${default_cfg[1]}"" + +"$"Operation modes"": + -h, --help "$"Print this help, then exit"" + -V, --version "$"Print version number, then exit"" + -q, --quiet "$"Run in quiet mode"" + -r, --colorize "$"Enable the colorized output"" + -D, --debug "$"Run in debugging mode (very verbose output)"" + +"$"Samples"": + @frontend@ -q -C ${default_cfg[0]} --eval=\"logging_dir\" + +"$"Report bugs to ." + + exit ${1:-1} +} + +case $1 in + --autospec-args-file*) + if [[ "$1" =~ = ]]; then + argsfile=`echo $1 | sed 's/^--autospec-args-file=//'` + else + argsfile=$2 + fi + [ -r "$argsfile" ] || notify.error $"cannot read"": \`$argsfile'" + . $argsfile && rm -f $argsfile + ;; +esac + +for arg in $@; do + case $arg in + -h|--help) usage 0 ;; + -V|--version) version; echo; copying; exit 0 ;; + esac +done + +exec_options=`LANG=C getopt \ + -o C:DqrhV \ + --long eval:,config:,\ +debug,quiet,colorize,help,version,\ +frontend_opts: \ + -n "$me" -- "$@"` +[ $? = 0 ] || exit 1 + +notify.debug "[ ${0} ${exec_options} ]\n" +eval set -- "$exec_options" + +while :; do + case $1 in + -C|--config) + cfg_file=$2; shift ;; + --eval) + autospecvar="$2"; shift ;; + -D|--debug) + let "verbose = 2" ;; + -q|--quiet) + let "verbose = 0" ;; + -r|--colorize) + let "colorize = 1" ;; + -h|--help) + usage 0 ;; + -V|--version) + version; echo; copying; exit 0 ;; + --) shift; break ;; + *) notify.error $"unrecognized option"" -- \`$1'" ;; + esac + shift +done + +for arg in $@; do + [[ -z "$s_rpm_pck" ]] && s_rpm_pck=$arg || + notify.error $"unrecognized option"" -- \`$arg'" +done + +[ "$colorize" = "1" ] && notify.enable_colors + +# config.getvar() +# Parameters: +# $1 : the configuration file where to look at +# $2 : the configuration variable to expand +# Description: +# Expand the configuration variable `$2' looking in the file `$1' +function config.getvar() { + notify.debug "[ ${0}${exec_options} ]\n" + + local cfg_file="$1" + local autospecvar="$2" + local cfg_file_lst + + if [ "$cfg_file" ]; then + [ -r $cfg_file ] || + notify.error $"configuration file not found"" -- \`$cfg_file'" + cfg_file_lst="$cfg_file" + else + cfg_file_lst="${default_cfg[*]}" + fi + notify.debug "cfg_file_lst = \"$cfg_file_lst\"" + + unset value autospecvar_val autospecvar_file autospecvar_sed + autospecvar_sed=$(\ +echo "$autospecvar" | sed 's,\[,\\[,g;s,\],\\],g') + + for f in $cfg_file_lst; do + [ -r $f ] || continue + + confvar_1stline=$(\ +sed -n "/^[ \t]*$autospecvar_sed[[]*[0-9]*[]]*=/p" $f) + if [[ "$confvar_1stline" ]]; then + autospecvar_file="$f" + notify.debug "variable \`$autospecvar' found in \`$f'" + notify.debug "confvar_1stline = \`$confvar_1stline'" + + [ "$verbose" = 0 ] || notify.note "#[$autospecvar_file]" + + confvar_1stline=$(\ +sed -n "/^[ \t]*$autospecvar_sed[[]*[0-9]*[]]*=/p" $autospecvar_file) + notify.debug "confvar_1stline = \`$confvar_1stline'" + + case "$confvar_1stline" in + *[\[0-9*\]]=*) + # an entry like: ftp_rw_srpms_dir[0]="/devel/SRPMS" + case "$autospecvar" in + *[\[0-9*\]]) + sed -n "/^$autospecvar_sed=/{s|.*|&;|p}" \ + $autospecvar_file | + while read line; do notify.note "$line"; done + ;; + *) sed -n "/^$autospecvar_sed\[[0-9*]\]=/{s|.*|&;|p}" \ + $autospecvar_file | + while read line; do notify.note "$line"; done + ;; + esac + ;; + *=\"*\"|*=%*|*=[0-9a-zA-Z]*|*=\$*|*=\(*\)) + # entries like: + # - rpm_macro_make="%make" + # - rpm_macro_make=%make + # - ftp_rw_rpms_dir[0]="/devel/RPMS" + # - arch_list="i586 ppc" + notify.note "${confvar_1stline};" + ;; + *=\(*) + # a variable like: + # rpm_approved_licenses=(\ + # ... + sed -e '/./{H;$!d;}' -e "x;/$autospecvar_sed=(/!d;" \ + $autospecvar_file | + while read line; do + case "$line" in + \#*|"") ;; + *\)) notify.note "${line};" ;; + *) notify.note "$line" ;; + esac + done + ;; + *=\"\\) + # a variable like: + # format_extra_rules="\ + sed -e '/./{H;$!d;}' -e "x;/$autospecvar_sed=\"/!d;" \ + $autospecvar_file | + while read line; do + case "$line" in + \#*|"") ;; + *\") notify.note "${line};" ;; + *) notify.note "$line" ;; + esac + done + ;; + *) notify.error $"(bug)"" -- $FUNCNAME: "$"unknown variable type" + ;; + esac + fi + done +} + +config.getvar "$cfg_file" "$autospecvar" diff --git a/plugins/pck-extract.in b/plugins/pck-extract.in new file mode 100644 index 0000000..5c5a1a8 --- /dev/null +++ b/plugins/pck-extract.in @@ -0,0 +1,270 @@ +#!/bin/bash +# pck-extract -- plugin for @package@ +# Copyright (C) 2004-2010 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] && + { echo $"this script requires bash version 3 or better" >&2 && exit 1; } + +me=(${0##*/} "@version@" "@date@") + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +# default values: +# - colorized output (disabled by default) +let "colorize = 0" +# - output verbosity +let "verbose = 1" + +# load the configuration file(s) +[ -r @libdir@/libcfg.lib ] || + { echo "$me: "$"library not found"": @libdir@/libcfg.lib" 1>&2 + exit 1; } +. @libdir@/libcfg.lib + +[ -r @libdir@/libnetwork.lib ] || + { echo "$me: "$"library not found"": @libdir@/libnetwork.lib" 1>&2 + exit 1; } +. @libdir@/libnetwork.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="${me[0]}"; export TEXTDOMAIN + +function copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function version() { + echo "\ +${me[0]} ${me[1]} +Copyright (C) 2004-2010 Davide Madrisan " +} + +# $1: optional exit code (default is '1') +function usage() { + version + echo "\ +"$"Extract a given file or list of files from a srpm archive"". + +"$"Usage"": + @frontend@ -x -F [--destdir=] + +"$"where the above options mean"": + -x, --extract "$"Extract from the srpm package ..."" + -F, --files "$"...the specified file or list of files "" + --destdir "$"Save extracted files in the directory "" + +"$"Operation modes"": + -h, --help "$"Print this help, then exit"" + -V, --version "$"Print version number, then exit"" + -q, --quiet "$"Run in quiet mode"" + -r, --colorize "$"Enable the colorized output"" + -D, --debug "$"Run in debugging mode (very verbose output)"" + +"$"Samples"": + @frontend@ -x @package@-@version@-1mamba.src.rpm -F \\*.spec --destdir=/tmp/specs + +"$"Report bugs to ." + + exit ${1:-1} +} + +case $1 in + --autospec-args-file*) + if [[ "$1" =~ = ]]; then + argsfile=`echo $1 | sed 's/^--autospec-args-file=//'` + else + argsfile=$2 + fi + [ -r "$argsfile" ] || notify.error $"cannot read"": \`$argsfile'" + . $argsfile && rm -f $argsfile + ;; +esac + +for arg in $@; do + case $arg in + -h|--help) usage 0 ;; + -V|--version) version; echo; copying; exit 0 ;; + esac +done + +exec_options=`LANG=C getopt \ + -o xF:DqrhV \ + --long \ +extract,files:,destdir:,\ +debug,quiet,colorize,help,version,\ +frontend_opts: \ + -n "$me" -- "$@"` +[ $? = 0 ] || exit 1 + +notify.debug "[ ${0} ${exec_options} ]\n" +eval set -- "$exec_options" + +while :; do + case $1 in + -x|--extract) ;; + -F|--files) + filelst="$2"; shift ;; + --destdir) + destdir="$2"; shift ;; + -D|--debug) + let "verbose = 2" ;; + -q|--quiet) + let "verbose = 0" ;; + -r|--colorize) + let "colorize = 1" ;; + -h|--help) + usage 0 ;; + -V|--version) + version; echo; copying; exit 0 ;; + --) shift; break ;; + *) notify.error $"unrecognized option"" -- \`$1'" ;; + esac + shift +done + +for arg in $@; do + [[ -z "$s_rpm_pck" ]] && s_rpm_pck=$arg || + notify.error $"unrecognized option"" -- \`$arg'" +done + +[ "$colorize" = "1" ] && notify.enable_colors + +# s_rpm_pck : the name of the srpm package (local or remote) +# (i.e. /usr/src/RPM/SRPMS/automake-1.9-1qilnx.src.rpm) +# filelst : list of file to extract (default is '*.spec', that is the specfile) +# destdir : the directory where to extract files (current directory if unset) +# +# Extract the specified file(s) `filelst' (default = all files) from the rpm or srpm +# archive `s_rpm_pck' to the optional directory `destdir'. + +[ -z "$filelst" ] && filelst='*' +[ -z "$destdir" ] && destdir='.' + +notify.note "[${NOTE}$s_rpm_pck${NORM}]" + +# check if all the needed tools are available +for tool in bunzip2 cpio gunzip mktemp rpm2cpio; do + [ "$(type -p $tool)" ] || + notify.error $"utility not found"": \`$tool'" +done + +tmpcpiodir=$(mktemp -q -d -t $me.XXXXXXXX) +[ $? -eq 0 ] && + trap "rm -fr $tmpcpiodir" 0 1 2 3 6 7 9 13 15 || + notify.error $"can't create temporary files" +notify.debug "$FUNCNAME: tmpcpiodir = $tmpcpiodir" + +#local s_rpm_pck_name +case "$s_rpm_pck" in +http://*\.src\.*|http://*\.nosrc\.*|ftp://*\.src\.*|ftp://*\.nosrc\.*) + s_rpm_pck_name="${s_rpm_pck##*/}" + notify.debug "$FUNCNAME: s_rpm_pck_name = $s_rpm_pck_name" + + curl.download \ +--options "$curl_options" \ +${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ +--exit-on-err --destdir="$tmpcpiodir" "$s_rpm_pck" + + s_rpm_pck="$tmpcpiodir/$s_rpm_pck_name" +;; +*\.src\.*|*\.nosrc\.*) + s_rpm_pck_name="$s_rpm_pck" + notify.debug "$FUNCNAME: s_rpm_pck_name = $s_rpm_pck_name" + + [[ -e "$s_rpm_pck" ]] || + notify.error $"cannot find:"" \`$s_rpm_pck'" +;; +*) # FIXME : add support for RPMS packages if someone will ask for + notify.error "\`$s_rpm_pck': "$"not a srpm package" ;; +esac + +mkdir -p $destdir 2>/dev/null || notify.error $"cannot create \`$destdir'" + +#local errcode +#local \ +tmpcpiopck="srpm_pck.cpio" + +notify.debug "\ +$FUNCNAME: converting the rpm package into a cpio archive..." + +rpm2cpio $s_rpm_pck > $tmpcpiodir/$tmpcpiopck +let "errcode = $?" +[ "$errcode" = 0 ] || + { rm -fr $tmpcpiodir + notify.debug "$FUNCNAME: exit code of rpm2cpio = \`$errcode'" + notify.error $"can't save extracted files to \`$destdir'"; } + +notify.debug "\ +$FUNCNAME: extracting files from the cpio archive..." + +pushd $tmpcpiodir &>/dev/null + +cpio --quiet --extract --preserve-modification-time \ + < $tmpcpiodir/$tmpcpiopck +let "errcode = $?" +[ "$errcode" = 0 ] || + { rm -fr $tmpcpiodir + notify.debug "$FUNCNAME: exit code of cpio = \`$errcode'" + notify.error $"can't save extracted files to \`$destdir'"; } + +rm -f $tmpcpiodir/$tmpcpiopck + +#notify.debug "\ +#$FUNCNAME: extracting files from the srpm archive..." +# +#rpm2cpio $s_rpm_pck 2>/dev/null | \ +#cpio --quiet --extract $filelst &>/dev/null +#[ $? -ne 0 ] && +# { popd &>/dev/null +# notify.error $"can't save extracted files to \`$destdir'"; } + +popd &>/dev/null + +#local fname +for f in $tmpcpiodir/${filelst:-*}; do + fname=${f##*/} + notify.debug "$FUNCNAME: fname = \"$fname\"" + case $fname in + $s_rpm_pck_name) + ;; + *\.diff.bz2|*\.patch.bz2) + notify.debug "$FUNCNAME: decompressing the patch..." + bunzip2 $f &>/dev/null + [ $? -eq 0 ] || + { rm -fr $tmpcpiodir + notify.warning $"can't decompress the file"" \`$f'"; } + + notify.note " * ${NOTE}$destdir/${fname/\.bz2/}${NORM}" + cp -pf ${f/\.bz2/} $destdir/${fname/\.bz2/} &>/dev/null + ;; + *\.diff.gz|*\.patch.gz) + notify.debug "$FUNCNAME: decompressing the patch..." + gunzip $f &>/dev/null + [ $? -eq 0 ] || + { rm -fr $tmpcpiodir + notify.warning $"can't decompress the file"" \`$f'"; } + + notify.note " * ${NOTE}$destdir/${fname/\.gz/}${NORM}" + cp -pf ${f/\.gz/} $destdir/${fname/\.gz/} &>/dev/null + ;; + *) + notify.note " * ${NOTE}$destdir/$fname${NORM}" + cp -pf $f $destdir/$fname &>/dev/null + ;; + esac + [ $? -eq 0 ] || + { rm -fr $tmpcpiodir + notify.error $"can't save files to \`$destdir'"; } +done + +rm -fr $tmpcpiodir diff --git a/plugins/pck-update.in b/plugins/pck-update.in new file mode 100644 index 0000000..9a77368 --- /dev/null +++ b/plugins/pck-update.in @@ -0,0 +1,3198 @@ +#!/bin/bash +# pck-update -- plugin for @package@ +# Copyright (C) 2004-2011 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] && + { echo $"this script requires bash version 3 or better" >&2 && exit 1; } + +me=(${0##*/} "@version@" "@date@") + +[ $(id -u) -eq 0 ] && + { echo "$me: "$"you're running $me as root" 1>&2 && exit 1; } + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +[ -r @libdir@/libspec.lib ] || + { echo "$me: "$"library not found"": @libdir@/libspec.lib" 1>&2 + exit 1; } +. @libdir@/libspec.lib + +[ -r @libdir@/libnetwork.lib ] || + { echo "$me: "$"library not found"": @libdir@/libnetwork.lib" 1>&2 + exit 1; } +. @libdir@/libnetwork.lib + +[ -r @libdir@/libapse.lib ] || + { echo "$me: "$"library not found"": @libdir@/libapse.lib" 1>&2 + exit 1; } +. @libdir@/libapse.lib + +# default values: +# colorized output (disabled by default) +let "colorize = 0" +# output verbosity +let "verbose = 1" +# +let "cleanup = 0" +let "spec_format = 0" +let "rebuild = 0" +let "force = 0" +let "force_update = 0" +let "force_build = 0" +let "force_install = 0" +let "force_download = 0" +let "force_upload = 0" +# do not enable logging by default +let "logging = 0" +# do upload srpms packages +let "nosrpm = 0" +# do upload rpms packages +let "norpms = 0" +# do not use rpm variables for unix tools +let "format_unix_tools = 0" + +unset ignore_test_list + +# load the configuration file(s) +[ -r @libdir@/libcfg.lib ] || + { echo "$me: "$"library not found"": @libdir@/libcfg.lib" 1>&2 + exit 1; } +. @libdir@/libcfg.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="${me[0]}"; export TEXTDOMAIN + +function copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function version() { + echo "\ +${me[0]} ${me[1]} +Copyright (C) 2004-2010 Davide Madrisan " +} + +# $1: optional exit code (default is '1') +function usage() { + version + echo "\ +"$"Update the package to version and release "". + +"$"Usage"": + @frontend@ -u -a [] [] [-d v1=r1[,v2=r2,...]] \\ + [-l usr:pswd] [-S ] [-A ] \\ + [--server-download ] [--server-upload ] \\ + [--changelog \"msg\" ] [--nosrpm|--norpm] \\ + [--force-update] [--force-build] [--force-install] \\ + [--force-download] [--ignore-test t1[,t2,...]] \\ + [-c] [-f] [-L] [-R] + +"$"where the above options mean"": + -u, --update "$"Update the package to version and release "" + -a, --action "$"Do the actions specified in the comma separated list "" + 0. "$"check for available versions in the $DISTRO repositories"" + 1. "$"download and install the srpm package"" + 2. "$"check if a new version is available"" + 3. "$"download new source files"" + 4. "$"update and check the specfile"" + 5. "$"build the rpm(s) and srpm packages"" + 6. "$"build the list of the build requirements"" + 7. "$"simulate the installation of the rpm package(s)"" + 8. "$"perform some quality and security checks"" + 9. "$"calculate the md5/sha1 hashing values"" + 10. "$"upload the new packages to the ftp repository"","" + "$"*remove* old packages from the ftp repository"" + "$"(move packages to \`\$ftp_rw_old_dir', if set)"" + 11. "$"install the new rpm packages"" + --force-update "$"Force the update of the rpm(s) and srpm packages"" + --force-build "$"Force the rebuild of the rpm(s) and srpm packages"" + --force-install"" + "$"Install the new packages even if rpm complains for errors"" + --force-download"" + "$"Download the source files even if found in SOURCE"" + --force "$"Try to execute the given action(s) bypassing errors"" + --ignore-test "$"Skip the given test number(s)"" (t1[,t2,...])"" + -d, --define "$"Define variables ,,... with values ,,..."" + --server-download"" + "$"Select a server from where to download srpm packages"" + --server-upload "" + "$"Select a server where to upload packages"" + --server "$"Select a server to be used for both download and upload"" + -l, --login "$"FTP user (usr) and password (pswd) for packages upload"" + -S, --specfile "$"Name of the specfile (default: .spec)"" + -A, --arch "$"Force the architecture to a given value"" + --changelog "$"Set change information for the package"" + --nosrpm "$"action"" 5: "$"Only build the rpm packages"" + "$"action"" 10: "$"Do not upload the srpm package"" + --norpm "$"action"" 5: "$"Only build the srpm package"" + "$"action"" 10: "$"Do not upload the rpm packages"" + -c, --clear "$"Remove all the temporary files except (s)rpm packages"" + -f, --format "$"Enable specfile autoformatting"" + -L, --log "$"Unable logging to file (logging dir: \`\$logging_dir')"" + -R, --rebuild "$"Enable rebuilding mode and settings (action 4 only)"" + --root "$"Specify an alternative root directory to rpm"" + +"$"Operation modes"": + -h, --help "$"Print this help, then exit"" + -V, --version "$"Print version number, then exit"" + -q, --quiet "$"Run in quiet mode"" + -r, --colorize "$"Enable the colorized output"" + -D, --debug "$"Run in debugging mode (very verbose output)"" + +"$"Samples"": + @frontend@ -u aPackage 0.1.2 -a4 -f --changelog \""$"changelog entry""\" + @frontend@ --log -u aPackage -a5,7:9 --force-build --define addons_ver=0.9 + @frontend@ -c -u -l usr:pswd aPackage 0.1.2 -a10 --server-upload=1 + @frontend@ -u aPackage -a1,4,5 --arch=noarch --rebuild --ignore-test=6,7 + @frontend@ -u aPackage -a10 --norpm -S /var/tmp/specs/aPackage.spec + @frontend@ -u aPackage -a11 --force-install + +"$"Report bugs to ." + + exit ${1:-1} +} + +case $1 in + --autospec-args-file*) + if [[ "$1" =~ = ]]; then + argsfile=`echo $1 | sed 's/^--autospec-args-file=//'` + else + argsfile=$2 + fi + [ -r "$argsfile" ] || notify.error $"cannot read"": \`$argsfile'" + . $argsfile && rm -f $argsfile + ;; +esac + +for arg in $@; do + case $arg in + -h|--help) usage 0 ;; + -V|--version) version; echo; copying; exit 0 ;; + esac +done + +exec_options=`LANG=C getopt \ + -o ua:d:l:S:A:cfLRDqrhV \ + --long \ +update,action:,define:,login:,specfile:,arch:,\ +server-download:,server-upload:,server:,\ +changelog:,nosrpm,norpm,\ +force-update,force-build,force-install,force-download,force,\ +ignore-test:,clear,format,log,rebuild,root:,\ +debug,quiet,colorize,help,version,\ +frontend_opts: \ + -n "$me" -- "$@"` +[ $? = 0 ] || exit 1 + +eval set -- "$exec_options" + +while :; do + case $1 in + -u|--update) ;; + -a|--action) + steps=$2; shift ;; + -d|--define) + define_list=$2; shift ;; + -l|--login) + cl_ftp_rw_user=${2%%:*} + cl_ftp_rw_passwd=${2##*:}; shift ;; + -S|--specfile) + usrdef_spec=$2 + spec_name="${usrdef_spec##*/}" + spec_dir_conf="$spec_dir" + spec_dir=$(echo "$usrdef_spec" | sed -n "s,[/]*$spec_name$,,p") + [ "$spec_dir" ] || spec_dir="$spec_dir_conf" + case "$spec_dir" in + \.) spec_dir="$(pwd)" ;; + \./*|\.\./*) # not an absolute paths + spec_dir="$(pwd)/$spec_dir" ;; + esac + shift ;; + -A|--arch) + target_cpu="$2"; shift ;; + --server-download) + ftp_server_download_id="$2"; shift ;; + --server-upload) + ftp_server_upload_id="$2"; shift ;; + --server) + ftp_server_download_id="$2" + ftp_server_upload_id="$2" + shift ;; + --changelog) + changelog_userdef="$2"; shift ;; + --nosrpm) + let "nosrpm = 1" ;; + --norpm) + let "norpms = 1" ;; + --force-update) + let "force_update = 1" ;; + --force-build) + let "force_build = 1" ;; + --force-install) + let "force_install = 1" ;; + --force-download) + let "force_download = 1" ;; + --force) + let "force_update = 1" + let "force_build = 1" + let "force_install = 1" + let "force_download = 1" + let "force_upload = 1" ;; + --ignore-test) + ignore_test_list=$2; shift ;; + -c|--clear) + cleanup=1 ;; + -f|--format) + let "spec_format = 1" ;; + -L|--log) + let "logging = 1" ;; + -R|--rebuild) + let "rebuild = 1" ;; + --root) + rpm_rootdir="$2"; shift + rpm_root_opts="--root=$rpm_rootdir" ;; + -D|--debug) + let "verbose = 2" ;; + -q|--quiet) + let "verbose = 0" ;; + -r|--colorize) + let "colorize = 1" ;; + -h|--help) + usage 0 ;; + -V|--version) + version; echo; copying; exit 0 ;; + --) shift; break ;; + *) notify.error $"unrecognized option"" -- \`$1'" ;; + esac + shift +done + +for arg in $@; do + if [[ -z "$pck_name" ]]; then + pck_name=$arg + elif [[ -z "$pck_newver" ]]; then + pck_newver=$arg + elif [[ -z "$pck_newrel" ]]; then + pck_newrel=$arg + else + notify.error $"unrecognized option"" -- \`$arg'" + fi +done + +notify.debug "${0} ${exec_options}" +#echo -e "[ ${0} \\ \n ${exec_options} ]\n" + +if [ -n "$rpm_rootdir" ]; then + [ -d "$rpm_rootdir" ] || + notify.error $"no such file or directory"": $rpm_rootdir" +fi + +[ "$logging" = "1" ] && let "colorize = 0" + +[ "$colorize" = "1" ] && notify.enable_colors +# default values for non mandatory configuration variables +[ "$logging_dir" ] || logging_dir="${tmppath_dir:-/var/tmp}/@package@" + +# check if all the needed tools are available +for tool in cat chmod cpio date file find fold ftp getopt grep host \ + mktemp objdump readlink rpm rpmbuild rpm2cpio sed seq sort strings; do + [ "$(type -p $tool)" ] || + notify.error $"utility not found"": \`$tool'" +done + +# check for configuration mistakes (in the configuration file(s)) +unset upload_ftpserver +for i in `seq 1 1 ${#ftp_rw_server[@]}`; do + # if the entry is not a void string ("") check for mandatory + # related variables + if [ "${ftp_rw_server[$i-1]}" ]; then + [ "${ftp_rw_rpms_dir[$i-1]}" ] || notify.error $"\ +must be set in the configuration file"": \`ftp_rw_rpms_dir[$(($i-1))]'" + [ "${ftp_rw_srpms_dir[$i-1]}" ] || notify.error $"\ +must be set in the configuration file"": \`ftp_rw_srpms_dir[$(($i-1))]'" + fi +done + +#case "$spec_backup_attr" in +# "hidden") ;; "visible") ;; +# *) notify.error $"\ +#unrecognized value for \`spec_backup_attr': $spec_backup_attr" ;; +#esac + +[ "${#ftp_rw_server[@]}" = 0 ] && notify.error $"\ +must be set in the configuration file"": \`ftp_rw_server[]'" + +[ "${#ftpurl_ro_rpms[*]}" = "${#ftp_rw_rpms_dir[*]}" ] || + notify.error "\ +\`ftpurl_ro_rpms', \`ftp_rw_rpms_dir': "$"must have the same size" + +[ "${#ftpurl_ro_srpms[*]}" = "${#ftp_rw_srpms_dir[*]}" ] || + notify.error "\ +\`ftpurl_ro_srpms', \`ftp_rw_srpms_dir': "$"must have the same size" + +[ "${#ftpdir_rw_old[*]}" = "${#ftp_rw_rpms_dir[*]}" ] || + notify.error "\ +\`ftpdir_rw_old', \`ftp_rw_rpms_dir': "$"must have the same size" + +[ "$ftp_rw_server_num_default" ] || notify.error $"\ +must be set in the configuration file"": \`ftp_rw_server_num_default'" +# check if `ftp_rw_server_num_default' is a valid number + +[[ "$ftp_rw_server_num_default" =~ ^[0-9]+$ ]] || + notify.error "\`ftp_rw_server_num_default': "\ +$"illegal value"": \"$ftp_rw_server_num_default\"" +[ "$ftp_rw_server_num_default" -lt ${#ftp_rw_rpms_dir[*]} ] || + notify.error "\`ftp_rw_server_num_default': "\ +$"illegal value"": \"$ftp_rw_server_num_default\"" + +# display users and passwords in the debug messages (default: '0') +debug_print_private_user_infos=0 + +infofile=$(mktemp -q -t infofile.XXXXXXXX) +[ $? -eq 0 ] || notify.error $"can't create temporary files" + +# preprocessed specfile generated by 'rpm --specfile --specedit' +specfile_preprocessed=$(mktemp -q -t specpreproc.XXXXXXXX) +[ $? -eq 0 ] || notify.error $"can't create temporary files" + +trap "rm -f $infofile $specfile_preprocessed" 0 1 2 3 6 7 9 13 15 +notify.debug "infofile = $infofile" + +# function infofile.create() +# write in the ($temporary) file '$infofile' all the needed variables +# got from the package specfile +# args: +# none +function infofile.create() { + notify.debug "$FUNCNAME: creating info file ($infofile)..." + + ( unset SPEC_NAME + unset SPEC_VERSION + unset SPEC_RELEASE + unset SPEC_GROUP + unset SPEC_FILENAME + unset SPEC_URL + unset SPEC_PATCH + unset SPEC_SOURCE + unset SPEC_LICENSE + unset SPEC_TARGET + unset SPEC_OBSOLETES + unset SPEC_BUILDARCH + unset SPEC_BUILDREQUIRES + unset SPEC_BUILDROOT + #unset SRPM_SPECFILE + unset SRPM_SPECFILE_WITH_PATH + unset USER_RPMDEFINE_OPTS + unset SPECFILE_PREPROCESSED + + # destroy the old infofile but use its data + [ -r $infofile ] && . $infofile + > $infofile + + if [ -z "$SRPM_SPECFILE" ]; then + SRPM_SPECFILE="${spec_name:-$pck_name.spec}" + [ "$spec_name" ] || notify.warning $"\ +assuming as specfile"": \`$spec_dir/$SRPM_SPECFILE'" + fi + + case "$SRPM_SPECFILE" in + */*) + if [ "$SRPM_SPECFILE" = "$spec_dir/${SRPM_SPECFILE##*/}" ]; then + # permit this syntax for backward compatibility + SRPM_SPECFILE="${SRPM_SPECFILE##*/}" + else + notify.error $"unsupported path for specfile"": \`$SRPM_SPECFILE'" + fi + ;; + esac + + echo "SRPM_SPECFILE=\"$SRPM_SPECFILE\"" >> $infofile + notify.debug "SRPM_SPECFILE = \"$SRPM_SPECFILE\"" + + [ "$SRPM_SPECFILE_WITH_PATH" ] || + SRPM_SPECFILE_WITH_PATH="$spec_dir/$SRPM_SPECFILE" + + [ -f "$SRPM_SPECFILE_WITH_PATH" ] || + notify.error $"specfile not found"": \`$SRPM_SPECFILE_WITH_PATH'" + + echo "SRPM_SPECFILE_WITH_PATH=\"$SRPM_SPECFILE_WITH_PATH\"" >> $infofile + notify.debug "SRPM_SPECFILE_WITH_PATH = \"$SRPM_SPECFILE_WITH_PATH\"" + + if [ -z "$USER_RPMDEFINE_OPTS" ]; then + USER_RPMDEFINE_OPTS="\ +$(for i in `seq 1 1 ${#define_list_name[*]}`; do +echo -n " --define=\"${define_list_name[$i-1]} ${define_list_value[$i-1]}\"" +done)" + fi + echo "USER_RPMDEFINE_OPTS='""$USER_RPMDEFINE_OPTS""'" >> $infofile + notify.debug "USER_RPMDEFINE_OPTS = \'$USER_RPMDEFINE_OPTS\'" + + # create the specfile_preprocessed only once + if [ ! -s "$specfile_preprocessed" ]; then + notify.debug "running: \ +rpm -q $USER_RPMDEFINE_OPTS --specfile --specedit $SRPM_SPECFILE_WITH_PATH ..." + eval "\ +rpm -q $USER_RPMDEFINE_OPTS --specfile --specedit $SRPM_SPECFILE_WITH_PATH \ + 2>/dev/null >> $specfile_preprocessed" || + notify.error $"rpm exited with error code \`$?'" + fi + + SPECFILE_PREPROCESSED="$specfile_preprocessed" + notify.debug "SPECFILE_PREPROCESSED = \"$SPECFILE_PREPROCESSED\"" + echo "SPECFILE_PREPROCESSED=\"$SPECFILE_PREPROCESSED\"" >> $infofile + + # set the variables 'rpmvar_name[]', 'rpmvar_value[]', 'rpmvar_expr[]' + if [ "$SPEC_VERSION_FORCED" ]; then + # use 'SPEC_VERSION' instead of the version hardcoded in the specfile + # (needed when we want to upgrade to a more recent version of the package + # discovered by libapse) + rpmvars.init --pckver="$SPEC_VERSION_FORCED" "$SRPM_SPECFILE_WITH_PATH" + else + rpmvars.init "$SRPM_SPECFILE_WITH_PATH" + fi + + if [ -r $SPECFILE_PREPROCESSED ]; then + # check for values not yet in the `infofile' + [ "$SPEC_NAME" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_NAME + [ "$SPEC_VERSION" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_VERSION + [ "$SPEC_RELEASE" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_RELEASE + [ "$SPEC_GROUP" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_GROUP + [ "$SPEC_FILENAME" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_FILENAME + [ "$SPEC_URL" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_URL + [ "$SPEC_PATCH" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_PATCH + [ "$SPEC_SOURCE" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_SOURCE + [ "$SPEC_LICENSE" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_LICENSE + [ "$SPEC_TARGET" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_TARGET + [ "$SPEC_OBSOLETES" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_OBSOLETES + [ "$SPEC_BUILDARCH" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_BUILDARCH + [ "$SPEC_BUILDREQUIRES" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_BUILDREQUIRES + [ "$SPEC_BUILDROOT" ] || specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_BUILDROOT + + echo "\ +SPEC_NAME=\"$SPEC_NAME\" +SPEC_VERSION=\"$SPEC_VERSION\" +SPEC_RELEASE=\"$SPEC_RELEASE\" +SPEC_GROUP=(\ +$(for i in `seq 1 1 ${#SPEC_GROUP[*]}`; do + echo -n "\"${SPEC_GROUP[i-1]}\" " +done)) +SPEC_FILENAME=\"$SPEC_FILENAME\" +SPEC_URL=\"$SPEC_URL\" +SPEC_PATCH=(${SPEC_PATCH[*]}) +SPEC_SOURCE=(${SPEC_SOURCE[*]}) +SPEC_LICENSE=(\ +$(for i in `seq 1 1 ${#SPEC_LICENSE[*]}`; do + echo -n "\"${SPEC_LICENSE[i-1]}\" " +done)) +SPEC_TARGET=(${SPEC_TARGET[*]}) +SPEC_OBSOLETES=(${SPEC_OBSOLETES[*]}) +SPEC_BUILDARCH=\"$SPEC_BUILDARCH\" +SPEC_BUILDROOT=\"$SPEC_BUILDROOT\" +SPEC_BUILDREQUIRES=(\ +$(for i in `seq 1 1 ${#SPEC_BUILDREQUIRES[*]}`; do + echo -n "\"${SPEC_BUILDREQUIRES[i-1]}\" " +done)) +BUILD_ARCH=\"$BUILD_ARCH\" +TARGET_ARCH=\"$TARGET_ARCH\"" >> $infofile + else + notify.error $"specfile not found"": \`$SRPM_SPECFILE_WITH_PATH'" + fi + ) || exit 1 # exit with error if the specfile is not found + + notify.debug "$(infofile.cat $infofile)" +} + +# function infofile.cat() +# print the content of the infofile +# args: +# $1 : infofile name +function infofile.cat() { + local infofile="$1" + + [ "$infofile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + + [ -e $infofile ] && echo "\ +[infofile] +$( cat $infofile | \ + sed '# indent and display the infofile + s,.*, &,' )" +} + +# function specfile.newrelease() +# calculate the new release versioning number +# args: +# none +function specfile.newrelease() { + [ -s "$infofile" ] || infofile.create + + ( . $infofile + + # NOTE: we only accept release strings in the format '' + [[ "$SPEC_RELEASE" =~ ^[0-9]+(\.[0-9]+){0,}[^0-9\.]+.*$ ]] || + { notify.debug "\ +$FUNCNAME: SPEC_RELEASE ($SPEC_RELEASE): unsupported format"; + exit 1; } + + if [ "$pck_newver" = $SPEC_VERSION ]; then + local sr_relnum="${SPEC_RELEASE%%[^0-9\.]*}" + local sr_distroid="${SPEC_RELEASE/$sr_relnum}" + notify.debug "$FUNCNAME: sr_relnum = \"$sr_relnum\"" + notify.debug "$FUNCNAME: sr_distroid = \"$sr_distroid\"" + + [[ "$SPEC_RELEASE" =~ ^[0-9]+(\.[0-9]+){1,}[^\.]*$ ]] && + { echo "${sr_relnum%\.*}.$(( ${sr_relnum/*\./} + 1 ))${DISTRO_rpm}" + break; } + + # '<[0-9]+>' + [[ "$SPEC_RELEASE" =~ ^[0-9]+[^0-9]+$ ]] && + { echo "$(( $sr_relnum + 1 ))${DISTRO_rpm}"; break; } + + # this line should be never reached + notify.error $"\ +(bug)"" -- $FUNCNAME: "$"release number: unsupported format"": \"$SPEC_RELEASE\"" + else + echo "1${DISTRO_rpm}" + fi ) || \ +notify.error $"release number: unsupported format"": \"$SPEC_RELEASE\"" +} + +# function specfile.checksintax() +# do some syntax checks in the specfile of the building package +# args: +# $1 : specfile name +# $2, ... : execute these check numbers (optional, default = all checks) +function specfile.checksintax() { + local i rpmvar specfile="$1"; shift + + [[ "$specfile" ]] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + notify.debug "$FUNCNAME: specfile = \"$specfile\"" + + local arg args="${@:-"`seq -s" " 1 9`"}" # default: all checks + notify.debug "$FUNCNAME: args = \"$args\"" + + local token ignore_test_list_value + ignore_test_list_value=() + OIFS="$IFS"; IFS=',' + for token in $ignore_test_list; do + IFS='='; set -- $token + ignore_test_list_value[${#ignore_test_list_value[*]}]="$1"; + IFS=',' + done + IFS="$OIFS" + notify.debug "$FUNCNAME: \ +ignore_test_list_value = (${ignore_test_list_value[*]})" + + function skip_test() { + local test n found + + test="$1" + let "found = 0" + + for n in ${ignore_test_list_value[*]}; do + [ "$n" = "$test" ] && let "found = 1" + done + + return $found + } + + notify.note $"checking"" \`${NOTE}$specfile${NORM}'..." + for arg in $args; do + notify.debug "$FUNCNAME: arg = \"$arg\"" + case "$arg" in + 1) # 1. checking if 'Source[0]' is a valid internet address + # (skip this test if no '%setup' section has been found) + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg (source0)..."" "$"skipped" + continue; } + + grep -q "^%setup[ \t]*$\|^%setup[ \t]\+" $specfile + if [ $? -eq 0 ]; then + notify.note " * "$"running test"" $arg (source0)..." + if [[ "$source0_name_structure" ]]; then + specfile.getvars -s $specfile --verbatim SPEC_SOURCE0 + if [[ "$SPEC_SOURCE0_VERBATIM" ]]; then + [[ "$(echo "$SPEC_SOURCE0_VERBATIM" | \ + grep -e "$source0_name_structure")" ]] || notify.warning "\ +\`Source[0]': "$"does not point to a valid internet address" + fi + fi + else + notify.note "\ + * "$"running test"" $arg (source0)..."" "$"skipped" + fi + ;; + 2) # 2. check if the patches have standard names + # (see the 'patch_name_structure' var in the configure file) + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg (patch)..."" "$"skipped" + continue; } + + notify.note " * "$"running test"" $arg (patch)..." + specfile.getvars -s $specfile --verbatim SPEC_PATCH + echo "${SPEC_PATCH_VERBATIM[@]}" | \ + for i in `seq 1 1 ${#SPEC_PATCH_VERBATIM[@]}`; do + [[ "${SPEC_PATCH_VERBATIM[$i-1]}" =~ \ + $patch_name_structure ]] || + { notify.warning "\ +patch $i (\`${NOTE}${SPEC_PATCH_VERBATIM[$i-1]}${NORM}') " + notify.warning $"\ +not a standard structure (see config file)"; } + done + ;; + 3) # 3. check if `%setup' have `-D' and/or `-T' options + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg (%setup)..."" "$"skipped" + continue; } + + notify.note " * "$"running test"" $arg (%setup)..." + [[ "$(cat $specfile | \ + sed -n "/%setup/{/-D /p;/-T /p;/-D$/p;/-T$/p}")" ]] && + notify.warning $"\ +found \`-D' and/or \`-T' option(s) in the \`%setup' directive" + ;; + 4) # 4. check if all the `%files' blocks have a `%defattr' line + # note: skip commented out blocks + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg (%defattr)..."" "$"skipped" + continue; } + + notify.note " * "$"running test"" $arg (%defattr)..." + [[ "$(sed -e ' + # print paragraph if it contains "%files" and "%defattr" + /./{H;$!d;}' -e 'x;/%files/!d;/%defattr/!d' $specfile | \ + grep "^[[:space:]]*%files")" != \ + "$(grep "^[[:space:]]*%files" $specfile)" ]] && + notify.error $"\ +missing at least one \`%defattr' directive" + ;; + 5) # 5. check if the rpm macros %configure, %make are used + # - look in the block : `%build' to `%install' + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg (%build, %install)..."" "$"skipped" + continue; } + + notify.note " * "$"running test"" $arg (%build, %install)..." + local token tokens + sed -n '/%build/,/%install/p' $specfile | \ + while read -a tokens; do + for token in ${tokens[*]}; do + case "$token" in + configure|./configure) + [[ "$rpm_macro_configure" ]] && notify.warning $"\ +use rpm macros if possible:"" \`$token' --> \`$rpm_macro_configure'" ;; + make) + [[ "$rpm_macro_make" ]] && notify.warning $"\ +use rpm macros if possible:"" \`$token' --> \`$rpm_macro_make'" ;; + esac + done + done + # - look in the block : `%install' to `%changelog' + sed -n '/%install/,/%changelog/p' $specfile | \ + while read -a tokens; do + for token in ${tokens[*]}; do + case "$token" in + make) + [[ "$rpm_macro_make" ]] && notify.warning $"\ +use rpm macros if possible:"" $( +[[ "$rpm_macro_makeinstall" ]] && + echo -en "\n * \`make install' -> \`$rpm_macro_makeinstall'" +[[ "$rpm_macro_makeoldinstall" ]] && + echo -en "\n * \`make install' -> \`$rpm_macro_makeoldinstall'" )" ;; + esac + done + done + ;; + 6) # 6. check if '%find_lang' is used when localization files + # are detected + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg (%find_lang)..."" "$"skipped" + continue; } + + notify.note " * "$"running test"" $arg (%find_lang)..." + # FIXME : the test should perhaps be improved... + grep -q "^[ ]*[^# ]*/share/locale/" $specfile || continue + + notify.error $"\ +"$"localization files must be packaged via \`%find_lang'""${NORM} +--------------------------------------- +${NOTE}"$"Hint"":${NORM} +%install +... +%find_lang %{name} + +%files -f %{name}.lang +--------------------------------------- +" + ;; + 7) # 7. check if the install/uninstall code is present + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg ("$"info pages"")..."" "$"skipped" + continue; } + + notify.note " * "$"running test"" $arg ("$"info pages"")..." + local infopages errors + # FIXME: non LSB compliant systems are unsupported + infopages="$(\ +grep "/share/info/\|^[ ]*%_infodir\|^[ ]*%{_infodir}" $specfile | \ +grep -v "^[ ]*#\|^[a-zA-Z]")" + [[ "$infopages" ]] || continue + + let "errors = 0" + if [ "$rpm_macro_installinfo" ]; then + grep -q "$rpm_macro_installinfo" $specfile || + { let "errors += 1" + notify.debug "rpm_macro_installinfo check failed"; } + fi + if [ "$rpm_macro_uninstallinfo" ]; then + grep -q "$rpm_macro_uninstallinfoo" $specfile || + { let "errors += 1" + notify.debug "rpm_macro_uninstallinfo check failed"; } + fi + if [ "$rpm_macro_installinfo_binary" ]; then + grep -q "\ +Requires(post)[ \t]*:[ \t]*${rpm_macro_installinfo_binary}" $specfile || + { let "errors += 1" + notify.debug "rpm_macro_installinfo_binary check failed"; } + fi + + [ "$errors" = "0" ] || notify.error "\ +"$"info pages are not installed/uninstalled in the correct way""${NORM} +--------------------------------------- +${NOTE}"$"Hint"":${NORM} +$([[ "$rpm_macro_installinfo_binary" ]] && + echo "Requires(post): $rpm_macro_installinfo_binary" || + echo "Requires(post): ${path_installinfo:-/sbin/install-info}") + +%post [] +$([[ "$rpm_macro_installinfo" ]] && + echo "$rpm_macro_installinfo %{name}.info" || + echo "${path_installinfo:-/sbin/install-info} %{name}.info") + +%preun [] +$([[ "$rpm_macro_uninstallinfo" ]] && + echo "$rpm_macro_uninstallinfo %{name}.info" || + echo "${path_installinfo:-/sbin/install-info} --delete %{name}.info") +exit 0 +--------------------------------------- +" + ;; + 8) # 8. check for illegal 'Group's (see configuration file) + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg ("$"package Groups"")..."" "$"skipped" + continue; } + + if [ "${#rpm_allowed_groups[*]}" = 0 ]; then + # 'rpm_allowed_groups' unset in the configuration files + notify.note "\ + * "$"running test"" $arg ("$"package Groups"")..."" "$"skipped" + continue + fi + + notify.note "\ + * "$"running test"" $arg ("$"package Groups"")..." + + local i j match + for j in `seq 1 1 ${#SPEC_GROUP[*]}`; do + notify.debug "\ +$FUNCNAME: checking if \"${SPEC_GROUP[$j-1]}\" is a known group ..." + let "match = 0" + for i in `seq 1 1 ${#rpm_allowed_groups[*]}`; do + notify.debug "\ +$FUNCNAME: current group: \"${rpm_allowed_groups[$i-1]}\"" + [ "${rpm_allowed_groups[$i-1]}" = \ + "${SPEC_GROUP[$j-1]}" ] && + { let "match = 1"; break; } + done + [ "$match" = 1 ] || notify.error "\ +"$"invalid \`Group'"" \"${SPEC_GROUP[$j-1]}\"""${NORM} +--------------------------------------- +${NOTE}"$"Hint"":${NORM}"" +"$"see configuration files"" (\`${NOTE}rpm_allowed_groups${NORM}') +"$"or enter the command"": +${NOTE}@package@ --eval=rpm_allowed_groups${NORM} +--------------------------------------- +" + done + ;; + 9) # 9. check for no approved 'License's (see configuration file) + skip_test $arg || + { notify.note "\ + * "$"running test"" $arg ("$"approved License"")..."" "$"skipped" + continue; } + + if [ "${#rpm_approved_licenses[*]}" = 0 ]; then + # 'rpm_approved_licenses' unset in the configuration files + notify.note "\ + * "$"running test"" $arg ("$"approved License"")..."" "$"skipped" + continue + fi + + notify.note "\ + * "$"running test"" $arg ("$"approved License"")..." + + local i j match + for j in `seq 1 1 ${#SPEC_LICENSE[*]}`; do + notify.debug "\ +$FUNCNAME: checking if \"${SPEC_LICENSE[$j-1]}\" is an approved license ..." + let "match = 0" + for i in `seq 1 1 ${#rpm_approved_licenses[*]}`; do + notify.debug "\ +$FUNCNAME: current license: \"${rpm_approved_licenses[$i-1]}\"" + [ "${rpm_approved_licenses[$i-1]}" = \ + "${SPEC_LICENSE[$j-1]}" ] && + { let "match = 1"; break; } + done + [ "$match" = 1 ] || notify.warning "\ +"$"not approved \`License'"" \"${NOTE}${SPEC_LICENSE[$j-1]}${NORM}\""" +--------------------------------------- +${NOTE}"$"Hint"":${NORM}"" +"$"see configuration files"" (\`${NOTE}rpm_approved_licenses${NORM}') +"$"or enter the command"": +${NOTE}@package@ --eval=rpm_approved_licenses${NORM} +--------------------------------------- +" + done + ;; + *) # if code reach this point, there is a bug + notify.error $"\ +(bug)"" -- $FUNCNAME: "$"illegal value for arg"" (#2): \"$2\"" ;; + esac + done + + return 0 +} + +# function specfile.rotate_bck() +# create a backup copy of the current specfile and rotate the +# last '$spec_backup_numbers' (default = 5) saved specfiles +# args +# specfile to rotate with path +function specfile.rotate_bck() { + local specfile="$1" + [ "$specfile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + + local v + local oldfext="${spec_backup_extension:-old}" + local specname="${specfile##*/}" + local specpath="${specfile%/*}" + + #notify.debug "$FUNCNAME: oldfext = $oldfext" + #notify.debug "$FUNCNAME: specname = $specname" + #notify.debug "$FUNCNAME: specpath = $specpath" + + # create hidded files by default + local oldfprefix="." + [ "$spec_backup_attr" = "visible" ] && oldfprefix="" + + #notify.debug "$FUNCNAME: oldfprefix = $oldfprefix" + + for v in `seq $((${spec_backup_numbers:-5} - 2)) -1 0`; do + [[ -e "${specpath}/${oldfprefix}${specname}.$v.${oldfext}" ]] && + { notify.debug "$FUNCNAME: \ +[${specpath}] ${specname}.$v.${oldfext}\ + --> ${specname}.$(($v + 1)).${oldfext}" + mv -f ${specpath}/${oldfprefix}${specname}.$v.${oldfext} \ + ${specpath}/${oldfprefix}${specname}.$(($v + 1)).${oldfext}; } + done + + if [ -e "${specfile}" ]; then + notify.note $"\ +making a ${NOTE}backup copy${NORM} of the current specfile"" + --> ${NOTE}${specpath}/${oldfprefix}${specname}.0.${oldfext}${NORM}" + cp -f ${specfile} \ + ${specpath}/${oldfprefix}${specname}.0.${oldfext} + fi +} + +# function target_cpu.set_and_check() +# check the user defined variable 'target_cpu' and set if unset +# args: +# none +function target_cpu.set_and_check() { + if [ ! "$target_cpu" ]; then + target_cpu="${SPEC_BUILDARCH:-$BUILD_ARCH}" + [ "$target_cpu" == "noarch" ] && + target_cpu=`rpm --eval %{_host_cpu} 2>/dev/null` + fi + notify.debug "target_cpu = $target_cpu" + + # check if the 'target_cpu' is an allowed architecture + local arch_list_curr bad_arch=1 + for arch_list_curr in ${arch_list[@]}; do + [ "$arch_list_curr" = "$target_cpu" ] && + { let "bad_arch = 0"; break; } + done + [ "$bad_arch" = 1 ] && + notify.error $"unsupported architecture"": \`$target_cpu'" +} + +# function package.update() +# do all the actions needed to update an rpm package +# args: +# $1 : boolean variable: force specfile reformatting +# $2 : package name of the package to be upgraded +# $3 : new release of the package to be upgraded (optional in some step) +# $4 : new versione of the package to be upgraded (optional in some step) +# $5 : steps of the upgrading process +# $6 : ftp user with write permission +# $7 : ftp password with write permission +# $8 : specfile name +# $9 : list of specfile variables/values set by the user +# $10 : ftp server from where to download srpms packages +# $11 : ftp server where to upload packages +declare -r update_steps=11 # total steps in the update process +function package.update() { + local spec_format=$1 + + local pck_name="$2" + [[ "$pck_name" ]] || notify.error $"missing package name" + + # remove the heading path if any + [[ "$pck_name" =~ .*/.* ]] && pck_name="${pck_name##*/}" + # remove the trailing ".spec" string if any + [[ "$pck_name" =~ \.spec$ ]] && pck_name="${pck_name%\.spec}" + + local pck_newver="$3" + local pck_newrel="$4" + + if [[ $logging -eq 1 ]]; then # enable logging + logging_file="\ +$logging_dir/$(LC_ALL="C" date "+%Y%m%d_%H%M%S")-$pck_name.log" + + mkdir -p $logging_dir &>/dev/null + [ $? -eq 0 ] || notify.error $"\ +cannot create logging directory"" (\`logging_file')" + + > $logging_file + notify.note $"logging file"": \`"${NOTE}"$logging_file${NORM}'" + + exec 3<&1 # link fd #3 with stdout; save stdout + exec 4<&2 # link fd #4 with stderr; save stderr + exec 1>>$logging_file + exec 2>>$logging_file + + notify.note "[ ${0}${exec_options} ]\n" + fi + + # note: leave here after the 'logging_file' stuff + notify.debug "pck_name = $pck_name" + + # the arch on which autospec is being running + BUILD_ARCH="$(rpm --eval %_build_cpu 2>/dev/null)" + [[ "$BUILD_ARCH" ]] || + notify.error $"cannot evaluate:"" \`BUILD_ARCH'" + notify.debug "BUILD_ARCH = $BUILD_ARCH" + + unset steps + local user_steps="$5" + [[ "$user_steps" ]] || + notify.error $"no action specified: set with \`--action'" + + OIFS="$IFS"; IFS=',' + for token in $user_steps; do + case $token in + *:*) + fromstep=${token%%:*}; tostep=${token##*:} + [[ -z "$fromstep" || -z "$tostep" ]] && + notify.error $"sintax error in --action \`$4'" + steps=("${steps[*]}" $(seq $fromstep 1 $tostep)) + ;; + *) steps[${#steps[*]}]="$token" ;; + esac + done + IFS="$OIFS" + + notify.debug "steps = (`echo ${steps[*]} | sed 's,\n, ,'`)" + [[ -n "`echo "${steps[*]}" | sed 's,[0-9 ]*,,'`" ]] && + notify.error $"\ +sintax error in the command"": \`--action'"" (\`${4:-"?"}')" + + local ftp_rw_user_forced="$6" + local ftp_rw_passwd_forced="$7" +# [[ ( -n "$6" && -z "$7" ) || ( -z "$6" && -n "$7" ) ]] && +# notify.error $"\ +#\`ftp_rw_user' and \`ftp_rw_passwd' must be both set or unset" + + local spec_name + case "$8" in + "") spec_name="${pck_name/\.spec/}.spec" ;; + *.spec) spec_name="$8" ;; + *) spec_name="${8}.spec" ;; + esac + + notify.debug "spec_name = $spec_name" + notify.debug "spec_dir = $spec_dir" + + # note (workaround): we must set here all the args before '$9' + # because the command 'set --' called later will overwrite them + + local ftp_server_download_id="${10}" + notify.debug "ftp_server_download_id = $ftp_server_download_id" + local ftp_server_download_num ftp_server_download_alias + + # check whether `ftp_server_download_id' is valid + if [ "$ftp_server_download_id" ]; then + if [[ "$ftp_server_download_id" =~ ^[0-9]+$ ]]; then + ftp_server_download_num="$ftp_server_download_id" + ftp_server_download_alias="" + [ "$ftp_server_download_num" -lt ${#ftp_rw_rpms_dir[*]} ] || + notify.error "\ +\`--server-download': "$"illegal value for arg"": \"$ftp_server_download_id\"" + else + ftp_server_download_alias="$ftp_server_download_id" + notify.debug "ftp_server_download_alias = $ftp_server_download_alias" + local found_alias=0 + for i in ${!ftp_alias[@]}; do + if [ "$ftp_server_download_alias" = "${ftp_alias[$i]}" ]; then + ftp_server_download_num="$i" + found_alias=1 + break + fi + done + [ "$found_alias" = 0 ] && notify.error "\ +\`--server-download': "$"illegal value for arg"": \"$ftp_server_download_id\"" + fi + fi + + local ftp_server_upload_id="${11}" + notify.debug "ftp_server_upload_id = $ftp_server_upload_id" + local ftp_server_upload_num ftp_server_upload_alias + + # check whether `ftp_server_upload_id' is valid + if [ "$ftp_server_upload_id" ]; then + if [[ "$ftp_server_upload_id" =~ ^[0-9]+$ ]]; then + ftp_server_upload_num="$ftp_server_upload_id" + ftp_server_upload_alias="" + [ "$ftp_server_upload_num" -lt ${#ftp_rw_rpms_dir[*]} ] || + notify.error "\ +\`--server-upload': "$"illegal value for arg"": \"$ftp_server_upload_id\"" + else + ftp_server_upload_alias="$ftp_server_upload_id" + notify.debug "ftp_server_upload_alias = $ftp_server_upload_alias" + local found_alias=0 + for i in ${!ftp_alias[@]}; do + if [ "$ftp_server_upload_alias" = "${ftp_alias[$i]}" ]; then + ftp_server_upload_num="$i" + found_alias=1 + break + fi + done + [ "$found_alias" = 0 ] && notify.error "\ +\`--server-upload': "$"illegal value for arg"": \"$ftp_server_upload_id\"" + fi + fi + + local token define_list_name define_list_value + define_list_name=() + define_list_value=() + define_list_rpm="" + OIFS="$IFS"; IFS=',' + for token in $9; do + IFS='='; set -- $token + # '$2' can be null as in : --define cross_target_cpu="" + [[ "$1" ]] || + notify.error $"sintax error in the command"": \`--define'" + define_list_name[${#define_list_name[*]}]="$1" + define_list_value[${#define_list_value[*]}]="$2" + define_list_rpm="${define_list_rpm} --define \"$1 $2\"" + IFS=',' + done + IFS="$OIFS" + notify.debug "\ +define_list_name = [ \ +$(for i in `seq 0 1 $(( ${#define_list_name[*]} - 1 ))`; do +echo -n "\"%${define_list_name[$i]}\" "; done)]" + notify.debug "\ +define_list_value = [ \ +$(for i in `seq 0 1 $(( ${#define_list_value[*]} - 1 ))`; do +echo -n "\"${define_list_value[$i]}\" "; done)]" + notify.debug "\ +define_list_rpm = \"$define_list_rpm\"" + + if [ "$pck_newver" ]; then + notify.note $"updating package ${NOTE}${pck_name##*/}${NORM} \ +to version ${NOTE}${pck_newver}${NORM}""..." + else + notify.note $"updating package"" ${NOTE}${pck_name##*/}${NORM}..." + fi + + for step in ${steps[*]}; do + case $step in + 0) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +check for available versions in the $DISTRO repositories""${NORM}" + + local srpm_pck_found=0 + if [ "$ftp_server_download_num" ]; then + repository.get_SRPMS_name \ + --urllist "${ftpurl_ro_srpms[$ftp_server_download_num]}" \ + --urlnum "$ftp_server_download_num" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "$pck_name" + + if [[ "$got_SPEC_FILENAME" ]]; then + [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] && + notify.warning $"found too many candidates" + notify.note \ +$"Repository"" : ${NOTE}(#$ftp_server_download_num) ${got_SPEC_FILENAME_URL}${NORM}" + notify.note $"Package(s)"" : ${NOTE}${got_SPEC_FILENAME[@]}${NORM}" + else + notify.warning $"\ +cannot find a matching SRPM package in the given repositories" + fi + else + for i in `seq 1 1 ${#ftp_rw_server[*]}`; do + [ "${ftp_enable[$(($i-1))]}" = 0 ] || + repository.get_SRPMS_name \ + --urllist "${ftpurl_ro_srpms[$(($i-1))]}" \ + --urlnum "$(($i-1))" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "$pck_name" + + if [[ "$got_SPEC_FILENAME" ]]; then + [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] && + notify.warning $"found too many candidates" + notify.note \ +$"Repository"" : ${NOTE}(#$(($i-1))) ${got_SPEC_FILENAME_URL}${NORM}" + notify.note $"Package(s)"" : ${NOTE}${got_SPEC_FILENAME[@]}${NORM}" + + let "srpm_pck_found += 1" + fi + done + [ "$srpm_pck_found" = 0 ] && notify.warning $"\ +cannot find a matching SRPM package in the given repositories" + fi + ;; + + 1) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +download and install the srpm package""${NORM}" + +# notify.debug "\ +#repository.get_SRPMS_name \ +#--urllist \"${ftpurl_ro_srpms[$ftp_server_download_num]}\" \ +#--urlnum \"$ftp_server_download_num\" \ +#--proxy \"$proxy\" --proxy-user \"$proxy_user\" \"$pck_name\"" + + repository.get_SRPMS_name \ + --urllist "${ftpurl_ro_srpms[$ftp_server_download_num]}" \ + --urlnum "$ftp_server_download_num" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "$pck_name" + + [[ "$got_SPEC_FILENAME" ]] || notify.error $"\ +cannot find a matching SRPM package in the given repositories" + + [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]] && + notify.error $"\ +found too many candidates"": $( + for f in ${got_SPEC_FILENAME[*]}; do + echo -en "\n * $f" + done )" + + # NOTE: always force the download of srpms files because non + # forcing behaviour causes issues (documented by Silvan). + curl.download --options "$curl_options" --force \ +${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ +--exit-on-err --destdir="$srpms_dir" "$got_SPEC_FILENAME_URL/$got_SPEC_FILENAME" + + notify.note $"installing"" ${NOTE}$got_SPEC_FILENAME${NORM}..." + for filename in \ + $(rpm -p -ql $srpms_dir/$got_SPEC_FILENAME 2>/dev/null); do + case "$filename" in + *.spec) + destdir="$spec_dir" + # echo "SRPM_SPECFILE=${spec_name:-$filename}" >> $infofile + echo "SRPM_SPECFILE=$filename" >> $infofile + ;; + *) destdir="$source_dir" ;; + esac + notify.note " * $destdir/${filename##*/}" + done + + # provide 'SRPM_SPECFILE' + . $infofile + + # do not overwrite the current specfile, if any + specfile.rotate_bck $spec_dir/$SRPM_SPECFILE + + notify.debug "running: rpm -hiv $srpm_install_options \ +--define \"%_specdir $spec_dir\" --define \"%_sourcedir $source_dir\" \ +$srpms_dir/$got_SPEC_FILENAME" + rpm -hiv "$srpm_install_options" \ + --define "%_specdir $spec_dir" \ + --define "%_sourcedir $source_dir" \ + $srpms_dir/$got_SPEC_FILENAME 2>&1 >/dev/null || + notify.error $"\ +an error occurred while installing \`$got_SPEC_FILENAME'" + + # remove the old SRPMS archive + # (NOTE: disabled because of incompatibilities with autodist) + #rm -f $srpms_dir/$got_SPEC_FILENAME + + # overwrite the default value with the real value + echo "SPEC_FILENAME=$got_SPEC_FILENAME" >> $infofile + ;; + 2) if [[ -n "$pck_newver" || "$rebuild" = 1 ]]; then + notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +check if a new version is available""${NORM}... "$"skipped" + continue + else + notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +check if a new version is available""${NORM}" + fi + + infofile.create + . $infofile + + unset SPEC_SOURCE0_PCKNAME + specfile.getvars -s $SPECFILE_PREPROCESSED SPEC_SOURCE0_PCKNAME + + unset SPEC_SOURCE0_VERBATIM + specfile.getvars -s $SRPM_SPECFILE_WITH_PATH --verbatim SPEC_SOURCE0 + + apse.scrapeversion \ + --pckname "$SPEC_SOURCE0_PCKNAME" \ + --pckurl "${SPEC_SOURCE[0]}" \ + --pckurlverbatim "${SPEC_SOURCE0_VERBATIM}" \ + --specname "$SPEC_NAME" \ + ${proxy:+ --proxy $proxy} \ + ${proxy_user:+ --proxy-user $proxy_user} + + retval=$? + + notify.debug "SPEC_VERSION = $SPEC_VERSION" + notify.debug "APSE_LAST_VERSION = $APSE_LAST_VERSION" + + if [ "$force_update" = 0 ]; then + case $retval in + # package is already the latest version + "0") exit 4 ;; + # a newer version of the package is already installed (!?) + "1") exit 2 ;; + # a new version is available + "2") : ;; + # no information on latest available version + "3") exit 3 ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"unknown retcode for apse.scrapeversion()"" ($retval)" ;; + esac + else + pck_newver="$SPEC_VERSION" + fi + if [ "$APSE_LAST_VERSION" ]; then + pck_newver="$APSE_LAST_VERSION" + notify.debug "pck_newver = $pck_newver" + + echo "SPEC_VERSION_FORCED=\"$pck_newver\"" > $infofile + rpmvars.init --clear + fi + ;; + 3) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +download new source files""${NORM}" + + infofile.create + . $infofile + + #[ -z "$pck_newver" ] && + # notify.error $"version for new package required" + if [ -z "$pck_newver" ]; then + pck_newver="$SPEC_VERSION" + notify.debug "pck_newver = $SPEC_VERSION (forced)" + fi + + # the update to the same version got a skip download message + + local filenum local fullURL fullURL_new sdflag + + # get the list of URL of all the source files... + specfile.getvars -s $SRPM_SPECFILE_WITH_PATH --verbatim SPEC_SOURCE + + [ "$force_download" = "1" ] && sdflag="--force" + + for filenum in `seq 1 1 ${#SPEC_SOURCE_VERBATIM[@]}`; do + let "totfilenum += 1" + fullURL=${SPEC_SOURCE_VERBATIM[$filenum-1]} + notify.debug "fullURL = $fullURL" + + fullURL_new=$(\ +echo $fullURL | sed "s,%[{]*version[}]*,$pck_newver,g") + notify.debug "fullURL_new = $fullURL_new" + fullURL_new=$(\ +rpmvars.solve "$fullURL_new" "$SRPM_SPECFILE_WITH_PATH") + notify.debug "fullURL_new = $fullURL_new" + + curl.download --options "$curl_options" $sdflag \ +${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ +--exit-on-err --filenum="$totfilenum" --destdir="$source_dir" "$fullURL_new" + done + + # get the list of URL of all the patches (usually local files)... + specfile.getvars -s $SRPM_SPECFILE_WITH_PATH --verbatim SPEC_PATCH + + for filenum in `seq 1 1 ${#SPEC_PATCH_VERBATIM[@]}`; do + let "totfilenum += 1" + fullURL=${SPEC_PATCH_VERBATIM[$filenum-1]} + notify.debug "fullURL = $fullURL" + fullURL_new=$(\ +rpmvars.solve "$fullURL" "$SRPM_SPECFILE_WITH_PATH") + notify.debug "fullURL_new = $fullURL_new" + + curl.download --options "$curl_options" $sdflag \ +${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ +--exit-on-err --filenum="$totfilenum" --destdir="$source_dir" "$fullURL_new" + done + ;; + 4) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +update and check the specfile""${NORM}" + + infofile.create + . $infofile + + if [ "$rebuild" = 1 ]; then + if [ -z "$pck_newver" ]; then + pck_newver="$SPEC_VERSION" + notify.debug "pck_newver = $SPEC_VERSION (forced)" + fi + else + [ "$pck_newver" ] || + notify.error $"version for new package required" + fi + + chmod ${rpm_specfile_mode:-644} $SRPM_SPECFILE_WITH_PATH + + # check in the specfile for some (common) problems + + notify.note "\ +${NOTE}"$"check the specfile for common mistakes""${NORM}" + specfile.checksintax $SRPM_SPECFILE_WITH_PATH || exit 1 + +# [[ "$rebuild" = 0 && ${#SPEC_PATCH[@]} -gt 0 ]] && +# notify.warning $"\ +#found ${#SPEC_PATCH[@]} patch(es) in the specfile" + + # create a backup copy for the specfile +# specfile.rotate_bck $SRPM_SPECFILE_WITH_PATH + + notify.note $"${NOTE}updating${NORM} the new specfile \ +\`${NOTE}$spec_dir/$SRPM_SPECFILE${NORM}'""..." + + # function apply_define_list_name() + # modify the `%define' entries using the data from + # `define_list_name[]' and `define_list_value[]' + # args: + # $1 : the file to modify + function apply_define_list_name() { + local i infile=$1 + [[ "$infile" ]] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (#1)" + + for i in `seq 0 1 $(( ${#define_list_name[*]} - 1 ))`; do + sed -i "/%define[ \t]*${define_list_name[$i]}[ \t]*/{ +s|\(.*[ \t]*${define_list_name[$i]}[ \t]*\).*|\1${define_list_value[$i]}|}" \ + "$infile" + done + } + + # set the changelog entry + local changelog_new + if [ "$changelog_userdef" ]; then + changelog_new="$changelog_userdef" + else + if [ "$pck_newver" = "$SPEC_VERSION" ]; then + [ "$rebuild" = 1 ] && + changelog_new="$changelog_rebuild_defvalue" || + changelog_new="$changelog_samever_defvalue" + else + #changelog_new="update to version $pck_newver by $me" + changelog_new="update to $pck_newver" + fi + fi + + local specfile_newrelease="$(specfile.newrelease)" + + if [ "$spec_format" = 1 ]; then + notify.debug $"specfile autoformattig enabled" + + $(echo "" | sed "$format_extra_rules" 2>/dev/null) || \ + notify.error $"\ +illegal \`format_extra_rules' (see configuration file(s))" + + local bindir=`rpm --eval=%{_bindir}` + local datadir=`rpm --eval=%{_datadir}` + local includedir=`rpm --eval=%{_includedir}` + local infodir=`rpm --eval=%{_infodir}` + local libdir=`rpm --eval=%{_libdir}` + local libexecdir=`rpm --eval=%{_libexecdir}` + local localstatedir=`rpm --eval=%{_localstatedir}` + local mandir=`rpm --eval=%{_mandir}` + local prefix=`rpm --eval=%{_prefix}` + local sbindir=`rpm --eval=%{_sbindir}` + local sharedstatedir=`rpm --eval=%{_sharedstatedir}` + local sysconfdir=`rpm --eval=%{_sysconfdir}` + + local tmpspec=$(mktemp -q -t $me.XXXXXXXX) + [ $? -eq 0 ] || + notify.error $"can't create temporary files" + notify.debug "tmpspec = \`${NOTE}$tmpspec${NORM}'" + + # build a formatting preamble + local spec_ids; spec_ids=(\ + Name + Version + Release + Epoch + Serial + Summary + Group + Vendor + Distribution + Packager + URL + Source[0-9]* + Patch[0-9]* + NoSource + NoPatch + License + BuildArch + BuildArchitectures + BuildConflicts + BuildRequires + ExclusiveArch + ExclusiveOs + ExcludeArch + ExcludeOs + Obsoletes + Requires + Prefix + BuildRoot) + + # check for missing specfile ids + + local id + local spec_lines_missing # missing lines automatically added + spec_lines_missing=() + + for id in ${spec_ids[@]}; do + # note (sed "/%description/q") : only look in the preamble + [[ "`\ +sed -n "/%description/q;{/^[ \t]*$id[ \t]*:/p}" \ + $SRPM_SPECFILE_WITH_PATH`" ]] || \ + case $id in + # these are not mandatory ids + Patch*|NoSource|NoPatch|\ + BuildArch|BuildArchitectures|BuildConflicts|BuildRequires|\ + Epoch|Serial|\ + ExclusiveArch|ExclusiveOs|ExcludeArch|ExcludeOs|\ + Obsoletes|Requires|Prefix) + ;; + # these values are overwritten, so are no mandatory + Vendor) + notify.warning $"\ +missing entry forced"": Vendor: $VENDOR" + spec_lines_missing[${#spec_lines_missing[*]}]="\ +Vendor $VENDOR" + ;; + Distribution) + notify.warning $"\ +missing entry forced"" : \"Distribution: $DISTRO\"" + spec_lines_missing[${#spec_lines_missing[*]}]="\ +Distribution $DISTRO" + #eval "missing_${id}_id=1" + #notify.debug "missing_${id}_id = 1" + ;; + *) notify.error $"\ +missing entry in the specfile:"" \`${id%%[[0-9]*}'" ;; + esac + done + + local line linenum spec_lines + let "linenum = 0" + spec_lines=() + + # line number where the 1st occurrence of a specfile id appears + local linenum_1stid + # last line numer of the specfile preamble + local linenum_preamble_end + # set to '1' if at least a '%if' directive has been found + local if_directive=0 + + # - save to '$tmpspec' the lines before the specfile preamble + # - set 'if_directive' if a conditional block is found + # - set 'linenum_1stid': line number of 1st specfile id + # - save in 'spec_lines[]' the lines of the preamble + while read -r line; do + let linenum+=1 + case "$line" in + %description*) let linenum-=1; break ;; + %if\ *) + [ "$linenum_1stid" ] && + { notify.debug "found \`%if' directive (line#$linenum)" + let "if_directive = 1"; } + ;; + %if[a-z]*) + notify.warning "\ +$FUNCNAME: "$"FIXME: sorry, not implemented yet..."" (${line/ */})" + let "if_directive = 1" + ;; + [A-Za-z]*:*|[A-Za-z]*:[\ \t]*|\ + [A-Za-z]*:[\ \t]*|[\ \t]*[A-Za-z]*:[\ \t]*) + [ "$linenum_1stid" ] || + { linenum_1stid=$linenum + notify.debug "\ +linenum_1stid (start of preamble) = $linenum"; } + ;; + esac + + # print the lines before the preamble + # (generally comments and/or '%define' directives) + [ "$linenum_1stid" ] && + { notify.debug "spec_lines[${#spec_lines[*]}]=\"$line\"" + spec_lines[${#spec_lines[*]}]="$line"; } || + echo "$line" >> $tmpspec + done < $SRPM_SPECFILE_WITH_PATH + + # last line number of the specfile preamble + linenum_preamble_end=$linenum + notify.debug "linenum (end of preamble) = $linenum_preamble_end" + + # apply the user '--define' variable definitions + apply_define_list_name $tmpspec + + notify.debug "[pre-preamble]\ +`cat $tmpspec | sed -n '1{s,.*,\n &,p};2,${s,.*, &,p}'`" + + notify.debug "\ +[preamble -- original] line#$linenum_1stid$(\ +for i in $(seq 1 1 ${#spec_lines[@]}); do + echo -n "\n ${spec_lines[$i-1]}" +done)" + + local tmppreamble=$(mktemp -q -t $me.XXXXXXXX) + [ $? -eq 0 ] || + notify.error $"can't create temporary files" + notify.debug "tmppreamble = \`${NOTE}$tmppreamble${NORM}'" + + # add missing ids and values that are automatically resolved + for i in $(seq 1 1 ${#spec_lines_missing[*]}); do + line="${spec_lines_missing[$i-1]}" + printf "\ +%-${format_preamble_tab:-14}s %s\n" "${line/ */}:" "${line/* /}" \ + >> $tmppreamble + notify.debug "\ +insertion forced for id : \`${line/ */}'" + # spec_lines[${#spec_lines[*]}]="${spec_lines_missing[$i-1]}" + done + + # add the other ids and values + for i in $(seq 1 1 ${#spec_lines[@]}); do + line="${spec_lines[$i-1]}" + case "$line" in + Version*|[\ \t]*Version*) + id="Version" + notify.debug "forced : $id = \"$pck_newver\"" + printf "\ +%-${format_preamble_tab:-14}s %s\n" "$id:" "$pck_newver" + ;; + Release*|[\ \t]*Release*) + id="Release" + notify.debug "\ +forced : $id = \"$specfile_newrelease\"" + printf "\ +%-${format_preamble_tab:-14}s %s\n" "$id:" "$specfile_newrelease" + ;; + Distribution*|[\ \t]*Distribution*) + notify.debug "forced : Distribution = \"$DISTRO\"" + printf "\ +%-${format_preamble_tab:-14}s %s\n" "Distribution:" "$DISTRO" + ;; + Vendor*|[\ \t]*Vendor*) + id="Vendor" + notify.debug "forced : $id = \"$VENDOR\"" + printf "\ +%-${format_preamble_tab:-14}s %s\n" "$id:" "$VENDOR" + ;; + BuildRoot*|[\ \t]*BuildRoot*) + id="BuildRoot" + notify.debug "\ +forced : $id = \"$format_buildroot_value\"" + printf "\ +%-${format_preamble_tab:-14}s %s\n" "$id:" "$format_buildroot_value" + ;; + [a-zA-Z0-9\ \t]*:*) + id="$(echo $line | sed "s,[ \t]*:.*,,")" + [[ "$id" = Url ]] && id="URL" + value="$(echo $line | sed "s,[A-Za-z0-9 \t]*:[ \t]*,,")" + printf "\ +%-${format_preamble_tab:-14}s %s\n" "$id:" "$value" + ;; + *) # specfile commands, blank lines or unknown entries + echo "$line" + ;; + esac + done >> $tmppreamble + + # FIXME : the preamble lines ('$tmppreamble' file) should be + # reordered in a 'standard' way when possible + # **caution** when '$if_directive' is true + + # FIXME : reordering should be performed in a better way + if [ "$if_directive" = 0 ]; then + for id in ${spec_ids[@]}; do + sed -n "/^[ \t]*[# \t]*${id}[0-9]*/p" $tmppreamble \ + >> $tmpspec + sed -i "/^[# \t]*${id}[0-9]*/d" $tmppreamble + done + cat $tmppreamble >> $tmpspec + else + notify.warning "\ +$FUNCNAME: "$"FIXME: sorry, not implemented yet..."" (preamble sorting when %if)" + cat $tmppreamble >> $tmpspec + fi + rm -f $tmppreamble + + notify.debug "[preamble -- formatted] line#$linenum_1stid\ +$(sed -n "$linenum_1stid,\$p" $tmpspec | \ + sed -n '1{s,.*,\n &,p};2,${s,.*, &,p}')" + + # writes the rest of the specfile until '%changelog' + let "linenum = linenum_preamble_end + 1" + local prep_section=0 + local file_section=0 + local install_section=0 + while :; do + line="`sed -n "${linenum}p" $SRPM_SPECFILE_WITH_PATH`" + #notify.debug "line #${linenum} : \"$line\"" + case "$line" in + %description*) + let "file_section = 0" + notify.debug "[description] line#$linenum (\`$line')" + echo "$line" >> $tmpspec && let "linenum += 1" + # 1st line of the %description block + local startline=$linenum + while :; do + case "\ +`sed -n "${linenum}p" $SRPM_SPECFILE_WITH_PATH`" in + %package*|%prep|%setup*|%build|%install|%post*|\ +%preun*|%clean|%files*|%changelog) + [[ "$linenum" = "$startline" ]] && + notify.error $"\`%description' has empty body" + break ;; + *) let "linenum += 1" ;; + esac + done + if [ "${format_description_width:-0}" != 0 ]; then + notify.debug "\ +format_description_width = \"$format_description_width\"" + sed -n "$startline,$(($linenum - 1)){ +# delete leading whitespace from front of each line +:a /^[ \t]\+/s/^[ \t]*// +# found a line starting by '*' or '-' (so it's a list): +# format this line, goto end (label 'e') +/^\(*\|-\)[ \t]*/{ + s,^.[ ]*\(.*\),* \1,;be} +# append next line if the current does not end with '.' nor ':' +/[^(\.|:)]$/{ + x;n # save pattern space and get a new line + /^$/{H;x;be} # find a blank line: restore, goto end + /^[ \t]\+/s/^[ \t]*// + # oops, the new line starts by '*' or '-' + /^\(*\|-\)[ \t]*/{ + H;x # take care of all the input lines we are processing, + # format the line starting by '*' or '-', goto end + s,[^a-zA-Z0-9][*-]\+[ ]*,\n* ,;be} + # replace the eol with a space and go to the begin of the script + H;x;s/\n/ /;ba} +# cut lines with a trailing period inside +s/\.[ ]\+\([A-Z]\)/.\n\1/g +# and now print all we have processed and formatted +:e;p}" $SRPM_SPECFILE_WITH_PATH | \ + fold - -s -w "$format_description_width" >> $tmpspec + else + sed -n "$startline,$(($linenum - 1)){ +s,\.[ \t]*\(.\+\)$,\.\n\1,g;p}" $SRPM_SPECFILE_WITH_PATH >> $tmpspec + fi + continue ;; + %package*) + let "file_section = 0" + notify.debug "[package] line#$linenum (\`$line')" + echo "$line" >> $tmpspec && let "linenum += 1" + local startline=$linenum # one line after "%package" + while :; do + line="`sed -n "${linenum}p" $SRPM_SPECFILE_WITH_PATH`" + case "$line" in + *:*|\#*) let "linenum += 1" ;; + *) break ;; + esac + done + sed -n "${startline},$(($linenum-1))p" \ + $SRPM_SPECFILE_WITH_PATH | \ + while read -r line; do + case "$line" in + *:*) # note: the second sed expression is a bit more + # complicated because it must support a line like + # Requires: %{name} = %{?epoch:%epoch:}%{version} + printf "%-14s %s\n" \ + "`echo $line | sed 's,[ \t]*:.*,,'`:" \ + "`echo $line | sed 's,[a-zA-Z0-9 \t]*:[ \t]*,,'`" \ + >> $tmpspec ;; + \#*) echo "$line" >> $tmpspec ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"parsing the \`%package' block" ;; + esac + done + continue ;; + %prep*) + let "file_section = 0" + notify.debug "[prep] line#$linenum (\`$line')" + echo "$line" >> $tmpspec + let "prep_section += 1" ;; # '%prep' section found + %setup*-q*) + let "file_section = 0" + notify.debug "[setup] line#$linenum (\`$line')" + echo "$line" >> $tmpspec ;; + %setup*) + let "file_section = 0" + notify.debug "[setup] line#$linenum (\`$line' + \`-q')" + # add the '-q' option to '%setup' if not present + echo "$line" | sed 's,%setup\(.*\),%setup -q\1,' \ + >> $tmpspec ;; + %build) + let "file_section = 0" + notify.debug "[build] line#$linenum" + echo "$line" >> $tmpspec && let "linenum += 1" + local startline_configure startline_make configure + let "configure = 0" + while :; do + line="$(sed -n "${linenum}p" $SRPM_SPECFILE_WITH_PATH)" + case "$line" in + %install*) + let "linenum -= 1" + break ;; + *./configure*|*%configure*|*\ configure*) + let "startline_configure = $linenum" + notify.debug "startline_configure = $startline_configure" + let "linenum += 1" + let "configure = 1" ;; + *[%\ \t]make|*[%\ \t]make[%\ \t]*|make|make[%\ \t]*) + if [ -z "$startline_make" ]; then + # this check is needed to support multiple calls to make + # %make + # make test || : + let "startline_make = $linenum" + notify.debug "startline_make = $startline_make" + let "make = 1" + fi + let "linenum += 1" ;; + *) if [[ "$configure" = 1 ]]; then + notify.debug "configure == 1" + case "$line" in + *\\) let "linenum += 1" ;; + *) echo "`\ +sed -n "$startline_configure,${linenum}p" $SRPM_SPECFILE_WITH_PATH`" | \ +sed -n ' # do format the configure lines + /^[ \t]*.\/configure\|[ \t]*%configure/{ + :a /\\$/N; s/\\\n//; ta; s,[ \t]*--, \\\n --,g}; p' >> $tmpspec + let "configure = 0" + let "linenum += 1" ;; + esac + echo "" >> $tmpspec + elif [[ "$make" = 1 ]]; then + case "$line" in + *\\) let "linenum += 1" ;; + *) echo "`\ +sed -n "$startline_make,${linenum}p" $SRPM_SPECFILE_WITH_PATH`" | \ +sed "$format_extra_rules" | \ +sed -n ' # do format the make lines + /^[ \t]*make[ \t]*\|[ \t]*%make[ \t]*/{:a /\\$/N; s/\\\n//; ta}; p' \ + >> $tmpspec + + let "make = 0" + let "linenum += 1" ;; + esac + echo "" >> $tmpspec + else + echo "$line" | sed "$format_extra_rules" \ + >> $tmpspec + let "linenum += 1" + fi ;; + esac + done ;; + %changelog*) + let "file_section = 0" + notify.debug "[changelog] line#$linenum" + # exit the loop when %changelog is found + break ;; + %files*) + let "file_section = 1" + notify.debug "[file] ($line) line#$linenum" + echo "$line" >> $tmpspec ;; + %install*) + let "install_section = 1" + notify.debug "[%install] ($line) line#$linenum" + echo "$line" >> $tmpspec ;; + *) if [[ "$prep_section" = 0 ]]; then + # do not modify lines before `%prep' section + echo "$line" >> $tmpspec + let "linenum += 1" + continue + fi + +# if [ "$install_section" = 1 ]; then +# case "$line" in +# *[%\ \t]make|*[%\ \t]make[%\ \t]*|make|make[%\ \t]*) +# let "make = 1" +#echo "*startline = $startline -- $line" +# let "startline = $linenum" ;; +# esac +# +# if [ "$make" = 1 ]; then +# while :; do +# line="$(\ +#sed -n "${linenum}{s,\t, ,g;p}" $SRPM_SPECFILE_WITH_PATH)" +# case "$line" in +# *\\) let "linenum += 1" ;; +# *) echo "$(\ +#sed -n "$startline,${linenum}p" $SRPM_SPECFILE_WITH_PATH)" | \ +# sed -n ' # do format the make install lines +# /^[ ]*make\|[ ]*%make/{ +# :a /\\$/N; s/\\\n//; ta +# s,\ , \\\n ,g}; p' >> $tmpspec +# let "make = 0" +# let "linenum += 1" +#echo "*linenum = $linenum -- $line" +# break ;; +# esac +# done +# fi +# fi + + [ "$file_section" = 1 ] && + line="$(echo "$line" | sed "\ +s,$bindir/,%{_bindir}/, +s,$sbindir/,%{_sbindir}/, +s,$includedir/,%{_includedir}/, +s,$libdir/,%{_libdir}/, +s,$libexecdir/,%{_libexecdir}/, +s,$mandir/,%{_mandir}/, +s,$infodir/,%{_infodir}/, +s,$datadir/,%{_datadir}/, +s,$sysconfdir/,%{_sysconfdir}/, +s,$localstatedir/,%{_localstatedir}/, +s,$sharedstatedir/,%{_sharedstatedir}/, +s,$prefix/,%{_prefix}/,")" + + line="$(echo "$line" | sed ' +s,^rm -rf $RPM_BUILD_ROOT,[ \"$RPM_BUILD_ROOT\" != / ] \&\& rm -rf $RPM_BUILD_ROOT,g +s,^rm -rf %[{]*buildroot[}]*,[ \"%{buildroot}\" != / ] \&\& rm -rf %{buildroot},g +s,\($[{]*RPM_BUILD_ROOT[}]*\)/\(%[{]*_[a-z]*dir[}]*\),\1\2,g +s,\(%[{]*buildroot[}]*\)/\(%[{]*_[a-z]*dir[}]*\),\1\2,g')" + + [ "$format_buildroot" ] && line="$(echo "$line" | \ + sed 's,$[{]*RPM_BUILD_ROOT[}]*,%{buildroot},g')" + [ "$format_builddir" ] && line="$(echo "$line" | \ + sed 's,$[{]*RPM_BUILD_DIR[}]*,%{_builddir},g')" + + [[ "$format_extra_rules" ]] && line="\ +$(echo "$line" | sed "$format_extra_rules" 2>/dev/null)" + + # do use rpm variables (see 'rpm --showrc') between'%prep' + # and '%changelog', if 'format_unix_tools' is true + [ "$format_unix_tools" = 1 ] && + line="$(echo "$line" | sed ' +s,^grep ,%{__grep} ,;s,\([&; ]\+\)grep ,\1%{__grep} ,g +/\(%[{]\?__make[}]\?\|make\)[ ]*install/!s,\([&; ]*\)install ,\1%{__install} ,g +s,ln -fs,%{__ln_s} -f,g +s,ln -sf,%{__ln_s} -f,g +s,ln -s, %{__ln_s},g +s,^make\([^a-z]\),%{__make}\1,;s,\([&; ]\+\)make\([^a-z]\),\1%{__make}\2,g +s,mkdir -p ,%{__mkdir_p} ,g +s,mkdir ,%{__mkdir} ,g +s,^mv,%{__mv},;s,\([&; ]\+\)mv ,\1%{__mv} ,g +s,^rm,%{__rm},;s,\([&; ]\+\)rm ,\1%{__rm} ,g +s,^sed,%{__sed},;s,\([&; ]\+\)sed ,\1%{__sed} ,g +s,^tar,%{__tar},;s,\([&; ]\+\)tar ,\1%{__tar} ,g')" + + echo "$line" >> $tmpspec + ;; + esac + let "linenum += 1" + done + + echo -e "\ +%changelog +* `LC_ALL="C" date "+%a %b %d %Y"` $packager_fullname \ +<$packager_email> ${pck_newver}-$specfile_newrelease +- ${changelog_new//\\n/\n } +" >> $tmpspec + + sed -n '/%changelog/,${/^%changelog/d;p}' \ + $SRPM_SPECFILE_WITH_PATH >> $tmpspec + + cp -f $tmpspec $SRPM_SPECFILE_WITH_PATH 2>/dev/null + [[ $? -eq 0 ]] || + notify.error $"cannot create \`$SRPM_SPECFILE_WITH_PATH'" + + rm -f $tmpspec + else # [ "$spec_format" = 0 ] + apply_define_list_name $SRPM_SPECFILE_WITH_PATH + + # change package version and release + # update the %changelog + sed -i "\ + s,\(^Version[ \t]*:[ \t]*\).*,\1$pck_newver, + s,\(^Release[ \t]*:[ \t]*\).*,\1$specfile_newrelease, + /%changelog.*/a\\ +* `LC_ALL="C" date "+%a %b %d %Y"` $packager_fullname \ +<$packager_email> $pck_newver-$specfile_newrelease\\ +- ${changelog_new//\\n/\n }\\ +" $SRPM_SPECFILE_WITH_PATH + fi + + # avoid using caching data out of sync in following steps + notify.debug "removing infofile ($infofile)" + rm -f $infofile + notify.debug "removing preprocessed specfile ($specfile_preprocessed)" + > $specfile_preprocessed + + rpmvars.init --clear + ;; + 5) if [ "$norpms" = 1 ]; then + notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +build the srpm package""${NORM}" + else + notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +build the rpm(s) and srpm packages""${NORM}" + + # security check about LD_LIBRARY_PATH to catch misuse + [ "$LD_LIBRARY_PATH" ] && notify.warning "\ +LD_LIBRARY_PATH is set"" ($LD_LIBRARY_PATH)" + + [ "$PYTHONDONTWRITEBYTECODE" ] && notify.warning "\ +PYTHONDONTWRITEBYTECODE is set"" ($PYTHONDONTWRITEBYTECODE)" + fi + + infofile.create + . $infofile + + target_cpu.set_and_check + + if [ "$force_build" = 0 ]; then + local pck filename pck_rpmversion pck_rpmrelease build_needed + + # [[ "$pck_newver" && -z "$pck_newrel" ]] && + # [[ "$pck_newver" != $SPEC_VERSION ]] && + # notify.error $"release for new package required" + # + # # use the value provided by user via command line if available + # pck_rpmversion=${pck_newver:-$SPEC_VERSION} + # pck_rpmrelease="${pck_newrel:-"${SPEC_RELEASE%%[^0-9\.]*}"}" + + [[ -n "$pck_newver" && "$pck_newver" != "$SPEC_VERSION" ]] && + notify.error $"\ +the version entered at command line doesn't match the version set in the specfile" + + [[ -n "$pck_newrel" && "$pck_newrel" != "$SPEC_RELEASE" ]] && + notify.error $"\ +the release entered at command line doesn't match the version set in the specfile" + + pck_rpmversion="$SPEC_VERSION" + pck_rpmrelease="${SPEC_RELEASE%%[^0-9\.]*}" + notify.debug "pck_rpmversion = $pck_rpmversion" + notify.debug "pck_rpmrelease = $pck_rpmrelease" + + notify.debug "SPEC_TARGET = [${SPEC_TARGET[*]}]" + + # check if the rpm file(s) has been already built + let "build_needed = 0" + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture + filename="$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + notify.debug "\ +filename = $filename ""\ +$([ -f "$filename" ] && echo "(found)" || echo "(not found)")" + [ -f "$filename" ] || let "build_needed = 1" + + ## rebuild the rpm package(s) if the specfile has been modified + #[ "$SRPM_SPECFILE_WITH_PATH" -nt "$filename" ] && + # let "build_needed = 1" + done + notify.debug "build_needed = $build_needed" + [ "$build_needed" = 1 ] && norpms=0 || norpms=1 + notify.debug "norpms = $norpms (forced)" + + # check if the srpm file already exists + filename="\ +$srpms_dir/$SPEC_NAME-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.src.rpm" + notify.debug "\ +filename = $filename ""\ +$([ -f "$filename" ] && echo "(found)" || echo "(not found)")" + [ -f "$filename" ] && nosrpm=1 || nosrpm=0 + + #if [ "$SRPM_SPECFILE_WITH_PATH" -nt "$filename" ]; then + # # rebuild the srpm package if the specfile has been modified + # nosrpm=0 + # notify.debug "nosrpm = $nosrpm (forced)" + #fi + fi + + [ -n "$pck_rpmversion" ] || pck_rpmversion="$SPEC_VERSION" + [ -n "$pck_rpmrelease" ] || pck_rpmrelease="${SPEC_RELEASE%%[^0-9\.]*}" + + # nothing to do, we can exit + if [[ "$norpms" = 1 && "$nosrpm" = 1 ]]; then + notify.note "\ +${NOTE}"$"building the rpm packages""${NORM}... "$"skipped" + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture + filename="$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + [ -f "$filename" -a "$SRPM_SPECFILE_WITH_PATH" -nt "$filename" ] && + notify.warning $"\ +specfile is newer than rpm package(s) (according to modification date)" + break + done + + notify.note "\ +${NOTE}"$"building the srpm package""${NORM}... "$"skipped" + filename="\ +$srpms_dir/$SPEC_NAME-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.src.rpm" + [ -f "$filename" -a "$SRPM_SPECFILE_WITH_PATH" -nt "$filename" ] && + notify.warning $"\ +specfile is newer than srpm (according to modification date)" + continue + fi + + # download and install all the needed build requirements... + + # note: it's not possible to directly use the features provided by + # rpmlib because they'are bugged (at least in the version 4.0.4) + # so we install the necessary 'BuildRequirement's looking at the + # specfile preamble + [ "$(sed -n '/^BuildRequires/p' $SRPM_SPECFILE_WITH_PATH)" ] && + notify.debug "\ +[BuildRequires] +$(sed -n '/^BuildRequires/{s,.*, &,p}' $SRPM_SPECFILE_WITH_PATH)" + + local f rpm_provided_by buildrequirements_to_install + for f in ${SPEC_BUILDREQUIRES[@]}; do + rpm_provided_by="$(rpm -q $rpm_root_opts --whatprovides $f)" + [ $? -eq 0 ] || unset rpm_provided_by + + notify.note " * "$"\ +build requirement found"": \`${NOTE}$f${NORM}' ""\ +(${NOTE}$rpm_provided_by${NORM})" + + # the build requirement is already installed + [[ "$rpm_provided_by" ]] && continue + + buildreqs_to_install[${#buildreqs_to_install[*]}]="$f" + done + + # remove duplicates + buildreqs_to_install=( +$(for f in ${buildreqs_to_install[@]}; do echo $f; done | sort -u)) + + # install missing build requirements + if [[ "${buildreqs_to_install[@]}" ]]; then + if [ -n "$rpm_download_and_install" ]; then + for f in ${buildreqs_to_install[@]}; do + notify.note " * "$"\ +installing missing build requirement"": \`${NOTE}$f${NORM}'" + done + + if [ -n "$proxy" ]; then + [[ "$debug_print_private_user_infos" = "1" || + -z "$proxy_user" ]] && notify.debug "\ +{http,ftp}_proxy=\"{http,ftp}://${proxy_user:+${proxy_user}@}${proxy}\"" + + http_proxy="http://${proxy_user:+${proxy_user}@}${proxy}" \ + ftp_proxy="ftp://${proxy_user:+${proxy_user}@}${proxy}" \ + $rpm_download_and_install ${buildreqs_to_install[*]} + else + $rpm_download_and_install ${buildreqs_to_install[*]} + fi + [ $? -eq 0 ] || notify.error $"\ +cannot install the needed build requirements" + else + notify.error $"\ +found ${NOTE}missing BuildRequirement${NORM} \`${NOTE}$f${NORM}'" + fi + fi + + # automatically download the missing source and patch files... + + # get the list of URLs for the source files to download + specfile.getvars -s $SRPM_SPECFILE_WITH_PATH --verbatim SPEC_SOURCE + + local filenum totfilenum fullURL sdflag + + [ "$force_download" = 1 ] && sdflag="--force" + + let "totfilenum = 0" + for filenum in `seq 1 1 ${#SPEC_SOURCE_VERBATIM[@]}`; do + let "totfilenum += 1" + fullURL=${SPEC_SOURCE_VERBATIM[$filenum-1]} + notify.debug "fullURL = $fullURL" + + fullURL=$(\ +rpmvars.solve "$fullURL" "$SRPM_SPECFILE_WITH_PATH") + notify.debug "fullURL = $fullURL" + + curl.download --options "$curl_options" $sdflag \ +${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ +--exit-on-err --filenum="$totfilenum" --destdir="$source_dir" "$fullURL" + done + + # get the list of URLs for the patch files to download + specfile.getvars -s $SRPM_SPECFILE_WITH_PATH --verbatim SPEC_PATCH + + for filenum in `seq 1 1 ${#SPEC_PATCH_VERBATIM[@]}`; do + let "totfilenum += 1" + fullURL=${SPEC_PATCH_VERBATIM[$filenum-1]} + notify.debug "fullURL = $fullURL" + + fullURL=$(\ +rpmvars.solve "$fullURL" "$SRPM_SPECFILE_WITH_PATH") + notify.debug "fullURL = $fullURL" + + curl.download --options "$curl_options" $sdflag \ +${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ +--exit-on-err --filenum="$totfilenum" --destdir="$source_dir" "$fullURL" + done + + local rpmbuild_opts="\ +--define=\"%_srcrpmdir $srpms_dir\" \ +--define=\"%_rpmdir $rpms_dir\" \ +--define=\"%_specdir $spec_dir\" \ +--define=\"%_sourcedir $source_dir\" \ +--define=\"%_builddir $build_dir\" \ +--define=\"%_tmppath $tmppath_dir\"" + + # [ "$rpm_rootdir" ] && + # rpmbuild_opts="$rpmbuild_opts $rpm_root_opts" + + # check if we are cross-compiling + [ "$BUILD_ARCH" != "$target_cpu" ] && + rpmbuild_opts="--target $target_cpu $rpmbuild_opts" + + [ "$cleanup" = "1" ] && rpmbuild_opts="$rpmbuild_opts --clean" + + # note: exit with error when build requirements are missing + notify.note "${NOTE}"$"testing out specfile""${NORM}..." + eval "rpmbuild --nobuild \ +$rpmbuild_opts $rpm_root_opts $USER_RPMDEFINE_OPTS \ +$SRPM_SPECFILE_WITH_PATH 2>&1" || + notify.error $"rpmbuild exited with error code \`$?'" + + notify.debug "define_list_name = (${define_list_name[*]})" + notify.debug "define_list_value = (${define_list_value[*]})" + + if [ "$norpms" = 1 ]; then + notify.note "\ +${NOTE}"$"building the rpm packages""${NORM}... "$"skipped" + + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture + filename="$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + [ -f "$filename" -a "$SRPM_SPECFILE_WITH_PATH" -nt "$filename" ] && + notify.warning $"\ +specfile is newer than rpm package(s) (according to modification date)" + break + done + fi + + if [ "$nosrpm" = 1 ]; then + notify.note "\ +${NOTE}"$"building the srpm package""${NORM}... "$"skipped" + + filename="\ +$srpms_dir/$SPEC_NAME-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.src.rpm" + [ -f "$filename" -a "$SRPM_SPECFILE_WITH_PATH" -nt "$filename" ] && + notify.warning $"\ +specfile is newer than srpm (according to modification date)" + fi + + if [[ "$norpms" = 1 && "$nosrpm" = 1 ]]; then + : + elif [ "$norpms" = 1 ]; then + notify.note "${NOTE}"$"building the srpm package""${NORM}..." + # as the dependencies check is done before, it is safe to pass + # --nodeps to non-simulated build commands. + eval "\ +rpmbuild -bs $rpmbuild_opts --nodeps $SRPM_SPECFILE_WITH_PATH $USER_RPMDEFINE_OPTS 2>&1" + elif [ "$nosrpm" = 1 ]; then + notify.note "${NOTE}"$"building the rpm packages""${NORM}..." + eval "\ +rpmbuild -bb $rpmbuild_opts --nodeps $SRPM_SPECFILE_WITH_PATH $USER_RPMDEFINE_OPTS 2>&1" + else + notify.note "${NOTE}"$"building rpm and srpm packages""${NORM}..." + eval "\ +rpmbuild -ba $rpmbuild_opts --nodeps $SRPM_SPECFILE_WITH_PATH $USER_RPMDEFINE_OPTS 2>&1" + fi + [ $? -eq 0 ] || + notify.error $"rpmbuild exited with error code \`$?'" + ;; + 6) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +build the list of the build requirements""${NORM}" + +# notify.warning $"\ +#deprecated option"": "$"use"" -a5 --norpm [--force-build]" + + infofile.create + . $infofile + +# rpmbuild -bs $SRPM_SPECFILE_WITH_PATH 2>&1 +# [[ $? -eq 0 ]] || +# notify.error $"rpmbuild exited with error code \`$?'" + + local frequires=$(mktemp -q -t frequires.XXXXXXXX) || + notify.error $"can't create temporary files" + + target_cpu.set_and_check + + local i pck filename pck_rpmversion pck_rpmrelease + + [[ "$pck_newver" && -z "$pck_newrel" ]] && + [[ "$pck_newver" != $SPEC_VERSION ]] && + notify.error $"release for new package required" + + # use the value provided by user via command line if available + pck_rpmversion=${pck_newver:-$SPEC_VERSION} + pck_rpmrelease="${pck_newrel:-"${SPEC_RELEASE%%[^0-9\.]*}"}" + notify.debug "pck_rpmversion = $pck_rpmversion" + notify.debug "pck_rpmrelease = $pck_rpmrelease" + + notify.debug "SPEC_TARGET = [${SPEC_TARGET[*]}]" + + PERL_PREFIXES=`perl -V | grep "^ /usr/lib/perl5"` + + unset provides + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then + filename="$rpms_dir/noarch/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" + else + filename="$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + fi + #notify.note " * $filename" + [ -e $filename ] || + notify.error $"package not found"": \`$filename'" + + # look for RPMs provides + provides="$provides `rpm -p -q $filename --provides | \ + while read line; do echo -n "${line/ */} "; done`" + done + + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then + filename="$rpms_dir/noarch/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" + else + filename="$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + fi + notify.note " * $filename" + #[ -e $filename ] || + # notify.error $"package not found"": \`$filename'" + + # display all the build requirements + rpm -p -q $filename --requires | \ + while read line; do + buildreq="" + req=${line/ */} + if [ "`echo \"$provides\" | grep ${req}`" ]; then + # self-provided requirement + : + elif [ "${req:0:1}" = "/" ]; then + # file requirement; ignore + : + elif [ "${req:0:5}" = "perl(" ]; then + # a perl requirement + preq=`echo $req | sed "s|perl(\(.*\))|\1|g"` + preq="`echo $preq | sed 's|::|/|g'`.pm" + for p in $PERL_PREFIXES; do + [ -e ${p}/${preq} ] && + buildreq=`rpm -qf ${p}/${preq} 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` + [ "$buildreq" ] && break + done + [ ! "$buildreq" ] && + echo "# $req: perl requirement not resolved" >> $frequires + elif [ "${req:0:7}" = "rpmlib(" -o \ + "${req:0:7}" = "config(" -o \ + "${req:0:11}" = "executable(" ]; then + # not a build requirement + : + elif [ "${req/.so*/}" != "$req" ]; then + # requirement is a shared library + req=${req/(*)/} + lib=${req/.*/}.so + libpath=`$path_ldconfig -p | grep $req` + libpath=${libpath/\(*\)/} + if [ "$libpath" ]; then + libpath=${libpath/* => /} + solibpath="${libpath/.so*/}.so" + if [ ! -e $solibpath -a "${solibpath:0:5}" = "/lib/" ]; then + solibpath="/usr$solibpath" + fi + eval buildreq=`rpm -qf $solibpath 2>/dev/null | \ + sed "s|\(.*\)-[^-]*-[^-]*|\1|"` 2>/dev/null + if [ ! "$buildreq" -o $? -ne 0 ]; then + # let's try removing version extension in libname + # (eg. liblber-2.2.so => liblber.so) + solibpath=`echo $solibpath | sed "s|-[0-9.]*\.so|.so|"` + eval buildreq=`rpm -qf $solibpath 2>/dev/null | \ + sed "s|\(.*\)-[^-]*-[^-]*|\1|"` 2>/dev/null + [ ! "$buildreq" -o $? -ne 0 ] && + echo "#$req: .so link not found" >> $frequires + fi + else + echo "\ +#$req: library not reported by ldconfig; run \`ldconfig' and try again" >> $frequires + fi + elif [ "${req}" = "python(abi)" ]; then + # python requirement + buildreq=libpython-devel + else + # unidentified requirement + buildreq=`rpm -q --whatprovides $req 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` + [ "$buildreq" ] || echo "#$req: not found; what is this?" >> $frequires + fi + if [ "${buildreq}" -a "${buildreq/%-devel/}" = "${buildreq}" ]; then + # if a -devel exists for this package, use it + develpkg=`rpm -q ${buildreq}-devel 2>/dev/null` && + buildreq=`echo $develpkg | sed "s|\(.*\)-[^-]*-[^-]*|\1|"` + fi + # finally print buildrequires line + [ "$buildreq" ] && echo "BuildRequires: $buildreq" >> $frequires + done + done + + notify.note "## AUTOBUILDREQ-BEGIN" + cat $frequires | sort -u + notify.note "## AUTOBUILDREQ-END" + + rm -f $frequires + ;; + 7) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +simulate the installation of the rpm package(s)""${NORM}" + + infofile.create + . $infofile + + target_cpu.set_and_check + + local i pck filename pck_rpmversion pck_rpmrelease + + [[ "$pck_newver" && -z "$pck_newrel" ]] && + [[ "$pck_newver" != $SPEC_VERSION ]] && + notify.error $"release for new package required" + + # use the value provided by user via command line if available + pck_rpmversion=${pck_newver:-$SPEC_VERSION} + pck_rpmrelease="${pck_newrel:-"${SPEC_RELEASE%%[^0-9\.]*}"}" + notify.debug "pck_rpmversion = $pck_rpmversion" + notify.debug "pck_rpmrelease = $pck_rpmrelease" + + notify.debug "SPEC_TARGET = [${SPEC_TARGET[*]}]" + + for pck in ${SPEC_TARGET[*]}; do + # FIXME : we should check and complain if the package has + # been built for a different architecture + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then + filename="$rpms_dir/noarch/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" + else + filename="$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + fi + notify.note " * $filename" + [ -e $filename ] || + notify.error $"package not found"": \`$filename'" + done + + notify.debug "rpm -U --test ${rpm_root_opts:+$rpm_root_opts }\ +$(for pck in ${SPEC_TARGET[*]}; do + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then + echo -n "$rpms_dir/noarch/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm " + else + echo -n "$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm " + fi +done)" + rpm -U --test $rpm_root_opts \ + $(for pck in ${SPEC_TARGET[*]}; do + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then + echo -n "$rpms_dir/noarch/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm " + else + echo -n "$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm " + fi + done) || notify.error $"rpm exited with error code:"" \`$?'" + ;; + 8) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +perform some quality and security checks""${NORM}" + + infofile.create + . $infofile + + target_cpu.set_and_check + + notify.debug "\ +pck_newver = \"$pck_newver\", pck_newrel = \"$pck_newrel\"" + [[ "$pck_newver" && -z "$pck_newrel" ]] && + [[ "$pck_newver" != $SPEC_VERSION ]] && + notify.error $"release for new package required" + + local i + + local pck_rpmversion + # use the value provided by user via command line when available + pck_rpmversion=${pck_newver:-$SPEC_VERSION} + notify.debug "pck_rpmversion = $pck_rpmversion" + + local pck_rpmrelease + # use the value provided by user via command line when available + pck_rpmrelease="${pck_newrel:-"${SPEC_RELEASE%%[^0-9\.]*}"}" + notify.debug "pck_rpmrelease = $pck_rpmrelease" + + local tmpextractdir + tmpextractdir=$(mktemp -q -d -t rpm_extract.XXXXXXXX) + [[ $? -eq 0 ]] || + notify.error $"can't create temporary files" + notify.debug "$FUNCNAME: tmpextractdir = $tmpextractdir" + + # create the info file 'rpmpkg.info' in '$tmpextractdir' + # data: + # - rpmpkg_name[] : name of the rpm packages + # - data saved in '$infofile' + + local pcknew_name + > $tmpextractdir/rpmpkg.info + i=0 + for pck in ${SPEC_TARGET[@]}; do + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then + pcknew_name="\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" + [[ -e $rpms_dir/noarch/$pcknew_name ]] || + notify.error $"package not found"": \`$pcknew_name'" + echo "rpmpkg_name[$i]=\"$rpms_dir/noarch/$pcknew_name\"" \ + >> $tmpextractdir/rpmpkg.info + else + pcknew_name="\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + [[ -e $rpms_dir/$target_cpu/$pcknew_name ]] || + notify.error $"package not found"": \`$pcknew_name'" + echo "rpmpkg_name[$i]=\"$rpms_dir/$target_cpu/$pcknew_name\"" \ + >> $tmpextractdir/rpmpkg.info + fi + notify.debug "$FUNCNAME: pcknew_name[$i] = $pcknew_name" + let "i += 1" + done + + # function rpms.extract() + # extract the files contained in all the rpm archives build by + # by a single specfile + # args: + # -i|--infofile the file containing infos about packages to extract + # -t|--tmpdir the directory where the files will be extracted to + function rpms.extract() { + local rpminfofile tmpextractdir + TEMP=`LANG=C getopt \ + -o i:t: --long infofile:,tmpdir: -n "$FUNCNAME" -- "$@"` + [[ $? = 0 ]] || return 1 + eval set -- "$TEMP" + + while :; do + case "$1" in + -i|--infofile) + rpminfofile="$2" + shift + ;; + -t|--tmpdir) + tmpextractdir="$2" + shift + ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error" ;; + esac + shift + done + + [ "$rpminfofile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--infofile)" + [ -r "$rpminfofile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"cannot read"" \`$rpminfofile'" + + [ "$tmpextractdir" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--tmpdir)" + [ -d "$tmpextractdir" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"no such file or directory"" \`$tmpextractdir'" + + . $rpminfofile + + i=0 + for pck in ${rpmpkg_name[@]}; do + [[ -e "$pck" ]] || notify.error $"\ +package not found"": \`$pck'" + + mkdir -p $tmpextractdir/$i 2>/dev/null + [ $? -eq 0 ] || notify.error $"\ +can't create temporary directory"": $tmpextractdir/$i" + + pushd $tmpextractdir/$i >/dev/null + rpm2cpio $pck > rpm_extract_tmp.cpio + [ $? -eq 0 ] || + notify --error $"cannot extract files from rpm archive" + + cpio --quiet --extract --make-directories < rpm_extract_tmp.cpio + [ $? -eq 0 ] || + notify --error $"cannot extract files from cpio archive" + + rm -f rpm_extract_tmp.cpio + popd >/dev/null + let "i += 1" + done + } + + rpms.extract \ + --infofile "$tmpextractdir/rpmpkg.info" \ + --tmpdir "$tmpextractdir" || exit 1 + + # execute all the available tests... + + [ -n "$testdir" ] || + notify.error "\`testdir': "$"unset in the configuration files" + [ -d "$testdir" ] || + notify.error $"no such file or directory"": \`$testdir'" + + for fname in $testdir/*; do + notify.debug "$FUNCNAME: running test: \`$fname'" + ( . $fname + alltests --infofile "$tmpextractdir/rpmpkg.info" \ + --tmpdir "$tmpextractdir" ) + done + + # temporary files cleanup + rm -fr $tmpextractdir + ;; + 9) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ +calculate the md5/sha1 hashing values""${NORM}" + + infofile.create + . $infofile + + target_cpu.set_and_check + + [[ "$pck_newver" && -z "$pck_newrel" ]] && + [[ "$pck_newver" != $SPEC_VERSION ]] && + notify.error $"release for new package required" + + # use the value provided by user via command line if available + local pck_rpmversion pck_rpmrelease + pck_rpmversion=${pck_newver:-$SPEC_VERSION} + pck_rpmrelease="${pck_newrel:-"${SPEC_RELEASE%%[^0-9\.]*}"}" + notify.debug "pck_rpmversion = $pck_rpmversion" + notify.debug "pck_rpmrelease = $pck_rpmrelease" + + # ??? th md5sum values differ from the output of the ??? + # ??? command `rpmsign -v --checksig ' ??? + for tool in md5sum sha1sum; do + local filename="\ +$srpms_dir/$SPEC_NAME-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.src.rpm" + [[ -e $filename ]] || + notify.error $"package not found"": \`$filename'" + + echo "[${tool/sum/}]" + $tool -b $filename | sed "s,*.*/\(.*\),\1," + local i=0 + for pck in ${SPEC_TARGET[@]}; do + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then + filename="$rpms_dir/noarch/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" + else + filename="$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + fi + [ -e "$filename" ] || + notify.error $"package not found"": \`$filename'" + $tool -b $filename | sed "s,*.*/\(.*\),\1," + let "i += 1" + done + done + ;; + 10) [ -s "$infofile" ] || infofile.create + . $infofile + + target_cpu.set_and_check + + # usefull when debugging (default value is '1') + local do_ftp_upload=1 + + local pck_rpmversion pck_rpmrelease + [[ "$pck_newver" && -z "$pck_newrel" ]] && + [ "$pck_newver" != "$SPEC_VERSION" ] && + notify.error $"release for new package required" + + # use the value provided by user via command line if available + pck_rpmversion=${pck_newver:-$SPEC_VERSION} + # WARNING: only works if SPEC_RELEASE = [0-9\.]* + pck_rpmrelease="${pck_newrel:-"${SPEC_RELEASE%%[^0-9\.]*}"}" + notify.debug "pck_rpmversion = $pck_rpmversion" + notify.debug "pck_rpmrelease = $pck_rpmrelease" + + # repository.get_SRPMS_name( mbrowse ) + # --> got_SPEC_FILENAME_URL (${ftpurl_ro_rpms[0]}) + # --> SPEC_FILENAME_URL_old + # --> got_SPEC_FILENAME_URL_LEVEL (0) + # --> SPEC_FILENAME_URL_LEVEL_old + # --> got_SPEC_FILENAME_old (mbrowse-0.3.1-2qilnx.src.rpm) + # --> SPEC_VERSION_old (0.3.1) + # --> SPEC_RELEASE_old (2qilnx) + + repository.get_SRPMS_name \ + --urllist "${ftpurl_ro_srpms[$ftp_server_upload_num]}" \ + --urlnum "$ftp_server_upload_num" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "$pck_name" ${SPEC_OBSOLETES[@]} + # FIXME: `$?' is nonzero if the argument of `--urllist' is ""; + # this generally happens with a buggy configuration file but we + # do not stop the execution here with an errors condition + # (this behaviour should be probably changed when the read-only + # access to repositories requiring a password will be supported) + # + #[ $? -eq 0 ] || + # { notify.error $"repositories unreachable"; break; } + + if [[ ${#got_SPEC_FILENAME[@]} -gt 1 ]]; then + if [ "$force_upload" = 1 ]; then + # FIXME : add some extra checks + notify.warning $"found too many candidates"": $( + for f in ${got_SPEC_FILENAME[*]}; do + echo -en "\n * \`$f' " + done )" + else + notify.error $"found too many candidates"": $( + for f in ${got_SPEC_FILENAME[*]}; do + echo -en "\n * \`$f' " + done )" + fi + fi + + if [[ "$got_SPEC_FILENAME" ]]; then + SPEC_FILENAME_old="$got_SPEC_FILENAME" + SPEC_FILENAME_URL_old="$got_SPEC_FILENAME_URL" + SPEC_FILENAME_URL_LEVEL_old="$got_SPEC_FILENAME_URL_LEVEL" + fi + + notify.debug "SPEC_FILENAME_old = $SPEC_FILENAME_old" + notify.debug "SPEC_FILENAME_URL_old = $SPEC_FILENAME_URL_old" + notify.debug "\ +SPEC_FILENAME_URL_LEVEL_old = $SPEC_FILENAME_URL_LEVEL_old" + + local SPEC_VERSION_old SPEC_RELEASE_old + + if [ "$SPEC_FILENAME_old" ]; then + # version and release of the old packages + SPEC_VERSION_old=$(echo "$SPEC_FILENAME_old" | \ + sed "s,^.*-\([^-]*\)-[^-]*,\1,") + # we use a distro name indipendent regexpr + SPEC_RELEASE_old=$(echo "$SPEC_FILENAME_old" | \ + sed "s,^.*-[^-]*-\([^-]*\).src.rpm,\1,") + + notify.debug "SPEC_VERSION_old = $SPEC_VERSION_old" + notify.debug "SPEC_RELEASE_old = $SPEC_RELEASE_old" + fi + + # no repository for upload set by user... + if [ -z "$ftp_server_upload_num" ]; then + # ...so we select the repository where the old packages have been + # found or the default server, if no old packages exist + ftp_server_upload_num="\ +${SPEC_FILENAME_URL_LEVEL_old:-$ftp_rw_server_num_default}" + notify.debug "\ +ftp_server_upload_num = \"$ftp_server_upload_num\" (was unset)" + + [ "$ftp_server_upload_num" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: ""ftp_server_upload_num = \"\"" + fi + + notify.debug "\ +ftp_server_upload_num = \"$ftp_server_upload_num\"" + + if [ "${ftp_rw_server[$ftp_server_upload_num]}" ]; then + repository.is_reachable "${ftp_rw_server[$ftp_server_upload_num]}" + # NOTE. notify.error --> notify.warning because host command fails + # in qemu-arm environment (1.4.18) + [ $? -eq 0 ] || notify.warning $"\ +server unreachable"": \`${ftp_rw_server[$ftp_server_upload_num]}'" + else + notify.error $"\ +you have no read write access to url#$ftp_server_upload_num" + break + fi + + # NOTE : 'SPEC_FILENAME_URL_LEVEL_old' is unset the first time + # the package is uploaded to the ftp repository + if [ "$SPEC_FILENAME_URL_LEVEL_old" ]; then + [ "${arch_list[$SPEC_FILENAME_URL_LEVEL_old]}" ] || + notify.error "\ +\`arch_list[$SPEC_FILENAME_URL_LEVEL_old]': "$"unset in the configuration files" + + # find for RPM packages with same name but possibily with a + # different ver/rel by looking at + # ${ftpurl_ro_rpms[$SPEC_FILENAME_URL_LEVEL_old]} + repository.get_RPMS_name \ + --archlist "${arch_list[$SPEC_FILENAME_URL_LEVEL_old]}" \ + --target-cpu "$target_cpu" \ + --exclude "-$SPEC_VERSION-$SPEC_RELEASE" \ + --proxy "$proxy" \ + --proxy-user "$proxy_user" \ + "${ftpurl_ro_rpms[$SPEC_FILENAME_URL_LEVEL_old]}" \ + ${SPEC_TARGET[@]} ${SPEC_OBSOLETES[@]} + # ... and save the list in 'RPM_FILENAME_old[]' + RPM_FILENAME_old=( ${got_RPM_FILENAME[@]} ) + fi + + # now saving the updated copy... + + local ftp_opts="$curl_opts_netlink\ +${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}" + + [ "${ftp_rw_passive_mode[$ftp_server_upload_num]}" = "on" ] && + ftp_opts="$ftp_opts --ftp-pasv" + + local upload_ftp_server + local upload_ftp_rpms_dir + local upload_ftp_srpms_dir + local upload_ftp_port + local upload_ftp_user + local upload_ftp_passwd + local curr_srv_alias + + # select the server where the new packages will be uploaded + upload_ftp_server=${ftp_rw_server[$ftp_server_upload_num]} + notify.debug "upload_ftp_server = \"$upload_ftp_server\"" + [ "$upload_ftp_server" ] || notify.error "\ +\`ftp_rw_server[$ftp_server_upload_num]': "$"unset in the configuration files" + + # get the folder where the new rpm packages will be uploaded + upload_ftp_rpms_dir=${ftp_rw_rpms_dir[$ftp_server_upload_num]} + notify.debug "upload_ftp_rpms_dir = \"$upload_ftp_rpms_dir\"" + [ "$upload_ftp_rpms_dir" ] || notify.error "\ +\`ftp_rw_rpms_dir[$ftp_server_upload_num]': "$"unset in the configuration files" + + # get the folder where the new srpm package will be uploaded + upload_ftp_srpms_dir=${ftp_rw_srpms_dir[$ftp_server_upload_num]} + notify.debug "upload_ftp_srpms_dir = \"$upload_ftp_srpms_dir\"" + [ "$upload_ftp_srpms_dir" ] || notify.error "\ +\`ftp_rw_srpms_dir[$ftp_server_upload_num]': "$"unset in the configuration files" + + upload_ftp_port=${ftp_rw_port[$ftp_server_upload_num]} + [ "$ftp_rw_user_forced" ] && + upload_ftp_user="$ftp_rw_user_forced" || + upload_ftp_user="${ftp_rw_user[$ftp_server_upload_num]}" + [ "$ftp_rw_passwd_forced" ] && + upload_ftp_passwd="$ftp_rw_passwd_forced" || + upload_ftp_passwd="${ftp_rw_passwd[$ftp_server_upload_num]}" + + curr_srv_alias="${ftp_alias[$ftp_server_upload_num]}" + notify.note "\ +${NOTE}"$"upload the new packages to the ftp repository"" \ +#$ftp_server_upload_num ${curr_srv_alias:+($curr_srv_alias) }${NORM}: \ +${NOTE}$upload_ftp_server${NORM}..." + + [ "$do_ftp_upload" = "0" ] && + notify.warning $"\ +ftp upload has been disabled"" (do_ftp_upload = \"0\")" + + if [ -z "$upload_ftp_user" ]; then + notify.note $"trying with the ${NOTE}anonymous login${NORM}""..." + upload_ftp_user="anonymous" + [ "$upload_ftp_passwd" ] || upload_ftp_passwd="$packager_email" + fi + + notify.debug "upload_ftp_server = \"$upload_ftp_server\"" + # FIXME: the @arch@ string should be perhaps expanded here + notify.debug "upload_ftp_rpms_dir = \"$upload_ftp_rpms_dir\"" + notify.debug "upload_ftp_srpms_dir = \"$upload_ftp_srpms_dir\"" + notify.debug "upload_ftp_port = \"$upload_ftp_port\"" + if [ "$debug_print_private_user_infos" = "1" ]; then + notify.debug "upload_ftp_user = \"$upload_ftp_user\"" + notify.debug "upload_ftp_passwd = \"$upload_ftp_passwd\"" + else + notify.debug "upload_ftp_user = ***" + notify.debug "upload_ftp_passwd = ***" + fi + + # RPM package(s)... + if [ "$norpms" = "0" ]; then + let "i = 0" + for pck in ${SPEC_TARGET[@]}; do + # copy noarch packages to all the repository set in the + # configuration variable `arch_noarch_upload[]' + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" = "noarch" ]; then + filename="\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" + + for upload_arch in \ + ${arch_noarch_upload[$ftp_server_upload_num]}; do + if [ "$upload_arch" == "@arch@" ]; then + if [ "$target_cpu" != "noarch" ]; then + currurl="\ +$(repository.resolveURL "$upload_ftp_rpms_dir" "${target_cpu}")" + else + set -- ${arch_list[*]} + currurl="\ +$(repository.resolveURL "$upload_ftp_rpms_dir" "$1")" + fi + else + currurl="\ +$(repository.resolveURL "$upload_ftp_rpms_dir" "$upload_arch")" + fi + + [ "$do_ftp_upload" = "0" ] || curl.upload \ +$([ "$debug_print_private_user_infos" = 1 ] && echo -n "--debug-unsecure ") \ +--exit-on-err \ +--user "$upload_ftp_user:$upload_ftp_passwd" \ +--options "$ftp_opts" \ +--upload-file "$rpms_dir/noarch/$filename" \ +$upload_ftp_server${upload_ftp_port:+:$upload_ftp_port}/$currurl/$filename + done + else + filename="\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + currurl="\ +$(repository.resolveURL "$upload_ftp_rpms_dir" "$target_cpu")" + + [ "$do_ftp_upload" = "0" ] || curl.upload \ +$([ "$debug_print_private_user_infos" = 1 ] && echo -n "--debug-unsecure ") \ +--exit-on-err \ +--user "$upload_ftp_user:$upload_ftp_passwd" \ +--options "$ftp_opts" \ +--upload-file "$rpms_dir/$target_cpu/$filename" \ +$upload_ftp_server${upload_ftp_port:+:$upload_ftp_port}/$currurl/$filename + fi + let "i += 1" + done + fi + + # SRPM package... + if [ "$nosrpm" = "0" ]; then + filename="\ +$SPEC_NAME-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.src.rpm" + + [ "$do_ftp_upload" = "0" ] || curl.upload \ +$([ "$debug_print_private_user_infos" = 1 ] && echo -n "--debug-unsecure ") \ +--exit-on-err \ +--user="$upload_ftp_user:$upload_ftp_passwd" \ +--options="$ftp_opts" \ +--upload-file "$srpms_dir/$filename" \ +$upload_ftp_server${upload_ftp_port:+:$upload_ftp_port}/\ +$upload_ftp_srpms_dir/\ +$SPEC_NAME-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.src.rpm + fi + + # do backup or erase old packages... + + # NOTE: the backup is performed on the same server where old + # packages have been found and only if for this server the + # variable 'ftpdir_rw_old variable' has been set (is the variable + # is unset the old packages will just be removed) + + # it was the first upload for these packages (no backup possible) + [ "$SPEC_FILENAME_URL_LEVEL_old" ] || + { notify.note "${NOTE}"$"no old packages have been found.""${NORM}" + continue; } + + local backup_ftp_server + local backup_ftp_port + local backup_ftp_user + local backup_ftp_passwd + + backup_ftp_server=${ftp_rw_server[$SPEC_FILENAME_URL_LEVEL_old]} + backup_ftp_port=${ftp_rw_port[$SPEC_FILENAME_URL_LEVEL_old]} + [ "$ftp_rw_user_forced" ] && + backup_ftp_user="$ftp_rw_user_forced" || + backup_ftp_user="${ftp_rw_user[$SPEC_FILENAME_URL_LEVEL_old]}" + [ "$ftp_rw_passwd_forced" ] && + backup_ftp_passwd="$ftp_rw_passwd_forced" || + backup_ftp_passwd="${ftp_rw_passwd[$SPEC_FILENAME_URL_LEVEL_old]}" + + if [ -z "$backup_ftp_user" ]; then + notify.note $"trying with the ${NOTE}anonymous login${NORM}""..." + backup_ftp_user="anonymous" + [ "$backup_ftp_passwd" ] || backup_ftp_passwd="$packager_email" + fi + + notify.debug "backup_ftp_server = \"$backup_ftp_server\"" + notify.debug "backup_ftp_rpms_dir = \"$backup_ftp_rpms_dir\"" + notify.debug "backup_ftp_srpms_dir = \"$backup_ftp_srpms_dir\"" + notify.debug "backup_ftp_port = \"$backup_ftp_port\"" + if [ "$debug_print_private_user_infos" = "1" ]; then + notify.debug "backup_ftp_user = \"$backup_ftp_user\"" + notify.debug "backup_ftp_passwd = \"$backup_ftp_passwd\"" + else + notify.debug "backup_ftp_user = ***" + notify.debug "backup_ftp_passwd = ***" + fi + + local ftp_opts="$curl_opts_netlink" + + local curl_ftp_command_opts="\ +${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}" + [ "${ftp_rw_passive_mode[$ftp_server_upload_num]}" = "on" ] && + curl_ftp_command_opts="$curl_ftp_command_opts --ftp-passive" + + local backup_ftp_bckdir + if [ "${ftpdir_rw_old[$SPEC_FILENAME_URL_LEVEL_old]}" ]; then + notify.note "\ +${NOTE}"$"moving old packages to the remote backup folder""${NORM}..." + # generate a unique folder name (with P~=1) + backup_ftp_bckdir="\ +${ftpdir_rw_old[$ftp_server_upload_num]}/${SPEC_NAME}_$(date +%y%m%d.%H%M%S)" + else + curr_srv_alias="${ftp_alias[$SPEC_FILENAME_URL_LEVEL_old]}" + notify.note " +${NOTE}"$"removing old packages from the repository"" \ +$backup_ftp_server${curr_srv_alias:+ ($curr_srv_alias)}${NORM}..." + unset backup_ftp_bckdir + fi + notify.debug "backup_ftp_bckdir = \"$backup_ftp_bckdir\"" + + # get the directories where the old packages reside... + local ftp_rpms_old_dir="\ +${ftp_rw_rpms_dir[$SPEC_FILENAME_URL_LEVEL_old]}" + + local ftp_srpms_old_dir="\ +${ftp_rw_srpms_dir[$SPEC_FILENAME_URL_LEVEL_old]}" + + # a backup should be performed? (boolean variables) + local rpm_pcks_to_backup=0 + local srpm_pcks_to_backup=0 + + for pck in ${RPM_FILENAME_old[@]}; do + let "rpm_pcks_to_backup = 1" + notify.note "\ + * $(repository.resolveURL "$ftp_rpms_old_dir/${pck##*:}" "${pck%:*}")" + done + + # print the old SRPMS package... + [[ -n "$SPEC_FILENAME_old" && \ + "$nosrpm" != "1" && \ + "$SPEC_VERSION_old-$SPEC_RELEASE_old" != \ + "$SPEC_VERSION-$SPEC_RELEASE" ]] && + { let "srpm_pcks_to_backup = 1" + notify.note "\ + * $ftp_srpms_old_dir/$SPEC_FILENAME_old"; } + + notify.debug "rpm_pcks_to_backup = $rpm_pcks_to_backup" + notify.debug "srpm_pcks_to_backup = $srpm_pcks_to_backup" + + [[ "$rpm_pcks_to_backup" = "0" && "$srpm_pcks_to_backup" = "0" ]] && + { notify.note "${NOTE}"$"no old packages have been found.""${NORM}" + continue; } + + # print the backup folder... + [ "${ftpdir_rw_old[$ftp_server_upload_num]}" ] && + notify.note "\ + --> ""\ +$backup_ftp_server${backup_ftp_port:+:$backup_ftp_port} :: $backup_ftp_bckdir" + + if [ "$do_ftp_upload" = "1" ]; then + if [ "${ftpdir_rw_old[$SPEC_FILENAME_URL_LEVEL_old]}" ]; then + # make a backup copy of the old packages... + curl.ftp_command $curl_ftp_command_opts \ + --options "$ftp_opts" \ + --user "$upload_ftp_user:$upload_ftp_passwd" \ + --action mkdir --directory "$backup_ftp_bckdir" \ + $backup_ftp_server${backup_ftp_port:+:$backup_ftp_port} + + for pck in ${RPM_FILENAME_old[@]}; do + curl.ftp_command $curl_ftp_command_opts \ + --options "$ftp_opts" \ + --user "$upload_ftp_user:$upload_ftp_passwd" \ + --action rename-file \ + --rename-from "\ +$(repository.resolveURL "$ftp_rpms_old_dir/${pck##*:}" "${pck%:*}")" \ + --rename-to "$backup_ftp_bckdir/${pck##*:}" \ + $backup_ftp_server${backup_ftp_port:+:$backup_ftp_port} + done + if [ "$srpm_pcks_to_backup" = "1" ]; then + curl.ftp_command $curl_ftp_command_opts \ + --options "$ftp_opts" \ + --user "$upload_ftp_user:$upload_ftp_passwd" \ + --action rename-file \ + --rename-from "$ftp_srpms_old_dir/$SPEC_FILENAME_old" \ + --rename-to "$backup_ftp_bckdir/$SPEC_FILENAME_old" \ + $backup_ftp_server${backup_ftp_port:+:$backup_ftp_port} + fi + else + notify.debug "ftp_rpms_old_dir = $ftp_rpms_old_dir" + + # just delete the old packages... + for pck in ${RPM_FILENAME_old[@]}; do + currurl="\ +$(repository.resolveURL "$ftp_rpms_old_dir/${pck##*:}" "${pck%:*}")" + notify.debug "currurl = $currurl" + curl.ftp_command $curl_ftp_command_opts \ + --options "$ftp_opts" \ + --user "$upload_ftp_user:$upload_ftp_passwd" \ + --action delete \ + --delete "$currurl" \ +$backup_ftp_server${backup_ftp_port:+:$backup_ftp_port} + done + if [ "$srpm_pcks_to_backup" = "1" ]; then + curl.ftp_command $curl_ftp_command_opts \ + --options "$ftp_opts" \ + --user "$upload_ftp_user:$upload_ftp_passwd" \ + --action delete \ + --delete "${ftp_srpms_old_dir}/$SPEC_FILENAME_old" \ +$backup_ftp_server${backup_ftp_port:+:$backup_ftp_port} + fi + fi + fi + ;; + 11) [ -s "$infofile" ] || infofile.create + . $infofile + + target_cpu.set_and_check + + local pck_rpmversion pck_rpmrelease + [[ "$pck_newver" && -z "$pck_newrel" ]] && + [ "$pck_newver" != $SPEC_VERSION ] && + notify.error $"release for new package required" + + # use the value provided by user via command line if available + pck_rpmversion=${pck_newver:-$SPEC_VERSION} + pck_rpmrelease="${pck_newrel:-"${SPEC_RELEASE%%[^0-9\.]*}"}" + notify.debug "pck_rpmversion = $pck_rpmversion" + notify.debug "pck_rpmrelease = $pck_rpmrelease" + + [ "$force_install" = 1 ] && notify.note "\ +${NOTE}"$"install the new rpm packages"" ("$"force enabled"")${NORM}..." || + notify.note "${NOTE}"$"install the new rpm packages""${NORM}..." + + if [ "$rpm_download_and_install" ]; then + local pck2install_list="" + for pck in ${SPEC_TARGET[@]}; do + if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then + filename="$rpms_dir/noarch/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" + else + filename="$rpms_dir/$target_cpu/\ +$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" + fi + + [[ -n "$rpm_install_noinstall_mask" && + $filename =~ $rpm_install_noinstall_mask ]] && continue + if [[ -n "$rpm_install_l10n_pck_mask" && + $filename =~ $rpm_install_l10n_pck_mask ]]; then + [[ $filename =~ $rpm_install_l10n_pck_allow_lang_mask ]] \ + || continue + fi + + [ -e $filename ] && notify.note " * $filename" || + notify.error $"package not found"": \`$filename'" + pck2install_list="$pck2install_list $filename" + done + + if [ "$force_install" = 1 ]; then + [ "$rpm_install_force" ] || notify.error "\ +\`rpm_install_force': "$"unset in the configuration files" + notify.debug "\ +$rpm_install_force ${rpm_root_opts:+$rpm_root_opts }$pck2install_list" + $rpm_install_force $rpm_root_opts $pck2install_list + # || notify.error $"cannot install the new rpm packages" + else + [ "$rpm_install" ] || notify.error "\ +\`rpm_install': "$"unset in the configuration files" + notify.debug "\ +$rpm_install ${rpm_root_opts:+$rpm_root_opts }$pck2install_list" + $rpm_install $rpm_root_opts $pck2install_list || + notify.error $"cannot install the new rpm packages" + fi + fi + ;; + *) notify.warning $"unknown step \`$step'" ;; + esac + done + + if [ "$cleanup" = 1 ]; then + notify.note "[${NOTE}"$"cleaning up temporary files""${NORM}]" + notify.note $"removing source packages and patches, if any""..." + + # rpmbuild --rmsource $SRPM_SPECFILE_WITH_PATH + + [ -s "$infofile" ] || infofile.create + . $infofile + for srpm_source in ${SPEC_SOURCE[@]}; do + notify.note " "$"removing"" $srpm_source..." + rm -f $source_dir/$srpm_source + done + for srpm_patch in ${SPEC_PATCH[@]}; do + notify.note " "$"removing"" $srpm_patch..." + rm -f $source_dir/$srpm_patch + done + fi + + rm -f $infofile + + #notify.note "[${NOTE}"$"end of updating process""${NORM}]" + + if [ "$logging" = 1 ]; then + exec 1<&3 3<&- # restore stdout and close fd#3 + exec 2<&4 4<&- # restore stderr and close fd#4 + fi +} + +# the user configuration file for @package@ is required +config.check4user +# make some security checks +config.security + +package.update \ + "$spec_format" "$pck_name" "$pck_newver" "$pck_newrel" \ + "$steps" \ + "$cl_ftp_rw_user" \ + "$cl_ftp_rw_passwd" \ + "$spec_name" \ + "$define_list" \ + "$ftp_server_download_id" \ + "$ftp_server_upload_id" diff --git a/plugins/spec-create-old.in b/plugins/spec-create-old.in new file mode 100644 index 0000000..33ab289 --- /dev/null +++ b/plugins/spec-create-old.in @@ -0,0 +1,1507 @@ +#!/bin/bash +# pck-create -- plugin for @package@ +# Copyright (C) 2004-2010 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] && + { echo $"this script requires bash version 3 or better" >&2 && exit 1; } + +me=(${0##*/} "@version@" "@date@") + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +[ -r @libdir@/libnetwork.lib ] || + { echo "$me: "$"library not found"": @libdir@/libnetwork.lib" 1>&2 + exit 1; } +. @libdir@/libnetwork.lib + +# default values: +# colorized output (disabled by default) +let "colorize = 0" +# output verbosity +let "verbose = 1" +# Display all the man pages in the autogenerated specfile ("0") +# One entry per man page section ("1") +# Only one entry for all the man pages ("2") +let "man_condensed_list = 0" +# Display all the info pages in the autogenerated specfile ("0") (default) +# Only one entry for all the info pages ("1") +let "info_condensed_list = 0" +# do not use rpm variables for unix tools +let "format_unix_tools = 0" + +spec_type="standard" + +# load the configuration file(s) +[ -r @libdir@/libcfg.lib ] || + { echo "$me: "$"library not found"": @libdir@/libcfg.lib" 1>&2 + exit 1; } +. @libdir@/libcfg.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="${me[0]}"; export TEXTDOMAIN + +function copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function version() { + echo "\ +${me[0]} ${me[1]} +Copyright (C) 2004-2010 Davide Madrisan " +} + +# $1: optional exit code (default is '1') +function usage() { + version + echo "\ +"$"Try to create a specfile for the specified "". + +"$"Usage"": + @frontend@ -s [-n ] [-v ] [-t ] [-o ] + +"$"where the above options mean"": + -s, --source "$"Try to create a specfile for the specified "" + -n, --pck-name "$"Name of the package (default: taken from tarball name)"" + -v, --pck-version "$"Version of the package (default: taken from tarball name)"" + -t, --type "$"Typology of the specfile to be created"" + standard : "$"standard specfile (default)"" + gnome : "$"specfile for gnome packages"" + kde3 : "$"specfile for kde3 packages"" + kde4 : "$"specfile for kde4 packages"" + library : "$"specfile for common library packages"" + librarytools: "$"specfile for library packages with tools"" + perl : "$"specfile for single-package perl modules"" + python : "$"specfile for python modules"" + -o, --output "$"Redirect the output to the file "" + +"$"Operation modes"": + -h, --help "$"Print this help, then exit"" + -V, --version "$"Print version number, then exit"" + -q, --quiet "$"Run in quiet mode"" + -r, --colorize "$"Enable the colorized output"" + -D, --debug "$"Run in debugging mode (very verbose output)"" + +"$"Samples"": + @frontend@ -s ~/software/@package@-@version@.tar.bz2 -t standard -o @package@.spec + @frontend@ -s http://ftp.qilinux.it/devel/tools/@package@/@package@-@version@.tar.bz2 + +"$"Report bugs to ." + + exit ${1:-1} +} + +case $1 in + --autospec-args-file*) + if [[ "$1" =~ = ]]; then + argsfile=`echo $1 | sed 's/^--autospec-args-file=//'` + else + argsfile=$2 + fi + [ -r "$argsfile" ] || notify.error $"cannot read"": \`$argsfile'" + . $argsfile && rm -f $argsfile + ;; +esac + +for arg in $@; do + case $arg in + -h|--help) usage 0 ;; + -V|--version) version; echo; copying; exit 0 ;; + esac +done + +# the user configuration file for @package@ is required +config.check4user + +exec_options=`LANG=C getopt \ + -o s:n:v:t:o:DqrhV \ + --long \ +source:,pck-name:,pck-version:,type:,output:,\ +debug,quiet,colorize,help,version,\ +frontend_opts: \ + -n "$me" -- "$@"` +[ $? = 0 ] || exit 1 + +notify.debug "[ ${0} ${exec_options} ]\n" +eval set -- "$exec_options" + +while :; do + case $1 in + -s|--source) + [ "$2" = "--help" ] && usage 0 + [ "$2" = "-h" ] && usage 0 + pck_tarball=$2; shift + ;; + -n|--pck-name) + pck_name=$2; shift ;; + -v|--pck-version) + shift; pck_version=$1 ;; + -t|--type) + spec_type=$2; shift ;; + -o|--output) + outfile=$2; shift ;; + -D|--debug) + let "verbose = 2" ;; + -q|--quiet) + let "verbose = 0" ;; + -r|--colorize) + let "colorize = 1" ;; + -h|--help) + usage 0 ;; + -V|--version) + version; echo; copying; exit 0 ;; + --) shift; break ;; + *) notify.error $"unrecognized option"" -- \`$1'" ;; + esac + shift +done + +for arg in $@; do + notify.error $"unrecognized option"" -- \`$arg'" +done + +[ "$colorize" = "1" ] && notify.enable_colors + +[ "$perl_Makefile_generator" ] || perl_Makefile_generator="Makefile.PL" + +# specfile.create() +# Parameters: +# $1 : try to create a specfile from this tarball +# $2 : package name +# $3 : package version +# $4 : package tipology (template) +# $5 : output file +# Description: +# Create an initial specfile to help packaging activities +# +function specfile.create() { + notify.debug "[ ${0}${exec_options} ]\n" + + # check if all the needed tools are available + # note: uncompress has been removed from the mandatory list + for tool in \ +chmod find fmt grep mktemp sed sort uniq \ +bunzip2 gunzip unzip; do + [ "$(type -p $tool)" ] || + notify.error $"utility not found"": \`$tool'" + done + + # expand Makefile variables found in string '$1' looking in the + # makefile '$2' and in the main Makefile + # this function expand also configure variables (@var@) + function expand.variables() { + local str="$1" + local am_makefile="$2" + local token var expanded + + notify.debug "str = \"$str\", am_makefile = \"$am_makefile\"" + + # expand the Makefile variables + OIFS="$IFS"; IFS='$' + for token in $str; do + [ "$token" ] || continue + var="`echo "$token" | sed 's,(,,;s,).*,,;s,{,,;s,}.*,,'`" + token="`echo "$token" | sed 's,(,,;s,).*,,;s,}.*,},'`" + unset expanded + [[ -n "$am_makefile" && -e "$am_makefile" ]] && + expanded=`sed -n ":a + /\\\\$/N;s/\\\\\n//;ta + /^[ ]*${var//\//\\/}[ ]*=/{s,.*=[ ]*,,p}" $am_makefile` + if [ "$expanded" ]; then + str="`echo "$str" | \ + sed "s,\\$($var),$expanded,g; + s,\\${$var},$expanded,g"`" + else + # try to find a value looking in the main Makefile + [[ -e $tmpdir/$pck_rootdir/Makefile.in ]] && + expanded=`sed -n ":a + /\\\\$/N;s/\\\\\n//;ta + /^[ ]*${var//\//\\/}[ ]*=/{s,.*=[ ]*,,p}" \ + $tmpdir/$pck_rootdir/Makefile.in` + [[ "$expanded" ]] && str="`echo "$str" | \ + sed "s,\\$($var),$expanded,g; + s,\\${$var},$expanded,g"`" + fi + [[ "$expanded" ]] && + notify.debug "\ + \"$token\" == \"$expanded\" (${am_makefile:-Makefile.in})" || + notify.debug " \"$token\" == " + notify.debug " --> str = \"$str\"" + done + IFS="$OIFS" + + # expand the configure variables + OIFS="$IFS"; IFS='@' + case "$str" in + *@*@*) + if [[ -x $tmpdir/$pck_rootdir/configure ]]; then + for token in ${str%@*}; do + [[ "$token" ]] || continue + notify.debug " token = \"$token\"" + # note: if there are two or more matching lines, + # the first is choosen + local expanded=`sed -n "\ + # concatenate lines with a trailing backslash + /^[ ]*${token//\//\\/}=[^ ]*[ ]*$/{ + s,.*=\([^ ]*\).*,\1,;s,',,g;p;q}" ./configure` + notify.debug " \"$token\" == \"$expanded\"" + # if @$token@ has been found in ./configure + if [[ -n "$expanded" ]]; then + str=`echo "${str/$/\\$}" | \ + sed "s,@$token@,$expanded,"` + notify.debug " --> str = \"$str\"" + fi + done + fi ;; + esac + IFS="$OIFS" + + # try to adjust unresolved variables (best effort) + # i.e. "$(libdir)/pkgconfig" --> "%{_libdir}/pkgconfig" + str=`echo "$str" | sed 's,\${\([^_]\),%{_\1,g;s,\$(,%{_,g;s,),},g'` + notify.debug " --> str = \"$str\"" + echo "$str" + } + + # find informations about available info pages + function specfile.infopages() { + local automake_used=` + [[ ! -e $tmpdir/$pck_rootdir/Makefile.am ]]; echo $?` + + cd $tmpdir/$pck_rootdir && + case $1 in + --exist) + # If the package contains Texinfo source, it will be declared + # with the 'TEXINFOS' primary. + # Generally Texinfo files are converted into info, and thus the + # 'info_TEXINFOS' macro is most commonly used. + # Any Texinfo source file must end in the '.texi', '.txi', or + # '.texinfo' extension ('.texi' is recommended). + # + # e.g. info_TEXINFOS = texinfo.txi info-stnd.texi info.texi + [[ $automake_used -eq 1 ]] && + [[ "\ +`LANG=C find -name Makefile.am -exec grep "info_TEXINFOS[ ]*=" {} \;`" ]] || + [[ "`LANG=C find -type f \ + \( -name '*.texi' -or -name '*.txi' -or -name '*.texinfo' \)`" ]] + echo $((! $?)) ;; + --list) + if [[ $automake_used -eq 0 ]]; then + [[ `specfile.infopages --exist` = 1 ]] && + echo "%{_infodir}/<"$"info-page"">" + else + LANG=C find -name Makefile.am -exec \ + sed -n -e :a -e ' + # if a line ends with a backslash, append... + /\\$/N;s/\\\n//;ta # ...the next line to it + /info_TEXINFOS[ ]*=/p' {} \; | + while read macro skip infopages_list; do + for f in ${infopages_list/\.*/}; do + LANG=C find -name $f\* \ + -exec grep -H "produced by makeinfo" {} \; | + sed "s,.*/\(.*\):.*,%{_infodir}/\1$info_compress_ext," + done + done + fi ;; + *) notify.error $"\ +(bug)"" -- "$"illegal arg#1 for \`$FUNCNAME'" ;; + esac + } + + # find informations about available man pages + function specfile.manpages() { + # find the list of the manpages when automake is used + # output like this: + # MANSRC = pkcs15-crypt.1 pkcs15-init.1 ... + function manpages.am_expand() { + local am_makefile + for am_makefile in `LANG=C find -name Makefile.am -exec \ + grep -rl -m1 -e "MANS[ ]*=" {} \;`; do + sed -n -e :a -e ' + # if a line ends with a backslash, append... + /\\$/N;s/\\\n//;ta # ...the next line to it + /MANS[ ]*=/p' $am_makefile | \ + while read macro skip manpages_list; do + # `manpages_list' can contain Makefile variables + # i.e. man_MANS = $(MANSRC) pkcs15-profile.5 + case "$manpages_list" in + *\$\(*\)*|*\${*}*) + # notify.debug "manpages_list ($am_makefile) = \"$manpages_list\"" + for token in $manpages_list; do + case $token in + \$\(*\)|\${*}) # found variable `$token' + token=`echo $token | sed -n 's,^\$.,,;s,.$,,p'` + sed -n ":a + /\\\\$/N;s/\\\\\n//;ta + /$token[ ]*=/p" $am_makefile ;; + *) # 'plain' manpage (not a variable) + echo "$macro = $token" ;; + esac + done ;; + *) # no Makefile variables has been used + echo "$macro = $manpages_list" ;; + esac + done + done + } + + local automake_used=` + [[ ! -e $tmpdir/$pck_rootdir/Makefile.am ]]; echo $?` + + cd $tmpdir/$pck_rootdir && + case $1 in + --exist) + [ "$automake_used" = 1 ] && + [[ "`LANG=C find -name Makefile.am \ + -exec grep "MANS[ ]*=" {} \;`" ]] || + [[ "`LANG=C find -type f -name "*.[0-9]"`" ]] + echo $((! $?)) ;; + --groups) + if [ "$automake_used" = 0 ]; then + LANG=C find -type f -name "*.[0-9]" | sed 's,.*\(.\),\1,' + else + manpages.am_expand | \ + while read macro equal manpages_list; do + case $macro in + man[0-9]_MANS) + for f in $manpages_list; do + case $f in + *.man) echo $macro | sed "s/man\(.\)_MANS/\1/" ;; + *) echo $f | sed "s/.*\.//" ;; + esac + done ;; + *) for f in $manpages_list; do + echo $f | sed "s/.*\(.\)/\1/" + done ;; + esac + done + fi | sort | uniq ;; + --list) + [[ "$2" ]] || notify.error $"\ +(bug)"" -- "$"missing arg#2 in \`$FUNCNAME $1'" + + # list of man pages in the section '$2' + local manpage + if [ "$automake_used" = 0 ]; then + # FIXME : if a manpage is compressed in the source tarball, + # a double `$man_compress_ext' will be appended + LANG=C find -type f -name "*.$2" \ + -printf "%%{_mandir}/man$2/%f$man_compress_ext\n" + else + manpages.am_expand | \ + while read macro equal manpages_list; do + case $macro in + # sometimes developers prefer to name a man page something + # like 'foo.man' in the source, and then rename it to have + # the correct suffix, e.g. 'foo.1', when installing the file. + # For instance, consider this example: + # man1_MANS = rename.man thesame.1 alsothesame.1c + # In this case, 'rename.man' will be renamed to 'rename.1' + # when installed, but the other files will keep their names. + man[0-9]_MANS) + man_section=`echo $macro | sed "s/man\(.\)_MANS/\1/"` + # only man pages in section '$2' + [[ $man_section = $2 ]] || continue + for f in $manpages_list; do + echo -n "%{_mandir}/man$man_section/" + case $f in + *.man) echo "\ +${f/\.man/.$man_section}$man_compress_ext" ;; + *) echo "$f$man_compress_ext" ;; + esac + done ;; + # Man pages are declared using the 'MANS' primary (generally + # 'man_MANS'). Man pages are installed in the correct + # subdirectory of 'mandir', based on the file extension + # ('0' through '9', and 'l' and 'n'). + *) for f in $manpages_list; do + man_section=`echo $f | sed "s/.*\(.\)/\1/"` + [[ $man_section = $2 ]] || continue + echo "%{_mandir}/man$man_section/$f$man_compress_ext" + done ;; + esac + done | sort | uniq + fi ;; + *) notify.error $"\ +(bug)"" -- "$"illegal arg#1 for \`$FUNCNAME'" ;; + esac + } + + # find informations about available i18n (gettext) files + function specfile.i18n_support() { + case $1 in + --exist) + # note: in the 'tar' tarball there is no 'intl' folder, so we use 'po' + [[ "`LANG=C find $tmpdir/$pck_rootdir/ -type d -name po`" ]] + echo $((! $?)) ;; + *) notify.error $"\ +(bug)"" -- "$"illegal arg#1 for \`$FUNCNAME'" ;; + esac + } + + # find informations about pkgconfig related stuff (*.pc files) + function specfile.pkgconfig() { + local automake_used=` + [[ ! -e $tmpdir/$pck_rootdir/Makefile.am ]]; echo $?` + + cd $tmpdir/$pck_rootdir && + case $1 in + --exist) + if [[ $automake_used -eq 1 ]]; then + [[ `LANG=C find -name Makefile.am \ + -exec grep "pkgconfigdir[ ]*=" {} \;` ]] + echo $((! $?)) + else + [[ `LANG=C find -name Makefile.in -exec grep "\.pc " {} \;` ]] + echo $((! $?)) + fi ;; + --dir) + unset pkgconfigdir + if [[ $automake_used -eq 1 ]]; then + pkgconfigdir=` + LANG=C find -name Makefile.am \ + -exec grep "pkgconfigdir[ ]*=" {} \; | \ + sed 's,pkgconfigdir[ ]*=[ ]*,,' | sort | uniq` + notify.debug "pkgconfigdir = \"$pkgconfigdir\"" + pkgconfigdir="`expand.variables "$pkgconfigdir"`/*.pc" + notify.debug " pkgconfigdir = \"$pkgconfigdir\"" + else + # FIXME : add a check for real path + [[ `$FUNCNAME --exist` -eq 1 ]] && + pkgconfigdir="%{_libdir}/pkgconfig/*.pc" + fi + echo "$pkgconfigdir" ;; + *) notify.error $"\ +(bug)"" -- "$"illegal arg#1 for \`$FUNCNAME'" ;; + esac + } + + # specfile.includedir() + # Parameters: + # $1 : --exist (optional) + # Description: + # Find information about installation directories of *.h files + # + function specfile.includedir() { + local headers include_headers \ + include am_headers_path am_headers_paths \ + automake_used=` + [[ ! -e $tmpdir/$pck_rootdir/Makefile.am ]]; echo $?` + + if [[ $automake_used -eq 1 ]]; then + if [[ "$1" = "--exist" ]]; then + cd $tmpdir/$pck_rootdir && + headers=`LANG=C find . -name Makefile.am -exec \ + grep -rl -e ".*include_HEADERS[ ]*=" {} \;` + [[ -z "$headers" ]]; echo $? + exit + fi + + cd $tmpdir/$pck_rootdir && + case "$spec_type" in + standard | library) + am_headers_paths=() + # found for Makefiles that install header files + # note: ^[^ ]*includedir can be not present + for f in `LANG=C find . -name Makefile.am -exec \ + grep -rl -e "^[^ ]*include_HEADERS[ ]*=" {} \;`; do + # some examples: + # [apt] + # includedir=${prefix}/include/apt-pkg + # include_HEADERS = ... + # --> ${prefix}/include/apt-pkg + # [avifile] + # mainincludedir = $(pkgincludedir) + # maininclude_HEADERS = ... + # --> $(pkgincludedir) --> $(includedir)/@PACKAGE@ + # [a52dec] + # pkginclude_HEADERS = ... + # --> %{_includedir} + # [aspell] + # include_HEADERS = aspell.h + # pspell_includedir = ${includedir}/pspell + # pspell_include_HEADERS = pspell.h + # --> %{_includedir} %{_includedir}/pspell + # [pygtk-2.4.1] + # PLATFORM_VERSION = 2.0 + # pkginclude_HEADERS = pygtk.h + # pkgincludedir = $(includedir)/pygtk-$(PLATFORM_VERSION)/pygtk + # --> %{_includedir}/pygtk-2.0/pygtk + for include_headers in ` + sed -n 's/\(^[^ ]*include_HEADERS\)[ ]*=.*/\1/p' $f`; do + include=`echo $include_headers | \ + sed -n 's/^\([^ ]*\)include_HEADERS[ ]*/\1/p'` + headers=`echo $include_headers | sed -n "\ +s,^${include}includedir[ ]*=[ ]*\([^ ]*\),\1,p" $f` + + notify.debug "include_headers ($f) = \"$include_headers\"" + notify.debug " --> include = \"$include\"" + notify.debug " --> headers = \"$headers\"" + + if [[ "$headers" ]]; then + local newheader=`echo $headers | sed -n ' + s,\$[{(]includedir[)}],%{_includedir}, + s,\$[{(]prefix[)}],%{_prefix},;p'` + # add `newheader' only if not yet in `am_headers_paths' + local alreadyin=0 + for i in `seq 1 1 ${#am_headers_paths[*]}`; do + [[ "${am_headers_paths[$i-1]}" = "$newheader" ]] && + let "alreadyin = 1" && break + done + newheader="`expand.variables $newheader $f`" + [[ $alreadyin -eq 0 ]] && + am_headers_paths[${#am_headers_paths[*]}]=$newheader + else +am_headers_paths[${#am_headers_paths[*]}]="%{_includedir}" #"(needed by KDE editors) + fi + notify.debug " \ +am_headers_paths = \"${am_headers_paths[*]}\"" + done + + done + for i in `seq 1 1 ${#am_headers_paths[*]}`; do + am_headers_path=${am_headers_paths[$i-1]} + notify.debug "am_headers_path[$i] = $am_headers_path" + # check if one or more configure variable are used + case "$am_headers_path" in + *@*@*) + if [[ -x ./configure ]]; then + OIFS="$IFS"; IFS='@' + for token in ${am_headers_path%@*}; do + [[ "$token" ]] || continue + # expand the variables looking into the + # ./configure file + local exp_token=`sed -n "\ +/^[ ]*${token//\//\\/}=[^ ]*[ ]*$/{s,.*=\([^ ]*\).*,\1,;s,',,g;p}" ./configure` + notify.debug " \"$token\" == \"$exp_token\"" + # if @$token@ has been found in ./configure + if [[ -n "$exp_token" ]]; then + am_headers_path=`echo "${am_headers_path/$/\\$}" | \ + sed "s,@$token@,$exp_token,"` + notify.debug "\ + --> am_headers_path[$i] = \"$am_headers_path\"" + fi + done + IFS="$OIFS" + # at this point there should be no directory + # different to '$(includedir)' (hopefully) + am_headers_path=`echo $am_headers_path | \ + sed 's,\${includedir},%{_includedir}, + s,\$(includedir),%{_includedir}, + s,\${prefix},%{_prefix}, + s,\$(prefix),%{_prefix},'` + notify.debug "\ + --> am_headers_path[$i] = \"$am_headers_path\"" + fi + ;; + esac + + [[ "$am_headers_path" =~ / ]] && + am_headers_path="$am_headers_path/*.h" || + am_headers_path="\ +%dir $am_headers_path\n$am_headers_path/*.h" + am_headers_paths[$i-1]="$am_headers_path" + done ;; + python) + : ;; # FIXME + esac + else + # no Makefile.am file found (check in Makefile[.in]) + # FIXME: modify this brainless code + [[ "$spec_type" = "library" ]] && + am_headers_paths=("%{_includedir}/*.h") + fi + # remove duplicate entries + for i in `seq 1 1 ${#am_headers_paths[*]}`; do + echo ${am_headers_paths[$i-1]} + done | sort | uniq + } + + function specfile.devel_exist() { + [[ $(specfile.includedir --exist) -eq 1 || + $(specfile.pkgconfig --exist) -eq 1 ]] && echo 1 || echo 0 + } + + # 1. specfile preamble + function specfile.write_preamble() { + # set package name and version to '%{name}' and '%{version}' +# local pck_tarball_4spec=`echo ${pck_tarball##*/} | +# sed "s,$pck_name,%{name},g;s,$pck_version,%{version},g"` + local pck_tarball_4spec=`echo "${pck_tarball##*/}" | + sed "s,$pck_version,%{version},g"` + + # find for package license info + # FIXME: currently GNU GPL, LGPL, and W3C licenses are supported + local spec_license="$license_defvalue" + + if [[ -e $tmpdir/$pck_rootdir/COPYING ]]; then + [[ `grep -c "[ ]*GNU GENERAL PUBLIC LICENSE[ ]*" \ + $tmpdir/$pck_rootdir/COPYING` -eq 0 ]] || spec_license="GPL" + [[ `grep -c "[ ]*GNU LIBRARY GENERAL PUBLIC LICENSE[ ]*" \ + $tmpdir/$pck_rootdir/COPYING` -eq 0 ]] || spec_license="LGPL" + [[ `grep -c "[ ]*GNU LESSER GENERAL PUBLIC LICENSE[ ]*" \ + $tmpdir/$pck_rootdir/COPYING` -eq 0 ]] || spec_license="LGPL" + [[ `grep -c "Copyright .* World Wide Web Consortium" \ + $tmpdir/$pck_rootdir/COPYING` -eq 0 ]] || spec_license="W3C" + fi + + case $spec_type in + standard) + [ "$spec_source" ] || spec_source=".../$pck_tarball_4spec" + [ -e $tmpdir/$pck_rootdir/CMakeLists.txt ] && spec_buildrequires="cmake" + ;; + library) + [ "$spec_source" ] || spec_source=".../$pck_tarball_4spec" + spec_group="$library_group" + [ -e $tmpdir/$pck_rootdir/CMakeLists.txt ] && spec_buildrequires="cmake" + ;; + perl) + local perl_module_name + if [[ -e $tmpdir/$pck_rootdir/Build.PL ]]; then + notify.debug "$FUNCNAME: -e Build.PL" + # new building/installing technology + perl_module_name=$( + sed -n "/^[ \t]*module_name[ ]*/{ + s,.*=>[ ]*['\"]\(.*\)['\"].*,\1,;p + }" $tmpdir/$pck_rootdir/Build.PL) + local Build_PL_license + Build_PL_license=$( + sed -n "/^[ \t]*license[ ]*/{ + s,.*=>[ ]*['\"]\(.*\)['\"].*,\1,;p + }" $tmpdir/$pck_rootdir/Build.PL) + notify.debug "Build_PL_license = \"$Build_PL_license\"" + # see manpage of "Module::Build" + case "$Build_PL_license" in + perl) + spec_license="GPL, Artistic" ;; + gpl) + spec_license="GPL" ;; + lgpl) + spec_license="LGPL" ;; + artistic) + spec_license="Artistic" ;; + bsd) + spec_license="BSD License" ;; + open_source) + spec_license="OSI Approved" ;; + unrestricted) + # The distribution is licensed under a license that is not + # approved by www.opensource.org but that allows distribution + # without restrictions + spec_license="no OSI Approved" ;; + restricted) + # The distribution may not be redistributed without special + # permission from the author and/or copyright holder + spec_license="no OSI Approved" ;; + *) spec_license="$perl_License_default" ;; + esac + elif [[ -e $tmpdir/$pck_rootdir/$perl_Makefile_generator ]]; then + notify.debug "$FUNCNAME: -e $perl_Makefile_generator" + # look in the Makefile.PL file for the variable `NAME' in the + # block 'WriteMakefile(' ... ')' + perl_module_name=$( + sed -n "/^WriteMakefile(/,/^)/{ + /^[ \t]*NAME/{s,.*NAME.*=>[ ]*['\"]\(.*\)['\"]\,.*,\1,p + }}" $tmpdir/$pck_rootdir/$perl_Makefile_generator) + [ "$perl_module_name" ] || perl_module_name=$( + sed -n "\ +/name/{s,^[ \t]*name[ \t]*['\"]*\([a-zA-Z]*\)['\"]*.*,\1,p}" \ + $tmpdir/$pck_rootdir/$perl_Makefile_generator) + spec_license="$perl_License_default" + else + notify.error "\ +neither \`$perl_Makefile_generator' nor \`Build.PL' file found" + fi + notify.debug "perl_module_name = \"$perl_module_name\"" + + [ -n "$perl_module_name" ] && + spec_summary="$perl_module_name - $summary_defvalue" || + spec_summary="... - $summary_defvalue" + notify.debug "spec_summary = \"$spec_summary\"" + spec_group="$library_group_perl" + + [ "$spec_source" ] || + if [ "$perl_module_name" ]; then + spec_source="\ +http://www.cpan.org/modules/by-module/${perl_module_name//::/\/}/$pck_tarball_4spec" + else + spec_source="\ +http://www.cpan.org/modules/by-module/.../$pck_tarball_4spec" + fi + + spec_url="http://www.cpan.org" + spec_buildrequires="perl-devel >= %perl_major_ver" + spec_requires='perl >= %perl_major_ver' + #spec_buildroot='%{_tmppath}/perl-root # fixed in perl-5.8.6-3qilnx + ;; + python) + # check if `setup.py' exists + [[ -e $tmpdir/$pck_rootdir/setup.py ]] || + notify.error "\`setup.py': "$"file not found" + + spec_group="$python_modules_group" + spec_summary="$(\ +cd $tmpdir/$pck_rootdir && python setup.py --description 2>/dev/null | \ +sed 1q 2>/dev/null)" + spec_url="$(\ +cd $tmpdir/$pck_rootdir && python setup.py --url 2>/dev/null | \ +sed 1q 2>/dev/null)" + [ "$spec_source" ] || spec_source=".../$pck_tarball_4spec" + spec_license="$(\ +cd $tmpdir/$pck_rootdir && python setup.py --license 2>/dev/null | \ +sed 1q 2>/dev/null)" + [[ "$spec_license" = UNKNOWN ]] && spec_license="$license_defvalue" + spec_requires="python${rpm_macro_pyver:+ >= $rpm_macro_pyver}" + ;; + esac + + local spec_source_4spec=`echo "$spec_source" | + sed "s,$pck_version,%{version},g"` + + [[ "$spec_type" = perl ]] && echo "\ +%define perl_major_ver %(eval \`perl -V:version\`; echo \${version%*.[0-9]*}.0) +" + + (echo "\ +Name: $pck_name +Version: $pck_version +Release: 1$DISTRO_rpm +Summary: ${spec_summary:-$summary_defvalue} +Group: ${spec_group:-$group_defvalue} +Vendor: $VENDOR +Distribution: $DISTRO +Packager: $packager_fullname <$packager_email> +URL: ${spec_url:-$url_defvalue} +Source: ${spec_source_4spec:-$pck_tarball_4spec} +License: ${spec_license:-$license_defvalue}" +if [ "$(specfile.infopages --exist)" = 1 ]; then + [ "$rpm_macro_installinfo_binary" ] && + echo "Requires(post): ${rpm_macro_installinfo_binary}" || + echo "Requires(post): ${path_installinfo:-/sbin/install-info}" +fi +[ "$spec_requires" ] && echo Requires: $spec_requires +[ "$spec_buildrequires" ] && echo BuildRequires: $spec_buildrequires + echo "\ +BuildRoot: ${spec_buildroot:-"$format_buildroot_value"}") | \ + while read id value; do + printf "%-${format_preamble_tab:-14}s %s\n" "$id" "$value" + done + } + + # 2. specfile package(s) description + function specfile.write_packages() { + case $spec_type in + python) + echo " +%description +${spec_summary:-$summary_defvalue}." ;; + *) echo " +%description +$description_defval" ;; + esac + + case "$spec_type" in + standard) + [[ `specfile.includedir --exist` -eq 1 || + `specfile.pkgconfig --exist` -eq 1 ]] && + echo " +%package devel +Summary: Devel package for %{name} +Group: Development/Libraries +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description devel +$description_devel_defval + +This package contains static libraries and header files need for development." + ;; + library) + echo " +%package devel +Group: $library_group_devel +Summary: $library_summary +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description devel +$description_devel_defval + +This package contains static libraries and header files need for development." + ;; + python) + : # FIXME + ;; + esac + } + + # 3. %setup + function specfile.write_setup() { + echo " +%prep" + if [ "$pck_rootdir_4spec" = "%{name}-%{version}" ]; then + echo "%setup -q" + elif [ "$pck_rootdir_4spec" = "-c %{name}-%{version}" ]; then + echo "%setup -q $pck_rootdir_4spec" + else + echo "%setup -q -n $pck_rootdir_4spec" + fi + } + + # 4. %build + function specfile.write_build() { + local pck_configure=`(\ + cd $tmpdir/$pck_rootdir && + { [[ -x ./configure ]] && echo -n "./configure" + LANG=C find . -mindepth 2 -type f -perm +111 \ + -name configure -printf "%p "; } )` + notify.debug "pck_configure = \"$pck_configure\"" + + local make_bin perl_bin + if [ "$format_unix_tools" = "1" ]; then + make_bin="%{__make}"; perl_bin="%{__perl}" + else + make_bin="make"; perl_bin="perl" + fi + + echo " +%build" + case $spec_type in + standard | library) + # if `configure' exists, write the needed specfile commands + if [[ -n "$rpm_macro_configure" && \ + "$pck_configure" = "./configure" ]]; then + echo "$rpm_macro_configure" + elif [[ "$pck_configure" ]]; then + # writes also the other `configure' executable scripts found + # in the source package as a comment + echo -n "${pck_configure/ */} \\" + [[ "$pck_configure" =~ ' ' ]] && + echo -n " # -or- ${pck_configure#* }" + echo -n " + --prefix=%{_prefix}" +[[ `specfile.infopages --exist` = 1 ]] && echo -n "\ + \\ + --infodir=%{_infodir}" +[[ `specfile.manpages --exist` = 1 ]] && echo "\ + \\ + --mandir=%{_mandir}" || echo "" + echo "" + elif [ -e $tmpdir/$pck_rootdir/CMakeLists.txt ]; then + if [ "$rpm_macro_cmake" ]; then + echo "$rpm_macro_cmake" + else + echo "\ +CFLAGS=\"${CFLAGS:-%optflags}\" ; export CFLAGS +CXXFLAGS=\"${CXXFLAGS:-%optflags}\" ; export CXXFLAGS +FFLAGS=\"${FFLAGS:-%optflags}\" ; export FFLAGS +mkdir -p build ; cd build +cmake \\ + -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\ + -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\ + -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\ + -DLIB_INSTALL_DIR:PATH=%{_libdir} \\ + -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\ + -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \\ +%if "%{?_lib}" == \"lib64\" + -DLIB_SUFFIX=64 \\ +%endif + -DBUILD_SHARED_LIBS:BOOL=ON .. +" + fi + [ -n "$rpm_macro_make" ] && + echo "%make" || echo "$make_bin %{?_smp_mflags}" + fi + [[ "$makefile" ]] && + { [[ "$rpm_macro_make" ]] && + echo "%make" || echo "$make_bin %{?_smp_mflags}"; } + ;; + perl) + if [[ -e $tmpdir/$pck_rootdir/Build.PL ]]; then + echo "\ +$perl_bin Build.PL installdirs=vendor +./Build +./Build test" + elif [[ -e $tmpdir/$pck_rootdir/$perl_Makefile_generator ]]; then + echo "\ +$perl_bin $perl_Makefile_generator PREFIX=%{_prefix} INSTALLDIRS=vendor" + if [[ "$rpm_macro_make" ]]; then + echo "\ +%make +%make test" + else + echo "\ +$make_bin %{?_smp_mflags} +$make_bin test" + fi + fi + ;; + python) + [[ "$(find $tmpdir/$pck_rootdir -type f -name *.c)" ]] && + echo "CFLAGS=\"%{optflags}\" %{__python} setup.py build" || + echo "%{__python} setup.py build" ;; + esac + } + + # 5. %install + function specfile.write_install() { + local make_bin perl_bin + if [ "$format_unix_tools" = "1" ]; then + make_bin="%{__make}"; rm_bin="%{__rm}" + else + make_bin="make"; rm_bin="rm" + fi + + # look at the prefix variable used in makefiles ('DESTDIR' or 'prefix') + local makeinstall_cmd + if [ -e $tmpdir/$pck_rootdir/CMakeLists.txt ]; then + [ -n "$rpm_macro_makeinstall_cmake" ] && + makeinstall_cmd="$rpm_macro_makeinstall_cmake" || + makeinstall_cmd="$make_bin install DESTDIR=\"%{buildroot}\" #-C build" + elif [ -n "$makefile" ]; then + if [[ "`grep -c "DESTDIR[ ]*=[ ]*" $makefile`" ]]; then + [[ "$rpm_macro_makeinstall" ]] && + makeinstall_cmd="%makeinstall" || + makeinstall_cmd="$make_bin install DESTDIR=\"%{buildroot}\"" + elif [[ "`grep -c "prefix[ ]*=[ ]*" $makefile`" ]]; then + if [[ "$rpm_macro_makeoldinstall" ]]; then + makeinstall_cmd="%makeoldinstall" + elif [[ "$rpm_macro_makeinstall" ]]; then + makeinstall_cmd="%makeinstall" + else + makeinstall_cmd="$make_bin prefix=\"%{buildroot}\"" + fi + else + notify.warning "neither \`DESTDIR' nor \`prefix' variables found" + fi + fi + + echo " +%install +[ \"%{buildroot}\" != / ] && $rm_bin -rf \"%{buildroot}\"" + + case $spec_type in + standard | library) + [ "$makeinstall_cmd" ] && echo "$makeinstall_cmd" + [[ "$(specfile.i18n_support --exist)" = "1" ]] && echo " +%find_lang %{name}" + ;; + perl) + if [ -e $tmpdir/$pck_rootdir/Build.PL ]; then + echo "\ +./Build install \\ + destdir=\"%{buildroot}\" \\ + --install_path bindoc=\"%{_mandir}/man1\" \\ + --install_path libdoc=\"%{_mandir}/man3\" + +packlist=\`find %{buildroot} -name .packlist\` +[ -z \"\$packlist\" ] && exit 1 || cat \$packlist | \\ + sed \"s,%buildroot,,g;s,.*/man/.*,&.gz,g\" | \\ + sort -u > .packlist && rm \$packlist + +find %{buildroot}%{perl_vendorlib} \\ + -type d -depth -exec rmdir {} 2>/dev/null \\; + +strid=\`echo \$packlist | sed 's,.*auto\(.*\)/.packlist,\1,'\` +for dir in \`find %{buildroot} -type d | grep \$strid\`; do + echo "%dir \${dir#%buildroot}" >> .packlist +done" + else + echo "\ +%makeinstall_perl +packlist=\`find %{buildroot} -name .packlist\` +[ -z \"\$packlist\" ] && exit 1 || cat \$packlist | \\ + sed \"s,%buildroot,,g;s,.*/man/.*,&.gz,g\" | \\ + sort -u > .packlist && rm \$packlist + +strid=\`echo \$packlist | sed 's,.*auto\(.*\)/.packlist,\1,'\` +for dir in \`find %{buildroot} -type d | grep \$strid\`; do + echo \"%dir \${dir#%buildroot}\" >> .packlist +done" + fi + ;; + python) + echo "\ +%{__python} setup.py install \\ + -O1 --skip-build \\ + --root=\"%{buildroot}\" \\ + --install-headers=%{_includedir}/python \\ + --install-lib=${python_install_lib_path:-%_libdir/site-python} \\ + --single-version-externally-managed \\ + --record=%{name}.filelist + +sed -i \"\,\.egg-info/,d;s,.*/man/.*,&.gz,\" %{name}.filelist" + ;; + esac + } + + # 6. %clean + function specfile.write_clean() { + if [ "$format_unix_tools" = "1" ]; then + echo " +%clean +[ \"%{buildroot}\" != / ] && %{__rm} -rf \"%{buildroot}\"" + else + echo " +%clean +[ \"%{buildroot}\" != / ] && rm -rf \"%{buildroot}\"" + fi + + if [ "$spec_type" = "perl" ]; then + [ "$format_unix_tools" = "1" ] && + echo "%{__rm} -f .packlist" || echo "rm -f .packlist" + fi + } + + # 7. specfile scripts + function specfile.write_scripts() { + if [[ $(specfile.infopages --exist) = 1 ]]; then + local infofile + echo " +%post" + + # FIXME : , -1, -2: install only the first one + for infofile in $(specfile.infopages --list); do + if [[ "$rpm_macro_installinfo" ]]; then + # %{_infodir}/foo.info.gz --> foo.info + infofile="$(\ +echo "$infofile" | sed "s,.*/,,;s,$info_compress_ext\$,,")" + echo "$rpm_macro_installinfo $infofile" + else + echo "\ +if [ \"\$1\" = \"0\" ]; then + ${path_installinfo:-/sbin/install-info} $infofile %{_infodir}/dir +fi" + fi + done + [[ "$spec_type" = library ]] && + echo "${path_ldconfig:-/sbin/ldconfig}" + + echo "exit 0" + echo " +%preun" + # FIXME : , -1, -2: install only the first one + for infofile in $(specfile.infopages --list); do + if [[ "$rpm_macro_uninstallinfo" ]]; then + infofile="$(\ +echo "$infofile" | sed "s,.*/,,;s,$info_compress_ext\$,,")" + echo "$rpm_macro_uninstallinfo $infofile" + else + echo "\ +${path_installinfo:-/sbin/install-info} --delete $infofile %{_infodir}/dir" + fi + done + [[ "$spec_type" = library ]] && + echo "${path_ldconfig:-/sbin/ldconfig}" + echo "exit 0" + else + [[ "$spec_type" = library ]] && echo " +%post -p ${path_ldconfig:-/sbin/ldconfig} +%postun -p ${path_ldconfig:-/sbin/ldconfig}" + fi + } + + # 8. %files + function specfile.write_files() { + # standard text documentation files (see 'automake --help') + # + some other documentation files found in some packages + # NOTE : the 'INSTALL' file may eventually be added + local docs std_docs=' + AUTHORS + BACKLOG + BUGS + CHANGES + COPYING + COPYING.DOC + COPYING.LESSER + COPYING.LIB + CREDITS + ChangeLog* + LICENCE + LICENSE + MANUAL + NEWS + README* + THANKS + TODO + WHATSNEW + WHERE' + + # do not add the generic GNU INSTALL in the list of docs + [ -f "$tmpdir/$pck_rootdir/INSTALL" ] && + case $(sed 5q $tmpdir/$pck_rootdir/INSTALL) in + *"These are generic installation instructions."*) + std_docs=$(echo $std_docs | sed 's/INSTALL //') ;; + *) : ;; + esac + + local docs_curr doc_curr + for std_doc in $std_docs; do + # `ls' if used to support strings like `ChangeLog*' + docs_curr=$(cd $tmpdir/$pck_rootdir && ls $std_doc 2>/dev/null) + for doc_curr in $docs_curr; do + # ignore empty documentation files + [[ -s $tmpdir/$pck_rootdir/$doc_curr ]] && docs="$docs $doc_curr" + done + done + # split the list of docs into multiple lines if necessary + [ "$docs" ] && docs=`echo $docs | fmt -u -w 77 | sed 's,.*,%doc &,'` + + # info pages + infos=` + case $info_condensed_list in + 0) specfile.infopages --list | sort ;; + 1) echo "%{_infodir}/*" ;; + *) notify.error "\ +"$"(bug)"" -- $FUNCNAME: "$"illegal value for"" 'info_condensed_list' \ +($info_condensed_list)" ;; + esac` + + # man pages + mans=` + case $man_condensed_list in + 0) for man_group in $(specfile.manpages --groups); do + specfile.manpages --list $man_group | sort + done ;; + 1) for man_group in $(specfile.manpages --groups); do + echo "%{_mandir}/man${man_group}/*" + done ;; + 2) [[ $(specfile.manpages --exist) = 1 ]] && + echo "%{_mandir}/man?/*" ;; + *) notify.error "\ +"$"(bug)"" -- $FUNCNAME: "$"illegal value for"" 'man_condensed_list' \ +($man_condensed_list)" ;; + esac` + + case $spec_type in + standard) + [[ `specfile.i18n_support --exist` = 1 ]] && + echo -e "\n%files -f %{name}.lang" || echo -e "\n%files" + + echo "\ +%defattr(-,root,root)" +# find for i18n files +#[[ "$i18n_found" ]] && echo "%{_datadir}/locale/*/LC_MESSAGES/*" +# package documentation +for doc in infos mans docs; do + [[ "${!doc}" ]] && echo -e "${!doc}" +done + + if [[ `specfile.devel_exist` -eq 1 ]]; then + echo " +%files devel +%defattr(-,root,root)" + [[ `specfile.includedir --exist` -eq 1 ]] && + echo -e "`specfile.includedir --dir`" + [[ `specfile.pkgconfig --exist` -eq 1 ]] && + echo "`specfile.pkgconfig --dir`" + fi + ;; + library) + [[ `specfile.i18n_support --exist` = 1 ]] && + echo -e "\n%files -f %{name}.lang" || echo -e "\n%files" + + echo "\ +%defattr(-,root,root) +%{_libdir}/*.so.*" +# package documentation +for doc in infos mans docs; do + [[ "${!doc}" ]] && echo -e "${!doc}" +done + +echo -e " +%files devel +%defattr(-,root,root) +$(specfile.includedir) +%{_libdir}/*.a +%{_libdir}/*.la +%{_libdir}/*.so" +[[ `specfile.pkgconfig --exist` = 1 ]] && echo "`specfile.pkgconfig --dir`" + ;; + perl) + echo " +%files -f .packlist +%defattr(-,root,root)" + ;; + python) + echo " +%files -f %{name}.filelist +%defattr(-,root,root)" + ;; + esac + } + + # 9. %changelog + function specfile.write_changelog() { + echo " +%changelog +* `LC_ALL="C" date "+%a %b %d %Y"` $packager_fullname <$packager_email> $pck_version-1$DISTRO_rpm +- package created by @package@" + } + + function specfile.ckeck_defvalues() { + # $1: name of the specfile + local specfile="$1" + + check_vals=( + "Summary" summary_defvalue + "Group" group_defvalue + "URL" url_defvalue + "License" license_defvalue + "%description" description_defval + "%description devel" description_devel_defval + "%changelog" changelog_samever_defvalue + ) + + for i in `seq 1 1 $(( ${#check_vals[@]} / 2 ))`; do + id="${check_vals[($i-1)*2]}" + value="${check_vals[($i-1)*2+1]}" + case "$id" in + # for the id starting by '%' we must consider the first two lines + # after its line number (three lines from the id and the first + # blank line found) + %*) sed -n "/^$id$/,/^$/p" $specfile | sed 3q | \ + grep -q "${!value}" ;; + *) sed -n "/%description/q;{/^$id/p}" $specfile | \ + grep -q "${!value}" ;; + esac + [ $? -eq 0 ] && notify.warning $"\ +remember to modify the value for \`${NOTE}$id${NORM}'" + done + } + + local spec_source \ + spec_group \ + spec_url \ + spec_buildrequires \ + spec_requires \ + spec_buildroot + + local spec_type="$1" + case $spec_type in + standard|library|perl|python) ;; + gnome|kde3|kde4|librarytools) + notify.error \ +$"FIXME: sorry, not implemented yet..."" "$"(see $templatedir)" ;; + *) notify.error $"unknown specfile --type"" \`$spec_type'" ;; + esac + + # collect informations from the tarball name and the source files + # 1. pck_tarball, pck_name , pck_version + # 2. pck_rootdir (where the package has been decompressed) --> pck_rootdir_4spec + # 3. specfile.write_preamble() + # spec_license (default:"$license_defvalue") + # spec_buildrequires + # perl_module_name + # spec_summary + # spec_group + # spec_source + # spec_url + # spec_buildrequires + # spec_requires + + # 'pck_tarball' = absolute path of '$1' + local pck_tarball + case "$2" in + http://*|https://*|ftp://*) + pck_tarball="${2##*/}" + spec_source="$2" + + curl.download \ +--options "$curl_options" \ +${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ +--exit-on-err --destdir="$source_dir" "$spec_source" + + pck_tarball=$source_dir/$pck_tarball + ;; + *://*) + notify.error $"unsupported protocol"": \`${2//\:*}'" + ;; + /*) pck_tarball="$2" ;; + *) pck_tarball="$(pwd)/$2" ;; + esac + notify.debug "pck_tarball = $pck_tarball" + notify.debug "spec_source = $spec_source" + + [ "$pck_tarball" ] || notify.error $"missing tarball name" + + [ -e $pck_tarball ] || + notify.error $"cannot find the package $pck_tarball" + + # get the package name from the tarball name + local pck_name=${3:-`echo $2 | sed -n "\ + s/.*\/// # remove directory name, if any + s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) + /-[0-9]*/{s/-[0-9].*//p;q} # - + /[^-\.][0-9]\./{s/\(.*[^-\.]\)[0-9]\..*/\1/p;q} # + # (no version, but can end with numbers) + /^[^0-9]*[0-9]*$/p"`} + notify.debug "pck_name = \"$pck_name\"" + [ "$pck_name" ] || + notify.error $"cannot get the package name, use the \`-n' option" + + [[ "${pck_newver//[0-9\.]/}" ]] && + notify.error $"invalid version number"" -- \`$pck_newver'" + + local pck_version=${4:-`echo $2 | sed -n "\ + /[0-9]/!q # return nothing if no number is found in the package name + s,.*/,, # remove directory name, if any + s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) + /-[0-9]*/{s/.*-\([0-9]*.*\)/\1/p;q} # - + /[^-\.][0-9]\./{s/.*[^-\.]\([0-9]\..*\)/\1/p;q} # + # (no version, but can end with numbers) + /^[^0-9]*[0-9]*$/q"`} + notify.debug "pck_version = \"$pck_version\"" + [ "$pck_version" ] || + notify.error $"cannot get the package version, use the \`-v' option" + + local outfile="$5" + if [ "$outfile" ]; then + notify.debug $"output file"": ${NOTE}$outfile${NORM}" + > $outfile || notify.error $"can't create output file"" $outfile" + # do not chmod a non-regular file (for instance /dev/null) + [ -f "$outfile" ] && chmod ${rpm_specfile_mode:-644} $outfile + fi + + notify.note "${NOTE}"$"generating specfile""${NORM}""..."" + * "$"source"": ${NOTE}$pck_tarball${NORM}"" + * "$"mode"": ${NOTE}$spec_type${NORM}" + + # check the name structure of the library and perl packages + case $spec_type in + library) + [[ "$pck_name" =~ $library_name_structure ]] || notify.error $"\ +libraries must have this name structure (use \`-n'):"" \ +\`$library_name_structure'" + ;; + perl) + [[ "$pck_name" =~ $perl_module_name_structure ]] || notify.error $"\ +perl modules must have this name structure (use \`-n'):"" \ +\`$perl_module_name_structure'" + ;; + python) + [[ "$pck_name" =~ $python_module_name_structure ]] || notify.error $"\ +python modules must have this name structure (use \`-n'):"" \ +\`$python_module_name_structure'" + ;; + esac + + # link fd#3 with stdout and redirect stdout to the log file + [ "$outfile" ] && { exec 3<&1; exec 1>>$outfile; } + + local tmpdir=`mktemp -q -d -t $me.XXXXXXXX` + [ $? -eq 0 ] || + notify.error $"can't create temporary directory" + + # decompress the tarball in the 'tmpdir' directory + cp -f $pck_tarball $tmpdir + pushd $tmpdir >/dev/null + case $pck_tarball in + *.tar.gz|*.tgz) + gunzip -c $pck_tarball | tar xf - ;; + *.tar.bz2|*.tbz2) + bunzip2 -c $pck_tarball | tar xf - ;; + *.tar.Z) + [ "$(type -p uncompress)" ] || + notify.error $"utility not found"": \`uncompress'" + uncompress -c $pck_tarball | tar xf - ;; + *.shar.gz) + gunzip -c $pck_tarball | unshar ;; + *.zip) + unzip -q $pck_tarball ;; + *.tar.xz|*.tar.lzma) + [ "$(type -p xz)" ] || + notify.error $"utility not found"": \`xz'" + xz -d --stdout $pck_tarball | tar xf - ;; + *.tar.lz) + [ "$(type -p lzip)" ] || + notify.error $"utility not found"": \`lzip'" + lzip -cd $pck_tarball | tar -xf - ;; + *.tar.7z) + [ "$(type -p 7za)" ] || + notify.error $"utility not found"": \`7za'" + 7za x -bd $pck_tarball >/dev/null | tar xf - ;; + *.7z) + [ "$(type -p 7za)" ] || + notify.error $"utility not found"": \`7za'" + 7za x -bd $pck_tarball >/dev/null ;; + *) notify.error $"unsupported package compression method" ;; + esac + popd >/dev/null + + # find the root directory of the uncompressed tarball + local pck_rootdir=`\ + LANG=C find $tmpdir -mindepth 1 -maxdepth 1 -type d -printf "%f"` + + local pck_rootdir_4spec + + # hack for packages without a root directory + notify.debug "pck_rootdir = \"$pck_rootdir\"" + if [ ! -d "$tmpdir/$pck_rootdir" ]; then + pck_rootdir="" + pck_rootdir_4spec="-c %{name}-%{version}" + else + pck_rootdir_4spec=`echo $pck_rootdir | \ + sed "s/$pck_name/%{name}/;s/$pck_version/%{version}/"` + fi + notify.debug "pck_rootdir = \"$pck_rootdir\"" + notify.debug "pck_rootdir_4spec = \"$pck_rootdir_4spec\"" + + ############ BEGIN FIXME: move code to a better place ############ + # check if a makefile exists + local makefile + for f in $tmpdir/$pck_rootdir/{Makefile,Makefile.in}; do + [[ -e $f ]] && makefile=$f + done + case "$spec_type" in + # note: perl packages usually use the perl script Makefile.PL + # python modules don't use Makefiles at all + perl | python) : ;; + *) if [ -e $tmpdir/$pck_rootdir/CMakeLists.txt ]; then + : + elif [ -z "$makefile" ]; then + notify.warning $"\ +neither \`Makefile' nor \`Makefile.in' has been found" + fi + [[ -e $tmpdir/$pck_rootdir/$perl_Makefile_generator || + -e $tmpdir/$pck_rootdir/Build.PL ]] && + notify.warning $"\ +looks like a perl package (use \`-t perl' if this is true)" + [[ -e $tmpdir/$pck_rootdir/setup.py ]] && + notify.warning $"\ +looks like a python module (use \`-t python' if this is true)" + ;; + esac + ############ END FIXME: move code to a better place ############## + + # write the resulting specfile + + specfile.write_preamble + specfile.write_packages + specfile.write_setup + specfile.write_build + specfile.write_install + specfile.write_clean + specfile.write_scripts + specfile.write_files + specfile.write_changelog + + [[ "$outfile" ]] && specfile.ckeck_defvalues "$outfile" + + rm -fr $tmpdir + if [[ "$outfile" ]]; then + exec 1<&3 3<&- # restore stdout and close fd#3 + [[ -f $outfile ]] && + notify.note $"created specfile"": \`${NOTE}$outfile${NORM}'" + fi +} + +specfile.create \ + "$spec_type" "$pck_tarball" "$pck_name" "$pck_version" "$outfile" diff --git a/plugins/spec-create.in b/plugins/spec-create.in new file mode 100644 index 0000000..13ccb31 --- /dev/null +++ b/plugins/spec-create.in @@ -0,0 +1,770 @@ +#!/bin/bash +# pck-create -- plugin for @package@ +# Copyright (C) 2004-2011 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 3 ] && + { echo $"this script requires bash version 3 or better" >&2 && exit 1; } + +me=(${0##*/} "@version@" "@date@") + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } +. @libdir@/libmsgmng.lib + +[ -r @libdir@/libnetwork.lib ] || + { echo "$me: "$"library not found"": @libdir@/libnetwork.lib" 1>&2 + exit 1; } +. @libdir@/libnetwork.lib + +# set default variables +# colorized output (disabled by default) +let "colorize = 0" +# output verbosity +let "verbose = 1" + +spec_type=standard +spec_first_release=1 +spec_run_ldconfig="/sbin/ldconfig" +spec_changelog_date="$(LC_ALL="C" date "+%a %b %d %Y")" +spec_changelog_comment="package created by @package@" + +spec_default_summary="..." +spec_default_group="..." +spec_default_url="..." +spec_default_license="..." +spec_default_source="..." +spec_default_description="..." +spec_default_description_devel="..." +spec_setup_macro= + +spec_cmd_configure_autotools="%configure" +spec_cmd_make_autotools="%make" +spec_cmd_makeinstall_autotools="%makeinstall" + +spec_cmd_configure_cmake="%cmake -d build" +spec_cmd_make_cmake="%make" +spec_cmd_makeinstall_cmake="%makeinstall -C build" + +spec_cmd_configure_default="" +spec_cmd_make_default="" +spec_cmd_makeinstall_default="" + +[ "$perl_Makefile_generator" ] || perl_Makefile_generator="Makefile.PL" + +# load the configuration file(s) +[ -r @libdir@/libcfg.lib ] || + { echo "$me: "$"library not found"": @libdir@/libcfg.lib" 1>&2 + exit 1; } +. @libdir@/libcfg.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="${me[0]}"; export TEXTDOMAIN + +function copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function version() { + echo "\ +${me[0]} ${me[1]} +Copyright (C) 2004-2011 Davide Madrisan " +} + +# $1: optional exit code (default is '1') +function usage() { + version + echo "\ +"$"Try to create a specfile for the specified source archive"". + +"$"Usage"": + @frontend@ -s [-n ] [-v ] [-t ] [-o ] + +"$"where the above options mean"": + -s, --source "$"Try to create a specfile for the specified source archive"" + -n, --pck-name "$"Name of the package (default: taken from name)"" + -v, --pck-version "$"Version of the package (default: taken from name)"" + -t, --type "$"Typology of the specfile to be created"" + standard : "$"standard specfile (default)"" + gnome : "$"specfile for gnome packages"" + kde3 : "$"specfile for kde3 packages"" + kde4 : "$"specfile for kde4 packages"" + library : "$"specfile for common library packages"" + perl : "$"specfile for single-package perl modules"" + python : "$"specfile for python modules"" + standard-daemon : "$"standard specfile for system/network services"" + -o, --output "$"Redirect the output to the file "" + +"$"Operation modes"": + -h, --help "$"Print this help, then exit"" + -V, --version "$"Print version number, then exit"" + -q, --quiet "$"Run in quiet mode"" + -r, --colorize "$"Enable the colorized output"" + -D, --debug "$"Run in debugging mode (very verbose output)"" + +"$"Samples"": + @frontend@ -s ~/software/@package@-@version@.tar.bz2 -t standard -o @package@.spec + @frontend@ -s http://ftp.qilinux.it/devel/tools/@package@/@package@-@version@.tar.bz2 + +"$"Report bugs to ." + + exit ${1:-1} +} + +case $1 in + --autospec-args-file*) + if [[ "$1" =~ = ]]; then + argsfile=`echo $1 | sed 's/^--autospec-args-file=//'` + else + argsfile=$2 + fi + [ -r "$argsfile" ] || notify.error $"cannot read"": \`$argsfile'" + . $argsfile && rm -f $argsfile + ;; +esac + +for arg in $@; do + case $arg in + -h|--help) usage 0 ;; + -V|--version) version; echo; copying; exit 0 ;; + esac +done + +# the user configuration file for @package@ is required +config.check4user + +exec_options=`LANG=C getopt \ + -o s:n:v:t:o:DqrhV \ + --long \ +source:,pck-name:,pck-version:,type:,output:,\ +debug,quiet,colorize,help,version,\ +frontend_opts: \ + -n "$me" -- "$@"` +[ $? = 0 ] || exit 1 + +notify.debug "[ ${0} ${exec_options} ]\n" +eval set -- "$exec_options" + +while :; do + case $1 in + -s|--source) + [ "$2" = "--help" ] && usage 0 + [ "$2" = "-h" ] && usage 0 + pck_tarball=$2; shift + ;; + -n|--pck-name) + pck_name=$2; shift ;; + -v|--pck-version) + shift; pck_version=$1 ;; + -t|--type) + spec_type=$2; shift ;; + -o|--output) + outfile=$2; shift ;; + -D|--debug) + let "verbose = 2" ;; + -q|--quiet) + let "verbose = 0" ;; + -r|--colorize) + let "colorize = 1" ;; + -h|--help) + usage 0 ;; + -V|--version) + version; echo; copying; exit 0 ;; + --) shift; break ;; + *) notify.error $"unrecognized option"" -- \`$1'" ;; + esac + shift +done + +for arg in $@; do + notify.error $"unrecognized option"" -- \`$arg'" +done + +[ "$colorize" = "1" ] && notify.enable_colors + +function specfile.ckeck_defvalues() { + # $1: name of the specfile + local specfile="$1" currvalue + + check_values=( + "Summary" spec_default_summary + "Group" spec_default_group + "URL" spec_default_url + "Source" spec_default_source + "License" spec_default_license + "%description" spec_default_description + "%description devel" spec_default_description_devel + ) + + for i in `seq 1 1 $(( ${#check_values[@]} / 2 ))`; do + id="${check_values[($i-1)*2]}" + value="${check_values[($i-1)*2+1]}" + case "$id" in + # when id begins by a '%' character, the two lines below the id must + # be taken into account (three lines: the line containing the id, the + # following one and the following (blank) line) + %*) sed -n "/^$id$/,/^$/p" $specfile | sed 3q | grep -q "${!value}" + [ $? -eq 0 ] && notify.warning $"\ +remember to modify the value for \`${NOTE}$id${NORM}'" ;; + *) currvalue="\ +$(sed -n "/%description/q;{/^[ \t]*$id[ \t]*:[ \t]*/{s,.*:[ \t]*,,p}}" $specfile)" +notify.debug "[[ \"$currvalue\" =~ \"${!value}\" ]]" + [[ "$currvalue" =~ "${!value}" ]] && notify.warning $"\ +remember to modify the value for \`${NOTE}$id${NORM}'" ;; + esac + done +} + +function template.expand() { + local OPTIONS=`LANG=C getopt \ + -o t:T:n:v:s:l:S:d:b: \ + --long template:,type:,pckname:,pckversion:,setupmacro:,summary:,license:,\ +source:,standard-docs:,build-technology:,\ +i18n:,icons-mimetypes:,\ +infopages:,manpages:,\ +pck-apidocs:,pck-tools:,\ +shared-libraries:,\ + -n "${0}" -- "$@"` +[ $? = 0 ] || exit 1 + + notify.debug "$FUNCNAME: ${OPTIONS}" + eval set -- "${OPTIONS}" + + local templatefile spec_type + local pck_name pck_version + local spec_setup_macro + local spec_summary="$spec_default_summary" + local spec_license="$spec_default_license" + local standard_docs + local build_technology + + local i18n="0" + local icons_mimetypes="0" + local infopages="0" + local manpages="0" + local pck_apidocs="0" + local pck_tools="0" + local shared_libraries="0" + + while :; do + case $1 in + -t|--template) + templatefile=$2; shift ;; + -T|--type) + spec_type=$2; shift ;; + -n|--pckname) + pck_name=$2; shift ;; + -v|--pckversion) + pck_version=$2; shift ;; + -s|--setupmacro) + spec_setup_macro="$2"; shift ;; + --summary) + spec_summary="$2"; shift ;; + -l|--license) + spec_license="$2"; shift ;; + -S|--source) + spec_source="$2"; shift ;; + -d|--standard-docs) + standard_docs="$2"; shift ;; + -b|--build-technology) + build_technology="$2"; shift ;; + --i18n) + i18n="$2"; shift ;; + --icons-mimetypes) + icons_mimetypes="$2"; shift ;; + --infopages) + infopages="$2"; shift ;; + --manpages) + manpages="$2"; shift ;; + --pck-apidocs) + pck_apidocs="$2"; shift ;; + --pck-tools) + pck_tools="$2"; shift ;; + --shared-libraries) + shared_libraries="$2"; shift ;; + --) shift; break ;; + *) notify.error $"unrecognized option"" -- \`$1'" ;; + esac + shift + done + + notify.debug "$FUNCNAME: build_technology = $build_technology" + + local spec_cmd_configure + local spec_cmd_make + local spec_cmd_makeinstall + + case "$build_technology" in + cmake) + spec_cmd_configure="$spec_cmd_configure_cmake" + spec_cmd_make="$spec_cmd_make_cmake" + spec_cmd_makeinstall="$spec_cmd_makeinstall_cmake" + ;; + autotools) + spec_cmd_configure="$spec_cmd_configure_autotools" + spec_cmd_make="$spec_cmd_make_autotools" + spec_cmd_makeinstall="$spec_cmd_makeinstall_autotools" + ;; + unknown) + notify.warning $"unknown build techonology" + spec_cmd_configure="$spec_cmd_configure_default" + spec_cmd_make="$spec_cmd_make_default" + spec_cmd_makeinstall="$spec_cmd_makeinstall_default" + ;; + esac + notify.debug "$FUNCNAME: spec_cmd_configure = \"$spec_cmd_configure\"" + notify.debug "$FUNCNAME: spec_cmd_make = \"$spec_cmd_make\"" + notify.debug "$FUNCNAME: spec_cmd_makeinstall = \"$spec_cmd_makeinstall\"" + + [ -r "$templatefile" ] || notify.error $"file not found"": $templatefile" + + local currvar line skipline=0 + while read line; do + # FIXME: this code does not support nested conditional statements + case "$line" in + @if:*) + currvar="$(echo "$line" | sed "s,@if:\([^ \t]*\).*,\1,")" + [ "${!currvar}" = 1 ] || skipline=1 + #echo "@if[$currvar]" + #unset currvar + continue + ;; + @else:*) + #currvar="$(echo "$line" | sed "s,@if:\([^ \t]*'http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-%{version}.tar.gz'\).*,\1,")" + [ "$skipline" = 0 ] && skipline=1 || skipline=0 + ;; + @fi:*) + #currvar="$(echo "$line" | sed "s,@fi:\([^ \t]*\).*,\1,")" + skipline=0 + continue + ;; + *) [ "$skipline" = 1 ] || echo "$line" | sed "\ +s,@DISTRO@,${DISTRO:-?DISTRO?}, +s,@DISTRO_rpm@,${DISTRO_rpm:-?DISTRO_rpm?}, +s,@VENDOR@,${VENDOR:-?VENDOR?}, +s,@packager_fullname@,${packager_fullname:-?packager_fullname?}, +s,@packager_email@,${packager_email:-?packager_email?}, +s,@rpm_default_buildroot@,${rpm_default_buildroot:-?rpm_default_buildroot?}, +s,@pck_name@,$pck_name, +s,@pck_version@,$pck_version, +s,@spec_first_release@,${spec_first_release:-1}, +s,@spec_run_ldconfig@,$spec_run_ldconfig, +s,^\(%setup.*\),${spec_setup_macro}, +/^[ \t]*Summary[ \t]*:[ \t]*\.\.\..*$/{ + s,\(^[ \t]*Summary[ \t]*:[ \t]*\).*,\1${spec_summary},} +/^[ \t]*License[ \t]*:[ \t]*\.\.\.$/{ + s,\(^[ \t]*License[ \t]*:[ \t]*\).*,\1${spec_license},} +s,^\([ \t]*Source[ \t]*:[ \t]*\).*,\1${spec_source}, +s,@configure@,$spec_cmd_configure, +s,@make@,$spec_cmd_make, +s,@makeinstall@,$spec_cmd_makeinstall, +s,@standard_docs@,${standard_docs:+%doc $standard_docs}, +s,@spec_changelog_date@,$spec_changelog_date, +s,@spec_changelog_comment@,$spec_changelog_comment, +" +#/$spec_i18n/{ # if spec_i18n +# s,@i18n@\([^@]*\)@.*,\1,;be;} #select 1st arg +#:e s,@i18n@[^@]*@\([^@]*\)[@]*,\1, #select 2nd arg + ;; + esac + done < $templatefile | \ + sed '/^$/{n;/^$/d}' # remove duplicate blank lines +} + +# specfile.create() +# Parameters: +# $1 : try to create a specfile from this tarball +# $2 : package name +# $3 : package version +# $4 : package tipology (template) +# $5 : output file +# Description: +# Create an initial specfile to help packaging activities +# +function specfile.create() { + notify.debug "[ ${0}${exec_options} ]\n" + + # check if all the needed tools are available + # note: uncompress has been removed from the mandatory list + for tool in chmod find grep mktemp sed bunzip2 gunzip unzip; do + [ "$(type -p $tool)" ] || + notify.error $"utility not found"": \`$tool'" + done + + local spec_type="$1" + + # collect informations from the tarball name and the source files + # 1. pck_tarball, pck_name , pck_version + # 2. pck_rootdir (where the package has been decompressed) --> pck_rootdir_4spec + + # 'pck_tarball' = absolute path of '$1' + local pck_tarball + + case "$2" in + http://*|https://*|ftp://*) + pck_tarball="${2##*/}" + spec_source="$2" + + curl.download \ +--options "$curl_options" \ +${proxy:+--proxy $proxy} ${proxy_user:+--proxy-user $proxy_user} \ +--exit-on-err --destdir="$source_dir" "$spec_source" + + pck_tarball=$source_dir/$pck_tarball + ;; + *://*) + notify.error $"unsupported protocol"": \`${2//\:*}'" + ;; + /*) pck_tarball="$2" ;; + *) pck_tarball="$(pwd)/$2" ;; + esac + notify.debug "$FUNCNAME: pck_tarball = $pck_tarball" + notify.debug "$FUNCNAME: spec_source = $spec_source" + + [ "$pck_tarball" ] || notify.error $"missing tarball name" + + [ -e $pck_tarball ] || + notify.error $"cannot find the package $pck_tarball" + + # get the package name from the tarball name + local pck_name=${3:-`echo $2 | sed -n "\ + s/.*\/// # remove directory name, if any + s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) + /-[0-9]*/{s/-[0-9].*//p;q} # - + /[^-\.][0-9]\./{s/\(.*[^-\.]\)[0-9]\..*/\1/p;q} # + # (no version, but can end with numbers) + /^[^0-9]*[0-9]*$/p"`} + notify.debug "pck_name = \"$pck_name\"" + [ "$pck_name" ] || + notify.error $"cannot get the package name, use the \`-n' option" + + [[ "${pck_newver//[0-9\.]/}" ]] && + notify.error $"invalid version number"" -- \`$pck_newver'" + + local pck_version=${4:-`echo $2 | sed -n "\ + /[0-9]/!q # return nothing if no number is found in the package name + s,.*/,, # remove directory name, if any + s/\.[^0-9].*// # remove trailing stuff (.tar.gz, ...) + /-[0-9]*/{s/.*-\([0-9]*.*\)/\1/p;q} # - + /[^-\.][0-9]\./{s/.*[^-\.]\([0-9]\..*\)/\1/p;q} # + # (no version, but can end with numbers) + /^[^0-9]*[0-9]*$/q"`} + notify.debug "$FUNCNAME: pck_version = \"$pck_version\"" + [ "$pck_version" ] || + notify.error $"cannot get the package version, use the \`-v' option" + + local outfile="$5" + if [ "$outfile" ]; then + notify.debug "$FUNCNAME: output file"": ${NOTE}$outfile${NORM}" + > $outfile || notify.error $"can't create output file"" $outfile" + # do not chmod a non-regular file (for instance /dev/null) + [ -f "$outfile" ] && chmod ${rpm_specfile_mode:-644} $outfile + fi + + notify.note "${NOTE}"$"generating specfile""${NORM}""..."" + * "$"source"": ${NOTE}$pck_tarball${NORM}"" + * "$"mode"": ${NOTE}$spec_type${NORM}" + + case "$spec_type" in + library) + [[ "$pck_name" =~ $library_name_structure ]] || notify.error $"\ +libraries must have this name structure (use \`-n'):"" \ +\`$library_name_structure'" + ;; + perl) + [[ "$pck_name" =~ $perl_module_name_structure ]] || notify.error $"\ +perl modules must have this name structure (use \`-n'):"" \ +\`$perl_module_name_structure'" + ;; + python) + [[ "$pck_name" =~ $python_module_name_structure ]] || notify.error $"\ +python modules must have this name structure (use \`-n'):"" \ +\`$python_module_name_structure'" + ;; + esac + + # link fd#3 with stdout and redirect stdout to the log file + [ "$outfile" ] && { exec 3<&1; exec 1>>$outfile; } + + local tmpdir=`mktemp -q -d -t $me.XXXXXXXX` + [ $? -eq 0 ] || + notify.error $"can't create temporary directory" + + # decompress the tarball in the 'tmpdir' directory + cp -f $pck_tarball $tmpdir + pushd $tmpdir >/dev/null + case $pck_tarball in + *.tar.gz|*.tgz) + gunzip -c $pck_tarball | tar xf - ;; + *.tar.bz2|*.tbz2) + bunzip2 -c $pck_tarball | tar xf - ;; + *.tar.Z) + [ "$(type -p uncompress)" ] || + notify.error $"utility not found"": \`uncompress'" + uncompress -c $pck_tarball | tar xf - ;; + *.shar.gz) + gunzip -c $pck_tarball | unshar ;; + *.zip) + unzip -q $pck_tarball ;; + *.tar.xz|*.tar.lzma) + [ "$(type -p xz)" ] || + notify.error $"utility not found"": \`xz'" + xz -d --stdout $pck_tarball | tar xf - ;; + *.tar.lz) + [ "$(type -p lzip)" ] || + notify.error $"utility not found"": \`lzip'" + lzip -cd $pck_tarball | tar -xf - ;; + *.tar.7z) + [ "$(type -p 7za)" ] || + notify.error $"utility not found"": \`7za'" + 7za x -bd $pck_tarball >/dev/null | tar xf - ;; + *.7z) + [ "$(type -p 7za)" ] || + notify.error $"utility not found"": \`7za'" + 7za x -bd $pck_tarball >/dev/null ;; + *.jar) + [ "$(type -p jar)" ] || + notify.error $"utility not found"": \`jar'" + jar -xf $pck_tarball >/dev/null ;; + *) notify.warning $"unsupported package compression method" ;; + esac + popd >/dev/null + rm -f $tmpdir/${pck_tarball##*/} + + local pck_rootdir_dirs=(`\ +LANG=C find $tmpdir -mindepth 1 -maxdepth 1 -type d -printf "%f "`) + notify.debug "$FUNCNAME: pck_rootdir_dirs = \"$pck_rootdir_dirs\"" + local pck_rootdir_files=(`\ +LANG=C find $tmpdir -mindepth 1 -maxdepth 1 -type f -printf "%f "`) + notify.debug "$FUNCNAME: pck_rootdir_files = \"$pck_rootdir_files\"" + + # 0. set 'spec_setup_macro' + + local pck_rootdir local pck_rootdir_4spec spec_setup_macro + + if [[ -n "$pck_rootdir_files" || \ + ( -z "$pck_rootdir_dirs" && -z "$pck_rootdir_files" ) ]]; then + # detected a package without a root directory + pck_rootdir="" + pck_rootdir_4spec="-c %{name}-%{version}" + spec_setup_macro="%setup -q $pck_rootdir_4spec" + else + pck_rootdir="$pck_rootdir_dirs" + pck_rootdir_4spec=`echo $pck_rootdir | \ + sed "s/$pck_name/%{name}/;s/$pck_version/%{version}/"` + if [ "$pck_rootdir_4spec" = "%{name}-%{version}" ]; then + spec_setup_macro="%setup -q" + elif [ "$pck_rootdir_4spec" = "-c %{name}-%{version}" ]; then + spec_setup_macro="%setup -q $pck_rootdir_4spec" + else + spec_setup_macro="%setup -q -n $pck_rootdir_4spec" + fi + fi + + notify.debug "$FUNCNAME: pck_rootdir = \"$pck_rootdir\"" + notify.debug "$FUNCNAME: pck_rootdir_4spec = \"$pck_rootdir_4spec\"" + notify.debug "$FUNCNAME: spec_setup_macro = \"$spec_setup_macro\"" + + # 1. preliminaries checks + + case "$spec_type" in perl) ;; + *) [[ -e $tmpdir/$pck_rootdir/$perl_Makefile_generator || + -e $tmpdir/$pck_rootdir/Build.PL ]] && notify.warning $"\ +looks like a perl package (use \`-t perl' if this is true)" ;; + esac + case "$spec_type" in python) ;; + *) [[ -e $tmpdir/$pck_rootdir/setup.py ]] && notify.warning $"\ +looks like a python module (use \`-t python' if this is true)" ;; + esac + + # 2. set 'spec_summary' + local spec_summary="$spec_default_summary" + local perl_pckname_from_makefile="" + case "$spec_type" in perl) + if [ -e $tmpdir/$pck_rootdir/Makefile.PL ]; then + # look for the variable `NAME' in Makefile.PL inside the + # 'WriteMakefile(' ... ')' block + perl_pckname_from_makefile=$(sed -n "\ +/^[ \t]*WriteMakefile(/,/^)/{# + /^[ \t]*[']NAME['][ \t]*=>/{# + s|.*=>[ \t]*['\"]\(.*\)['\"].*|\1|;p}}" \ + $tmpdir/$pck_rootdir/Makefile.PL) +# [ "$perl_pckname_from_makefile" ] || +# perl_pckname_from_makefile=$(sed -n "\ +#/name/{s,^[ \t]*name[ \t]*['\"]*\([a-zA-Z]*\)['\"]*.*,\1,p}" \ +# $tmpdir/$pck_rootdir/Makefile.PL) + fi + [ -n "$perl_pckname_from_makefile" ] && + spec_summary="$perl_pckname_from_makefile - ..." + esac + + # 3. set 'spec_license' + case "$spec_type" in perl) + spec_license="${perl_License_default:-$spec_default_license}" + esac + + # find for package license info + # FIXME: currently GNU GPL, LGPL, and W3C licenses are supported + local spec_license="$spec_default_license" + + if [[ -e $tmpdir/$pck_rootdir/COPYING ]]; then + [[ `grep -c "[ ]*GNU GENERAL PUBLIC LICENSE[ ]*" \ + $tmpdir/$pck_rootdir/COPYING` -eq 0 ]] || spec_license="GPL" + [[ `grep -c "[ ]*GNU LIBRARY GENERAL PUBLIC LICENSE[ ]*" \ + $tmpdir/$pck_rootdir/COPYING` -eq 0 ]] || spec_license="LGPL" + [[ `grep -c "[ ]*GNU LESSER GENERAL PUBLIC LICENSE[ ]*" \ + $tmpdir/$pck_rootdir/COPYING` -eq 0 ]] || spec_license="LGPL" + [[ `grep -c "Copyright .* World Wide Web Consortium" \ + $tmpdir/$pck_rootdir/COPYING` -eq 0 ]] || spec_license="W3C" + fi + + notify.debug "$FUNCNAME: spec_license (1) = \"$spec_license\"" + + # 4. set 'spec_source' + + local spec_preamble_tarball=`echo "${pck_tarball##*/}" | + sed "s,$pck_version,%{version},g"` + local spec_preamble_source=`echo "$spec_source" | + sed "s,$pck_version,%{version},g"` + + [ "$spec_source" ] || + spec_preamble_tarball="http://.../$spec_preamble_tarball" + + notify.debug "$FUNCNAME: spec_preamble_tarball = \"$spec_preamble_tarball\"" + notify.debug "$FUNCNAME: spec_preamble_source = \"$spec_preamble_source\"" + + # 5. discover basic documentation and set 'spec_basic_docs' + + # standard text documentation files (see 'automake --help') + # + some other documentation files commonly found in several packages + local standard_docs_list=' + AUTHORS + BACKLOG + BUGS + CHANGES + COPYING + COPYING.DOC + COPYING.LESSER + COPYING.LIB + CREDITS + ChangeLog* + LICENCE + LICENSE + MANUAL + NEWS + README* + THANKS + TODO + WHATSNEW + WHERE' + + local standard_docs doc currdocs currdoc + for doc in $standard_docs_list; do + # `ls' if used to support strings like `ChangeLog*' + currdocs=$(cd $tmpdir/$pck_rootdir && ls $doc 2>/dev/null) + for currdoc in $currdocs; do + # ignore empty documentation files + [ -s $tmpdir/$pck_rootdir/$currdoc ] && + standard_docs="${standard_docs:+$standard_docs }$currdoc" + done + done + # split the list of docs into multiple lines if necessary + #[ "$docs" ] && docs=`echo $docs | fmt -u -w 77 | sed 's,.*,%doc &,'` + + # 6. discover build technology + + local build_techology="unknown" + case "$spec_type" in + kde3|kde4|perl|python) + build_techology="$spec_type" + ;; + *) if [ -e $tmpdir/$pck_rootdir/CMakeLists.txt ]; then + build_techology="cmake" + elif [ -x $tmpdir/$pck_rootdir/configure ]; then + build_techology="autotools" + fi + ;; + esac + + # 7. check for internationalization files + + local spec_i18n="0" + # note: in the 'tar' tarball there is no 'intl' folder, so we use 'po' + [ "$(LANG=C find $tmpdir/$pck_rootdir/ -type d -name po 2>/dev/null)" ] && + spec_i18n="1" + + # 8. check for manpages + + local spec_manpages="0" + [ "$(LANG=C find $tmpdir/$pck_rootdir/ -name Makefile.am \ +-exec grep "MANS[ ]*=" {} \; 2>/dev/null)" ] && spec_manpages="1" + + [ "$spec_manpages" = 0 ] && + { [ "$(LANG=C find $tmpdir/$pck_rootdir/ \ +-type f -name "*.[0-9]" 2>/dev/null)" ] && spec_manpages="1"; } + + # 9. check for infopages + + local spec_infopages="0" + [ "$(LANG=C find $tmpdir/$pck_rootdir/ -name Makefile.am \ +-exec grep "info_TEXINFOS[ ]*=" {} \; 2>/dev/null)" ] && spec_infopages="1" + notify.debug "$FUNCNAME: spec_infopages = $spec_infopages" + + [ "$spec_infopages" = 0 ] && + { [ "$(LANG=C find $tmpdir/$pck_rootdir/ \ +-type f -name "*.info" 2>/dev/null)" ] && spec_infopages="1"; } + notify.debug "$FUNCNAME: spec_infopages = $spec_infopages" + + # 10. check for gtk-doc documentation + + local spec_gtk_doc="0" + [ "$(LANG=C $tmpdir/$pck_rootdir/configure --help 2>/dev/null | \ +grep -e "enable-gtk-doc")" ] && { + spec_gtk_doc="1" + [ "$build_techology" = "autotools" ] && spec_cmd_configure="\ +$spec_cmd_configure_autotools --enable-gtk-doc" + } + + + # FIXME: missing support for: + # pkgconfig files + # includedir files + + template.expand \ + --template "$templatedir/${spec_type}" \ + --type "$spec_type" \ + --pckname "$pck_name" \ + --pckversion "$pck_version" \ + --setupmacro "$spec_setup_macro" \ + --summary="$spec_summary" \ + --license "$spec_license" \ + --source "${spec_preamble_source:-$spec_preamble_tarball}" \ + --standard-docs "$standard_docs" \ + --build-technology "$build_techology" \ + --i18n "$spec_i18n" \ + --icons-mimetypes "1" \ + --infopages "$spec_infopages" \ + --manpages "$spec_manpages" \ + --pck-apidocs "$spec_gtk_doc" \ + --pck-tools "1" \ + --shared-libraries "1" + + [ "$outfile" ] && specfile.ckeck_defvalues "$outfile" + + rm -fr $tmpdir + if [ "$outfile" ]; then + exec 1<&3 3<&- # restore stdout and close fd#3 + [ -f "$outfile" ] && + notify.note $"created specfile"": \`${NOTE}$outfile${NORM}'" + fi +} + +specfile.create \ + "$spec_type" "$pck_tarball" "$pck_name" "$pck_version" "$outfile" diff --git a/po/it/Makefile b/po/it/Makefile new file mode 100644 index 0000000..59320d0 --- /dev/null +++ b/po/it/Makefile @@ -0,0 +1,49 @@ +# Makefile for autospec +# Copyright (C) 2008 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +srcdir = ../.. + +include $(srcdir)/Makefile.env + +pck_catalogs := $(wildcard *.po) + +LANG=it + +.SUFFIXES: +.SUFFIXES: .po .mo .in +.po.mo:; @echo "Generating binary message catalog '$@'..."; \ + msgfmt $< -o $@ + +all: locales + +locales: $(pck_catalogs:.po=.mo) + +install: locales + @destdir="$(DESTDIR)$(localedir)/$(LANG)/LC_MESSAGES";\ + $(INSTALL_DIR) $$destdir;\ + for f in $(pck_catalogs:.po=); do\ + $(INSTALL_DATA) $${f}.mo $$destdir/$${f}.mo;\ + done + +uninstall: + @for f in $(pck_catalogs:.po=); do\ + echo "rm -f $(DESTDIR)$(localedir)/$(LANG)/LC_MESSAGES/$${f}.mo";\ + rm -f $(DESTDIR)$(localedir)/$(LANG)/LC_MESSAGES/$${f}.mo;\ + done + +clean: + rm -f $(pck_catalogs:.po=.mo) + diff --git a/po/it/autospec_fe.po b/po/it/autospec_fe.po new file mode 100644 index 0000000..3533f8d --- /dev/null +++ b/po/it/autospec_fe.po @@ -0,0 +1,89 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan +# +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2008-10-08 16:15+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +msgid "this script requires bash version 2 or better" +msgstr "questo script richiede bash versione 2 o superiore" + +msgid "" +"This program is free software; you can redistribute it and/or modify it under\n" +"the terms of the GNU General Public License version 2 as published by the\n" +"Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY\n" +"or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" +"Questo รจ software libero; รจ possibile redistribuirlo e/o modificarlo nei termini\n" +"della GNU General Public License versione 2 cosรฌ come pubblicata dalla\n" +"Free Software Foundation. Non รจ fornita ALCUNA garanzia; neppure di NEGOZIABILITA'\n" +"o di APPLICABILITA' PER UN PARTICOLARE SCOPO." + +msgid "Automatically update rpm packages and help creating new specfiles." +msgstr "Aggiorna automaticamente pacchetti rpm ed assiste nella creazione di specfile." + +msgid "Operation modes" +msgstr "Modalitร  operative" + +msgid "Update the given package to a specified version and release" +msgstr "Aggiorna il pacchetto indicato ad una specifica versione e release" + +msgid "Try to create a specfile for the specified tarball" +msgstr "Cerca di creare uno specfile per il tarball indicato" + +msgid "Extract a given file or list of files from a srpm archive" +msgstr "Estrae da un archivio srpm un file o una lista di file indicati" + +msgid "Print the value of the given configuration variable" +msgstr "Stampa il valore che la variabile indicata ha nei file di configurazione" + +msgid "Print this help, then exit" +msgstr "Stampa questa schermata di aiuto e termina il programma" + +msgid "Print version number, then exit" +msgstr "Stampa il numero di versione e termina il programma" + +msgid "Run in quiet mode" +msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione" + +msgid "Enable the colorized output" +msgstr "Abilita l'output colorato" + +msgid "Run in debugging mode (very verbose output)" +msgstr "Attiva la modalitร  di debugging (output prolisso)" + +msgid "Usage" +msgstr "Utilizzo" + +msgid "Use '-u -h', '-s -h', '-x -h', and '--eval -h' to display specific command line options." +msgstr "Usa '-u -h', '-s -h', '-x -h', '--eval -h' per avere le opzioni a linea di comando specifiche." + +msgid "Report bugs to ." +msgstr "Segnalare eventuali bug a ." + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "version" +msgstr "versione" + +msgid "unset in the configuration files" +msgstr "non configurato nei file di configurazione" + +msgid "plugin not found" +msgstr "plugin non trovato" + +msgid "can't create temporary files" +msgstr "impossibile creare file temporanei" + +msgid "you're running $me as root" +msgstr "stai eseguendo $me come root" diff --git a/po/it/config-getvar.po b/po/it/config-getvar.po new file mode 100644 index 0000000..6a493d4 --- /dev/null +++ b/po/it/config-getvar.po @@ -0,0 +1,91 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2005-11-05 18:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# plugins/config-getvar + +msgid "this script requires bash version 3 or better" +msgstr "questo script richiede bash versione 3 o superiore" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "" +"This program is free software; you can redistribute it and/or modify it under\n" +"the terms of the GNU General Public License version 2 as published by the\n" +"Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY\n" +"or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" +"Questo รจ software libero; รจ possibile redistribuirlo e/o modificarlo nei termini\n" +"della GNU General Public License versione 2 cosรฌ come pubblicata dalla\n" +"Free Software Foundation. Non รจ fornita ALCUNA garanzia; neppure di NEGOZIABILITA'\n" +"o di APPLICABILITA' PER UN PARTICOLARE SCOPO." + +msgid "Print the value of a given configuration variable" +msgstr "Stampa il valore che una data variabile assume nei file di configurazione" + +msgid "Usage" +msgstr "Utilizzo" + +msgid "where the above options mean" +msgstr "dove le precedenti opzioni significano" + +msgid "Print the value of the configuration variable " +msgstr "Stampa il valore che assume nei file di configurazione" + +msgid "Use an alternate configuration file" +msgstr "Utilizza un file di configurazione alternativo" + +msgid "Default files:" +msgstr "File di default:" + +msgid "Operation modes" +msgstr "Modalitร  operative" + +msgid "Print this help, then exit" +msgstr "Stampa questa schermata di aiuto e termina il programma" + +msgid "Print version number, then exit" +msgstr "Stampa il numero di versione e termina il programma" + +msgid "Run in quiet mode" +msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione" + +msgid "Enable the colorized output" +msgstr "Abilita l'output colorato" + +msgid "Run in debugging mode (very verbose output)" +msgstr "Attiva la modalitร  di debugging (output prolisso)" + +msgid "Samples" +msgstr "Alcuni esempi" + +msgid "Report bugs to ." +msgstr "Segnalare eventuali bug a ." + +msgid "cannot read" +msgstr "impossibile leggere" + +msgid "unrecognized option" +msgstr "opzione non conosciuta" + +msgid "configuration file not found" +msgstr "file di configurazione non trovato" + +msgid "(bug)" +msgstr "(bug)" + +msgid "unknown variable type" +msgstr "tipo di variabile sconosciuto" diff --git a/po/it/libapse.po b/po/it/libapse.po new file mode 100644 index 0000000..c1c5c55 --- /dev/null +++ b/po/it/libapse.po @@ -0,0 +1,110 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2005-11-05 18:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# lib/libapse.lib + +msgid "this script requires bash version 2 or better" +msgstr "questo script richiede bash versione 2 o superiore" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "version" +msgstr "versione" + +msgid "Find for updates scanning the web." +msgstr "Ricerca aggiornamenti cercando nel web." + +msgid "Usage" +msgstr "Utilizzo" + +msgid "where the above options mean" +msgstr "dove le precedenti opzioni significano" + +msgid "Name of the package" +msgstr "Nome del pacchetto" + +msgid "Name of the spec file" +msgstr "Nome dello specfile" + +msgid "URL of the project home page" +msgstr "Indirizzo internet dell'homepage del progetto" + +msgid "URL with no variable expansion" +msgstr "Indirizzo internet senza espansione delle variabili" + +msgid "Proxy" +msgstr "Proxy" + +msgid "Proxy user" +msgstr "Utenza proxy" + +msgid "Operation modes" +msgstr "Modalitร  operative" + +msgid "Print this help, then exit" +msgstr "Stampa questa schermata di aiuto e termina il programma" + +msgid "Samples" +msgstr "Alcuni esempi" + +msgid "Report bugs to ." +msgstr "Segnalare eventuali bug a ." + +msgid "(bug)" +msgstr "(bug)" + +msgid "\\`getopt' error" +msgstr "errore in \\`getopt'" + +msgid "\\`getopt' error: bad command \\`$1'" +msgstr "errore in \\`getopt': comando errato \\`$1'" + +msgid "can't create temporary files" +msgstr "impossibile creare file temporanei" + +msgid "looking at" +msgstr "cerco in" + +msgid "couldn't resolve host" +msgstr "impossibile risolvere il nome dell'host" + +msgid "failed to connect to host" +msgstr "impossibile connettersi all'host" + +msgid "curl error (exit code: $retval)" +msgstr "errore curl (codice di errore: $retval)" + +msgid "not parametric source0 name; cannot update" +msgstr "source0 in formato non parametrico: impossibile aggiornare" + +msgid "found version:" +msgstr "versione trovata:" + +msgid "last version of \\`${NOTE}$specname${NORM}' found:" +msgstr "ultima versione di \\`${NOTE}$specname${NORM}' trovata:" + +msgid "package \\`${NOTE}$specname${NORM}' is already the latest version" +msgstr "il pacchetto \\`${NOTE}$specname${NORM}' รจ giร  aggiornato all'ultima versione" + +msgid "a new version of \\`${NOTE}$specname${NORM}' is available!" +msgstr "รจ disponibile una nuova versione di \\`${NOTE}$specname${NORM}'!" + +msgid "a newer version of \\`${NOTE}$specname${NORM}' is already installed" +msgstr "รจ giร  installata una versione successiva di \\`${NOTE}$specname${NORM}'" + +msgid "cannot find a new version of \\`$specname'" +msgstr "impossibile trovare una nuova versione per \\`$specname'" diff --git a/po/it/libcfg.po b/po/it/libcfg.po new file mode 100644 index 0000000..6057aca --- /dev/null +++ b/po/it/libcfg.po @@ -0,0 +1,44 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2005-11-05 18:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# lib/libcfg.lib + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "configuration file not found" +msgstr "file di configurazione non trovato" + +msgid "Hint" +msgstr "Suggerimento" + +msgid "user \\`$(id -nu)' does not belong to group \\`$packager_group'" +msgstr "l'utente \\`$(id -nu)' non appartiene al gruppo \\`$packager_group'" + +msgid "the file \\`$f' should be readable only by the group \\`$packager_group'" +msgstr "il file \\`$f' dovrebbe essere leggibile solo dal gruppo \\`$packager_group'" + +msgid "unset in the configuration files" +msgstr "non configurato nei file di configurazione" + +msgid "missing variable in the configuration file" +msgstr "variabile non inizializzata nel file di configurazione" + +msgid "loading" +msgstr "caricamento di" + +msgid "cannot read" +msgstr "impossibile leggere" diff --git a/po/it/libmsgmng.po b/po/it/libmsgmng.po new file mode 100644 index 0000000..578d193 --- /dev/null +++ b/po/it/libmsgmng.po @@ -0,0 +1,23 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2005-11-05 18:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# lib/libmsgmng.lib + +msgid "this script requires bash version 2 or better" +msgstr "questo script richiede bash versione 2 o superiore" + +msgid "no message" +msgstr "nessun messaggio" diff --git a/po/it/libnetwork.po b/po/it/libnetwork.po new file mode 100644 index 0000000..0c207d9 --- /dev/null +++ b/po/it/libnetwork.po @@ -0,0 +1,86 @@ +# translation of it.po to Italiana +# Copyright (C) 2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2008-11-05 22:00+0100\n" +"PO-Revision-Date: 2008-11-05 22:00+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# lib/librepository.lib + +msgid "this script requires bash version 2 or better" +msgstr "questo script richiede bash versione 2 o superiore" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "(bug)" +msgstr "(bug)" + +msgid "\\`getopt' error" +msgstr "errore in \\`getopt'" + +msgid "\\`getopt' error: bad command \\`$1'" +msgstr "errore in \\`getopt': commando errato \\`$1'" + +msgid "not a number" +msgstr "non รจ un numero" + +msgid "missing mandatory arg" +msgstr "parametro mancante" + +msgid "can't create temporary files" +msgstr "impossibile creare file temporanei" + +msgid "getting list of files from" +msgstr "ricavo l'elenco dei file da" + +msgid "couldn't resolve host" +msgstr "impossibile risolvere il nome dell'host" + +msgid "failed to connect to host" +msgstr "impossibile connettersi all'host" + +msgid "failure in receiving network data" +msgstr "impossibile recevere dati via rete" + +msgid "curl error (exit code: $retval)" +msgstr "errore curl (codice di errore: $retval)" + +msgid "unsupported query type for this protocol" +msgstr "ricerca non supportata in questo protocollo" + +msgid "cannot get the list of files" +msgstr "impossibile ottenere la lista dei file" + +msgid "no list of architectures set" +msgstr "nessuna lista di architetture specificata" + +msgid "unsupported protocol" +msgstr "protocollo non supportato" + +msgid "not an internet address" +msgstr "non รจ un indirizzo internet" + +msgid "no such directory" +msgstr "cartella non trovata" + +msgid "cannot download" +msgstr "impossibile scaricare" + +msgid "unknown action" +msgstr "azione sconosciuta" + +msgid "package not found" +msgstr "pacchetto non trovato" + +msgid "downloading" +msgstr "download di" diff --git a/po/it/libspec.po b/po/it/libspec.po new file mode 100644 index 0000000..0d7fc2b --- /dev/null +++ b/po/it/libspec.po @@ -0,0 +1,146 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2005-11-05 18:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# lib/libspec.lib + +msgid "this script requires bash version 2 or better" +msgstr "questo script richiede bash versione 2 o superiore" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "(bug)" +msgstr "(bug)" + +msgid "missing mandatory arg" +msgstr "parametro mancante" + +msgid "detected a specfile with unsupported syntax:" +msgstr "lo specfile usa una sintassi non supportata:" + +msgid "\\`getopt' error" +msgstr "errore in \\`getopt'" + +msgid "\\`getopt' error: bad command \\`$1'" +msgstr "errore in \\`getopt': comando errato \\`$1'" + +msgid "specfile not found" +msgstr "specfile non trovato" + +msgid "can't create temporary files" +msgstr "impossibile creare file temporanei" + +msgid "rpm exited with error code \\`$?'" +msgstr "rpm รจ teminato con error \\`$?'" + +msgid "FIXME: sorry, not implemented yet..." +msgstr "FIXME: spiacente, implementazione mancante..." + +msgid "\\`%end' found; should perhaps be \\`%endif'" +msgstr "\\`%end' utilizzata; forse si intendeva \\`%endif'" + +msgid "cannot evaluate:" +msgstr "impossibile valutare:" + +msgid "assertion failed:" +msgstr "" + +msgid "version" +msgstr "versione" + +msgid "Get informations from a given specfile." +msgstr "Ricava informazioni da un specfile dato." + +msgid "Usage" +msgstr "Utilizzo" + +msgid "where the above options mean" +msgstr "dove le precedenti opzioni significano" + +msgid "name (and patch) of the specfile" +msgstr "nome (e percorso) dello specfile" + +msgid "do not try to expand variables" +msgstr "non cercare di espandere le variabili" + +msgid "and belongs to the following list" +msgstr "e appartiene alla lista seguente" + +msgid "list of package groups" +msgstr "lista dei gruppi utilizzati" + +msgid "full name of the srpm package" +msgstr "nome completo del pacchetto srpm" + +msgid "list of patches" +msgstr "lista delle patch" + +msgid "name of the source0 file" +msgstr "name del file indicato da source0" + +msgid "list of source files" +msgstr "lista dei source file" + +msgid "list of all the generated rpm packages" +msgstr "lista dei pacchetti rpm generati" + +msgid "list of the obsoleted packages" +msgstr "lista dei pacchetti resi obsoleti" + +msgid "list of the declared build requirements" +msgstr "lista dei \\`build requirements' dichiarati" + +msgid "Operation modes" +msgstr "Modalitร  operative" + +msgid "Print this help, then exit" +msgstr "Stampa questa schermata di aiuto e termina il programma" + +msgid "Samples" +msgstr "Alcuni esempi" + +msgid "Report bugs to ." +msgstr "Segnalare eventuali bug a ." + +msgid "bad specfile preamble" +msgstr "preambolo dello specfile non conforme" + +msgid "bad arg \\`$var'" +msgstr "argomento errato \\`$var'" + +msgid "cannot initialize \\`$var' from specfile data" +msgstr "impossibile assegnare un valore a \\`$var' usando i dati dello specfile" + +msgid "directory not found" +msgstr "cartella non trovata" + +msgid "file not found" +msgstr "file non trovato" + +msgid "skipped" +msgstr "ignorato" + +msgid "couldn't resolve host" +msgstr "impossibile risolvere il nome dell'host" + +msgid "failed to connect to host" +msgstr "impossibile connettersi all'host" + +msgid "curl error (exit code: $retval)" +msgstr "errore curl (codice di errore: $retval)" + +msgid "cannot download" +msgstr "impossibile scaricare" diff --git a/po/it/pck-extract.po b/po/it/pck-extract.po new file mode 100644 index 0000000..c02b961 --- /dev/null +++ b/po/it/pck-extract.po @@ -0,0 +1,109 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2005-11-05 18:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# plugins/pck-extract + +msgid "this script requires bash version 3 or better" +msgstr "questo script richiede bash versione 3 o superiore" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "" +"This program is free software; you can redistribute it and/or modify it under\n" +"the terms of the GNU General Public License version 2 as published by the\n" +"Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY\n" +"or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" +"Questo รจ software libero; รจ possibile redistribuirlo e/o modificarlo nei termini\n" +"della GNU General Public License versione 2 cosรฌ come pubblicata dalla\n" +"Free Software Foundation. Non รจ fornita ALCUNA garanzia; neppure di NEGOZIABILITA'\n" +"o di APPLICABILITA' PER UN PARTICOLARE SCOPO." + +msgid "Extract a given file or list of files from a srpm archive" +msgstr "Estrae da un archivio srpm un file o una lista di file indicati" + +msgid "Usage" +msgstr "Utilizzo" + +msgid "where the above options mean" +msgstr "dove le precedenti opzioni significano" + +msgid "Extract from the srpm package ..." +msgstr "Estrae dal pacchetto srpm ..." + +msgid "...the specified file or list of files " +msgstr "...il file o la lista di file " + +msgid "Save extracted files in the directory " +msgstr "Salva i file estratti nella cartella " + +msgid "Operation modes" +msgstr "Modalitร  operative" + +msgid "Print this help, then exit" +msgstr "Stampa questa schermata di aiuto e termina il programma" + +msgid "Print version number, then exit" +msgstr "Stampa il numero di versione e termina il programma" + +msgid "Run in quiet mode" +msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione" + +msgid "Enable the colorized output" +msgstr "Abilita l'output colorato" + +msgid "Run in debugging mode (very verbose output)" +msgstr "Attiva la modalitร  di debugging (output prolisso)" + +msgid "Samples" +msgstr "Alcuni esempi" + +msgid "Report bugs to ." +msgstr "Segnalare eventuali bug a ." + +msgid "cannot read" +msgstr "impossibile leggere" + +msgid "unrecognized option" +msgstr "opzione non conosciuta" + +msgid "utility not found" +msgstr "programma non trovato" + +msgid "can't create temporary files" +msgstr "impossibile creare file temporanei" + +msgid "cannot download" +msgstr "impossibile scaricare" + +msgid "cannot find:" +msgstr "impossibile trovare:" + +msgid "not a srpm package" +msgstr "non รจ un pacchetto srpm" + +msgid "cannot create \\`$destdir'" +msgstr "impossibile creare \\`$destdir'" + +msgid "can't save extracted files to \\`$destdir'" +msgstr "impossibile salvare i file estratti in \\`$destdir'" + +msgid "can't decompress the file" +msgstr "impossibile decomprimere il file" + +msgid "can't save files to \\`$destdir'" +msgstr "impossibile salvare i file in \\`$destdir'" diff --git a/po/it/pck-update.po b/po/it/pck-update.po new file mode 100644 index 0000000..a7626c0 --- /dev/null +++ b/po/it/pck-update.po @@ -0,0 +1,499 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2005-11-05 18:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# plugins/pck-update + +msgid "this script requires bash version 3 or better" +msgstr "questo script richiede bash versione 3 o superiore" + +msgid "you're running $me as root" +msgstr "stai eseguendo $me come root" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "" +"This program is free software; you can redistribute it and/or modify it under\n" +"the terms of the GNU General Public License version 2 as published by the\n" +"Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY\n" +"or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" +"Questo รจ software libero; รจ possibile redistribuirlo e/o modificarlo nei termini\n" +"della GNU General Public License versione 2 cosรฌ come pubblicata dalla\n" +"Free Software Foundation. Non รจ fornita ALCUNA garanzia; neppure di NEGOZIABILITA'\n" +"o di APPLICABILITA' PER UN PARTICOLARE SCOPO." + +msgid "Update the package to version and release " +msgstr "Aggiorna il pacchetto a versione e release " + +msgid "Usage" +msgstr "Utilizzo" + +msgid "where the above options mean" +msgstr "dove le precedenti opzioni significano" + +msgid "Do the actions specified in the comma separated list " +msgstr "Esegue la lista di azioni separate da virgole " + +msgid "check for available versions in the $DISTRO repositories" +msgstr "cerca se il pacchetto รจ disponibile nei repository $DISTRO" + +msgid "download and install the srpm package" +msgstr "download ed installazione del pacchetto srpm" + +msgid "check if a new version is available" +msgstr "controlla se รจ disponibile un aggiornamento" + +msgid "download new source files" +msgstr "download dei nuovi file sorgente" + +msgid "update and check the specfile" +msgstr "aggiornamento e controllo dello specfile" + +msgid "build the rpm(s) and srpm packages" +msgstr "creazione dei pacchetti rpm e srpm" + +msgid "build the list of the build requirements" +msgstr "creazione della lista dei build requirement" + +msgid "simulate the installation of the rpm package(s)" +msgstr "simulazione dell'installazione dei pacchetti rpm" + +msgid "perform some quality and security checks" +msgstr "esecuzione dei test di qualitร  e sicurezza" + +msgid "calculate the md5/sha1 hashing values" +msgstr "calcolo dei valori di hashing md5 e sha1" + +msgid "upload the new packages to the ftp repository" +msgstr "upload dei nuovi pacchetti sul sito ftp" + +msgid "*remove* old packages from the ftp repository" +msgstr "*rimozione* dei vecchi pacchetti dal sito ftp" + +msgid "(move packages to \\`\\$ftp_rw_old_dir', if set)" +msgstr "(backup in \\`\\$ftp_rw_old_dir', se definita)" + +msgid "install the new rpm packages" +msgstr "installazione dei nuovi pacchetti rpm" + +msgid "Force the update of the rpm(s) and srpm packages" +msgstr "Forza l'aggiornamento dei pacchetti rpm e srpm" + +msgid "Force the rebuild of the rpm(s) and srpm packages" +msgstr "Ricrea comunque i pacchetti rpm e srpm" + +msgid "Install the new packages even if rpm complains for errors" +msgstr "Installa i nuovi pacchetti anche in caso di errori rpm" + +msgid "Download the source files even if found in SOURCE" +msgstr "Scarica i file sorgente anche se presenti in SOURCE" + +msgid "Try to execute the given action(s) bypassing errors" +msgstr "Cerca di eseguire comunque le azioni specificate" + +msgid "Skip the given test number(s)" +msgstr "Non esegue i test indicati" + +msgid "Define variables ,,... with values ,,..." +msgstr "Assegna alle variabili v1,v2,... i valori r1,r2,..." + +msgid "Select a server from where to download srpm packages" +msgstr "Server da utilizzare nel download dei pacchetti" + +msgid "Select a server where to upload packages" +msgstr "Server dove effettuare l'upload dei pacchetti" + +msgid "Select a server to be used for both download and upload" +msgstr "Server per l'upload e il download dei pacchetti" + +msgid "FTP user (usr) and password (pswd) for packages upload" +msgstr "User (usr) e password (pswd) per l'upload sul sito FTP" + +msgid "Name of the specfile (default: .spec)" +msgstr "Nome dello specfile (default: .spec)" + +msgid "Force the architecture to a given value" +msgstr "Forza un valore per l'architettura" + +msgid "Set change information for the package" +msgstr "Scrive il messaggio indicato nel changelog del pacchetto" + +msgid "action" +msgstr "azione" + +msgid "Only build the rpm packages" +msgstr "Crea soltanto i pacchetti rpm" + +msgid "Do not upload the srpm package" +msgstr "Non effettua l'upload del pacchetto srpm" + +msgid "Only build the srpm package" +msgstr "Crea soltanto il pacchetto srpm" + +msgid "Do not upload the rpm packages" +msgstr "Non effettua l'upload dei pacchetti rpm" + +msgid "Remove all the temporary files except (s)rpm packages" +msgstr "Rimuove tutti i file temporanei" + +msgid "Enable specfile autoformatting" +msgstr "Abilita la riformattazione dello specfile" + +msgid "Unable logging to file (logging dir: \\`\\$logging_dir')" +msgstr "Abilita il log su file (nella directory: \\`\\$logging_dir'" + +msgid "Enable rebuilding mode and settings (action 4 only)" +msgstr "Attiva modalitร  ed impostazioni di rebuild (azione 4)" + +msgid "Specify an alternative root directory to rpm" +msgstr "Definisce una root directory alternativa per rpm" + +msgid "Operation modes" +msgstr "Modalitร  operative" + +msgid "Print this help, then exit" +msgstr "Stampa questa schermata di aiuto e termina il programma" + +msgid "Print version number, then exit" +msgstr "Stampa il numero di versione e termina il programma" + +msgid "Run in quiet mode" +msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione" + +msgid "Enable the colorized output" +msgstr "Abilita l'output colorato" + +msgid "Run in debugging mode (very verbose output)" +msgstr "Attiva la modalitร  di debugging (output prolisso)" + +msgid "Samples" +msgstr "Alcuni esempi" + +msgid "changelog entry" +msgstr "stringa di changelog" + +msgid "Report bugs to ." +msgstr "Segnalare eventuali bug a ." + +msgid "cannot read" +msgstr "impossibile leggere" + +msgid "no such file or directory" +msgstr "file o cartella non trovata" + +msgid "unrecognized option" +msgstr "opzione non conosciuta" + +msgid "utility not found" +msgstr "programma non trovato" + +msgid "must be set in the configuration file" +msgstr "non inizializzato nei file di configurazione" + +msgid "must have the same size" +msgstr "devono avere la stessa dimensione" + +msgid "illegal value" +msgstr "valore non valido" + +msgid "assuming as specfile" +msgstr "assumo che lo specfile sia" + +msgid "unsupported path for specfile" +msgstr "persorso dello specfile non supportato" + +msgid "specfile not found" +msgstr "specfile non trovato" + +msgid "(bug)" +msgstr "(bug)" + +msgid "missing mandatory arg" +msgstr "parametro mancante" + +msgid "release number: unsupported format" +msgstr "release: formato non supportato" + +msgid "checking" +msgstr "sto controllando" + +msgid "running test" +msgstr "esecuzione test" + +msgid "skipped" +msgstr "ignorato" + +msgid "does not point to a valid internet address" +msgstr "non fa riferimento ad un indirizzo internet" + +msgid "not a standard structure (see config file)" +msgstr "nome con struttura non standard (vedi configurazione)" + +msgid "found \\`-D' and/or \\`-T' option(s) in the \\`%setup' directive" +msgstr "sospetta opzione \\`-D' e/o \\`-T' nella direttiva \\`%setup'" + +msgid "missing at least one \\`%defattr' directive" +msgstr "manca almeno una direttiva \\`%defattr'" + +msgid "use rpm macros if possible:" +msgstr "utilizzare le macro rpm quando possibile:" + +msgid "localization files must be packaged via \\`%find_lang'" +msgstr "trovati file di localizzazione non gestiti da \\`%find_lang'" + +msgid "Hint" +msgstr "Suggerimento" + +msgid "info pages" +msgstr "pagine info" + +msgid "info pages are not installed/uninstalled in the correct way" +msgstr "le pagine info non vengono installate/disinstallate correttamente" + +msgid "package Groups" +msgstr "campi Group dei pacchetti" + +msgid "invalid \\`Group'" +msgstr "\\`Group' non valido" + +msgid "see configuration files" +msgstr "guarda nei file di configurazione" + +msgid "or enter the command" +msgstr "oppure esegui il comando" + +msgid "approved License" +msgstr "Licenza valida" + +msgid "not approved \\`License'" +msgstr "\\`License' non approvata" + +msgid "illegal value for arg" +msgstr "valore non valido per l'argomento" + +msgid "\\`getopt' error" +msgstr "errore in \\`getopt'" + +msgid "\\`getopt' error: bad command \\`$1'" +msgstr "errore in \\`getopt': comando errato \\`$1'" + +msgid "can't create temporary files" +msgstr "impossibile creare file temporanei" + +msgid "can't create temporary directory" +msgstr "impossibile creare la cartella temporanea" + +msgid "command line architecture ignored, using:" +msgstr "ignoro l'architettura indicata ed uso:" + +msgid "unsupported architecture" +msgstr "architettura non supportata" + +msgid "missing package name" +msgstr "nome del pacchetto mancante" + +msgid "cannot create logging directory" +msgstr "impossibile creare la directory di logging" + +msgid "logging file" +msgstr "file di log" + +msgid "cannot evaluate:" +msgstr "impossibile valutare:" + +msgid "no action specified: set with \\`--action'" +msgstr "nessuna azione specificata: utilizzare \\`--action'" + +msgid "sintax error in --action \\`$4'" +msgstr "errore di instassi in --action \\`$4'" + +msgid "sintax error in the command" +msgstr "errore di sintassi nel comando" + +msgid "updating package ${NOTE}${pck_name##*/}${NORM} to version ${NOTE}${pck_newver:-[?]}${NORM}" +msgstr "aggiornamento del pacchetto ${NOTE}${pck_name##*/}${NORM} alla versione ${NOTE}${pck_newver:-[?]}${NORM}" + +msgid "updating package" +msgstr "aggiornamento del pacchetto" + +msgid "found too many candidates" +msgstr "trovati troppi pacchetti candidati" + +msgid "Repository" +msgstr "Archivio" + +msgid "Package(s)" +msgstr "Pacchetto" + +msgid "cannot find a matching SRPM package in the given repositories" +msgstr "impossibile trovare il pacchetto SRPM nei repository indicati" + +msgid "downloading" +msgstr "download di" + +msgid "got from" +msgstr "scaricato da" + +msgid "cannot download" +msgstr "impossibile scaricare" + +msgid "installing" +msgstr "installazione di" + +msgid "making a ${NOTE}backup copy${NORM} of the current specfile" +msgstr "creazione di una ${NOTE}copia di backup${NORM} dello specfile corrente" + +msgid "an error occurred while installing \\`$got_SPEC_FILENAME'" +msgstr "si รจ verificato un errore installando \\`$got_SPEC_FILENAME'" + +msgid "version for new package required" +msgstr "versione del nuovo pacchetto non indicata" + +msgid "check the specfile for common mistakes" +msgstr "controllo dello specfile alla ricerca di comuni errori" + +msgid "${NOTE}updating${NORM} the new specfile \\`${NOTE}$spec_dir/$SRPM_SPECFILE${NORM}'" +msgstr "${NOTE}aggiornamento${NORM} del nuovo specfile \\`${NOTE}$spec_dir/$SRPM_SPECFILE${NORM}'" + +msgid "specfile autoformattig enabled" +msgstr "formattazione automatica dello specfile abilitata" + +msgid "illegal \\`format_extra_rules' (see configuration file(s))" +msgstr "\\`format_extra_rules' non corretta (vedi file di configurazione)" + +msgid "missing entry forced" +msgstr "aggiunta voce mancante" + +msgid "missing entry in the specfile:" +msgstr "voce mancante nello specfile:" + +msgid "FIXME: sorry, not implemented yet..." +msgstr "FIXME: spiacente, implementazione mancante..." + +msgid "\\`%description' has empty body" +msgstr "trovata \\`%description' senza testo" + +msgid "parsing the \\`%package' block" +msgstr "parsing del blocco \\`%package'" + +msgid "cannot create \\`$spec_dir/$SRPM_SPECFILE'" +msgstr "impossibile creare \\`$spec_dir/$SRPM_SPECFILE'" + +msgid "build the srpm package" +msgstr "crea il pacchetto srpm" + +msgid "LD_LIBRARY_PATH is set" +msgstr "LD_LIBRARY_PATH รจ definita" + +msgid "PYTHONDONTWRITEBYTECODE is set" +msgstr "PYTHONDONTWRITEBYTECODE รจ definita" + +msgid "the version entered at command line doesn't match the version set in the specfile" +msgstr "versione specificata a linea di comando differente da quanto indicato nello specfile" + +msgid "the release entered at command line doesn't match the release set in the specfile" +msgstr "release specificata a linea di comando differente da quato indicato nello specfile" + +msgid "building the rpm packages" +msgstr "creazione dei pacchetti rpm" + +msgid "specfile is newer than rpm package(s) (according to modification date)" +msgstr "lo specfile รจ piรน recente del/dei pacchetto/i rpm" + +msgid "building the srpm package" +msgstr "creazione del pacchetto srpm" + +msgid "specfile is newer than srpm (according to modification date)" +msgstr "lo specfile รจ piรน recente del file srpm" + +msgid "build requirement found" +msgstr "trovato build requirement" + +msgid "installing missing build requirement" +msgstr "installazione del \"build requirement\"" + +msgid "cannot install the needed build requirements" +msgstr "impossibile installare i \"build requirement\" necessari" + +msgid "found ${NOTE}missing BuildRequirement${NORM} \\`${NOTE}$f${NORM}'" +msgstr "trovato ${NOTE}BuildRequirement non soddisfatto${NORM} \\`${NOTE}$f${NORM}'" + +msgid "testing out specfile" +msgstr "esecuzione dei test sullo specfile" + +msgid "rpmbuild exited with error code \\`$?'" +msgstr "rpmbuild รจ terminato con il codice d'errore \\`$?'" + +msgid "building rpm and srpm packages" +msgstr "creazione dei pacchetti rpm e srpm" + +msgid "release for new package required" +msgstr "release del nuovo pacchetto non indicata" + +msgid "package not found" +msgstr "pacchetto non trovato" + +msgid "rpm exited with error code:" +msgstr "rpm รจ terminato con il codice di errore:" + +msgid "cannot extract files from rpm archive" +msgstr "impossibile estrarre i file dall'archivio rpm" + +msgid "cannot extract files from cpio archive" +msgstr "impossibile estrarre i file dall'archivio cpio" + +msgid "server unreachable" +msgstr "server non raggiungibile" + +msgid "you have no read write access to url#$ftp_server_upload_num" +msgstr "accesso in scrittura alla url#$ftp_server_upload_num vietato" + +msgid "unset in the configuration files" +msgstr "non configurato nei file di configurazione" + +msgid "ftp upload has been disabled" +msgstr "l'upload dei pacchetti via ftp รจ stato disabilitato" + +msgid "trying with the ${NOTE}anonymous login${NORM}" +msgstr "provo ad utilizzare un ${NOTE}login anonimo${NORM}" + +msgid "no old packages have been found." +msgstr "non sono stati trovati vecchi pacchetti." + +msgid "moving old packages to the remote backup folder" +msgstr "sposto i vecchi pacchetti nella directory di backup del repository" + +msgid "removing old packages from the repository" +msgstr "rimozione dei vecchi pacchetti dal sito" + +msgid "force enabled" +msgstr "forzata" + +msgid "cannot install the new rpm packages" +msgstr "impossibile installare i pacchetti rpm" + +msgid "unknown step \\`$step'" +msgstr "lo step \\`$step' non esiste" + +msgid "cleaning up temporary files" +msgstr "eliminazione dei file temporanei" + +msgid "removing source packages and patches, if any" +msgstr "rimozione dei pacchetti sorgente e delle patch, se presenti" + +msgid "removing" +msgstr "rimozione di" diff --git a/po/it/spec-create.po b/po/it/spec-create.po new file mode 100644 index 0000000..6c7cb38 --- /dev/null +++ b/po/it/spec-create.po @@ -0,0 +1,206 @@ +# translation of it.po to Italiana +# Copyright (C) 2004-2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2004-09-01 22:48+0200\n" +"PO-Revision-Date: 2005-11-05 18:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +msgid "this script requires bash version 3 or better" +msgstr "questo script richiede bash versione 3 o superiore" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "" +"This program is free software; you can redistribute it and/or modify it under\n" +"the terms of the GNU General Public License version 2 as published by the\n" +"Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY\n" +"or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" +"Questo รจ software libero; รจ possibile redistribuirlo e/o modificarlo nei termini\n" +"della GNU General Public License versione 2 cosรฌ come pubblicata dalla\n" +"Free Software Foundation. Non รจ fornita ALCUNA garanzia; neppure di NEGOZIABILITA'\n" +"o di APPLICABILITA' PER UN PARTICOLARE SCOPO." + +msgid "Try to create a specfile for the specified source archive" +msgstr "Cerca di creare uno specfile per l'archivio sorgente indicato" + +msgid "Usage" +msgstr "Utilizzo" + +msgid "where the above options mean" +msgstr "dove le precedenti opzioni significano" + +msgid "Name of the package (default: taken from name)" +msgstr "Nome del pacchetto (default: ricavato dal nome dell'archivio sorgente)" + +msgid "Version of the package (default: taken from name)" +msgstr "Versione del pacchetto (default: ricavato dal nome dell'archivio sorgente)" + +msgid "Typology of the specfile to be created" +msgstr "Categoria dello specfile da generare" + +msgid "standard specfile (default)" +msgstr "specfile standard (default)" + +msgid "specfile for gnome packages" +msgstr "specfile per pacchetti gnome" + +msgid "specfile for kde3 packages" +msgstr "specfile per pacchetti kde3" + +msgid "specfile for kde4 packages" +msgstr "specfile per pacchetti kde4" + +msgid "specfile for common library packages" +msgstr "specfile per librerie" + +msgid "specfile for single-package perl modules" +msgstr "specfile per singoli moduli perl" + +msgid "specfile for python modules" +msgstr "specfile per moduli python" + +msgid "standard specfile for system/network services" +msgstr "specfile per servizi di sistema/rete" + +msgid "Redirect the output to the file " +msgstr "Redirige lo standard output sul file " + +msgid "Operation modes" +msgstr "Modalitร  operative" + +msgid "Print this help, then exit" +msgstr "Stampa questa schermata di aiuto e termina il programma" + +msgid "Print version number, then exit" +msgstr "Stampa il numero di versione e termina il programma" + +msgid "Run in quiet mode" +msgstr "Non stampa alcun dettaglio delle operazioni in esecuzione" + +msgid "Enable the colorized output" +msgstr "Abilita l'output colorato" + +msgid "Run in debugging mode (very verbose output)" +msgstr "Attiva la modalitร  di debugging (output prolisso)" + +msgid "Samples" +msgstr "Alcuni esempi" + +msgid "Report bugs to ." +msgstr "Segnalare eventuali bug a ." + +msgid "cannot read" +msgstr "impossibile leggere" + +msgid "unrecognized option" +msgstr "opzione non conosciuta" + +msgid "utility not found" +msgstr "programma non trovato" + +msgid "info-page" +msgstr "pagina-info" + +msgid "(bug)" +msgstr "(bug)" + +msgid "illegal arg#1 for \\`$FUNCNAME'" +msgstr "argomento #1 per \\`$FUNCNAME' non lecito" + +msgid "missing arg#2 in \\`$FUNCNAME $1'" +msgstr "argomento #2 in \\`$FUNCNAME $1' mancante" + +msgid "unknown build techonology" +msgstr "tecnologia di build sconosciuta" + +msgid "file not found" +msgstr "file non trovato" + +msgid "remember to modify the value for \\`${NOTE}$id${NORM}'" +msgstr "ricordarsi di modificare il valore di \\`${NOTE}$id${NORM}'" + +msgid "FIXME: sorry, not implemented yet..." +msgstr "FIXME: spiacente, implementazione mancante..." + +msgid "(see $templatedir)" +msgstr "(si veda $templatedir)" + +msgid "unknown specfile --type" +msgstr "\\`--type' indicato sconosciuto" + +msgid "skipped" +msgstr "ignorato" + +msgid "cannot download" +msgstr "impossibile scaricare" + +msgid "unsupported protocol" +msgstr "protocollo non supportato" + +msgid "missing tarball name" +msgstr "manca il nome del tarball" + +msgid "cannot find the package $pck_tarball" +msgstr "impossibile trovare il pacchetto $pck_tarball" + +msgid "cannot get the package name, use the \\`-n' option" +msgstr "impossibile ricavare il nome del pacchetto, usa l'opzione \\`-n'" + +msgid "invalid version number" +msgstr "numero di versione non valido" + +msgid "cannot get the package version, use the \\`-v' option" +msgstr "impossibile ricavare la versione del pacchetto, usa l'opzione \\`-v'" + +msgid "output file" +msgstr "file di output" + +msgid "can't create output file" +msgstr "impossibile creare il file di output" + +msgid "generating specfile" +msgstr "generazione dello specfile" + +msgid "source" +msgstr "sorgente" + +msgid "mode" +msgstr "modo" + +msgid "libraries must have this name structure (use \\`-n'):" +msgstr "i nomi delle librerie devono avere questa struttura (usare \\`-n'):" + +msgid "perl modules must have this name structure (use \\`-n'):" +msgstr "i nomi dei moduli perl devono avere questa struttura (usare \\`-n'):" + +msgid "python modules must have this name structure (use \\`-n'):" +msgstr "i nomi dei moduli python devono avere questa struttura (usare \\`-n'):" + +msgid "can't create temporary directory" +msgstr "impossibile creare directory temporanee" + +msgid "unsupported package compression method" +msgstr "metodo di compressione del pacchetto non supportato" + +msgid "neither \\`Makefile' nor \\`Makefile.in' has been found" +msgstr "\\`Makefile' e \\`Makefile.in' non trovati" + +msgid "looks like a perl package (use \\`-t perl' if this is true)" +msgstr "sembra un pacchetto perl (in questo caso usa \\`-t perl')" + +msgid "looks like a python module (use \\`-t python' if this is true)" +msgstr "sembra un modulo python (in questo caso usa \\`-t python')" + +msgid "created specfile" +msgstr "creato specfile" diff --git a/po/it/test01_pkgquality.po b/po/it/test01_pkgquality.po new file mode 100644 index 0000000..aad1f30 --- /dev/null +++ b/po/it/test01_pkgquality.po @@ -0,0 +1,104 @@ +# translation of it.po to Italiana +# Copyright (C) 2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2008-10-28 22:00+0100\n" +"PO-Revision-Date: 2008-10-28 22:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# tests/pkg_security_test_001 + +msgid "this script requires bash version 2 or better" +msgstr "questo script richiede bash versione 2 o superiore" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "performing quality checks" +msgstr "esecuzione dei test di qualitร " + +msgid "\\`getopt' error" +msgstr "errore in \\`getopt'" + +msgid "(bug)" +msgstr "(bug)" + +msgid "missing mandatory arg" +msgstr "parametro mancante" + +msgid "cannot read" +msgstr "impossibile leggere" + +msgid "no such file or directory" +msgstr "file o cartella non trovata" + +msgid "checking for wrong symbolic links" +msgstr "ricerca di link simbolici errati" + +msgid "empty string" +msgstr "stringa vuota" + +msgid "checking" +msgstr "controllo" + +msgid "checking for \\`$SPEC_BUILDROOT' (%buildroot) strings" +msgstr "ricerca della stringa \\`$SPEC_BUILDROOT' (%buildroot)" + +msgid "skipped" +msgstr "ignorato" + +msgid "checking for \\`$BUILDDIR' (%_builddir) strings" +msgstr "ricerca della stringa \\`$BUILDDIR' (%_builddir)" + +msgid "checking for suspicious plugins in devel packages" +msgstr "controllo di plugin sospetti nei pacchetti devel" + +msgid "found suspect plugin \\`${NOTE}$f${NORM}'" +msgstr "trovato sospetto plugin \\`${NOTE}$f${NORM}'" + +msgid "checking for wrong file attributes in bin and lib directories" +msgstr "ricerca di file binari e librerie con permessi errati" + +msgid "found suspect file" +msgstr "file sospetto" + +msgid "Hint" +msgstr "Suggerimento" + +msgid "checking for binary files installed in /etc (see FHS)" +msgstr "ricerca di file binari installati in /etc (vedi FHS)" + +msgid "checking if the info catalog is updated when necessary" +msgstr "controllo se il registro delle pagine info viene aggiornato" + +msgid "info pages should be installed/uninstalled" +msgstr "le pagine info dovrebbero essere installate/disinstallate" + +msgid "checking packages for wrong user and/or group ownerships" +msgstr "ricerca di pacchetti contenenti file con errato utente e/o gruppo" + +msgid "package not found" +msgstr "pacchetto non trovato" + +msgid "checking packages for desktop files installed in the applnk dir" +msgstr "ricerca di pacchetti con file desktop installati in applnk" + +msgid "create desktop files for:" +msgstr "creare file desktop per:" + +msgid "see:" +msgstr "vedere:" + +msgid "checking for packages with bad BuildArch tag" +msgstr "ricerca di pacchetti con errato tag BuildArch" + +msgid "this package should be tagged \\`noarch'" +msgstr "questo pacchetto dovrebbe essere di tipo \\`noarch'" diff --git a/po/it/test02_pkgsecurity.po b/po/it/test02_pkgsecurity.po new file mode 100644 index 0000000..ee4fd65 --- /dev/null +++ b/po/it/test02_pkgsecurity.po @@ -0,0 +1,62 @@ +# translation of it.po to Italiana +# Copyright (C) 2008 Davide Madrisan +# Davide Madrisan + +msgid "" +msgstr "" +"Project-Id-Version: it\n" +"POT-Creation-Date: 2008-10-28 22:00+0100\n" +"PO-Revision-Date: 2008-10-28 22:03+0100\n" +"Last-Translator: Davide Madrisan \n" +"Language-Team: Italiana \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" + +# tests/pkg_security_test_001 + +msgid "this script requires bash version 2 or better" +msgstr "questo script richiede bash versione 2 o superiore" + +msgid "library not found" +msgstr "libreria non trovata" + +msgid "performing security checks" +msgstr "esecuzione dei test di sicurezza" + +msgid "\\`getopt' error" +msgstr "errore in \\`getopt'" + +msgid "(bug)" +msgstr "(bug)" + +msgid "missing mandatory arg" +msgstr "parametro mancante" + +msgid "cannot read" +msgstr "impossibile leggere" + +msgid "no such file or directory" +msgstr "file o cartella non trovata" + +msgid "checking for RPATH vulnerabilities" +msgstr "ricerca di vulnerabilitร  di tipo RPATH" + +msgid "checking" +msgstr "controllo" + +msgid "checking for setuid binaries" +msgstr "ricerca di binari setuid" + +msgid "checking for unsecure use of \\`\\$\\$' in shell and perl scripts" +msgstr "ricerca di script shell e perl che utilizzano \\`\\$\\$' in modo insicuro" + +msgid "seems to be affected" +msgstr "sembra affetto" + +msgid "Hint for bash scripts (\\`mktemp' required)" +msgstr "Suggerimento per script bash (richiede \\`mktemp')" + +msgid "Hint for perl scripts" +msgstr "Suggerimento per script perl" diff --git a/templates/Makefile b/templates/Makefile new file mode 100644 index 0000000..e9a6c01 --- /dev/null +++ b/templates/Makefile @@ -0,0 +1,36 @@ +# Makefile for autospec +# Copyright (C) 2008,2011 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +srcdir = .. + +include $(srcdir)/Makefile.env + +pck_templates := gnome kde3 kde4 library perl python standard standard-daemon + +all: + +install: $(pck_templates) + @$(INSTALL_DIR) $(DESTDIR)$(templatedir) + for f in $(pck_templates); do\ + $(INSTALL_DATA) $${f} $(DESTDIR)$(templatedir)/$${f};\ + done + +uninstall: + for f in $(pck_templates); do\ + rm -f $(DESTDIR)$(templatedir)/$${f};\ + done + +clean: diff --git a/templates/gnome b/templates/gnome new file mode 100644 index 0000000..6651eae --- /dev/null +++ b/templates/gnome @@ -0,0 +1,69 @@ +%define gnomever n1.n2.n3 + +%define gnomemajver %(echo %gnomever | cut -d. -f 1-2) +%define gnomegroup ... +%define pkgname ... + +Name: %{pkgname} +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... +Group: ... +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: @packager_fullname@ <@packager_email@> +URL: http://www.gnome.org +# bugfixes: http://ftp.acc.umu.se/pub/GNOME/sources/%{pkgname}-*.tar.bz2 +Source: http://ftp.gnome.org/pub/GNOME/%{gnomegroup}/%{gnomemajver}/%{gnomever}/sources/%{pkgname}-%{version}.tar.bz2 +License: GPL +## AUTOBUILDREQ-BEGIN +## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements. +## AUTOBUILDREQ-END +BuildRequires: gtk-doc +BuildRoot: @rpm_default_buildroot@ + +%description +... + +@if:library_apidocs +%package apidocs +Summary: %{pkgname} API documentation +Group: Documentation +Requires: gtk-doc + +%description apidocs +%{pkgname} API documentation. +@fi:library_apidocs + +%prep +%setup -q -n %{pkgname}-%{version} + +%build +@if:library_apidocs +@configure@ --enable-gtk-doc +@else:library_apidocs +@configure@ +@fi:library_apidocs +@make@ + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +@makeinstall@ + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +@standard_docs@ + +@if:library_apidocs +%files apidocs +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_datadir}/gtk-doc/html/%{name} +@fi:library_apidocs + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@ diff --git a/templates/kde3 b/templates/kde3 new file mode 100644 index 0000000..54cb1fb --- /dev/null +++ b/templates/kde3 @@ -0,0 +1,42 @@ +Name: @pck_name@ +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... +Group: ... +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: $packager_fullname <$packager_email> +URL: ... +Source: ... +#Patch0: %{name}--.patch +License: ... +## AUTOBUILDREQ-BEGIN +## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements. +## AUTOBUILDREQ-END +BuildRoot: @rpm_default_buildroot@ + +%description +... + +%prep +%setup -q +#%patch0 -p1 + +%build +%configure_kde +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +@standard_docs@ + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@ diff --git a/templates/kde4 b/templates/kde4 new file mode 100644 index 0000000..a810b0a --- /dev/null +++ b/templates/kde4 @@ -0,0 +1,113 @@ +Name: @pck_name@ +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... +Group: ... +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: @packager_fullname@ <@packager_email@> +URL: http://www.kde.org +Source: ... +#Patch0: %{name}--.patch +License: ... +BuildRequires: cmake +BuildRequires: libqt4-devel +BuildRequires: kdelibs4-devel +## AUTOBUILDREQ-BEGIN +## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements. +## AUTOBUILDREQ-END +Requires: kdelibs4 +Requires: kdebase-runtime +BuildRoot: @rpm_default_buildroot@ + +%description +... + +%prep +%setup -q +#%patch0 -p1 + +%build +%cmake_kde4 -d build +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall -C build + +@if:i18n +%find_lang %{name} --all-name --with-kde +@fi:i18n + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post +@if:shared_libraries +## remove the following line if no dynamic libraries are provided by this package +/sbin/ldconfig +@fi:shared_libraries +@if:icons_mimetypes +touch --no-create %{_kde4_icondir}/hicolor &>/dev/null +touch --no-create %{_kde4_icondir}/oxygen &>/dev/null +@fi:icons_mimetypes +exit 0 + +@if:icons_mimetypes +%posttrans +@fi:icons_mimetypes +@if:shared_libraries +## remove the following line if no dynamic libraries are provided by this package +/sbin/ldconfig +@fi:shared_libraries +@if:icons_mimetypes +update-desktop-database -q &>/dev/null +update-mime-database %{_kde4_mimedir} &>/dev/null +gtk-update-icon-cache %{_kde4_icondir}/hicolor &>/dev/null +gtk-update-icon-cache %{_kde4_icondir}/oxygen &>/dev/null +exit 0 +@fi:icons_mimetypes + +%postun +@if:shared_libraries +## remove the following line if no dynamic libraries are provided by this package +/sbin/ldconfig +@fi:shared_libraries +@if:icons_mimetypes +if [ $1 -eq 0 ]; then +\ update-desktop-database -q &>/dev/null +\ update-mime-database %{_kde4_mimedir} &>/dev/null +\ touch --no-create %{_kde4_icondir}/hicolor &>/dev/null +\ touch --no-create %{_kde4_icondir}/oxygen &>/dev/null +\ gtk-update-icon-cache %{_kde4_icondir}/hicolor &>/dev/null +\ gtk-update-icon-cache %{_kde4_icondir}/oxygen &>/dev/null +fi +@fi:icons_mimetypes +exit 0 + +@if:i18n +%files -f %{name}.lang +@else:i18n +%files +@fi:i18n +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_kde4_bindir}/%{name} +# %{_kde4_datadir}/%{name} +# %{_kde4_dbusinterfacesdir}/org.kde.*.xml +# %{_kde4_kcfgdir}/*.kcfg +# %{_kde4_libdir}/kde4/*.so +# %{_kde4_icondir}/hicolor/*/*/*.png +# %{_kde4_icondir}/oxygen/*/*/*.png +# %{_kde4_icondir}/oxygen/scalable/*/*.svgz +# %{_kde4_xdgappsdir}/*.desktop +# %{_kde4_servicesdir}/*.desktop +# %config %{_kde4_configdir}/*.knsrc +# %doc %lang(en) %{_kde4_htmldir}/en/%{name} +## note: "man3" pages normally goes to devel package if any +# %{_mandir}/man?/%{name}.* +@standard_docs@ + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@ diff --git a/templates/library b/templates/library new file mode 100644 index 0000000..3faefe7 --- /dev/null +++ b/templates/library @@ -0,0 +1,137 @@ +Name: @pck_name@ +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... +Group: System/Libraries +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: @packager_fullname@ <@packager_email@> +URL: ... +Source: ... +#Patch0: %{name}--.patch +License: ... +## AUTOBUILDREQ-BEGIN +## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements. +## AUTOBUILDREQ-END +@if:infopages +Requires(post): %{__install_info} +@fi:infopages +BuildRoot: @rpm_default_buildroot@ + +%description +... + +%package devel +Group: Development/Libraries +Summary: Static libraries and headers for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description devel +... +This package contains static libraries and header files need for development. + +@if:pck_tools +%package tools +Group: Applications/... +Summary: Utility applications for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description tools +The %{name}-tools package contains utility applications for %{name}. +@fi:pck_tools + +@if:pck_apidocs +%package apidocs +Group: Documentation +Summary: %{name} API documentation +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: gtk-doc + +%description apidocs +This package includes the %{name} API documentation. +@fi:pck_apidocs + +%prep +%setup -q +#%patch0 -p1 + +%build +@if:pck_apidocs +@configure@ --enable-gtk-doc +@else:pck_apidocs +@configure@ +@fi:pck_apidocs +@make@ + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +@makeinstall@ + +@if:i18n +%find_lang %{name} +@fi:i18n + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +@if:infopages +%post devel +## modify the infopage name as required +%install_info %{name}.info +exit 0 + +%preun devel +## modify the infopage name as required +%uninstall_info %{name}.info +exit 0 +@fi:infopages + +@if:i18n +%files -f %{name}.lang +@else:i18n +%files +@fi:i18n +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_libdir}/*.so.* +# %{_mandir}/man1/* +@standard_docs@ + +%files devel +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_bindir}/%{name}-config +# %{_datadir}/aclocal/*.m4 +# %{_includedir}/*.h +# %{_includedir}/%{name} +# %{_libdir}/*.a +# %{_libdir}/*.la +# %{_libdir}/*.so +# %{_libdir}/pkgconfig/*.pc +# %{_mandir}/man3/* +@if:infopages +# %{_infodir}/*.info.* +@fi:infopages + +@if:pck_tools +%files tools +%defattr(-,root,root) +## note: list all the binaries but %{name}-config +# %{_bindir}/... +## note: usually there's a manpages for each tool +# %{_mandir}/man1/* +@fi:pck_tools + +@if:pck_apidocs +%files apidocs +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_datadir}/gtk-doc/html/%{name} +@fi:pck_apidocs + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@ diff --git a/templates/perl b/templates/perl new file mode 100644 index 0000000..faaa4c2 --- /dev/null +++ b/templates/perl @@ -0,0 +1,58 @@ +%define perl_major_ver %(eval `perl -V:version`; echo ${version%*.[0-9]*}.0) + +Name: @pck_name@ +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... - ... +Group: System/Libraries/Perl +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: @packager_fullname@ <@packager_email@> +URL: http://www.cpan.org +Source: http://www.cpan.org/modules/by-module/... +#Patch0: %{name}--.patch +License: GPL, Artistic +## AUTOBUILDREQ-BEGIN +## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements. +## AUTOBUILDREQ-END +BuildRequires: perl-devel +Requires: perl >= %perl_major_ver +BuildRoot: @rpm_default_buildroot@ + +%description +... + +%prep +%setup -q +#%patch0 -p1 + +%build +%{__perl} Makefile.PL PREFIX=%{_prefix} INSTALLDIRS=vendor OPTIMIZE="%{optflags}" + +%make +%make test + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall_perl + +packlist=`find %{buildroot} -name .packlist` +[ -z "$packlist" ] && exit 1 || cat $packlist | \\ +\ sed "s,%{buildroot},,g;s,.*/man/.*,&.gz,g" | \\ +\ sort -u > .packlist && rm -f $packlist + +strid=`echo $packlist | sed 's,.*auto\\(.*\\)/.packlist,\\1,'` +for dir in `find %{buildroot} -type d | grep $strid`; do +\ echo "%dir ${dir#%buildroot}" >> .packlist +done + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files -f .packlist +%defattr(-,root,root) +@standard_docs@ + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@ diff --git a/templates/python b/templates/python new file mode 100644 index 0000000..e4733f7 --- /dev/null +++ b/templates/python @@ -0,0 +1,48 @@ +Name: @pck_name@ +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... +Group: System/Libraries +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: @packager_fullname@ <@packager_email@> +URL: ... +Source: ... +#Patch0: %{name}--.patch +License: ... +## AUTOBUILDREQ-BEGIN +## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements. +## AUTOBUILDREQ-END +BuildRequires: libpython-devel +Requires: python >= %python_version +BuildRoot: @rpm_default_buildroot@ + +%description +... + +%prep +%setup -q +#%patch0 -p1 + +%build +CFLAGS="%{optflags}" %{__python} setup.py build + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%{__python} setup.py install \\ +\ -O1 --skip-build \\ +\ --root="%{buildroot}" \\ +\ --install-headers=%{_includedir}/python \\ +\ --install-lib=%{python_sitearch} \\ +\ --single-version-externally-managed \\ +\ --record=%{name}.filelist + +sed -i "\\,\\.egg-info/,d;s,.*/man/.*,&.gz," %{name}.filelist + +%files -f %{name}.filelist +%defattr(-,root,root) +@standard_docs@ + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@ diff --git a/templates/standard b/templates/standard new file mode 100644 index 0000000..99b7540 --- /dev/null +++ b/templates/standard @@ -0,0 +1,95 @@ +Name: @pck_name@ +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... +Group: ... +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: @packager_fullname@ <@packager_email@> +URL: ... +Source: ... +#Patch0: %{name}--.patch +License: ... +## AUTOBUILDREQ-BEGIN +## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements. +## AUTOBUILDREQ-END +@if:infopages +Requires(post): %{__install_info} +@fi:infopages +BuildRoot: @rpm_default_buildroot@ + +%description +... + +@if:pck_apidocs +%package apidocs +Group: Documentation +Summary: %{name} API documentation +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: gtk-doc + +%description apidocs +This package includes the %{name} API documentation. +@fi:pck_apidocs + +%prep +%setup -q +#%patch0 -p1 + +%build +@if:pck_apidocs +@configure@ --enable-gtk-doc +@else:pck_apidocs +@configure@ +@fi:pck_apidocs +@make@ + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +@makeinstall@ + +@if:i18n +%find_lang %{name} +@fi:i18n + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +@if:infopages +%post devel +## modify the infopage name as required +%install_info %{name}.info +exit 0 + +%preun devel +## modify the infopage name as required +%uninstall_info %{name}.info +exit 0 +@fi:infopages + +@if:i18n +%files -f %{name}.lang +@else:i18n +%files +@fi:i18n +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_bindir}/%{name} +# %{_datadir}/%{name} +# %config(noreplace) %{_sysconfdir}/sysconfig/%{name} +# %{_mandir}/man?/* +@if:infopages +# %{_infodir}/*.info.* +@fi:infopages +@standard_docs@ + +@if:pck_apidocs +%files apidocs +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_datadir}/gtk-doc/html/%{name} +@fi:pck_apidocs + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@ diff --git a/templates/standard-daemon b/templates/standard-daemon new file mode 100644 index 0000000..040b3ab --- /dev/null +++ b/templates/standard-daemon @@ -0,0 +1,119 @@ +Name: @pck_name@ +Version: @pck_version@ +Release: @spec_first_release@@DISTRO_rpm@ +Summary: ... +Group: ... +Vendor: @VENDOR@ +Distribution: @DISTRO@ +Packager: @packager_fullname@ <@packager_email@> +URL: ... +Source: ... +#Patch0: %{name}--.patch +License: ... +## AUTOBUILDREQ-BEGIN +## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements. +## AUTOBUILDREQ-END +@if:infopages +Requires(post): %{__install_info} +@fi:infopages +BuildRoot: @rpm_default_buildroot@ + +%description +... + +@if:pck_apidocs +%package apidocs +Group: Documentation +Summary: %{name} API documentation +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: gtk-doc + +%description apidocs +This package includes the %{name} API documentation. +@fi:pck_apidocs + +%prep +%setup -q +#%patch0 -p1 + +%build +@if:pck_apidocs +@configure@ --enable-gtk-doc +@else:pck_apidocs +@configure@ +@fi:pck_apidocs +@make@ + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +@makeinstall@ + +@if:i18n +%find_lang %{name} +@fi:i18n + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%pre +/usr/sbin/useradd -s /bin/false -r -d \\ +\ -c "service description" &>/dev/null || : + +%post +if [ $1 -eq 1 ]; then +\ /sbin/chkconfig --add +\ /sbin/service start +fi +exit 0 + +%preun +if [ $1 -eq 0 ]; then +\ /sbin/service stop &>/dev/null || : +\ /sbin/chkconfig --del +fi +exit 0 + +%postun +if [ $1 -ge 1 ]; then +\ /sbin/service condrestart &>/dev/null || : +fi +exit 0 + +@if:infopages +%post devel +## modify the infopage name as required +%install_info %{name}.info +exit 0 + +%preun devel +## modify the infopage name as required +%uninstall_info %{name}.info +exit 0 +@fi:infopages + +@if:i18n +%files -f %{name}.lang +@else:i18n +%files +@fi:i18n +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_bindir}/%{name} +# %{_datadir}/%{name} +# %config(noreplace) %{_sysconfdir}/sysconfig/%{name} +# %{_mandir}/man?/* +@if:infopages +# %{_infodir}/*.info.* +@fi:infopages +@standard_docs@ + +@if:pck_apidocs +%files apidocs +%defattr(-,root,root) +## note: this list is just an example; modify as required +# %{_datadir}/gtk-doc/html/%{name} +@fi:pck_apidocs + +%changelog +* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@ +- @spec_changelog_comment@ diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..e570f95 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,45 @@ +# Makefile for autospec +# Copyright (C) 2008 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +srcdir = .. + +include $(srcdir)/Makefile.env + +pck_tests := test01_pkgquality test02_pkgsecurity +pck_tests_infiles := $(wildcard *.in) + +all: + +check: $(pck_tests) + @for f in $(pck_tests); do\ + echo -n "checking $$f... ";\ + bash -n $$f \ + && echo "[PASSED]" || { echo "[FAILED]"; exit 1; };\ + done + +install: $(pck_tests) + @$(INSTALL_DIR) $(DESTDIR)$(testdir) + for f in $(pck_tests); do\ + $(INSTALL_SCRIPT) $${f} $(DESTDIR)$(testdir)/$${f};\ + done + +uninstall: + for f in $(pck_tools); do\ + rm -f $(DESTDIR)$(tooldir)/$${f};\ + done + +clean: + rm -f $(patsubst %.in,%,$(pck_tests_infiles)) diff --git a/tests/test01_pkgquality.in b/tests/test01_pkgquality.in new file mode 100644 index 0000000..d3a8850 --- /dev/null +++ b/tests/test01_pkgquality.in @@ -0,0 +1,367 @@ +#!/bin/bash +# test01_pkgquality -- @package@ test (rpm quality checks) +# Copyright (C) 2008 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } + +. @libdir@/libmsgmng.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="test01_pkgquality"; export TEXTDOMAIN + +function alltests() { + # FIXME: add to 'po' file + notify.note "** ${NOTE}"$"performing quality checks""${NORM}""..." + + TEMP=`LANG=C getopt \ + -o i:t: --long infofile:,tmpdir: \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || return 1 + eval set -- "$TEMP" + + while :; do + case "$1" in + -i|--infofile) + rpminfofile="$2" + shift + ;; + -t|--tmpdir) + tmpextractdir="$2" + shift + ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error" ;; + esac + shift + done + + [ "$rpminfofile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--infofile)" + [ -r "$rpminfofile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"cannot read"" \`$rpminfofile'" + + . $rpminfofile + + [ "$tmpextractdir" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--tmpdir)" + [ -d "$tmpextractdir" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"no such file or directory"" \`$tmpextractdir'" + + # check for broken symlinks + # - symlinks to files in the buildroot directory for rpm + # (usable for a symlink attacks) + # - symlinks not pointing to existing files + notify.note \ +" * ${NOTE}"$"checking for wrong symbolic links""${NORM}..." + + # local rpmbuildroot=`sed -n "/%description/q;{ + # /^BuildRoot[ ]*:/{s/[^ ]*[ ]*//;p}}" \ + # $spec_dir/$SRPM_SPECFILE | \ + # sed "s,%[{]*name[}]*,$SPEC_NAME, + # s,%[{]*version[}]*,$SPEC_VERSION, + # s,%[{]*_tmppath[}]*,$tmppath_dir,;p"` + + # FIXME: 'tmppath_dir' should be get from configuration files + tmppath_dir=`rpm --eval %_tmppath 2>/dev/null` + + [ "$tmppath_dir" ] || + notify.error $"(bug)"" -- $FUNCNAME: ""empty string"" (tmppath_dir)" + + notify.debug "tmppath_dir = $tmppath_dir" + + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + pushd $tmpextractdir/$i >/dev/null + for f in $(find -mindepth 1 -type l); do + notify.debug "$f --> `readlink $f`" + # FIXME: the check fails if 'BuildRoot' doesn't start + # by '%_{tmppath}' + # note: the first condition check for wrong links, like + # /usr/share/man/man1/zcmp.1.gz -> .gz + # made by the broken `brp-compress' script in rpm 4.0.4 + [[ "$(readlink $f)" = ".gz" || \ + "$(readlink $f)" =~ $tmppath_dir ]] && notify.warning $"\ +wrong symlink"": \`${NOTE}${f/./}${NORM}' --> \`${NOTE}$(readlink $f)${NORM}'" + done + popd >/dev/null + let "i += 1" + done +### + + # check for `%buildroot' strings + if [ "$rpm_ignores_buildroot" = 1 ]; then + notify.note \ +" * ${NOTE}"$"checking for \`$SPEC_BUILDROOT' (%buildroot) strings"\ +"${NORM}... "$"skipped" + else + notify.note \ + " * "$"checking for \`$SPEC_BUILDROOT' (%buildroot) strings" + + [ "$SPEC_BUILDROOT" ] || + notify.error \ + $"(bug)"" -- $FUNCNAME: ""empty string"" (SPEC_BUILDROOT)" + + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + find $tmpextractdir/$i -type f \ + -exec grep -ls "$SPEC_BUILDROOT" {} \; | \ + while read filename; do + notify.note " ${NOTE}$(\ +echo $filename | sed "s,$tmpextractdir/$i,," )${NORM}" + notify.note "$(\ +strings -a $filename | grep "^$SPEC_BUILDROOT" | sort -bu | \ +sed "s,$SPEC_BUILDROOT\(.*\), - [%buildroot]\1,")" + done + let "i += 1" + done + fi +### + + # check for `%_builddir' strings + BUILDDIR="$(rpm --eval=%_builddir 2>/dev/null)" + notify.note \ +" * ${NOTE}"$"checking for \`$BUILDDIR' (%_builddir) strings""${NORM}... " + + [ "$BUILDDIR" ] || + notify.error $"(bug)"" -- $FUNCNAME: ""empty string"" (BUILDDIR)" + + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + find $tmpextractdir/$i -type f \ + -exec grep -ls "$BUILDDIR" {} \; | \ + while read filename; do + notify.note " ${NOTE}$(\ +echo $filename | sed "s,$tmpextractdir/$i,," )${NORM}" + notify.note "$(\ +strings -a $filename | grep "$BUILDDIR" | sort -bu | \ +sed "s,$BUILDDIR,[%_builddir],g;s,.*, - &,")" + done + let "i += 1" + done +### + + # check for suspected plugins (.la, .so) in devel packages + # note: pure plugins must be in the main package, not in devel + notify.note " * ${NOTE}"$"\ +checking for suspicious plugins in devel packages""${NORM}..." + + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + # skip non devel packages + [[ "${pck##*/}" =~ -devel- ]] || { let "i += 1"; continue; } + + notify.note " - "$"checking"": \`${pck##*/}'" + + pushd $tmpextractdir/$i >/dev/null + # find *.so files that are not symlinks to dynamic libraries + for f in `\ +find -mindepth 1 -type f -name \*.so -exec file {} \; | \ +grep ' shared object,' | sed -n 's/.\(.*\):.*/\1/p'`; do + notify.warning $"found suspect plugin \`${NOTE}$f${NORM}'" + done + popd >/dev/null + let "i += 1" + done +### + + # check for wrong file attributes in lib and bin dirs + notify.note " * ${NOTE}"$"\ +checking for wrong file attributes in bin and lib directories""${NORM}..." + + warning=0 + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + pushd $tmpextractdir/$i >/dev/null + for f in $( find . -type f \ + \( -name '*.so*' -not -perm 755 \) -or \ + \( \( -path './bin/*' -or \ + -path './sbin/*' -or \ + -path './usr/bin/*' -or \ + -path './usr/sbin/*' \) \ + -not -perm -111 \) 2>/dev/null ); do + let "warning = 1" && + notify.warning $"found suspect file"": \ +\`${NOTE}${f/./}${NORM}' [$(ls -l "$f" | sed 's, .*,,')]" + done + let "i += 1" + popd >/dev/null + done + [[ $warning -eq 0 ]] || notify.note "\ +----------------------------- +${NOTE}"$"Hint"":${NORM} + # fixup strange shared library permissions + chmod 755 %{buildroot}%{_libdir}/*.so* + + %files + %defattr(-,root,root) + ... + %attr(0755,root,root) %{_bindir}/ +-----------------------------" +### + + # check for binary files in etc (see FHS-2.2) + notify.note " * ${NOTE}"$"\ +checking for binary files installed in /etc (see FHS)""${NORM}..." + + warning=0 + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + pushd $tmpextractdir/$i >/dev/null + for f in $( find ./etc -type f -perm +111 2>/dev/null ); do + case $f in + ./etc/rc.d/init.d/*) ;; + *) let "warning = 1" && + notify.warning $"found suspect file"": \ +\`${NOTE}${f/./}${NORM}' [$(ls -l "$f" | sed 's, .*,,')]" ;; + esac + done + popd >/dev/null + let "i += 1" + done + [ "$warning" = 0 ] || notify.note "\ +----------------------------- +${NOTE}"$"Hint"":${NORM} + %files + %defattr(-,root,root) + ... + %attr(0644,root,root) %{_sysconfdir}/<...file> +-----------------------------" #|| exit 1 +### + + # check for installation code needed by info pages + notify.note \ +" * ${NOTE}"$"checking if the info catalog is updated when necessary""${NORM}..." + + error=0 + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + [[ -e $pck ]] || notify.error $"package not found"": \`${pck##*/}'" + + [[ "$(rpm -p -ql $pck | + # FIXME: this check only works for FHS-compliant distros + grep "^$(rpm --eval %_infodir)")" ]] || + { let "i += 1"; continue; } # no info pages found + #notify.debug "$FUNCNAME: info page(s) found" + + [[ "$(rpm -p -q --scripts $pck | sed -n ' +/postinstall /,${/\/sbin\/install-info \/.*/p}')" ]] || let "error+=1" + + [[ "$(rpm -p -q --scripts $pck | sed -n ' +/preuninstall /,${/\/sbin\/install-info.*--[delete\|remove].*/p}')" ]] || \ + let "error+=1" + + [[ "$error" = "0" ]] || notify.warning "\ +"$"info pages should be installed/uninstalled""${NORM} +--------------------------------------- +${NOTE}"$"Hint"":${NORM} +$([[ "$rpm_macro_installinfo_binary" ]] && + echo "Requires(post):$rpm_macro_installinfo_binary" || + echo "Requires(post):${path_installinfo:-/sbin/install-info}") + +%post [] +$([[ "$rpm_macro_installinfo" ]] && + echo "$rpm_macro_installinfo %{name}.info" || + echo "${path_installinfo:-/sbin/install-info} %{name}.info") + +%preun [] +$([[ "$rpm_macro_uninstallinfo" ]] && + echo "$rpm_macro_uninstallinfo %{name}.info" || + echo "${path_installinfo:-/sbin/install-info} --delete %{name}.info") +exit 0 +---------------------------------------" + done +### + + # check packages for wrong user and/or group ownerships + notify.note " * ${NOTE}"$"\ +checking packages for wrong user and/or group ownerships""${NORM}..." + + error=0 + idun="$(id -un)" idgn="$(id -gn)" + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + [[ -e $pck ]] || notify.error $"\ +package not found"": \`${pck##*/}'" + ( LANG=C rpm -p -qlv $pck | \ + while read line; do + set -- $line + # FIXME : find a better check, perhaps using a range + # of uid reserved for users + [[ "$idun" = "$3" || "$idgn" = "$4" ]] && + notify.warning $"found suspect file"": \ +\`${NOTE}$9${NORM}' [uid:\`${NOTE}$3${NORM}', gid:\`${NOTE}$4${NORM}']" + done ) + done +### + + # check for desktop files installed in non standard applnk dir + notify.note " * ${NOTE}"$"\ +checking packages for desktop files installed in the applnk dir""${NORM}..." + + warning=0 + rpmdatadir=$(rpm --eval %_datadir 2>/dev/null) + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + pushd $tmpextractdir/$i >/dev/null + for f in $( find .${rpmdatadir} -type f 2>/dev/null ); do + case $f in + .${rpmdatadir}/applnk/*.desktop) + let "warning = 1" && + notify.warning $"found suspect file"": \ +\`${NOTE}${f/./}${NORM}' [$(ls -l "$f" | sed 's, .*,,')]" ;; + *) ;; + esac + done + popd >/dev/null + done + [ "$warning" = 0 ] || notify.note "\ +----------------------------- +${NOTE}"$"Hint"":${NORM} + "$"create desktop files for:"" ${rpmdatadir}/applications + "$"see:"" +-----------------------------" +### + + # check if a package that do not contains binaries is tagged noarch + notify.note \ +" * ${NOTE}"$"checking for packages with bad BuildArch tag""${NORM}..." + + warning=0 + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + pushd $tmpextractdir/$i >/dev/null + for f in $(find -mindepth 2 -perm +111 -type f \ + -exec file {} \; | grep -E "( ELF | library )"); do + notify.debug "found a ELF file: \`${NOTE}${f/./}${NORM}'" + let "warning = 1" + break + done + popd >/dev/null + done + if [ "$warning" = 0 ]; then + [ "$SPEC_BUILDARCH" = "noarch" ] || notify.warning "\ +"$"this package should be tagged \`noarch'"" +----------------------------- +${NOTE}"$"Hint"":${NORM} +BuildArch: noarch +-----------------------------" + fi +} diff --git a/tests/test02_pkgsecurity.in b/tests/test02_pkgsecurity.in new file mode 100644 index 0000000..90c315f --- /dev/null +++ b/tests/test02_pkgsecurity.in @@ -0,0 +1,149 @@ +#!/bin/bash +# test02_pkgsecurity -- @package@ test (rpm security checks) +# Copyright (C) 2008 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } + +. @libdir@/libmsgmng.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="test02_pkgsecurity"; export TEXTDOMAIN + +function alltests() { + # FIXME: add to 'po' file + notify.note "** ${NOTE}"$"performing security checks""${NORM}""..." + + TEMP=`LANG=C getopt \ + -o i:t: --long infofile:,tmpdir: \ + -n "$FUNCNAME" -- "$@"` + [ $? = 0 ] || return 1 + eval set -- "$TEMP" + + while :; do + case "$1" in + -i|--infofile) + rpminfofile="$2" + shift + ;; + -t|--tmpdir) + tmpextractdir="$2" + shift + ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error" ;; + esac + shift + done + + [ "$rpminfofile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--infofile)" + [ -r "$rpminfofile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"cannot read"" \`$rpminfofile'" + + . $rpminfofile + + [ "$tmpextractdir" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--tmpdir)" + [ -d "$tmpextractdir" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"no such file or directory"" \`$tmpextractdir'" + + + function security.filecheckrpath() { + # $1: file to check + # RPATH /usr/lib/.:/usr/lib/qt3/lib:/usr/lib:/usr/X11R6/lib + objdump -p $1 2>/dev/null | \ + sed -n '/RPATH/{s/.* \(.*\)/\1:/p}' | \ + while read -d: path; do + # try to discard false positive warnings + [[ "${allowed_libdirs}:" =~ ${path}: ]] || echo -n "$path " + done + } + + notify.note \ +" * ${NOTE}"$"checking for RPATH vulnerabilities""${NORM}..." + + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + pushd $tmpextractdir/$i >/dev/null + + # find ELF binaries (ELF 32-bit LSB executable) + # and libs (ELF 32-bit LSB shared object) + for f in $(find -mindepth 2 -perm +111 -type f); do + if [[ "$(file $f | grep " ELF ")" ]]; then + rpath="$(security.filecheckrpath $f)" + [[ "$rpath" ]] && notify.warning "${f/./}\nRPATH: $rpath" + fi + done + popd >/dev/null + let "i += 1" + done +### + + notify.note \ +" * ${NOTE}"$"checking for setuid binaries""${NORM}..." + + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + pushd $tmpextractdir/$i >/dev/null + # find setuid binaries + # NOTE: find output is different for normal and root users + for f in $(find -mindepth 2 -perm +111 -type f); do + [[ "$(file $f | grep " setuid ")" ]] && + notify.warning "${NOTE}${f/./}${NORM}" + done + popd >/dev/null + let "i += 1" + done +### + + # checking for unsecure use of $$ as random source in shell scripts + notify.note " * ${NOTE}"$"\ +checking for unsecure use of \`\$\$' in shell and perl scripts""${NORM}..." + + vulnerable=0 + let "i = 0" + for pck in ${rpmpkg_name[@]}; do + notify.note " - "$"checking"": \`${pck##*/}'" + pushd $tmpextractdir/$i >/dev/null + for f in $(find -mindepth 1 -perm +111 -type f); do + # we are interesting only in shell scripts + [[ "$(file $f | grep "shell script\|perl script")" ]] || + continue + # check for string like: + # - tmp=/tmp/zfoo.$$ + # - gzip -cdfq "$2" > /tmp/"$F".$$ + [[ \ +-n "$(grep $f -m1 -s -rl -e"[^[:space:]]*=.*\$\$")" || +-n "$(grep $f -m1 -s -rl -e">[[:space:]]*.*[[:space:]]*[^[:space:]]*\$\$")" ]] && + let "vulnerable = 1" && + notify.warning $"\ +seems to be affected"": \`${NOTE}${f/./}${NORM}'" + done + popd >/dev/null + let "i += 1" + done + [[ $vulnerable -eq 1 ]] && notify.note "\ +----------------------------- +${NOTE}"$"Hint for bash scripts (\`mktemp' required)"":${NORM} + tmpdir=\`mktemp -d /tmp/.XXXXXX\` || + { echo \"Cannot create directory \\\`\$tmpdir'. Aborting.\" >&2; exit 1; } + trap 'ret=\$?; rm -rf \$tmpdir && exit \$ret' 0 + trap '(exit $?); exit' 1 2 13 15 + tmpfile=\`env TMPDIR=\"\" mktemp -p \$tmpdir tmpfile.XXXXXX\` || + { echo \"Cannot create temporary file \\\`\$tmpfile'. Aborting.\" >&2; exit 1; } +${NOTE}"$"Hint for perl scripts"":${NORM} + use File::Temp qw/ tempfile /; + (\$fh,\$file) = tempfile ('.XXXXXX'); +-----------------------------" +} diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 0000000..0696ac2 --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,45 @@ +# Makefile for autospec +# Copyright (C) 2008 by Davide Madrisan + +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY, to the extent permitted by law; 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. + +srcdir = .. + +include $(srcdir)/Makefile.env + +pck_tools := autoupdate-perl_modules extract-specs kde4-flist2rpmvars +pck_tools_infiles := $(wildcard *.in) + +all: + +check: $(pck_tools) + @for f in $(pck_tools); do\ + echo -n "checking $$f... ";\ + bash -n $$f \ + && echo "[PASSED]" || { echo "[FAILED]"; exit 1; };\ + done + +install: $(pck_tools) + @$(INSTALL_DIR) $(DESTDIR)$(tooldir) + for f in $(pck_tools); do\ + $(INSTALL_SCRIPT) $${f} $(DESTDIR)$(tooldir)/$${f};\ + done + +uninstall: + for f in $(pck_tools); do\ + rm -f $(DESTDIR)$(tooldir)/$${f};\ + done + +clean: + rm -f $(patsubst %.in,%,$(pck_tools_infiles)) diff --git a/tools/autoupdate-perl_modules.in b/tools/autoupdate-perl_modules.in new file mode 100644 index 0000000..18e6551 --- /dev/null +++ b/tools/autoupdate-perl_modules.in @@ -0,0 +1,97 @@ +#!/bin/bash +# $autoupdate-perl_modules -- update all perl modules +# Copyright (C) 2005,2006 Davide Madrisan +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License version 2 as published by the +# Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. +# +# Report bugs to + + +# FIXME : WORK IN PROGRESS ... + + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +me=("${0##*/}" "0.1.1") + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + export LANG +fi +TEXTDOMAIN="@package@"; export TEXTDOMAIN + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } + +. @libdir@/libmsgmng.lib + +spec_dir=`rpm --eval %_specdir 2>/dev/null` +spec_changelog="automatically rebuild" + +eval $(autospec -q --eval=logging_dir) +[ "$logging_dir" ] || logging_dir="${tmppath_dir:-/var/tmp}/@package@" + +# FIXME : get the list of perl modules from the repository +# ftp://ftp.qilinux.it:21/pub/QiLinux/devel/SPECS + +# WARNING : this variable used for test only +mperl_lst="perl-Archive-Tar.spec" + +for mperl in $mperl_lst; do + autospec -u ${mperl/\.spec} -a1 + specfile.getvars SPEC_TARGET -s $spec_dir/$mperl_lst + + # FIXME : skip packages with multiple targets + [ "${SPEC_TARGET[*]}" = 1 ] || + { > $logging_dir/${mperl/\.spec}.skipped + continue; } + + # specfile fixes + + grep -q "%define PERL_VERSION %(eval" $spec_dir/$mperl && + { sed -i " +s,%define PERL_VERSION %(eval \`perl -V:version\`; echo \$version),\ +%define perl_major_ver %(eval \`perl -V:version\`; echo \${version%*.[0-9]*}.0), +s,%PERL_VERSION,%{perl_major_ver},g +s,%{PERL_VERSION},%{perl_major_ver},g" $spec_dir/$mperl + tempfile=`mktemp -q specfile.XXXXXXXX` || + notify.error $"can't create temporary files" + + sed "/%install/q" $spec_dir/$mperl > $tempfile + echo "\ +[ \"%{buildroot}\" != / ] && rm -rf %{buildroot} +%makeinstall_perl +packlist=\`find %{buildroot} -name .packlist\` +[[ -z \"$packlist\" ]] && exit 1 || cat \$packlist | \ + sed \"s,%buildroot,,g;s,.*/man/.*,&.gz,g\" | \ + sort -u > .packlist && rm \$packlist + +strid=\`echo \$packlist | sed 's,.*auto\(.*\)/.packlist,\1,'\` +for dir in \`find %{buildroot} -type d | grep \$strid\`; do + echo \"%dir \${dir#%buildroot}\" >> .packlist +done + +%clean +[ \"%{buildroot}\" != / ] && rm -rf %{buildroot} +rm -f .packlist + +%files -f .packlist +%defattr(-,root,root) +" + sed -n '/%changelog/,$p' $spec_dir/$mperl >> $tempfile + mv $tempfile $spec_dir/$mperl + } + + sed -i " +s,perl Makefile.PL,perl Makefile.PL INSTALLDIRS=vendor, +s,make %{?_smp_mflags},%make, +s,^make,%make," $spec_dir/$mperl + + autospec -u ${mperl/\.spec} -a4 -f --rebuild \ + --changelog="$spec_changelog" --log +done diff --git a/tools/extract-specs.in b/tools/extract-specs.in new file mode 100644 index 0000000..1668db0 --- /dev/null +++ b/tools/extract-specs.in @@ -0,0 +1,142 @@ +#!/bin/bash +# $0 -- get the specfiles from a local repository +# Copyright (C) 2005,2007 Davide Madrisan +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License version 2 as published by the +# Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. +# +# Report bugs to + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +me=(${0##*/} "0.2.2") + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } + +. @libdir@/libmsgmng.lib + +# FIXME: add a po file for this script +#if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then +# . /etc/sysconfig/i18n +# export LANG +#fi +#TEXTDOMAIN="@package@"; export TEXTDOMAIN + +# default values +let "verbose = 1" +let "update_days = 0" # `0' means +\infty +unset update_opt +unset owner_opt + +function version() { + echo "\ +$me, "$"version"" ${me[1]}"" +"$"Get the specfiles from a local repository."" +Copyright (C) 2005-2007 Davide Madrisan " +} + +function copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function usage() { + # $1: optional exit code (default is '1') + version + echo " +"$"Usage":" + $me -s -d {-a | -u } [-o :] + +"$"where the above options mean":" + -s, --sourcedir "$"The local path where to find for the SRPMS packages"" + -d, --destdir "$"The local path where the extracted specfile will be saved"" + -a, --all "$"Get the specfiles from all the spmrs packages found"" + -u, --update "$"Get the specfiles from srpms last modified days ago"" + -o, --owner "$"Set the ownership of all files created to the specified value"" + +"$"Operation modes":" + -h, --help "$"Print this help, then exit"" + -v, --version "$"Print version number, then exit"" + -q, --quiet "$"Run in quiet mode"" + +"$"Some examples":" + $me -s /var/ftp/pub/SRPMS -d /var/temp/SPECS -o ftpuser:ftpuser -u 1 + +"$"Report bugs to .""" + + exit ${1:-1} +} + +[ $# -eq 0 ] && usage + +TEMP=`LANG=C getopt \ + -o s:d:au:o:hvq \ + --long sourcedir:,destdir:,all,update:,owner:,help,version,quiet \ + -n "$me" -- "$@"` +[[ $? = 0 ]] || exit 1 + +eval set -- "$TEMP" + +while :; do + case $1 in + -s|--sourcedir) + sourcedir="$2"; shift ;; + -d|--destdir) + destdir="$2"; shift ;; + -a|--all) + let "update_days = 0"; shift ;; + -u|--update) + update_days="$2"; shift ;; + -o|--owner) + owner_opt="--owner $2"; shift ;; + -q|--quiet) + let "verbose = 0" ;; + -h|--help) + usage 0 ;; + -v|--version) + version; echo; copying; exit 0;; + --) shift; break ;; + *) notify.error $"(bug)"" -- "$"\`getopt' error" + esac + shift +done + + +[[ -d "$sourcedir" ]] || + notify.error $"not such a directory"": \`$sourcedir'" + +if [[ ! -d "$destdir" ]]; then + mkdir -p "$destdir" 2>/dev/null + [ $? -ne 0 ] && + notify.error $"cannot create \`$destdir'" +fi + +if [ "$update_days" != "0" ]; then + echo "$update_days" | grep -Eq "^[0-9]+$" || + notify.error $"not a number"": \`$update_days'" + update_opt="-ctime -${update_days}" +fi + +pushd $destdir &>/dev/null +[ $? -ne 0 ] && notify.error "$destdir: "$"permission denied" + +find "$sourcedir" -maxdepth 1 $update_opt -type f -name \*.src.rpm | \ +while read file; do + notify.note $"processing"": $file ..." + rpm2cpio $file 2>/dev/null | \ + cpio --quiet --extract --unconditional $owner_opt "*.spec" 2>/dev/null + [ $? -ne 0 ] && + notify.warning $"cannot extract the specfile from \`$file'" +done + +popd &>/dev/null + +notify.note $"\nall done, $destdir content updated" diff --git a/tools/kde4-flist2rpmvars.in b/tools/kde4-flist2rpmvars.in new file mode 100644 index 0000000..a2d95fb --- /dev/null +++ b/tools/kde4-flist2rpmvars.in @@ -0,0 +1,137 @@ +#!/bin/bash +# $0 -- translate the list of files generated by rpm in a list suitable for +# inclusion into a specfile (kde4 only) +# Copyright (C) 2008-2010 Davide Madrisan +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License version 2 as published by the +# Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. +# +# Report bugs to + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +me=(${0##*/} "0.3.1") + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } + +. @libdir@/libmsgmng.lib + +# FIXME: add a po file for this script +#if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then +# . /etc/sysconfig/i18n +# export LANG +#fi +#TEXTDOMAIN="@package@"; export TEXTDOMAIN + +# default values +let "nospaces = 1" +sed_extra_mask="s,^[ \t]*,," + +function version() { + echo "\ +$me, "$"version"" ${me[1]}"" +"$"Get the specfiles from a local repository."" +Copyright (C) 2008 Davide Madrisan " +} + +function copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function usage() { + # $1: optional exit code (default is '1') + version + echo " +"$"Usage":" + $me [-s] + +"$"where the above options mean":" + -s, --spaces "$"Do not remove extra-spaces"" + +"$"Operation modes":" + -h, --help "$"Print this help, then exit"" + -v, --version "$"Print version number, then exit"" + +"$"Some examples":" + $me /tmp/kompare4_filelist + +"$"Report bugs to .""" + + exit ${1:-1} +} + +[ $# -eq 0 ] && usage + +TEMP=`LANG=C getopt \ + -o shv \ + --long nospaces,help,version \ + -n "$me" -- "$@"` +[[ $? = 0 ]] || exit 1 + +eval set -- "$TEMP" + +while :; do + case $1 in + -s|--nospaces) + let "nospaces = 0" + sed_extra_mask="";; + -h|--help) + usage 0 ;; + -v|--version) + version; echo; copying; exit 0;; + --) shift; break ;; + *) notify.error $"(bug)"" -- "$"\`getopt' error" + esac + shift +done + +flist="$1" +[[ -r "$flist" ]] || notify.error $"file not found"": \`$flist'" + +# see: /etc/rpm/macros.kde4 +cat $flist | \ +while read line; do + echo $line | sed "\ +$sed_extra_mask +s,/etc/opt/kde,%{_kde4_sysconfdir}, +s,/opt/kde/bin,%{_kde4_bindir}, +s,/opt/kde/sbin,%{_kde4_sbindir}, +\ +s,/opt/kde/include,%{_kde4_includedir}, +\ +s,/opt/kde/lib/kde4/libexec,%{_kde4_libexecdir}, +s,/opt/kde/lib/kde4/plugins,%{_kde4_pluginsdir}, +s,/opt/kde/lib,%{_kde4_libdir}, +\ +s,/opt/kde/share/applications,%{_kde4_xdgappsdir}, +s,/opt/kde/share/apps/kconf_update,%{_kde4_kconfupdatedir}, +s,/opt/kde/share/apps,%{_kde4_datadir}, +s,/opt/kde/share/autostart,%{_kde4_autostartdir}, +s,/opt/kde/share/config.kcfg,%{_kde4_kcfgdir}, +s,/opt/kde/share/config,%{_kde4_configdir}, +s,/opt/kde/share/dbus-1/interfaces,%{_kde4_dbusinterfacesdir}, +s,/opt/kde/share/dbus-1/services,%{_kde4_dbusservicesdir}, +s,/opt/kde/share/desktop-directories,%{_kde4_xdgdirectorydir}, +s,/opt/kde/share/doc/HTML,%{_kde4_htmldir}, +s,/opt/kde/share/icons,%{_kde4_icondir}, +s,/opt/kde/share/kde4/services,%{_kde4_servicesdir}, +s,/opt/kde/share/kde4/servicetypes,%{_kde4_servicetypesdir}, +s,/opt/kde/share/locale,%{_kde4_localedir}, +s,/opt/kde/share/mime/packages,%{_kde4_xdgmimedir}, +s,/opt/kde/share/mimelnk,%{_kde4_mimedir}, +s,/opt/kde/share/sounds,%{_kde4_soundsdir}, +s,/opt/kde/share/templates,%{_kde4_templatesdir}, +s,/opt/kde/share/wallpapers,%{_kde4_wallpaperdir}, +s,/opt/kde/share,%{_kde4_sharedir}, +#s,/opt/kde,%{_kde4_prefix}, +" +done | sort diff --git a/unmaintained/autobuild.in b/unmaintained/autobuild.in new file mode 100644 index 0000000..93bd873 --- /dev/null +++ b/unmaintained/autobuild.in @@ -0,0 +1,402 @@ +#!/bin/bash +# autobuild -- plugin for @package@ +# Copyright (C) 2006 Davide Madrisan + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +me=(${0##*/} "@version@" "@date@") + +[ $(id -u) -eq 0 ] && + { echo "$me: "$"you're running $me as root" 1>&2 && exit 1; } + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } + +. @libdir@/libmsgmng.lib + +[ -r @libdir@/libspec.lib ] || + { echo "$me: "$"library not found"": @libdir@/libspec.lib" 1>&2 + exit 1; } + +. @libdir@/libspec.lib + +# load the configuration file(s) +[ -r @libdir@/libcfg.lib ] || + { echo "$me: "$"library not found"": @libdir@/libcfg.lib" 1>&2 + exit 1; } + +. @libdir@/libcfg.lib + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + [ "$LANG" ] && export LANG +fi +TEXTDOMAIN="@package@"; export TEXTDOMAIN + +function copying() { + echo "\ +"$"This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License version 2 as published by the +Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE." +} + +function version() { + echo "\ +${me[0]} ${me[1]} +Copyright (C) 2006 Davide Madrisan " +} + +function usage() { + version + echo "\ +*** FIXME *** + +"$"Usage"": + @frontend@ -b [-T ] + +"$"where the above options mean"": + -b, --batch "$"Run in batch mode, using as a road map"" + -T, --target "$"Execute rules only for the given package"" + +"$"Operation modes"": + -h, --help "$"Print this help, then exit"" + -V, --version "$"Print version number, then exit"" + -q, --quiet "$"Run in quiet mode"" + -r, --colorize "$"Enable the colorized output"" + -D, --debug "$"Run in debugging mode (very verbose output)"" + +"$"Samples"": + @frontend@ --batch /var/tmp/autobuild.rules + +"$"Report bugs to ." + + exit ${1:-1} +} + +# check if all the needed tools are available +#for tool in ... ; do +# [ "$(type -p $tool)" ] || +# notify.error $"utility not found": \`$tool'" +#done + +case $1 in + --autospec-args-file*) + if echo $1 | grep -q '=' ; then + argsfile=`echo $1 | sed 's/^--autospec-args-file=//'` + else + argsfile=$2 + fi + [ -r "$argsfile" ] || notify.error $"cannot read"": \`$argsfile'" + . $argsfile && rm -f $argsfile + ;; +esac + +for arg in $@; do + case $arg in + -h|--help) usage 0 ;; + -V|--version) version; echo; copying; exit 0 ;; + esac +done + +exec_options=`LANG=C getopt \ + -o b:T:DqrhV \ + --long batch:,target:,\ + debug,quiet,colorize,help,version,\ + frontend_opts: \ + -n "$me" -- "$@"` +[ $? = 0 ] || exit 1 + +notify.debug "[ ${0} ${exec_options} ]\n" +eval set -- "$exec_options" + +while :; do + case $1 in + -b|--batch) + batchfile=$2; shift ;; + -T|--target) + batchtargetpck=$2; shift ;; # FIXME : currently ignored! + -D|--debug) + let "verbose = 2" ;; + -q|--quiet) + let "verbose = 0" ;; + -r|--colorize) + let "colorize = 1" ;; + -h|--help) + usage 0 ;; + -V|--version) + version; echo; copying; exit 0 ;; + --) shift; break ;; + *) notify.error $"unrecognized option"" -- \`$1'" ;; + esac + shift +done + +for arg in $@; do + notify.error $"unrecognized option"" -- \`$arg'" +done + +[ "$logging" = "1" ] && let "colorize = 0" + +[ "$colorize" = "1" ] && notify.enable_colors +# default values for non mandatory configuration variables +[ "$logging_dir" ] || logging_dir="${tmppath_dir:-/var/tmp}/@package@" + +# function autobuild.build() +# execute the commands contained in all the rules blocks +# args: +# $1 : none +function autobuild.build() { + # function autobuild.do_current() + # execute the commands contained in a rules block + # args: + # $1 : name (and path) of the rules file + function autobuild.do_current() { + local steps + [ "$download" = true ] && steps="1" + + # FIXME: support for `update' is not complete ! + if [ -n "$update" ]; then + steps="${steps:+$steps,}4" + [ "$update" = rebuild ] && let "rebuild = 1" + fi + + [[ "$build" = true || "$build" = force ]] && + steps="${steps:+$steps,}5" + [ "$build" = force ] && let "force_build = 1" + + [ "$install" = testonly ] && steps="${steps:+$steps,}7" + [ "$install" = true ] && steps="${steps:+$steps,}11" + [ "$install" = force ] && + { steps="${steps:+$steps,}11"; let "force_install = 1"; } + + [ "$upload" = true ] && steps="${steps:+$steps,}10" + + ( let "colorize = 0" + notify.disable_colors + + package.update \ + "${spec_format:-0}" \ + "$pck_name" "$pck_newver" "$pck_newrel" \ + "$steps" \ + "" "" \ + "${spec_name:-"${pck_name}.spec"}" \ + "$define_list" \ + "$ftp_server_download_num" \ + "$ftp_server_upload_num"; ) + # FIXME: "$changelog_userdef" + + let "error = $?" + [ "$error" = 0 ] || notify.warning $"error detected!" + } + + + local rulesfile="$1" + notify.debug "rulesfile = \"$rulesfile\"" + + [ "$batchfile" ] || notify.error $"\ +(bug)"" -- $FUNCNAME: "$"rulesfile unset" + + [ -r $rulesfile ] || + notify.error $"file not found"": \`$rulesfile'" + + notify.note $"parsing"" ${NOTE}$rulesfile${NORM}..." + + local linenum=1 + unset pck_name + + while read line; do + set -- $line + notify.debug "line = \"$line\"" + notify.debug " \$1 = \"$1\"" + + case "$1" in + \#*|"") # skip comments and blank lines + ;; + "[COMMANDS]"|"[GLOBAL]"|"[PACKAGES]") + section="$1" + notify.debug "parsing $1 section (line #$linenum)..." + + if [ "$section" = "[PACKAGES]" ]; then + # check for syntax errors + [ "$logging_dir" ] || + notify.error $"undefined directive"" \`logdir'" + [ "$spec_dir" ] || + notify.error $"undefined directive"" \`specdir'" + fi + # if a package block is yet cached, do autobuild it + # (this happens for the last package listed in the rules file) + if [ "$pck_name" ]; then + notify.debug "batchtargetpck = \"$batchtargetpck\"" + notify.debug "pck_name = \"$pck_name\"" + [ "$pck_name" = "${batchtargetpck:-$pck_name}" ] && + autobuild.do_current + unset pck_name + fi + ;; + logdir) + [ "$section" = "[GLOBAL]" ] || + notify.error \ +$"misplaced directive"" \`logdir', "$"line"" #$linenum" + logging_dir="$(eval echo $2)" + notify.note "logdir: ${NOTE}$logging_dir${NORM}" + ;; + specdir) + [ "$section" = "[GLOBAL]" ] || + notify.error \ +$"misplaced directive"" \`specdir', "$"line"" #$linenum" + spec_dir="$(eval echo $2)" + notify.note "specdir: ${NOTE}$spec_dir${NORM}" + ;; + package) + if [ "$pck_name" ]; then + # the previous package block has ended, so the corresponding + # actions must be taken now + notify.debug "batchtargetpck = \"$batchtargetpck\"" + notify.debug "pck_name = \"$pck_name\"" + if [ "$pck_name" = "${batchtargetpck:-$pck_name}" ]; then + autobuild.do_current + let "error = $?" + [ "$error" = 0 ] || + notify.warning $"error detected!"" ($pck_name)" + fi + unset pck_name + fi + + let "error = 0" + + pck_name="$(eval echo $2)" + notify.debug "batchtargetpck = \"$batchtargetpck\"" + notify.debug "pck_name = \"$pck_name\"" + [ "$pck_name" = "${batchtargetpck:-$pck_name}" ] && + notify.note "\n*** "$"package"": ${NOTE}$pck_name${NORM}" + ;; + specfile_name) + # optional: if missing, specfile_name is set to .spec + spec_name="$2" + ;; + download) + [ "$error" = 0 ] || continue + download="$(eval echo $2)" + # legal values: true, false + case "$download" in + true|false) ;; + *) notify.warning \ +$"unknown rvalue"" \`$upload', "$"line"" #$linenum" + let "error+=1" ;; + esac + ;; + download_server) + [ "$error" = 0 ] || continue + ftp_server_download_num="$(eval echo $2)" + ;; + update) + [ "$error" = 0 ] || continue + # legal values are , rebuild, false + # ex: <*.2n.*> (any, even number, any) + # <*.2n+1.*> (any, odd number, any) + # <*> (any number) + update="$(eval echo $2)" + case "$update" in + rebuild|false) ;; + *) # FIXME : implementation is incomplete + # should perhaps make a syntax checking + pck_newver="$update" + notify.debug "pck_newver = \"$pck_newver\"" + pck_newrel="$(eval echo $3)" + notify.debug "pck_newrel = \"$pck_newrel\"" + ;; + esac + ;; + build) + [ "$error" = 0 ] || continue + # legal values: false, force, true + build="$(eval echo $2)" + case "$build" in + false|force|true) ;; + *) notify.warning \ +$"unknown rvalue"" \`$upload', "$"line"" #$linenum" + let "error+=1" ;; + esac + ;; + build_define) + [ "$error" = 0 ] || continue + shift; define_list="$(eval echo $*)" + ;; + install) + [ "$error" = 0 ] || continue + # legal values: false, force, testonly, true + install="$(eval echo $2)" + case "$install" in + false|force|testonly|true) ;; + *) notify.warning \ +$"unknown rvalue"" \`$upload', "$"line"" #$linenum" + let "error+=1" ;; + esac + ;; + upload) + [ "$error" = 0 ] || continue + # legal values: true, false + upload="$(eval echo $2)" + case "$upload" in + true|false) ;; + *) notify.warning \ +$"unknown rvalue"" \`$upload', "$"line"" #$linenum" + let "error+=1" ;; + esac + ;; + upload_server) + [ "$error" = 0 ] || continue + ftp_server_upload_num="$(eval echo $2)" + ;; + *) [ "$section" = "[COMMANDS]" ] && + { eval "$line"; continue; } + + notify.error \ +$"unknown token"" \`$1', "$"line"" #$linenum" + ;; + esac + let "linenum += 1" + done < $rulesfile + + # if a package block is yet cached, do autobuild it + if [ "$pck_name" ]; then + [ "$pck_name" = "${batchtargetpck:-$pck_name}" ] && + autobuild.do_current + unset pck_name + fi +} + +# function autobuild.doall() +# frontend for this plugin +# args: +# $1 : name (and path) of the rules file +function autobuild.doall() { + local rulesfile="$1" + notify.debug "rulesfile = \"$rulesfile\"" + + [ "$batchfile" ] || notify.error $" +(bug)"" -- $FUNCNAME: "$"rulesfile unset" + + notify.error "FIXME: sorry, this plugin is currently unmantained" + + ( # set some global variables used by the pck-update plugin + let "logging = 1" + + notify.debug $"loading plugin"" \`$plugin_pck_update'..." + # FIXME: switch to the new @package@ architecture !!! + . $plugin_pck_update + + autobuild.build "$batchfile"; ) + + return $? +} + +# user configuration file for @package@ required +config.check4user +# make some security checks +config.security + +autobuild.doall "$batchfile" diff --git a/unmaintained/autobuild_example.rules b/unmaintained/autobuild_example.rules new file mode 100644 index 0000000..db71103 --- /dev/null +++ b/unmaintained/autobuild_example.rules @@ -0,0 +1,26 @@ +# +# this file is an example of rule file for the autobuild plugin +# + +[commands] +# this section can be used to set up some variables used later +# or to call external scripts +sn="$(LC_ALL="C" date "+%Y.%m.%d")" + +[global] +specdir /usr/src/RPM/SPECS +logdir /var/tmp/autobuild-$sn + +[packages] +package gzip +download false +download_server 0 +update rebuild +build force +build_define +install testonly +upload false +upload_server 0 + +[commands] +echo -e "\\nThat's all." diff --git a/unmaintained/autobuild_kde.rules b/unmaintained/autobuild_kde.rules new file mode 100644 index 0000000..8498065 --- /dev/null +++ b/unmaintained/autobuild_kde.rules @@ -0,0 +1,35 @@ +[COMMANDS] +sn="$(LC_ALL="C" date "+%Y.%m.%d")" +[ "$ARTSVER" ] || { echo "ARTSVER unset!"; exit 1; } +[ "$KDEVER" ] || { echo "KDEVER unset!"; exit 1; } +echo "arts version : $ARTSVER" +echo "KDE version : $KDEVER" + +[GLOBAL] +specdir /usr/src/RPM/SPECS +logdir /var/tmp/autobuild-$sn + +[PACKAGES] +package arts +download force +download_server 0 +update $ARTSVER +build force +build_define kdever=$KDEVER +install false +upload false +upload_server 0 + +package kdelibs +download force +download_server 0 +update $KDEVER +build true +build_define +install true +upload false +upload_server 0 + +[COMMANDS] +echo -e "\\nThat's all." + diff --git a/unmaintained/autoupdate-kde.in b/unmaintained/autoupdate-kde.in new file mode 100644 index 0000000..0b502ae --- /dev/null +++ b/unmaintained/autoupdate-kde.in @@ -0,0 +1,162 @@ +#!/bin/bash +# autoupdate-kde -- update all the KDE packages +# Copyright (C) 2005,2006 Davide Madrisan +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License version 2 as published by the +# Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. +# +# Report bugs to + +[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] && + echo $"this script requires bash version 2 or better" >&2 && exit 1 + +me=("${0##*/}" "0.1.1") + +if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then + . /etc/sysconfig/i18n + export LANG +fi +TEXTDOMAIN="@package@"; export TEXTDOMAIN + +[ -r @libdir@/libmsgmng.lib ] || + { echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2 + exit 1; } + +. @libdir@/libmsgmng.lib + +let "action_build = 0" +let "action_check = 0" +let "action_download = 0" +let "action_install = 0" +let "action_upload = 0" + +# default package list +pcklist="\ +arts +kdelibs +kdebase +kdeadmin +kdepim +kdemultimedia +kdegames +kdegraphics +kdenetwork +kdeutils +kdeartwork +kdesdk +kdeedu +kdebindings +kdetoys +kdeaccessibility +kdeaddons +kde-i18n +kdevelop +kdewebdev" + +function usage() { + echo "\ +$me, "$"version"" ${me[1]}"" +"$"Update all the KDE packages."" +Copyright (C) 2005 Davide Madrisan "" + +"$"Usage"": + $me {-b|-c|-d|-i|-u} [-p=] + +"$"where the above options mean"": + -b, --build build the packages + -c, --check check the packages + -d, --download download the source packages + -i, --install install the rpm packages + -u, --upload upload the rpm packages + -p, --pcklist space separated list of packages + +"$"Operation modes"": + -h, --help Print this help, then exit + +"$"Some examples"": + $me -dbi --pcklist=\"arts kdelibs kdebase\" + +"$"Report bugs to ." +} + +OPTS=`LANG=C getopt -o bcdiup:h \ + --long build,check,download,install,upload,pcklist:,help -n "$me" -- "$@"` +[ $? = 0 ] || return 1 + +eval set -- "$OPTS" + +while :; do + case $1 in + -b|--build) + let "action_build = 1" ;; + -c|--check) + let "action_check = 1" ;; + -d|--download) + let "action_download = 1" ;; + -i|--install) + let "action_install = 1" ;; + -u|--upload) + let "action_upload = 1" ;; + -p|--pcklist) + pcklist="$2" + shift ;; + -h|--help) + usage; exit ;; + --) shift; break ;; + *) notify.error $"\ +(bug)"" -- $FUNCNAME: "$"\`getopt' error" ;; + esac + shift +done + +kdever=$1 +[ "$kdever" ] || + { echo $"missing mandatory arg (KDE version)"; exit 1; } + +flist=`mktemp -q -t flist.XXXXXXXX` || + { echo $"can't create temporary files" 1>&2 + exit 1; } + +KDEURL="ftp://ftp.kde.org/pub/kde/stable/$kdever/src" + +curl -s --url $KDEURL/ --list-only -o $flist 2>/dev/null +artsver=$(\ + sed -n "/arts-[0-9\.]*.tar/{s,arts-,,;s,\.tar\..*,,p}" $flist) +kdevelopver=$(\ + sed -n "/kdevelop-[0-9\.]*.tar/{s,kdevelop-,,;s,\.tar\..*,,p}" $flist) +rm -f $flist + +function do_pck_update() { + actions="$1" + [ "$actions" ] || + { echo $"\ +(bug)"" -- $FUNCNAME: "$"missing mandatory arg (#1)" 1>&2 + exit 1; } + + for pck in $pcklist; do + case "$pck" in + arts) + autospec -u arts -a"$actions" $artsver \ + --define kdever=$kdever ;; + kdevelop) + autospec -u kdevelop -a"$actions" $kdevelopver \ + --define kdever=$kdever ;; + *) autospec -u $pck -a"$actions" $kdever ;; + esac + done +} + +# [1] download source packages +[ "$action_download" = "0" ] || do_pck_update "1,3" +# [2] build the new rpm and srpm packages +[ "$action_build" = "0" ] || do_pck_update "4,5" +# [3] check packages +[ "$action_check" = "0" ] || do_pck_update "7" +# [4] install packages +[ "$action_upload" = "0" ] || do_pck_update "8" +# [5] upload packages +[ "$action_install" = "0" ] || do_pck_update "11" + +# ADDME ... diff --git a/unmaintained/mbrowse.spec b/unmaintained/mbrowse.spec new file mode 100644 index 0000000..c864ea1 --- /dev/null +++ b/unmaintained/mbrowse.spec @@ -0,0 +1,190 @@ +# this is a comment +# and now another comment + +# this string should be skipped by sintax tests : _infodir + +%define with_contrib 1 +%define use_gcc_33 0 +%define use_ccache 1 +%define mbaddons_ver 1.2.3 +#%define dailyver %(date +%d%m_%y) +%define with_gui 1 +%define always_true 1 + +%define majorminor %(echo %version | cut -d. -f 1-2) + +## *AUTOSPEC-OFF* +%define not_a_as_definition a_test +## *AUTOSPEC-ON* + +%define target_cpu %{_target_cpu} + +%if ! %{use_gcc_33} +%if %always_true +%if %use_ccache +%define BUILD_CC "ccache gcc" +%else +%define BUILD_CC "gcc" +%endif +%endif +%else +%if %use_ccache +%define BUILD_CC "ccache gcc33" +%else +%define BUILD_CC "gcc33" +%endif +%endif + +%if "%{?stage1}" +%define notadef "nad" +%endif + +Summary: A MIB browser based on net-snmp and GTK+ +Name : mbrowse +Version: 0.3.1 +Release: 2006.1.5qilnx +Epoch: 1 +Group: Network/Monitoring +Vendor: QiLinux +Packager: Davide Madrisan +BuildRoot: %{_tmppath}/%{name}-%{version}-root +Url: http://goldplated.atlcartel.com +Source: http://www.awebsiteintheworld.org/%{name}/%{majorminor}/%{name}-%{version}.tar.gz +#Source1: ftp://ftp.ftpsomewhere.net/mbrowse-2/contrib/mbrowse-contrib-%{version}.tar.bz2 +#Source2: http://www.website.va/download/mbrowse_addons-%{mbaddons_ver}.tar.bz2 +#Source3: alocalfile.sh +Patch0: %{name}-0.3.1-config.patch.bz2 +Patch1: %{name}-0.3.1-gcc34.patch.gz +Patch2: nonstandardname_mbrowse-0.3.1-gcc34.patch +#Patch3: http://www.awebsiteintheworld.org/awebpatch-%{version}.patch +BuildRequires: net-snmp-devel >= 4.2 +BuildRequires: libopenssl-devel +Requires(post):%{__install_info} +%if %with_gui +BuildRequires: libgtk1-devel >= 1.2.10 +#BuildRequires: libglib2-devel >= 2.1.5 +BuildRequires: libglib1-devel >= 1.2.10 +BuildRequires: zlib-devel >= 1.2.3 +%endif +Requires: exists(/bin/bash) +License: GPL, LGPL , zlib/libpng License + +# yet another comment + +%description +This package is a MIB browser based on net-snmp and GTK+. +Blah blah. + +%if %with_contrib +%package contrib +Summary: Just added to test autospec +#Group: Network/Monitoring/Users Contrib +Group: Network/Monitoring +#BuildArch: noarch +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +## *AUTOSPEC-OFF* +Obsoletes: %{name}-extratools +## *AUTOSPEC-ON* +Obsoletes: %{name}-extra +Obsoletes: %{name}-tools + +%description contrib +Contributor scripts for %{name}. +%endif + +%prep +%setup -q +%patch0 -p1 -b .config +%patch1 -p1 -b .gcc34 + +%build +%configure + +#% define BUILD_CC %{_target_platform}-gcc +#% define BUILD_CXX %{_target_platform}-g++ +# +#% define USE_DISTCC 0 +# +#% if %{USE_DISTCC} +#% define DISTCC_CC ccache distcc %{?BUILD_CC} +#% define DISTCC_CXX ccache distcc %{?BUILD_CXX} +#% define BUILD_OPTS CC="%{DISTCC_CC}" CXX="%{DISTCC_CXX}" -j1 +#% else +#% define BUILD_OPTS CC="%{BUILD_CC}" CXX="%{BUILD_CXX}" %{_smp_mflags} +#% endif +# +#make %{BUILD_OPTS} + +## *AUTOSPEC-OFF* +%ifarch ppc +echo "arch is ppc..." +%endif +## *AUTOSPEC-ON* + +%if "%{?debug}" == "1" +%make %{?BUILD_CC:CC=%BUILD_CC} CFLAGS="-Wall -g" +%else +%make %{?BUILD_CC:CC=%BUILD_CC} +%endif + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +# REMOVE! +install -d %{buildroot}%{_infodir} +touch %{buildroot}%{_infodir}/mbrowse.info + +rm -f %{buildroot}%{_datadir}/phantom.tmp + +install -d %{buildroot}%{_sysconfdir} +touch %{buildroot}%{_sysconfdir}/mbrowse.conf + +echo "\ +!#/bin/bash + +tempf=$$ +rm -f $temp +" >> %{buildroot}%{_bindir}/badscript + +install -d %{buildroot}%{_datadir}/locale/it_IT/LC_MESSAGES +touch %{buildroot}%{_datadir}/locale/it_IT/LC_MESSAGES/%{name}.mo + +%find_lang %{name} + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post +%install_info mbrowse.info + +%preun +%uninstall_info mbrowse.info + +%files -f %{name}.lang +%defattr(-,root,root) +%attr(2755,root,root) %{_bindir}/mbrowse +%{_bindir}/badscript +%_infodir/mbrowse.* +# /usr/include/info/mbrowse.* +#%{_mandir}/man8/mbrowse.* +#%{_mandir}/fr/man8/mbrowse-fr.* +#%{_datadir}/locale/* +%config %{_sysconfdir}/mbrowse.conf +%doc AUTHORS COPYING ChangeLog NEWS README TODO + +%if %with_contrib +%if %{target_cpu} == %{_build_cpu} +%files contrib +%defattr(-,root,root) +%doc AUTHORS +%endif +%endif + +#%files -f XXX -n contrib2 +#%defattr(-,root,root) +#%doc CONTRIB-TWO + +%changelog +* Wed Dec 29 2004 Davide Madrisan 0.3.1-1qilnx +- package created by autospec