Unverified Commit 958ab3d8 authored by Andrej Shadura's avatar Andrej Shadura
Browse files

Stop using meta mode for the initial checkout, use size_limit instead

Previously, we used meta mode to prepare a clean checkout, and them
switched the meta mode off immediately afterwards. However, OBS 2.10
no longer supports this behaviour, which was always a hack: at the
"validate" step of the commit process, it returns the _meta file as part
of the filelist, but as this file is special, it’s not present in the
local filelist, resulting in an error message, failing upload and a
successful error code (!) being returned:

    Transmitting file data There is no sha256 sum for file _meta.
    This could be due to an outdated working copy.
    Please update your working copy with osc update and
    commit again afterwards.

Instead of this, check out the package in the normal mode, skipping the
downloads, and re-add all files from scratch.

Signed-off-by: Andrej Shadura's avatarAndrej Shadura <andrew.shadura@collabora.co.uk>
parent 8cdf5e9e
......@@ -14,6 +14,9 @@ from osc.oscerr import OscIOError, WrongArgs
from debian.deb822 import Changes, Dsc
statfrmt = osc.core.statfrmt
def get_objects_from_file(filename):
Return a tuple containing (None or a Changes object), a Dsc object,
......@@ -93,27 +96,22 @@ class DPut(object):
# Now, this is a hack.
# OBS tracks metadata and package data separately. Separate
# revlogs and separate trees. When we create a checkout with
# meta=True, osc will only request metadata part of the package.
# This is good for us, since it allows us to start with a mostly
# Updating the package files with size_limit set to 1 after
# the initialisation allows us to start with a mostly
# clean working directory and still proceed without downloading
# all of the current contents only to possibly remove it in the
# first step.
# However, this also means that we cannot request contents of the
# latest package tree if we want to retain some files.
# osc used to allow downloading files for package checkouts with
# meta=True, but it no longer does.
# An alternative hack is to create a checkout with meta=False,
# set the max. download size to 1 byte, check out the latest
# revision and mark all existing files for deletion.
# Or we can flip the meta flag back to False after we’re done
# and manually rewind the current revision to the latest one.
# By the way, turns out _meta and _link aren’t needed after all.
package.meta = False
# first step; if we were to configure this in init_package,
# the setting would get stored in the local checkout config.
# We override the checkout formatter temporarily to prevent it
# from printing a scary file listing with all files deleted
# (which it prints because when files are skipped, it doesn’t
# find them in a local checkout).
print("Existing files in the package:")
osc.core.statfrmt = lambda _, file: statfrmt(' ', file)
osc.core.statfrmt = statfrmt
package.rev = package.latest_rev()
return package
......@@ -245,6 +243,10 @@ def do_dput(self, subcmd, opts, *args):
# reset the file list, so that we can add files freely without
# osc barking at us each time we re-add an existing file
package.filenamelist = []
# adding local_file_list to the package as links
for f in local_file_list:
filepath = dscdir / f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment