debdry-0.2.2/ 0000755 0001750 0001750 00000000000 13003542276 012662 5 ustar pabs pabs 0000000 0000000 debdry-0.2.2/PKG-INFO 0000644 0001750 0001750 00000001760 13003542276 013763 0 ustar pabs pabs 0000000 0000000 Metadata-Version: 1.1
Name: debdry
Version: 0.2.2
Summary: Semi-assisted automatic Debian packaging
Home-page: https://anonscm.debian.org/cgit/collab-maint/debdry.git
Author: Enrico Zini
Author-email: enrico@debian.org
License: GPL3
Description: debdry is for debian/ directories what debhelper7 is for debian/rules.
It applies the Don't Repeat Yourself idea to packaging, attempting to reuse as
much as possible of upstream's metadata and standard packaging practices.
debdry runs an appropriate auto-debianisation tool for a given source
directory, then applies manual overrides from a debian.in directory.
debdry supports the following types of packages (in brackets you will find
extra packages that need to be installed for each type of package):
- Perl [dh-make-perl]
- Python [python-stdeb, python3-stdeb]
- Ruby [gem2deb]
- Haskell [cabal-debian]
Platform: any
Requires: apt
debdry-0.2.2/debdry.1 0000644 0001750 0001750 00000001471 13003542275 014217 0 ustar pabs pabs 0000000 0000000 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH DEBDRY "1" "October 2016" "debdry 0.1" "User Commands"
.SH NAME
debdry \- Merge manually and automatically generated debian/ packaging.
.SH DESCRIPTION
usage: debdry [\-h] [\-\-version] [\-v] [\-\-debug] [\-r] [\-\-dry] [dir]
.PP
Merge manually and automatically generated debian/ packaging.
.SS "positional arguments:"
.TP
dir
package source directory, default: .
.SS "optional arguments:"
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-\-version\fR
show program's version number and exit
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Verbose output
.TP
\fB\-\-debug\fR
Debug output
.TP
\fB\-r\fR, \fB\-\-restore\fR
Undebianise, leaving only debdry files in debian/
.TP
\fB\-\-dry\fR
Take an existing package and add a minimal debian/debdry/
debdry-0.2.2/README.md 0000640 0001750 0001750 00000016647 13003334507 014147 0 ustar pabs pabs 0000000 0000000 # debdry
Debian, Don't Repeat Yourself.
debdry is a tool for semi-assisted automatic Debian packaging. It tries to be
for entire debian/ directories what debhelper7 is for debian/rules.
Most upstreams already provide a reasonable amount of packaging metadata in
their tarballs, and we already have auto-debianisation tools that generate a
reasonable debian/ directory from them, requiring few manual edits to be ready
for upload.
There is no reason to rewrite upstream package descriptions, dependencies, and
so on. If an upstream's tarball packaging can use improvements, instead of
working around it in `debian/` we can improve it and send upstream our patch:
*we will give back to the free software community*.
## How it works
When `debdry` is run, it:
1. moves the contents of your `debian/` directory aside;
2. it chooses and runs an automatic debianisation tool;
3. it applies your manual changes on top of the autogenerated `debian/`, to
produce the final source package;
4. it stores the original `debian/` directory in `debian/debdry` so that the
process can be reversed.
## Merging
This section describes the merging logic so far. The merging happens between an
`auto` directory and a `manual` directory, to generate the `debian` directory.
* If a file exists in `manual` but not in `auto`, then it is copied to `debian`.
* If a file exists in `auto` but not in `manual`, then it is copied to `debian`.
* `changelog` is always copied from `manual` to `debian`.
* `rules`: see Merging `debian/rules` below.
* `control`: see "Merging `debian/control`" below.
* Any other file that exists in both directories is copied from `manual` to
`debian`.
### Merging `debian/rules`
If `rules` in `manual` starts with `#!`, then it is copied to `debian`.
If `rules` in `manual` does not start with `#!`, then the version in `manual`
is appended to the version in `auto` to create the version for `debian`.
The rationale for this is that the auto-generated `debian/rules` file will
generally be a simple debhelper invocation, and if any changes are needed to
that, they are likely to be in the form of overrides. One just needs to
maintain the overrides, and `debdry` will append them to the autogenerated
`debian/rules`.
### Merging `debian/control`
Control files are merged on a section by section basis. Sections are identified
by their `Source:` or `Package:` fields.
The `control` file in `debian` is built by concatenating:
1. The merged source section from the `manual` and `auto` control files.
2. All the binary sections that are in `auto` but not in `manual`.
3. All the binary sections that are in `manual` but not in `auto`.
Sections are merged as follows:
* All fields from `auto` are used.
* All fields that exist in `manual` but not in `auto` are added.
* For all fields that exist in both, the version from `manual` is used.
If a field in `manual` starts with `X-Debdry-`, then the `X-Debdry-` prefix is
stripped and the field contents are merged smartly. See "Smart merging" below.
After merging, the fields appear in the order suggested by libapt-pkg.
### Smart merging
`manual` fields starting with `X-Debdry-` are merged smartly into their `auto`
counterpart. Smart merging is implemented for `Uploaders:` fields and all
fields that list package dependencies.
If `auto` is missing, the field contents are taken as is.
If `auto` exists, then:
* If an uploader email address, or a package name, exists in both values, the
version from `manual` is used.
* Otherwise, the `manual` value is appended to the `auto` fields.
This can be used to add uploaders or dependencies, to fix uploader names, and
to tweak versioning constraints in dependencies.
## Auto-packaging tools by language
### Python
The tool is [python-stdeb](https://pypi.python.org/pypi/stdeb/), supported by
debdry.
### perl
The tool is [dh-make-perl](http://search.cpan.org/~dam/DhMakePerl/dh-make-perl),
supported by debdry.
### ruby
The tool is [dh-make-ruby](https://wiki.debian.org/Teams/Ruby/Packaging#gem2deb_as_the_preferred_packaging_tool_for_ruby_software),
supported by debdry.
### autotools
I cannot think of anything better than [dh-make](https://packages.debian.org/search?keywords=dh-make)
at the moment, but I haven't spent much time thinking about it yet.
### haskell
The tool is [cabal-debian](https://hackage.haskell.org/package/cabal-debian),
supported by debdry.
### node.js
[npm2debian](https://github.com/arikon/npm2debian) exists; I need help from
someone who uses it to add support to debdry and test it.
## Diffing
You can run `debdry` with `--dry` on an existing package to create
`debian/debdry` with a simplified version of the packaging.
The result currently needs manual tweaking:
* generation of `X-Debdry-` fields is not supported, so the `control` file will
not be as small as it can be.
* generation of `debian/rules` deltas is not supported: a
`debian/debdry/rules.diff` will be generated instead.
## Rationale
I'm generally fond of the DRY principle (http://c2.com/cgi/wiki?DontRepeatYourself)
but every time I package software for Debian I feel WET (Write
Everything Twice) instead.
Many upstream ecosystems have started including enough metadata in their
upstream packaging to significantly overlap with debian/. Think
short/long descriptions, upstream URLs, licenses, dependencies.
When the upstream packaging is well made, there is usually not much else
to add to a dh-make-equivalent initial boilerplate code, besides testing
and taking responsibility for it. Maintaining software in Debian should
be about testing and taking responsibility for it, not about retyping
things that upstream has already typed.
What if upstream got it wrong? It often happens. In that case, we can
patch their sources, and send them the patch. That way, instead of
having our own private work-arounds, we make the packaging better for
everyone, even those who do not use Debian.
The idea of debdry is to regenerate the debian/ directory every time a new
version of the software is packaged, using the dh-make-equivalent for the given
package type. It then takes manually maintained data and uses it to complete
the packaging.
At each new version there is a chance for the debianisation to be
updated: the Python team switches from dh_pysupport to dh_python2? Your
package will automatically follow (provided python-stdeb is updated
accordingly, but that is another story).
I like how with debhelper7 we are writing debian/rules files that only
describe how the package diverges from a standard. I want to do exactly
the same for the whole debian/ directory. Ideally, the debian.in/
directory used by debdry should only describe how the upstream packaging
diverges from a standard in a way that cannot be fixed by patching it.
I have no intention of having debdry replace hand-writing debian/
directories, nor have it handle all possible corner cases. I aim at it
being useful in the general case. I want to address the ordinary,
routine, boring work, and leave the rest as it is.
## TODO list
* Remove need for identifying source/binary stanzas, since we know that some
fields are only in one or the other. This means that single-binary packages
do not need to mark debian/control stanzas with `Source: name` or
`Package: name` fields.
* Add a README.Source or README.Debdry to the generated debian/ directory,
explaining that the hand-maintained files are actually in debian/debdry.
* Add a debdry-specific conffile in debian/ to allow specifying a custom
command (or list of commands) for auto-debianisation.
debdry-0.2.2/robotic-minion 0000755 0001750 0001750 00000001715 13003527773 015551 0 ustar pabs pabs 0000000 0000000 #!/bin/sh
set -e
CMD=${1:?"Usage: $0 man|deb|debsrc"}
regenerate_manpages()
{
COLUMNS=200 help2man --name='Merge manually and automatically generated debian/ packaging.' --section=1 --no-info ./debdry > debdry.1
pandoc --standalone --to man \
-V title:git-debry-build \
-V section:1 \
-V footer:"$(./debdry --version)" \
-V header:'User commands' \
-V date:"$(LANG=C date -d "$(dpkg-parsechangelog -SDate)" '+%B %Y')" \
-o git-debdry-build.1 git-debdry-build.md
sed -i -e '/\.TH/ a .SH NAME\
git-debdry-build \\- simple wrapper around debdry and git-buildpackage' git-debdry-build.1
}
action="$1"
shift
case "$action" in
man)
regenerate_manpages
;;
deb|debsrc)
regenerate_manpages
python setup.py sdist
mmv "dist/debdry-*.tar.gz" "../debdry_#1.orig.tar.gz"
rmdir dist
rm -rf debdry.egg-info/
if [ "$action" = 'debsrc' ]; then
build_flags='-S'
fi
export PATH="$(dirname $0):${PATH}"
git-debdry-build $build_flags "$@"
;;
esac
debdry-0.2.2/COPYING 0000640 0001750 0001750 00000104513 12442173606 013720 0 ustar pabs pabs 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
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.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 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 .
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:
Copyright (C)
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
.
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
.
debdry-0.2.2/test/ 0000755 0001750 0001750 00000000000 13003542276 013641 5 ustar pabs pabs 0000000 0000000 debdry-0.2.2/test/test_control.py 0000640 0001750 0001750 00000010237 13003334727 016731 0 ustar pabs pabs 0000000 0000000 import unittest
from debdrylib.tree import Control
def doctrim(docstring):
"""
Trim a docstring-like string.
"""
maxint = 9999
# From http://legacy.python.org/dev/peps/pep-0257/#handling-docstring-indentation
if not docstring:
return ''
# Convert tabs to spaces (following the normal Python rules)
# and split into a list of lines:
lines = docstring.expandtabs().splitlines()
# Determine minimum indentation (first line doesn't count):
indent = maxint
for line in lines[1:]:
stripped = line.lstrip()
if stripped:
indent = min(indent, len(line) - len(stripped))
# Remove indentation (first line is special):
trimmed = [lines[0].strip()]
if indent < maxint:
for line in lines[1:]:
trimmed.append(line[indent:].rstrip())
# Strip off trailing and leading blank lines:
while trimmed and not trimmed[-1]:
trimmed.pop()
while trimmed and not trimmed[0]:
trimmed.pop(0)
# Return a single string:
return '\n'.join(trimmed)
class TestCombine(unittest.TestCase):
def _parse_control(self, buf):
# TODO: deindent buf
return Control.scan_string("control", "./control", buf)
def assertCombines(self, c1, c2, expected):
c1 = self._parse_control(doctrim(c1))
c2 = self._parse_control(doctrim(c2))
c = c1.combine("control", "./control", c2)
self.assertEquals(c.to_string().strip(), doctrim(expected))
def test_plainfield(self):
self.assertCombines(
"""
Source: foo
Maintainer: Enrico Zini
""",
"""
Source: foo
Maintainer: Enrico Zini
""",
"""
Source: foo
Maintainer: Enrico Zini
""")
def test_smartfield_plain(self):
self.assertCombines(
"""
Source: foo
Build-Depends: python3-all, foo
""",
"""
Source: foo
Build-Depends: python3-all, dh-python
""",
"""
Source: foo
Build-Depends: python3-all, dh-python
""")
def test_smartfield_smart(self):
self.assertCombines(
"""
Source: foo
Build-Depends: python3-all, foo
""",
"""
Source: foo
X-Debdry-Build-Depends: python3-all, dh-python
""",
"""
Source: foo
Build-Depends: python3-all, foo, dh-python
""")
class TestDiff(unittest.TestCase):
def _parse_control(self, buf):
# TODO: deindent buf
return Control.scan_string("control", "./control", buf)
def assertDiffs(self, c1, c2, expected):
c1 = self._parse_control(doctrim(c1))
c2 = self._parse_control(doctrim(c2))
c = c1.diff("control", "./control", c2)
self.assertEquals(c.to_string().strip(), doctrim(expected))
def test_plainfield(self):
self.assertDiffs(
"""
Source: foo
Maintainer: Enrico Zini
""",
"""
Source: foo
Maintainer: Enrico Zini
""",
"""
Source: foo
Maintainer: Enrico Zini
""")
def test_smartfield_plain(self):
self.assertDiffs(
"""
Source: foo
Build-Depends: python3-all, foo
""",
"""
Source: foo
Build-Depends: python3-all, dh-python
""",
"""
Source: foo
Build-Depends: python3-all, dh-python
""")
def test_smartfield_smart(self):
self.assertDiffs(
"""
Source: foo
Build-Depends: python3-all, foo
""",
"""
Source: foo
Build-Depends: python3-all, foo, dh-python
""",
"""
Source: foo
X-Debdry-Build-Depends: dh-python
""")
debdry-0.2.2/test/c++/ 0000755 0001750 0001750 00000000000 13003542276 014211 5 ustar pabs pabs 0000000 0000000 debdry-0.2.2/test/c++/hello.cc 0000640 0001750 0001750 00000000164 12442173606 015623 0 ustar pabs pabs 0000000 0000000 #include
using namespace std;
int main(int argc, const char* argv[])
{
cout << "Hello." << endl;
}
debdry-0.2.2/test/c++/configure.ac 0000640 0001750 0001750 00000000602 12442173606 016474 0 ustar pabs pabs 0000000 0000000 dnl Process this file with autoconf to produce a configure script.
AC_INIT(hello, [1.0], [enrico@enricozini.org])
AC_CONFIG_SRCDIR([configure.ac])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
AC_LANG([C++])
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_STDC
AC_HEADER_STDC
dnl Give me warnings
AX_CXXFLAGS_WARN_ALL
AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT
debdry-0.2.2/test/c++/Makefile.am 0000640 0001750 0001750 00000000203 12442173606 016237 0 ustar pabs pabs 0000000 0000000 ## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = hello
hello_SOURCES = hello.cc
debdry-0.2.2/test/data/ 0000755 0001750 0001750 00000000000 13003542276 014552 5 ustar pabs pabs 0000000 0000000 debdry-0.2.2/test/data/20141016-control-trailing-commas 0000640 0001750 0001750 00000005312 12442173606 022135 0 ustar pabs pabs 0000000 0000000 Source: haskell-hoauth2
Maintainer: Debian Haskell Group
Uploaders: Joachim Breitner
Priority: extra
Section: haskell
Build-Depends: debhelper (>= 7.0),
haskell-devscripts (>= 0.8),
cdbs,
ghc,
ghc-prof,
libghc-aeson-dev (>= 0.7),
libghc-aeson-dev (<< 0.8),
libghc-aeson-prof,
libghc-bytestring-show-dev (>= 0.3.5),
libghc-bytestring-show-dev (<< 0.4),
libghc-bytestring-show-prof,
libghc-http-conduit-dev (>= 2.0),
libghc-http-conduit-dev (<< 2.2),
libghc-http-conduit-prof,
libghc-http-types-dev (>= 0.8),
libghc-http-types-dev (<< 0.9),
libghc-http-types-prof,
libghc-monad-control-dev (>= 0.3),
libghc-monad-control-dev (<< 0.4),
libghc-monad-control-prof,
libghc-mtl-dev (>= 1),
libghc-mtl-dev (<< 2.3),
libghc-mtl-prof,
libghc-random-dev,
libghc-random-prof,
libghc-text-dev (>= 0.11),
libghc-text-dev (<< 1.2),
libghc-text-prof,
Build-Depends-Indep: ghc-doc,
libghc-aeson-doc,
libghc-bytestring-show-doc,
libghc-http-conduit-doc,
libghc-http-types-doc,
libghc-monad-control-doc,
libghc-mtl-doc,
libghc-random-doc,
libghc-text-doc,
Standards-Version: 3.9.5
Homepage: http://hackage.haskell.org/package/hoauth2
X-Description: OAuth2 authentication for Haskell
This library provies OAuth2 authentication for Haskell applications.
.
It was te tested against the following services
.
* google web oauth:
* weibo oauth2:
* github oauth:
Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-hoauth2
Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-hoauth2
Package: libghc-hoauth2-dev
Architecture: any
Depends: ${haskell:Depends},
${misc:Depends},
${shlibs:Depends},
Recommends: ${haskell:Recommends},
Suggests: ${haskell:Suggests},
Conflicts: ${haskell:Conflicts},
Provides: ${haskell:Provides},
Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
${haskell:LongDescription}
.
${haskell:Blurb}
Package: libghc-hoauth2-prof
Architecture: any
Depends: ${haskell:Depends},
${misc:Depends},
Recommends: ${haskell:Recommends},
Suggests: ${haskell:Suggests},
Conflicts: ${haskell:Conflicts},
Provides: ${haskell:Provides},
Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
${haskell:LongDescription}
.
${haskell:Blurb}
Package: libghc-hoauth2-doc
Architecture: all
Section: doc
Depends: ${haskell:Depends},
${misc:Depends},
Recommends: ${haskell:Recommends},
Suggests: ${haskell:Suggests},
Conflicts: ${haskell:Conflicts},
Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
${haskell:LongDescription}
.
${haskell:Blurb}
debdry-0.2.2/test/test_tree.py 0000640 0001750 0001750 00000000274 12442173606 016213 0 ustar pabs pabs 0000000 0000000 import unittest
from debdrylib.tree import Control
class TestParse(unittest.TestCase):
def test_1(self):
Control.scan("control", "test/data/20141016-control-trailing-commas")
debdry-0.2.2/test/test_fieldmerge.py 0000640 0001750 0001750 00000006306 12442173606 017361 0 ustar pabs pabs 0000000 0000000 import unittest
from debdrylib.tree import UploadersControlField, PkglistControlField
class TestUploaders(unittest.TestCase):
def _pfield(self, value):
return UploadersControlField("Uploaders", value, False)
def _sfield(self, value):
return UploadersControlField("Uploaders", value, True)
def test_plain(self):
cf1 = self._pfield("Enrico Zini ")
cf2 = self._pfield("A ")
f = cf1.combine(cf2)
self.assertEquals(f.to_string(), "A ")
def test_smart(self):
cf1 = self._pfield("Enrico Zini ")
cf2 = self._sfield("A ")
f = cf1.combine(cf2)
self.assertEquals(f.to_string(), "Enrico Zini , A ")
cf1 = self._pfield('"Adam C. Powell, IV" ')
cf2 = self._sfield("A ")
f = cf1.combine(cf2)
self.assertEquals(f.to_string(), '"Adam C. Powell, IV" , A ')
cf1 = self._pfield('"Adam C. Powell, IV" , Andrea Palazzi ')
cf2 = self._sfield("A ")
f = cf1.combine(cf2)
self.assertEquals(f.to_string(),
'"Adam C. Powell, IV" , Andrea Palazzi , A ')
cf1 = self._pfield('"Adam C. Powell, IV" , Andrea Palazzi ')
cf2 = self._sfield('"Adam C. Powell, IV" , Andrea Palazzi ')
f = cf1.combine(cf2)
self.assertEquals(f.to_string(),
'"Adam C. Powell, IV" , Andrea Palazzi ')
cf1 = self._pfield('"Adam C. Powell, IV" , Andrea Palozzi ')
cf2 = self._sfield("Andrea Palazzi , Enrico Zini ")
f = cf1.combine(cf2)
self.assertEquals(f.to_string(),
'"Adam C. Powell, IV" , Andrea Palazzi , Enrico Zini ')
class TestDeps(unittest.TestCase):
def _pfield(self, value):
return PkglistControlField("Depends", value, False)
def _sfield(self, value):
return PkglistControlField("Depends", value, True)
def assert_combine_plain(self, val1, val2, result):
cf1 = self._pfield(val1)
cf2 = self._pfield(val2)
f = cf1.combine(cf2)
self.assertEquals(f.to_string(), result)
def assert_combine_smart(self, val1, val2, result):
cf1 = self._pfield(val1)
cf2 = self._sfield(val2)
f = cf1.combine(cf2)
self.assertEquals(f.to_string(), result)
def test_plain(self):
self.assert_combine_plain("foo", "bar", "bar")
self.assert_combine_plain("foo (=1.4), bar (=1)", "bar", "bar")
def test_deps(self):
self.assert_combine_smart("foo", "bar", "foo, bar")
self.assert_combine_smart("foo (=1.4), bar, baz (>> 1.0)",
"foo (>= 1.5)",
"foo (>= 1.5), bar, baz (>> 1.0)")
debdry-0.2.2/test/__init__.py 0000640 0001750 0001750 00000000000 12442173606 015737 0 ustar pabs pabs 0000000 0000000 debdry-0.2.2/stdeb.cfg 0000640 0001750 0001750 00000000164 13003330756 014437 0 ustar pabs pabs 0000000 0000000 [DEFAULT]
Source: debdry
Package: debdry
Package3: debdry
Section: devel
Depends: python3-apt
Depends3: python3-apt
debdry-0.2.2/debdrylib/ 0000755 0001750 0001750 00000000000 13003542276 014622 5 ustar pabs pabs 0000000 0000000 debdry-0.2.2/debdrylib/debdry.py 0000640 0001750 0001750 00000013503 13003334747 016445 0 ustar pabs pabs 0000000 0000000 #!/usr/bin/python3
# coding: utf8
#
# Copyright (C) 2014 Enrico Zini
#
# 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 .
from .auto import Auto
from .tree import DebianDirectory
import os
import shutil
class Debdry:
def __init__(self, srcdir, debug=False):
self.srcdir = srcdir
self.debug = debug
self.dir_backup = os.path.join(srcdir, "debian/debdry")
self.dir_auto = os.path.join(srcdir, "debian.auto")
self.dir_debian = os.path.join(srcdir, "debian")
def is_debdry(self):
"""
Check if the debian/ directory is in debdry state
"""
return not os.path.exists(self.dir_backup)
def is_debianised(self):
"""
Check if the debian/ directory is in fully debianised state
"""
return os.path.exists(self.dir_backup)
def restore(self):
"""
Remove all the contents of debian/ and replace them with the contents
of debian/.debdry
"""
if not self.is_debianised():
raise RuntimeError("restore_debdry called on a non-debianised source")
# Delete everything except .debdry
for fn in os.listdir(self.dir_debian):
if fn == "debdry": continue
pathname = os.path.join(self.dir_debian, fn)
if os.path.isdir(pathname):
shutil.rmtree(pathname)
else:
os.unlink(pathname)
# Move all in .debdry one dir up
for fn in os.listdir(self.dir_backup):
os.rename(os.path.join(self.dir_backup, fn), os.path.join(self.dir_debian, fn))
# Remove .debdry
os.rmdir(self.dir_backup)
def debianise(self):
"""
Debianise the package, backing up debdry originals in dir_backup
"""
tmpdir = os.path.join(self.srcdir, "debian.debdry")
if os.path.isdir(tmpdir): shutil.rmtree(tmpdir)
if not os.path.exists(self.dir_debian):
os.makedirs(self.dir_debian)
# Move the debdry sources to debian.debdry
if os.path.exists(self.dir_backup):
os.rename(self.dir_backup, tmpdir)
shutil.rmtree(self.dir_debian)
else:
os.rename(self.dir_debian, tmpdir)
try:
# Perform automatic debianisation
Auto.debianise(self.srcdir)
# Move debian/ to debian.auto/
os.rename(self.dir_debian, self.dir_auto)
auto = DebianDirectory.scan(self.srcdir, self.dir_auto)
manual = DebianDirectory.scan(self.srcdir, tmpdir)
merged = DebianDirectory.combine(self.srcdir, self.dir_debian, auto, manual)
except:
# Rollback: restore debian.debdry to debian
self.maybe_preserve_workdir(tmpdir)
if os.path.isdir(self.dir_debian): shutil.rmtree(self.dir_debian)
os.rename(tmpdir, self.dir_debian)
raise
else:
# Commit: move debian.debdry to debian/debdry
os.rename(tmpdir, self.dir_backup)
finally:
if os.path.isdir(self.dir_auto): shutil.rmtree(self.dir_auto)
def diff(self):
"""
Take an existing, manually maintained debian/ dir, compute what it adds
to an auto-generated package, and put the results in debian/debdry
"""
tmpdir = os.path.join(self.srcdir, "debian.debdry")
if os.path.isdir(tmpdir): shutil.rmtree(tmpdir)
# Move debian to debian.debdry
os.rename(self.dir_debian, tmpdir)
# Remove debian.debdry/debdry if it exists
debdrydir = os.path.join(tmpdir, "debdry")
if os.path.exists(debdrydir):
shutil.rmtree(debdrydir)
try:
# Perform automatic debianisation
Auto.debianise(self.srcdir)
# Move debian/ to debian.auto/
os.rename(self.dir_debian, self.dir_auto)
# Diff with debdry
auto = DebianDirectory.scan(self.srcdir, self.dir_auto)
manual = DebianDirectory.scan(self.srcdir, tmpdir)
diffed = DebianDirectory.diff(self.srcdir, debdrydir, auto, manual)
except:
# Rollback: remove debian.debdry/debdry
self.maybe_preserve_workdir(debdrydir)
if os.path.isdir(debdrydir): shutil.rmtree(debdrydir)
raise
finally:
# Restore debian.debdry back to debian
os.rename(tmpdir, self.dir_debian)
if os.path.isdir(self.dir_auto): shutil.rmtree(self.dir_auto)
def maybe_preserve_workdir(self, pathname):
"""
Offer to preserve a work directory during rollback, if self.debug is
set and we are connected to a tty.
"""
if not self.debug or not os.isatty(0) or not os.isatty(1): return
if not os.path.isdir(pathname): return
renamed_pathname = pathname + ".debug"
want_rename = input(
"An error occurred and --debug is used: preserve {} as {}? (y/N) ".format(
pathname, renamed_pathname))
if want_rename.lower() != "y": return
if os.path.isdir(renamed_pathname):
shutil.rmtree(renamed_pathname)
# Hardlink the backup directory contents to the original directory
shutil.copytree(pathname, renamed_pathname, copy_function=os.link)
debdry-0.2.2/debdrylib/tree.py 0000640 0001750 0001750 00000051217 12442173606 016140 0 ustar pabs pabs 0000000 0000000 #!/usr/bin/python3
# coding: utf8
import os
import io
import re
import shutil
import apt_pkg
from collections import OrderedDict
import tempfile
import difflib
import logging
log = logging.getLogger(__name__)
class Node:
pass
class FilesystemNode(Node):
def __init__(self, relname, absname):
self.relname = relname
self.absname = absname
def dump(self, out, level=0):
print("{}{}".format(" " * level, self.relname), file=out)
class DirectoryBase(FilesystemNode):
def __init__(self, relname, absname):
super().__init__(relname, absname)
self.files = {}
def dump(self, out, level=0):
super().dump(out, level)
for n in self.files.values():
n.dump(out, level + 1)
class DebianDirectory(DirectoryBase):
"""
Represent a debian/ directory
"""
def __init__(self, srcdir, absname=None):
if absname is None: absname = os.path.join(srcdir, "debian")
super().__init__(os.path.basename(absname), absname)
self.srcdir = srcdir
@classmethod
def scan(cls, srcdir, absname=None):
"""
Init the DebianDirectory by scanning the filesystem
"""
self = cls(srcdir, absname)
for relname in os.listdir(self.absname):
absname = os.path.join(self.absname, relname)
if relname == "control":
log.info("%s: control file", absname)
self.files[relname] = Control.scan(relname, absname)
elif relname == "rules":
log.info("%s: rules file", absname)
self.files[relname] = Rules.scan(relname, absname)
elif os.path.isdir(absname):
log.info("%s: subdirectory", absname)
self.files[relname] = Directory.scan(relname, absname)
else:
log.info("%s: plain file", absname)
self.files[relname] = File.scan(relname, absname)
return self
@classmethod
def combine(cls, srcdir, absname, base, extra):
"""
Init the DebianDirectory by overlaying extra on top of base
"""
os.makedirs(absname, exist_ok=True)
self = cls(srcdir, absname)
for k in base.files.keys() - extra.files.keys():
self.files[k] = base.files[k].copy_to(k, os.path.join(self.absname, k))
for k in extra.files.keys() - base.files.keys():
self.files[k] = extra.files[k].copy_to(k, os.path.join(self.absname, k))
for k in base.files.keys() & extra.files.keys():
self.files[k] = base.files[k].combine(k, os.path.join(self.absname, k), extra.files[k])
return self
@classmethod
def diff(cls, srcdir, absname, base, extra):
"""
Init the DebianDirectory with the diff to go from base to extra
"""
os.makedirs(absname, exist_ok=True)
self = cls(srcdir, absname)
for k in base.files.keys() - extra.files.keys():
log.warn("{}: exists in {} but not in {}: ignoring file".format(
self.relname, base.absname, extra.absname))
for k in extra.files.keys() - base.files.keys():
self.files[k] = extra.files[k].copy_to(k, os.path.join(self.absname, k))
for k in base.files.keys() & extra.files.keys():
self.files[k] = base.files[k].diff(k, os.path.join(self.absname, k), extra.files[k])
return self
class Directory(DirectoryBase):
"""
Represent a subdirectory of debian/, any level down
"""
@classmethod
def scan(cls, relname, absname):
self = cls(relname, absname)
for relname in os.listdir(self.absname):
absname = os.path.join(self.absname, relname)
if os.path.isdir(absname):
log.info("%s: subdirectory", absname)
self.files[relname] = Directory(relname, absname)
else:
log.info("%s: plain file", absname)
self.files[relname] = File(relname, absname)
return self
def copy_to(self, relname, absname):
log.debug("%s: generating subdir", absname)
os.makedirs(absname, exist_ok=True)
for name, node in self.files.items():
node.copy_to(name, os.path.join(absname, name))
return self.__class__(relname, absname)
def combine(self, relname, absname, other):
os.makedirs(absname, exist_ok=True)
res = self.__class__(relname, absname)
for k in self.files.keys() - other.files.keys():
self.files[k] = self.files[k].copy_to(k, os.path.join(self.absname, k))
for k in other.files.keys() - self.files.keys():
self.files[k] = other.files[k].copy_to(k, os.path.join(self.absname, k))
for k in other.files.keys() & self.files.keys():
self.files[k] = self.files[k].combine(k, os.path.join(self.absname, k), other.files[k])
return self
def diff(self, relname, absname, other):
os.makedirs(absname, exist_ok=True)
res = self.__class__(relname, absname)
for k in self.files.keys() - other.files.keys():
log.warn("{}: exists in {} but not in {}: ignoring file".format(
self.relname, base.absname, extra.absname))
for k in other.files.keys() - self.files.keys():
self.files[k] = other.files[k].copy_to(k, os.path.join(self.absname, k))
for k in other.files.keys() & self.files.keys():
self.files[k] = self.files[k].diff(k, os.path.join(self.absname, k), other.files[k])
return self
class DeletedFile(FilesystemNode):
def dump(self, out, level=0):
print("{}{} (deleted)".format(" " * level, self.relname), file=out)
class File(FilesystemNode):
"""
Represent a file anywhere under debian/
"""
def open(self, mode="rt", encoding="utf8", **kw):
return io.open(self.absname, mode=mode, encoding=encoding, **kw)
def read(self, **kw):
with io.open(self.absname, **kw) as fd:
return fd.read()
def readlines(self, **kw):
with io.open(self.absname, **kw) as fd:
return fd.readlines()
def copy_to(self, relname, absname):
log.info("%s: copying from %s", absname, self.absname)
shutil.copy2(self.absname, absname)
return self.__class__(relname, absname)
def combine(self, relname, absname, other):
shutil.copy2(other.absname, absname)
return self.__class__.scan(relname, absname)
def diff(self, relname, absname, other):
if self.read() != other.read():
shutil.copy2(other.absname, absname)
return self.__class__.scan(relname, absname)
else:
return DeletedFile(relname, absname)
@classmethod
def scan(cls, relname, absname):
return cls(relname, absname)
class Rules(File):
"""
Represent a debian/rules file
"""
@property
def contents(self):
res = getattr(self, "_contents", None)
if res is not None: return res
self._contents = self.read()
return self._contents
@classmethod
def scan(cls, relname, absname):
return cls(relname, absname)
def combine(self, relname, absname, other):
if other.contents.startswith("#!"):
shutil.copy2(other.absname, absname)
else:
with io.open(absname, "wt") as fd:
fd.write(self.contents)
fd.write("\n")
fd.write(other.contents)
shutil.copystat(other.absname, absname)
return self.__class__.scan(relname, absname)
def diff(self, relname, absname, other):
log.warn("%s: diffing debian/rules is not yet supported: generating a diff instead", self.relname)
my_lines = self.readlines()
other_lines = other.readlines()
dstpathname = absname + ".diff"
with io.open(dstpathname, "wt") as out:
for line in difflib.unified_diff(my_lines, other_lines, "debian.auto/rules", "debian/rules"):
out.write(line)
return File(relname + ".diff", dstpathname)
def dump(self, out, level=0):
if self.contents.startswith("#!"):
print("{}{} (full)".format(" " * level, self.relname), file=out)
else:
print("{}{} (partial)".format(" " * level, self.relname), file=out)
class Control(File):
SOURCE_FIELDS = frozenset(apt_pkg.REWRITE_SOURCE_ORDER)
BINARY_FIELDS = frozenset(apt_pkg.REWRITE_PACKAGE_ORDER)
PKGLIST_FIELDS = frozenset(("Depends", "Pre-Depends", "Recommends",
"Suggests", "Breaks", "Conflicts", "Provides",
"Replaces", "Enhances", "Build-Depends"))
def __init__(self, relname, absname):
super().__init__(relname, absname)
# Source: section
self.source = ControlSectionSource()
# Package: sections
self.binaries = OrderedDict()
def _scan_lines(self, data):
for section in apt_pkg.TagFile(data):
if 'Source' in section:
for tag in section.keys():
self.add_source_field(tag, section[tag])
elif 'Package' in section:
name = section["Package"]
for tag in section.keys():
self.add_binary_field(name, tag, section[tag])
else:
# If there is no Source or Package in this stanza, dispatch
# according to field names
for tag in section.keys():
self.add_mixed_field(tag, section[tag])
@classmethod
def scan(cls, relname, absname):
self = cls(relname, absname)
with self.open() as fd:
self._scan_lines(fd)
return self
@classmethod
def scan_string(cls, relname, absname, buf):
self = cls(relname, absname)
with tempfile.TemporaryFile() as fd:
fd.write(buf.encode("utf8"))
fd.seek(0)
self._scan_lines(fd)
return self
def to_string(self):
sections = []
# Add the source section
sections.append(self.source.to_string())
# Add the binary sections
for section in self.binaries.values():
sections.append(section.to_string())
return "\n".join(sections)
def write(self):
# Write out the concatenation of all the stanzas
with io.open(self.absname, "wt") as outfd:
outfd.write(self.to_string())
def combine(self, relname, absname, other):
res = self.__class__(relname, absname)
res.source = self.source.combine(other.source)
# Add the binary sections that are in self but not in other
for name in self.binaries.keys() - other.binaries.keys():
res.binaries[name] = self.binaries[name].copy()
#log.warn("%s: Package: %s exists only in auto: ignored", absname, name)
# Add the binary sections that are in other but not in self
for name in other.binaries.keys() - self.binaries.keys():
res.binaries[name] = other.binaries[name].copy()
# Merge the binary sections that are in both, taking auto as the
# baseline
for name in self.binaries.keys() & other.binaries.keys():
res.binaries[name] = self.binaries[name].combine(other.binaries[name])
# Write out the file
res.write()
return res
def diff(self, relname, absname, other):
res = self.__class__(relname, absname)
res.source = self.source.diff(other.source)
# Add the binary sections that are in self but not in other
for name in self.binaries.keys() - other.binaries.keys():
log.warn("%s: Package: %s exists only in auto: ignored", absname, name)
# Add the binary sections that are in other but not in self
for name in other.binaries.keys() - self.binaries.keys():
res.binaries[name] = other.binaries[name].copy()
# Merge the binary sections that are in both, taking auto as the
# baseline
for name in self.binaries.keys() & other.binaries.keys():
res.binaries[name] = self.binaries[name].diff(other.binaries[name])
# Write out the file
res.write()
return res
def add_source_field(self, tag, value):
if tag.startswith("X-Debdry-"):
tag = tag[9:]
smart = True
else:
smart = False
if tag == "Uploaders":
self.source.add(tag, UploadersControlField(tag, value, smart))
elif tag in self.PKGLIST_FIELDS:
self.source.add(tag, PkglistControlField(tag, value, smart))
else:
if smart:
log.warn("%s: unsupported field X-Debdry-%s found: treating it as %s",
self.absname, tag, tag)
self.source.add(tag, PlainControlField(tag, value))
def add_binary_field(self, pkgname, tag, value):
if tag.startswith("X-Debdry-"):
tag = tag[9:]
smart = True
else:
smart = False
rec = self.binaries.get(pkgname, None)
if rec is None:
self.binaries[pkgname] = rec = ControlSectionBinary()
if tag in self.PKGLIST_FIELDS:
rec.add(tag, PkglistControlField(tag, value, smart))
else:
if smart:
log.warn("%s: unsupported field X-Debdry-%s found: treating it as %s",
self.absname, tag, tag)
rec.add(tag, PlainControlField(tag, value))
def add_mixed_field(self, tag, value):
orig_tag = tag
if tag.startswith("X-Debdry-"):
tag = tag[9:]
if tag in self.SOURCE_FIELDS:
self.add_source_field(orig_tag, value)
elif tag in self.BINARY_FIELDS:
self.add_binary_field(None, orig_tag, value)
else:
log.warn("%s: ignoring unrecognised field '%s'", self.absname, orig_tag)
def dump(self, out, level=0):
super().dump(out, level)
print("{}src:".format(" " * (level + 1)))
self.source.dump(out, level + 1)
for pkgname, section in self.binaries.items():
print("{}bin {}:".format(" " * (level + 1), pkgname))
section.dump(out, level + 1)
class ControlSection:
def __init__(self):
self.fields = OrderedDict()
def add(self, tag, field):
if field is None: return
self.fields[tag] = field
def dump(self, out, level=0):
for tag, field in self.fields.items():
field.dump(out, level + 1)
def copy(self):
res = self.__class__()
for k, v in self.fields.items():
res.fields[k] = v.copy()
return res
def to_string(self):
section = self.get_empty_tagsection()
return apt_pkg.rewrite_section(section, self.REWRITE_ORDER,
[f.to_apt() for f in self.fields.values()])
def combine(self, other):
res = self.__class__()
# All fields in self are copied
for tag in self.fields.keys() - other.fields.keys():
res.add(tag, self.fields[tag].copy())
# Then all fields in other are copied
for tag in other.fields.keys() - self.fields.keys():
res.add(tag, other.fields[tag].copy())
# Combine the fields that are in both
for tag in self.fields.keys() & other.fields.keys():
res.add(tag, self.fields[tag].combine(other.fields[tag]))
return res
def diff(self, other):
res = self.__class__()
# FIXME: we still have no way to delete a field
for tag in self.fields.keys() - other.fields.keys():
log.warn("control field %s exists only in auto: ignored", tag)
# Then all fields in other are copied
for tag in other.fields.keys() - self.fields.keys():
res.add(tag, other.fields[tag].copy())
# Combine the fields that are in both
for tag in self.fields.keys() & other.fields.keys():
if tag in ("Source", "Package"):
res.add(tag, other.fields[tag].copy())
else:
res.add(tag, self.fields[tag].diff(other.fields[tag]))
return res
class ControlSectionSource(ControlSection):
REWRITE_ORDER = apt_pkg.REWRITE_SOURCE_ORDER
def get_empty_tagsection(self):
name = self.fields.get("Source", None)
if name is None:
raise RuntimeError("TODO: package is name is missing for source section")
return apt_pkg.TagSection("Source: {}\n".format(name))
class ControlSectionBinary(ControlSection):
REWRITE_ORDER = apt_pkg.REWRITE_PACKAGE_ORDER
def get_empty_tagsection(self):
name = self.fields.get("Package", None)
if name is None:
raise RuntimeError("TODO: package is name is missing for binary section")
return apt_pkg.TagSection("Package: {}\n".format(name))
class PlainControlField(Node):
def __init__(self, tag, value):
self.tag = tag
self.value = value
def dump(self, out, level=0):
print("{}{}: {}".format(" " * level, self.tag, self.value[:40]))
def copy(self):
return self.__class__(self.tag, self.value)
def to_string(self):
return self.value
def to_apt(self):
return (self.tag, self.value)
def combine(self, other):
return self.__class__(self.tag, other.value)
def diff(self, other):
if self.value == other.value:
return None
return self.__class__(self.tag, other.value)
class IndexedControlField(Node):
def __init__(self, tag, smart):
self.tag = tag
self.smart = smart
self.values = OrderedDict()
def dump(self, out, level=0):
if self.smart:
tag = "X-Debdry-" + self.tag
else:
tag = self.tag
if len(self.values) > 1:
print("{}{}: {} and {} more".format(" " * level,
tag,
", ".join(self.values.values())[:40],
len(self.values) - 1))
else:
print("{}{}: {}".format(" " * level,
tag,
", ".join(self.values.values())[:40]))
def copy(self):
return self.__class__(self.tag, self.to_string(), self.smart)
def to_string(self):
return ", ".join(self.values.values())
def to_apt(self):
if self.smart:
return ("X-Debdry-" + self.tag, self.to_string())
else:
return (self.tag, self.to_string())
def combine(self, other):
if not other.smart:
value = other.to_string()
else:
res = OrderedDict()
for k, v in self.values.items():
res[k] = v
for k, v in other.values.items():
res[k] = v
value = ", ".join(res.values())
return self.__class__(self.tag, value, self.smart)
def diff(self, other):
smart = False
if self.to_string() == other.to_string():
value = None
elif self.values.keys() - other.values.keys():
# If there are values in self and not in others, do a full field
# override
value = other.to_string()
else:
res = OrderedDict()
# Common fields first
for k in self.values.keys() & other.values.keys():
theirs = other.values[k]
# Skip common fields
if self.values[k] == theirs: continue
res[k] = theirs
# Then other-only fields
for k in other.values.keys() - self.values.keys():
res[k] = other.values[k]
if res:
smart = True
value = ", ".join(res.values())
else:
value = None
if value is None: return None
return self.__class__(self.tag, value, smart)
class UploadersControlField(IndexedControlField):
re_split_uploaders = re.compile(r'(?<=>)\s*,\s*')
re_email = re.compile(r'<([^>]+)>')
def __init__(self, tag, value, smart):
super().__init__(tag, smart)
# Store uploaders indexed by email address
for v in self.re_split_uploaders.split(value):
self.values[self._get_email(v)] = v
def _get_email(self, maint):
mo = self.re_email.search(maint)
if not mo:
raise ValueError("Unparsable email: {}".format(repr(maint)))
return mo.group(1)
class PkglistControlField(IndexedControlField):
re_split_deps = re.compile(r"\s*,\s*")
def __init__(self, tag, value, smart):
super().__init__(tag, smart)
# Store package entries indexed by package name
for v in self.re_split_deps.split(value):
if not v: continue
self.values[v.split()[0]] = v
debdry-0.2.2/debdrylib/__init__.py 0000640 0001750 0001750 00000000000 12442173606 016720 0 ustar pabs pabs 0000000 0000000 debdry-0.2.2/debdrylib/auto.py 0000640 0001750 0001750 00000011704 12501706224 016140 0 ustar pabs pabs 0000000 0000000 #!/usr/bin/python3
# coding: utf8
#
# Copyright (C) 2014 Enrico Zini
#
# 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 .
import os.path
import subprocess
import logging
import shutil
log = logging.getLogger(__name__)
class Auto:
DEBIANIZERS = []
def __init__(self, dirname):
self.dirname = dirname
def debianise(self):
"""
Auto-build a debian/ directory based on the upstream packaging
"""
raise NotImplementedError()
def run_command(self, argv, **opts):
"""
Runs a shell command
"""
log.debug('$ ' + " ".join(argv))
subprocess.check_call(argv, **opts)
@classmethod
def valid_for_source(cls, dirname):
"""
Return true if this method thinks it can debianise the given source
tree
"""
return False
@classmethod
def instantiate(cls, dirname):
"""
Instantiate a debianizer object for a source dir
"""
valid = []
for d in cls.DEBIANIZERS:
if d.valid_for_source(dirname):
valid.append(d)
if not valid:
# No valid debianizers were found
for d in cls.DEBIANIZERS:
label = getattr(d, 'LABEL', d.__class__.__name__)
err_msg = getattr(d, 'FAILED_ATTEMPT_DESCRIPTION', 'not valid')
log.info("%s: %s" % (label, err_msg))
raise RuntimeError("No method found for debianising {}".format(dirname))
if len(valid) == 1: return valid[0](dirname)
raise RuntimeError("{} methods found debianising {}: {}".format(
len(valid), dirname), ", ".join(str(x) for x in valid))
@classmethod
def debianise(cls, dirname):
"""
Debianise the given directory autoselecting the method to use
"""
debianiser = cls.instantiate(dirname)
debianiser.debianise()
@classmethod
def register(cls, debianizer):
"""
Register a class as an auto-debianizer.
This can be used as a class decorator.
"""
cls.DEBIANIZERS.append(debianizer)
return debianizer
@Auto.register
class PerlDhMakePerl(Auto):
LABEL = "dh-make-perl"
FAILED_ATTEMPT_DESCRIPTION = "Makefile.PL and Build.PL not found"
def debianise(self):
self.run_command(["dh-make-perl", "--vcs", "none"], cwd=self.dirname)
@classmethod
def valid_for_source(cls, dirname):
files = frozenset(os.listdir(dirname))
return "Makefile.PL" in files or "Build.PL" in files
@Auto.register
class PythonStddeb(Auto):
LABEL = "python"
FAILED_ATTEMPT_DESCRIPTION = "setup.py not found"
def debianise(self):
# Keep track of the current directory contents, to detect cruft left
# around by setup.py
old_contents = set(os.listdir(self.dirname))
with open(os.path.join(self.dirname, "setup.py"), "rt") as fd:
if "python3" in next(fd):
interpreter = "python3"
else:
interpreter = "python"
self.run_command([interpreter, "setup.py", "--command-packages=stdeb.command", "debianize"], cwd=self.dirname)
# Cleanup known cruft left around by setup.py
new_contents = set(os.listdir(self.dirname))
for f in new_contents - old_contents:
if not f.endswith(".egg-info"): continue
log.info("Cleaning setup.py cruft %s left in %s", f, self.dirname)
shutil.rmtree(os.path.join(self.dirname, f))
@classmethod
def valid_for_source(cls, dirname):
return os.path.exists(os.path.join(dirname, "setup.py"))
@Auto.register
class RubyDhMakeRuby(Auto):
LABEL = "dh-make-ruby"
FAILED_ATTEMPT_DESCRIPTION = "*.gemspec files not found"
def debianise(self):
self.run_command(["dh-make-ruby", "."], cwd=self.dirname)
@classmethod
def valid_for_source(cls, dirname):
files = os.listdir(dirname)
if any(x.endswith(".gemspec") for x in files): return True
return "Gemfile" in files
@Auto.register
class HaskellCabalDebian(Auto):
LABEL = "cabal-debian"
FAILED_ATTEMPT_DESCRIPTION = "*.cabal files not found"
def debianise(self):
self.run_command(["cabal-debian"], cwd=self.dirname)
@classmethod
def valid_for_source(cls, dirname):
files = os.listdir(dirname)
return any(x.endswith(".cabal") for x in files)
debdry-0.2.2/git-debdry-build.1 0000644 0001750 0001750 00000002537 13003542275 016101 0 ustar pabs pabs 0000000 0000000 .\" Automatically generated by Pandoc 1.17.2
.\"
.TH "git-debry-build" "1" "October 2016" "debdry 0.1" "User commands"
.SH NAME
git-debdry-build \- simple wrapper around debdry and git-buildpackage
.hy
.SH git\-debdry\-build
.PP
A simple wrapper around \f[C]gbp\ buildpackage\f[] and debdry.
.SH Usage
.PP
$ git debdry\-build OPTIONS (#options)
.SH Options
.PP
\f[B]git\-debdry\-build\f[] does not take any options itself, and all
options passed to it on the command line are passed unchanged to
\f[C]git\-buildpackage\f[].
.SH Mode of operation
.PP
\f[B]git\-debdry\-build\f[] will create a temporary branch off the
current HEAD, run debdry on it, commit the \f[I]debian/\f[] directory to
that branch, and build the package using \f[B]git\-buildpackage(1)\f[].
.PP
If the build succeeds, you will find the build artifacts in the parent
directory as usual, and the temporary branch will be deleted.
If you want to save the state of tree used for the build (for example
when doing the final build before uploading to the Debian archive), you
can just pass the \f[I]\-\-git\-tag\f[] option to
\f[B]git\-buildpackage\f[] and that very tree will be tagged for you.
.PP
If the build fails, \f[B]git\-debdry\-build\f[] will not remove the
temporary branch and will tell you its name so that you can inspect its
contents if necessary.
.SH See also
.PP
\f[B]git\-buildpackage(1)\f[]
debdry-0.2.2/debdry 0000750 0001750 0001750 00000004131 12442173606 014056 0 ustar pabs pabs 0000000 0000000 #!/usr/bin/python3
# coding: utf8
#
# Copyright (C) 2014 Enrico Zini
#
# 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 .
import argparse
import logging
import sys
from debdrylib.debdry import Debdry
parser = argparse.ArgumentParser(description='Merge manually and automatically generated debian/ packaging.')
parser.add_argument("dir", nargs="?", default=".", help="package source directory, default: %(default)s")
#parser.add_argument("--dry-run", action="store_true", help="")
parser.add_argument('--version', action='version', version='%(prog)s 0.1')
parser.add_argument('-v', '--verbose', action="store_true",
help="Verbose output")
parser.add_argument('--debug', action="store_true",
help="Debug output")
parser.add_argument('-r', '--restore', action="store_true",
help="Undebianise, leaving only debdry files in debian/")
parser.add_argument('--dry', action="store_true",
help="Take an existing package and add a minimal debian/debdry/")
args = parser.parse_args()
FORMAT = "%(asctime)-15s %(levelname)s %(message)s"
if args.debug:
logging.basicConfig(level=logging.DEBUG, stream=sys.stderr, format=FORMAT)
elif args.verbose:
logging.basicConfig(level=logging.INFO, stream=sys.stderr, format=FORMAT)
else:
logging.basicConfig(level=logging.WARN, stream=sys.stderr, format=FORMAT)
debdry = Debdry(args.dir, debug=args.debug)
if args.restore:
debdry.restore()
elif args.dry:
debdry.diff()
else:
debdry.debianise()
debdry-0.2.2/git-debdry-build.md 0000640 0001750 0001750 00000002046 12521414504 016325 0 ustar pabs pabs 0000000 0000000 # git-debdry-build
A simple wrapper around `gbp buildpackage` and debdry.
# Usage
$ git debdry-build [OPTIONS]
# Options
**git-debdry-build** does not take any options itself, and all options passed
to it on the command line are passed unchanged to `git-buildpackage`.
# Mode of operation
**git-debdry-build** will create a temporary branch off the current HEAD, run
debdry on it, commit the _debian/_ directory to that branch, and build the
package using **git-buildpackage(1)**.
If the build succeeds, you will find the build artifacts in the parent
directory as usual, and the temporary branch will be deleted. If you want to
save the state of tree used for the build (for example when doing the final
build before uploading to the Debian archive), you can just pass the
_--git-tag_ option to **git-buildpackage** and that very tree will be tagged
for you.
If the build fails, **git-debdry-build** will not remove the temporary branch
and will tell you its name so that you can inspect its contents if necessary.
# See also
**git-buildpackage(1)**
debdry-0.2.2/debdry.egg-info/ 0000755 0001750 0001750 00000000000 13003542276 015625 5 ustar pabs pabs 0000000 0000000 debdry-0.2.2/debdry.egg-info/dependency_links.txt 0000644 0001750 0001750 00000000001 13003542276 021673 0 ustar pabs pabs 0000000 0000000
debdry-0.2.2/debdry.egg-info/PKG-INFO 0000644 0001750 0001750 00000001760 13003542276 016726 0 ustar pabs pabs 0000000 0000000 Metadata-Version: 1.1
Name: debdry
Version: 0.2.2
Summary: Semi-assisted automatic Debian packaging
Home-page: https://anonscm.debian.org/cgit/collab-maint/debdry.git
Author: Enrico Zini
Author-email: enrico@debian.org
License: GPL3
Description: debdry is for debian/ directories what debhelper7 is for debian/rules.
It applies the Don't Repeat Yourself idea to packaging, attempting to reuse as
much as possible of upstream's metadata and standard packaging practices.
debdry runs an appropriate auto-debianisation tool for a given source
directory, then applies manual overrides from a debian.in directory.
debdry supports the following types of packages (in brackets you will find
extra packages that need to be installed for each type of package):
- Perl [dh-make-perl]
- Python [python-stdeb, python3-stdeb]
- Ruby [gem2deb]
- Haskell [cabal-debian]
Platform: any
Requires: apt
debdry-0.2.2/debdry.egg-info/SOURCES.txt 0000644 0001750 0001750 00000001005 13003542276 017505 0 ustar pabs pabs 0000000 0000000 COPYING
MANIFEST.in
README.md
debdry
debdry.1
git-debdry-build
git-debdry-build.1
git-debdry-build.md
robotic-minion
setup.py
stdeb.cfg
debdry.egg-info/PKG-INFO
debdry.egg-info/SOURCES.txt
debdry.egg-info/dependency_links.txt
debdry.egg-info/top_level.txt
debdrylib/__init__.py
debdrylib/auto.py
debdrylib/debdry.py
debdrylib/tree.py
test/__init__.py
test/test_control.py
test/test_fieldmerge.py
test/test_tree.py
test/c++/Makefile.am
test/c++/configure.ac
test/c++/hello.cc
test/data/20141016-control-trailing-commas debdry-0.2.2/debdry.egg-info/top_level.txt 0000644 0001750 0001750 00000000012 13003542276 020350 0 ustar pabs pabs 0000000 0000000 debdrylib
debdry-0.2.2/git-debdry-build 0000755 0001750 0001750 00000001451 13003541312 015726 0 ustar pabs pabs 0000000 0000000 #!/bin/sh
set -e
current_branch=$(git rev-parse --abbrev-ref HEAD)
build_branch="$current_branch-$(date +%Y-%m-%d_%H-%M-%S)"
git checkout -b "$build_branch"
debdry .
git add debian
git commit -m "Debian tree generated by $(debdry --version)"
cleanup() {
debclean
git reset --hard
git checkout "$current_branch"
}
aborted() {
cleanup
echo "I: build aborted on your request. The contents of the tree used"
echo "I: for the build is available in the $build_branch branch."
exit 1
}
trap aborted INT
rc=0
gbp buildpackage --git-ignore-new --git-debian-branch="$build_branch" "$@" || rc=$?
cleanup
if [ "$rc" -eq 0 ]; then
git branch -D "$build_branch"
else
echo "E: build failed. The contents of the tree used for the build"
echo "E: is available in the $build_branch branch."
fi
exit "$rc"
debdry-0.2.2/setup.py 0000640 0001750 0001750 00000002100 13003331553 014353 0 ustar pabs pabs 0000000 0000000 #!/usr/bin/env python3
from setuptools import setup
setup(name="debdry",
version="0.2.2",
description="Semi-assisted automatic Debian packaging",
long_description="""debdry is for debian/ directories what debhelper7 is for debian/rules.
It applies the Don't Repeat Yourself idea to packaging, attempting to reuse as
much as possible of upstream's metadata and standard packaging practices.
debdry runs an appropriate auto-debianisation tool for a given source
directory, then applies manual overrides from a debian.in directory.
debdry supports the following types of packages (in brackets you will find
extra packages that need to be installed for each type of package):
- Perl [dh-make-perl]
- Python [python-stdeb, python3-stdeb]
- Ruby [gem2deb]
- Haskell [cabal-debian]
""",
author="Enrico Zini",
author_email="enrico@debian.org",
url="https://anonscm.debian.org/cgit/collab-maint/debdry.git",
requires=["apt"],
license="GPL3",
platforms="any",
packages=["debdrylib"],
scripts=["debdry", "git-debdry-build"],
)
debdry-0.2.2/MANIFEST.in 0000640 0001750 0001750 00000000300 12442173606 014410 0 ustar pabs pabs 0000000 0000000 include COPYING
include README.md
include debdry.1
include git-debdry-build.md
include git-debdry-build.1
include stdeb.cfg
include MANIFEST.in
include robotic-minion
recursive-include test *
debdry-0.2.2/setup.cfg 0000644 0001750 0001750 00000000073 13003542276 014503 0 ustar pabs pabs 0000000 0000000 [egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0