Skip to content

opam: Use mandatory --set-default flag when adding new repo instance

Antoine R. Dumont requested to merge staging-fix-opam-routine into production

This is mandatory to ensure all packages metadata from all opam instances can be queried with the opam show command [1]

This adds the new repository instance to the default switch (one created during the first opam init call).

Refs. swh/infra/sysadm-environment#4971 (closed)

[1] Refs. swh/devel/swh-lister!482 (comment 143208) (onward)

$ $SWH_PUPPET_ENVIRONMENT_HOME/bin/octocatalog-diff --to staging worker01
Found host worker01.softwareheritage.org
Cloning into '/tmp/swh-ocd.xmsVgsGe/swh-site'...
done.
branch 'staging' set up to track 'origin/staging'.
Switched to a new branch 'staging'
Cloning into '/tmp/swh-ocd.xmsVgsGe/environments/production/data/private'...
done.
Cloning into '/tmp/swh-ocd.xmsVgsGe/environments/staging/data/private'...
done.
*** Running octocatalog-diff on host worker01.softwareheritage.org
I, [2023-06-30T18:02:06.639098 #3044710]  INFO -- : Catalogs compiled for worker01.softwareheritage.org
I, [2023-06-30T18:02:07.029566 #3044710]  INFO -- : Diffs computed for worker01.softwareheritage.org
diff origin/production/worker01.softwareheritage.org current/worker01.softwareheritage.org
*******************************************
  File[/usr/local/bin/opam-manage-shared-state.sh] =>
   parameters =>
     content =>
      @@ -35,4 +35,7 @@
         # prior to calling this one.
      _
      +  # This installs all instances in the main "switch", hence the use of --set-default in
      +  # the opam repository add call.
      +
         instance_name=$1
         instance_url=$2
      @@ -41,5 +44,8 @@
           $CMD update --root $ROOT_DIR
         else
      -    $CMD repository add --root $ROOT_DIR --all-switches $instance_name $instance_url
      +    # Add the new instance repository in the main "switch" (independent installation
      +    # "repository" prefix with its own compiler and sets of installed and pinned
      +    # packages). The "main" one being the one used at installation time.
      +    $CMD repository add --root $ROOT_DIR --set-default $instance_name $instance_url
         fi
       }
*******************************************
*** End octocatalog-diff on worker01.softwareheritage.org

cc @anlambert

Edited by Antoine R. Dumont

Merge request reports