Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package obs-scm-bridge for openSUSE:Factory 
checked in at 2023-05-31 21:55:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-scm-bridge (Old)
 and      /work/SRC/openSUSE:Factory/.obs-scm-bridge.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "obs-scm-bridge"

Wed May 31 21:55:10 2023 rev:5 rq:1090015 version:0.4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/obs-scm-bridge/obs-scm-bridge.changes    
2023-01-27 10:17:20.815927439 +0100
+++ /work/SRC/openSUSE:Factory/.obs-scm-bridge.new.1533/obs-scm-bridge.changes  
2023-05-31 21:55:12.073254974 +0200
@@ -1,0 +2,10 @@
+Tue May 16 08:21:41 UTC 2023 - Adrian Schröter <adr...@suse.de>
+
+- update to 0.4.0
+  * avoid export of .gitattributes file by default
+  * upstream osc is supported now
+  * export meta information of the git clone
+  * Add fallback code for a specific case
+  * Convert local links into symlinks in project git
+
+-------------------------------------------------------------------

Old:
----
  obs-scm-bridge-0.3.0.obscpio

New:
----
  obs-scm-bridge-0.4.1.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ obs-scm-bridge.spec ++++++
--- /var/tmp/diff_new_pack.HTpaqb/_old  2023-05-31 21:55:12.457257244 +0200
+++ /var/tmp/diff_new_pack.HTpaqb/_new  2023-05-31 21:55:12.461257267 +0200
@@ -23,7 +23,7 @@
 %endif
 
 Name:           obs-scm-bridge
-Version:        0.3.0
+Version:        0.4.1
 Release:        0
 Summary:        A help service to work with git repositories in OBS
 License:        GPL-2.0-or-later

++++++ _service ++++++
--- /var/tmp/diff_new_pack.HTpaqb/_old  2023-05-31 21:55:12.493257456 +0200
+++ /var/tmp/diff_new_pack.HTpaqb/_new  2023-05-31 21:55:12.497257481 +0200
@@ -2,8 +2,8 @@
   <service name="obs_scm" mode="manual">
     <param name="url">https://github.com/openSUSE/obs-scm-bridge</param>
     <param name="scm">git</param>
-    <param name="revision">0.3.0</param>
-    <param name="version">0.3.0</param>
+    <param name="revision">0.4.1</param>
+    <param name="version">0.4.1</param>
   </service>
   <service mode="manual" name="set_version" />
 

