diff options
64 files changed, 4299 insertions, 59 deletions
@@ -1,17 +1,2 @@ *~ -devtools-*.tar.gz* -archbuild -archco -archrelease -archrm -bash_completion -checkpkg -commitpkg -finddeps -lddd -makechrootpkg -mkarchroot -rebuildpkgs -zsh_completion -find-libdeps -crossrepomove +#* @@ -0,0 +1,2 @@ +Joshua Haase +Nicolás Reynolds @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. 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 +them 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 prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. 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. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey 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; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + 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. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +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. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + 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 +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program 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, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU 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 Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. @@ -1,55 +1,51 @@ -V=20121128.6 +# Configuration +DESTDIR= -PREFIX = /usr/local -pkgdatadir=$(PREFIX)/share/devtools +#prefix=/usr/local +prefix=/usr +exec_prefix=$(prefix) +datarootdir=$(prefix)/share -BINPROGS = \ - checkpkg \ - find-libdeps \ - finddeps \ - lddd +bindir=$(exec_prefix)/bin +sbindir=$(exec_prefix)/sbin +#sysconfdir=$(prefix)/etc +sysconfdir=/etc +datadir=$(datarootdir) +docdir=$(datarootdir)/doc -SBINPROGS = \ - mkarchroot +################################################################################ -all: $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion +# these are directories +pseudo-packages=abslibre-tools chroot-tools fullpkg lib mips64el-tools toru -edit = sed -e "s|@pkgdatadir[@]|$(pkgdatadir)|g" +# these are the resulting packages +packages=libretools libretools-pr libretools-mips64el +# and which directories they contains +libretools=abslibre-tools lib chroot-tools fullpkg toru misc +libretools-mips64el=mips64el-tools -%: %.in Makefile - @echo "GEN $@" - @$(RM) "$@" - @m4 -P $@.in | $(edit) >$@ - @chmod a-w "$@" - @chmod +x "$@" +################################################################################ -clean: - rm -f $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion +all: PHONY build +build: PHONY build-libretools build-doc +install: PHONY install-libretools install-doc -install: all - install -dm0755 $(DESTDIR)$(PREFIX)/bin - install -dm0755 $(DESTDIR)$(PREFIX)/sbin - install -dm0755 $(DESTDIR)$(pkgdatadir) +%-doc: PHONY doc + $(MAKE) -C doc $* +%-misc: PHONY src + $(MAKE) -C src $* - install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin -# install -m0755 ${SBINPROGS} $(DESTDIR)$(PREFIX)/sbin - install -m0755 mkarchroot $(DESTDIR)$(PREFIX)/sbin/archroot +build-%: PHONY src/% + $(MAKE) -C src/$* build +install-%: PHONY src/% + $(MAKE) -C src/$* install - ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides +.SECONDEXPANSION: +$(addprefix build-, $(packages)): build-%: PHONY $$(addprefix build-, $$($$*)) +$(addprefix install-,$(packages)): install-%: PHONY $$(addprefix install-,$$($$*)) - install -m0644 lib/common.sh $(DESTDIR)$(pkgdatadir)/common.sh - install -m0644 makechrootpkg.in $(DESTDIR)$(pkgdatadir)/makechrootpkg.sh - install -Dm0644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools - install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools +################################################################################ -uninstall: - for f in ${BINPROGS} ; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done -# for f in ${SBINPROGS} ; do rm -f $(DESTDIR)$(PREFIX)/sbin/$$f; done - rm -f $(DESTDIR)$(PREFIX)/sbin/archroot - - rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides - - rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools - rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools - -.PHONY: all clean install uninstall +FORCE: PHONY +PHONY: +.PHONY: FORCE PHONY diff --git a/common.mk b/common.mk new file mode 100644 index 0000000..6248b80 --- /dev/null +++ b/common.mk @@ -0,0 +1,37 @@ +# Configuration +DESTDIR= + +#prefix=/usr/local +prefix=/usr +exec_prefix=$(prefix) +datarootdir=$(prefix)/share + +bindir=$(exec_prefix)/bin +sbindir=$(exec_prefix)/sbin +#sysconfdir=$(prefix)/etc +sysconfdir=/etc +datadir=$(datarootdir) +docdir=$(datarootdir)/doc + +################################################################################ +progs = $(shell find . -maxdepth 1 -type f -executable -printf '%f\n') +confs = $(shell find . -maxdepth 1 -type f -not -executable -printf '%f\n'|fgrep -v Makefile) +files = $(addprefix $(DESTDIR)$(libre_execdir)/,$(progs)) \ + $(addprefix $(DESTDIR)$(libre_datadir)/,$(confs)) + +all: PHONY build + +build: PHONY + +install: PHONY $(files) + +$(DESTDIR)$(libre_execdir)/%: % + install -Dm755 '$<' '$@' +$(DESTDIR)$(libre_datadir)/%: % + install -Dm755 '$<' '$@' + +################################################################################ + +FORCE: PHONY +PHONY: +.PHONY: FORCE PHONY diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..7af3750 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,2 @@ +libre_datadir=$(docdir)/libretools +include ../common.mk diff --git a/doc/createworkdir b/doc/createworkdir new file mode 100644 index 0000000..d74198a --- /dev/null +++ b/doc/createworkdir @@ -0,0 +1,62 @@ +== CreateWorkDir + +This script recreates a proper dir tree for packaging. It's aim is to help +you be organized with the work you do as a packager, and stablish a +certain standard for packages' ubication, so you don't have to loose much +time with them. Just package and upload! + +It will create a dir tree like this: +workdir/ + abslibre/ + .git/ + libre/<PKGBUILDS> + libre-testing/<PKGBUILDS> + staging/ + libre/ + libre-testing/ + repos/ + libre/ + i686/ + x86_64/ + libre-testing/ + i686/ + x86_64/ + +*Related Variables* + - WORKDIR + + +=== staging/ + +This directory contains one dir for each repository, where the resulting +packages are in moved for syncing against the main repository on +Parabola's server. This dir is architecture independent. + +*Related Variables* + - REPOS + + +=== abslibre/ + +This is the git repo for Parabola's PKGBUILDs. Here you can find the ABS +tree for our packages, and also where you'll have to put new ones for +commit. + +(You'll need push access to Parabola's main server, but pulling is +public.) + +*Related Variables* + - ABSLIBREGIT + + +=== repos/ + +Contains the repo dir structure. Probably not useful for uploading +packages, but it will be for creating new repos for public access. + +It contains a dir for every repository, and inside them, a dir for every +supported architecture. + +*Related Variables* + - REPOS + - ARCHES diff --git a/doc/fullpkg b/doc/fullpkg new file mode 100644 index 0000000..5645fae --- /dev/null +++ b/doc/fullpkg @@ -0,0 +1,7 @@ +# FullPKG +FullPKG is a tool to build a package from ABS, find all needed dependencies +along the way and build them too if necessary. + +## Before running fullpkg +Update PKGBUILD path cache by running `toru -u <repo>` on your ABS root. Once +for each repo you'll be using. diff --git a/doc/treepkg.markdown b/doc/treepkg.markdown new file mode 100644 index 0000000..7f7ece1 --- /dev/null +++ b/doc/treepkg.markdown @@ -0,0 +1,130 @@ +# TreePKG + +`treepkg` is a tool for recursively building packages from an ABS tree. It has +been tested while building packages for the mips64el port and it has proven to +be useful. + +It was written having in mind the experience of `fullpkg`, which converted to +`fullpkg-ng` and then splitted into `fullpkg-build` and `fullpkg-find`. It's +aim is to simplify algorithms implemented on the fullpkg family, while solving +some design issues that made fullpkg miss some packages sometimes. + + +## Requirements + +`treepkg` needs the help of `toru-path` for "indexing" an ABS tree. `toru-path` +stores a tokyocabinet database of "pkgname" => "path" pairs, where pkgname is +replaced by the "pkgbase", "pkgname", and "provides" fields of a PKGBUILD, +followed by the path of the current PKGBUILD. + +This information is then used by `treepkg` to know where to find the PKGBUILD +of a package. The fullpkg family needed to guess this by traversing the full +ABS tree, and therefore it was unable to find pkgnames that differ from +pkgbase. + +So, to use `treepkg` you need to run `toru-path` after the ABS tree update. + +> Split PKGBUILDs make it difficult to extract metadata if it's stored inside +> package() functions. This will happen with the provides field and `treepkg` +> won't find that linux-libre-headers provides linux-headers, for instance. + +## How does it work + +`treepkg` must be run from the path of the PKGBUILD you're going to build (this +may change over time). This will be DEPTH=0 and it will create a temporary +directory to work on in the format /tmp/pkgbase-treepkg-random-string. Inside +this directory, it will copy the needed PKGBUILDs prefixed with their depth +number. The first package will always be copied to 000\_pkgbase. + +From then on, treepkg sources the PKGBUILD and runs itself over all pkgnames on +the depends and makedepends array, only if it detects their versions aren't +already built or deprecated by newer ones, using the `is_built` utility. + +While processing this info, it will increase the depth of the packages. It'll +also write a CSV file with the knowledge it acquires from the ABS tree (useful +for debugging). This file is called BUILDORDER. + +When this process ends (no more needed dependencies are found), the temporary +work dir is traversed in inverse order (from higher depths to 0) running the +FULLBUILDCMD from libretools.conf and then the HOOKLOCALRELEASE variable, which +*must* provide a way to `repo-add` the packages to an available repository, so +the next build will find and install the newer version using pacman. + +For instance, having this as the first pacman repository (on /etc/pacman.conf): + + [stage3] + Server = /var/cache/pacman/pkg + +And this on /etc/makepkg.conf: + + PKGDEST=/var/cache/pacman/pkg + +Your HOOKLOCALRELEASE script should look like this: + + # Get needed vars + source /etc/makepkg.conf + source /etc/libretools.conf + source PKGBUILD + + unset build package check + + fullver=$(full_version ${epoch:-0} ${pkgver} ${pkgrel}) + pkgs=() + + # Generate canonical package paths + msg "Adding packages to [stage3]..." + for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + pkgs+=("${PKGDEST}/${name}-${fullver}-*.pkg.tar.*") + done + + # Add the packages to a local + repo-add ${PKGDEST}/stage3.db.tar.gz ${pkgs[@]} + + # Stage the packages for later releasing + librestage $1 + +> Note the first HOOKLOCALRELEASE argument is the remote repository name (core, +> extra, etc.) + +There's a special case when a dependency depends on another that was put on +a depth level lower than itself. In this case the build order will be wrongly +assumed and you may end up with broken packages. + +To explain it with an example: + + ghostscript (0) - fontconfig (1) + \ cups (1) - fontconfig (ignored) + +The second time fontconfig appears, it will be ignored. In this case cups will +build against an fontconfig version that will be outdated by the fontconfig +version at depth 1. In this cases, `treepkg` will detect it cached the +dependency on a lower depth, and will "bury" it to a depth higher than the +current one. Thus this will become the build path: + + ghostscript (0) - fontconfig (buried) + \ cups (1) - fontconfig (2) + +> Note: currently, `treepkg` doesn't perform recursive burying, so if you hit +> a really long build tree with some circular dependencies you may find +> packages buried several times and queued to build before their actuals deps. + +## Tips + +`treepkg` accepts two arguments: 1) the temporary work dir and 2) the next +depth level it should use (if current equals 0, it'll pass 1). You don't need +to pass this arguments when running it manually, they're used internally to +automatically construct the build path. + +But if a build failed, `treepkg` will cancel itself immediately informing you +where the leftovers files were left. If you pass this path to `treepkg` as the +first argument, it will resume the build, skipping to the last package being +packaged. + +You can take the opportunity given by this to modify the build path or the +PKGBUILDs, without having to run `treepkg` twice. For instance you can remove +a package from the build order, or move it manually, or update the PKGBUILD +that made `treepkg` fail in the first place. You can force a skipped package +(after building it manually) by using `touch built_ok` on the PKGBUILD dir. + +You don't probably want to mess with the second argument though. diff --git a/doc/workflows.markdown b/doc/workflows.markdown new file mode 100644 index 0000000..f55ae7e --- /dev/null +++ b/doc/workflows.markdown @@ -0,0 +1,60 @@ +# Workflows + +Describe your packaging workflow here! + + +## fauno's way + +During packaging, I don't usually restart a build from scratch if I have to +make changes to the PKGBUILD. I use a lot of commenting out commands already +ran, `makepkg -R`, etc. When I used `libremakepkg` I ended up using a lot more +`librechroot` and working from inside the unconfigured chroot, because +`makechrootpkg` (the underlying technology for `libremakepkg`) tries to be too +smart. + +When I started writing `treepkg` I found that mounting what I need directly on +the chroot and working from inside it was much more comfortable and simple than +having a makepkg wrapper doing funny stuff (for instance, mangling makepkg.conf +and breaking everything.) + +This is how the chroot is configured: + +* Create the same user (with same uid) on the chroot that the one I use regularly. + +* Give it password-less sudo on the chroot. + +* Bind mount /home to /chroot/home, where I have the abslibre-mips64el clone. + +* Bind mount /var/cache/pacman/pkg to /chroot/var/cache/pacman/pkg + +* Put these on system's fstab so I don't have to do it everytime + +* Configure makepkg.conf to PKGDEST=CacheDir and SRCDEST to something on my home. + +Workflow: + +* Enter the chroot with `systemd-nspawn -D/chroot` and `su - fauno`. + +* From another shell (I use tmux) edit the abslibre or search for updates with + `git log --no-merges --numstat`. + +* Pick a package and run `treepkg` from its dir on the chroot, or retake + a build with `treepkg /tmp/package-treepkg-xxxx`. (Refer to doc/treepkg + here). + +What this allows: + +* Not having to worry about the state of the chroot. `chcleanup` removes and + adds packages in a smart way so shared dependencies stay and others move + along (think of installing and removing qt for a complete kde rebuild). + +* Building many packages in a row without recreating a chroot for every one of + them. + +* Knowing that any change you made to the chroot stays as you want (no one + touches your makepkg.conf) + +* Hability to run regular commands, not through a chroot wrapper. I can `cd` to + a dir and use `makepkg -whatever` on it and nothing breaks. + +* No extra code spent on wrappers. diff --git a/rePKGBUILD.proto b/rePKGBUILD.proto new file mode 100644 index 0000000..c8b19bf --- /dev/null +++ b/rePKGBUILD.proto @@ -0,0 +1,29 @@ +# This is an example rePKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Your Name <youremail@domain.com> +source PKGBUILD +unset build package md5sums source +_repo= # Put the repo here +_mirror=http://mirrors.kernel.org/archlinux # Put mirror here +source=(PKGBUILD + "${_mirror}/${_repo}/os/${CARCH}/${pkgname%-libre}-$pkgver-$pkgrel-$CARCH$PKGEXT" + # files for pkg modifications below this line + ) + +build() { + cd "${srcdir}/" + rm .{INSTALL,PKGINFO} + # put actions for package modifications below this line + +} + +package() { + find ${srcdir} -maxdepth 1 -type l -delete + cp -a ${srcdir}/* ${pkgdir} +} + + +# vim:set ts=2 sw=2 et: diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..ff8d399 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir) +include ../common.mk diff --git a/src/abslibre-tools/Makefile b/src/abslibre-tools/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/abslibre-tools/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/abslibre-tools/createworkdir b/src/abslibre-tools/createworkdir new file mode 100755 index 0000000..b443c08 --- /dev/null +++ b/src/abslibre-tools/createworkdir @@ -0,0 +1,63 @@ +#!/bin/bash +# CreateWorkDir +# Creates a dir structure for working with Parabola packages + +# Copyright 2010 Nicolás Reynolds + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola 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 3 of the License, or +# (at your option) any later version. + +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +source /etc/libretools.conf +custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf +[[ -e $custom_config ]] && source $custom_config + +[[ ! -d ${WORKDIR} ]] && { # Create the WORKDIR + + msg "Creating WORKDIR on ${WORKDIR}" + mkdir -p ${WORKDIR} ||{ + error "Could not create ${WORKDIR}"; exit 1 + } + +} + +for _repo in ${REPOS[@]}; do # Create the staging dirs + + [[ ! -d ${WORKDIR}/staging/${_repo} ]] && { + mkdir -p ${WORKDIR}/staging/${_repo} || { + error "Can't create ${WORKDIR}/staging/${_repo}" + exit 1 + } + } + +done + +[[ ! -d ${WORKDIR}/abslibre/.git ]] && { + msg "Cloning into ABSLibre" + CMD="git clone ${ABSLIBREGIT} ${WORKDIR}/abslibre" + ${CMD} || { + error "Could not clone ABSLibre" + plain "Try running this command:" + echo + plain "${CMD}" + exit 1 + } +} + +msg "Finished, your packaging dir tree looks like this now:" +ls --color=always ${WORKDIR}/*/* + +exit 0 diff --git a/src/abslibre-tools/libreaddiff b/src/abslibre-tools/libreaddiff new file mode 100755 index 0000000..98646a2 --- /dev/null +++ b/src/abslibre-tools/libreaddiff @@ -0,0 +1,97 @@ +#!/bin/bash +# -*- coding: utf-8 -*- +# Copyright (C) 2011, 2012 Michał Masłowski <mtjm@mtjm.eu> +# +# 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 3 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +set -e + +. /etc/libretools.conf +custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf +[ -e $custom_config ] && . $custom_config + +for arg in "$@" ; do + case "$arg" in + -h|--h|--he|--hel|--help|-\?) + echo 'Usage: libreaddiff repo [arch] + +This script outputs a diff of package names and versions in repo +between pacman'\''s sync db and abslibre checkout.' >&2 + exit 0 + ;; + esac +done + +# The repo to find missing packages in. +repo=$1 +# The arch to check in Arch repos, other will have all arches checked. +arch=${2:-mips64el} +# A Python tuple of repos which don't have arch=any packages. +archrepos='("core", "extra", "community")' + +diff -U0 \ + <( ( + cd /var/lib/pacman/sync + for f in $repo.db ; do + tar xOf $f | python -c 'import sys +arch = None +name = None +version = None +it = iter(sys.stdin) +try: + while True: + line = next(it) + if line == "%ARCH%\n": + arch = next(it) + if arch == "'"$arch"'\n" or "'$repo'" not in '"$archrepos"': + print("%s-%s" % (name.strip(), version.strip())) + if line == "%NAME%\n": + name = next(it) + if line == "%VERSION%\n": + version = next(it) +except StopIteration: + pass +' + done + ) | sort ) \ + <( ( + cd "${WORKDIR}/abslibre" + # Needed to not include pkgnames specific to other arches. + CARCH=$arch + for f in $repo/* ; do + unset pkgname + unset epoch + unset pkgver + unset pkgrel + unset arch + . $f/PKGBUILD || continue + is_here=false + for arc in ${arch[@]} ; do + if [ "$arc" = "any" -o "$arc" = "$CARCH" ] ; then + is_here=true + break + fi + done + if [ "$is_here" = "true" ] ; then + for name in ${pkgname[@]} ; do + if [ -z "$epoch" ] ; then + echo $name-$pkgver-$pkgrel + else + echo $name-$epoch:$pkgver-$pkgrel + fi + done + fi + done + ) | sort ) | sed -rn 's/^[+-][^+-].+$/&/p' diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease new file mode 100755 index 0000000..efb698e --- /dev/null +++ b/src/abslibre-tools/librerelease @@ -0,0 +1,155 @@ +#!/bin/bash +# Librerelease +# Uploads packages into [staging] + +# Copyright 2010 Nicolás Reynolds + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola 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 3 of the License, or +# (at your option) any later version. + +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +source /etc/libretools.conf +custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf + +function usage { + echo "$(gettext "Usage: $0")" + echo + echo "$(gettext "This script uploads packages on $WORKDIR/stagging")" + echo "$(gettext "to parabola server.")" + echo + echo "$(gettext "OPTIONS:")" + echo "$(gettext " -h this message.")" + echo "$(gettext " -l only list packages but not upload them.")" + echo "$(gettext " -c clean packages on $WORKDIR/staging.")" + echo "$(gettext " -n dry-run")" +} + +function list_packages { + repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null)) + for _repo in ${repos[@]}; do + msg2 "$_repo" + find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n" + done + unset repos +} + +function sign_packages { + if [ -z "${SIGEXT}" ]; then + SIGEXT=.sig + warning "Empty SIGEXT var, using default .sig" + fi + + if [ -z "${GPG_AGENT_INFO}" ]; then + warning "It's better to use gpg-agent to sign packages in batches" + fi + + packages=($(find "${WORKDIR}/staging/" -type f -iname '*.pkg.tar.?z')) + for package in ${packages[@]}; do + if [ -f "${package}${SIGEXT}" ]; then + + warning "Package signature found, verifying..." + +# Verify that the signature is correct, else remove for re-signing + if ! gpg --quiet --verify "${package}${SIGEXT}" >/dev/null 2>&1; then + error "Failed! Resigning..." + rm -f "${package}${SIGEXT}" + fi + fi + + msg2 "Signing ${package}..." + gpg --default-key "${SIGID}" --output "${package}${SIGEXT}" \ + --detach-sig "${package}" || { + error "Signing failed" + exit 2 + } + + done +} + +# Remove everything that's not a package or a signature +function clean_non_packages { + find $WORKDIR/staging/ -type f \ + \! -iname "*.pkg.tar.?z" -a \! -iname "*.pkg.tar.?z.sig" \ + -delete +} + +# Clean everything if not on dry-run mode +function clean { + [ -z ${dryrun} ] && \ + rm -f $@ +} + +if [ -w / ]; then + error "Run $0 as normal user" + exit 1 +fi + +while getopts 'hlcn' arg; do + case $arg in + h) usage; exit 0 ;; + l) list_packages; exit 0 ;; + c) clean; exit $? ;; + n) dryrun="--dry-run" ;; + esac +done + +[[ -e $custom_config ]] && source $custom_config + +[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" + +clean_non_packages +if [ ! -z "${SIGID}" ]; then + sign_packages +else + error "Package signing is *required*, please set SIGID on your libretools.conf" + exit 1 +fi + +# Make the permissions of the packages 644 otherwise the user will get access +# denied error when they try to download (rsync --no-perms doesn't seem to +# work). +find ${WORKDIR}/staging -type f -exec chmod 644 {} \; +find ${WORKDIR}/staging -type d -exec chmod 755 {} \; + +# Get the synced files +SYNCED_FILES=($(find ${WORKDIR}/staging -type f)) + +msg "%s to upload" $(du -h -d 0 ${WORKDIR}/staging | tr "\t" " " | cut -d" " -f1) +msg "Uploading packages..." +rsync --recursive \ + ${dryrun} \ + --no-group \ + --no-perms \ + --copy-links \ + --hard-links \ + --partial \ + --prune-empty-dirs \ + --human-readable \ + --progress \ + -e "ssh " \ + ${WORKDIR}/staging \ + ${PARABOLAHOST}:${LIBREDESTDIR}/ || { + error "Sync failed, try again" + exit 1 + } + +msg "Removing ${#SYNCED_FILES[@]} files from local [staging]" +clean ${SYNCED_FILES[@]} + +msg "Running db-update on repos" +ssh ${PARABOLAHOST} dbscripts/db-update + +exit 0 diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage new file mode 100755 index 0000000..ae66cce --- /dev/null +++ b/src/abslibre-tools/librestage @@ -0,0 +1,137 @@ +#!/bin/bash +# LibreStage +# Prepares packages for upload into [staging] + +# Copyright 2010 Nicolás Reynolds + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola 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 3 of the License, or +# (at your option) any later version. + +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + + +source /etc/libretools.conf +custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf +[[ -e $custom_config ]] && source $custom_config + +if [ -w / ]; then + error "This script should be run as regular user" + exit 1 +fi + + +# End Config + +usage() { + cat <<EOU +LibreStage Copyright (C) 2011 Nicolás Reynolds +This program comes with ABSOLUTELY NO WARRANTY. +This is free software, and you are welcome to redistribute it +under the terms of the GNU General Public License version 3 or later. + + +Usage: $(basename $0) <repo> [<repo2> ... ] + +LibreRelease will stage for upload the package(s) built by the PKGBUILD on +the current directory to the specified repo(s). +EOU +} + +repos=$@ + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + esac +done + +if [ ${#repos} -eq 0 ]; then + usage + exit 1; +fi + +[[ ! -e ./PKGBUILD ]] && { + error "PKGBUILD not found" + exit 1 +} + +# Source the needed files +source /etc/makepkg.conf +[[ -e ~/.makepkg.conf ]] && source ~/.makepkg.conf +source ./PKGBUILD +[[ -e ./rePKGBUILD ]] && source ./rePKGBUILD + +# Default package location +PKGDEST=${PKGDEST:-.} +SRCPKGDEST=${SRCPKGDEST:-.} + +PKGEXT=".pkg.tar.?z" + +staged=false +# Copies the packages to the specified repos inside staging +for _arch in ${ARCHES[@]}; do + for pkg in ${pkgname[@]}; do + + pkgpath=$(find ${PKGDEST}/ -type f \ + -name "${pkg}-$(get_full_version "${pkg}")-${_arch}${PKGEXT}") + + [[ -z ${pkgpath} ]] && continue + + pkgfile=$(basename ${pkgpath}) + +# TODO refactor this + if [ -e "${pkgpath}" ]; then + msg "Found ${pkgfile}" + + canonical="" + for _repo in ${repos[@]}; do + + if [ ! -d "${WORKDIR}/staging/${_repo}" ]; then + warning "[${_repo}] didn't exist, creating..." + mkdir -p "${WORKDIR}/staging/${_repo}" + fi + + if [ -z "$canonical" ]; then + canonical="${WORKDIR}/staging/${_repo}/${pkgfile}" + + cp "${pkgpath}" "${WORKDIR}/staging/${_repo}/" || { + error "Can't put ${pkgfile} on [staging]" + exit 1 + } && { + msg2 "${pkg} staged on [${_repo}]" + staged=true + } + + else + ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { + error "Can't put ${pkgfile} on [staging]" + exit 1 + } && { + msg2 "${pkg} staged on [${_repo}]" + staged=true + } + + fi + done + fi + done +done + +if ! $staged ; then + error "No package was staged" + exit 1 +fi + +exit 0 @@ -0,0 +1,133 @@ +#!/bin/bash +# Copyright 2010 Nicolás Reynolds, Joshua Ismael + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola 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 3 of the License, or +# (at your option) any later version. + +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +. /etc/libretools.conf +. /etc/abs.conf + +cmd=${0##*/} + +usage() { + echo "Usage: $cmd pkgname-from-aur1 [pkgname-from-aur2 ...]" + echo + echo "This script will download packages from aur to the current dir" + echo "and check their license for nonfree issues." +} + +main() { + while getopts 'h' arg; do + case $arg in + h) usage; exit 0;; + *) usage; exit 1;; + esac + done + + local missing_deps=() + for _pkg in "$@"; do + + # Remove the version + _pkg="${_pkg%%[<>=]*}" + + if [[ -f "${_pkg}/PKGBUILD" ]]; then + warning "${_pkg} already existed." + + # Check if we want to diff + if [[ -z "${DIFFTOOL}" ]]; then + continue + else + # Store our copy of the PKGBUILD dir + _diff="${PWD}/${_pkg}" + stdnull "pushd $(mktemp --tmpdir -d ${_pkg}.XXXX)" + msg2 "Downloading PKGBUILD into ${PWD} for diff" + fi + fi + + msg "Downloading $_pkg..." + local url=https://aur.archlinux.org/packages/${_pkg:0:2}/${_pkg}/$_pkg.tar.gz + wget -O - -q "$url" | tar xzf - >/dev/null 2>&1 + + if [[ $? -ne 0 ]]; then + error "Couldn't get $_pkg" + continue + fi + + stdnull "pushd $_pkg" + + if [[ ! -z "$_diff" ]]; then + msg2 "Diffing files" + # Diff all files with our difftool + for file in *; do + "${DIFFTOOL}" "${_diff}/${file}" "${file}" + done + + # Go back to our copy to continue working + stdnull "pushd ${_diff}" + fi + + . PKGBUILD + + ################################################################ + + if ! pkgbuild-check-nonfree; then + if [[ $? = 15 ]]; then + warning "This PKGBUILD links to known unfree packages" + fi + fi + + ################################################################ + + msg2 "Checking license..." + local free=0 + for _license in ${license[@]}; do + if [[ ! -d /usr/share/licenses/common/$_license ]]; then + warning "License $_license is not a common license" + free=1 + fi + done + + if [[ $free -eq 1 ]]; then + plain "Please check that the license is included in the package and *specially* that it respects your freedom." + fi + + ################################################################ + + for _dep in "${depends[@]}" "${makedepends[@]}"; do + _dep=${_dep/[<>=]*/} + if ! is_built $_dep; then + if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then + msg2 "$_dep will be get from AUR" + missing_deps+=($_dep) + fi + else + msg2 "$_dep is on repos" + fi + done + + stdnull popd + done + + [[ ${#missing_deps[*]} -gt 0 ]] && { + msg2 "Retrieving missing deps: ${missing_deps[@]}" + $0 ${missing_deps[@]} + } + + exit 0 +} + +main "$@" diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile new file mode 100644 index 0000000..3ae95ea --- /dev/null +++ b/src/chroot-tools/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(sbindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup new file mode 100755 index 0000000..821c572 --- /dev/null +++ b/src/chroot-tools/chcleanup @@ -0,0 +1,57 @@ +#!/bin/bash -eE +# (c) Nicolás Reynolds <fauno@parabola.nu> +# Released under GPLv3 +# +# Performs chroot cleanup smartly, it only removes the unneeded packages or +# leaves you with a cleansystem +# +# See: HOOKPREBUILD + +DRYRUN=${DRYRUN:-false} +source "$(which libremessages)" + +if [[ ! -f /.arch-chroot ]] && ! ${DRYRUN}; then + error "(chcleanup): Must be run inside of a chroot" + exit 1 +fi + +source /etc/libretools.d/chroot.conf +# If we're running makepkg +if [ -f PKGBUILD ]; then + source PKGBUILD + CHROOTEXTRAPKG+=("${depends[@]}" + "${makedepends[@]}" + "${checkdepends[@]}") +fi + +msg "Cleaning chroot..." + +TEMPDIR="$(mktemp --tmpdir -d $(basename $0).XXXXX)" +cp -a /var/lib/pacman/sync "${TEMPDIR}/" +cleanup_log="${TEMPDIR}"/libretools-cleanup.log + +# Get the full list of packages needed by dependencies, including the base system +pacman -b "${TEMPDIR}" \ + -Sp --print-format "%n" \ + base base-devel sudo "${CHROOTEXTRAPKG[@]}" \ + >"${cleanup_log}" + +# Diff installed packages against a clean chroot then remove leftovers +packages=($(comm -23 <(pacman -Qq | sort -u) \ + <(sort -u "${cleanup_log}"))) + +RET=0 +if [[ ${#packages[@]} != 0 ]]; then + msg2 "Removing %d packages" ${#packages[@]} + + if ${DRYRUN}; then + echo "${packages[@]}" + else + # Only remove leftovers, -Rcs removes too much + pacman --noconfirm -Rn "${packages[@]}" || RET=$? + fi +fi +# Cleanup +rm -rf "${TEMPDIR}" + +exit $RET diff --git a/src/chroot-tools/chroot.conf b/src/chroot-tools/chroot.conf new file mode 100644 index 0000000..d84e8b4 --- /dev/null +++ b/src/chroot-tools/chroot.conf @@ -0,0 +1,13 @@ +# The full path to the chroot is +# $CHROOTDIR/$CHROOT/$CHROOTCOPY +# where $CHROOTCOPY is set at runtime, either +# - based on the username +# - set with the `-l COPY` flag +# The purpose of having a $CHROOT setting is that multiple clones of the same +# base $CHROOT can quickly and easily be created. +CHROOTDIR=/var/lib/archbuild +CHROOT=default + +# Extra packages to have installed on the chroot. +# This is in addition to CHROOTPKG=(base base-devel sudo) +CHROOTEXTRAPKG=(distcc ccache tsocks libretools) diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot new file mode 100755 index 0000000..7f113f5 --- /dev/null +++ b/src/chroot-tools/librechroot @@ -0,0 +1,164 @@ +#!/bin/bash -euE +# librechroot + +# Copyright 2010 Nicolás Reynolds +# Copyright 2011 Joshua Haase +# Copyright 2012 Luke Shumaker +# +# This file is part of Parabola. +# +# Parabola 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 3 of the License, or +# (at your option) any later version. +# +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +. /usr/share/libretools/conf.sh +load_conf_libretools_chroot + +. "$(which libremessages)" +. /usr/share/devtools/makechrootpkg.sh + +cleanup=(':'); +cleanup() { + for cmd in "${cleanup[@]}"; do + $cmd + done +} + +cmd=${0##*/} +usage() { + echo "Usage: $cmd [OPTIONS] " + echo 'Interacts with a chroot.' + echo '' + echo 'This command will make the following configuration changes in' + echo 'the chroot:' + echo " - overwrite \`/etc/libretools.d/chroot.conf'" + echo " - overwrite \`/etc/pacman.d/mirrorlist'" + echo " - set \`CacheDir' in \`/etc/pacman.conf'" + echo '' + echo 'Options:' + echo ' Settings:' + echo " -n <CHROOT> Use this chroot instead of \`$CHROOT'" + echo " -l <COPY> Use this chroot copy instead \`$CHROOTCOPY'" + echo ' -N Disable networking in the chroot' + echo '' + echo ' Modes: (the last mode given will be used)' + echo ' -C Clean /repo in the chroot' + echo ' -c Clean the packages installed in the chroot' + echo ' -I <FILE> Install the package FILE into the chroot' + echo ' -i <PKG> Install the package PKG from repos into the chroot' + echo ' -m Make sure the chroot exists; do nothing else' + echo ' -r <CMD> Run CMD in the chroot' + echo " -s Sync the copy with the \`root' copy" + echo ' -u Update the chroot' + echo ' -h Show this message' +} + +main() { + CHROOTCOPY=$LIBREUSER + [[ $CHROOTCOPY != root ]] || CHROOTCOPY=copy + + local mode=enter + local archroot_args=(-f) + local ARG='' + while getopts 'n:l:NCcI:i:mr:suh' arg; do + case $arg in + n) CHROOT=$OPTARG;; + l) CHROOTCOPY=$OPTARG;; + N) archroot_args+=(-N);; + + C) mode=clean_repo;; + c) mode=clean_pacman;; + I) mode=install_file; ARG=$OPTARG;; + i) mode=install_pkg; ARG=$OPTARG;; + m) mode=noop;; + r) mode=run; ARG=$OPTARG;; + s) mode=sync;; + u) mode=update;; + + h) usage; exit 0;; + *) usage; exit 1;; + esac + done + shift $(($OPTIND - 1)) + if [[ $# > 0 ]]; then + usage + exit 1 + fi + + # not local + rootdir="${CHROOTDIR}/${CHROOT}/root" + copydir="${CHROOTDIR}/${CHROOT}/${CHROOTCOPY}" + + ######################################################################## + + if (( EUID )); then + error "This script must be run as root." + exit 1 + fi + + # Keep this lock as long as we are running + # Note that '9' is the same FD number as in (mk)archroot + lock_open_write 9 "$copydir" \ + "Waiting for existing lock on \`$copydir' to be released" + + if [[ ! -d $rootdir ]]; then + libremkchroot "$CHROOT" + fi + + if [[ ! -d $copydir ]] && [[ $mode != sync ]]; then + chroot_sync + fi + + mkdir -p $copydir/etc/libretools.d + { + if [[ -n ${CHROOTEXTRAPKG[@]:-} ]]; then + printf 'CHROOTEXTRAPKG=(' + printf "'%s' " "${CHROOTEXTRAPKG[@]}" + printf ')\n' + else + printf 'CHROOTEXTRAPKG=()\n' + fi + } > $copydir/etc/libretools.d/chroot.conf + + ######################################################################## + + trap cleanup EXIT + case "$mode" in + clean_repo) + rm -rf "${copydir}/repo/*" + bsdtar -czf "${copydir}/repo/repo.db.tar.gz" -T /dev/null + ln -s "repo.db.tar.gz" "${copydir}/repo/repo.db" + ;; + clean_pacman) + cleanup+=("rm -f $copydir/clean $copydir/chrootexec") + cp -a "$(which chcleanup)" "${copydir}/clean" + echo '#!/bin/bash' > "${copydir}/chrootexec" + echo 'mkdir /build' >> "${copydir}/chrootexec" + echo 'cd /build; /clean' >> "${copydir}/chrootexec" + chmod 755 "${copydir}/chrootexec" + archroot "${archroot_args[@]}" "${copydir}" -r /chrootexec + ;; + install_file) + cleanup+=("rm $copydir/${ARG##*/}") + cp "$ARG" "$copydir/${ARG##*/}" + archroot "${archroot_args[@]}" "${copydir}" -r "pacman -U /${ARG##*/} --noconfirm" + ;; + install_pkg) archroot "${archroot_args[@]}" "${copydir}" -i $ARG ;; + noop) :;; + run) archroot "${archroot_args[@]}" "${copydir}" -r "$ARG" ;; + sync) chroot_sync;; + update) archroot "${archroot_args[@]}" "${copydir}" -u ;; + enter) archroot "${archroot_args[@]}" "${copydir}" -r bash ;; + esac +} + +main "$@" diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg new file mode 100755 index 0000000..a9e1fb7 --- /dev/null +++ b/src/chroot-tools/libremakepkg @@ -0,0 +1,187 @@ +#!/bin/bash -euE +# libremakepkg + +# Copyright 2010 - 2011 Nicolás Reynolds +# Copyright 2011 Joshua Ismael Haase Hernández +# Copyright 2012 Luke Shumaker +# +# This file is part of Parabola. +# +# Parabola 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 3 of the License, or +# (at your option) any later version. +# +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +. /usr/share/libretools/conf.sh +load_conf_libretools_chroot + +. "$(which libremessages)" +. /usr/share/devtools/makechrootpkg.sh + +shopt -s nullglob + +# Boring functions ############################################################# + +## +# End inmediately but print a useful message +## +trap_exit() { + copy_logs + error "$*" + exit 1 +} + +extract() { + local user=$LIBREUSER + $INCHROOT || user=nobody + + local clean + if $INCHROOT; then + clean=chcleanup + else + cp -a "$(which chcleanup)" "${copydir}/clean" + clean=/clean + fi + + chroot_exec "${clean} && sudo -u ${user} ${MAKEPKG} ${makepkg_args} -o" +} + +build() { + local user=$LIBREUSER + $INCHROOT || user=nobody + + chroot_exec -N "sudo -u ${user} ${MAKEPKG} ${makepkg_args} -e" +} + +# Functions that check for issues with the build ############################### + +check_pkgbuild() { + msg "Checking PKGBUILD for issues" + # TODO + if ! pkgbuild-check-nonfree -f; then + if [[ $? -eq 15 ]]; then + # other errors mean fail, not nonfree + error "PKGBUILD contains non-free issues" + exit 15 + else + warning "PKGBUILD couldn't be check aganist non-free issues" + fi + fi +} + +check_src() { + msg "Checking src directory for issues" + # TODO +} + +check_pkg() { + msg "Checking final package for issues" + # TODO +} + + +# The main program ############################################################# + +cmd=${0##*/} +usage() { + echo "Usage: $cmd [options] [-- makepkg args]" + echo 'This program will build your package.' + echo '' + echo 'If run from outside of a chroot, this will set PKGDEST and' + echo "SRCDEST in the chroot's \`/etc/makepkg.conf', as well as making" + echo "whataver alterations to the chroot \`librechroot' makes." + echo '' + echo 'Options:' + echo " -n <CHROOT> Use this chroot instead of \`$CHROOT'" + echo " -l <COPY> Use this chroot copy instead \`$CHROOTCOPY'" + echo " -m <MAKEPKG> Use the command MAKEPKG instead of \'makepkg'" + echo ' -h Show this message' +} + +main() { + # Parse command line ################################################### + + CHROOTCOPY=$LIBREUSER + [[ $CHROOTCOPY != root ]] || CHROOTCOPY=copy + + makepkg_args='-s --noconfirm -L ' + MAKEPKG=makepkg + + INCHROOT=false + if [[ -f /.arch-chroot ]]; then + INCHROOT=true + fi + + while getopts 'n:l:m:Rh' arg ; do + case "${arg}" in + n) CHROOT=$OPTARG;; + l) CHROOTCOPY=$OPTARG;; + m) MAKEPKG=$OPTARG;; + h) usage; exit 0;; + *) usage; exit 1;; + esac + done + shift $(($OPTIND - 1)) + # Pass all arguments after -- right to makepkg + makepkg_args+=" $*" + + if $INCHROOT; then + copydir='' + else + copydir="${CHROOTDIR}/${CHROOT}/${CHROOTCOPY}" + fi + + # Init ################################################################# + + if (( EUID )); then + error "This script must be run as root" + exit 1 + fi + + if [[ ! -f PKGBUILD ]]; then + # This is the message used by makepkg + error "PKGBUILD does not exist" + exit 1 + fi + + # Trap signals from makepkg + trap 'trap_exit "(libremakepkg): TERM signal caught. Exiting..."' TERM HUP QUIT + trap 'trap_exit "(libremakepkg): Aborted by user! Exiting..."' INT + trap 'trap_exit "(libremakepkg): An unknown error has occurred. Exiting..."' ERR + + SRCDEST="$(get_conf_makepkg SRCDEST .)" + PKGDEST="$(get_conf_makepkg PKGDEST .)" + + # OK, we're starting now ############################################### + + lock_open_write 9 "$copydir" \ + "Waiting for existing lock on \`$copydir' to be released" + + # Set target CARCH as it might be used within the PKGBUILD to select + # correct sources + MAKEPKG_CONF=$copydir/etc/makepkg.conf + export CARCH="$(get_conf_makepkg CARCH)" + unset MAKEPKG_CONF + + $INCHROOT || chroot_init + + check_pkgbuild + $INCHROOT || chroot_copy_in + extract + check_src + build + check_pkg + + add_to_local_repo + $INCHROOT || chroot_copy_out +} + +main "$@" diff --git a/src/chroot-tools/libremkchroot b/src/chroot-tools/libremkchroot new file mode 100755 index 0000000..6a13792 --- /dev/null +++ b/src/chroot-tools/libremkchroot @@ -0,0 +1,68 @@ +#!/bin/bash -euE +# libremkchroot + +# Copyright 2011, 2012 Luke Shumaker +# +# This file is part of Parabola. +# +# Parabola 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 3 of the License, or +# (at your option) any later version. +# +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +. /usr/share/libretools/conf.sh +load_conf_libretools_chroot + +. "$(which libremessages)" + +cmd=${0##*/} + +usage() { + echo "Usage: $cmd [OPTIONS] [CHROOT]" + echo 'This script will create a chroot to build packages in.' + echo "Use \`librechroot' to interact with the chroot after it is created." + echo '' + echo "The default CHROOT is \`${CHROOT}'." + echo '' + echo 'Options:' + echo ' -h Show this message' + echo '' + echo ' -C <file> Location of pacman config file.' + echo ' -M <file> Location of makepkg config file.' +} + +main() { + archroot_args=(-f); + while getopts 'hC:M:' arg; do + case "$arg" in + C|M) archroot_args+=("-$arg" "$OPTARG");; + + h) usage; exit 0;; + *) usage; exit 1;; + esac + done + shift $(($OPTIND - 1)) + case $# in + 0) :;; + 1) CHROOT="$1";; + *) usage; exit 1;; + esac + + if (( EUID )); then + error "This script must be run as root" + exit 1 + fi + + mkdir -p "${CHROOTDIR}/${CHROOT}" + archroot "${archroot_args[@]}" "${CHROOTDIR}/${CHROOT}/root" -i base base-devel sudo "${CHROOTEXTRAPKG[@]}" +} + +main "$@" diff --git a/src/devtools/.gitignore b/src/devtools/.gitignore new file mode 100644 index 0000000..e5e29ed --- /dev/null +++ b/src/devtools/.gitignore @@ -0,0 +1,17 @@ +*~ +devtools-*.tar.gz* +archbuild +archco +archrelease +archrm +bash_completion +checkpkg +commitpkg +finddeps +lddd +makechrootpkg +mkarchroot +rebuildpkgs +zsh_completion +find-libdeps +crossrepomove diff --git a/src/devtools/Makefile b/src/devtools/Makefile new file mode 100644 index 0000000..8b94f80 --- /dev/null +++ b/src/devtools/Makefile @@ -0,0 +1,55 @@ +V=20121128.6 + +PREFIX = /usr/local +pkgdatadir=$(PREFIX)/share/devtools + +BINPROGS = \ + checkpkg \ + find-libdeps \ + finddeps \ + lddd + +SBINPROGS = \ + mkarchroot + +all: $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion + +edit = sed -e "s|@pkgdatadir[@]|$(pkgdatadir)|g" + +%: %.in Makefile + @echo "GEN $@" + @$(RM) "$@" + @m4 -P $@.in | $(edit) >$@ + @chmod a-w "$@" + @chmod +x "$@" + +clean: + rm -f $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion + +install: all + install -dm0755 $(DESTDIR)$(PREFIX)/bin + install -dm0755 $(DESTDIR)$(PREFIX)/sbin + install -dm0755 $(DESTDIR)$(pkgdatadir) + + install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin +# install -m0755 ${SBINPROGS} $(DESTDIR)$(PREFIX)/sbin + install -m0755 mkarchroot $(DESTDIR)$(PREFIX)/sbin/archroot + + ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides + + install -m0644 lib/common.sh $(DESTDIR)$(pkgdatadir)/common.sh + install -m0644 makechrootpkg.in $(DESTDIR)$(pkgdatadir)/makechrootpkg.sh + install -Dm0644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools + install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools + +uninstall: + for f in ${BINPROGS} ; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done +# for f in ${SBINPROGS} ; do rm -f $(DESTDIR)$(PREFIX)/sbin/$$f; done + rm -f $(DESTDIR)$(PREFIX)/sbin/archroot + + rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides + + rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools + rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools + +.PHONY: all clean install uninstall diff --git a/README b/src/devtools/README index e10394f..e10394f 100644 --- a/README +++ b/src/devtools/README diff --git a/bash_completion.in b/src/devtools/bash_completion.in index 5e4fe66..5e4fe66 100644 --- a/bash_completion.in +++ b/src/devtools/bash_completion.in diff --git a/checkpkg.in b/src/devtools/checkpkg.in index a761df7..a761df7 100644 --- a/checkpkg.in +++ b/src/devtools/checkpkg.in diff --git a/find-libdeps.in b/src/devtools/find-libdeps.in index 7618850..7618850 100644 --- a/find-libdeps.in +++ b/src/devtools/find-libdeps.in diff --git a/finddeps.in b/src/devtools/finddeps.in index 656fe5a..656fe5a 100644 --- a/finddeps.in +++ b/src/devtools/finddeps.in diff --git a/gitconfig b/src/devtools/gitconfig index 890a5d0..890a5d0 100644 --- a/gitconfig +++ b/src/devtools/gitconfig diff --git a/lddd.in b/src/devtools/lddd.in index 4040ce6..4040ce6 100644 --- a/lddd.in +++ b/src/devtools/lddd.in diff --git a/lib/common.sh b/src/devtools/lib/common.sh index d6fbe7c..d6fbe7c 100644 --- a/lib/common.sh +++ b/src/devtools/lib/common.sh diff --git a/makechrootpkg.in b/src/devtools/makechrootpkg.in index 9e5b04f..9e5b04f 100644 --- a/makechrootpkg.in +++ b/src/devtools/makechrootpkg.in diff --git a/mkarchroot.in b/src/devtools/mkarchroot.in index 96f4399..96f4399 100644 --- a/mkarchroot.in +++ b/src/devtools/mkarchroot.in diff --git a/zsh_completion.in b/src/devtools/zsh_completion.in index ec07b3b..ec07b3b 100644 --- a/zsh_completion.in +++ b/src/devtools/zsh_completion.in diff --git a/src/diff-unfree b/src/diff-unfree new file mode 100755 index 0000000..24ada67 --- /dev/null +++ b/src/diff-unfree @@ -0,0 +1,86 @@ +#!/bin/bash +# This script will help you diff a *-libre PKGBUILD against the unfree one +# to check for updates. +# Copyright 2010 Nicolás Reynolds + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola 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 3 of the License, or +# (at your option) any later version. + +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +. /etc/libretools.conf + +cmd=${0##*/} + +usage() { + echo "Usage: $cmd [community|packages] [unfree-package] [repo]" + echo "Usage: $cmd --help" + echo "Helps you diff build scripts from ABSLibre against (Unfree) ABS." + echo "" + echo "Package name and repo will we guessed if you don't specify them." +} + +main() { + if [[ "$1" == "--help" ]]; then + usage + exit 0 + fi + + local package_guess=${PWD##*/} + local repo=${1:-$(basename ${PWD%/*})} + local package=${2:-${package_guess%-libre}} + local trunk=${3:-trunk} + + svnrepo="packages" + case $repo in + community*) svnrepo="community";; + multilib*) svnrepo="community";; + *) :;; + esac + + if [[ ! -r PKGBUILD ]]; then + error "This is not a build dir." + exit 1 + fi + + + tmp_dir="$(mktemp --tmpdir -d ${package}.XXXXXX)" + if [[ ! -d "${tmp_dir}" ]]; then + error "Can't create temp dir" + exit 1 + fi + unfree_dir="${tmp_dir}/${svnrepo}/${package}/${trunk}" + + stdnull 'pushd "${tmp_dir}"' + + msg "Getting diff from $repo/$package..." + + stdnull 'svn checkout --depth=empty svn://svn.archlinux.org/$svnrepo' + + cd ${svnrepo} + svn update ${package} + + # Back to start dir + stdnull popd + + msg "Diffing files" + + for _file in ${unfree_dir}/*; do + msg2 "$(basename "${_file}")" + ${DIFFTOOL} "$PWD/$(basename "${_file}")" "${_file}" + done +} + +main "$@" diff --git a/src/fullpkg/Makefile b/src/fullpkg/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/fullpkg/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/fullpkg/fullpkg b/src/fullpkg/fullpkg new file mode 100755 index 0000000..6d6153a --- /dev/null +++ b/src/fullpkg/fullpkg @@ -0,0 +1,34 @@ +#!/bin/bash +# set -x # uncomment for debug +# Builds packages from ABS recursively. It tries to find dependencies that +# aren't built or need update and then makepkg them in order. + +usage() { + + echo "cd to a dir containing a PKGBUILD and run:" + echo "$0 [build_dir]" + echo "" + echo "This script will check dependencies, build them if possible " + echo "and stage the packages on it's repo." + echo "" + echo "OPTIONS:" + echo " -h : this message." + echo "" + echo "Wrapper for \`fullpkg-find' and \`fullpkg-build'" + echo "" + exit 1 + +} + +while getopts 'h' arg; do + case "$arg" in + h) usage ;; + esac +done + +shift $(( OPTIND - 1 )) + +build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}" +fullpkg-find "$build_dir" && fullpkg-build -N "$build_dir" + +exit 0 diff --git a/src/fullpkg/fullpkg-build b/src/fullpkg/fullpkg-build new file mode 100755 index 0000000..b497db5 --- /dev/null +++ b/src/fullpkg/fullpkg-build @@ -0,0 +1,211 @@ +#!/bin/bash +# set -x # uncomment for debug +# Builds packages from ABS recursively. It tries to find dependencies that +# aren't built or need update and then makepkg them in order. + +# TODO move __build to chroot + +source /etc/makepkg.conf +source /etc/libretools.conf + +if [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then + source $XDG_CONFIG_HOME/libretools/libretools.conf +fi + + +## List packages on log that are on status +## usage: list_pkgs <status> <message> +# +## status: nonfree, built, failed, unstaged +list_pkgs() { + msg="$2" + local pkgs=($(grep "$1:" $build_dir/log)) && { + msg "$2" + echo ${pkgs[@]} | tr " " "\n" | cut -d: -f2 + } +} + +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) +get_fullver() { + if [[ $1 -eq 0 ]]; then +# zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + +} + +## Check all build_dir, fails if one PKGBUILD is nonfree +check_nonfree() { + find "$build_dir" -name PKGBUILD \ + -exec pkgbuild-check-nonfree {} + + if [ "$?" -eq 15 ]; then + error "Some PKGBUILD have nonfree problems" + exit 15 + fi + +} + +# Removes a package from the buildorder +# $1 package name +# $2 buildorder file +remove_buildorder() { + grep -Evw "${1}" ${2} > ${2}2 + mv -f ${2}2 ${2} + + return $? +} + +succesfull_build() { + + if [ "$RUN" != "$FULLBUILDCMD" ]; then + return 0 # Custom command or download sources + fi + + if source .INFO && [ -n "$repo" ]; then + + if [ ! -z "$HOOKLOCALRELEASE" ]; then + find -name "*.pkg.tar.?z" -print0 | xargs -0 "$HOOKLOCALRELEASE" "$repo" + fi + + librestage $repo || echo "unstaged:$(basename $PWD)" >>$build_dir/log + + msg "Updating pacman db and packages" + sudo pacman -Sy || true + + fi + + echo "built:$(basename $PWD)" >>$build_dir/log +} + +build_description() { + list_pkgs "nonfree" "Those packages contain nonfree deps:" + list_pkgs "built" "Those packages were built and staged:" + list_pkgs "failed" "Those packages failed to build:" + list_pkgs "unstaged" "Those packages couldn't be staged (missing reponame):" +} + +__build() { + pushd ${build_dir} >/dev/null + + build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first + + while [ ${#build_packages[@]} -ge 1 ]; do + + pushd "$build_dir/${build_packages[0]}" >/dev/null + + if [ -n "${HOOKPKGBUILDMOD}" ]; then + ${HOOKPKGBUILDMOD} || true + fi + + eval "$RUN"; r=$? + + case $r in + + 0) succesfull_build ;; + + *) error "There were errors while trying to build the package." + echo "failed:$(basename $PWD)" >>$build_dir/log + ;; + esac + + remove_buildorder "${build_packages[0]}" $buildorder || true + +# which is next package? + build_packages=($(sort -gr $buildorder | cut -d: -f2)) + popd > /dev/null + done + + popd >/dev/null +} + +# End inmediately but print a useful message +trap_exit() { + error "$@" + warning "Leftover files left on $build_dir" + mv .BUILDORDER BUILDORDER + exit 1 +} + +# Trap signals from makepkg +set -E +trap 'trap_exit "(fullpkg-build) TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "(fullpkg-build) Aborted by user! Exiting..."' INT +trap 'trap_exit "(fullpkg-build) An unknown error has occurred. Exiting..."' ERR + +CLEANUP="false" +CHECKNONFREE="true" +RUN="$FULLBUILDCMD" +MESSAGE="Building packages" + +usage() { + + echo "" + echo "$(basename $0) [options] <build_dir>" + echo "" + echo "Builds packages from build_dir, create a build_dir using:" + echo "'fullpkg-find <build_dir>'" + echo "" + echo "If no <build_dir> is specified, it uses the current directory." + echo "" + echo "OPTIONS:" + echo " -h : this message." + echo " -c : clean <build_dir> on succesfull build" + echo " -N : don't check for freedom issues." #Also made by fullpkg-find + echo " -r \"command\" : use this instead of \"$FULLBUILDCMD\"." + echo " -g : get sources for building packages on build_dir." + echo "" + exit 1 + +} + +while getopts 'hNr:g' arg; do + case $arg in + h) usage ;; + c) CLEAN ;; + N) CHECKNONFREE="false" ;; + r) RUN="$OPTARG" + MESSAGE="Executing custom action";; + g) RUN='makepkg -g > /dev/null' + MESSAGE="Downloading packages";; + esac +done + +shift $(( OPTIND - 1 )) +build_dir="${1:-`pwd`}" +buildorder="${build_dir}/BUILDORDER" + +if [ ! -e "$buildorder" ]; then + error "This is not a build_dir. Make one using fullpkg." + usage +else +# backup BUILDORDER + cp "$buildorder" "$build_dir/.BUILDORDER" +fi + +if "$CHECKNONFREE"; then + check_nonfree +fi + +if [ -z "$FULLBUILDCMD" ]; then + error "Set your FULLBUILDCMD on libretools.conf" +fi + +msg "$MESSAGE" +__build + +if [ "$RUN" != "$FULLBUILDCMD" ]; then + # Used for downloading or custom command + mv "$build_dir/.BUILDORDER" "$buildorder" + exit 0 +elif "$CLEANUP"; then + find "$build_dir" -mindepth 1 -delete +fi + +build_description + +plain "Test packages on and if they work fine librerelease." + +exit 0 diff --git a/src/fullpkg/fullpkg-find b/src/fullpkg/fullpkg-find new file mode 100755 index 0000000..b09edf9 --- /dev/null +++ b/src/fullpkg/fullpkg-find @@ -0,0 +1,211 @@ +#!/bin/bash +# set -x # uncomment for debug +# Builds packages from ABS recursively. It tries to find dependencies that +# aren't built or need update and then makepkg them in order. + +# TODO: fullpkg-find should find packages wich depend on the +# package to be build, so we can avoid "missing $name.so errors" + +# Get repo name. Asumes ${ABSROOT}/repo/package/PKGBUILD +guess_repo() { + basename $(dirname $(pwd)) +} + +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) +get_fullver() { + if [[ $1 -eq 0 ]]; then +# zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + +} + +copy_files() { + + local copydir="$build_dir/${pkgbase:-${pkgname[0]}}" + mkdir -p "$copydir" + + # Copy PKGBUILD and sources + cp PKGBUILD "$copydir" + ( + source PKGBUILD + for file in "${source[@]}"; do + file="${file%%::*}" + file="${file##*://*/}" + if [[ -f $file ]]; then + cp "$file" "$copydir/" + elif [[ -f $SRCDEST/$file ]]; then + cp "$SRCDEST/$file" "$copydir/" + fi + done + + # Find all changelog and install files, even inside functions + for i in 'changelog' 'install'; do + while read -r file; do + # evaluate any bash variables used + eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\" + [[ -f $file ]] && cp "$file" "$copydir" + done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) + done + ) +} + +# Checks ABSROOT and look for target pkg deps. Adds them if not built or outdated. +find_deps() { +# Check this level + source PKGBUILD + + local repo="${repo:-$(guess_repo)}" + local pkgbase="${pkgbase:-${pkgname[0]}}" + local fullver="$(get_fullver ${epoch:-0} ${pkgver} ${pkgrel})" + + if ! pkgbuild-check-nonfree > /dev/null 2> /dev/null; then + if [ "$?" -eq 15 ]; then + error "pkgbase" has nonfree issues + return 15 + fi + fi + + # Checking any package built, since otherwise e.g. kdebase would + # be always considered outdated: there is no package built named kdebase. + # TODO: maybe check for the package requested in case of recursive calls, + # instead of the first one listed? + if is_built "${pkgname[0]}" "${fullver}"; then + exit 0 # pkg is built and updated + fi + +# greater levels are built first + echo "${LEVEL}:${pkgbase}" >>"$build_dir/BUILDORDER" +# PKGBUILD is already there + if [ -d "${build_dir}/${pkgbase}" ]; then + exit 0 +# Copy dir to build_dir + else + copy_files + +# to identify repo later + echo "repo=$repo" > "${build_dir}/${pkgbase}/.INFO" + fi + +# current package plus a space for every level + msg2 "%${LEVEL}s${pkgbase}-${fullver}" + +## Check next levels + declare -i next_level=$LEVEL+1 + +# All deps in separate line, only once, without version. + deps=($(echo "${depends[@]} ${makedepends[@]}" | \ + sed "s/[=<>]\+[^ ]\+//g" | \ + tr ' ' "\n" | \ + sort -u)) + + for _dep in ${deps[@]}; do + + local found=false + # May fail, e.g. since abslibre-mips64el doesn't include + # arch=any packages. + local pkgdir=$(toru -p ${_dep}) || true + + if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then + found=true + + pushd "${pkgdir}" > /dev/null +# runs itself on dep's PKGBUILD dir + $0 -l ${next_level} ${build_dir} || return $? + popd > /dev/null + fi + + if ! (( found )); then + echo "dep_not_found:$_dep" >>$build_dir/log + fi + + done + +## End variable block + + unset next_level dir +} + +source /etc/libretools.conf +source /etc/makepkg.conf + +if [ -e $XDG_CONFIG_HOME/libretools/libretools.conf ]; then + source $XDG_CONFIG_HOME/libretools/libretools.conf +fi + +LEVEL=0 +MAXLEVEL=20 +CLEANFIRST='false' +UPDATEDB='true' + +usage() { + + echo "" + echo "cd to a dir containing a PKGBUILD and run:" + echo "$(basename $0) [options] <build_dir>" + echo "" + echo "This script will create a build_dir for recursive building" + echo "it tries to find dependencies that aren't built or need update." + echo "" + echo "If no <build_dir> is specified, the script works on a tempdir" + echo "" + echo "OPTIONS:" + echo " -h : this message." + echo " -A <absroot> : use this ABSROOT." + echo " -c : clean <build_dir> before working." + echo " -m <max_level> : check deps until this level" + echo " -n : don't update pacman db." + echo "" + exit 1 + +} + +while getopts 'hA:l:cmn' arg; do + case "$arg" in + h) usage ;; + A) ABSROOT="$OPTARG" ;; + l) LEVEL="$OPTARG" ;; # hidden option to know dep level. + c) CLEANFIRST='true' ;; + m) MAXLEVEL="$OPTARG" ;; + n) UPDATEDB='false' ;; + esac +done + +if [ ! -r PKGBUILD ]; then + error "This directory doesnt contain a PKGBUILD" + usage +fi + +shift $(( OPTIND - 1 )) +build_dir="${1}" + +if [ "$LEVEL" -eq 0 ]; then + + build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}" + + if [ ! -d "$build_dir" ]; then + mkdir -p "$build_dir" + elif "$CLEANFIRST"; then + # Erase files already in dir + msg "Cleaning up files in dir" + find "$build_dir" -mindepth 1 -delete + fi + + if "$UPDATEDB"; then + msg "Updating pacman db" + sudo pacman -Sy --noconfirm || true + fi + +# make files for log and buildorder + touch "${build_dir}"/{log,BUILDORDER} + buildorder="${build_dir}/BUILDORDER" + + msg "Checking dependencies" +fi + +find_deps + +exit 0 diff --git a/src/is_built b/src/is_built new file mode 100755 index 0000000..1fa79d2 --- /dev/null +++ b/src/is_built @@ -0,0 +1,36 @@ +#!/bin/bash +usage() { + echo "$0 " + echo + echo "Detect if a given package version is already in repos" + echo "Assuming you want greater or equal" + echo + echo "Example usage: is_built 'pcre' '20'" +} + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + *) usage; exit 1 ;; + esac +done + +ver=${2} +pkg=${1} +pver=$(LC_ALL=C pacman -Sddp --print-format "%v" "${pkg}" 2>/dev/null) + +# if pacman fails or returns nothing +r=$? +[ "${pver}" = " there is nothing to do" ] && r=1 + +result=$(vercmp "${pver}" "${ver}") + +# if vercmp > 1 means our version is bigger +if [ ${result} -ge 0 -a ${r} -eq 0 ]; then + exit 0 +else + exit 1 +fi + +# just in case +exit 1 diff --git a/src/is_unfree b/src/is_unfree new file mode 100755 index 0000000..c2a37c9 --- /dev/null +++ b/src/is_unfree @@ -0,0 +1,8 @@ +#!/bin/bash +# Checks if a package is on blacklist + +. /etc/libretools.conf + +blacklist="$XDG_CONFIG_HOME/libretools/blacklist.txt" +egrep -q "^${1}:" "${blacklist}" +exit $? diff --git a/src/lib/Makefile b/src/lib/Makefile new file mode 100644 index 0000000..0c69ba3 --- /dev/null +++ b/src/lib/Makefile @@ -0,0 +1,2 @@ +libre_datadir=$(datadir)/libretools +include ../../common.mk diff --git a/src/lib/conf.sh b/src/lib/conf.sh new file mode 100644 index 0000000..b11495d --- /dev/null +++ b/src/lib/conf.sh @@ -0,0 +1,116 @@ +#!/bin/bash + +INCLUDE_CONF_SH=conf.sh + +LIBREUSER="${SUDO_USER:-$USER}" +LIBREHOME="$(eval echo ~$LIBREUSER)" +if [[ -z ${XDG_CONFIG_HOME:-} ]]; then + export XDG_CONFIG_HOME="${LIBREHOME}/.config" +fi + +# Generic functions ############################################################ + +get_files() { + local slug=$1 + case $slug in + makepkg.conf) + if [[ $MAKEPKG_CONF != /etc/$slug && -r $MAKEPKG_CONF ]]; then + echo "$MAKEPKG_CONF" + else + echo /etc/$slug + echo "$LIBREHOME/.$slug" + fi + ;; + libretools.conf) + echo /etc/$slug + echo "$XDG_CONFIG_HOME/libretools/$slug" + ;; + *.conf) + echo /etc/libretools.d/$slug + echo "$XDG_CONFIG_HOME/libretools/$slug" + ;; + esac +} + +load_files() { + for file in $(get_files $1.conf); do + if [[ -r $file ]]; then + . "$file" + fi + done +} + +check_vars() { + local slug=$1 + shift + local ret=0 + for VAR in "$@"; do + if [[ -z ${!VAR} ]]; then + if [[ $(get_files $slug|wc -l) > 1 ]]; then + echo "Configure '$VAR' in one of:" + get_files $slug | sed 's/./ -> &/' + else + echo "Configure '$VAR' in $(get_files $slug)" + fi + ret=1 + fi >>/dev/stderr + done + if [[ $ret != 0 ]]; then + return 1 + fi +} + +# makepkg configuration ######################################################## + +[[ -n ${MAKEPKG_CONF:-} ]] || MAKEPKG_CONF=/etc/makepkg.conf + +load_conf_makepkg() { + load_files makepkg +} + +get_conf_makepkg() ( + set +euE + local setting=$1 + local default=$2 + load_conf_makepkg + printf '%s\n' "${!setting:-${default}}" +) + +set_conf_makepkg() { + local key=$1 + local val=$2 + for file in `get_files makepkg.conf|tac`; do + if [[ -w $file ]]; then + sed -i "/^\s*$key=/d" "$file" + echo "$key='$val'" >> "$file" + return 0 + fi + done + return 1 +} + + +# libretools configuration ##################################################### + +check_conf_libretools() { + check_vars libretools.conf \ + PARABOLAHOST LIBREDESTDIR BLACKLIST WORKDIR REPOS ARCHES \ + ABSLIBREGIT COMMITCMD DIFFTOOL FULLBUILDCMD SIGEXT SIGID +} + +load_conf_libretools() { + load_files libretools + check_conf_libretools +} + +load_conf_libretools_chroot() { + load_files chroot + # Exclude CHROOTEXTRAPKG from the checks because an empty value is valid + if [[ -f /.arch-chroot ]]; then + # inside of a chroot, only CHROOTEXTRAPKG needs to be set, but + # as stated above, we don't check for it. + : + else + check_vars chroot.conf CHROOTDIR CHROOT + fi +} diff --git a/src/librediff b/src/librediff new file mode 100755 index 0000000..6dbe41b --- /dev/null +++ b/src/librediff @@ -0,0 +1,57 @@ +#!/bin/bash +# Generates a patch for a nonfree PKGBUILD +# +# Copyright 2010 Nicolás Reynolds + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola 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 3 of the License, or +# (at your option) any later version. + +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +. /etc/libretools.conf + +cmd=${0##*/} + +usage() { + echo "Usage: $cmd <pkgname> [<pkgname2> ...]" + echo "Requirements:" + echo " * Have a <pkgname>/ directory with nonfree build scripts inside" + echo " * Have a <pkgname>-libre/ directory with libre build scripts inside" +} + +main() { + local packages=("$@") + if [[ ${packages[#]} = 0 ]]; then + usage + exit 1 + fi + + for package in "${packages[@]}"; do + if [[ ! -f ./${package}/PKGBUILD || ! -f ./${package}-libre/PKGBUILD ]] + then + error "Build scripts not found for ${package}(-libre)" + else + + . ./${package}-libre/PKGBUILD + [[ -z ${pkgbase} ]] && pkgbase=${pkgname} + + # Generate a diff file, no -r since we don't want to patch src/ nor pkg/ + diff -auN ${package} ${package}-libre > $PATCHDIR/${pkgbase}-${pkgver}-${pkgrel}.patch + done + + exit 0 +} + +main "$@" diff --git a/src/libremessages b/src/libremessages new file mode 100755 index 0000000..ccb5fb4 --- /dev/null +++ b/src/libremessages @@ -0,0 +1,85 @@ +#!/bin/bash +# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> +# Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org> +# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com> +# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu> +# Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk> +# Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.org> +# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org> +# Copyright (c) 2011 by Joshua Haase <hahj87@gmail.com> +# +# 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 3 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, see <http://www.gnu.org/licenses/>. + +################################################################################ +# Inherit most functions from devtools # +################################################################################ + +# This is only installed in Parabola's distribution of devtools, not Arch's +. /usr/share/devtools/common.sh + +################################################################################ +# gettext initialization # +################################################################################ + +export TEXTDOMAIN='libretools' +export TEXTDOMAINDIR='/usr/share/locale' + +################################################################################ +# Devtools overrides # +################################################################################ + +# Override several functions with built-in text to uses gettext + +warning() { + local mesg=$1; shift + printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +error() { + local mesg=$1; shift + printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +stat_done() { + printf "${BOLD}$(gettext "done")${ALL_OFF}\n" >&2 +} + +################################################################################ +# Own functions # +################################################################################ + +stdnull() { + eval "$@ >/dev/null 2>&1" +} + +# Set the terminal title +term_title() { + local fmt='' + case "$TERM" in + screen|tmux) fmt='\ek%s\e\\';; + xterm*|rxvt*) fmt='\e]0;%s\a';; + esac + printf "$fmt" "$*" +} + +################################################################################ +# Run one of the defined functions if invoked directly # +################################################################################ + +if [[ "${0##*/}" = libremessages ]]; then + _libremessages_cmd=$1 + shift + "$_libremessages_cmd" "$@" + unset _libremessages_cmd +fi diff --git a/src/librerepkg b/src/librerepkg new file mode 100755 index 0000000..85c58d9 --- /dev/null +++ b/src/librerepkg @@ -0,0 +1,69 @@ +#!/bin/bash +# Copyright 2011 Joshua Ismael Haase Hernandez + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola 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 3 of the License, or +# (at your option) any later version. + +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +. /etc/libretools.conf +. /etc/makepkg.conf +. /etc/abs.conf + +cmd=${0##*/} + +usage() { + echo "cd to a dir with a rePKGBUILD and other file info and run" + echo "$cmd [makepkg flags]" + echo "" + echo "This script will repackage an arch package without compiling" +} + +main() { + while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + esac + done + makepkgflags=("$@") + + if [[ ! -r rePKGBUILD ]]; then + error "This build does not contains a rePKGBUILD." + exit 1 + fi + . rePKGBUILD + + tempdir="$(mktemp --tmpdir -d ${PWD##*/}.XXXXX)" + + msg "Copying files" + cp ./* "${tempdir}/" + + for _arch in "${arch[@]}"; do + msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))" + stdnull pushd "${tempdir}" + + msg2 "Updating md5sums" + makepkg -gp rePKGBUILD >> rePKGBUILD + + echo "export CARCH=${_arch}" >> rePKGBUILD + + msg "Repackaging using makepkg" + makepkg -Lcdp rePKGBUILD "${makepkgflags[@]}" + + stdnull popd "${tempdir}" + done +} + +main "$@" diff --git a/src/libretools.conf b/src/libretools.conf new file mode 100644 index 0000000..777758c --- /dev/null +++ b/src/libretools.conf @@ -0,0 +1,104 @@ +#!/bin/bash + +################################################################################ +# misc # +################################################################################ + +## Blacklist URL +## Used by `pkgbuild-check-nonfree` +BLACKLIST=http://repo.parabolagnulinux.org/docs/blacklist.txt + +## Diff tool (vimdiff, gvimdiff, meld, etc) +## Used by `aur`, `diff-unfree` +DIFFTOOL=`which vimdiff gvimdiff meld colordiff diff 2>/dev/null|sed 's/\s.*//;1q'` + +## The repos you'll be packaging for +## Used by `toru`, `createworkdir`, `prfullpkg` +# Tip: As early repos take precedence on $REPOS loops, you can use this as +# inverted order of precedence. Put testing repos first so fullpkg find new +# PKGBUILDs first, for instance. Toru-path uses reverse order to enforce repo +# precedence on the path cache (the last path added replaces the rest) +REPOS=('core' 'libre' 'extra' 'community' 'libre-testing' 'social' 'sugar' 'pcr' 'java') + +## The architectures +## Used by `librestage` +ARCHES=('i686' 'x86_64' 'mips64el' 'any') + +################################################################################ +# abslibre # +################################################################################ + +# The dir where you work on +WORKDIR=/home/$USER/packages + +## Package signing +SIGEXT=".sig" +#SIGID="0xYOURID" + +## Parabola hostname +PARABOLAHOST=parabola +## Assumes something similar in your .ssh/config: + +## Repo server +# Host parabola +# Port 1863 +# HostName repo.parabolagnulinux.org +# User repo + +## Server destination of libre packages +# Don't change unless you know what you're doing and you won't screw +# anything ;) +LIBREDESTDIR=/srv/http/repo/public + +## ABSLibre +ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git + +## Commit Command +## Should be git or hg +## Uncomment only one of those +COMMITCMD=git +#COMMITCMD=hg + +################################################################################ +# fullpkg # +################################################################################ + +## Uncomment one of those or make one of your choice +# Normal fullpkg +FULLBUILDCMD="sudo libremakepkg" +# Cross compiling fullkpg +# FULLBUILDCMD="sudo libremakepkg -n cross-compile-chroot" +# Build from within the chroot (or host system) +# FULLBUILDCMD="makepkg -sL --noconfirm" + +# Run a command before releasing a package (ie. SSH connection, SSH tunnel, etc.) +HOOKPRERELEASE="ssh -fN parabola" + +# Run a command before running FULLBUILDCMD, usually to cleanup uneeded packages +# Note! chcleanup *is not* chroot aware, if you run it as it is it will cleanup +# your system +# HOOKPREBUILD="chcleanup" + +# Locally release the package or any other action after running FULLBUILDCMD +# succesfully +# HOOKLOCALRELEASE="" + +################################################################################ +# toru # +################################################################################ + +TORUPATH=/var/lib/libretools/toru + +################################################################################ +# Stub for old programs; wouldn't normally be in a .conf file # +################################################################################ + +if [[ -z ${INCLUDE_CONF_SH:-} ]]; then + . /usr/share/libretools/conf.sh + if [[ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]]; then + . "$XDG_CONFIG_HOME/libretools/libretools.conf" + fi + check_conf_libretools || exit $? + + . /usr/bin/libremessages +fi diff --git a/src/mips64el-tools/Makefile b/src/mips64el-tools/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/mips64el-tools/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/mips64el-tools/add-mips64el b/src/mips64el-tools/add-mips64el new file mode 100755 index 0000000..e06d857 --- /dev/null +++ b/src/mips64el-tools/add-mips64el @@ -0,0 +1,6 @@ +#!/bin/bash +# Change all arch array that aren't any or mips64el already + +find -name 'PKGBUILD' -exec sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" '{}' \; + +exit $? diff --git a/src/mips64el-tools/librebasebuilder b/src/mips64el-tools/librebasebuilder new file mode 100755 index 0000000..f7d3a25 --- /dev/null +++ b/src/mips64el-tools/librebasebuilder @@ -0,0 +1,84 @@ +#!/bin/bash +# -*- coding: utf-8 -*- +# Copyright (C) 2012 Michał Masłowski <mtjm@mtjm.eu> +# +# 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 3 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +set -e + +# TODO: + +# - make it more configurable + +# - compare the result with previous base images + +for arg in "$@" ; do + case "$arg" in + -h|--h|--he|--hel|--help|-\?) + echo 'Usage: librebasebuilder + +Make a base tarball named parabola-mips64el-DATE.tar.bz2. + +This script must be run as root.' >&2 + exit 0 + ;; + esac +done + +[[ "$UID" != "0" ]] && { + echo "This script must be run as root." >&2 + exit 1 +} + +tempdir=/home/chroot/base +outdir=$(pwd) + +mkarchroot -n $tempdir mkinitcpio base sudo parted nano zile vi ed openssh + +cd $tempdir + +# Don't list mtjm's DNS servers. +cat > etc/resolv.conf <<EOF +# +# /etc/resolv.conf +# + +#search <yourdomain.tld> +#nameserver <ip> + +# End of file +EOF + +# From pacman-mirrorlist-libre-20120307-1. Remember to escape dollars. +cat > etc/pacman.d/mirrorlist <<EOF +# Parabola GNU/Linux - Last Updated: Wed Mar 7 17:33:36 GMT 2012 + +# Atlanta, GA, USA +# Responsible: belos +Server = http://parabola.techno-geeks.org/\$repo/os/\$arch + +# Nuremberg, Germany +# Responsible: johkra +Server = http://parabolaweb.eu/\$repo/os/\$arch + +# UK +# Responsible: Parabola Project +Server = http://repo.parabolagnulinux.org/\$repo/os/\$arch + +EOF + +rm .arch-chroot + +tar cjf $outdir/parabola-mips64el-$(LC_ALL=C date -u +%Y%m%d).tar.bz2 . diff --git a/src/mips64el-tools/mips-add b/src/mips64el-tools/mips-add new file mode 100755 index 0000000..da9b431 --- /dev/null +++ b/src/mips64el-tools/mips-add @@ -0,0 +1,7 @@ +#!/bin/bash +source /etc/libretools.conf +if ! grep mips64el PKGBUILD >/dev/null; then # Add mips64el in ${arch} array if it isn't 'any' + warning "Adding mips64el arch" + sed -i "s/^\(arch=([^)anym]\+\))/\1 'mips64el')/" "PKGBUILD" + librecommit PKGBUILD +fi diff --git a/src/mips64el-tools/mips64el.conf b/src/mips64el-tools/mips64el.conf new file mode 100644 index 0000000..836b407 --- /dev/null +++ b/src/mips64el-tools/mips64el.conf @@ -0,0 +1,12 @@ +## Arquitecture specific commands + +## Run a command for PKGBUILD modifications before building +## Like adding 'mips64el' to arch if it's not there +# HOOKPKGBUILDMOD="mips-add" + +## Run a command for local releasing of packages +# Useful for mass packaging (ie. mips port) +# Must accept the following parameters even if the command won't use them: +# $1 repo name +# $2+ packages +# HOOKLOCALRELEASE="mipsrelease" diff --git a/src/mips64el-tools/mipsrelease b/src/mips64el-tools/mipsrelease new file mode 100755 index 0000000..4d7a7de --- /dev/null +++ b/src/mips64el-tools/mipsrelease @@ -0,0 +1,65 @@ +#!/bin/bash +# Lic: GPLv3+ +# Author: Nicolas Reynolds <fauno@kiwwwi.com.ar> +# Local release of mips64el packages + clean ABS sync +# Called by HOOKLOCALRELEASE + +# $1 repo +# $2+ packages + +source /etc/makepkg.conf +source /etc/libretools.conf + +libretoolsdir="$(dirname $0)/../" + +usage() { + echo "$0 repo package1 [ package2 ... packageN ]" + echo + echo " release packages locally on ${PKGDEST}/stage3." + echo " and make a clean ABS sync " +} + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + +repo=$1; shift + +if [ -z "${repo}" ]; then + error "Empty repo" + exit 1 +fi + +# Get all needed sources +source PKGBUILD +fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) +pkgs=() +makepkg --source -f --skippgpcheck + +msg "Adding packages to [stage3]..." +for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + pkgs+=("${PKGDEST}/${name}-${fullver}-*.pkg.tar.*") +done + +repo-add ${PKGDEST}/stage3.db.tar.gz ${pkgs[@]} + +librestage ${repo} + + +mkdir -p ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null + +pushd ${WORKDIR}/abs/${CARCH}/${repo} >/dev/null + tar xvf $SRCPKGDEST/${pkgbase:-${pkgname[0]}}-${fullver}${SRCEXT} +popd >/dev/null + +exit $? diff --git a/src/pkgbuild-check-nonfree b/src/pkgbuild-check-nonfree new file mode 100755 index 0000000..0fd480c --- /dev/null +++ b/src/pkgbuild-check-nonfree @@ -0,0 +1,187 @@ +#!/bin/bash +# pkgbuild-check-nonfree +# Copyright 2010 Joshua Ismael Haase Hernández, Joseph Graham +# Copyright 2012 Luke Shumaker + +# ---------- GNU General Public License 3 ---------- + +# This file is part of Parabola. + +# Parabola 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 3 of the License, or +# (at your option) any later version. + +# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>. + +. /etc/libretools.conf + +cmd=${0##*/} +ev=0 + +# log_end() { +# kill "$teepid" +# rm "$logpipe" +# } + +# log() { +# local LOG="pkgbuild-check-nonfree-$(date -u +%Y%m%d).log" +# # ensure overridden package variables survive tee with split packages +# logpipe="$(mktemp)" +# mkfifo "$logpipe" +# tee "$LOG" < "$logpipe" & +# teepid=$! +# trap log_end ERR EXIT +# } + + +unset_pkgbuild() { + unset 'pkgbase' 'pkgname' 'pkgver' 'pkgrel' 'epoch' 'pkgdesc' \ + 'arch' 'url' 'license' 'groups' 'optdepends' 'provides' \ + 'conflicts' 'replaces' 'backup' 'options' 'install' \ + 'changelog' 'source' 'noextract' 'md5sums' 'build' \ + 'check' 'package' 'depends' 'makedepends' 'checkdepends' +} + +assert_pkgbuild() { + if [ -e "$1" ]; then + + source "$1" + if [ -n "${pkgname[0]}" ]; then + return 0 # valid PKGBUILD + fi + + fi + + error "$1 is not a valid PKGBUILD" + return 1 +} + +check_replacement() { + [ $2 ] || return 0 # Free (not found) + local needle=$1; shift + local item + local rep + for line in $@; do + + local item="$(echo "$line" | cut -d':' -f1)" + local rep="$(echo "$line" | cut -s -d':' -f2)" + + if [ "$item" == "$needle" ]; then + if [ -z "$rep" ]; then + return 15 # Nonfree (found) + else + echo "$rep" + return 0 # Free (has replacement) + fi + fi + + done + return 0 # Free (not found) +} + +## +# Download the blacklist. +## +get_blacklist() { + mkdir -p "$XDG_CONFIG_HOME/libretools" + pushd "$XDG_CONFIG_HOME/libretools" >/dev/null + + msg "Downloading the blacklist of proprietary software packages." + + if ! wget -N -q -O blacklist.txt "${BLACKLIST}" 2>/dev/null; then + + if [ -e "$XDG_CONFIG_HOME/libretools/blacklist.txt" ]; then + warning "Using local copy of blacklist" + else + error "Download failed, exiting" + fi + + fi + + popd > /dev/null +} + +## +# Check wheter a package depends on non-free +## +check_deps() { + unset_pkgbuild + if ! assert_pkgbuild "$1"; then + exit 1 # not PKGBUILD + fi + + msg2 "${pkgbase:-${pkgname[0]}} $pkgver $pkgrel ${epoch:-""}" # > "$logpipe" + + for pkg in "${pkgname[@]}" "${depends[@]}" "${makedepends[@]}" "${checkdepends[@]}"; do + + local lines=($(grep "$pkg" "$XDG_CONFIG_HOME/libretools/blacklist.txt" | tr " " "_")) + + local rep="$(check_replacement $pkg ${lines[@]})" + local freedom=$? + + if [[ $freedom = 15 ]]; then + warning "found $pkg" # > "$logpipe" + ev=15 + elif [ -n "$rep" ]; then + if [ "$rep" = "$pkg" ]; then + plain "$pkg is repackaged with the same name." # > "$logpipe" + else + plain "$pkg -> $rep" # > "$logpipe" + fi + fi + done +} + +usage() { + # TODO: implement PKGBUILD arguments + echo "Usage: $cmd [OPTIONS] [PKGBUILD1 PKGBUILD2 ...]" + echo "" + echo "If no PKGBUILD is specified, \`./PKGBUILD' is implied" + echo "" + echo "Options:" + echo " -f Allow running as root user" + echo " -h Show this message" +} + +main() { + local asroot=false + while getopts 'fh' arg; do + case "$arg" in + f) asroot=true;; + h) usage; exit 0;; + *) usage; exit 1;; + esac + done + shift $(($OPTIND - 1)) + pkgbuilds=("$@") + if [[ $# < 1 ]]; then + pkgbuilds=("`pwd`/PKGBUILD") + fi + + if [[ -w / ]] && ! $asroot; then + error "Run as normal user" + exit 1 + fi + + get_blacklist + # log + + msg "Looking for unfree dependencies" + + for p in "${pkgbuilds[@]}"; do + if [[ -n "$p" ]]; then + check_deps "$p" + fi + done + + return $ev +} + +main "$@" diff --git a/src/toru/Makefile b/src/toru/Makefile new file mode 100644 index 0000000..f2cec54 --- /dev/null +++ b/src/toru/Makefile @@ -0,0 +1,3 @@ +libre_execdir=$(bindir) +libre_datadir=$(sysconfdir)/libretools.d +include ../../common.mk diff --git a/src/toru/toru b/src/toru/toru new file mode 100755 index 0000000..28f0b8a --- /dev/null +++ b/src/toru/toru @@ -0,0 +1,314 @@ +#!/bin/bash +# Queries the ABS +# License: GPL3 + +## TODO +# * Add license text +# * Create symlinks from pkgbase to pkgname[@] for easy package finding + +## GOALS +# * Have a searchable database of PKGBUILD metadata +# * Have an interface for source-only builds +# * Possibility to hook up ABS dirs besides ABSROOT (low priority) +# * Tell updates and non available binary packages (working on this) + +source $(dirname $(command -v $0))/toru-utils + +# Saves contents on a named cache +# $1 cache name (repo) +# $2+ contents +function store_cache { + cache=$1; shift + + [ -z "$cache" ] && return 1 + + cat $@ > ${TORUPATH}/${cache}.cache + + return $? +} + +# Return cache contents +# $1 cache name +read_cache() { + cat ${TORUPATH}/${1}.cache 2>/dev/null + + return $? +} + +## +# usage : get_full_version( $epoch, $pkgver, $pkgrel ) +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +## +get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi +} + +# Outputs an ordered package-fullpkgver array +print_package_array() { + echo "$@" | tr " " "\n" | sort -u +} + + +# Gets repo.db contents (unordered) +# $1 repo +get_db_contents() { + [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 + + bsdtar -tf /var/lib/pacman/sync/$1.db | cut -d'/' -f1 | sort -u +} + +# Get the pkgname +# pkgname from pkgver separator can be either '-' or ' ' +extract_pkgname() { + echo "$@" | tr " " "\n" | sed "s/^\(.\+\)[- ][^-]\+-[^-]\+$/\1/" +} + +# Get all the pkgnames from a file +# pkgname from pkgver separator can be either '-' or ' ' +extract_pkgname_from_file() { + sed "s/^\(.\+\)[- ][^-]\+-[^-]\+$/\1/" $1 +} + +# Split pkgnames from pkgvers +split_pkgname_from_pkgver() { + sed "s/^\(.\+\)-\([^-]\+-[^-]\+\)$/\1 \2/" $1 +} + +# Get the fullpkgver +# pkgname from pkgver separator can be either '-' or ' ' +extract_fullpkgver() { + echo "$@" | tr " " "\n" | sed "s/^.\+[ -]\([^-]\+-[^-]\+\)$/\1/" +} + +# Checks if $1 is a valid repo +is_repo() { + if ! in_array ${1} ${REPOS[@]}; then + $quiet || warning "${1} is not a valid repo (check REPOS array at libretools.conf)" + return 1 + fi +} + +# Updates the database by finding all PKGBUILDS +# Workflow: +# * Find all PKGBUILDs on the ABS repo specified +# * Get all packages already on package repos +# * Compare them +# Args: +update() { + local update_sync_file=false +# The PKGBUILDs found + local -a pkgbuilds=() +# The list of pkgname-fullpkgver + local -a packages_in_abs=() + local -a pkg_updates=() + local -a package_paths=() + +# Traverse all specified repos + for __repo in $@; do +# Check if the repo is set as such, otherwise skip + is_repo ${__repo} || continue + +# Fullpath of the repo + _repopath=$(readlink -f ${__repo}) + +# This is the syncfile, stores the last date as content and mtime + local lastsyncfile=${TORUPATH}/${__repo}.lastsync + +# Find all the PKGBUILDs newer than the last update +# Update newer, otherwise everything + if [[ $force = true || ! -e ${lastsyncfile} ]]; then + + $quiet || warning "Forcing upgrade" +# Get all PKGBUILDs + pkgbuilds=($(find ${_repopath} -maxdepth 2 -type f -name 'PKGBUILD')) + + else + +# Only find newer than lastsyncfile and read everything else from cache + pkgbuilds=($(find ${_repopath} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) + packages_in_abs=($(read_cache ${__repo})) + + $quiet || msg2 "Getting ${#packages_in_abs[@]} packages from cache" + + fi + + package_paths=($(read_cache ${__repo}.paths || true)) + +# Inform how many PKGBUILDS were found and quit immediately if none + $quiet || msg "Found $((${#pkgbuilds[*]}-1)) PKGBUILDs to update" + +# Traverse all found PKGBUILDs + for _pkgbuild in ${pkgbuilds[@]}; do +# Update the sync file because there are pkgbuilds to update + update_sync_file=true + +# Load PKGBUILD's metadata + source ${_pkgbuild} || continue + +# Guess pkgbase from PKGBUILD's basedir + _pkgpath=$(dirname "${_pkgbuild}") + _pkgbase=${pkgbase:-${pkgname[0]}} + +# We won't need this (all unsets are for memory efficiency) + unset build package url md5sums install pkgdesc backup options +# TODO fill a license list + unset license +# TODO create source tarballs? + unset mksource +# TODO solve dependency tree? + unset depends makedepends + + for _pkg in ${pkgname[@]}; do +# Keep removing unneeded stuff + unset package_${_pkg} >/dev/null 2>&1 || true +# Fill the list of packages to find + packages_in_abs+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) + package_paths+=($_pkg:$_pkgpath) + done # end pkgnames + + unset pkgbase pkgname pkgver pkgrel source epoch + done # end pkgbuilds + +# Sync! (Only if there was an actual sync) + ${update_sync_file} && lastsync ${lastsyncfile} + + if [ "${lastsyncfile}" -nt "${TORUPATH}/${__repo}.paths.cache" ]; then + print_package_array "${package_paths[@]}" > $TMPDIR/paths + store_cache ${__repo}.paths $TMPDIR/paths + fi + +# If there isn't an update cache or it's older than the last update, we check + if [ "${lastsyncfile}" -nt "${TORUPATH}/${__repo}.updates.cache" ]; then + +# Get repo database contents + packages_in_sync=($(get_db_contents ${__repo})) +# Drops arrays into files + print_package_array "${packages_in_abs[@]}" > ${TMPDIR}/packages_in_abs + print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync + +# Work with files + unset packages_in_abs package_in_sync + +# Use a different separator for pkgnames and pkgvers +# so we can join them by pkgname (first field) + split_pkgname_from_pkgver ${TMPDIR}/packages_in_abs | sort -k1b,1 > ${TMPDIR}/in_abs + split_pkgname_from_pkgver ${TMPDIR}/packages_in_sync | sort -k1b,1 > ${TMPDIR}/in_sync + + $quiet || msg "These packages are available to update" +# Join both files by pkgname, the end result is: +# pkgname syncver absver + join ${TMPDIR}/in_sync ${TMPDIR}/in_abs | \ + while read need_line; do + _pkg=$(echo "${need_line}" | cut -d' ' -f1) + _syncver=$(echo "${need_line}" | cut -d' ' -f2) + _absver=$(echo "${need_line}" | cut -d' ' -f3) + +# If the versions differ we need an update +# TODO move this to update query + if [ "${_syncver}" != "${_absver}" ]; then + $quiet || msg2 "$_pkg update from $_syncver to $_absver" + $quiet && echo "$_pkg" + +# FIXME this works all right but it's unset once the while ends + #pkg_updates+=("$_pkg") + +# Fix for the above problem, but it access the file every time instead of +# puting all packages together once + echo $_pkg >> ${TMPDIR}/updates + + fi + done # end need_line + + unset _pkg _syncver _absver need_line + +# Save the cache + store_cache ${__repo} ${TMPDIR}/packages_in_abs + +# See above FIXME + # print_package_array "${updates[@]}" > ${TMPDIR}/updates + if [ -r ${TMPDIR}/updates ]; then + store_cache ${__repo}.updates ${TMPDIR}/updates + fi + + else + $quiet || msg "Reading updates from cache..." + read_cache ${__repo}.updates + fi + + done # end repos +} + +# Find all the packages that are missing from the repo dbs (aka not built) +missing() { + true +} + +## Finds a PKGBUILD on toru's path cache +## usage: where_is <pkgname> +# Look in all caches but pick the first one +where_is() { + local __repo + local _path + for __repo in ${REPOS[@]}; do + _path=$(grep "^${1}:" "${TORUPATH}/${__repo}.paths.cache" 2>/dev/null | + cut -d: -f2) + + [ -n "${_path}" ] && break + done + + [ -z "$_path" ] && return 1 + + echo ${_path} +} + +# TODO: clean usage instructions +function usage { + echo "" + echo "$0 [options] repo1 ... repon" + echo "" + echo "Make a db containing PKGBUILD metadata." + echo "" + echo "-h : this message" +# echo "-a : update all repos at once" + echo "-u : update repo information" + echo "-q : quiet" + echo "-f : rebuild the db even if it is updated" + echo "-p <pkgname>: return the path for pkgname" + echo "" + exit 1 +} + +## MAIN +commands=() +repos=() +quiet=false +force=false +while getopts 'haqfpum' arg; do + case $arg in + h) usage; exit 0 ;; +# TODO: Update all repos on $REPOS array +# a) update_all_repos ;; + q) quiet=true ;; + f) force=true ;; + u) commands+=(update);; + p) shift $(( OPTIND - 1 )) + where_is "$1" || exit 1;; + m) commands+=(missing);; + esac + + shift $(( OPTIND - 1 )) +done + + +TMPDIR=$(mktemp -d) + +[[ -z ${TMPDIR} ]] && exit 1 + +${commands[0]} ${@} + +exit $? diff --git a/src/toru/toru-info b/src/toru/toru-info new file mode 100755 index 0000000..523f682 --- /dev/null +++ b/src/toru/toru-info @@ -0,0 +1,28 @@ +#!/bin/bash +# Prints info about a given pkgname +source /etc/libretools.conf + +for _pkg in $@; do + _pkgbuild="$(toru-where $_pkg)" + + if [ -f "$_pkgbuild/PKGBUILD" ]; then + source "$_pkgbuild/PKGBUILD" 2>/dev/null || { + warning "Errors on %s" $_pkg + continue + } + + deps="${depends[@]} ${makedepends[@]} ${checkdepends[@]}" + repo="$(basename $(dirname "$_pkgbuild"))" + + unset build package depends makedepends checkdepends optdepends source md5sums + + msg "%s/%s %s-%s" $repo $_pkg $pkgver $pkgrel + msg2 "$pkgdesc" + msg2 "$url" + msg2 "Depends: ${deps}" + else + warning "%s doesn't exist" $_pkg + fi + + unset pkgname pkgver pkgrel pkgdesc url +done diff --git a/src/toru/toru-path b/src/toru/toru-path new file mode 100755 index 0000000..baeaeb5 --- /dev/null +++ b/src/toru/toru-path @@ -0,0 +1,50 @@ +#!/bin/bash + +source $(dirname $(command -v $0))/toru-utils + +TORUPATH=${T:-${TORUPATH}} +VERBOSE=${V:-false} + +if [ ! -w "$TORUPATH" ]; then + error "Toru's path isn't writable. Please check $TORUPATH" + exit 1 +fi + +LASTSYNCFILE=${TORUPATH}/lastsync.paths +PATHFILE=${TORUPATH}/paths.tch + +if [ ! -e "${PATHFILE}" ]; then + tcamgr create "${PATHFILE}" +fi + +# TODO pass other paths via flags +# ABSROOT has trailing slash +fullrepos=() +for (( i = ${#REPOS[@]}-1 ; i >= 0 ; i-- )); do + ${VERBOSE} && msg "Processing [%s]" ${REPOS[$i]} + + [ -d "${ABSROOT}${REPOS[$i]}" ] && \ + fullrepos+=("${ABSROOT}${REPOS[$i]}") +done +pkgbuilds=($(get_pkgbuilds ${fullrepos[@]})) + +msg "Updating path cache" +msg2 "${#pkgbuilds[@]} PKGBUILDs to update" +for _pkgbuild in ${pkgbuilds[@]}; do +# plain "$_pkgbuild" + source ${_pkgbuild} >/dev/null 2>&1 || { + error "${_pkgbuild} contains errors, skipping" + continue + } + + fullpath=$(dirname ${_pkgbuild}) + + for _pkg in ${pkgbase} ${pkgname[@]} ${provides[@]}; do + $VERBOSE && msg2 "${_pkg} -> ${fullpath}" + tcamgr put ${PATHFILE} ${_pkg/[<>=]*} ${fullpath} + done + + unset pkgbase pkgname provides +done + +lastsync ${LASTSYNCFILE} diff --git a/src/toru/toru-utils b/src/toru/toru-utils new file mode 100755 index 0000000..316e6b8 --- /dev/null +++ b/src/toru/toru-utils @@ -0,0 +1,76 @@ +#!/bin/bash + +source /etc/abs.conf +source /etc/libretools.conf + +LASTSYNCFILE=${TORUPATH}/lastsync +FORCE=false +QUIET=false +DEBUG=false + +# usage : in_array( $needle, $haystack ) +function in_array { + [[ $2 ]] || return 1 # Not found + + local needle=$1; shift + local item + + for item in "$@"; do + [[ ${item#@} = $needle ]] && return 0 # Found + done + + return 1 # Not Found +} + +# Stores the lastsync date +lastsync() { + local lastsyncfile + + lastsyncfile=$1 + + [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { + error "The sync date can't be saved. ${lastsyncfile} isn't writable." + return 1 + } + + date +%s > ${lastsyncfile} + touch ${lastsyncfile} +} + +get_dbs() { + local _db + for _db in /var/lib/pacman/sync/*.db; do + bsdtar tf ${_db} | cut -d'/' -f1 | sort -u + done +} + +# repo paths +get_pkgbuilds() { + pkgbuilds=() + + if [[ $FORCE = true || ! -e ${LASTSYNCFILE} ]]; then + + $QUIET || warning "Forcing upgrade" +# Get all PKGBUILDs + extra="" + else +# Only find newer than lastsyncfile and read everything else from cache + extra=" -newer ${LASTSYNCFILE}" + fi + +# Return all PKGBUILDs found + find $@ -mindepth 2 -maxdepth 3 -type f -name 'PKGBUILD' ${extra} +} + +# End inmediately but print a useful message +trap_exit() { + error "$@" + + exit 1 +} + +# Trap signals from makepkg +set -E +trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "Aborted by user! Exiting..."' INT +trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR diff --git a/src/toru/toru-where b/src/toru/toru-where new file mode 100755 index 0000000..e9ab29d --- /dev/null +++ b/src/toru/toru-where @@ -0,0 +1,7 @@ +#!/bin/bash +# Locates a PKGBUILD dir on toru's path cache +source /etc/libretools.conf + +PATHFILE=${TORUPATH}/paths.tch + +tcamgr get ${PATHFILE} $1 2>/dev/null || echo "" diff --git a/src/treepkg b/src/treepkg new file mode 100755 index 0000000..8c4cc8e --- /dev/null +++ b/src/treepkg @@ -0,0 +1,237 @@ +#!/bin/bash +#set -x +# (c) 2012 Nicolás Reynolds <fauno@parabola.nu> +# +# 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 3 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +source /etc/libretools.conf +source $XDG_CONFIG_HOME/libretools/libretools.conf >/dev/null 2>&1|| true + +term_title "$(basename $0)" + +# Get system variables +source /etc/makepkg.conf +source $HOME/makepkg.conf >/dev/null 2>&1|| true + +# End inmediately but print an useful message +trap_exit() { + term_title "error!" + error "($(basename $0)) $@ (leftovers on ${BUILDDIR})" + exit 1 +} + +# Trap signals from makepkg +set -E +trap 'trap_exit "TERM signal caught. Exiting..."' TERM HUP QUIT +trap 'trap_exit "Aborted by user! Exiting..."' INT +trap 'trap_exit "An unknown error has occurred. Exiting..."' ERR + +# return : full version spec, including epoch (if necessary), pkgver, pkgrel +# usage : get_fullver( ${epoch:-0}, $pkgver, $pkgrel ) +get_fullver() { + if [ $1 -eq 0 ]; then +# zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + +} + +# Add line to build order cache in CSV format +# *must* be run from the PKGBUILD path +# status;depth;pkgbase;[epoch:]pkgver-pkgrel;path;repo +# $1 status +# $2 pkgname +add_order() { + echo "${1};${DEPTH};${2:-${pkgbase}};${fullver};${PWD};$(guess_repo "$PWD")" >> "${BUILDORDER}" + ${VERBOSE} && msg2 "%${DEPTH}s${2:-${pkgbase}} [${1}]" || true +} + +# Bury a package deeper in the tree +# $1 pkgbase +# $2 nextdepth +bury() { +# Bury only if we are going to build the dep +# Get it's current depth and dir name + local current_depth=$(grep "build;[0-9]\+;${1};" "${BUILDORDER}" | cut -d ';' -f 2) + local current_name="$(printf "%03d" ${current_depth})_${1}" + +# If there's a depth or the package is not the root of the build tree (which +# can lead to funny chicken-and-egg problems), update the depth to the current +# package next-depth and rename the dir too + if [ -z "${current_depth}" ]; then return; fi + if [ -z "${current_name}" ]; then return; fi + if [ ${current_depth} -eq 0 ]; then return; fi + if [ ${current_depth} -ge $2 ]; then return; fi + + ${VERBOSE} && msg "Burying ${1} from ${current_depth} to ${2}" + + { + sed -i "s|^\(build;\)\([0-9]\+\)\(;${1};.*\)$|\1${2}\3|" "${BUILDORDER}" && \ + mv "${BUILDDIR}/${current_name}" "${BUILDDIR}/$(printf "%03d" ${2})_${1}" + } || return 1 +} + +# Guess the repo from the pkgbase path +# $1 path, pwd or toru-where +guess_repo() { + basename "$(dirname "${1}")" +} + +if [ ! -f PKGBUILD ]; then + error "Missing PKGBUILD ($PWD)" + exit 1 +fi + +if ! source PKGBUILD ; then + error "Can't source PKGBUILD" + exit 1 +fi + +# Save resources +unset pkgdesc arch license groups backup install md5sums sha1sums \ + sha256sums source options >/dev/null 2>&1 + +unset build package >/dev/null 2>&1 + +for _pkg in ${pkgname[@]}; do + unset package_${_pkg} >/dev/null 2>&1 || true +done +## + +# Get useful values +pkgbase="${pkgbase:-${pkgname[0]}}" +fullver=$(get_fullver ${epoch:-0} ${pkgver} ${pkgrel}) + +# Get or set the work dir +BUILDDIR="${1:-$(mktemp -d /tmp/${pkgbase}-treepkg-XXXx)}" +BUILDORDER="${BUILDDIR}/BUILDORDER" +DEPTH=${2:-0} +NEXTDEPTH=$((${DEPTH} + 1)) +# This can be set as env vars (ie: $ V=false B=false treepkg) +# TODO Turn into flags? +VERBOSE=${V:-true} +BUILD=${B:-true} +CLEANUP=${C:-true} +# Skip BUILDORDER creation and build anything on BUILDDIR +BUILDNOW=${N:-false} + +if [ ! -z "${1}" -a ${DEPTH} -eq 0 ]; then + BUILDNOW=true +fi + +if ! ${BUILDNOW}; then +# ensure it exists + touch "${BUILDORDER}" + +# If this package is already built quit silently + for _pkg in ${pkgname[@]}; do + if is_built "${_pkg}" "${fullver}"; then + add_order "ignore" + exit 0 + fi + done + +# Ignore if already in build order + egrep -q ";${pkgbase};" "${BUILDORDER}" && exit 0 + +# Add pkgbase to build order + add_order "build" + +# Copy the directory to the build dir +# TODO run makepkg --source to avoid moving garbage around? + cp -r "${PWD}" "${BUILDDIR}/$(printf "%03d" ${DEPTH})_${pkgbase}" + +# Cleanup dep versioning + deps=($(echo "${depends[@]} ${makedepends[@]}" | \ + sed "s/[=<>]\+[^ ]\+//g" | \ + tr ' ' "\n" | \ + sort -u)) + +# NOTE: getting depends from package() is a PITA + for _dep in ${deps[@]}; do +# Move deps deeper in the tree if +# pkgbase - dep1 +# \ dep2 - dep1 +# dep1 should be depth + 1 + egrep -q ";${_dep};" "${BUILDORDER}" && bury "${_dep}" ${NEXTDEPTH} + +# Ask toru where's a PKGBUILD + depdir="$(toru-where ${_dep})" + + if [ -z "${depdir}" -o ! -d "${depdir}" ]; then +# We specify the pkgname because we can't source the dep PKGBUILD +# Normally 'any' packages are missing from our work ABS + add_order "missing" "${_dep}" + continue + fi + + pushd "${depdir}" >/dev/null + +# Run itself over dependencies + $0 "${BUILDDIR}" ${NEXTDEPTH} + + done +# End BUILD now +fi + +# Only build at the end +if [ ${DEPTH} -eq 0 ]; then + ${VERBOSE} && msg "Starting build" || true + + if ${BUILD}; then + ${VERBOSE} && msg "Build tree stored in ${BUILDORDER}" || true + +# Build everything sorting the build dir +# The reverse order ensures we start by the deepest packages + for _pkg in $(ls -r "${BUILDDIR}"); do +# Ignore if there's no PKGBUILD + if [ ! -f "${BUILDDIR}/${_pkg}/PKGBUILD" ]; then continue; fi +# Skip if already built (faster than calling is_build again) + if [ -f "${BUILDDIR}/${_pkg}/built_ok" ]; then continue; fi + + ${VERBOSE} && msg "Building ${_pkg/_/ }" || true + +# Remove leading zeros and space if any + term_title "$(echo ${_pkg/_/ } | sed "s/^0\+ \?//")" + +# Run build command + pushd "${BUILDDIR}/${_pkg}" >/dev/null + sudo pacman -Syu --noconfirm + + ${HOOKPREBUILD} + + ${FULLBUILDCMD} +# Run local release hook with $1 = $repo + ${HOOKLOCALRELEASE} $(egrep ";${_pkg#*_};" "${BUILDORDER}" | cut -d';' -f6) + + touch built_ok + popd >/dev/null + done + + else +# Just print the working dir + ${VERBOSE} || echo "${BUILDORDER}" || true + fi + +if ${CLEANUP} ; then + msg2 "Removing ${BUILDDIR}" + rm -rf "${BUILDDIR}" +fi + +fi + +term_title "done" +exit $? |