Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

luc14n0
Copy link

@luc14n0 luc14n0 commented Feb 13, 2023

This should bring us closer to how osc vc behaves:

BEFORE:

-------------------------------------------------------------------
Fri Feb 10 02:14:14 UTC 2023 - [email protected]

- 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 <[email protected]>

- 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 "[email protected]"

    * The '<param name="changesemail">[email protected]</param> tag nested under the
      obs_scm/tar_scm service tag in your _service file.

Passing:
    * '--changesemail "[email protected]"' on the CLI, when using the obs_scm/tar_scm script
      manually.

TarSCM/changes.py Outdated Show resolved Hide resolved
TarSCM/changes.py Outdated Show resolved Hide resolved
TarSCM/changes.py Outdated Show resolved Hide resolved
Add automatic line wrapping feature for lines generated by
changesgenerate that are longer than 67 characters, aligning with
openSUSE's current guidelines.

https://en.opensuse.org/openSUSE:Creating_a_changes_file_(RPM)

Signed-off-by: Luciano Santos <[email protected]>
TarSCM/changes.py Outdated Show resolved Hide resolved
TarSCM/changes.py Outdated Show resolved Hide resolved
TarSCM/changes.py Outdated Show resolved Hide resolved
TarSCM/cli.py Outdated Show resolved Hide resolved
Modify default behavior of changesgenerate to add packager's name AND
email by default, instead of only the former, in the generated changes
entry header. This also adds changesemail, a new parameter for _service
files, that must be used along with changesauthor whenever configuring
them manually is needed.

Signed-off-by: Luciano Santos <[email protected]>
@luc14n0 luc14n0 changed the title Automatically wrap lines created by changesgenerate and default to name/email for changesauthor Automatically wrap lines created by changesgenerate and default to name and email Apr 14, 2023
@luc14n0
Copy link
Author

luc14n0 commented Apr 14, 2023

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 [email protected] --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
Copy link
Author

luc14n0 commented Apr 18, 2023

Ping!

@luc14n0
Copy link
Author

luc14n0 commented Apr 28, 2023

Another ping!

@Vogtinator
Copy link
Member

In #502 I implemented the real name handling differently, like osc vc does

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants