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

g.extension: fix printing extension temporary directory to stderr for downloading extension source code only with -d flag #2918

Merged

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Apr 15, 2023

Describe the bug
If you try download some extension source code only (-d flag), printed extension directory is not correct (check extension directory path on the To Compile/Install run and Path to the source line)

To Reproduce
Steps to reproduce the behavior:

  1. Try download some extension source code only g.extension -d r.accumulate
  2. Check downloaded extension source code path printed on stderr (line To Compile/Install run and Path to the source code)
GRASS nc_basic_spm_grass7/PERMANENT:grass > g.extension -d r.accumulate
WARNING: Extension <r.accumulate> already installed. Re-installing...
Fetching <r.accumulate> from <https://github.com/OSGeo/grass-addons> (be
patient)...
remote: Enumerating objects: 41, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 41 (delta 3), reused 13 (delta 2), pack-reused 13
Receiving objects: 100% (41/41), 1.63 MiB | 787.00 KiB/s, done.
Resolving deltas: 100% (3/3), done.
Updating files: 100% (41/41), done.
Already on 'grass8'
Your branch is up to date with 'origin/grass8'.

To compile run:
make MODULE_TOPDIR=/usr/lib64/grass83 RUN_GISRC=/tmp/grass8-tomas-32426/gisrc BIN=/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate/bin HTMLDIR=/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate/docs/html RESTDIR=/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate/docs/rest MANBASEDIR=/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate/docs/man SCRIPTDIR=/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate/scripts STRINGDIR=/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate ETC=/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate/etc SOURCE_URL=https://github.com/OSGeo/grass-addons

To install run:
make MODULE_TOPDIR=/usr/lib64/grass83 ARCH_DISTDIR=/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate INST_DIR=/home/tomas/.grass8/addons install

Path to the source code:
/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate

GRASS nc_basic_spm_grass7/PERMANENT:grass > tree /tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate
/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate
└── grass_addons
    ├── CONTRIBUTING.md
    ├── contributors.csv
    ├── LICENSE
    ├── pyproject.toml
    ├── README.md
    ├── src
    │   ├── Makefile
    │   ├── raster
    │   │   ├── Makefile
    │   │   └── r.accumulate
    │   │       ├── accumulate_iterative.c
    │   │       ├── accumulate_recursive.c
    │   │       ├── calculate_lfp_iterative.c
    │   │       ├── calculate_lfp_recursive.c
    │   │       ├── delineate_streams.c
    │   │       ├── delineate_subwatersheds_iterative.c
    │   │       ├── delineate_subwatersheds_recursive.c
    │   │       ├── global.h
    │   │       ├── line_list.c
    │   │       ├── main.c
    │   │       ├── Makefile
    │   │       ├── point_list.c
    │   │       ├── r_accumulate_formats.png
    │   │       ├── r.accumulate.html
    │   │       ├── r_accumulate_nc_comparison.png
    │   │       ├── r_accumulate_nc_example.png
    │   │       ├── r_accumulate_nc_lfp_example_multiple.png
    │   │       ├── r_accumulate_nc_lfp_example_single.png
    │   │       ├── r_accumulate_nc_lfp_example_single_warning.png
    │   │       ├── r_accumulate_nc_lfp_example_subwatersheds.png
    │   │       ├── r_accumulate_nc_stream_comparison.png
    │   │       ├── r_accumulate_nc_stream_example.png
    │   │       ├── r_accumulate_nc_subwatersheds_example.png
    │   │       ├── r_accumulate_nc_watershed_example.png
    │   │       ├── r_accumulate_r_watershed_nc_example.png
    │   │       ├── raster.c
    │   │       └── subaccumulate.c
    │   └── toolboxes.xml
    └── SUBMITTING

4 directories, 36 files

Expected behavior
Correct printed downloaded extension source code directory path to stderr.

Instead of extension directory path

/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate

should be

/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate/grass_addons/src/raster/r.accumulate

