uncommitted - osc-plugins-dput

Ready changes

Summary

Import uploads missing from VCS:

Diff

diff --git a/debian/changelog b/debian/changelog
index 4bb157f..e3e417b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+osc-plugins-dput (20220512.0-1) unstable; urgency=medium
+
+  * New upstream release.
+
+ -- Andrej Shadura <andrew.shadura@collabora.co.uk>  Thu, 12 May 2022 16:44:08 +0200
+
 osc-plugins-dput (20210202.0-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/osc_plugin_dput/main.py b/osc_plugin_dput/main.py
index 8f16a95..40bf8fb 100644
--- a/osc_plugin_dput/main.py
+++ b/osc_plugin_dput/main.py
@@ -5,7 +5,7 @@ from __future__ import print_function
 import os
 from pathlib import Path
 from tempfile import TemporaryDirectory
-from urllib.request import pathname2url, HTTPError
+from urllib.request import pathname2url
 
 import osc.conf as conf
 import osc.core
@@ -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):
                                                     project=self.project_name,
                                                     package=self.package_name,
                                                     dir='.',
-                                                    meta=True)
-            package.update()
-            # 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
+                                                    meta=False)
+            # 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)
+            package.update(size_limit=1)
+            osc.core.statfrmt = statfrmt
+
             package.rev = package.latest_rev()
             return package
 
@@ -220,30 +218,9 @@ def do_dput(self, subcmd, opts, *args):
         # we still want to overwrite
         retained -= set(local_file_list)
 
-        # The temporary checkout we're using doesn't seem to have the
-        # expected result for latest_rev()?
-        source_rev = osc.core.get_source_rev(conf.config['apiurl'],
-                                             proj_name, package_name)
-
-        if 'rev' in source_rev:
-            latest_revision = source_rev['rev']
-
-            for f in retained:
-                print('retaining non-source file: %r' % f)
-                if not os.path.exists(f):
-                    print('fetching %r from server' % f)
-
-                    try:
-                        package.updatefile(f, latest_revision)
-                    except HTTPError as e:
-                        # _link sometimes appears in remote_file_list but can't
-                        # be downloaded
-                        if f == '_link' and e.code == 404:
-                            print('Ignoring 404 error for _link')
-                        else:
-                            raise
-                    else:
-                        downloaded.add(f)
+        # 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:
diff --git a/setup.cfg b/setup.cfg
index acae020..e418024 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = osc-plugin-dput
-version = 20210202.0
+version = 20220512.0
 description = dput plugin for Open Build Service commander
 long_description = file:README.md
 url = https://gitlab.collabora.com/obs/osc-plugin-dput

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/lib/python3/dist-packages/osc_plugin_dput-20220512.0.egg-info/PKG-INFO
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/osc_plugin_dput-20220512.0.egg-info/dependency_links.txt
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/osc_plugin_dput-20220512.0.egg-info/requires.txt
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/osc_plugin_dput-20220512.0.egg-info/top_level.txt

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/lib/python3/dist-packages/osc_plugin_dput-20210202.0.egg-info/PKG-INFO
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/osc_plugin_dput-20210202.0.egg-info/dependency_links.txt
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/osc_plugin_dput-20210202.0.egg-info/requires.txt
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/osc_plugin_dput-20210202.0.egg-info/top_level.txt

No differences were encountered between the control files of package osc-plugin-dput

No differences were encountered between the control files of package osc-plugins-dput

Run locally

More details

Full run details