openSUSE / obs-service-tar_scm

An OBS source service: fetches code from any SCM and archives it
GNU General Public License v2.0
31 stars 105 forks source link

Automatically wrap lines created by changesgenerate and default to name and email #461

Open luc14n0 opened 1 year ago

luc14n0 commented 1 year ago

This should bring us closer to how osc vc behaves:

BEFORE:

-------------------------------------------------------------------
Fri Feb 10 02:14:14 UTC 2023 - luc14n0@opensuse.org

- Update to version 1.17.0+8:
  * add an optional parameter to _p9k_upglob to pass glob qualifiers and use it in most cases to restrict globbing to files/directories/links/etc (#2175)
  * set POWERLEVEL9K_VPN_IP_INTERFACE to the same value as the default: this adds ZeroTier support
  * fix the default value of POWERLEVEL9K_VPN_IP_INTERFACE
  * fix a silly bug introduced in the last commit (#2170)
  * fix network interface detection on macos (#2170)
  * bust caches
  * Add AWS partitions support to EKS kubernetes cluster names
  * Update README.md
  * don't trust P9K_SSH if it was set with a different TTY (#2154)
  * work around a bug in ohmyzsh (#2152)

AFTER:

-------------------------------------------------------------------
Sat Feb 11 00:02:40 UTC 2023 - Luciano Santos <luc14n0@opensuse.org>

- Update to version 1.17.0+8:
  * add an optional parameter to _p9k_upglob to pass glob
    qualifiers and use it in most cases to restrict globbing to
    files/directories/links/etc (#2175)
  * set POWERLEVEL9K_VPN_IP_INTERFACE to the same value as the
    default: this adds ZeroTier support
  * fix the default value of POWERLEVEL9K_VPN_IP_INTERFACE
  * fix a silly bug introduced in the last commit (#2170)
  * fix network interface detection on macos (#2170)
  * bust caches
  * Add AWS partitions support to EKS kubernetes cluster names
  * Update README.md
  * don't trust P9K_SSH if it was set with a different TTY (#2154)
  * work around a bug in ohmyzsh (#2152)

The module in use here is textwrap and it's part of Python's Standard Library, so there's no need for extra dependencies. And unless there's a word longer than 67 characters or a hyphened compound word, words shouldn't get split.


The modifications I did to SystemExit() should look like this, for the changesauthor:

No 'changesauthor' has been defined! You can do it by:                                                             [4/128]

Configuring:                                                                                                              
    * The 'realname' entry for the default API section (api.opensuse.org) -- or whatever OBS
      instance you're working with -- in your OSCRC file with:

        osc config "https://api.opensuse.org" realname John "Doe"

    * The '<param name="changesauthor">John Doe</param> tag nested under the obs_scm/tar_scm
      service tag in your _service file.

Passing:
    * '--changesauthor "John Doe"' on the CLI, when using the obs_scm/tar_scm script manually.

And for the newly introduced changesemail parameter:

No 'changesemail' has been defined! You can do it by:

Configuring:
    * The 'email' entry for the default API section (api.opensuse.org) -- or whatever OBS
      instance you're working with -- in your OSCRC file with:

        osc config "https://api.opensuse.org" email "jdoe@example.com"

    * The '<param name="changesemail">jdoe@example.com</param> tag nested under the
      obs_scm/tar_scm service tag in your _service file.

Passing:
    * '--changesemail "jdoe@example.com"' on the CLI, when using the obs_scm/tar_scm script
      manually.
luc14n0 commented 1 year ago

There's only one issue with one of my last iterations. When using the service in the CLI fails:

$ /usr/lib/obs/service/obs_scm --url https://gitlab.gnome.org/Incubator/loupe.git --scm git --revision refs/tags/44[2/365]
rsionformat @PARENT_TAG@+@TAG_OFFSET@ --versionrewrite-pattern '(.*)\+0' --versionrewrite-replacement \1 --changesgenerate
 enable --changesauthor 'Geeko Packager' --changesemail geeko@opensuse.org --outdir $PWD
Cloning into '/home/luc14n0/dev/obs/luc14n0/branches/GNOME/Next/loupe/tmpydayww3d/loupe'...                              
Updating files: 100% (81/81), done.
8f2bd8de833168e9b64512d03d91ce82fd7081ba
Traceback (most recent call last):
  File "/usr/lib/obs/service/obs_scm", line 30, in <module>
    main()
  File "/usr/lib/obs/service/obs_scm", line 26, in main
    TarSCM.run()
  File "/usr/lib/obs/service/TarSCM/__init__.py", line 39, in run
    task_list.process_list()
  File "/usr/lib/obs/service/TarSCM/tasks.py", line 131, in process_list
    self.process_single_task(task)
  File "/usr/lib/obs/service/TarSCM/tasks.py", line 261, in process_single_task
    self._process_changes(args,
  File "/usr/lib/obs/service/TarSCM/tasks.py", line 297, in _process_changes
    shutil.copy(filename, new_changes_file)
  File "/usr/lib64/python3.10/shutil.py", line 417, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib64/python3.10/shutil.py", line 234, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: 'loupe.changes' and '/home/luc14n0/dev/obs/luc14n0/branches/GNOME/Next/loupe/loupe.changes' are the 
same file

I don't know why the commit messages aren't being written to the temporary .changes file yet.

luc14n0 commented 1 year ago

Ping!

luc14n0 commented 1 year ago

Another ping!