diff --git a/tools/mothership/worker_server/srpm_import/srpm_import.go b/tools/mothership/worker_server/srpm_import/srpm_import.go index 892ec252..7d61f876 100644 --- a/tools/mothership/worker_server/srpm_import/srpm_import.go +++ b/tools/mothership/worker_server/srpm_import/srpm_import.go @@ -231,7 +231,7 @@ func (s *State) uploadLookasideBlobs(lookaside storage.Storage) error { // // For example: // -// SOURCES/bar 1234567890abcdef +// 1234567890abcdef SOURCES/bar func (s *State) writeMetadataFile(targetFS billy.Filesystem) error { // Open metadata file for writing. name, err := s.rpm.Header.GetStrings(rpmutils.NAME) @@ -249,7 +249,7 @@ func (s *State) writeMetadataFile(targetFS billy.Filesystem) error { // Write each line to the metadata file. for path, hash := range s.lookasideBlobs { // RPM sources MUST be in SOURCES/ directory - _, err = f.Write([]byte(filepath.Join("SOURCES", path) + " " + hash + "\n")) + _, err = f.Write([]byte(hash + " " + filepath.Join("SOURCES", path) + "\n")) if err != nil { return errors.Wrap(err, "failed to write line to metadata file") } @@ -467,7 +467,6 @@ func (s *State) populateTargetRepo(repo *git.Repository, targetFS billy.Filesyst } importStr := fmt.Sprintf("import %s-%s-%s", nevra.Name, nevra.Version, nevra.Release) hash, err := wt.Commit(importStr, &git.CommitOptions{ - All: true, Author: &object.Signature{ Name: s.authorName, Email: s.authorEmail, @@ -534,7 +533,8 @@ func (s *State) Import(opts *git.CloneOptions, storer storage2.Storer, targetFS } dist := elDistRegex.FindString(nevra.Release) err = s.pushTargetRepo(repo, &git.PushOptions{ - Auth: opts.Auth, + Force: true, + Auth: opts.Auth, RefSpecs: []config.RefSpec{ config.RefSpec(fmt.Sprintf("refs/heads/%s:refs/heads/%[1]s", dist)), config.RefSpec(fmt.Sprintf("refs/tags/imports/%s/*:refs/tags/imports/%[1]s/*", dist)), diff --git a/tools/mothership/worker_server/srpm_import/srpm_import_test.go b/tools/mothership/worker_server/srpm_import/srpm_import_test.go index 04062def..961b2747 100644 --- a/tools/mothership/worker_server/srpm_import/srpm_import_test.go +++ b/tools/mothership/worker_server/srpm_import/srpm_import_test.go @@ -150,7 +150,7 @@ func TestWriteMetadataFile(t *testing.T) { n, err := f.Read(buf) require.Nil(t, err) - require.Equal(t, "SOURCES/bash-4.4.tar.gz d86b3392c1202e8ff5a423b302e6284db7f8f435ea9f39b5b1b20fd3ac36dfcb\n", string(buf[:n])) + require.Equal(t, "d86b3392c1202e8ff5a423b302e6284db7f8f435ea9f39b5b1b20fd3ac36dfcb SOURCES/bash-4.4.tar.gz\n", string(buf[:n])) f, err = fs.Open(".gitignore") require.Nil(t, err) @@ -232,7 +232,7 @@ func TestWriteMetadataExpandLayout(t *testing.T) { buf, err := io.ReadAll(f) require.Nil(t, err) - require.Equal(t, "SOURCES/efi-rpm-macros-3.tar.bz2 f002f60baed7a47ca3e98b8dd7ece2f7352dac9ffab7ae3557eb56b481ce2f86\n", string(buf)) + require.Equal(t, "f002f60baed7a47ca3e98b8dd7ece2f7352dac9ffab7ae3557eb56b481ce2f86 SOURCES/efi-rpm-macros-3.tar.bz2\n", string(buf)) } func TestGetRepo_New(t *testing.T) { @@ -484,7 +484,7 @@ func TestPopulateTargetRepo_New(t *testing.T) { require.Nil(t, err) buf, err := io.ReadAll(f) require.Nil(t, err) - require.Equal(t, "SOURCES/efi-rpm-macros-3.tar.bz2 f002f60baed7a47ca3e98b8dd7ece2f7352dac9ffab7ae3557eb56b481ce2f86\n", string(buf)) + require.Equal(t, "f002f60baed7a47ca3e98b8dd7ece2f7352dac9ffab7ae3557eb56b481ce2f86 SOURCES/efi-rpm-macros-3.tar.bz2\n", string(buf)) // Verify layout ls, err := fs.ReadDir(".") @@ -621,7 +621,7 @@ func TestPopulateTargetRepo_Existing(t *testing.T) { require.Nil(t, err) buf, err := io.ReadAll(f) require.Nil(t, err) - require.Equal(t, "SOURCES/efi-rpm-macros-3.tar.bz2 f002f60baed7a47ca3e98b8dd7ece2f7352dac9ffab7ae3557eb56b481ce2f86\n", string(buf)) + require.Equal(t, "f002f60baed7a47ca3e98b8dd7ece2f7352dac9ffab7ae3557eb56b481ce2f86 SOURCES/efi-rpm-macros-3.tar.bz2\n", string(buf)) // Verify layout ls, err := fs.ReadDir(".") @@ -769,7 +769,7 @@ func TestImport1_New(t *testing.T) { require.Nil(t, err) buf, err := io.ReadAll(f) require.Nil(t, err) - require.Equal(t, "SOURCES/efi-rpm-macros-3.tar.bz2 f002f60baed7a47ca3e98b8dd7ece2f7352dac9ffab7ae3557eb56b481ce2f86\n", string(buf)) + require.Equal(t, "f002f60baed7a47ca3e98b8dd7ece2f7352dac9ffab7ae3557eb56b481ce2f86 SOURCES/efi-rpm-macros-3.tar.bz2\n", string(buf)) // Verify layout ls, err := fs.ReadDir(".") @@ -851,7 +851,7 @@ func TestImport2_New(t *testing.T) { require.Nil(t, err) buf, err := io.ReadAll(f) require.Nil(t, err) - require.Equal(t, "SOURCES/bash-4.4.tar.gz d86b3392c1202e8ff5a423b302e6284db7f8f435ea9f39b5b1b20fd3ac36dfcb\n", string(buf)) + require.Equal(t, "d86b3392c1202e8ff5a423b302e6284db7f8f435ea9f39b5b1b20fd3ac36dfcb SOURCES/bash-4.4.tar.gz\n", string(buf)) // Verify layout ls, err := fs.ReadDir(".")