Just forwarding this question to more appropriate list.

----------  Forwarded Message  ----------

Subject: %forgemeta support for `git` tasks in checked-out code?
Date: Thursday, June 25, 2020, 6:42:42 PM CEST
From: PGNet Dev <pgnet....@gmail.com>
To: copr-de...@lists.fedorahosted.org

I'm building a package using multiple sources.

I'm using $forgemeta to get/manage sources, as per example here:

        
https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/#_multiple_sources_example

One of my sources pulls from upstream scm (github), and needs a subsequent 'git 
submodule--init'.

Is seems that what %forgemeta pulls/tars/expands is not initilialize git repo; 
rather, just the relevant target's files.

E.g., for a given scm source (here, ngx_brotli), the %forgemeta pull unpacks

        tree -L 1 -a ngx_brotli
                ngx_brotli
                ├── config
                ├── CONTRIBUTING.md
                ├── deps
                ├── filter
                ├── .gitmodules
                ├── LICENSE
                ├── README.md
                ├── script
                ├── static
                └── .travis.yml

note, no ".git" folder, and no ability as is to `git submodule --init` in the 
tree.

otoh, a `git clone` of the same source results, as expected, in

        tree -L 1 -a ngx_brotli  
                ngx_brotli
                ├── config
                ├── CONTRIBUTING.md
                ├── deps
                ├── filter
!!              ├── .git
                ├── .gitmodules
                ├── LICENSE
                ├── README.md
                ├── script
                ├── static
                └── .travis.yml

currently, to workaround this, I DISABLE the forge for the source in question, 
and do the pull & submodule init in %prep,

e.g., this spec

        %global forgeurl0 https://github.com/nginx/nginx
        Version:          1.19.0
        %global tag0      release-%{version}

        %global forgeurl1 https://github.com/openresty/headers-more-nginx-module
        %global tag1      master

        # DISABLE global forgeurl1 https://github.com/google/ngx_brotli
        %global tag2      master

        %forgemeta -i -z 0
        %forgemeta -i -z 1
        # DISABLE forgemeta -i -z 2

        Name:           %{name}
        %define dist    %{scm0}
        Release:        %{dist}
        Summary:        %{name}
        License:        BSD
        URL:            %{forgeurl0}

        Source0:        %{forgesource0}
        Source1:        %{forgesource1}
        Source2:        
https://github.com/google/ngx_brotli/archive/master/ngx_brotli-master.tar.gz
        ...

        %prep
        pushd .
        cd %{_sourcedir}
        rm -rf ngx_brotli
        git clone https://github.com/google/ngx_brotli
        cd ngx_brotli
        git submodule update --init
        cd ..
        tar --remove-files -czf ngx_brotli.tar.gz ngx_brotli
        popd

        %setup -T -b 0 -n  nginx-%{tag0}
        %setup -T -b 1 -n  headers-more-nginx-module-%{tag1}
        ...

        %build
        export DESTDIR=%{buildroot}
        cd %{_builddir}/%{name}-%{tag0}
        ...

        %install
        cd %{_builddir}/%{name}-%{tag0}
        make install DESTDIR=%{buildroot} INSTALLDIRS=vendor
        ...

appears to work, and the `git submodule --init` is taken care of correctly.

but, it's messy.

_is_ there a %forgemeta alternative to the manual git clone that will 
init/unpack the source _as_ a repo, allowing the submodule task to be exec'd?

this isn't, of course, ONLY a COPR question, but one of rpmbuild more generally.

_my_ goal _is_ to get it working on COPR, eventually.

that said, if this^ belongs on some other list, let me know.
_______________________________________________
copr-devel mailing list -- copr-de...@lists.fedorahosted.org
To unsubscribe send an email to copr-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/copr-de...@lists.fedorahosted.org

-----------------------------------------


_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to