GRASS nc_basic_spm_grass7/PERMANENT:~ > g.extension -d r.accumulate
WARNING: Extension <r.accumulate> already installed. Re-installing...
Fetching <r.accumulate> from <https://github.com/OSGeo/grass-addons> (be
patient)...
remote: Enumerating objects: 41, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 41 (delta 3), reused 13 (delta 2), pack-reused 13
Receiving objects: 100% (41/41), 1.63 MiB | 615.00 KiB/s, done.
Resolving deltas: 100% (3/3), done.
Updating files: 100% (41/41), done.
Already on 'grass8'
Your branch is up to date with 'origin/grass8'.

To compile run:
make MODULE_TOPDIR=/usr/lib64/grass83 RUN_GISRC=/tmp/grass8-tomas-24553/gisrc BIN=/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate/bin HTMLDIR=/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate/docs/html RESTDIR=/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate/docs/rest MANBASEDIR=/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate/docs/man SCRIPTDIR=/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate/scripts STRINGDIR=/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate ETC=/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate/etc SOURCE_URL=https://github.com/OSGeo/grass-addons

To install run:
make MODULE_TOPDIR=/usr/lib64/grass83 ARCH_DISTDIR=/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate INST_DIR=/home/tomas/.grass8/addons install

Path to the source code:
/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate

GRASS nc_basic_spm_grass7/PERMANENT:~ > tree /tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate 
/tmp/grass8-tomas-24553/tmp6676la82/r.accumulate/grass_addons/src/raster/r.accumulate
├── accumulate_iterative.c
├── accumulate_recursive.c
├── calculate_lfp_iterative.c
├── calculate_lfp_recursive.c
├── delineate_streams.c
├── delineate_subwatersheds_iterative.c
├── delineate_subwatersheds_recursive.c
├── global.h
├── line_list.c
├── main.c
├── Makefile
├── point_list.c
├── r_accumulate_formats.png
├── r.accumulate.html
├── r_accumulate_nc_comparison.png
├── r_accumulate_nc_example.png
├── r_accumulate_nc_lfp_example_multiple.png
├── r_accumulate_nc_lfp_example_single.png
├── r_accumulate_nc_lfp_example_single_warning.png
├── r_accumulate_nc_lfp_example_subwatersheds.png
├── r_accumulate_nc_stream_comparison.png
├── r_accumulate_nc_stream_example.png
├── r_accumulate_nc_subwatersheds_example.png
├── r_accumulate_nc_watershed_example.png
├── r_accumulate_r_watershed_nc_example.png
├── raster.c
└── subaccumulate.c

0 directories, 27 files

System description (please complete the following information):

  • Operating System: all
  • GRASS GIS version: 8.3.dev

Additional context
To be backported with #2895.

For downloading extension source code only with -d flag.
@tmszi tmszi added bug Something isn't working backport_needed Python Related code is in Python labels Apr 15, 2023
@tmszi tmszi added this to the 8.3.0 milestone Apr 15, 2023
@ninsbl
Copy link
Member

ninsbl commented Apr 15, 2023

Good catch, @tmszi !

I completely overlooked the download only option.

When working on #2895, I noticed that running make in grass-addons/src fails because not all subdirs (temporal, imagery, ...) are downloaded. Thus, I opened a PR in grass-addons: OSGeo/grass-addons#887
I would be happy to get your feedback on that too.

That PR should make it possible to run make at

/tmp/grass8-tomas-32426/tmp9uhgtrug/r.accumulate/grass_addons

This would open the possibility to support installation of multiple (or all) addons in g.extension. However, the addon name as directory would be no longer meaningful at that point. But that would be another PR / next step...

I really appreciate you are stress-testing the SVN replacement, @tmszi , as g.extension is a quite central module...

…extension dir path string line

Catch two cases:

1. CI test_github_download_official_module_src_code_only test stderr:

```
Path to the source code:

/tmp/grass8-tomas-16151/tmpg1l_wggn/db.join/grass_addons/src/db/db.join
```

2. Local running test_github_download_official_module_src_code_only test
stderr:

```
Path to the source code:
/tmp/grass8-tomas-16151/tmpg1l_wggn/db.join/grass_addons/src/db/db.join
```
@tmszi tmszi merged commit 0c6d351 into OSGeo:main Apr 22, 2023
@tmszi tmszi deleted the g_extension-fix-download-only-src-code-ext-dir-path branch April 22, 2023 06:10
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants