← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~lgp171188/launchpad:how-to-importing-an-ubuntu-package into launchpad:master

 

Guruprasad has proposed merging ~lgp171188/launchpad:how-to-importing-an-ubuntu-package into launchpad:master.

Commit message:
Add a how-to for importing an Ubuntu package in the dev environment


Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/430141
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:how-to-importing-an-ubuntu-package into launchpad:master.
diff --git a/doc/how-to/importing-an-ubuntu-package.rst b/doc/how-to/importing-an-ubuntu-package.rst
new file mode 100644
index 0000000..39c79e9
--- /dev/null
+++ b/doc/how-to/importing-an-ubuntu-package.rst
@@ -0,0 +1,55 @@
+===========================
+Importing an Ubuntu package
+===========================
+
+It may be necessary to import an Ubuntu package into the local Launchpad instance
+for testing - the UCT import script requires the package mentioned in a CVE file
+to be present before it can create a vulnerability corresponding to the CVE.
+
+This can be done using ``debmirror`` and the ``scripts/gina.py`` script. Install
+``debmirror``, if it is not installed already.
+
+Create a directory to store the partial mirror and perform a sync.
+
+.. code-block:: bash
+
+    $ mkdir /tmp/gina_test_archive
+    $ cd /tmp/gina_test_archive
+    $ # This syncs just the focal amd64 packages starting with 'bash'
+    $ debmirror -v --method=http --arch=amd64 -d focal --no-check-gpg --exclude='/*' --include='/bash' /tmp/gina_test_archive
+
+Configure the mirror path in ``configs/schema-lazr.conf`` by adding the following section
+
+.. code-block:: ini
+
+    [gina_target.focal]
+    root: /tmp/gina_test_archive
+    distro: ubuntu
+    distroseries: focal
+    pocketrelease: focal
+    architectures: amd64
+
+The value for the ``root`` key must match path in which the partial mirror was
+created above. The ubuntu release and the architecture used in the ``debmirror`` command
+must match the values specified in the above configuration file.
+
+Run all the Launchpad services including the librarian in a separate session.
+
+.. code-block:: bash
+
+    $ cd ~/launchpad/launchpad
+    $ make run_all
+
+Run the ``scripts/gina.py`` script to import the packages from the partial mirror.
+
+.. code-block:: bash
+
+    $ cd ~/launchpad/launchpad
+    $ ./scripts/gina.py focal  # where 'focal' is the release used in the previous steps.
+
+
+The script will run and print a lot of errors for the packages missing in the partial mirror.
+These errors can be ignored. Once it finishes, check its output to see verify the ``bash``
+package, which is used in this example, has been imported and uploaded to librarian. If there
+are no errors importing the ``bash`` package, the package should now be available in
+the local Launchpad instance.
diff --git a/doc/how-to/index.rst b/doc/how-to/index.rst
index 7fae5e5..5054af2 100644
--- a/doc/how-to/index.rst
+++ b/doc/how-to/index.rst
@@ -34,6 +34,7 @@ Operating development instances
    new-user
    apply-schema-changes
    use-updated-dependency
+   importing-an-ubuntu-package
 
 Operating Canonical's instances
 -------------------------------
diff --git a/lib/lp/services/config/schema-lazr.conf b/lib/lp/services/config/schema-lazr.conf
index 82fdc73..4beef2e 100644
--- a/lib/lp/services/config/schema-lazr.conf
+++ b/lib/lp/services/config/schema-lazr.conf
@@ -778,6 +778,13 @@ source_only: false
 # datatype: boolean
 sourcepackagenames_only: false
 
+[gina_target.focal]
+root: /tmp/gina_test_archive
+components: main
+distro: ubuntu
+distroseries: focal
+pocketrelease: focal
+architectures: amd64
 
 [gina_target.hoary.optional]
 # This section is only used in tests. The test conf must set the key values.