usage()
if 'Suite' not in Options:
query_suites = DBConn().session().query(Suite)
- suites = [suite.suite_name for suite in query_suites.all()]
- cnf['Obsolete::Options::Suite'] = ','.join(suites)
+ suites = [suite.suite_name for suite in query_suites]
+ cnf['Obsolete::Options::Suite'] = str(','.join(suites))
+
Logger = daklog.Logger("dominate")
session = DBConn().session()
for suite_name in utils.split_args(Options['Suite']):
self.find_b = self.Cnf.find_b
def has_key(self, name):
- return self.Cnf.has_key(name)
+ return name in self.Cnf
+
+ def __contains__(self, name):
+ return name in self.Cnf
def __getitem__(self, name):
return self.Cnf[name]
self.destination = destination
self.need_cleanup = False
+ dirmode = 0o2755
+ if mode is not None:
+ dirmode = 0o2700 | mode
+ # Allow +x for group and others if they have +r.
+ if dirmode & 0o0040:
+ dirmode = dirmode | 0o0010
+ if dirmode & 0o0004:
+ dirmode = dirmode | 0o0001
+
self.check_for_temporary()
destdir = os.path.dirname(self.destination)
if not os.path.exists(destdir):
- os.makedirs(destdir, 0o2775)
+ os.makedirs(destdir, dirmode)
if symlink:
os.symlink(source, self.destination)
elif link:
symlink (bool): Create a symlink instead
mode (int): Permissions to change `destination` to.
"""
+ if isinstance(mode, str) or isinstance(mode, unicode):
+ mode = int(mode, 8)
+
self.actions.append(_FilesystemCopyAction(source, destination, link=link, symlink=symlink, mode=mode))
def move(self, source, destination, mode=None):
Returns:
file handle of the new file
"""
+ if isinstance(mode, str) or isinstance(mode, unicode):
+ mode = int(mode, 8)
+
destdir = os.path.dirname(path)
if not os.path.exists(destdir):
os.makedirs(destdir, 0o2775)
re_file_safe = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_.:~+-]*$')
# Prefix of binary and source filenames
-_re_file_prefix = '^(?P<package>[a-z0-9][a-z0-9.+-]+)_(?P<version>[A-Za-z0-9.:~+-]+)'
+_re_file_prefix = r'^(?P<package>[a-z0-9][a-z0-9.+-]+)_(?P<version>[A-Za-z0-9.:~+-]+?)'
# Match binary packages
# Groups: package, version, architecture, type
-re_file_binary = re.compile(_re_file_prefix + '_(?P<architecture>[a-z0-9]+)\.(?P<type>u?deb)$')
+re_file_binary = re.compile(_re_file_prefix + r'_(?P<architecture>[a-z0-9]+)\.(?P<type>u?deb)$')
+
+# Match changes files
+# Groups: package, version, suffix
+re_file_changes = re.compile(_re_file_prefix + r'_(?P<suffix>[a-zA-Z0-9+-]+)\.changes$')
# Match dsc files
# Groups: package, version
# Match other source files
# Groups: package, version
-re_file_source = re.compile(_re_file_prefix + r'(?:(?:\.orig(?:-[a-zA-Z0-9-]+)?)?\.tar\.(?:bz2|gz|xz)|\.diff\.gz)$')
+re_file_source = re.compile(_re_file_prefix + r'(?:(?:\.orig(?:-[a-zA-Z0-9-]+)?|\.debian)?\.tar\.(?:bz2|gz|xz)|\.diff\.gz)$')
# Match upstream tarball
# Groups: package, version
Forces a string to UTF-8. If the string isn't already UTF-8,
it's assumed to be ISO-8859-1.
"""
+ if isinstance(s, unicode):
+ return s
try:
unicode(s, 'utf-8')
return s
################################################################################
-# Inspired(tm) by Bryn Keller's print_exc_plus (See
-# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52215)
-
-def print_exc():
- tb = sys.exc_info()[2]
- while tb.tb_next:
- tb = tb.tb_next
- stack = []
- frame = tb.tb_frame
- while frame:
- stack.append(frame)
- frame = frame.f_back
- stack.reverse()
- traceback.print_exc()
- for frame in stack:
- print "\nFrame %s in %s at line %s" % (frame.f_code.co_name,
- frame.f_code.co_filename,
- frame.f_lineno)
- for key, value in frame.f_locals.items():
- print "\t%20s = " % key,
- try:
- print value
- except:
- print "<unable to print>"
-
-################################################################################
-
-def try_with_debug(function):
- try:
- function()
- except SystemExit:
- raise
- except:
- print_exc()
-
-################################################################################
-
def arch_compare_sw (a, b):
"""
Function for use in sorting lists of architectures.
addresses = key_uid_email_cache.get(fingerprint)
if addresses != None:
return addresses
- addresses = set()
+ addresses = list()
cmd = "gpg --no-default-keyring %s --fingerprint %s" \
% (gpg_keyring_args(), fingerprint)
(result, output) = commands.getstatusoutput(cmd)
for l in output.split('\n'):
m = re_gpg_uid.match(l)
if m:
- addresses.add(m.group(1))
+ addresses.append(m.group(1))
key_uid_email_cache[fingerprint] = addresses
return addresses
################################################################################
-# Inspired(tm) by http://www.zopelabs.com/cookbook/1022242603
-
-def wrap(paragraph, max_length, prefix=""):
- line = ""
- s = ""
- have_started = 0
- words = paragraph.split()
-
- for word in words:
- word_size = len(word)
- if word_size > max_length:
- if have_started:
- s += line + '\n' + prefix
- s += word + '\n' + prefix
- else:
- if have_started:
- new_length = len(line) + word_size + 1
- if new_length > max_length:
- s += line + '\n' + prefix
- line = word
- else:
- line += ' ' + word
- else:
- line = word
- have_started = 1
-
- if have_started:
- s += line
-
- return s
-
-################################################################################
-
def clean_symlink (src, dest, root):
"""
Relativize an absolute symlink from 'src' -> 'dest' relative to 'root'.
def deb_extract_control(fh):
"""extract DEBIAN/control from a binary package"""
return apt_inst.DebFile(fh).control.extractdata("control")
+
+################################################################################
+
+def mail_addresses_for_upload(maintainer, changed_by, fingerprint):
+ """Mail addresses to contact for an upload
+
+ Args:
+ maintainer (str): Maintainer field of the changes file
+ changed_by (str): Changed-By field of the changes file
+ fingerprint (str): Fingerprint of the PGP key used to sign the upload
+
+ Returns:
+ List of RFC 2047-encoded mail addresses to contact regarding this upload
+ """
+ addresses = [maintainer]
+ if changed_by != maintainer:
+ addresses.append(changed_by)
+
+ fpr_addresses = gpg_get_key_addresses(fingerprint)
+ if fix_maintainer(changed_by)[3] not in fpr_addresses and fix_maintainer(maintainer)[3] not in fpr_addresses:
+ addresses.append(fpr_addresses[0])
+
+ encoded_addresses = [ fix_maintainer(e)[1] for e in addresses ]
+ return encoded_addresses
+++ /dev/null
-From: __DAK_ADDRESS__
-To: __MAINTAINER_TO__
-__BCC__
-X-Debian: DAK
-X-Debian-Package: __SOURCE__
-Precedence: bulk
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 8bit
-Subject: __CHANGES_FILENAME__ INSTALLED into __SUITE__
-
-__REJECT_MESSAGE__
-Installing:
-__SUMMARY__
-
-Thank you for your contribution to __DISTRO__.
+++ /dev/null
-From: __MAINTAINER_FROM__
-To: control@__BUG_SERVER__
-Cc: __MAINTAINER_TO__
-__BCC__
-X-Debian: DAK
-X-Debian-Package: __SOURCE__
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 8bit
-Subject: Fixed in upload of __SOURCE__ __VERSION__ to experimental
-
-__CONTROL_MESSAGE__
-quit
-
-This message was generated automatically in response to an
-upload to the experimental distribution. The .changes file follows.
-
-__FILE_CONTENTS__
+++ /dev/null
-From: __MAINTAINER_FROM__
-To: control@__BUG_SERVER__
-Cc: __MAINTAINER_TO__
-__BCC__
-X-Debian: DAK
-X-Debian-Package: __SOURCE__
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 8bit
-Subject: Fixed in NMU of __SOURCE__ __VERSION__
-
-__CONTROL_MESSAGE__
-quit
-
-This message was generated automatically in response to a
-non-maintainer upload. The .changes file follows.
-
-__FILE_CONTENTS__
+++ /dev/null
-From: __DAK_ADDRESS__
-To: __MAINTAINER_TO__
-__CC__
-__BCC__
-Reply-To: __STABLE_MAIL__
-X-Debian: DAK
-X-Debian-Package: __SOURCE__
-Precedence: bulk
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 8bit
-Subject: __CHANGES_FILENAME__ REJECTED from proposed-updates
-
-Your package was rejected by an ftp master on behalf of
-__STABLE_REJECTOR__, if you have any questions or
-comments regarding this rejection, please address them to
-__STABLE_REJECTOR__ by replying to this mail.
-
-The reason given for rejection was:
-
-__MANUAL_REJECT_MESSAGE__
-
-Please see:
-
- __MORE_INFO_URL__
-
-for more details.
-
-===
-
-Your rejected .changes files is in queue/REJECT/; the other files
-have been removed from proposed-updates and will be auto-cleaned as
-normal.
+++ /dev/null
-From: __DAK_ADDRESS__
-To: __WHOAMI__ <dak@security.debian.org>
-__BCC__
-X-Debian-Package: __SOURCE__
-Subject: Template Advisory __ADVISORY__
-
-------------------------------------------------------------------------
-Debian Security Advisory __ADVISORY__ security@debian.org
-http://www.debian.org/security/ __WHOAMI__
-__DATE__ http://www.debian.org/security/faq
-------------------------------------------------------------------------
-
-Package : __PACKAGE__
-Vulnerability : XXX
-Problem type : local/remote XXX
-Debian-specific: XXX
-CVE Id(s) : XXX
-CERT advisory : XXX
-BugTraq ID : XXX
-Debian Bug : XXX
-
-Several local/remote vulnerabilities have been discovered in...
-The Common
-Vulnerabilities and Exposures project identifies the following problems:
-
-[single issue]
-Foo discovered that
-
-
-[single issue]
-For the old stable distribution (etch), this problem has been fixed in version XXX
-__PACKAGE__
-
-For the stable distribution (lenny), this problem has been fixed in version XXX
-__PACKAGE__
-
-For the unstable distribution (sid), this problem has been fixed in
-version XXX
-
-[multiple issues]
-For the old stable distribution (etch), these problems have been fixed in version
-__PACKAGE__
-
-For the stable distribution (lenny), these problems have been fixed in version
-__PACKAGE__
-
-For the unstable distribution (sid), these problems have been fixed in
-version XXX
-
-We recommend that you upgrade your __PACKAGE__ package.
-
-Upgrade instructions
---------------------
-
-wget url
- will fetch the file for you
-dpkg -i file.deb
- will install the referenced file.
-
-If you are using the apt-get package manager, use the line for
-sources.list as given below:
-
-apt-get update
- will update the internal database
-apt-get upgrade
- will install corrected packages
-
-You may use an automated update by adding the resources from the
-footer to the proper configuration.
-
-
-Debian GNU/Linux 4.0 alias etch
--------------------------------
-
-Debian GNU/Linux 5.0 alias lenny
---------------------------------
-
-__ADVISORY_TEXT__
-
-
- These files will probably be moved into the stable distribution on
- its next update.
-
----------------------------------------------------------------------------------
-For apt-get: deb http://security.debian.org/ stable/updates main
-For dpkg-ftp: ftp://security.debian.org/debian-security dists/stable/updates/main
-Mailing list: debian-security-announce@lists.debian.org
-Package info: `apt-cache show <pkg>' and http://packages.debian.org/<pkg>
--- /dev/null
+/*.changes
+/*.deb
+/*.diff.gz
+/*.dsc
+/*.tar.gz
+/stamp-*
+
+/*/debian/files
--- /dev/null
+export GNUPGHOME = $(CURDIR)/gpg
+SHELL = /bin/bash
+
+TAR = nonfree-package_0.1 package_0.1 package-built-using_0.1
+PACKAGES = $(TAR) package_0.1-2 package_0.1-3
+
+all: packages
+
+tarballs: stamp-tarballs
+stamp-tarballs:
+ set -e; for t in $(TAR); do \
+ if [ ! -f $$t.orig.tar.gz ]; then \
+ tar -czf $$t.orig.tar.gz --exclude=debian $${t/_/-}; \
+ fi; \
+ done
+ touch $@
+
+packages: stamp-packages
+stamp-packages: stamp-tarballs
+ set -e; for p in $(PACKAGES); do \
+ (cd $${p/_/-}; dpkg-buildpackage); \
+ done
+ touch $@
+
+clean:
+ set -e; for p in $(PACKAGES); do \
+ make -C $${p/_/-} -f debian/rules clean; \
+ done
+ rm -f *.tar.gz *.dsc *.changes *.diff.gz *.deb
+ rm -f gpg/*~
+ rm -f stamp-*
--- /dev/null
+nonfree-package (0.1-1) unstable; urgency=low
+
+ * Initial release.
+
+ -- A Maintainer <maint@example.com> Fri, 08 Jun 2012 18:10:01 +0200
--- /dev/null
+Source: nonfree-package
+Section: non-free/misc
+Priority: extra
+Maintainer: A Maintainer <maint@example.com>
+Build-Depends: debhelper (>= 7)
+
+Package: nonfree-package
+Architecture: all
+Depends: ${misc:Depends}
+Description: a package
+ a package
--- /dev/null
+some-file usr/share/nonfree-package
--- /dev/null
+#! /usr/bin/make -f
+%:
+ dh $@
--- /dev/null
+package (0.1-1) unstable; urgency=low
+
+ * Initial release.
+
+ -- A Maintainer <maint@example.com> Fri, 08 Jun 2012 18:10:01 +0200
--- /dev/null
+Source: package
+Section: misc
+Priority: extra
+Maintainer: A Maintainer <maint@example.com>
+Build-Depends: debhelper (>= 7)
+
+Package: package
+Architecture: all
+Depends: ${misc:Depends}
+Description: a package
+ a package
--- /dev/null
+some-file usr/share/apackage
--- /dev/null
+#! /usr/bin/make -f
+%:
+ dh $@
--- /dev/null
+package-built-using (0.1-1) unstable; urgency=low
+
+ * Initial release.
+
+ -- A Maintainer <maint@example.com> Fri, 08 Jun 2012 18:10:01 +0200
--- /dev/null
+Source: package-built-using
+Section: misc
+Priority: extra
+Maintainer: A Maintainer <maint@example.com>
+Build-Depends: debhelper (>= 7)
+
+Package: package-built-using
+Architecture: all
+Depends: ${misc:Depends}
+Built-Using: package (= 0.1-1)
+Description: a package
+ a package
--- /dev/null
+some-file usr/share/apackage
--- /dev/null
+#! /usr/bin/make -f
+%:
+ dh $@