Skip to content

Change vc from osc to build script#54

Open
M0ses wants to merge 2 commits intoopenSUSE:masterfrom
M0ses:change_vc_from_osc_to_build_script
Open

Change vc from osc to build script#54
M0ses wants to merge 2 commits intoopenSUSE:masterfrom
M0ses:change_vc_from_osc_to_build_script

Conversation

@M0ses
Copy link
Copy Markdown
Contributor

@M0ses M0ses commented Jul 15, 2024

Calling vc directly instead of using osc vc as wrapper.

cpanspec should not require a configured osc.
osc is showing a cli wizard to configure login into a OBS instance at first call.
This is not required by cpanspec except for the vc command.

Using `osc vc` requires login to OBS API if first `osc` call and `osc vc` is
normally searching for `vc` in $PATH or has a fallback to
`/usr/lib/build/vc`.

SEE https://github.com/openSUSE/osc/blob/master/osc/conf.py#L1312
Copy link
Copy Markdown
Collaborator

@perlpunk perlpunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recently stumbled upon that as well.
But one question - where will vc get the email address and name for the changes line header from?

@perlpunk
Copy link
Copy Markdown
Collaborator

I was also thinking that the (osc )vc call could be optional, and cpanspe would just write the new changes into a file in the osc checkout, and then one would be able to call the preferred vc command after that.

@M0ses M0ses force-pushed the change_vc_from_osc_to_build_script branch from 8b30678 to 3d6c2af Compare July 15, 2024 13:43
perlpunk added a commit to perlpunk/autoupdate-perl that referenced this pull request Jul 15, 2024
See also openSUSE/cpanspec#54 which changes `osc vc` to
just `vc`.
@perlpunk
Copy link
Copy Markdown
Collaborator

We also need to remember to add the dependency sccs to the spec file: https://build.opensuse.org/package/show/devel:languages:perl/cpanspec
Could it maybe fallback to osc vc if vc is not found?

perlpunk added a commit to openSUSE/autoupdate-perl that referenced this pull request Jul 15, 2024
See also openSUSE/cpanspec#54 which changes `osc vc` to
just `vc`.
@perlpunk
Copy link
Copy Markdown
Collaborator

perlpunk commented Jul 15, 2024

Hm, actually /usr/lib/build/vc (a shell script) seems to be a different script than /usr/bin/vc (binary).

Also, when calling /usr/lib/build/vc I get:

/usr/lib/build/vc: line 26: dnsdomainname: command not found

It needs the hostname or hostname-busybox package.
And the header is: Mon Jul 15 14:50:43 UTC 2024 - tina <tina@localhost>

Calling vc from sccs just hangs. I guess this is something completely different.

DESCRIPTION
       The  vc  command  copies lines from the standard input to the standard output under control of its arguments and of ‘‘control statements’’ encountered in the standard input.  In the process of per‐
       forming the copy operation, user‐declared keyword may be replaced by their string value when they appear in plain text and/or control statements.

Using `osc vc` requires login to OBS API if first `osc` call and `osc vc` is
normally searching for `vc` in $PATH or has a fallback to
`/usr/lib/build/vc`.

SEE https://github.com/openSUSE/osc/blob/master/osc/conf.py#L1312
@M0ses
Copy link
Copy Markdown
Contributor Author

M0ses commented Jul 15, 2024

Could it maybe fallback to osc vc if vc is not found?

Possible but useless. (IMHO)

osc uses /usr/lib/{,obs-}build/vc, so osc vc as fallback would fail for the same reason as cpanspec.

Here some experiments with pythons shutil.which

kanku@moosex-app:~> python3 -c 'import shutil;print("%s" % shutil.which("my_cmd"));'
None
kanku@moosex-app:~> alias perldoc=/bin/true
kanku@moosex-app:~> python3 -c 'import shutil;print("%s" % shutil.which("perldoc"));'
/usr/bin/perldoc
kanku@moosex-app:~> alias my_cmd=/bin/true
kanku@moosex-app:~> python3 -c 'import shutil;print("%s" % shutil.which("my_cmd"));'
None
kanku@moosex-app:~>

Hm, actually /usr/lib/build/vc (a shell script) seems to be a different script than /usr/bin/vc (binary).

Also, when calling /usr/lib/build/vc I get:

/usr/lib/build/vc: line 26: dnsdomainname: command not found

Just another (non-critical) try to guess email.

It needs the hostname or hostname-busybox package. And the header is: Mon Jul 15 14:50:43 UTC 2024 - tina <tina@localhost>

I see - osc vc does some more guessing for realname/email address.

AFAICS osc vc is checking ~/.config/osc/oscrc for realname/email and if not found, it does osc api /person/<user> to gather the missing information.

Calling vc from sccs just hangs. I guess this is something completely different.

Sorry for confusion - I fixed my PR so it does not search vc in $PATH any longer.

Seems like osc vc was used because it already does all the realname/email guessing.
This might be completly fine for the average users usecases,
but in case of a fresh initialised environment it looks quite strange.

Even if the ENV variables VC_REALNAME/VC_MAILADDR are already set osc vc asks for apiurl/credentials to login at OBS.

kanku@moosex-app:/tmp/kanku> export VC_MAILADDR=fschreiner@suse.com
kanku@moosex-app:/tmp/kanku> export VC_REALNAME="Frank Schreiner"
kanku@moosex-app:/tmp/kanku> cpanspec -f MooseX-App-1.43.tar.gz 


Your user account / password are not configured yet.
You will be asked for them below, and they will be stored in
/home/kanku/.config/osc/oscrc for future use.

I now have a better understanding why osc vc was used in the past.
Anyway, I think, currrently its quite confusing for users and breaks the good old KISS principle.

@M0ses
Copy link
Copy Markdown
Contributor Author

M0ses commented Jul 15, 2024

Even cpanspec -p "My Name <my.address@example.com>" ... doesn't prevent osc from asking for credentials.

@M0ses
Copy link
Copy Markdown
Contributor Author

M0ses commented Jul 16, 2024

So far I found the following places where osc vc tries to find realname/mailaddr:

  • ENV Variables
    • VC_REALNAME
    • VC_MAILADDR
  • -p or --packager option
  • $HOME/.rpmmacros macro named %packager
  • $HOME/.config/osc/oscrc (realname/email in sections)
  • osc api /person/<username>

Please feel free to enhance the list

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.

2 participants