<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>45763</bug_id>
          
          <creation_ts>2023-04-06 12:34:39 +0300</creation_ts>
          <short_desc>rpm: поддержка архитектуры LoongArch</short_desc>
          <delta_ts>2023-07-08 10:23:08 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rpm</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>45802</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexey Sheplyakov">asheplyakov</reporter>
          <assigned_to name="Alexey Sheplyakov">asheplyakov</assigned_to>
          <cc>asheplyakov</cc>
    
    <cc>at</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>iv</cc>
    
    <cc>ldv</cc>
    
    <cc>liannnix</cc>
    
    <cc>nir</cc>
    
    <cc>placeholder</cc>
    
    <cc>sin</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>224044</commentid>
    <comment_count>0</comment_count>
    <who name="Alexey Sheplyakov">asheplyakov</who>
    <bug_when>2023-04-06 12:34:39 +0300</bug_when>
    <thetext></thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>224094</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Sheplyakov">asheplyakov</who>
    <bug_when>2023-04-06 20:28:47 +0300</bug_when>
    <thetext>#318149 TESTED #1 [test-only] sisyphus rpm.git=4.13.0.1-alt37</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>229215</commentid>
    <comment_count>2</comment_count>
    <who name="Andrey Limachko">liannnix</who>
    <bug_when>2023-07-07 19:21:30 +0300</bug_when>
    <thetext>#324286 EPERM #2 sisyphus rpm.git=4.13.0.1-alt38 apt.git=0.5.15lorg2-alt85</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>229216</commentid>
    <comment_count>3</comment_count>
    <who name="Gleb F-Malinovskiy">glebfm</who>
    <bug_when>2023-07-07 19:35:22 +0300</bug_when>
    <thetext>А зачем нужно вот это?

+#if defined(__loongarch64)
+       strcpy(un.machine, &quot;loongarch64&quot;);
+#endif</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>229226</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Sheplyakov">asheplyakov</who>
    <bug_when>2023-07-08 08:53:28 +0300</bug_when>
    <thetext>(Ответ для Gleb F-Malinovskiy на комментарий #3)
&gt; А зачем нужно вот это?
&gt; 
&gt; +#if defined(__loongarch64)
&gt; +       strcpy(un.machine, &quot;loongarch64&quot;);
&gt; +#endif

Чтобы работало.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>229227</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Sheplyakov">asheplyakov</who>
    <bug_when>2023-07-08 08:59:27 +0300</bug_when>
    <thetext>(Ответ для Gleb F-Malinovskiy на комментарий #3)
&gt; А зачем нужно вот это?
&gt; 
&gt; +#if defined(__loongarch64)
&gt; +       strcpy(un.machine, &quot;loongarch64&quot;);
&gt; +#endif

Функция defaultMachine (в файле lib/rpmrc.c) чуть менее чем полностью состоит из кода вида:

#       if defined(__linux__) &amp;&amp; defined(__riscv__)
        if (rstreq(un.machine, &quot;riscv&quot;)) {
                if (sizeof(long) == 4)
                        strcpy(un.machine, &quot;riscv32&quot;);
                else if (sizeof(long) == 8)
                        strcpy(un.machine, &quot;riscv64&quot;);
                else if (sizeof(long) == 16)
                        strcpy(un.machine, &quot;riscv128&quot;);
        }   
#       endif   /* riscv */</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>229228</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Sheplyakov">asheplyakov</who>
    <bug_when>2023-07-08 09:03:13 +0300</bug_when>
    <thetext>(Ответ для Alexey Sheplyakov на комментарий #5)
&gt; (Ответ для Gleb F-Malinovskiy на комментарий #3)
&gt; &gt; А зачем нужно вот это?
&gt; &gt; 
&gt; &gt; +#if defined(__loongarch64)
&gt; &gt; +       strcpy(un.machine, &quot;loongarch64&quot;);
&gt; &gt; +#endif
&gt; 
&gt; Функция defaultMachine (в файле lib/rpmrc.c) чуть менее чем полностью
&gt; состоит из кода вида:
&gt; 
&gt; #       if defined(__linux__) &amp;&amp; defined(__riscv__)
&gt;         if (rstreq(un.machine, &quot;riscv&quot;)) {
&gt;                 if (sizeof(long) == 4)
&gt;                         strcpy(un.machine, &quot;riscv32&quot;);
&gt;                 else if (sizeof(long) == 8)
&gt;                         strcpy(un.machine, &quot;riscv64&quot;);
&gt;                 else if (sizeof(long) == 16)
&gt;                         strcpy(un.machine, &quot;riscv128&quot;);
&gt;         }   
&gt; #       endif   /* riscv */

А причина существования функции defaultMachine в том, что название архитектуры с точки зрения ядра (Linux) и rpm не всегда совпадают. Ядру, например, безразлично, какой там ABI в userspace, а для rpm это архиважно.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>229233</commentid>
    <comment_count>7</comment_count>
    <who name="Gleb F-Malinovskiy">glebfm</who>
    <bug_when>2023-07-08 10:23:08 +0300</bug_when>
    <thetext>(In reply to Alexey Sheplyakov from comment #4)
&gt; Чтобы работало.
А без этого разве не работает?

Вы в целом ответили на вопросы, ответ на которые я знаю, а на мой вопрос не очень ответили.
Мне кажется очевидным, что если на loongarch64 будут какие-то изменения такого типа, то и этот код придётся менять, а сейчас этот код заменяет loongarch64 на loongarch64.
Ну пусть будет, вреда никакого.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>