Compare commits

...

13 Commits
0.205 ... main

Author SHA1 Message Date
Simon Quigley
466e2784de Upload to Unstable 2025-03-04 13:43:32 -06:00
Simon Quigley
ba3f0511f9 syncpackage: Catch exceptions cleanly, simply skipping to the next package (erring on the side of caution) if there is an error doing the download (LP: #1943286). 2025-03-04 13:42:50 -06:00
Simon Quigley
2e550ceff2 syncpackage: Cache the sync blocklist in-memory, so it's not fetched multiple times when syncing more than one package. 2025-03-04 13:39:07 -06:00
Simon Quigley
6c8a5d74bd syncpackage: s/syncblacklist/syncblocklist/g 2025-03-04 13:29:02 -06:00
Simon Quigley
3d11516599 mk-sbuild: default to using UTC for schroots (LP: #2097159). 2025-03-04 13:22:40 -06:00
Simon Quigley
5a20308ab1 Read ~/.devscripts in a more robust way, to ideally pick up multi-line variables (Closes: #725418). 2025-03-04 13:17:30 -06:00
Simon Quigley
b551877651 Add a changelog entry 2025-03-04 13:10:04 -06:00
ferbraher
4a4c4e0a27 Parsing arch parameter to getBinaryPackage() 2025-03-04 13:08:59 -06:00
Simon Quigley
865c1c97bc Add a changelog entry 2025-03-04 13:07:42 -06:00
Shengjing Zhu
d09718e976 import-bug-from-debian: package option is overridden and not used 2025-03-04 13:07:11 -06:00
Simon Quigley
bff7baecc9 Add a changelog entry 2025-03-04 13:06:38 -06:00
Dan Bungert
45fbbb5bd1 mk-sbuild: enable pkgmaintainermangler
mk-sbuild installs pkgbinarymangler into the schroot.  Of of the
provided tools in pkgbinarymangler is pkgmaintainermangler.
pkgmaintainermangler is disabled by default, and enabled with
configuration.

A difference between launchpad builds of a synced package and an sbuild
is that the maintainer information will be different.

Enable pkgmaintainermangler to close this difference.
2025-03-04 13:05:57 -06:00
Simon Quigley
ca217c035e Add a new changelog entry 2025-03-04 13:04:49 -06:00
8 changed files with 113 additions and 59 deletions

24
debian/changelog vendored
View File

@ -1,3 +1,27 @@
ubuntu-dev-tools (0.206) unstable; urgency=medium
[ Dan Bungert ]
* mk-sbuild: enable pkgmaintainermangler
[ Shengjing Zhu ]
* import-bug-from-debian: package option is overridden and not used
[ Fernando Bravo Hernández ]
* Parsing arch parameter to getBinaryPackage() (LP: #2081861)
[ Simon Quigley ]
* Read ~/.devscripts in a more robust way, to ideally pick up multi-line
variables (Closes: #725418).
* mk-sbuild: default to using UTC for schroots (LP: #2097159).
* syncpackage: s/syncblacklist/syncblocklist/g
* syncpackage: Cache the sync blocklist in-memory, so it's not fetched
multiple times when syncing more than one package.
* syncpackage: Catch exceptions cleanly, simply skipping to the next
package (erring on the side of caution) if there is an error doing the
download (LP: #1943286).
-- Simon Quigley <tsimonq2@debian.org> Tue, 04 Mar 2025 13:43:15 -0600
ubuntu-dev-tools (0.205) unstable; urgency=medium ubuntu-dev-tools (0.205) unstable; urgency=medium
* [syncpackage] When syncing multiple packages, if one of the packages is in * [syncpackage] When syncing multiple packages, if one of the packages is in

View File

@ -58,7 +58,7 @@ Display more progress information.
\fB\-F\fR, \fB\-\-fakesync\fR \fB\-F\fR, \fB\-\-fakesync\fR
Perform a fakesync, to work around a tarball mismatch between Debian and Perform a fakesync, to work around a tarball mismatch between Debian and
Ubuntu. Ubuntu.
This option ignores blacklisting, and performs a local sync. This option ignores blocklisting, and performs a local sync.
It implies \fB\-\-no\-lp\fR, and will leave a signed \fB.changes\fR file It implies \fB\-\-no\-lp\fR, and will leave a signed \fB.changes\fR file
for you to upload. for you to upload.
.TP .TP

View File

@ -150,7 +150,7 @@ def process_bugs(
err = False err = False
for bug in bugs: for bug in bugs:
ubupackage = package = bug.source ubupackage = bug.source
if package: if package:
ubupackage = package ubupackage = package
bug_num = bug.bug_num bug_num = bug.bug_num

View File

@ -155,6 +155,7 @@ proxy="_unset_"
DEBOOTSTRAP_NO_CHECK_GPG=0 DEBOOTSTRAP_NO_CHECK_GPG=0
EATMYDATA=1 EATMYDATA=1
CCACHE=0 CCACHE=0
USE_PKGBINARYMANGLER=0
while :; do while :; do
case "$1" in case "$1" in
@ -667,6 +668,7 @@ ubuntu)
if ubuntu_dist_ge "$RELEASE" "edgy"; then if ubuntu_dist_ge "$RELEASE" "edgy"; then
# Add pkgbinarymangler (edgy and later) # Add pkgbinarymangler (edgy and later)
BUILD_PKGS="$BUILD_PKGS pkgbinarymangler" BUILD_PKGS="$BUILD_PKGS pkgbinarymangler"
USE_PKGBINARYMANGLER=1
# Disable recommends for a smaller chroot (gutsy and later only) # Disable recommends for a smaller chroot (gutsy and later only)
if ubuntu_dist_ge "$RELEASE" "gutsy"; then if ubuntu_dist_ge "$RELEASE" "gutsy"; then
BUILD_PKGS="--no-install-recommends $BUILD_PKGS" BUILD_PKGS="--no-install-recommends $BUILD_PKGS"
@ -926,8 +928,8 @@ if [ -n "$TEMP_PREFERENCES" ]; then
sudo mv "$TEMP_PREFERENCES" $MNT/etc/apt/preferences.d/proposed.pref sudo mv "$TEMP_PREFERENCES" $MNT/etc/apt/preferences.d/proposed.pref
fi fi
# Copy the timezone (comment this out if you want to leave the chroot at UTC) # Copy the timezone (uncomment this if you want to use your local time zone)
sudo cp -P --remove-destination /etc/localtime /etc/timezone "$MNT"/etc/ #sudo cp -P --remove-destination /etc/localtime /etc/timezone "$MNT"/etc/
# Create a schroot entry for this chroot # Create a schroot entry for this chroot
TEMP_SCHROOTCONF=`mktemp -t schrootconf-XXXXXX` TEMP_SCHROOTCONF=`mktemp -t schrootconf-XXXXXX`
TEMPLATE_SCHROOTCONF=~/.mk-sbuild.schroot.conf TEMPLATE_SCHROOTCONF=~/.mk-sbuild.schroot.conf
@ -1046,6 +1048,25 @@ EOF
EOM EOM
fi fi
if [ "$USE_PKGBINARYMANGLER" = 1 ]; then
sudo bash -c "cat >> $MNT/finish.sh" <<EOM
mkdir -p /etc/pkgbinarymangler/
cat > /etc/pkgbinarymangler/maintainermangler.conf <<EOF
# pkgmaintainermangler configuration file
# pkgmaintainermangler will do nothing unless enable is set to "true"
enable: true
# Configure what happens if /CurrentlyBuilding is present, but invalid
# (i. e. it does not contain a Package: field). If "ignore" (default),
# the file is ignored (i. e. the Maintainer field is mangled) and a
# warning is printed. If "fail" (or any other value), pkgmaintainermangler
# exits with an error, which causes a package build to fail.
invalid_currentlybuilding: ignore
EOF
EOM
fi
if [ -n "$TARGET_ARCH" ]; then if [ -n "$TARGET_ARCH" ]; then
sudo bash -c "cat >> $MNT/finish.sh" <<EOM sudo bash -c "cat >> $MNT/finish.sh" <<EOM
# Configure target architecture # Configure target architecture
@ -1064,7 +1085,7 @@ apt-get update || true
echo set debconf/frontend Noninteractive | debconf-communicate echo set debconf/frontend Noninteractive | debconf-communicate
echo set debconf/priority critical | debconf-communicate echo set debconf/priority critical | debconf-communicate
# Install basic build tool set, trying to match buildd # Install basic build tool set, trying to match buildd
apt-get -y --force-yes install $BUILD_PKGS apt-get -y --force-yes -o Dpkg::Options::="--force-confold" install $BUILD_PKGS
# Set up expected /dev entries # Set up expected /dev entries
if [ ! -r /dev/stdin ]; then ln -s /proc/self/fd/0 /dev/stdin; fi if [ ! -r /dev/stdin ]; then ln -s /proc/self/fd/0 /dev/stdin; fi
if [ ! -r /dev/stdout ]; then ln -s /proc/self/fd/1 /dev/stdout; fi if [ ! -r /dev/stdout ]; then ln -s /proc/self/fd/1 /dev/stdout; fi

View File

@ -49,6 +49,7 @@ from ubuntutools.requestsync.mail import get_debian_srcpkg as requestsync_mail_g
from ubuntutools.version import Version from ubuntutools.version import Version
Logger = getLogger() Logger = getLogger()
cached_sync_blocklist = None
def remove_signature(dscname): def remove_signature(dscname):
@ -435,14 +436,14 @@ def copy(src_pkg, release, bugs, sponsoree=None, simulate=False, force=False, ye
close_bugs(bugs, src_pkg.source, src_pkg.version.full_version, changes, sponsoree) close_bugs(bugs, src_pkg.source, src_pkg.version.full_version, changes, sponsoree)
def is_blacklisted(query): def is_blocklisted(query):
"""Determine if package "query" is in the sync blacklist """Determine if package "query" is in the sync blocklist
Returns tuple of (blacklisted, comments) Returns tuple of (blocklisted, comments)
blacklisted is one of False, 'CURRENT', 'ALWAYS' blocklisted is one of False, 'CURRENT', 'ALWAYS'
""" """
series = Launchpad.distributions["ubuntu"].current_series series = Launchpad.distributions["ubuntu"].current_series
lp_comments = series.getDifferenceComments(source_package_name=query) lp_comments = series.getDifferenceComments(source_package_name=query)
blacklisted = False blocklisted = False
comments = [ comments = [
f"{c.body_text}\n -- {c.comment_author.name}" f"{c.body_text}\n -- {c.comment_author.name}"
f" {c.comment_date.strftime('%a, %d %b %Y %H:%M:%S +0000')}" f" {c.comment_date.strftime('%a, %d %b %Y %H:%M:%S +0000')}"
@ -450,32 +451,38 @@ def is_blacklisted(query):
] ]
for diff in series.getDifferencesTo(source_package_name_filter=query): for diff in series.getDifferencesTo(source_package_name_filter=query):
if diff.status == "Blacklisted current version" and blacklisted != "ALWAYS": if diff.status == "Blacklisted current version" and blocklisted != "ALWAYS":
blacklisted = "CURRENT" blocklisted = "CURRENT"
if diff.status == "Blacklisted always": if diff.status == "Blacklisted always":
blacklisted = "ALWAYS" blocklisted = "ALWAYS"
# Old blacklist: global cached_sync_blocklist
url = "https://ubuntu-archive-team.ubuntu.com/sync-blacklist.txt" if not cached_sync_blocklist:
with urllib.request.urlopen(url) as f: url = "https://ubuntu-archive-team.ubuntu.com/sync-blocklist.txt"
applicable_lines = [] try:
for line in f: with urllib.request.urlopen(url) as f:
line = line.decode("utf-8") cached_sync_blocklist = f.read().decode("utf-8")
if not line.strip(): except:
applicable_lines = [] print("WARNING: unable to download the sync blocklist. Erring on the side of caution.")
continue return ("ALWAYS", "INTERNAL ERROR: Unable to fetch sync blocklist")
applicable_lines.append(line)
try:
line = line[: line.index("#")]
except ValueError:
pass
source = line.strip()
if source and fnmatch.fnmatch(query, source):
comments += ["From sync-blacklist.txt:"] + applicable_lines
blacklisted = "ALWAYS"
break
return (blacklisted, comments) applicable_lines = []
for line in cached_sync_blocklist.splitlines():
if not line.strip():
applicable_lines = []
continue
applicable_lines.append(line)
try:
line = line[:line.index("#")]
except ValueError:
pass
source = line.strip()
if source and fnmatch.fnmatch(query, source):
comments += ["From sync-blocklist.txt:"] + applicable_lines
blocklisted = "ALWAYS"
break
return (blocklisted, comments)
def close_bugs(bugs, package, version, changes, sponsoree): def close_bugs(bugs, package, version, changes, sponsoree):
@ -725,35 +732,35 @@ def main():
if not src_pkg: if not src_pkg:
continue continue
blacklisted, comments = is_blacklisted(src_pkg.source) blocklisted, comments = is_blocklisted(src_pkg.source)
blacklist_fail = False blocklist_fail = False
if blacklisted: if blocklisted:
messages = [] messages = []
if blacklisted == "CURRENT": if blocklisted == "CURRENT":
Logger.debug( Logger.debug(
"Source package %s is temporarily blacklisted " "Source package %s is temporarily blocklisted "
"(blacklisted_current). " "(blocklisted_current). "
"Ubuntu ignores these for now. " "Ubuntu ignores these for now. "
"See also LP: #841372", "See also LP: #841372",
src_pkg.source, src_pkg.source,
) )
else: else:
if args.fakesync: if args.fakesync:
messages += ["Doing a fakesync, overriding blacklist."] messages += ["Doing a fakesync, overriding blocklist."]
else: else:
blacklist_fail = True blocklist_fail = True
messages += [ messages += [
"If this package needs a fakesync, use --fakesync", "If this package needs a fakesync, use --fakesync",
"If you think this package shouldn't be " "If you think this package shouldn't be "
"blacklisted, please file a bug explaining your " "blocklisted, please file a bug explaining your "
"reasoning and subscribe ~ubuntu-archive.", "reasoning and subscribe ~ubuntu-archive.",
] ]
if blacklist_fail: if blocklist_fail:
Logger.error("Source package %s is blacklisted.", src_pkg.source) Logger.error("Source package %s is blocklisted.", src_pkg.source)
elif blacklisted == "ALWAYS": elif blocklisted == "ALWAYS":
Logger.info("Source package %s is blacklisted.", src_pkg.source) Logger.info("Source package %s is blocklisted.", src_pkg.source)
if messages: if messages:
for message in messages: for message in messages:
for line in textwrap.wrap(message): for line in textwrap.wrap(message):
@ -765,7 +772,7 @@ def main():
for line in textwrap.wrap(comment): for line in textwrap.wrap(comment):
Logger.info(" %s", line) Logger.info(" %s", line)
if blacklist_fail: if blocklist_fail:
continue continue
if args.lp: if args.lp:

View File

@ -165,6 +165,7 @@ class SourcePackage(ABC):
series = kwargs.get("series") series = kwargs.get("series")
pocket = kwargs.get("pocket") pocket = kwargs.get("pocket")
status = kwargs.get("status") status = kwargs.get("status")
arch = kwargs.get("arch")
verify_signature = kwargs.get("verify_signature", False) verify_signature = kwargs.get("verify_signature", False)
try_binary = kwargs.get("try_binary", True) try_binary = kwargs.get("try_binary", True)
@ -184,6 +185,7 @@ class SourcePackage(ABC):
self._series = series self._series = series
self._pocket = pocket self._pocket = pocket
self._status = status self._status = status
self._arch = arch
# dscfile can be either a path or an URL. misc.py's download() will # dscfile can be either a path or an URL. misc.py's download() will
# later fiture it out # later fiture it out
self._dsc_source = dscfile self._dsc_source = dscfile
@ -252,6 +254,7 @@ class SourcePackage(ABC):
) )
try: try:
params["archtag"] = self._arch
bpph = archive.getBinaryPackage(self.source, **params) bpph = archive.getBinaryPackage(self.source, **params)
except PackageNotFoundException as bpnfe: except PackageNotFoundException as bpnfe:
# log binary lookup failure, in case it provides hints # log binary lookup failure, in case it provides hints

View File

@ -68,21 +68,19 @@ class UDTConfig:
config = {} config = {}
for filename in ("/etc/devscripts.conf", "~/.devscripts"): for filename in ("/etc/devscripts.conf", "~/.devscripts"):
try: try:
f = open(os.path.expanduser(filename), "r", encoding="utf-8") with open(os.path.expanduser(filename), "r", encoding="utf-8") as f:
content = f.read()
except IOError: except IOError:
continue continue
for line in f: try:
parsed = shlex.split(line, comments=True) tokens = shlex.split(content, comments=True)
if len(parsed) > 1: except ValueError as e:
Logger.warning( Logger.error("Error parsing %s: %s", filename, e)
"Cannot parse variable assignment in %s: %s", continue
getattr(f, "name", "<config>"), for token in tokens:
line, if "=" in token:
) key, value = token.split("=", 1)
if len(parsed) >= 1 and "=" in parsed[0]:
key, value = parsed[0].split("=", 1)
config[key] = value config[key] = value
f.close()
return config return config
def get_value(self, key, default=None, boolean=False, compat_keys=()): def get_value(self, key, default=None, boolean=False, compat_keys=()):

View File

@ -340,6 +340,7 @@ class PullPkg:
params = {} params = {}
params["package"] = options["package"] params["package"] = options["package"]
params["arch"] = options["arch"]
if options["release"]: if options["release"]:
(release, version, pocket) = self.parse_release_and_version( (release, version, pocket) = self.parse_release_and_version(