openSUSE / cpanspec

Create openSUSE spec files form cpan tar files
Other
8 stars 10 forks source link

Change vc from osc to build script #54

Open M0ses opened 1 month ago

M0ses commented 1 month ago

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.

perlpunk commented 1 month ago

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.

perlpunk commented 1 month ago

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 commented 1 month ago

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.
M0ses commented 1 month ago

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 commented 1 month ago

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

M0ses commented 1 month ago

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

Please feel free to enhance the list