(setf forgerie-phabricator:*repository-overrides*
'(
(:KEY 9 :ACTION :SKIP :SHORTNAME "git-loader-test-data")
(:KEY 15 :ACTION :UPDATE :DATA (:name "Credentials passwords keys etc"))
(:KEY 40 :ACTION :SKIP :SHORTNAME "org-slides")
(:KEY 42 :ACTION :SKIP :SHORTNAME "pg-hash")
(:KEY 48 :ACTION :SKIP :SHORTNAME "swh-statistics")
(:KEY 58 :ACTION :UPDATE :DATA (:name "Subversion loader"))
(:KEY 60 :ACTION :UPDATE :DATA (:name "Generic VCS and Package Loader"))
(:KEY 62 :ACTION :SKIP :SHORTNAME "FFEventFeed")
(:KEY 65 :ACTION :SKIP :SHORTNAME "staging")
(:KEY 67 :ACTION :SKIP :SHORTNAME "gsdgh")
(:KEY 73 :ACTION :SKIP :SHORTNAME "python-subvertpy")
(:KEY 89 :ACTION :UPDATE :DATA (:name "Manage etc resolv.conf with puppet"))
(:KEY 90 :ACTION :UPDATE :DATA (:name "Icinga 2 Puppet Module"))
(:KEY 102 :ACTION :UPDATE :DATA (:name "Web user interface - Django"))
(:KEY 105 :ACTION :UPDATE :DATA (:name "Manage entries in the Debian debconf database with Puppet"))
(:KEY 109 :ACTION :UPDATE :DATA (:name "Puppet NGINX management module"))
(:KEY 111 :ACTION :SKIP :SHORTNAME "test_pger")
(:KEY 114 :ACTION :SKIP :SHORTNAME "repos-git_1") ;; found through mysql
(:KEY 130 :ACTION :UPDATE :DATA (:name "Hello World"))
(:KEY 152 :ACTION :SKIP :SHORTNAME "swh-memory-graph")
(:KEY 160 :ACTION :SKIP :SHORTNAME "ci-environment") ;; empty
(:KEY 161 :ACTION :UPDATE :DATA (:name "Private Puppet Data - censored"))
(:KEY 195 :ACTION :UPDATE :DATA (:name "Cassandra and replayer deploment"))
(:KEY 202 :ACTION :UPDATE :DATA (:name "CodeMeta Generator - mirror"))
(:KEY 204 :ACTION :SKIP :SHORTNAME "swhapguide") ;; swhap guidelines
(:KEY 233 :ACTION :SKIP :SHORTNAME "test")
(:KEY 236 :ACTION :SKIP :SHORTNAME "python3-django-test-migrations")
(:KEY 239 :ACTION :SKIP :SHORTNAME "scrabble")
(:KEY 241 :ACTION :SKIP :SHORTNAME "python-pure-sasl")
(:KEY 245 :ACTION :SKIP :SHORTNAME "training-mob-programming")
(:KEY 249 :ACTION :SKIP :SHORTNAME "python3-py4j")
(:KEY 265 :ACTION :SKIP :SHORTNAME "django-rename-app")
))
; A function that takes an argument of a forgerie-core:merge-request and
; returns a string that will be appended to the description of created merge requests.
;
; Useful to create backlinks to the previous system, or addition migration information
(setf forgerie-gitlab:*merge-request-suffix*
(lambda (mr)
(let ((mr-id (forgerie-core:merge-request-id mr)))
(format nil "~%~%Migrated from D~A ([original](https://forge.softwareheritage.org/D~A))"
mr-id mr-id))))
; A function that takes an argument of a forgerie-core:ticket and
; returns a string that will be appended to the description of created tickets (issues).
;
; Useful to create backlinks to the previous system, or addition migration information
(setf forgerie-gitlab:*ticket-suffix*
(lambda (ticket)
(let ((ticket-id (forgerie-core:ticket-id ticket)))
(format nil "~%~%Migrated from T~A ([original](https://forge.softwareheritage.org/T~A))"
ticket-id ticket-id))))
;; Namespace structure
;; - Group: Software Heritage
;; - repos: python projects in a flat namespace
;; - Group: Infrastructure
;; - Group: Jenkins
;; - repos: jenkins-related repos
;; - Group: Puppet
;; - repos: our own puppet repos (puppet-swh-*)
;; - Group: puppet dependencies
;; - Group: Provisioning
;; - Group: git-annex
;; - Group: Teams
;; - Group: staff
;; - Group: HR
;; - Group: Research
;; - repos: papers
(setf forgerie-gitlab:*group-structure*
'((:name "Software Heritage" :path "modules")
(:name "Fixtures" :path "fixtures" :parent "modules")
(:name "Experiments" :path "experiments" :parent "modules")
(:name "Infrastructure" :path "infrastructure")
(:name "CI/CD" :path "ci-cd" :parent "infrastructure")
(:name "Puppet" :path "puppet" :parent "infrastructure")
(:name "Websites" :path "websites" :parent "infrastructure")
(:name "Annex" :path "annex" :parent "infrastructure")
(:name "Experiments" :path "experiments" :parent "infrastructure")
(:name "Puppet Dependencies" :path "dependencies" :parent "infrastructure/puppet")
(:name "CI/CD Dependencies" :path "dependencies" :parent "infrastructure/ci-cd")
;; (:name "Provisioning" :path "provisioning" :parent "infrastructure")
(:name "Teams" :path "teams")
(:name "Staff" :path "staff" :parent "teams")
(:name "Management" :path "management" :parent "teams")
(:name "System Administrators" :path "sysadmin" :parent "teams")
(:name "Interns" :path "interns" :parent "teams")
(:name "Research" :path "research")
(:name "Papers" :path "papers" :parent "research")
(:name "Experiments" :path "experiments" :parent "research")
))
(defun from-cache (wdir dir id)
"Read cache information from *working-directory*/<DIR>/<ID>"
(let ((cache-path (format nil "~A/~A/~A" wdir dir id)))
(when (probe-fiple cache-path)
(with-open-file (stream cache-path)
(read stream)))))
;; (let ((filepath "/var/tmp/forgerie/phabricator/everything/repositories"))
;; (when (probe-file filepath)
;; (with-open-file (str filepath)
;; (read str))))
(setf *repositories-cache*
(from-cache "/var/tmp/migrate-gitlab/forgerie/phabricator" "everything" "repositories"))
;; (setf *projects-cache*
;; (from-cache "/var/tmp/migrate-gitlab/forgerie/phabricator" "everything" "projects"))
;; (forgerie-core:vc-repository-slug (first *repositories-cache*)) ; => "puppet-environment"
;; (getf (first *repositories-cache*) :name)
(defun mapping-repo (repo)
(let*
((repo-slug (forgerie-core:vc-repository-slug repo))
(repo-tags
(remove-duplicates
(apply #'append
(mapcar
#'forgerie-core:project-tags
(append
(forgerie-core:vc-repository-primary-projects repo)
(forgerie-core:vc-repository-projects repo))))
:test #'string=)))
(cond
;; puppet repositories
((str:starts-with? "puppet-swh-" repo-slug) "infrastructure/puppet")
((string= "puppet-environment" repo-slug) "infrastructure/puppet")
((str:starts-with? "puppet-" repo-slug) "infrastructure/puppet/dependencies")
;; sysadmin stuff
((string= "swh-mirror" repo-slug) "infrastructure")
((string= "swh-sysadmin" repo-slug) "infrastructure")
((string= "iFWCFG" repo-slug) "infrastructure") ;; opnsense
((string= "limnoria-plugins" repo-slug) "infrastructure")
;; sysadm experiment
((string= "storage-benchmark-deployment" repo-slug) "infrastructure/experiments")
((string= "cassandra-replayer-deployment" repo-slug) "infrastructure/experiments")
;; websites and related
((string= "swh-keycloak-theme" repo-slug) "infrastructure/websites")
((string= "www.softwareheritage.org-gandi" repo-slug) "infrastructure/websites")
((string= "tools-mediawiki" repo-slug) "infrastructure/websites")
;; ci
((string= "swh-jenkins" repo-slug) "infrastructure/ci-cd")
((string= "swh-charts" repo-slug) "infrastructure")
((string= "forgerie" repo-slug) "infrastructure")
;; management
((string= "management" repo-slug) "teams/management")
((string= "team-management" repo-slug) "teams/management")
((string= "opdocs" repo-slug) "teams/management")
((string= "strategy" repo-slug) "teams/management")
((string= "gsoc-management" repo-slug) "teams/management")
((string= "swh-strategic-plan" repo-slug) "teams/management")
;; swh modules
((string= "swh-environment" repo-slug) "modules")
((string= "snippets" repo-slug) "modules")
((string= "swh-docs" repo-slug) "modules")
((string= "swh-loader-deposit" repo-slug) "modules")
((string= "swh-mirror-forge" repo-slug) "modules")
((string= "swh-storage-cassandra" repo-slug) "modules")
((string= "swh-docker-dev" repo-slug) "modules")
((string= "swh-web-django" repo-slug) "modules")
;; swh modules fixtures
((string= "jesuisgpl" repo-slug) "modules/fixtures")
((string= "helloworld" repo-slug) "modules/fixtures")
((string= "swh-storage-testdata" repo-slug) "modules/fixtures")
((string= "maven-index-exporter" repo-slug) "modules/fixtures")
((string= "codemeta-generator" repo-slug) "modules/fixtures")
;; swh modules experiments
((string= "pristine-zip" repo-slug) "modules/experiments")
((string= "mirror-tryout" repo-slug) "modules/experiments")
((string= "swh-db-audit" repo-slug) "modules/experiments")
((string= "listandsavegforge" repo-slug) "modules/experiments")
;; debian package dependencies
((str:starts-with? "python3-" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "universal-ctags" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "fossology-nomossa" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "python-cassandra-driver" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "django-webpack-loader" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "djangorestframework-xml" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "python-elasticsearch" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "monitoring-plugins-systemd" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "flask-api-debian-packaging" repo-slug) "infrastructure/ci-cd/dependencies")
((string= "flask-testing-debian-packaging" repo-slug) "infrastructure/ci-cd/dependencies")
;; research papers
((str:starts-with? "paper-" repo-slug) "research/papers")
((str:starts-with? "paper_" repo-slug) "research/papers")
((string= "emse-topology" repo-slug) "research/papers")
((string= "swh-topology-rr" repo-slug) "research/papers")
((string= "swhbib" repo-slug) "research/papers")
;; research experiments
;; git-annex
((str:starts-with? "annex-" repo-slug) "infrastructure/annex")
;; slides
((string= "slides" repo-slug) "teams/staff")
((string= "swh-style" repo-slug) "teams/staff")
;; user related
((string= "seirl-data" repo-slug) "seirl")
;; internship
((string= "internship-lang-detection" repo-slug) "teams/interns")
((string= "metadata" repo-slug) "teams/interns")
;; default
((find "packagers" repo-tags :test #'string=) "infrastructure/ci-cd/dependencies")
((find "continuous_integration" repo-tags :test #'string=) "infrastructure/ci-cd")
((find "language-puppet" repo-tags :test #'string=) "infrastructure/puppet")
((find "language-python" repo-tags :test #'string=) "modules")
((find "system_administrators" repo-tags :test #'string=) "infrastructure")
((find "system_administration" repo-tags :test #'string=) "infrastructure")
(t nil))))
;; slides, org-slides in team "speakers"?
;; how to deal
(setf forgerie-gitlab:*namespace-for-repo* 'mapping-repo)
(setf *print-miser-width* nil)
(setf *print-length* nil)
(setf *print-right-margin* 200)
(let* ((repos *repositories-cache*)
;; transform into a list of repositories to skip
(ignored-repos (remove-if-not #'identity
(mapcar (lambda (e) (let ((short (getf e :SHORTNAME)))
(when short short)))
forgerie-phabricator:*repository-overrides*)))
;; filter out repositories present in ignored-repos
(filtered-repos
(remove-if
(lambda (repo)
(let ((slug (forgerie-core:vc-repository-slug repo)))
(find slug ignored-repos :test #'string=)))
repos))
;; compute and sort the mapping for each repository
(tuples (sort
(mapcar
(lambda (repo)
(list (mapping-repo repo) (forgerie-core:vc-repository-slug repo) (forgerie-core:vc-repository-name repo)))
filtered-repos)
#'string-lessp :key #'first)))
;; and print it
(mapc 'pprint tuples)
nil)
(setf forgerie-phabricator:*included-repositories* nil
;; '("training-mob-programming" ;; private repository (well staff tagged)
;; "puppet-swh-site"
;; "swh-sysadmin-provisioning"
;; "puppet-environment"
;; ;; extra
;; "puppet-swh-postfix"
;; "getsentry-onpremise"
;; "puppet-puppet-grafana"
;; "puppet-theforeman-puppet"
;; "puppet-camptocamp-systemd"
;; "puppet-elastic-elastic_stack"
;; "puppet-puppetlabs-postgresql"
;; "puppet-puppetlabs-apache"
;; "puppet-icinga-icinga2"
;; "puppet-ssm-hitch"
;; "puppet-puppetlabs-puppetdb"
;; "puppet-puppet-letsencrypt"
;; "puppet-elastic-elasticsearch"
;; "puppet-openstack-ceph"
;; "puppet-puppet-nginx"
;; "puppet-icinga-icingaweb2"
;; "puppet-puppet-unattended_upgrades"
;; "puppet-puppet-cassandra"
;; "puppet-treydock-keycloak"
;; "puppet-puppet-archive"
;; "puppet-deric-zookeeper"
;; "puppet-puppet-redis"
;; "puppet-puppetlabs-mysql"
;; "puppet-puppet-extlib"
;; "puppet-puppetlabs-java_ks"
;; "puppet-puppetlabs-apt"
;; "puppet-puppetlabs-java"
;; "puppet-saz-memcached"
;; "puppet-puppetlabs-vcsrepo"
;; "puppet-puppetlabs-inifile"
;; "puppet-puppetlabs-stdlib"
;; "puppet-puppetlabs-concat"
;; "puppet-puppetlabs-docker"
;; "puppet-puppet-rabbitmq"
;; "puppet-puppetlabs-ntp"
;; "puppet-puppet-php"
;; "puppet-stm-debconf"
;; "puppet-saz-ssh"
;; "puppet-saz-sudo"
;; "puppet-saz-resolv_conf"
;; "puppet-saz-locales"
;; "puppet-puppet-kafka"
;; "puppet-swh-mediawiki"
;; "puppet-saz-timezone"
;; "puppet-puppetlabs-translate"
;; "puppet-swh-gunicorn"
;; "swh-grafana-dashboards"
;; "puppet-trepasi-debnet"
;; "puppet-ssm-munin"
;; "puppet-claranet-varnish"
;; "puppet-swh-uwsgi"
;; "puppet-swh-systemd"
;; "puppet-swh-dar"
;; "puppet-covermymeds-pgbouncer"
;; "puppet-swh-profile"
;; "puppet-swh-role"
;; "puppet-inkblot-bind"
;; "puppet-wikimedia-zookeeper"
;; "puppet-puppet-prometheus"
;; "puppet-thias-php"
;; "puppet-richardc-datacat"
;; "puppet-mosen-cups"
;; "puppet-wikimedia-kafka"
;; "puppet-arioch-redis"
;; "puppet-ripienaar-module_data"
;; "puppet-rlenglet-debconf_package"
;; "puppet-swh-private-data-censored"
;; "swh-jenkins-jobs"
;; "swh-jenkins-dockerfiles"
;; "swh-ansible"
;; )
)