++++++ obs-scm-bridge-0.3.0.obscpio -> obs-scm-bridge-0.4.1.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-scm-bridge-0.3.0/README.md 
new/obs-scm-bridge-0.4.1/README.md
--- old/obs-scm-bridge-0.3.0/README.md  2023-01-26 15:03:17.000000000 +0100
+++ new/obs-scm-bridge-0.4.1/README.md  2023-05-24 14:26:04.000000000 +0200
@@ -29,17 +29,15 @@
 <scmsync>https://github.com/foo/bar</scmsync>
 ```
 
-For doing a local checkout use the currently experimental osc from
-
-  https://download.opensuse.org/repositories/home:/adrianSuSE:/OBSGIT/
-
-This version allows you to do
+For doing a local checkout use a 1.0 release candidate of osc. This version 
allows
+you to do
 
 # osc co $project <$package>
 
 which will create a git repository inside of the classic osc checkout.
 
-The only further tested functionality is to do local builds atm.
+It also supports local building, but you need to use git for any source
+modification or operation.
 
 HOWTO manage an entire project
 ==============================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-scm-bridge-0.3.0/obs_scm_bridge 
new/obs-scm-bridge-0.4.1/obs_scm_bridge
--- old/obs-scm-bridge-0.3.0/obs_scm_bridge     2023-01-26 15:03:17.000000000 
+0100
+++ new/obs-scm-bridge-0.4.1/obs_scm_bridge     2023-05-24 14:26:04.000000000 
+0200
@@ -20,9 +20,7 @@
 import subprocess
 import tempfile
 from html import escape
-from typing import TYPE_CHECKING, Dict, List, Optional, Set, TextIO, Tuple, 
Union, overload
-if TYPE_CHECKING:
-    from typing import Literal
+from typing import Dict, List, Optional, Set, TextIO, Tuple, Union
 import urllib.parse
 import configparser
 
@@ -46,10 +44,11 @@
 
     _REGEXP = re.compile(r"^[a-zA-Z0-9\.\-\_\+]*$");
 
-    def __init__(self, outdir: str, url: str) -> None:
+    def __init__(self, outdir: str, url: str, projectscmsync: str) -> None:
         self.outdir   = outdir
         self.revision = None
         self.subdir   = None
+        self.projectscmsync = projectscmsync
         self.keep_meta = False
         self.enforced_deep_clone = False
         self.arch = []
@@ -81,60 +80,20 @@
         if self.url[5]:
             self.revision = self.url[5]
             self.url[5] = ''
+        # scmtoolurl is the url we pass to the the scm tool
+        scmtoolurl = self.url.copy()
+        if scmtoolurl[0] and scmtoolurl[0][0:4] == 'git+':
+            scmtoolurl[0] = scmtoolurl[0][4:]
+        self.scmtoolurl = urllib.parse.urlunparse(scmtoolurl)
 
-    @overload
-    def run_cmd(
-            self,
-            cmd: List[str],
-            *,
-            fatal: str,
-            cwd: Optional[str]=None,
-            stdout: int=subprocess.PIPE,
-            env: Optional[Dict[str, str]]=None,
-    ) -> Tuple["Literal[0]", str]: ...
-
-    @overload
-    def run_cmd(
-            self,
-            cmd: List[str],
-            *,
-            fatal: str,
-            cwd: Optional[str]=None,
-            stdout: TextIO,
-            env: Optional[Dict[str, str]]=None,
-    ) -> Tuple["Literal[0]", None]: ...
-
-    @overload
-    def run_cmd(
+    def run_cmd_nonfatal(
             self,
             cmd: List[str],
             *,
-            fatal: Optional[str]=None,
-            cwd: Optional[str]=None,
-            stdout: int=subprocess.PIPE,
-            env: Optional[Dict[str, str]]=None,
-    ) -> Tuple[int, str]: ...
-
-    @overload
-    def run_cmd(
-            self,
-            cmd: List[str],
-            *,
-            fatal: Optional[str]=None,
-            cwd: Optional[str]=None,
-            stdout: TextIO,
-            env: Optional[Dict[str, str]]=None,
-    ) -> Tuple[int, None]: ...
-
-    def run_cmd(
-            self,
-            cmd: List[str],
-            *,
-            fatal: Optional[str]=None,
             cwd: Optional[str]=None,
             stdout: Union[int, TextIO]=subprocess.PIPE,
             env: Optional[Dict[str, str]]=None,
-    ) -> Tuple[int, Optional[str]]:
+    ) -> Tuple[int, str]:
         logging.debug("COMMAND: %s" % cmd)
         stderr = subprocess.PIPE
         if stdout == subprocess.PIPE:
@@ -146,29 +105,42 @@
                                 cwd=cwd,
                                 env=env)
         std_out = proc.communicate()[0]
-        output = std_out.decode() if std_out else None
+        output = std_out.decode() if std_out else ''
 
         logging.debug("RESULT(%d): %s", proc.returncode, repr(output))
-        if fatal and proc.returncode != 0:
-            print("ERROR: " + fatal + " failed: ", output)
-            sys.exit(proc.returncode)
         return (proc.returncode, output)
 
+    def run_cmd(
+            self,
+            cmd: List[str],
+            *,
+            fatal: str,
+            cwd: Optional[str]=None,
+            stdout: Union[int, TextIO]=subprocess.PIPE,
+            env: Optional[Dict[str, str]]=None,
+    ) -> str:
+        returncode, output = self.run_cmd_nonfatal(cmd, cwd=cwd, 
stdout=stdout, env=env)
+        if returncode != 0:
+            print("ERROR: " + fatal + " failed: ", output)
+            sys.exit(returncode)
+        return output
+
     def do_clone_commit(self, outdir: str, include_submodules: bool=False) -> 
None:
         assert self.revision, "no revision is set but do_clone_commit was 
called"
         cmd = [ 'git', 'init', outdir ]
         self.run_cmd(cmd, fatal="git init")
-        cmd = [ 'git', '-C', outdir, 'remote', 'add', 'origin', 
urllib.parse.urlunparse(self.url) ]
+        cmd = [ 'git', '-C', outdir, 'remote', 'add', 'origin', 
self.scmtoolurl ]
         self.run_cmd(cmd, fatal="git remote add origin")
         cmd = [ 'git', '-C', outdir, 'fetch', 'origin', self.revision ]
         if shallow_clone:
             cmd += [ '--depth', '1' ]
         if include_submodules:
-            if self.subdir:
-               cmd += [ "--recurse-submodules=" + self.subdir ]
-            else:
+            # try to select specific submodule first when a subdir is given 
and fall back
+            if self.subdir is None or self.run_cmd_nonfatal(cmd + [ 
"--recurse-submodules=" + self.subdir ])[0] != 0:
                cmd += [ '--recurse-submodules' ]
-        self.run_cmd(cmd, fatal="git fetch")
+               self.run_cmd(cmd, fatal="git fetch")
+        else:
+            self.run_cmd(cmd, fatal="git fetch")
         cmd = [ 'git', '-C', outdir, 'checkout', '-q', self.revision ]
         env = {"GIT_LFS_SKIP_SMUDGE": "1", **os.environ} if self.no_lfs else 
None
         self.run_cmd(cmd, fatal="git checkout", env=env)
@@ -182,7 +154,7 @@
         if self.revision and re.match(r"^[0-9a-fA-F]{40,}$", self.revision):
             self.do_clone_commit(outdir, include_submodules)
             return
-        cmd = [ 'git', 'clone', urllib.parse.urlunparse(self.url), outdir ]
+        cmd = [ 'git', 'clone', self.scmtoolurl, outdir ]
         if include_submodules:
             if self.subdir:
                cmd += [ "--recurse-submodules=" + self.subdir ]
@@ -196,13 +168,49 @@
         env = {"GIT_LFS_SKIP_SMUDGE": "1", **os.environ} if self.no_lfs else 
None
         self.run_cmd(cmd, fatal="git clone", env=env)
 
+    # the _scmsync.obsinfo file might become obsolete again when we store 
entire
+    # git history by default later.
+    def write_obsinfo(self, outdir: str) -> None:
+        cmd = [ 'git', 'rev-parse', 'HEAD' ]
+        line = self.run_cmd(cmd, cwd=outdir, fatal="git rev-parse")
+        commit = line.rstrip()
+        cmd = [ 'git', 'log', '-n1', '--date=format:%Y%m%d', 
'--no-show-signature', '--pretty=format:%ct' ]
+        line = self.run_cmd(cmd, cwd=outdir, fatal="git rev-parse")
+        tstamp = line.rstrip()
+        infofile = os.path.join(outdir, '_scmsync.obsinfo')
+        with open(infofile, "w") as obsinfo:
+            obsinfo.write("mtime: " + tstamp + "\n")
+            obsinfo.write("commit: " + commit + "\n")
+            if self.scmtoolurl:
+                obsinfo.write("url: " + self.scmtoolurl + "\n")
+            if self.revision:
+                obsinfo.write("revision: " + self.revision + "\n")
+            if self.subdir:
+                obsinfo.write("subdir: " + self.subdir + "\n")
+            if self.projectscmsync:
+                obsinfo.write("projectscmsync: " + self.projectscmsync + "\n")
+
     def clone(self, shallow_clone: bool, include_submodules: bool=False) -> 
None:
         if not self.subdir:
             self.do_clone(self.outdir, (shallow_clone and not 
self.enforced_deep_clone), include_submodules)
+            self.write_obsinfo(self.outdir)
             return
         clonedir = tempfile.mkdtemp(prefix="obs-scm-bridge")
         self.do_clone(clonedir, (shallow_clone and not 
self.enforced_deep_clone), include_submodules)
         fromdir = os.path.join(clonedir, self.subdir)
+        if os.path.islink(fromdir):
+            target = os.readlink(fromdir).rstrip('/') # this is no recursive 
lookup, but is there a usecase?
+            if '/' in target:
+                print("ERROR: only local links are supported: " + self.subdir)
+                sys.exit(1)
+            # switch subdir and clone again
+            self.subdir=target
+            shutil.rmtree(clonedir)
+            clonedir = tempfile.mkdtemp(prefix="obs-scm-bridge")
+            fromdir = os.path.join(clonedir, self.subdir)
+            self.do_clone(clonedir, (shallow_clone and not 
self.enforced_deep_clone), include_submodules)
+            self.write_obsinfo(clonedir)
+
         if not 
os.path.realpath(fromdir+'/').startswith(os.path.realpath(clonedir+'/')):
             print("ERROR: subdir is not below clone directory")
             sys.exit(1)
@@ -242,7 +250,7 @@
         listing = sorted(os.listdir("."))
         specials = []
         for name in listing:
-            if name == '.git' and not self.keep_meta:
+            if name in ('.git', '.gitattributes') and not self.keep_meta:
                 # we do not store git meta data by default to avoid bloat 
storage
                 continue
             if name[0:1] == '.':
@@ -296,7 +304,7 @@
 
     def get_subdir_info(self, dir: str) -> str:
         cmd = [ download_assets, '--show-dir-srcmd5', '--', dir ]
-        rcode, info = self.run_cmd(cmd, fatal="download_assets 
--show-dir-srcmd5")
+        info = self.run_cmd(cmd, fatal="download_assets --show-dir-srcmd5")
         return info.strip()
 
     def write_info_file(self, filename: str, info: str) -> None:
@@ -309,17 +317,20 @@
             info = self.get_subdir_info(self.outdir)
         else:
             cmd = [ 'git', '-C', self.outdir, 'show', '-s', 
'--pretty=format:%H', 'HEAD' ]
-            rcode, info = self.run_cmd(cmd, fatal="git show -s HEAD")
+            info = self.run_cmd(cmd, fatal="git show -s HEAD")
             info = info.strip()
         if info:
             self.write_info_file(os.path.join(self.outdir, "_service_info"), 
info)
 
-    def write_package_xml_file(self, name: str, url: str) -> None:
+    def write_package_xml_file(self, name: str, url: str, projectscmsync: str) 
-> None:
+        projecturlxml=''
+        if projectscmsync:
+            projecturlxml=f"""\n  <url>{escape(projectscmsync)}</url>"""
         with open(f"{name}.xml", 'w') as xmlfile:
             xmlfile.write(f"""<package name="{escape(name)}">
-  <bcntsynctag>{escape(name)}</bcntsynctag>
+  <bcntsynctag>{escape(name)}</bcntsynctag>{projecturlxml}
   <scmsync>{escape(url)}</scmsync>
-</package>""")
+</package>\n""")
 
     def write_package_xml_local_link(self, target: str, name: str) -> None:
         with open(f"{name}.xml", 'w') as xmlfile:
@@ -334,7 +345,7 @@
     def list_submodule_revisions(self) -> None:
         self.revisions = {}
         cmd = [ 'git', 'ls-tree', 'HEAD', '.' ]
-        rcode, output = self.run_cmd(cmd, fatal="git ls-tree")
+        output = self.run_cmd(cmd, fatal="git ls-tree")
         for line in output.splitlines():
             lstree = line.split(maxsplit=4)
             if lstree[1] == 'commit' and len(lstree[2]) >= 40:
@@ -342,7 +353,7 @@
 
     def process_package_submodule(self, gsmsection: configparser.SectionProxy, 
package_name: Optional[str]=None) -> None:
         path = gsmsection['path']
-        url = gsmsection['url']
+        urlstr = gsmsection['url']
         if not package_name:
             package_name = path
 
@@ -361,7 +372,7 @@
 
         # all good, write xml file and register the module
         self.gitsubmodules.add(path)
-        url = list(urllib.parse.urlparse(url))
+        url = list(urllib.parse.urlparse(urlstr))
         url[5] = revision
         if self.arch:
             query = urllib.parse.parse_qs(url[4]);
@@ -374,9 +385,18 @@
             # need to append a '/' to the base url so that the relative
             # path is properly resolved, otherwise we might descend one
             # directory too far
-            unparsed_url = 
urllib.parse.urljoin(urllib.parse.urlunparse(self.url) +"/", unparsed_url)
+            unparsed_url = urllib.parse.urljoin(self.scmtoolurl+'/', 
unparsed_url)
+        if self.url[0][0:4] == 'git+':
+            unparsed_url = 'git+' + unparsed_url
+
+        projecturl = self.url.copy()
+        # replace the fragment with the checked out commit id
+        cmd = [ 'git', 'rev-parse', 'HEAD' ]
+        line = self.run_cmd(cmd, cwd=self.outdir, fatal="git rev-parse")
+        projecturl[5] = line.rstrip()
+        projectscmsync = urllib.parse.urlunparse(projecturl)
 
-        self.write_package_xml_file(package_name, unparsed_url)
+        self.write_package_xml_file(package_name, unparsed_url, projectscmsync)
         self.write_info_file(package_name + ".info", revision)
         self.export_files.add(package_name + ".xml")
         self.export_files.add(package_name + ".info")
@@ -392,12 +412,12 @@
         self.write_info_file(directory + ".info", info)
 
         # add subdir parameter to url
-        url = self.url
+        url = self.url.copy()
         query = urllib.parse.parse_qs(url[4])
-        query['subdir'] = directory
+        query['subdir'] = list(directory)
         url[4] = urllib.parse.urlencode(query)
         if self.revision:
-            self.url[5] = self.revision
+            url[5] = self.revision
 
         self.write_package_xml_file(directory, urllib.parse.urlunparse(url))
 
@@ -423,7 +443,7 @@
         listing = sorted(os.listdir("."))
         for name in listing:
             if os.path.islink(name):
-                target = os.readlink(name) # this is no recursive lookup, but 
is there a usecase?
+                target = os.readlink(name).rstrip('/') # this is no recursive 
lookup, but is there a usecase?
                 if '/' in target:
                     logging.warn("only local links are supported, skipping: " 
+ name)
                     continue
@@ -468,6 +488,8 @@
                         type=str)
     parser.add_argument('--projectmode',
                         help='just return the package list based on the 
subdirectories')
+    parser.add_argument('--projectscmsync',
+                        help='add also reference information of a project git 
for a package clone')
     parser.add_argument('--debug',
                         help='verbose debug mode')
     args = vars(parser.parse_args())
@@ -475,13 +497,14 @@
     url = args['url'][0]
     outdir = args['outdir'][0]
     project_mode = args['projectmode']
+    projectscmsync = args['projectscmsync']
 
     if args['debug']:
         logging.getLogger().setLevel(logging.DEBUG)
         logging.debug("Running in debug mode")
 
     # workflow
-    obsgit = ObsGit(outdir, url)
+    obsgit = ObsGit(outdir, url, projectscmsync)
     if project_mode == 'true' or project_mode == '1':
         obsgit.clone(shallow_clone)
         obsgit.generate_package_xml_files()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-scm-bridge-0.3.0/poetry.lock 
new/obs-scm-bridge-0.4.1/poetry.lock
--- old/obs-scm-bridge-0.3.0/poetry.lock        2023-01-26 15:03:17.000000000 
+0100
+++ new/obs-scm-bridge-0.4.1/poetry.lock        2023-05-24 14:26:04.000000000 
+0200
@@ -8,17 +8,26 @@
 
 [[package]]
 name = "attrs"
-version = "22.1.0"
+version = "22.2.0"
 description = "Classes Without Boilerplate"
 category = "dev"
 optional = false
-python-versions = ">=3.5"
+python-versions = ">=3.6"
 
 [package.extras]
-dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy 
(>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", 
"pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"]
-docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"]
-tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy 
(>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", 
"zope.interface"]
-tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", 
"mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"]
+cov = ["attrs[tests]", "coverage-enable-subprocess", "coverage[toml] (>=5.3)"]
+dev = ["attrs[docs,tests]"]
+docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", 
"sphinxcontrib-towncrier", "towncrier", "zope.interface"]
+tests = ["attrs[tests-no-zope]", "zope.interface"]
+tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", 
"mypy (>=0.971,<0.990)", "mypy (>=0.971,<0.990)", "pympler", "pympler", "pytest 
(>=4.3.0)", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-mypy-plugins", 
"pytest-xdist[psutil]", "pytest-xdist[psutil]"]
+
+[[package]]
+name = "cached-property"
+version = "1.5.2"
+description = "A decorator for caching properties in classes."
+category = "dev"
+optional = false
+python-versions = "*"
 
 [[package]]
 name = "colorama"
@@ -158,12 +167,21 @@
 category = "dev"
 optional = false
 python-versions = ">=3.6.2,<4.0"
+develop = false
 
 [package.dependencies]
+cached-property = {version = "^1.5", markers = "python_version < \"3.8\""}
 dataclasses = {version = ">=0.8", markers = "python_version < \"3.7\""}
-filelock = ">=3.4,<4.0"
-pytest = ">=3.10"
+filelock = "^3.4"
+pytest = ">= 3.10"
 pytest-testinfra = ">=6.4.0"
+typing-extensions = {version = ">=3.0", markers = "python_version < \"3.8\""}
+
+[package.source]
+type = "git"
+url = "https://github.com/dcermak/pytest_container.git";
+reference = "main"
+resolved_reference = "6afca09f3e73912905f39e592e3ff7bbdff22055"
 
 [[package]]
 name = "pytest-testinfra"
@@ -230,15 +248,19 @@
 [metadata]
 lock-version = "1.1"
 python-versions = ">=3.6.2,<4.0"
-content-hash = 
"8a967b873bf71c2c18bed2a42d14361884350e95dafb4d854a76933f607bc06d"
+content-hash = 
"3dfca7206024ae64998d55cf89cf04e28bcb0988761410d3cc80a91f5f570dda"
 
 [metadata.files]
 atomicwrites = [
     {file = "atomicwrites-1.4.1.tar.gz", hash = 
"sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11"},
 ]
 attrs = [
-    {file = "attrs-22.1.0-py2.py3-none-any.whl", hash = 
"sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"},
-    {file = "attrs-22.1.0.tar.gz", hash = 
"sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"},
+    {file = "attrs-22.2.0-py3-none-any.whl", hash = 
"sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836"},
+    {file = "attrs-22.2.0.tar.gz", hash = 
"sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"},
+]
+cached-property = [
+    {file = "cached-property-1.5.2.tar.gz", hash = 
"sha256:9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130"},
+    {file = "cached_property-1.5.2-py2.py3-none-any.whl", hash = 
"sha256:df4f613cf7ad9a588cc381aaf4a512d26265ecebd5eb9e1ba12f1319eb85a6a0"},
 ]
 colorama = [
     {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = 
"sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"},
@@ -284,10 +306,7 @@
     {file = "pytest-7.0.1-py3-none-any.whl", hash = 
"sha256:9ce3ff477af913ecf6321fe337b93a2c0dcf2a0a1439c43f5452112c1e4280db"},
     {file = "pytest-7.0.1.tar.gz", hash = 
"sha256:e30905a0c131d3d94b89624a1cc5afec3e0ba2fbdb151867d8e0ebd49850f171"},
 ]
-pytest-container = [
-    {file = "pytest_container-0.0.2-py3-none-any.whl", hash = 
"sha256:44d9f86893656c27a2b24871e96a1f8cb4186642702d7b290d12bcb84dbd3ff6"},
-    {file = "pytest_container-0.0.2.tar.gz", hash = 
"sha256:79c5eb57ada8a73ae319f0a57f105d38f751a73a7d358908e714f7678da3d3f9"},
-]
+pytest-container = []
 pytest-testinfra = [
     {file = "pytest-testinfra-6.8.0.tar.gz", hash = 
"sha256:07c8c2c472aca7d83099ebc5f850d383721cd654b66c60ffbb145e45e584ff99"},
     {file = "pytest_testinfra-6.8.0-py3-none-any.whl", hash = 
"sha256:56ac1dfc61342632a1189091473e253db1a3cdcecce0d49d6a769f33cd264814"},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-scm-bridge-0.3.0/pyproject.toml 
new/obs-scm-bridge-0.4.1/pyproject.toml
--- old/obs-scm-bridge-0.3.0/pyproject.toml     2023-01-26 15:03:17.000000000 
+0100
+++ new/obs-scm-bridge-0.4.1/pyproject.toml     2023-05-24 14:26:04.000000000 
+0200
@@ -11,8 +11,8 @@
 python = ">=3.6.2,<4.0"
 
 [tool.poetry.group.dev.dependencies]
-pytest-container = "^0.0.2"
-pytest-xdist = "^3.0.2"
+pytest-container = { git = "https://github.com/dcermak/pytest_container.git";, 
branch = "main" }
+pytest-xdist = ">=3.0"
 
 [build-system]
 requires = ["poetry-core"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-scm-bridge-0.3.0/test/test_service.py 
new/obs-scm-bridge-0.4.1/test/test_service.py
--- old/obs-scm-bridge-0.3.0/test/test_service.py       2023-01-26 
15:03:17.000000000 +0100
+++ new/obs-scm-bridge-0.4.1/test/test_service.py       2023-05-24 
14:26:04.000000000 +0200
@@ -32,6 +32,7 @@
     cd aaa_base && git rev-parse HEAD > /src/aaa_base
 
 COPY obs_scm_bridge /usr/bin/
+RUN chmod +x /usr/bin/obs_scm_bridge
 """
 
 TUMBLEWEED = DerivedContainer(
@@ -62,15 +63,34 @@
     """This is just a simple smoke test to check whether the script works."""
     auto_container.connection.run_expect([0], f"{_OBS_SCM_BRIDGE_CMD} --help")
 
-
 def test_clones_the_repository(auto_container_per_test: ContainerData):
     """Check that the service clones the manually created repository 
correctly."""
     dest = "/tmp/ring0"
     auto_container_per_test.connection.run_expect(
         [0], f"{_OBS_SCM_BRIDGE_CMD} --outdir {dest} --url {_RPMS_DIR}ring0"
     )
+    # delete _scmsync.obsinfo so that the diff succeeds
+    auto_container_per_test.connection.run_expect([0], f"rm 
{dest}/_scmsync.obsinfo")
     auto_container_per_test.connection.run_expect([0], f"diff {dest} 
{_RPMS_DIR}ring0")
 
+@pytest.mark.parametrize("container_per_test", CONTAINER_IMAGES, indirect=True)
+@pytest.mark.parametrize(
+    "fragment",
+    (
+        "",
+        "#main",
+        # sha of the 0.3.0 release tag
+        "#9907826c17ca7b650c4040e9c2b45bfef4d9821f",
+    ),
+)
+def test_clones_subdir(container_per_test: ContainerData, fragment: str):
+    dest = "/tmp/scm-bridge/"
+    container_per_test.connection.run_expect(
+        [0],
+        f"{_OBS_SCM_BRIDGE_CMD} --outdir {dest} "
+        f"--url 
https://github.com/openSUSE/obs-scm-bridge?subdir=test{fragment}";,
+    )
+
 
 def test_creates_packagelist(auto_container_per_test: ContainerData):
     """Smoke test for the generation of the package list files `$pkg_name.xml`

++++++ obs-scm-bridge.obsinfo ++++++
--- /var/tmp/diff_new_pack.HTpaqb/_old  2023-05-31 21:55:12.597258071 +0200
+++ /var/tmp/diff_new_pack.HTpaqb/_new  2023-05-31 21:55:12.601258095 +0200
@@ -1,5 +1,5 @@
 name: obs-scm-bridge
-version: 0.3.0
-mtime: 1674741797
-commit: 9907826c17ca7b650c4040e9c2b45bfef4d9821f
+version: 0.4.1
+mtime: 1684931164
+commit: 3710c1f7695d57c99dc5bb5c1877595ecaa33773
 

Reply via email to